diff --git a/data/sql/updates/pending_db_world/rev_1587062218041221300.sql b/data/sql/updates/pending_db_world/rev_1587062218041221300.sql new file mode 100644 index 000000000..2331c68be --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1587062218041221300.sql @@ -0,0 +1,8 @@ +INSERT INTO `version_db_world` (`sql_rev`) VALUES ('1587062218041221300'); + +DELETE FROM `acore_string` WHERE `entry` IN (30081,30082); +INSERT INTO `acore_string` (`entry`, `content_default`) VALUES +(30081, "%s does not have itemID = %i, thus cannot be removed."), +(30082, "%s does not have that many of itemID = %i, thus none were removed."); + +UPDATE `command` SET `help` = "Syntax: .additem #itemID/[#itemName]/#itemLink #itemCount\r\nAdds the specified item to you or the selected character.\nIf #itemCount is negative, you will remove #itemID." WHERE `name` = "additem"; diff --git a/src/server/game/Miscellaneous/Language.h b/src/server/game/Miscellaneous/Language.h index 6cb7b489b..2799337bd 100644 --- a/src/server/game/Miscellaneous/Language.h +++ b/src/server/game/Miscellaneous/Language.h @@ -1314,6 +1314,9 @@ enum AcoreStrings LANG_INSTANT_FLIGHT_ON = 30078, LANG_INSTANT_FLIGHT_OFF = 30079, - LANG_DEBUG_OPCODE_FILE_MISSING = 30080 + LANG_DEBUG_OPCODE_FILE_MISSING = 30080, + + LANG_REMOVEITEM_FAILURE = 30081, + LANG_REMOVEITEM_ERROR = 30082 }; #endif diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp index 7ff9fff76..b642ca67e 100644 --- a/src/server/scripts/Commands/cs_misc.cpp +++ b/src/server/scripts/Commands/cs_misc.cpp @@ -1466,8 +1466,23 @@ public: // Subtract if (count < 0) { - playerTarget->DestroyItemCount(itemId, -count, true, false); - handler->PSendSysMessage(LANG_REMOVEITEM, itemId, -count, handler->GetNameLink(playerTarget).c_str()); + if (!playerTarget->HasItemCount(itemId, 0)) + { + // output that player don't have any items to destroy + handler->PSendSysMessage(LANG_REMOVEITEM_FAILURE, handler->GetNameLink(playerTarget).c_str(), itemId); + } + else if (!playerTarget->HasItemCount(itemId, -count)) + { + // output that player don't have as many items that you want to destroy + handler->PSendSysMessage(LANG_REMOVEITEM_ERROR, handler->GetNameLink(playerTarget).c_str(), itemId); + } + else + { + // output successful amount of destroyed items + playerTarget->DestroyItemCount(itemId, -count, true, false); + handler->PSendSysMessage(LANG_REMOVEITEM, itemId, -count, handler->GetNameLink(playerTarget).c_str()); + } + return true; }