mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-18 00:18:43 +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:
2
sql/updates/world/2015_11_09_02_world.sql
Normal file
2
sql/updates/world/2015_11_09_02_world.sql
Normal file
@@ -0,0 +1,2 @@
|
||||
UPDATE `command` SET `help`='Syntax: .additem #itemid/[#itemname]/#shift-click-item-link #itemcount #bonusListIDs\n\nAdds the specified number of items of id #itemid (or exact (!) name $itemname in brackets, or link created by shift-click at item in inventory or recipe) to your or selected character inventory. If #itemcount is omitted, only one item will be added. #bonusListIDs is a semicolon separated list of bonuses to add to item (such as Mythic/Heroic/Warforged/socket)' WHERE `name`='additem';
|
||||
UPDATE `command` SET `help`='Syntax: .additemset #itemsetid #bonusListIDs\n\nAdd items from itemset of id #itemsetid to your or selected character inventory. Will add by one example each item from itemset.\n\nIf the itemset has multiple levels it adds one of each item level. #bonusListIDs is a semicolon separated list of bonuses to add to all items (such as Mythic/Heroic/Warforged/socket)' WHERE `name`='additemset';
|
||||
@@ -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