mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-20 01:15:35 +01:00
Core/Commands: Improved additem and additemset commands. Added optional parameter allowing to specify bonuslist ids for items (you can copy the ids from wowhead urls)
This commit is contained in:
@@ -1175,6 +1175,17 @@ public:
|
||||
if (count == 0)
|
||||
count = 1;
|
||||
|
||||
std::vector<int32> bonusListIDs;
|
||||
char const* bonuses = strtok(NULL, " ");
|
||||
|
||||
// semicolon separated bonuslist ids (parse them after all arguments are extracted by strtok!)
|
||||
if (bonuses)
|
||||
{
|
||||
Tokenizer tokens(bonuses, ';');
|
||||
for (char const* token : tokens)
|
||||
bonusListIDs.push_back(atoul(token));
|
||||
}
|
||||
|
||||
Player* player = handler->GetSession()->GetPlayer();
|
||||
Player* playerTarget = handler->getSelectedPlayer();
|
||||
if (!playerTarget)
|
||||
@@ -1214,7 +1225,7 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
Item* item = playerTarget->StoreNewItem(dest, itemId, true, Item::GenerateItemRandomPropertyId(itemId));
|
||||
Item* item = playerTarget->StoreNewItem(dest, itemId, true, Item::GenerateItemRandomPropertyId(itemId), GuidSet(), bonusListIDs);
|
||||
|
||||
// remove binding (let GM give it to another player later)
|
||||
if (player == playerTarget)
|
||||
@@ -1254,6 +1265,17 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
std::vector<int32> bonusListIDs;
|
||||
char const* bonuses = strtok(NULL, " ");
|
||||
|
||||
// semicolon separated bonuslist ids (parse them after all arguments are extracted by strtok!)
|
||||
if (bonuses)
|
||||
{
|
||||
Tokenizer tokens(bonuses, ';');
|
||||
for (char const* token : tokens)
|
||||
bonusListIDs.push_back(atoul(token));
|
||||
}
|
||||
|
||||
Player* player = handler->GetSession()->GetPlayer();
|
||||
Player* playerTarget = handler->getSelectedPlayer();
|
||||
if (!playerTarget)
|
||||
@@ -1272,7 +1294,7 @@ public:
|
||||
InventoryResult msg = playerTarget->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itr->second.GetId(), 1);
|
||||
if (msg == EQUIP_ERR_OK)
|
||||
{
|
||||
Item* item = playerTarget->StoreNewItem(dest, itr->second.GetId(), true);
|
||||
Item* item = playerTarget->StoreNewItem(dest, itr->second.GetId(), true, 0, GuidSet(), bonusListIDs);
|
||||
|
||||
// remove binding (let GM give it to another player later)
|
||||
if (player == playerTarget)
|
||||
|
||||
Reference in New Issue
Block a user