mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 13:37:05 +00:00
[11703] Proper way create items in Item::CreateItem/CloneItem for items not for inventory
Old code way work not allow create item without providing targeting player. In result creating item that will not placed to inventory required additional hacks for undo redundent links to player structures.
This commit is contained in:
parent
cc11366d6b
commit
0daf12a348
3 changed files with 7 additions and 5 deletions
|
|
@ -364,8 +364,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data)
|
|||
if (!pl->HasItemCount(it->GetEntry(), stackSize)) // not enough items
|
||||
continue;
|
||||
|
||||
Item *newItem = it->CloneItem(stackSize, pl);
|
||||
newItem->RemoveFromUpdateQueueOf(pl); // item not planned to adding to inventory
|
||||
Item *newItem = it->CloneItem(stackSize);
|
||||
|
||||
pl->DestroyItemCount(it, stackSize, true);
|
||||
|
||||
|
|
|
|||
|
|
@ -741,6 +741,7 @@ void Item::SetState(ItemUpdateState state, Player* forplayer)
|
|||
if (uState == ITEM_NEW && state == ITEM_REMOVED)
|
||||
{
|
||||
// pretend the item never existed
|
||||
if (forplayer || GetOwnerGuid())
|
||||
RemoveFromUpdateQueueOf(forplayer);
|
||||
delete this;
|
||||
return;
|
||||
|
|
@ -750,6 +751,8 @@ void Item::SetState(ItemUpdateState state, Player* forplayer)
|
|||
{
|
||||
// new items must stay in new state until saved
|
||||
if (uState != ITEM_NEW) uState = state;
|
||||
|
||||
if (forplayer || GetOwnerGuid())
|
||||
AddToUpdateQueueOf(forplayer);
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "11702"
|
||||
#define REVISION_NR "11703"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue