additional output for additem command
Port From (https://github.com/TrinityCore/TrinityCore/commit/72e61625bca5a8420fc76666db3481673b180a69)
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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);
|
||||
Reference in New Issue
Block a user