aboutsummaryrefslogtreecommitdiff
path: root/src/game/Player.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/Player.cpp')
-rw-r--r--src/game/Player.cpp66
1 files changed, 25 insertions, 41 deletions
diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index b1b27b2dda1..43a98ddc7b4 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -448,7 +448,6 @@ Player::Player (WorldSession *session): Unit(), m_achievementMgr(this), m_reputa
m_baseSpellPower = 0;
m_baseFeralAP = 0;
m_baseManaRegen = 0;
- m_armorPenetrationPct = 0.0f;
// Honor System
m_lastHonorUpdateTime = time(NULL);
@@ -853,9 +852,9 @@ bool Player::StoreNewItemInBestSlots(uint32 titem_id, uint32 titem_amount)
void Player::SendMirrorTimer(MirrorTimerType Type, uint32 MaxValue, uint32 CurrentValue, int32 Regen)
{
- if (int(MaxValue) == DISABLED_MIRROR_TIMER)
+ if (MaxValue == DISABLED_MIRROR_TIMER)
{
- if (int(CurrentValue) != DISABLED_MIRROR_TIMER)
+ if (CurrentValue!=DISABLED_MIRROR_TIMER)
StopMirrorTimer(Type);
return;
}
@@ -1578,7 +1577,7 @@ bool Player::BuildEnumData( QueryResult * result, WorldPacket * p_data )
if(!enchantId)
continue;
- if ((enchant = sSpellItemEnchantmentStore.LookupEntry(enchantId)))
+ if(enchant = sSpellItemEnchantmentStore.LookupEntry(enchantId))
break;
}
@@ -2398,8 +2397,9 @@ bool Player::IsGroupVisibleFor(Player* p) const
bool Player::IsInSameGroupWith(Player const* p) const
{
- return (p==this || (GetGroup() != NULL &&
- GetGroup()->SameSubGroup((Player*)this, (Player*)p)));
+ return p==this || GetGroup() != NULL &&
+ GetGroup() == p->GetGroup() &&
+ GetGroup()->SameSubGroup((Player*)this, (Player*)p);
}
///- If the player is invited, remove him. If the group if then only 1 person, disband the group.
@@ -3281,7 +3281,7 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen
if (_spell_idx->second->learnOnGetSkill == ABILITY_LEARNED_ON_GET_RACE_OR_CLASS_SKILL ||
// lockpicking/runeforging special case, not have ABILITY_LEARNED_ON_GET_RACE_OR_CLASS_SKILL
- ((pSkill->id==SKILL_LOCKPICKING || pSkill->id==SKILL_RUNEFORGING) && _spell_idx->second->max_value==0))
+ (pSkill->id==SKILL_LOCKPICKING || pSkill->id==SKILL_RUNEFORGING) && _spell_idx->second->max_value==0 )
{
switch(GetSkillRangeType(pSkill,_spell_idx->second->racemask!=0))
{
@@ -3362,7 +3362,7 @@ bool Player::IsNeedCastPassiveSpellAtLearn(SpellEntry const* spellInfo) const
{
// note: form passives activated with shapeshift spells be implemented by HandleShapeshiftBoosts instead of spell_learn_spell
// talent dependent passives activated at form apply have proper stance data
- bool need_cast = (!spellInfo->Stances || (m_form != 0 && (spellInfo->Stances & (1<<(m_form-1)))));
+ bool need_cast = !spellInfo->Stances || m_form != 0 && (spellInfo->Stances & (1<<(m_form-1)));
//Check CasterAuraStates
return need_cast && (!spellInfo->CasterAuraState || HasAuraState(AuraState(spellInfo->CasterAuraState)));
@@ -3404,7 +3404,7 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool learn_low_rank)
if (itr == m_spells.end())
return;
- if(itr->second->state == PLAYERSPELL_REMOVED || (disabled && itr->second->disabled) || itr->second->state == PLAYERSPELL_TEMPORARY)
+ if(itr->second->state == PLAYERSPELL_REMOVED || disabled && itr->second->disabled || itr->second->state == PLAYERSPELL_TEMPORARY)
return;
// unlearn non talent higher ranks (recursive)
@@ -3521,7 +3521,7 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool learn_low_rank)
if(_spell_idx->second->learnOnGetSkill == ABILITY_LEARNED_ON_GET_RACE_OR_CLASS_SKILL &&
pSkill->categoryId != SKILL_CATEGORY_CLASS ||// not unlearn class skills (spellbook/talent pages)
// lockpicking/runeforging special case, not have ABILITY_LEARNED_ON_GET_RACE_OR_CLASS_SKILL
- ((pSkill->id==SKILL_LOCKPICKING || pSkill->id==SKILL_RUNEFORGING) && _spell_idx->second->max_value==0))
+ (pSkill->id==SKILL_LOCKPICKING || pSkill->id==SKILL_RUNEFORGING) && _spell_idx->second->max_value==0 )
{
// not reset skills for professions and racial abilities
if ((pSkill->categoryId==SKILL_CATEGORY_SECONDARY || pSkill->categoryId==SKILL_CATEGORY_PROFESSION) &&
@@ -4768,7 +4768,7 @@ void Player::RepopAtGraveyard()
AreaTableEntry const *zone = GetAreaEntryByAreaID(GetAreaId());
// Such zones are considered unreachable as a ghost and the player must be automatically revived
- if((!isAlive() && zone && zone->flags & AREA_FLAG_NEED_FLY) || GetTransport() || GetPositionZ() < -500.0f)
+ if(!isAlive() && zone && zone->flags & AREA_FLAG_NEED_FLY || GetTransport() || GetPositionZ() < -500.0f)
{
ResurrectPlayer(0.5f);
SpawnCorpseBones();
@@ -7091,7 +7091,7 @@ void Player::_ApplyItemBonuses(ItemPrototype const *proto, uint8 slot, bool appl
// If set dpsMod in ScalingStatValue use it for min (70% from average), max (130% from average) damage
if (ssv)
{
- if ((extraDPS = ssv->getDPSMod(proto->ScalingStatValue)))
+ if (extraDPS = ssv->getDPSMod(proto->ScalingStatValue))
{
float average = extraDPS * proto->Delay / 1000.0f;
minDamage = 0.7f * average;
@@ -9009,10 +9009,10 @@ Item* Player::GetItemByPos( uint16 pos ) const
Item* Player::GetItemByPos( uint8 bag, uint8 slot ) const
{
- if( bag == INVENTORY_SLOT_BAG_0 && ( slot < BANK_SLOT_BAG_END || (slot >= KEYRING_SLOT_START && slot < CURRENCYTOKEN_SLOT_END )) )
+ if( bag == INVENTORY_SLOT_BAG_0 && ( slot < BANK_SLOT_BAG_END || slot >= KEYRING_SLOT_START && slot < CURRENCYTOKEN_SLOT_END ) )
return m_items[slot];
- else if ((bag >= INVENTORY_SLOT_BAG_START && bag < INVENTORY_SLOT_BAG_END)
- || (bag >= BANK_SLOT_BAG_START && bag < BANK_SLOT_BAG_END) )
+ else if(bag >= INVENTORY_SLOT_BAG_START && bag < INVENTORY_SLOT_BAG_END
+ || bag >= BANK_SLOT_BAG_START && bag < BANK_SLOT_BAG_END )
{
Bag *pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, bag );
if ( pBag )
@@ -10996,15 +10996,9 @@ Item* Player::EquipItem( uint16 pos, Item *pItem, bool update )
// update expertise and armor penetration - passive auras may need it
if( slot == EQUIPMENT_SLOT_MAINHAND )
- {
UpdateExpertise(BASE_ATTACK);
- UpdateArmorPenetration();
- }
else if( slot == EQUIPMENT_SLOT_OFFHAND )
- {
UpdateExpertise(OFF_ATTACK);
- UpdateArmorPenetration();
- }
switch(slot)
{
@@ -11154,13 +11148,9 @@ void Player::RemoveItem( uint8 bag, uint8 slot, bool update )
}
UpdateExpertise(BASE_ATTACK);
- UpdateArmorPenetration();
}
else if( slot == EQUIPMENT_SLOT_OFFHAND )
- {
UpdateExpertise(OFF_ATTACK);
- UpdateArmorPenetration();
- }
// update armor penetration - passive auras may need it
switch(slot)
{
@@ -11289,16 +11279,10 @@ void Player::DestroyItem( uint8 bag, uint8 slot, bool update )
break;
}
- if( slot == EQUIPMENT_SLOT_MAINHAND )
- {
+ if ( slot == EQUIPMENT_SLOT_MAINHAND )
UpdateExpertise(BASE_ATTACK);
- UpdateArmorPenetration();
- }
else if( slot == EQUIPMENT_SLOT_OFFHAND )
- {
UpdateExpertise(OFF_ATTACK);
- UpdateArmorPenetration();
- }
// equipment visual show
SetVisibleItemSlot(slot, NULL);
@@ -11677,7 +11661,7 @@ void Player::SwapItem( uint16 src, uint16 dst )
if(IsEquipmentPos ( src ) || IsBagPos ( src ))
{
// bags can be swapped with empty bag slots, or with empty bag (items move possibility checked later)
- uint8 msg = CanUnequipItem( src, !IsBagPos ( src ) || IsBagPos ( dst ) || (pDstItem && pDstItem->IsBag() && ((Bag*)pDstItem)->IsEmpty()));
+ uint8 msg = CanUnequipItem( src, !IsBagPos ( src ) || IsBagPos ( dst ) || pDstItem && pDstItem->IsBag() && ((Bag*)pDstItem)->IsEmpty());
if(msg != EQUIP_ERR_OK)
{
SendEquipError( msg, pSrcItem, pDstItem );
@@ -11707,7 +11691,7 @@ void Player::SwapItem( uint16 src, uint16 dst )
if(IsEquipmentPos ( dst ) || IsBagPos ( dst ))
{
// bags can be swapped with empty bag slots, or with empty bag (items move possibility checked later)
- uint8 msg = CanUnequipItem( dst, !IsBagPos ( dst ) || IsBagPos ( src ) || (pSrcItem->IsBag() && ((Bag*)pSrcItem)->IsEmpty()));
+ uint8 msg = CanUnequipItem( dst, !IsBagPos ( dst ) || IsBagPos ( src ) || pSrcItem->IsBag() && ((Bag*)pSrcItem)->IsEmpty());
if(msg != EQUIP_ERR_OK)
{
SendEquipError( msg, pSrcItem, pDstItem );
@@ -12125,7 +12109,7 @@ void Player::UpdateItemDuration(uint32 time, bool realtimeonly)
Item* item = *itr;
++itr; // current element can be erased in UpdateDuration
- if ((realtimeonly && item->GetProto()->Duration < 0) || !realtimeonly)
+ if (realtimeonly && item->GetProto()->Duration < 0 || !realtimeonly)
item->UpdateDuration(this,time);
}
}
@@ -14763,7 +14747,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
// check name limitations
if (ObjectMgr::CheckPlayerName(m_name) != CHAR_NAME_SUCCESS ||
- (GetSession()->GetSecurity() == SEC_PLAYER && objmgr.IsReservedName(m_name)))
+ GetSession()->GetSecurity() == SEC_PLAYER && objmgr.IsReservedName(m_name))
{
delete result;
CharacterDatabase.PExecute("UPDATE characters SET at_login = at_login | '%u' WHERE guid ='%u'", uint32(AT_LOGIN_RENAME),guid);
@@ -17947,7 +17931,7 @@ bool Player::ActivateTaxiPathTo(std::vector<uint32> const& nodes, Creature* npc
uint32 mount_display_id = objmgr.GetTaxiMountDisplayId(sourcenode, GetTeam(), npc == NULL);
// in spell case allow 0 model
- if ((mount_display_id == 0 && spellid == 0) || sourcepath == 0)
+ if (mount_display_id == 0 && spellid == 0 || sourcepath == 0)
{
WorldPacket data(SMSG_ACTIVATETAXIREPLY, 4);
data << uint32(ERR_TAXIUNSPECIFIEDSERVERERROR);
@@ -20408,8 +20392,8 @@ void Player::UpdateCorpseReclaimDelay()
{
bool pvp = m_ExtraFlags & PLAYER_EXTRA_PVP_DEATH;
- if ((pvp && !sWorld.getConfig(CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVP)) ||
- (!pvp && !sWorld.getConfig(CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVE) ))
+ if( pvp && !sWorld.getConfig(CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVP) ||
+ !pvp && !sWorld.getConfig(CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVE) )
return;
time_t now = time(NULL);
@@ -20445,8 +20429,8 @@ void Player::SendCorpseReclaimDelay(bool load)
return;
uint32 count;
- if ((pvp && !sWorld.getConfig(CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVP)) ||
- (!pvp && !sWorld.getConfig(CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVE) ))
+ if( pvp && sWorld.getConfig(CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVP) ||
+ !pvp && sWorld.getConfig(CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVE) )
{
count = (m_deathExpireTime-corpse->GetGhostTime())/DEATH_EXPIRE_STEP;
if(count>=MAX_DEATH_COUNT)