diff options
-rw-r--r-- | sql/updates/world/2015_11_09_02_world.sql | 2 | ||||
-rw-r--r-- | src/server/scripts/Commands/cs_misc.cpp | 26 |
2 files changed, 26 insertions, 2 deletions
diff --git a/sql/updates/world/2015_11_09_02_world.sql b/sql/updates/world/2015_11_09_02_world.sql new file mode 100644 index 00000000000..6cccbef3d41 --- /dev/null +++ b/sql/updates/world/2015_11_09_02_world.sql @@ -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'; diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp index 9a2cd919f6f..f848cba4c56 100644 --- a/src/server/scripts/Commands/cs_misc.cpp +++ b/src/server/scripts/Commands/cs_misc.cpp @@ -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) |