[7511] Fixed expertise update at items unequip/drop.

* Not attempt update at item move from slot in bag with equip-like slot number.
* Update at item drop from bag.
This commit is contained in:
VladimirMangos 2009-03-22 02:48:17 +03:00
parent ff48408dbb
commit 2885091dfe
2 changed files with 24 additions and 17 deletions

View file

@ -10707,21 +10707,27 @@ void Player::RemoveItem( uint8 bag, uint8 slot, bool update )
// remove item dependent auras and casts (only weapon and armor slots) // remove item dependent auras and casts (only weapon and armor slots)
if(slot < EQUIPMENT_SLOT_END) if(slot < EQUIPMENT_SLOT_END)
{
RemoveItemDependentAurasAndCasts(pItem); RemoveItemDependentAurasAndCasts(pItem);
// remove held enchantments // remove held enchantments, update expertise
if ( slot == EQUIPMENT_SLOT_MAINHAND ) if ( slot == EQUIPMENT_SLOT_MAINHAND )
{
if (pItem->GetItemSuffixFactor())
{ {
pItem->ClearEnchantment(PROP_ENCHANTMENT_SLOT_3); if (pItem->GetItemSuffixFactor())
pItem->ClearEnchantment(PROP_ENCHANTMENT_SLOT_4); {
} pItem->ClearEnchantment(PROP_ENCHANTMENT_SLOT_3);
else pItem->ClearEnchantment(PROP_ENCHANTMENT_SLOT_4);
{ }
pItem->ClearEnchantment(PROP_ENCHANTMENT_SLOT_0); else
pItem->ClearEnchantment(PROP_ENCHANTMENT_SLOT_1); {
pItem->ClearEnchantment(PROP_ENCHANTMENT_SLOT_0);
pItem->ClearEnchantment(PROP_ENCHANTMENT_SLOT_1);
}
UpdateExpertise(BASE_ATTACK);
} }
else if( slot == EQUIPMENT_SLOT_OFFHAND )
UpdateExpertise(OFF_ATTACK);
} }
} }
@ -10742,11 +10748,6 @@ void Player::RemoveItem( uint8 bag, uint8 slot, bool update )
pItem->SetSlot( NULL_SLOT ); pItem->SetSlot( NULL_SLOT );
if( IsInWorld() && update ) if( IsInWorld() && update )
pItem->SendUpdateToPlayer( this ); pItem->SendUpdateToPlayer( this );
if( slot == EQUIPMENT_SLOT_MAINHAND )
UpdateExpertise(BASE_ATTACK);
else if( slot == EQUIPMENT_SLOT_OFFHAND )
UpdateExpertise(OFF_ATTACK);
} }
} }
@ -10831,6 +10832,12 @@ void Player::DestroyItem( uint8 bag, uint8 slot, bool update )
// remove item dependent auras and casts (only weapon and armor slots) // remove item dependent auras and casts (only weapon and armor slots)
RemoveItemDependentAurasAndCasts(pItem); RemoveItemDependentAurasAndCasts(pItem);
// update expertise
if ( slot == EQUIPMENT_SLOT_MAINHAND )
UpdateExpertise(BASE_ATTACK);
else if( slot == EQUIPMENT_SLOT_OFFHAND )
UpdateExpertise(OFF_ATTACK);
// equipment visual show // equipment visual show
SetVisibleItemSlot(slot,NULL); SetVisibleItemSlot(slot,NULL);
} }

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "7510" #define REVISION_NR "7511"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__