diff --git a/Source/Framework/Constants/Language.cs b/Source/Framework/Constants/Language.cs index 2adb9c570..d2face90c 100644 --- a/Source/Framework/Constants/Language.cs +++ b/Source/Framework/Constants/Language.cs @@ -667,10 +667,11 @@ namespace Framework.Constants Gmlist = 597, GmlistHeader = 598, GmlistEmpty = 599, + RemoveitemFailure = 600, // End Level 3 List, Continued At 1100 - // 600-704 - free + // 601-704 - free WaitBeforeSpeaking = 705, NotEquippedItem = 706, diff --git a/Source/Game/Chat/Commands/MiscCommands.cs b/Source/Game/Chat/Commands/MiscCommands.cs index 54a842493..385c6e5ba 100644 --- a/Source/Game/Chat/Commands/MiscCommands.cs +++ b/Source/Game/Chat/Commands/MiscCommands.cs @@ -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; } diff --git a/Source/Game/Entities/Player/Player.Items.cs b/Source/Game/Entities/Player/Player.Items.cs index ef867895e..d848a0169 100644 --- a/Source/Game/Entities/Player/Player.Items.cs +++ b/Source/Game/Entities/Player/Player.Items.cs @@ -5515,7 +5515,7 @@ namespace Game.Entities } } - public void DestroyItemCount(uint itemEntry, uint count, bool update, bool unequip_check = true) + public uint DestroyItemCount(uint itemEntry, uint count, bool update, bool unequip_check = true) { Log.outDebug(LogFilter.Player, "STORAGE: DestroyItemCount item = {0}, count = {1}", itemEntry, count); uint remcount = 0; @@ -5536,7 +5536,7 @@ namespace Game.Entities DestroyItem(InventorySlots.Bag0, i, update); if (remcount >= count) - return; + return remcount; } else { @@ -5545,7 +5545,7 @@ namespace Game.Entities if (IsInWorld && update) item.SendUpdateToPlayer(this); item.SetState(ItemUpdateState.Changed, this); - return; + return remcount; } } } @@ -5571,7 +5571,7 @@ namespace Game.Entities DestroyItem(i, j, update); if (remcount >= count) - return; + return remcount; } else { @@ -5580,7 +5580,7 @@ namespace Game.Entities if (IsInWorld && update) item.SendUpdateToPlayer(this); item.SetState(ItemUpdateState.Changed, this); - return; + return remcount; } } } @@ -5604,7 +5604,7 @@ namespace Game.Entities DestroyItem(InventorySlots.Bag0, i, update); if (remcount >= count) - return; + return remcount; } } else @@ -5614,7 +5614,7 @@ namespace Game.Entities if (IsInWorld && update) item.SendUpdateToPlayer(this); item.SetState(ItemUpdateState.Changed, this); - return; + return remcount; } } } @@ -5633,7 +5633,7 @@ namespace Game.Entities remcount += item.GetCount(); DestroyItem(InventorySlots.Bag0, i, update); if (remcount >= count) - return; + return remcount; } else { @@ -5642,7 +5642,7 @@ namespace Game.Entities if (IsInWorld && update) item.SendUpdateToPlayer(this); item.SetState(ItemUpdateState.Changed, this); - return; + return remcount; } } } @@ -5668,7 +5668,7 @@ namespace Game.Entities DestroyItem(i, j, update); if (remcount >= count) - return; + return remcount; } else { @@ -5677,7 +5677,7 @@ namespace Game.Entities if (IsInWorld && update) item.SendUpdateToPlayer(this); item.SetState(ItemUpdateState.Changed, this); - return; + return remcount; } } } @@ -5700,7 +5700,7 @@ namespace Game.Entities remcount += item.GetCount(); DestroyItem(InventorySlots.Bag0, i, update); if (remcount >= count) - return; + return remcount; } } else @@ -5710,7 +5710,7 @@ namespace Game.Entities if (IsInWorld && update) item.SendUpdateToPlayer(this); item.SetState(ItemUpdateState.Changed, this); - return; + return remcount; } } } @@ -5730,7 +5730,7 @@ namespace Game.Entities DestroyItem(InventorySlots.Bag0, i, update); if (remcount >= count) - return; + return remcount; } else { @@ -5739,7 +5739,7 @@ namespace Game.Entities if (IsInWorld && update) item.SendUpdateToPlayer(this); item.SetState(ItemUpdateState.Changed, this); - return; + return remcount; } } } @@ -5759,7 +5759,7 @@ namespace Game.Entities DestroyItem(InventorySlots.Bag0, i, update); if (remcount >= count) - return; + return remcount; } else { @@ -5768,11 +5768,13 @@ namespace Game.Entities if (IsInWorld && update) item.SendUpdateToPlayer(this); item.SetState(ItemUpdateState.Changed, this); - return; + return remcount; } } } } + + return remcount; } public void DestroyItemCount(Item pItem, ref uint count, bool update) { diff --git a/sql/updates/world/master/2021_12_19_24_world_2019_12_28_01_world.sql b/sql/updates/world/master/2021_12_19_24_world_2019_12_28_01_world.sql new file mode 100644 index 000000000..68519239a --- /dev/null +++ b/sql/updates/world/master/2021_12_19_24_world_2019_12_28_01_world.sql @@ -0,0 +1,4 @@ +-- +delete from `trinity_string` where `entry`=600; +insert into `trinity_string` (entry,content_default,content_loc1,content_loc2,content_loc3,content_loc4,content_loc5,content_loc6,content_loc7,content_loc8) values +(600, "Failed to remove itemID = %i, amount = %i, from %s (No such item exists in target's inventory)", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);