additional output for additem command

Port From (https://github.com/TrinityCore/TrinityCore/commit/72e61625bca5a8420fc76666db3481673b180a69)
This commit is contained in:
hondacrx
2022-01-05 23:29:15 -05:00
parent 43d3298724
commit f1a0e55cb5
4 changed files with 45 additions and 20 deletions
+20 -2
View File
@@ -123,8 +123,26 @@ namespace Game.Chat
// Subtract
if (count < 0)
{
playerTarget.DestroyItemCount(itemId, (uint)-count, true, false);
handler.SendSysMessage(CypherStrings.Removeitem, itemId, -count, handler.GetNameLink(playerTarget));
uint destroyedItemCount = playerTarget.DestroyItemCount(itemId, (uint)-count, true, false);
if (destroyedItemCount > 0)
{
// output the amount of items successfully destroyed
handler.SendSysMessage(CypherStrings.Removeitem, itemId, destroyedItemCount, handler.GetNameLink(playerTarget));
// check to see if we were unable to destroy all of the amount requested.
uint unableToDestroyItemCount = (uint)(-count - destroyedItemCount);
if (unableToDestroyItemCount > 0)
{
// output message for the amount of items we couldn't destroy
handler.SendSysMessage(CypherStrings.RemoveitemFailure, itemId, unableToDestroyItemCount, handler.GetNameLink(playerTarget));
}
}
else
{
// failed to destroy items of the amount requested
handler.SendSysMessage(CypherStrings.RemoveitemFailure, itemId, -count, handler.GetNameLink(playerTarget));
}
return true;
}