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:
Shauren
2015-11-09 17:57:37 +01:00
parent 26e7d01af6
commit dfc8ea0ad5
2 changed files with 26 additions and 2 deletions

View File

@@ -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)