mirror of
https://github.com/mangosfour/server.git
synced 2025-12-26 16:37:06 +00:00
[10751] Use objectguids in item code.
Also * Fixed unexpected container updated state after inventory load * Make .debug getitemstate command more friendly by args.
This commit is contained in:
parent
bbd34562a8
commit
2601022b9f
14 changed files with 173 additions and 110 deletions
|
|
@ -69,8 +69,8 @@ bool Bag::Create(uint32 guidlow, uint32 itemid, Player const* owner)
|
|||
SetEntry(itemid);
|
||||
SetObjectScale(DEFAULT_OBJECT_SCALE);
|
||||
|
||||
SetUInt64Value(ITEM_FIELD_OWNER, owner ? owner->GetGUID() : 0);
|
||||
SetUInt64Value(ITEM_FIELD_CONTAINED, owner ? owner->GetGUID() : 0);
|
||||
SetGuidValue(ITEM_FIELD_OWNER, owner ? owner->GetObjectGuid() : ObjectGuid());
|
||||
SetGuidValue(ITEM_FIELD_CONTAINED, owner ? owner->GetObjectGuid() : ObjectGuid());
|
||||
|
||||
SetUInt32Value(ITEM_FIELD_MAXDURABILITY, itemProto->MaxDurability);
|
||||
SetUInt32Value(ITEM_FIELD_DURABILITY, itemProto->MaxDurability);
|
||||
|
|
@ -82,7 +82,7 @@ bool Bag::Create(uint32 guidlow, uint32 itemid, Player const* owner)
|
|||
// Cleaning 20 slots
|
||||
for (uint8 i = 0; i < MAX_BAG_SIZE; ++i)
|
||||
{
|
||||
SetUInt64Value(CONTAINER_FIELD_SLOT_1 + (i*2), 0);
|
||||
SetGuidValue(CONTAINER_FIELD_SLOT_1 + (i*2), ObjectGuid());
|
||||
m_bagslot[i] = NULL;
|
||||
}
|
||||
|
||||
|
|
@ -94,15 +94,15 @@ void Bag::SaveToDB()
|
|||
Item::SaveToDB();
|
||||
}
|
||||
|
||||
bool Bag::LoadFromDB(uint32 guid, uint64 owner_guid, Field *fields)
|
||||
bool Bag::LoadFromDB(uint32 guidLow, Field *fields, ObjectGuid ownerGuid)
|
||||
{
|
||||
if(!Item::LoadFromDB(guid, owner_guid, fields))
|
||||
if (!Item::LoadFromDB(guidLow, fields, ownerGuid))
|
||||
return false;
|
||||
|
||||
// cleanup bag content related item value fields (its will be filled correctly from `character_inventory`)
|
||||
for (int i = 0; i < MAX_BAG_SIZE; ++i)
|
||||
{
|
||||
SetUInt64Value(CONTAINER_FIELD_SLOT_1 + (i*2), 0);
|
||||
SetGuidValue(CONTAINER_FIELD_SLOT_1 + (i*2), ObjectGuid());
|
||||
if (m_bagslot[i])
|
||||
{
|
||||
delete m_bagslot[i];
|
||||
|
|
@ -140,7 +140,7 @@ void Bag::RemoveItem( uint8 slot, bool /*update*/ )
|
|||
m_bagslot[slot]->SetContainer(NULL);
|
||||
|
||||
m_bagslot[slot] = NULL;
|
||||
SetUInt64Value( CONTAINER_FIELD_SLOT_1 + (slot * 2), 0 );
|
||||
SetGuidValue(CONTAINER_FIELD_SLOT_1 + (slot*2), ObjectGuid());
|
||||
}
|
||||
|
||||
void Bag::StoreItem( uint8 slot, Item *pItem, bool /*update*/ )
|
||||
|
|
@ -150,9 +150,9 @@ void Bag::StoreItem( uint8 slot, Item *pItem, bool /*update*/ )
|
|||
if( pItem )
|
||||
{
|
||||
m_bagslot[slot] = pItem;
|
||||
SetUInt64Value(CONTAINER_FIELD_SLOT_1 + (slot * 2), pItem->GetGUID());
|
||||
pItem->SetUInt64Value(ITEM_FIELD_CONTAINED, GetGUID());
|
||||
pItem->SetUInt64Value( ITEM_FIELD_OWNER, GetOwnerGUID() );
|
||||
SetGuidValue(CONTAINER_FIELD_SLOT_1 + (slot * 2), pItem->GetObjectGuid());
|
||||
pItem->SetGuidValue(ITEM_FIELD_CONTAINED, GetObjectGuid());
|
||||
pItem->SetGuidValue(ITEM_FIELD_OWNER, GetOwnerGuid());
|
||||
pItem->SetContainer(this);
|
||||
pItem->SetSlot(slot);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue