diff options
Diffstat (limited to 'src/server/scripts')
-rw-r--r-- | src/server/scripts/Commands/cs_misc.cpp | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp index 81f01513035..af30a25abef 100644 --- a/src/server/scripts/Commands/cs_misc.cpp +++ b/src/server/scripts/Commands/cs_misc.cpp @@ -1263,8 +1263,27 @@ public: // Subtract if (count < 0) { - playerTarget->DestroyItemCount(itemId, -count, true, false); - handler->PSendSysMessage(LANG_REMOVEITEM, itemId, -count, handler->GetNameLink(playerTarget).c_str()); + uint32 destroyedItemCount = playerTarget->DestroyItemCount(itemId, -count, true, false); + + if (destroyedItemCount > 0) + { + // output the amount of items successfully destroyed + handler->PSendSysMessage(LANG_REMOVEITEM, itemId, destroyedItemCount, handler->GetNameLink(playerTarget).c_str()); + + // check to see if we were unable to destroy all of the amount requested. + uint32 unableToDestroyItemCount = -count - destroyedItemCount; + if (unableToDestroyItemCount > 0) + { + // output message for the amount of items we couldn't destroy + handler->PSendSysMessage(LANG_REMOVEITEM_FAILURE, itemId, unableToDestroyItemCount, handler->GetNameLink(playerTarget).c_str()); + } + } + else + { + // failed to destroy items of the amount requested + handler->PSendSysMessage(LANG_REMOVEITEM_FAILURE, itemId, -count, handler->GetNameLink(playerTarget).c_str()); + } + return true; } |