[10958] Rename function to CanUseEquippedWeapon

Signed-off-by: NoFantasy <nofantasy@nf.no>
This commit is contained in:
NoFantasy 2011-01-04 10:28:20 +01:00
parent 4fe41fb335
commit b3076146fc
6 changed files with 9 additions and 9 deletions

View file

@ -7289,7 +7289,7 @@ void Player::_ApplyItemBonuses(ItemPrototype const *proto, uint8 slot, bool appl
ApplyFeralAPBonus(feral_bonus, apply); ApplyFeralAPBonus(feral_bonus, apply);
} }
if (!IsUseEquipedWeapon(attType)) if (!CanUseEquippedWeapon(attType))
return; return;
if (proto->Delay) if (proto->Delay)
@ -9095,7 +9095,7 @@ Item* Player::GetWeaponForAttack(WeaponAttackType attackType, bool nonbroken, bo
if (!item || item->GetProto()->Class != ITEM_CLASS_WEAPON) if (!item || item->GetProto()->Class != ITEM_CLASS_WEAPON)
return NULL; return NULL;
if (useable && !IsUseEquipedWeapon(attackType)) if (useable && !CanUseEquippedWeapon(attackType))
return NULL; return NULL;
if (nonbroken && item->IsBroken()) if (nonbroken && item->IsBroken())
@ -9113,7 +9113,7 @@ Item* Player::GetShield(bool useable) const
if (!useable) if (!useable)
return item; return item;
if (item->IsBroken() || !IsUseEquipedWeapon(OFF_ATTACK)) if (item->IsBroken() || !CanUseEquippedWeapon(OFF_ATTACK))
return NULL; return NULL;
return item; return item;

View file

@ -440,7 +440,7 @@ void Player::CalculateMinMaxDamage(WeaponAttackType attType, bool normalized, fl
weapon_mindamage = lvl*0.85f*att_speed; weapon_mindamage = lvl*0.85f*att_speed;
weapon_maxdamage = lvl*1.25f*att_speed; weapon_maxdamage = lvl*1.25f*att_speed;
} }
else if (!IsUseEquipedWeapon(attType)) // check if player not in form but still can't use weapon (broken/etc) else if (!CanUseEquippedWeapon(attType)) // check if player not in form but still can't use weapon (broken/etc)
{ {
weapon_mindamage = BASE_MINDAMAGE; weapon_mindamage = BASE_MINDAMAGE;
weapon_maxdamage = BASE_MAXDAMAGE; weapon_maxdamage = BASE_MAXDAMAGE;

View file

@ -353,7 +353,7 @@ void Unit::Update( uint32 update_diff, uint32 p_time )
bool Unit::haveOffhandWeapon() const bool Unit::haveOffhandWeapon() const
{ {
if (!IsUseEquipedWeapon(OFF_ATTACK)) if (!CanUseEquippedWeapon(OFF_ATTACK))
return false; return false;
if(GetTypeId() == TYPEID_PLAYER) if(GetTypeId() == TYPEID_PLAYER)
@ -3330,7 +3330,7 @@ float Unit::GetUnitBlockChance() const
if(GetTypeId() == TYPEID_PLAYER) if(GetTypeId() == TYPEID_PLAYER)
{ {
Player const* player = (Player const*)this; Player const* player = (Player const*)this;
if(player->CanBlock() && player->IsUseEquipedWeapon(OFF_ATTACK)) if(player->CanBlock() && player->CanUseEquippedWeapon(OFF_ATTACK))
{ {
Item *tmpitem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND); Item *tmpitem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND);
if(tmpitem && !tmpitem->IsBroken() && tmpitem->GetProto()->Block) if(tmpitem && !tmpitem->IsBroken() && tmpitem->GetProto()->Block)

View file

@ -1199,7 +1199,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
uint32 getAttackTimer(WeaponAttackType type) const { return m_attackTimer[type]; } uint32 getAttackTimer(WeaponAttackType type) const { return m_attackTimer[type]; }
bool isAttackReady(WeaponAttackType type = BASE_ATTACK) const { return m_attackTimer[type] == 0; } bool isAttackReady(WeaponAttackType type = BASE_ATTACK) const { return m_attackTimer[type] == 0; }
bool haveOffhandWeapon() const; bool haveOffhandWeapon() const;
bool IsUseEquipedWeapon(WeaponAttackType attackType) const bool CanUseEquippedWeapon(WeaponAttackType attackType) const
{ {
if (IsInFeralForm()) if (IsInFeralForm())
return false; return false;

View file

@ -407,7 +407,7 @@ bool Unit::IsTriggeredAtSpellProcEvent(Unit *pVictim, SpellAuraHolder* holder, S
{ {
// Check if player is wearing shield // Check if player is wearing shield
Item *item = ((Player*)this)->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND); Item *item = ((Player*)this)->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND);
if(!item || item->IsBroken() || !IsUseEquipedWeapon(OFF_ATTACK) || item->GetProto()->Class != ITEM_CLASS_ARMOR || !((1<<item->GetProto()->SubClass) & spellProto->EquippedItemSubClassMask)) if(!item || item->IsBroken() || !CanUseEquippedWeapon(OFF_ATTACK) || item->GetProto()->Class != ITEM_CLASS_ARMOR || !((1<<item->GetProto()->SubClass) & spellProto->EquippedItemSubClassMask))
return false; return false;
} }
} }

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 "10957" #define REVISION_NR "10958"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__