[7279] Allow equipped items loading at relogin to arena map.

Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
Lightguard 2009-02-14 15:07:12 +03:00 committed by VladimirMangos
parent 3b4402b88b
commit 8d03a850c6
2 changed files with 25 additions and 21 deletions

View file

@ -9869,11 +9869,6 @@ uint8 Player::CanEquipItem( uint8 slot, uint16 &dest, Item *pItem, bool swap, bo
ItemPrototype const *pProto = pItem->GetProto(); ItemPrototype const *pProto = pItem->GetProto();
if( pProto ) if( pProto )
{ {
// May be here should be more stronger checks; STUNNED checked
// ROOT, CONFUSED, DISTRACTED, FLEEING this needs to be checked.
if (not_loading && hasUnitState(UNIT_STAT_STUNNED))
return EQUIP_ERR_YOU_ARE_STUNNED;
if(pItem->IsBindedNotWith(GetGUID())) if(pItem->IsBindedNotWith(GetGUID()))
return EQUIP_ERR_DONT_OWN_THAT_ITEM; return EQUIP_ERR_DONT_OWN_THAT_ITEM;
@ -9882,25 +9877,34 @@ uint8 Player::CanEquipItem( uint8 slot, uint16 &dest, Item *pItem, bool swap, bo
if(res != EQUIP_ERR_OK) if(res != EQUIP_ERR_OK)
return res; return res;
// do not allow equipping gear except weapons, offhands, projectiles, relics in // check this only in game
// - combat if(not_loading)
// - in-progress arenas
if( !pProto->CanChangeEquipStateInCombat() )
{ {
if( isInCombat() ) // May be here should be more stronger checks; STUNNED checked
return EQUIP_ERR_NOT_IN_COMBAT; // ROOT, CONFUSED, DISTRACTED, FLEEING this needs to be checked.
if (hasUnitState(UNIT_STAT_STUNNED))
return EQUIP_ERR_YOU_ARE_STUNNED;
if(BattleGround* bg = GetBattleGround()) // do not allow equipping gear except weapons, offhands, projectiles, relics in
if( bg->isArena() && bg->GetStatus() == STATUS_IN_PROGRESS ) // - combat
return EQUIP_ERR_NOT_DURING_ARENA_MATCH; // - in-progress arenas
if( !pProto->CanChangeEquipStateInCombat() )
{
if( isInCombat() )
return EQUIP_ERR_NOT_IN_COMBAT;
if(BattleGround* bg = GetBattleGround())
if( bg->isArena() && bg->GetStatus() == STATUS_IN_PROGRESS )
return EQUIP_ERR_NOT_DURING_ARENA_MATCH;
}
if(isInCombat()&& pProto->Class == ITEM_CLASS_WEAPON && m_weaponChangeTimer != 0)
return EQUIP_ERR_CANT_DO_RIGHT_NOW; // maybe exist better err
if(IsNonMeleeSpellCasted(false))
return EQUIP_ERR_CANT_DO_RIGHT_NOW;
} }
if(isInCombat()&& pProto->Class == ITEM_CLASS_WEAPON && m_weaponChangeTimer != 0)
return EQUIP_ERR_CANT_DO_RIGHT_NOW; // maybe exist better err
if(IsNonMeleeSpellCasted(false))
return EQUIP_ERR_CANT_DO_RIGHT_NOW;
uint8 eslot = FindEquipSlot( pProto, slot, swap ); uint8 eslot = FindEquipSlot( pProto, slot, swap );
if( eslot == NULL_SLOT ) if( eslot == NULL_SLOT )
return EQUIP_ERR_ITEM_CANT_BE_EQUIPPED; return EQUIP_ERR_ITEM_CANT_BE_EQUIPPED;

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 "7278" #define REVISION_NR "7279"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__