mirror of
https://github.com/liyunfan1223/azerothcore-wotlk.git
synced 2026-08-08 15:58:04 +00:00
fix(Scripts/Commands): Fix '.send items' command to no longer require an itemId count (#16340)
* Fix '.send items' command to no longer require an itemId count * Remove leftover debugging output, oops.
This commit is contained in:
@@ -70,14 +70,21 @@ public:
|
|||||||
{
|
{
|
||||||
auto itemTokens = Acore::Tokenize(itemString, ':', false);
|
auto itemTokens = Acore::Tokenize(itemString, ':', false);
|
||||||
|
|
||||||
if (itemTokens.size() != 2)
|
uint32 itemCount;
|
||||||
|
switch (itemTokens.size())
|
||||||
{
|
{
|
||||||
handler->SendSysMessage(Acore::StringFormatFmt("> Incorrect item list format for '{}'", itemString));
|
case 1:
|
||||||
continue;
|
itemCount = 1; // Default to sending 1 item
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
itemCount = *Acore::StringTo<uint32>(itemTokens.at(1));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
handler->SendSysMessage(Acore::StringFormatFmt("> Incorrect item list format for '{}'", itemString));
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 itemID = *Acore::StringTo<uint32>(itemTokens.at(0));
|
uint32 itemID = *Acore::StringTo<uint32>(itemTokens.at(0));
|
||||||
uint32 itemCount = *Acore::StringTo<uint32>(itemTokens.at(1));
|
|
||||||
|
|
||||||
ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(itemID);
|
ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(itemID);
|
||||||
if (!itemTemplate)
|
if (!itemTemplate)
|
||||||
|
|||||||
Reference in New Issue
Block a user