diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/game/Guild.cpp | 2 | ||||
-rw-r--r-- | src/game/Item.cpp | 16 | ||||
-rw-r--r-- | src/game/Item.h | 2 | ||||
-rw-r--r-- | src/game/Player.cpp | 6 |
4 files changed, 13 insertions, 13 deletions
diff --git a/src/game/Guild.cpp b/src/game/Guild.cpp index 86b50a651fd..7d3bbdee9c9 100644 --- a/src/game/Guild.cpp +++ b/src/game/Guild.cpp @@ -2208,7 +2208,7 @@ void Guild::MoveFromCharToBank( Player * pl, uint8 PlayerBag, uint8 PlayerSlot, pl->ItemRemovedQuestCheck( pItemChar->GetEntry(), SplitedAmount ); pItemChar->SetCount(pItemChar->GetCount()-SplitedAmount); - pItemChar->SetState(ITEM_CHANGED); + pItemChar->SetState(ITEM_CHANGED, pl); pl->SaveInventoryAndGoldToDB(); StoreItem(BankTab, dest, pNewItem); CharacterDatabase.CommitTransaction(); diff --git a/src/game/Item.cpp b/src/game/Item.cpp index 7c2a49e10af..e08f2e2e5dc 100644 --- a/src/game/Item.cpp +++ b/src/game/Item.cpp @@ -598,7 +598,7 @@ void Item::SetItemRandomProperties(int32 randomPropId) { SetInt32Value(ITEM_FIELD_RANDOM_PROPERTIES_ID,-int32(item_rand->ID)); UpdateItemSuffixFactor(); - SetState(ITEM_CHANGED); + SetState(ITEM_CHANGED, GetOwner()); } for (uint32 i = PROP_ENCHANTMENT_SLOT_0; i < PROP_ENCHANTMENT_SLOT_0 + 3; ++i) @@ -631,8 +631,7 @@ void Item::SetState(ItemUpdateState state, Player *forplayer) if (uState != ITEM_NEW) uState = state; - if (forplayer) - AddToUpdateQueueOf(forplayer); + AddToUpdateQueueOf(forplayer); } else { @@ -818,16 +817,17 @@ void Item::SetEnchantment(EnchantmentSlot slot, uint32 id, uint32 duration, uint SetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot*MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_ID_OFFSET,id); SetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot*MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_DURATION_OFFSET,duration); SetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot*MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_CHARGES_OFFSET,charges); - SetState(ITEM_CHANGED); + SetState(ITEM_CHANGED, GetOwner()); } -void Item::SetEnchantmentDuration(EnchantmentSlot slot, uint32 duration) +void Item::SetEnchantmentDuration(EnchantmentSlot slot, uint32 duration, Player* owner) { if (GetEnchantmentDuration(slot) == duration) return; SetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot*MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_DURATION_OFFSET,duration); - SetState(ITEM_CHANGED); + SetState(ITEM_CHANGED, owner); + // Cannot use GetOwner() here, has to be passed as an argument to avoid freeze due to hashtable locking } void Item::SetEnchantmentCharges(EnchantmentSlot slot, uint32 charges) @@ -836,7 +836,7 @@ void Item::SetEnchantmentCharges(EnchantmentSlot slot, uint32 charges) return; SetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot*MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_CHARGES_OFFSET,charges); - SetState(ITEM_CHANGED); + SetState(ITEM_CHANGED, GetOwner()); } void Item::ClearEnchantment(EnchantmentSlot slot) @@ -846,7 +846,7 @@ void Item::ClearEnchantment(EnchantmentSlot slot) for (uint8 x = 0; x < 3; ++x) SetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot*MAX_ENCHANTMENT_OFFSET + x, 0); - SetState(ITEM_CHANGED); + SetState(ITEM_CHANGED, GetOwner()); } bool Item::GemsFitSockets() const diff --git a/src/game/Item.h b/src/game/Item.h index c0156fab8b6..9a520782f58 100644 --- a/src/game/Item.h +++ b/src/game/Item.h @@ -284,7 +284,7 @@ class Item : public Object bool UpdateItemSuffixFactor(); static int32 GenerateItemRandomPropertyId(uint32 item_id); void SetEnchantment(EnchantmentSlot slot, uint32 id, uint32 duration, uint32 charges); - void SetEnchantmentDuration(EnchantmentSlot slot, uint32 duration); + void SetEnchantmentDuration(EnchantmentSlot slot, uint32 duration, Player* owner); void SetEnchantmentCharges(EnchantmentSlot slot, uint32 charges); void ClearEnchantment(EnchantmentSlot slot); uint32 GetEnchantmentId(EnchantmentSlot slot) const { return GetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot*MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_ID_OFFSET);} diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 44c666c5ed0..a48cd7f2f8e 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -12558,7 +12558,7 @@ void Player::RemoveEnchantmentDurations(Item *item) if (itr->item == item) { // save duration in item - item->SetEnchantmentDuration(EnchantmentSlot(itr->slot), itr->leftduration); + item->SetEnchantmentDuration(EnchantmentSlot(itr->slot), itr->leftduration, this); itr = m_enchantDuration.erase(itr); } else @@ -12624,7 +12624,7 @@ void Player::AddEnchantmentDuration(Item *item,EnchantmentSlot slot,uint32 durat { if (itr->item == item && itr->slot == slot) { - itr->item->SetEnchantmentDuration(itr->slot, itr->leftduration); + itr->item->SetEnchantmentDuration(itr->slot, itr->leftduration, this); m_enchantDuration.erase(itr); break; } @@ -17456,7 +17456,7 @@ void Player::_SaveInventory() // update enchantment durations for (EnchantDurationList::iterator itr = m_enchantDuration.begin(); itr != m_enchantDuration.end(); ++itr) - itr->item->SetEnchantmentDuration(itr->slot,itr->leftduration); + itr->item->SetEnchantmentDuration(itr->slot,itr->leftduration, this); // if no changes if (m_itemUpdateQueue.empty()) |