diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 76b6c6409..0090d4f67 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -8681,7 +8681,7 @@ uint8 Player::_CanStoreItem_InSpecificSlot( uint8 bag, uint8 slot, ItemPosCountV if(slot >= KEYRING_SLOT_START && slot < KEYRING_SLOT_START+GetMaxKeyringSize() && !(pProto->BagFamily & BAG_FAMILY_MASK_KEYS)) return EQUIP_ERR_ITEM_DOESNT_GO_INTO_BAG; - // currencytoken case (disabled until proper implement) + // currencytoken case if(slot >= CURRENCYTOKEN_SLOT_START && slot < CURRENCYTOKEN_SLOT_END && !(pProto->BagFamily & BAG_FAMILY_MASK_CURRENCY_TOKENS)) return EQUIP_ERR_ITEM_DOESNT_GO_INTO_BAG; @@ -10696,7 +10696,7 @@ void Player::DestroyZoneLimitedItem( bool update, uint32 new_zone ) for(uint32 j = 0; j < pBag->GetBagSize(); ++j) if (Item* pItem = pBag->GetItemByPos(j)) if (pItem->IsLimitedToAnotherMapOrZone(GetMapId(), new_zone)) - DestroyItem( i, j, update); + DestroyItem(i, j, update); // in equipment and bag list for(int i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_BAG_END; ++i) @@ -11377,7 +11377,7 @@ void Player::UpdateEnchantTime(uint32 time) void Player::AddEnchantmentDurations(Item *item) { - for(int x=0; xGetEnchantmentId(EnchantmentSlot(x))) continue; @@ -11482,7 +11482,7 @@ void Player::ApplyEnchantment(Item *item,bool apply) ApplyEnchantment(item, EnchantmentSlot(slot), apply); } -void Player::ApplyEnchantment(Item *item,EnchantmentSlot slot, bool apply, bool apply_dur, bool ignore_condition) +void Player::ApplyEnchantment(Item *item, EnchantmentSlot slot, bool apply, bool apply_dur, bool ignore_condition) { if(!item) return; diff --git a/src/game/QueryHandler.cpp b/src/game/QueryHandler.cpp index 63507686b..48efb480a 100644 --- a/src/game/QueryHandler.cpp +++ b/src/game/QueryHandler.cpp @@ -408,7 +408,7 @@ void WorldSession::HandleNpcTextQueryOpcode( WorldPacket & recv_data ) SendPacket( &data ); - sLog.outDebug( "WORLD: Sent SMSG_NPC_TEXT_UPDATE " ); + sLog.outDebug( "WORLD: Sent SMSG_NPC_TEXT_UPDATE" ); } void WorldSession::HandlePageTextQueryOpcode( WorldPacket & recv_data ) diff --git a/src/game/QuestHandler.cpp b/src/game/QuestHandler.cpp index 69a2d7c46..84458a33f 100644 --- a/src/game/QuestHandler.cpp +++ b/src/game/QuestHandler.cpp @@ -110,7 +110,7 @@ void WorldSession::HandleQuestgiverHelloOpcode( WorldPacket & recv_data ) void WorldSession::HandleQuestgiverAcceptQuestOpcode( WorldPacket & recv_data ) { - CHECK_PACKET_SIZE(recv_data,8+4+4); + CHECK_PACKET_SIZE(recv_data, 8+4+4); uint64 guid; uint32 quest; @@ -207,7 +207,7 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode( WorldPacket & recv_data ) void WorldSession::HandleQuestgiverQueryQuestOpcode( WorldPacket & recv_data ) { - CHECK_PACKET_SIZE(recv_data,8+4+1); + CHECK_PACKET_SIZE(recv_data, 8+4+1); uint64 guid; uint32 quest; diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 15e5eeb4f..8cbfc6283 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -45,7 +45,7 @@ #include "BattleGround.h" #include "Util.h" -#define SPELL_CHANNEL_UPDATE_INTERVAL (1*IN_MILISECONDS) +#define SPELL_CHANNEL_UPDATE_INTERVAL (1 * IN_MILISECONDS) extern pEffect SpellEffects[TOTAL_SPELL_EFFECTS]; @@ -160,11 +160,11 @@ void SpellCastTargets::Update(Unit* caster) { m_GOTarget = m_GOTargetGUID ? caster->GetMap()->GetGameObject(m_GOTargetGUID) : NULL; m_unitTarget = m_unitTargetGUID ? - ( m_unitTargetGUID==caster->GetGUID() ? caster : ObjectAccessor::GetUnit(*caster, m_unitTargetGUID) ) : + ( m_unitTargetGUID == caster->GetGUID() ? caster : ObjectAccessor::GetUnit(*caster, m_unitTargetGUID) ) : NULL; m_itemTarget = NULL; - if(caster->GetTypeId()==TYPEID_PLAYER) + if(caster->GetTypeId() == TYPEID_PLAYER) { if(m_targetMask & TARGET_FLAG_ITEM) m_itemTarget = ((Player*)caster)->GetItemByGuid(m_itemTargetGUID); @@ -181,7 +181,7 @@ void SpellCastTargets::Update(Unit* caster) bool SpellCastTargets::read ( WorldPacket * data, Unit *caster ) { - if(data->rpos()+4 > data->size()) + if(data->rpos() + 4 > data->size()) return false; *data >> m_targetMask; @@ -215,7 +215,7 @@ bool SpellCastTargets::read ( WorldPacket * data, Unit *caster ) if( m_targetMask & TARGET_FLAG_SOURCE_LOCATION ) { - if(data->rpos()+4+4+4 > data->size()) + if(data->rpos() + 4 + 4 + 4 > data->size()) return false; *data >> m_srcX >> m_srcY >> m_srcZ; @@ -225,7 +225,7 @@ bool SpellCastTargets::read ( WorldPacket * data, Unit *caster ) if( m_targetMask & TARGET_FLAG_DEST_LOCATION ) { - if(data->rpos()+1+4+4+4 > data->size()) + if(data->rpos() + 1 + 4 + 4 + 4 > data->size()) return false; if(!data->readPackGUID(m_unitTargetGUID)) @@ -238,7 +238,7 @@ bool SpellCastTargets::read ( WorldPacket * data, Unit *caster ) if( m_targetMask & TARGET_FLAG_STRING ) { - if(data->rpos()+1 > data->size()) + if(data->rpos() + 1 > data->size()) return false; *data >> m_strTarget; @@ -342,7 +342,7 @@ Spell::Spell( Unit* Caster, SpellEntry const *info, bool triggered, uint64 origi if(m_attackType == RANGED_ATTACK) { // wand case - if((m_caster->getClassMask() & CLASSMASK_WAND_USERS) != 0 && m_caster->GetTypeId()==TYPEID_PLAYER) + if((m_caster->getClassMask() & CLASSMASK_WAND_USERS) != 0 && m_caster->GetTypeId() == TYPEID_PLAYER) { if(Item* pItem = ((Player*)m_caster)->GetWeaponForAttack(RANGED_ATTACK)) m_spellSchoolMask = SpellSchoolMask(1 << pItem->GetProto()->Damage[0].DamageType); @@ -356,11 +356,11 @@ Spell::Spell( Unit* Caster, SpellEntry const *info, bool triggered, uint64 origi else m_originalCasterGUID = m_caster->GetGUID(); - if(m_originalCasterGUID==m_caster->GetGUID()) + if(m_originalCasterGUID == m_caster->GetGUID()) m_originalCaster = m_caster; else { - m_originalCaster = ObjectAccessor::GetUnit(*m_caster,m_originalCasterGUID); + m_originalCaster = ObjectAccessor::GetUnit(*m_caster, m_originalCasterGUID); if(m_originalCaster && !m_originalCaster->IsInWorld()) m_originalCaster = NULL; } @@ -399,12 +399,12 @@ Spell::Spell( Unit* Caster, SpellEntry const *info, bool triggered, uint64 origi if(m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_MAGIC && !(m_spellInfo->AttributesEx2 & SPELL_ATTR_EX2_CANT_REFLECTED)) { - for(int j=0;j<3;j++) + for(int j = 0;j < 3; ++j) { - if (m_spellInfo->Effect[j]==0) + if (m_spellInfo->Effect[j] == 0) continue; - if(!IsPositiveTarget(m_spellInfo->EffectImplicitTargetA[j],m_spellInfo->EffectImplicitTargetB[j])) + if(!IsPositiveTarget(m_spellInfo->EffectImplicitTargetA[j], m_spellInfo->EffectImplicitTargetB[j])) m_canReflect = true; else m_canReflect = (m_spellInfo->AttributesEx & SPELL_ATTR_EX_NEGATIVE) ? true : false; @@ -457,11 +457,11 @@ void Spell::FillTargetMap() { // TODO: ADD the correct target FILLS!!!!!! - for(uint32 i=0;i<3;++i) + for(uint32 i = 0; i < 3; ++i) { // not call for empty effect. // Also some spells use not used effect targets for store targets for dummy effect in triggered spells - if(m_spellInfo->Effect[i]==0) + if(m_spellInfo->Effect[i] == 0) continue; // targets for TARGET_SCRIPT_COORDINATES (A) and TARGET_SCRIPT filled in Spell::CheckCast call @@ -485,19 +485,19 @@ void Spell::FillTargetMap() switch(m_spellInfo->EffectImplicitTargetB[i]) { case 0: - SetTargetMap(i,m_spellInfo->EffectImplicitTargetA[i],tmpUnitMap); + SetTargetMap(i, m_spellInfo->EffectImplicitTargetA[i], tmpUnitMap); break; case TARGET_AREAEFFECT_INSTANT: // use B case that not dependent from from A in fact - if((m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION)==0) - m_targets.setDestination(m_caster->GetPositionX(),m_caster->GetPositionY(),m_caster->GetPositionZ()); - SetTargetMap(i,m_spellInfo->EffectImplicitTargetB[i],tmpUnitMap); + if((m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION) == 0) + m_targets.setDestination(m_caster->GetPositionX(), m_caster->GetPositionY(), m_caster->GetPositionZ()); + SetTargetMap(i, m_spellInfo->EffectImplicitTargetB[i], tmpUnitMap); break; case TARGET_BEHIND_VICTIM: // use B case that not dependent from from A in fact - SetTargetMap(i,m_spellInfo->EffectImplicitTargetB[i],tmpUnitMap); + SetTargetMap(i, m_spellInfo->EffectImplicitTargetB[i], tmpUnitMap); break; default: - SetTargetMap(i,m_spellInfo->EffectImplicitTargetA[i],tmpUnitMap); - SetTargetMap(i,m_spellInfo->EffectImplicitTargetB[i],tmpUnitMap); + SetTargetMap(i, m_spellInfo->EffectImplicitTargetA[i], tmpUnitMap); + SetTargetMap(i, m_spellInfo->EffectImplicitTargetB[i], tmpUnitMap); break; } break; @@ -505,22 +505,22 @@ void Spell::FillTargetMap() // Note: this hack with search required until GO casting not implemented // environment damage spells already have around enemies targeting but this not help in case not existed GO casting support // currently each enemy selected explicitly and self cast damage - if(m_spellInfo->EffectImplicitTargetB[i]==TARGET_ALL_ENEMY_IN_AREA && m_spellInfo->Effect[i]==SPELL_EFFECT_ENVIRONMENTAL_DAMAGE) + if(m_spellInfo->EffectImplicitTargetB[i] == TARGET_ALL_ENEMY_IN_AREA && m_spellInfo->Effect[i] == SPELL_EFFECT_ENVIRONMENTAL_DAMAGE) { if(m_targets.getUnitTarget()) tmpUnitMap.push_back(m_targets.getUnitTarget()); } else { - SetTargetMap(i,m_spellInfo->EffectImplicitTargetA[i],tmpUnitMap); - SetTargetMap(i,m_spellInfo->EffectImplicitTargetB[i],tmpUnitMap); + SetTargetMap(i, m_spellInfo->EffectImplicitTargetA[i], tmpUnitMap); + SetTargetMap(i, m_spellInfo->EffectImplicitTargetB[i], tmpUnitMap); } break; case TARGET_TABLE_X_Y_Z_COORDINATES: switch(m_spellInfo->EffectImplicitTargetB[i]) { case 0: - SetTargetMap(i,m_spellInfo->EffectImplicitTargetA[i],tmpUnitMap); + SetTargetMap(i, m_spellInfo->EffectImplicitTargetA[i], tmpUnitMap); // need some target for proccesing if(m_targets.getUnitTarget()) @@ -529,11 +529,11 @@ void Spell::FillTargetMap() tmpUnitMap.push_back(m_caster); break; case TARGET_AREAEFFECT_INSTANT: // All 17/7 pairs used for dest teleportation, A processed in effect code - SetTargetMap(i,m_spellInfo->EffectImplicitTargetB[i],tmpUnitMap); + SetTargetMap(i, m_spellInfo->EffectImplicitTargetB[i], tmpUnitMap); break; default: - SetTargetMap(i,m_spellInfo->EffectImplicitTargetA[i],tmpUnitMap); - SetTargetMap(i,m_spellInfo->EffectImplicitTargetB[i],tmpUnitMap); + SetTargetMap(i, m_spellInfo->EffectImplicitTargetA[i], tmpUnitMap); + SetTargetMap(i, m_spellInfo->EffectImplicitTargetB[i], tmpUnitMap); break; } break; @@ -541,21 +541,21 @@ void Spell::FillTargetMap() switch(m_spellInfo->EffectImplicitTargetB[i]) { case 0: - SetTargetMap(i,m_spellInfo->EffectImplicitTargetA[i],tmpUnitMap); + SetTargetMap(i, m_spellInfo->EffectImplicitTargetA[i], tmpUnitMap); break; case TARGET_SCRIPT_COORDINATES: // B case filled in CheckCast but we need fill unit list base at A case - SetTargetMap(i,m_spellInfo->EffectImplicitTargetA[i],tmpUnitMap); + SetTargetMap(i, m_spellInfo->EffectImplicitTargetA[i], tmpUnitMap); break; default: - SetTargetMap(i,m_spellInfo->EffectImplicitTargetA[i],tmpUnitMap); - SetTargetMap(i,m_spellInfo->EffectImplicitTargetB[i],tmpUnitMap); + SetTargetMap(i, m_spellInfo->EffectImplicitTargetA[i], tmpUnitMap); + SetTargetMap(i, m_spellInfo->EffectImplicitTargetB[i], tmpUnitMap); break; } break; } - if( (m_spellInfo->EffectImplicitTargetA[i]==0 || m_spellInfo->EffectImplicitTargetA[i]==TARGET_EFFECT_SELECT) && - (m_spellInfo->EffectImplicitTargetB[i]==0 || m_spellInfo->EffectImplicitTargetB[i]==TARGET_EFFECT_SELECT) ) + if( (m_spellInfo->EffectImplicitTargetA[i] == 0 || m_spellInfo->EffectImplicitTargetA[i] == TARGET_EFFECT_SELECT) && + (m_spellInfo->EffectImplicitTargetB[i] == 0 || m_spellInfo->EffectImplicitTargetB[i] == TARGET_EFFECT_SELECT) ) { // add here custom effects that need default target. // FOR EVERY TARGET TYPE THERE IS A DIFFERENT FILL!! @@ -587,8 +587,8 @@ void Spell::FillTargetMap() else { // clear cooldown at fail - if(m_caster->GetTypeId()==TYPEID_PLAYER) - ((Player*)m_caster)->RemoveSpellCooldown(m_spellInfo->Id,true); + if(m_caster->GetTypeId() == TYPEID_PLAYER) + ((Player*)m_caster)->RemoveSpellCooldown(m_spellInfo->Id, true); SendCastResult(SPELL_FAILED_NO_EDIBLE_CORPSES); finish(false); } @@ -633,7 +633,7 @@ void Spell::FillTargetMap() tmpUnitMap.push_back(m_targets.getUnitTarget()); if(m_targets.getCorpseTargetGUID()) { - Corpse *corpse = ObjectAccessor::GetCorpse(*m_caster,m_targets.getCorpseTargetGUID()); + Corpse *corpse = ObjectAccessor::GetCorpse(*m_caster, m_targets.getCorpseTargetGUID()); if(corpse) { Player* owner = ObjectAccessor::FindPlayer(corpse->GetOwnerGUID()); @@ -690,7 +690,7 @@ void Spell::FillTargetMap() case SPELL_EFFECT_APPLY_AREA_AURA_PARTY: // AreaAura if(m_spellInfo->Attributes == 0x9050000 || m_spellInfo->Attributes == 0x10000) - SetTargetMap(i,TARGET_AREAEFFECT_PARTY,tmpUnitMap); + SetTargetMap(i,TARGET_AREAEFFECT_PARTY, tmpUnitMap); break; case SPELL_EFFECT_SKIN_PLAYER_CORPSE: if(m_targets.getUnitTarget()) @@ -729,7 +729,7 @@ void Spell::FillTargetMap() } } - for (std::list::iterator itr = tmpUnitMap.begin() ; itr != tmpUnitMap.end();) + for (std::list::iterator itr = tmpUnitMap.begin(); itr != tmpUnitMap.end();) { if (!CheckTarget (*itr, i)) { @@ -740,7 +740,7 @@ void Spell::FillTargetMap() ++itr; } - for(std::list::const_iterator iunit= tmpUnitMap.begin();iunit != tmpUnitMap.end();++iunit) + for(std::list::const_iterator iunit = tmpUnitMap.begin(); iunit != tmpUnitMap.end(); ++iunit) AddUnitTarget((*iunit), i); } } @@ -768,24 +768,32 @@ void Spell::prepareDataForTriggerSystem() switch (m_spellInfo->SpellFamilyName) { case SPELLFAMILY_MAGE: // Arcane Missles / Blizzard triggers need do it - if (m_spellInfo->SpellFamilyFlags & 0x0000000000200080LL) m_canTrigger = true; - break; + if (m_spellInfo->SpellFamilyFlags & 0x0000000000200080LL) + m_canTrigger = true; + break; case SPELLFAMILY_WARLOCK: // For Hellfire Effect / Rain of Fire / Seed of Corruption triggers need do it - if (m_spellInfo->SpellFamilyFlags & 0x0000800000000060LL) m_canTrigger = true; - break; + if (m_spellInfo->SpellFamilyFlags & 0x0000800000000060LL) + m_canTrigger = true; + break; case SPELLFAMILY_PRIEST: // For Penance heal/damage triggers need do it - if (m_spellInfo->SpellFamilyFlags & 0x0001800000000000LL) m_canTrigger = true; - break; + if (m_spellInfo->SpellFamilyFlags & 0x0001800000000000LL) + m_canTrigger = true; + break; case SPELLFAMILY_ROGUE: // For poisons need do it - if (m_spellInfo->SpellFamilyFlags & 0x000000101001E000LL) m_canTrigger = true; - break; + if (m_spellInfo->SpellFamilyFlags & 0x000000101001E000LL) + m_canTrigger = true; + break; case SPELLFAMILY_HUNTER: // Hunter Rapid Killing/Explosive Trap Effect/Immolation Trap Effect/Frost Trap Aura/Snake Trap Effect/Explosive Shot if (m_spellInfo->SpellFamilyFlags & 0x0100200000000214LL || - m_spellInfo->SpellFamilyFlags2 & 0x200) m_canTrigger = true; - break; + m_spellInfo->SpellFamilyFlags2 & 0x200) + m_canTrigger = true; + break; case SPELLFAMILY_PALADIN: // For Judgements (all) / Holy Shock triggers need do it - if (m_spellInfo->SpellFamilyFlags & 0x0001000900B80400LL) m_canTrigger = true; - break; + if (m_spellInfo->SpellFamilyFlags & 0x0001000900B80400LL) + m_canTrigger = true; + break; + default: + break; } } @@ -843,7 +851,7 @@ void Spell::CleanupTargetList() void Spell::AddUnitTarget(Unit* pVictim, uint32 effIndex) { - if( m_spellInfo->Effect[effIndex]==0 ) + if( m_spellInfo->Effect[effIndex] == 0 ) return; // Check for effect immune skip if immuned @@ -852,12 +860,12 @@ void Spell::AddUnitTarget(Unit* pVictim, uint32 effIndex) uint64 targetGUID = pVictim->GetGUID(); // Lookup target in already in list - for(std::list::iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit) + for(std::list::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) { if (targetGUID == ihit->targetGUID) // Found in list { if (!immuned) - ihit->effectMask |= 1<effectMask |= 1 << effIndex; // Add only effect mask if not immuned return; } } @@ -867,7 +875,7 @@ void Spell::AddUnitTarget(Unit* pVictim, uint32 effIndex) // Get spell hit result on target TargetInfo target; target.targetGUID = targetGUID; // Store target GUID - target.effectMask = immuned ? 0 : 1<speed * 1000.0f); // Calculate minimum incoming time - if (m_delayMoment==0 || m_delayMoment>target.timeDelay) + if (m_delayMoment == 0 || m_delayMoment>target.timeDelay) m_delayMoment = target.timeDelay; } else target.timeDelay = 0LL; // If target reflect spell back to caster - if (target.missCondition==SPELL_MISS_REFLECT) + if (target.missCondition == SPELL_MISS_REFLECT) { // Calculate reflected spell result on caster target.reflectResult = m_caster->SpellHitResult(m_caster, m_spellInfo, m_canReflect); @@ -898,7 +906,7 @@ void Spell::AddUnitTarget(Unit* pVictim, uint32 effIndex) target.reflectResult = SPELL_MISS_PARRY; // Increase time interval for reflected spells by 1.5 - target.timeDelay+=target.timeDelay>>1; + target.timeDelay += target.timeDelay >> 1; } else target.reflectResult = SPELL_MISS_NONE; @@ -909,24 +917,24 @@ void Spell::AddUnitTarget(Unit* pVictim, uint32 effIndex) void Spell::AddUnitTarget(uint64 unitGUID, uint32 effIndex) { - Unit* unit = m_caster->GetGUID()==unitGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, unitGUID); + Unit* unit = m_caster->GetGUID() == unitGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, unitGUID); if (unit) AddUnitTarget(unit, effIndex); } void Spell::AddGOTarget(GameObject* pVictim, uint32 effIndex) { - if( m_spellInfo->Effect[effIndex]==0 ) + if( m_spellInfo->Effect[effIndex] == 0 ) return; uint64 targetGUID = pVictim->GetGUID(); // Lookup target in already in list - for(std::list::iterator ihit= m_UniqueGOTargetInfo.begin();ihit != m_UniqueGOTargetInfo.end();++ihit) + for(std::list::iterator ihit = m_UniqueGOTargetInfo.begin(); ihit != m_UniqueGOTargetInfo.end(); ++ihit) { if (targetGUID == ihit->targetGUID) // Found in list { - ihit->effectMask |= 1<effectMask |= 1 << effIndex; // Add only effect mask return; } } @@ -935,7 +943,7 @@ void Spell::AddGOTarget(GameObject* pVictim, uint32 effIndex) GOTargetInfo target; target.targetGUID = targetGUID; - target.effectMask = 1<Effect[effIndex]==0 ) + if( m_spellInfo->Effect[effIndex] == 0 ) return; // Lookup target in already in list - for(std::list::iterator ihit= m_UniqueItemInfo.begin();ihit != m_UniqueItemInfo.end();++ihit) + for(std::list::iterator ihit = m_UniqueItemInfo.begin(); ihit != m_UniqueItemInfo.end(); ++ihit) { if (pitem == ihit->item) // Found in list { @@ -981,7 +989,7 @@ void Spell::AddItemTarget(Item* pitem, uint32 effIndex) ItemTargetInfo target; target.item = pitem; - target.effectMask = 1<CalculateSpellDamage(&damageInfo, m_damage, m_spellInfo); - caster->DealDamageMods(damageInfo.target,damageInfo.damage,&damageInfo.absorb); + caster->DealDamageMods(damageInfo.target, damageInfo.damage, &damageInfo.absorb); // Send log damage message to client caster->SendSpellNonMeleeDamageLog(&damageInfo); @@ -1096,7 +1104,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target) if( !((Creature*)unit)->isPet() && !IsAutoRepeat() && !IsNextMeleeSwingSpell() && !IsChannelActive() ) { if ( Player* p = m_caster->GetCharmerOrOwnerPlayerOrPlayerItself() ) - p->CastedCreatureOrGO(unit->GetEntry(),unit->GetGUID(),m_spellInfo->Id); + p->CastedCreatureOrGO(unit->GetEntry(), unit->GetGUID(), m_spellInfo->Id); } if(((Creature*)unit)->AI()) @@ -1105,7 +1113,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target) // Call scripted function for AI if this spell is casted by a creature if(m_caster->GetTypeId()==TYPEID_UNIT && ((Creature*)m_caster)->AI()) - ((Creature*)m_caster)->AI()->SpellHitTarget(unit,m_spellInfo); + ((Creature*)m_caster)->AI()->SpellHitTarget(unit, m_spellInfo); } void Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask) @@ -1147,7 +1155,7 @@ void Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask) if( !m_caster->IsFriendlyTo(unit) ) { // for delayed spells ignore not visible explicit target - if(m_spellInfo->speed > 0.0f && unit==m_targets.getUnitTarget() && !unit->isVisibleForOrDetect(m_caster,false)) + if(m_spellInfo->speed > 0.0f && unit == m_targets.getUnitTarget() && !unit->isVisibleForOrDetect(m_caster,false)) { m_caster->SendSpellMiss(unit, m_spellInfo->Id, SPELL_MISS_EVADE); return; @@ -1202,20 +1210,20 @@ void Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask) // Apply additional spell effects to target if (m_preCastSpell) - m_caster->CastSpell(unit,m_preCastSpell, true, m_CastItem); + m_caster->CastSpell(unit, m_preCastSpell, true, m_CastItem); - for(uint32 effectNumber=0;effectNumber<3;effectNumber++) + for(uint32 effectNumber = 0; effectNumber < 3; ++effectNumber) { - if (effectMask & (1<DmgMultiplier[effectNumber]; // Apply multiplier mods if(Player* modOwner = m_originalCaster->GetSpellModOwner()) - modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_EFFECT_PAST_FIRST, multiplier,this); + modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_EFFECT_PAST_FIRST, multiplier, this); m_damageMultipliers[effectNumber] *= multiplier; } } @@ -1236,16 +1244,16 @@ void Spell::DoAllEffectOnTarget(GOTargetInfo *target) if(!go) return; - for(uint32 effectNumber=0;effectNumber<3;effectNumber++) - if (effectMask & (1<GetCharmerOrOwnerPlayerOrPlayerItself() ) - p->CastedCreatureOrGO(go->GetEntry(),go->GetGUID(),m_spellInfo->Id); + p->CastedCreatureOrGO(go->GetEntry(), go->GetGUID(), m_spellInfo->Id); } } @@ -1255,8 +1263,8 @@ void Spell::DoAllEffectOnTarget(ItemTargetInfo *target) if(!target->item || !effectMask) return; - for(uint32 effectNumber=0;effectNumber<3;effectNumber++) - if (effectMask & (1<item, NULL, effectNumber); } @@ -1268,11 +1276,11 @@ bool Spell::IsAliveUnitPresentInTargetList() uint8 needAliveTargetMask = m_needAliveTargetMask; - for(std::list::const_iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit) + for(std::list::const_iterator ihit= m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) { if( ihit->missCondition == SPELL_MISS_NONE && (needAliveTargetMask & ihit->effectMask) ) { - Unit *unit = m_caster->GetGUID()==ihit->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID); + Unit *unit = m_caster->GetGUID() == ihit->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID); if (unit && unit->isAlive()) needAliveTargetMask &= ~ihit->effectMask; // remove from need alive mask effect that have alive target @@ -1280,7 +1288,7 @@ bool Spell::IsAliveUnitPresentInTargetList() } // is all effects from m_needAliveTargetMask have alive targets - return needAliveTargetMask==0; + return needAliveTargetMask == 0; } // Helper for Chain Healing @@ -1348,7 +1356,7 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,UnitList& TagUnitMap) if(m_originalCaster) if(Player* modOwner = m_originalCaster->GetSpellModOwner()) - modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_RADIUS, radius,this); + modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_RADIUS, radius, this); uint32 EffectChainTarget = m_spellInfo->EffectChainTarget[i]; if(m_originalCaster) @@ -1701,7 +1709,7 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,UnitList& TagUnitMap) Player *pTarget = m_caster->GetCharmerOrOwnerPlayerOrPlayerItself(); Group *pGroup = pTarget ? pTarget->GetGroup() : NULL; - if(m_spellInfo->Id==57669) //Replenishment (special target selection) + if(m_spellInfo->Id == 57669) // Replenishment (special target selection) { if(pGroup) { @@ -1820,10 +1828,10 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,UnitList& TagUnitMap) m_targets.setDestination(caster->GetPositionX(), caster->GetPositionY(), caster->GetPositionZ()); }break; case TARGET_ALL_FRIENDLY_UNITS_AROUND_CASTER: - FillAreaTargets(TagUnitMap,m_targets.m_destX, m_targets.m_destY,radius,PUSH_SELF_CENTER,SPELL_TARGETS_FRIENDLY); + FillAreaTargets(TagUnitMap, m_targets.m_destX, m_targets.m_destY, radius, PUSH_SELF_CENTER, SPELL_TARGETS_FRIENDLY); break; case TARGET_ALL_FRIENDLY_UNITS_IN_AREA: - FillAreaTargets(TagUnitMap,m_targets.m_destX, m_targets.m_destY,radius,PUSH_DEST_CENTER,SPELL_TARGETS_FRIENDLY); + FillAreaTargets(TagUnitMap, m_targets.m_destX, m_targets.m_destY, radius, PUSH_DEST_CENTER, SPELL_TARGETS_FRIENDLY); break; // TARGET_SINGLE_PARTY means that the spells can only be casted on a party member and not on the caster (some seals, fire shield from imp, etc..) case TARGET_SINGLE_PARTY: @@ -1851,7 +1859,7 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,UnitList& TagUnitMap) } else if (m_caster->GetTypeId() == TYPEID_PLAYER) { - if( targetOwner == m_caster && target->GetTypeId()==TYPEID_UNIT && ((Creature*)target)->isPet()) + if( targetOwner == m_caster && target->GetTypeId() == TYPEID_UNIT && ((Creature*)target)->isPet()) { TagUnitMap.push_back(target); break; @@ -1865,8 +1873,8 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,UnitList& TagUnitMap) if(targetOwner) { if( targetOwner->GetTypeId() == TYPEID_PLAYER && - target->GetTypeId()==TYPEID_UNIT && (((Creature*)target)->isPet()) && - target->GetOwnerGUID()==targetOwner->GetGUID() && + target->GetTypeId() == TYPEID_UNIT && (((Creature*)target)->isPet()) && + target->GetOwnerGUID() == targetOwner->GetGUID() && pGroup->IsMember(((Player*)targetOwner)->GetGUID())) { TagUnitMap.push_back(target); @@ -1928,7 +1936,7 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,UnitList& TagUnitMap) { // targets the ground, not the units in the area if (m_spellInfo->Effect[i]!=SPELL_EFFECT_PERSISTENT_AREA_AURA) - FillAreaTargets(TagUnitMap,m_targets.m_destX, m_targets.m_destY,radius,PUSH_DEST_CENTER,SPELL_TARGETS_AOE_DAMAGE); + FillAreaTargets(TagUnitMap, m_targets.m_destX, m_targets.m_destY, radius, PUSH_DEST_CENTER, SPELL_TARGETS_AOE_DAMAGE); break; } case TARGET_MINION: @@ -2036,9 +2044,9 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,UnitList& TagUnitMap) UnitList tempUnitMap; - FillAreaTargets(tempUnitMap,m_caster->GetPositionX(), m_caster->GetPositionY(),max_range,PUSH_SELF_CENTER, SPELL_TARGETS_FRIENDLY); + FillAreaTargets(tempUnitMap, m_caster->GetPositionX(), m_caster->GetPositionY(), max_range, PUSH_SELF_CENTER, SPELL_TARGETS_FRIENDLY); - if(m_caster != pUnitTarget && std::find(tempUnitMap.begin(),tempUnitMap.end(),m_caster) == tempUnitMap.end() ) + if(m_caster != pUnitTarget && std::find(tempUnitMap.begin(),tempUnitMap.end(), m_caster) == tempUnitMap.end() ) tempUnitMap.push_front(m_caster); tempUnitMap.sort(TargetDistanceOrder(pUnitTarget)); @@ -2056,7 +2064,7 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,UnitList& TagUnitMap) while(t && next != tempUnitMap.end() ) { - if(!prev->IsWithinDist(*next,CHAIN_SPELL_JUMP_RADIUS)) + if(!prev->IsWithinDist(*next, CHAIN_SPELL_JUMP_RADIUS)) break; if(!prev->IsWithinLOSInMap(*next)) @@ -2148,7 +2156,7 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,UnitList& TagUnitMap) { float _target_x, _target_y, _target_z; pTarget->GetClosePoint(_target_x, _target_y, _target_z, m_caster->GetObjectSize(), CONTACT_DISTANCE, M_PI); - if(pTarget->IsWithinLOS(_target_x,_target_y,_target_z)) + if(pTarget->IsWithinLOS(_target_x, _target_y, _target_z)) { TagUnitMap.push_back(m_caster); m_targets.setDestination(_target_x, _target_y, _target_z); @@ -2575,15 +2583,15 @@ void Spell::_handle_immediate_phase() HandleThreatSpells(m_spellInfo->Id); m_needSpellLog = IsNeedSendToClient(); - for(uint32 j = 0;j<3;j++) + for(uint32 j = 0; j < 3; ++j) { - if(m_spellInfo->Effect[j]==0) + if(m_spellInfo->Effect[j] == 0) continue; // apply Send Event effect to ground in case empty target lists if( m_spellInfo->Effect[j] == SPELL_EFFECT_SEND_EVENT && !HaveTargetsForEffect(j) ) { - HandleEffects(NULL,NULL,NULL, j); + HandleEffects(NULL, NULL, NULL, j); continue; } @@ -2612,11 +2620,11 @@ void Spell::_handle_immediate_phase() DoAllEffectOnTarget(&(*ihit)); // process ground - for(uint32 j = 0;j<3;j++) + for(uint32 j = 0; j < 3; ++j) { // persistent area auras target only the ground if(m_spellInfo->Effect[j] == SPELL_EFFECT_PERSISTENT_AREA_AURA) - HandleEffects(NULL,NULL,NULL, j); + HandleEffects(NULL, NULL, NULL, j); } } @@ -2731,20 +2739,20 @@ void Spell::update(uint32 difftime) { if ( Player* p = m_caster->GetCharmerOrOwnerPlayerOrPlayerItself() ) { - for(std::list::iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit) + for(std::list::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) { TargetInfo* target = &*ihit; if(!IS_CREATURE_GUID(target->targetGUID)) continue; - Unit* unit = m_caster->GetGUID()==target->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster,target->targetGUID); - if (unit==NULL) + Unit* unit = m_caster->GetGUID() == target->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, target->targetGUID); + if (unit == NULL) continue; - p->CastedCreatureOrGO(unit->GetEntry(),unit->GetGUID(),m_spellInfo->Id); + p->CastedCreatureOrGO(unit->GetEntry(), unit->GetGUID(), m_spellInfo->Id); } - for(std::list::iterator ihit= m_UniqueGOTargetInfo.begin();ihit != m_UniqueGOTargetInfo.end();++ihit) + for(std::list::iterator ihit = m_UniqueGOTargetInfo.begin(); ihit != m_UniqueGOTargetInfo.end(); ++ihit) { GOTargetInfo* target = &*ihit; @@ -2752,7 +2760,7 @@ void Spell::update(uint32 difftime) if(!go) continue; - p->CastedCreatureOrGO(go->GetEntry(),go->GetGUID(),m_spellInfo->Id); + p->CastedCreatureOrGO(go->GetEntry(), go->GetGUID(), m_spellInfo->Id); } } } @@ -3120,33 +3128,35 @@ void Spell::WriteSpellGoTargets( WorldPacket * data ) // m_needAliveTargetMask req for stop channelig if one target die uint32 hit = m_UniqueGOTargetInfo.size(); // Always hits on GO uint32 miss = 0; - for(std::list::iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit) + for(std::list::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) { if ((*ihit).effectMask == 0) // No effect apply - all immuned add state { // possibly SPELL_MISS_IMMUNE2 for this?? ihit->missCondition = SPELL_MISS_IMMUNE2; - miss++; + ++miss; } else if ((*ihit).missCondition == SPELL_MISS_NONE) - hit++; + ++hit; else - miss++; + ++miss; } *data << (uint8)hit; - for(std::list::const_iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit) + for(std::list::const_iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) + { if ((*ihit).missCondition == SPELL_MISS_NONE) // Add only hits { *data << uint64(ihit->targetGUID); m_needAliveTargetMask |=ihit->effectMask; } + } - for(std::list::const_iterator ighit= m_UniqueGOTargetInfo.begin();ighit != m_UniqueGOTargetInfo.end();++ighit) + for(std::list::const_iterator ighit = m_UniqueGOTargetInfo.begin(); ighit != m_UniqueGOTargetInfo.end(); ++ighit) *data << uint64(ighit->targetGUID); // Always hits *data << (uint8)miss; - for(std::list::const_iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit) + for(std::list::const_iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) { if( ihit->missCondition != SPELL_MISS_NONE ) // Add only miss { @@ -3290,8 +3300,8 @@ void Spell::SendChannelUpdate(uint32 time) { if(time == 0) { - m_caster->SetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT,0); - m_caster->SetUInt32Value(UNIT_CHANNEL_SPELL,0); + m_caster->SetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT, 0); + m_caster->SetUInt32Value(UNIT_CHANNEL_SPELL, 0); } if (m_caster->GetTypeId() != TYPEID_PLAYER) @@ -3311,9 +3321,9 @@ void Spell::SendChannelStart(uint32 duration) // select first not resisted target from target list for _0_ effect if(!m_UniqueTargetInfo.empty()) { - for(std::list::const_iterator itr= m_UniqueTargetInfo.begin();itr != m_UniqueTargetInfo.end();++itr) + for(std::list::const_iterator itr = m_UniqueTargetInfo.begin(); itr != m_UniqueTargetInfo.end(); ++itr) { - if( (itr->effectMask & (1<<0)) && itr->reflectResult==SPELL_MISS_NONE && itr->targetGUID != m_caster->GetGUID()) + if( (itr->effectMask & (1 << 0)) && itr->reflectResult == SPELL_MISS_NONE && itr->targetGUID != m_caster->GetGUID()) { target = ObjectAccessor::GetUnit(*m_caster, itr->targetGUID); break; @@ -3322,9 +3332,9 @@ void Spell::SendChannelStart(uint32 duration) } else if(!m_UniqueGOTargetInfo.empty()) { - for(std::list::const_iterator itr= m_UniqueGOTargetInfo.begin();itr != m_UniqueGOTargetInfo.end();++itr) + for(std::list::const_iterator itr = m_UniqueGOTargetInfo.begin(); itr != m_UniqueGOTargetInfo.end(); ++itr) { - if(itr->effectMask & (1<<0) ) + if(itr->effectMask & (1 << 0) ) { target = m_caster->GetMap()->GetGameObject(itr->targetGUID); break; @@ -3353,16 +3363,16 @@ void Spell::SendResurrectRequest(Player* target) // Both players and NPCs can resurrect using spells - have a look at creature 28487 for example // However, the packet structure differs slightly - const char* sentName = m_caster->GetTypeId()==TYPEID_PLAYER ?"":m_caster->GetNameForLocaleIdx(target->GetSession()->GetSessionDbLocaleIndex()); + const char* sentName = m_caster->GetTypeId() == TYPEID_PLAYER ? "" : m_caster->GetNameForLocaleIdx(target->GetSession()->GetSessionDbLocaleIndex()); WorldPacket data(SMSG_RESURRECT_REQUEST, (8+4+strlen(sentName)+1+1+1)); data << uint64(m_caster->GetGUID()); - data << uint32(strlen(sentName)+1); + data << uint32(strlen(sentName) + 1); data << sentName; data << uint8(0); - data << uint8(m_caster->GetTypeId()==TYPEID_PLAYER ?0:1); + data << uint8(m_caster->GetTypeId() == TYPEID_PLAYER ? 0 : 1); target->GetSession()->SendPacket(&data); } @@ -3371,7 +3381,7 @@ void Spell::SendPlaySpellVisual(uint32 SpellID) if (m_caster->GetTypeId() != TYPEID_PLAYER) return; - WorldPacket data(SMSG_PLAY_SPELL_VISUAL, 12); + WorldPacket data(SMSG_PLAY_SPELL_VISUAL, 8 + 4); data << uint64(m_caster->GetGUID()); data << uint32(SpellID); // spell visual id? ((Player*)m_caster)->GetSession()->SendPacket(&data); @@ -3586,7 +3596,7 @@ void Spell::TakeReagents() if (p_caster->CanNoReagentCast(m_spellInfo)) return; - for(uint32 x=0;x<8;x++) + for(uint32 x = 0; x < 8; ++x) { if(m_spellInfo->Reagent[x] <= 0) continue; @@ -3600,7 +3610,7 @@ void Spell::TakeReagents() ItemPrototype const *proto = m_CastItem->GetProto(); if( proto && proto->ItemId == itemid ) { - for(int s=0;s < MAX_ITEM_PROTO_SPELLS; ++s) + for(int s = 0; s < MAX_ITEM_PROTO_SPELLS; ++s) { // CastItem will be used up and does not count as reagent int32 charges = m_CastItem->GetSpellCharges(s); @@ -3616,7 +3626,7 @@ void Spell::TakeReagents() } // if getItemTarget is also spell reagent - if (m_targets.getItemTargetEntry()==itemid) + if (m_targets.getItemTargetEntry() == itemid) m_targets.setItemTarget(NULL); p_caster->DestroyItemCount(itemid, itemcount, true); @@ -3648,7 +3658,7 @@ void Spell::HandleEffects(Unit *pUnitTarget,Item *pItemTarget,GameObject *pGOTar uint8 eff = m_spellInfo->Effect[i]; - damage = int32(CalculateDamage((uint8)i,unitTarget)*DamageMultiplier); + damage = int32(CalculateDamage((uint8)i, unitTarget) * DamageMultiplier); sLog.outDebug( "Spell: Effect : %u", eff); @@ -3779,7 +3789,7 @@ SpellCastResult Spell::CheckCast(bool strict) if(target->getLevel() + 10 < m_spellInfo->spellLevel) return SPELL_FAILED_LOWLEVEL; } - else if (m_caster->GetTypeId()==TYPEID_PLAYER) // Target - is player caster + else if (m_caster->GetTypeId() == TYPEID_PLAYER) // Target - is player caster { // Additional check for some spells // If 0 spell effect empty - client not send target data (need use selection) @@ -3795,7 +3805,7 @@ SpellCastResult Spell::CheckCast(bool strict) } // check pet presents - for(int j=0;j<3;j++) + for(int j = 0; j < 3; ++j) { if(m_spellInfo->EffectImplicitTargetA[j] == TARGET_PET) { @@ -3817,7 +3827,7 @@ SpellCastResult Spell::CheckCast(bool strict) { if(!CheckTargetCreatureType(target)) { - if(target->GetTypeId()==TYPEID_PLAYER) + if(target->GetTypeId() == TYPEID_PLAYER) return SPELL_FAILED_TARGET_IS_PLAYER; else return SPELL_FAILED_BAD_TARGETS; @@ -3826,7 +3836,7 @@ SpellCastResult Spell::CheckCast(bool strict) // TODO: this check can be applied and for player to prevent cheating when IsPositiveSpell will return always correct result. // check target for pet/charmed casts (not self targeted), self targeted cast used for area effects and etc - if(m_caster != target && m_caster->GetTypeId()==TYPEID_UNIT && m_caster->GetCharmerOrOwnerGUID()) + if(m_caster != target && m_caster->GetTypeId() == TYPEID_UNIT && m_caster->GetCharmerOrOwnerGUID()) { // check correctness positive/negative cast target (pet cast real check and cheating check) if(IsPositiveSpell(m_spellInfo->Id)) @@ -3872,7 +3882,7 @@ SpellCastResult Spell::CheckCast(bool strict) } // Spell casted only on battleground - if((m_spellInfo->AttributesEx3 & SPELL_ATTR_EX3_BATTLEGROUND) && m_caster->GetTypeId()==TYPEID_PLAYER) + if((m_spellInfo->AttributesEx3 & SPELL_ATTR_EX3_BATTLEGROUND) && m_caster->GetTypeId() == TYPEID_PLAYER) if(!((Player*)m_caster)->InBattleGround()) return SPELL_FAILED_ONLY_BATTLEGROUNDS; @@ -3887,10 +3897,10 @@ SpellCastResult Spell::CheckCast(bool strict) // zone check uint32 zone, area; - m_caster->GetZoneAndAreaId(zone,area); + m_caster->GetZoneAndAreaId(zone, area); SpellCastResult locRes= spellmgr.GetSpellAllowedInLocationError(m_spellInfo,m_caster->GetMapId(),zone,area, - m_caster->GetTypeId()==TYPEID_PLAYER ? ((Player*)m_caster) : NULL); + m_caster->GetTypeId() == TYPEID_PLAYER ? ((Player*)m_caster) : NULL); if(locRes != SPELL_CAST_OK) return locRes; @@ -3915,7 +3925,7 @@ SpellCastResult Spell::CheckCast(bool strict) //ImpliciteTargetA-B = 38, If fact there is 0 Spell with ImpliciteTargetB=38 if(m_UniqueTargetInfo.empty()) // skip second CheckCast apply (for delayed spells for example) { - for(uint8 j = 0; j < 3; j++) + for(uint8 j = 0; j < 3; ++j) { if( m_spellInfo->EffectImplicitTargetA[j] == TARGET_SCRIPT || m_spellInfo->EffectImplicitTargetB[j] == TARGET_SCRIPT && m_spellInfo->EffectImplicitTargetA[j] != TARGET_SELF || @@ -3962,7 +3972,7 @@ SpellCastResult Spell::CheckCast(bool strict) range = go_check.GetLastRange(); } } - else if( focusObject ) //Focus Object + else if( focusObject ) // Focus Object { float frange = m_caster->GetDistance(focusObject); if(range >= frange) @@ -4084,7 +4094,7 @@ SpellCastResult Spell::CheckCast(bool strict) if(m_caster->IsInWater()) return SPELL_FAILED_ONLY_ABOVEWATER; } - else if(m_spellInfo->SpellIconID==156) // Holy Shock + else if(m_spellInfo->SpellIconID == 156) // Holy Shock { // spell different for friends and enemies // hart version required facing @@ -4194,7 +4204,7 @@ SpellCastResult Spell::CheckCast(bool strict) // Can be area effect, Check only for players and not check if target - caster (spell can have multiply drain/burn effects) if(m_caster->GetTypeId() == TYPEID_PLAYER) if(Unit* target = m_targets.getUnitTarget()) - if(target!=m_caster && target->getPowerType()!=m_spellInfo->EffectMiscValue[i]) + if(target != m_caster && target->getPowerType() != m_spellInfo->EffectMiscValue[i]) return SPELL_FAILED_BAD_TARGETS; break; } @@ -4223,14 +4233,14 @@ SpellCastResult Spell::CheckCast(bool strict) int32 skillValue = ((Player*)m_caster)->GetSkillValue(skill); int32 TargetLevel = m_targets.getUnitTarget()->getLevel(); - int32 ReqValue = (skillValue < 100 ? (TargetLevel-10)*10 : TargetLevel*5); + int32 ReqValue = (skillValue < 100 ? (TargetLevel-10) * 10 : TargetLevel * 5); if (ReqValue > skillValue) return SPELL_FAILED_LOW_CASTLEVEL; // chance for fail at orange skinning attempt if( (m_selfContainer && (*m_selfContainer) == this) && skillValue < sWorld.GetConfigMaxSkillValue() && - (ReqValue < 0 ? 0 : ReqValue) > irand(skillValue-25, skillValue+37) ) + (ReqValue < 0 ? 0 : ReqValue) > irand(skillValue - 25, skillValue + 37) ) return SPELL_FAILED_TRY_AGAIN; break; @@ -4257,17 +4267,17 @@ SpellCastResult Spell::CheckCast(bool strict) // get the lock entry uint32 lockId = 0; - if (GameObject* go=m_targets.getGOTarget()) + if (GameObject* go = m_targets.getGOTarget()) lockId = go->GetLockId(); - else if(Item* itm=m_targets.getItemTarget()) + else if(Item* itm = m_targets.getItemTarget()) lockId = itm->GetProto()->LockID; - SkillType skillId =SKILL_NONE; + SkillType skillId = SKILL_NONE; int32 reqSkillValue = 0; int32 skillValue = 0; // check lock compatibility - SpellCastResult res = CanOpenLock(i,lockId,skillId,reqSkillValue,skillValue); + SpellCastResult res = CanOpenLock(i, lockId, skillId, reqSkillValue, skillValue); if(res != SPELL_CAST_OK) return res; @@ -4278,7 +4288,7 @@ SpellCastResult Spell::CheckCast(bool strict) bool canFailAtMax = skillId != SKILL_HERBALISM && skillId != SKILL_MINING; // chance for failure in orange gather / lockpick (gathering skill can't fail at maxskill) - if((canFailAtMax || skillValue < sWorld.GetConfigMaxSkillValue()) && reqSkillValue > irand(skillValue-25, skillValue+37)) + if((canFailAtMax || skillValue < sWorld.GetConfigMaxSkillValue()) && reqSkillValue > irand(skillValue - 25, skillValue + 37)) return SPELL_FAILED_TRY_AGAIN; } break; @@ -4332,7 +4342,7 @@ SpellCastResult Spell::CheckCast(bool strict) Pet* pet = ((Player*)m_caster)->GetPet(); - if (m_caster->GetTypeId()==TYPEID_PLAYER && m_caster->getClass()==CLASS_WARLOCK) + if (m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->getClass() == CLASS_WARLOCK) { if (strict) //starting cast, trigger pet stun (cast by pet so it doesn't attack player) pet->CastSpell(pet, 32752, true, NULL, NULL, pet->GetGUID()); @@ -4348,13 +4358,13 @@ SpellCastResult Spell::CheckCast(bool strict) } case SPELL_EFFECT_SUMMON_PLAYER: { - if(m_caster->GetTypeId()!=TYPEID_PLAYER) + if(m_caster->GetTypeId() != TYPEID_PLAYER) return SPELL_FAILED_BAD_TARGETS; if(!((Player*)m_caster)->GetSelection()) return SPELL_FAILED_BAD_TARGETS; Player* target = objmgr.GetPlayer(((Player*)m_caster)->GetSelection()); - if( !target || ((Player*)m_caster)==target || !target->IsInSameRaidWith((Player*)m_caster) ) + if( !target || ((Player*)m_caster) == target || !target->IsInSameRaidWith((Player*)m_caster) ) return SPELL_FAILED_BAD_TARGETS; // check if our map is dungeon @@ -4383,11 +4393,11 @@ SpellCastResult Spell::CheckCast(bool strict) float caster_pos_z = m_caster->GetPositionZ(); // Control the caster to not climb or drop when +-fz > 8 - if(!(fz<=caster_pos_z+8 && fz>=caster_pos_z-8)) + if(!(fz <= caster_pos_z + 8 && fz >= caster_pos_z - 8)) return SPELL_FAILED_TRY_AGAIN; // not allow use this effect at battleground until battleground start - if(m_caster->GetTypeId()==TYPEID_PLAYER) + if(m_caster->GetTypeId() == TYPEID_PLAYER) if(BattleGround const *bg = ((Player*)m_caster)->GetBattleGround()) if(bg->GetStatus() != STATUS_IN_PROGRESS) return SPELL_FAILED_TRY_AGAIN; @@ -4395,7 +4405,7 @@ SpellCastResult Spell::CheckCast(bool strict) } case SPELL_EFFECT_STEAL_BENEFICIAL_BUFF: { - if (m_targets.getUnitTarget()==m_caster) + if (m_targets.getUnitTarget() == m_caster) return SPELL_FAILED_BAD_TARGETS; break; } @@ -4413,7 +4423,7 @@ SpellCastResult Spell::CheckCast(bool strict) switch(m_spellInfo->Id) { case 61336: - if(m_caster->GetTypeId()!=TYPEID_PLAYER || !((Player*)m_caster)->IsInFeralForm()) + if(m_caster->GetTypeId() != TYPEID_PLAYER || !((Player*)m_caster)->IsInFeralForm()) return SPELL_FAILED_ONLY_SHAPESHIFT; break; default: @@ -4449,11 +4459,11 @@ SpellCastResult Spell::CheckCast(bool strict) if (m_caster->IsInWater()) return SPELL_FAILED_ONLY_ABOVEWATER; - if (m_caster->GetTypeId()==TYPEID_PLAYER && ((Player*)m_caster)->GetTransport()) + if (m_caster->GetTypeId() == TYPEID_PLAYER && ((Player*)m_caster)->GetTransport()) return SPELL_FAILED_NO_MOUNTS_ALLOWED; // Ignore map check if spell have AreaId. AreaId already checked and this prevent special mount spells - if (m_caster->GetTypeId()==TYPEID_PLAYER && !sMapStore.LookupEntry(m_caster->GetMapId())->IsMountAllowed() && !m_IsTriggeredSpell && !m_spellInfo->AreaGroupId) + if (m_caster->GetTypeId() == TYPEID_PLAYER && !sMapStore.LookupEntry(m_caster->GetMapId())->IsMountAllowed() && !m_IsTriggeredSpell && !m_spellInfo->AreaGroupId) return SPELL_FAILED_NO_MOUNTS_ALLOWED; ShapeshiftForm form = m_caster->m_form; @@ -4480,7 +4490,7 @@ SpellCastResult Spell::CheckCast(bool strict) case SPELL_AURA_FLY: { // not allow cast fly spells at old maps by players (all spells is self target) - if(m_caster->GetTypeId()==TYPEID_PLAYER) + if(m_caster->GetTypeId() == TYPEID_PLAYER) { if( !((Player*)m_caster)->IsAllowUseFlyMountsHere() ) return SPELL_FAILED_NOT_HERE; @@ -4493,10 +4503,10 @@ SpellCastResult Spell::CheckCast(bool strict) if (!m_targets.getUnitTarget()) return SPELL_FAILED_BAD_IMPLICIT_TARGETS; - if (m_caster->GetTypeId()!=TYPEID_PLAYER || m_CastItem) + if (m_caster->GetTypeId() != TYPEID_PLAYER || m_CastItem) break; - if(m_targets.getUnitTarget()->getPowerType()!=POWER_MANA) + if(m_targets.getUnitTarget()->getPowerType() != POWER_MANA) return SPELL_FAILED_BAD_TARGETS; break; @@ -4530,7 +4540,7 @@ SpellCastResult Spell::CheckPetCast(Unit* target) target = m_targets.getUnitTarget(); bool need = false; - for(uint32 i = 0;i<3;++i) + for(uint32 i = 0; i < 3; ++i) { if(m_spellInfo->EffectImplicitTargetA[i] == TARGET_CHAIN_DAMAGE || m_spellInfo->EffectImplicitTargetA[i] == TARGET_SINGLE_FRIEND || m_spellInfo->EffectImplicitTargetA[i] == TARGET_DUELVSPLAYER || m_spellInfo->EffectImplicitTargetA[i] == TARGET_SINGLE_PARTY || m_spellInfo->EffectImplicitTargetA[i] == TARGET_CURRENT_ENEMY_COORDINATES) { @@ -4558,7 +4568,7 @@ SpellCastResult Spell::CheckPetCast(Unit* target) else { bool duelvsplayertar = false; - for(int j=0;j<3;j++) + for(int j = 0; j < 3; ++j) { //TARGET_DUELVSPLAYER is positive AND negative duelvsplayertar |= (m_spellInfo->EffectImplicitTargetA[j] == TARGET_DUELVSPLAYER); @@ -4582,18 +4592,18 @@ SpellCastResult Spell::CheckCasterAuras() const // Flag drop spells totally immuned to caster auras // FIXME: find more nice check for all totally immuned spells // AttributesEx3 & 0x10000000? - if(m_spellInfo->Id==23336 || m_spellInfo->Id==23334 || m_spellInfo->Id==34991) + if(m_spellInfo->Id == 23336 || m_spellInfo->Id == 23334 || m_spellInfo->Id == 34991) return SPELL_CAST_OK; uint8 school_immune = 0; uint32 mechanic_immune = 0; uint32 dispel_immune = 0; - //Check if the spell grants school or mechanic immunity. - //We use bitmasks so the loop is done only once and not on every aura check below. + // Check if the spell grants school or mechanic immunity. + // We use bitmasks so the loop is done only once and not on every aura check below. if ( m_spellInfo->AttributesEx & SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY ) { - for(int i = 0;i < 3; i ++) + for(int i = 0; i < 3; ++i) { if(m_spellInfo->EffectApplyAuraName[i] == SPELL_AURA_SCHOOL_IMMUNITY) school_immune |= uint32(m_spellInfo->EffectMiscValue[i]); @@ -4602,12 +4612,12 @@ SpellCastResult Spell::CheckCasterAuras() const else if(m_spellInfo->EffectApplyAuraName[i] == SPELL_AURA_DISPEL_IMMUNITY) dispel_immune |= GetDispellMask(DispelType(m_spellInfo->EffectMiscValue[i])); } - //immune movement impairment and loss of control - if(m_spellInfo->Id==(uint32)42292) + // immune movement impairment and loss of control + if(m_spellInfo->Id == 42292) mechanic_immune = IMMUNE_TO_MOVEMENT_IMPAIRMENT_AND_LOSS_CONTROL_MASK; } - //Check whether the cast should be prevented by any state you might have. + // Check whether the cast should be prevented by any state you might have. SpellCastResult prevented_reason = SPELL_CAST_OK; // Have to check if there is a stun aura. Otherwise will have problems with ghost aura apply while logging out uint32 unitflag = m_caster->GetUInt32Value(UNIT_FIELD_FLAGS); // Get unit state @@ -4617,9 +4627,9 @@ SpellCastResult Spell::CheckCasterAuras() const prevented_reason = SPELL_FAILED_CONFUSED; else if(unitflag & UNIT_FLAG_FLEEING && !(m_spellInfo->AttributesEx5 & SPELL_ATTR_EX5_USABLE_WHILE_FEARED)) prevented_reason = SPELL_FAILED_FLEEING; - else if(unitflag & UNIT_FLAG_SILENCED && m_spellInfo->PreventionType==SPELL_PREVENTION_TYPE_SILENCE) + else if(unitflag & UNIT_FLAG_SILENCED && m_spellInfo->PreventionType == SPELL_PREVENTION_TYPE_SILENCE) prevented_reason = SPELL_FAILED_SILENCED; - else if(unitflag & UNIT_FLAG_PACIFIED && m_spellInfo->PreventionType==SPELL_PREVENTION_TYPE_PACIFY) + else if(unitflag & UNIT_FLAG_PACIFIED && m_spellInfo->PreventionType == SPELL_PREVENTION_TYPE_PACIFY) prevented_reason = SPELL_FAILED_PACIFIED; // Attr must make flag drop spell totally immune from all effects @@ -4640,8 +4650,8 @@ SpellCastResult Spell::CheckCasterAuras() const if( (1<<(itr->second->GetSpellProto()->Dispel)) & dispel_immune) continue; - //Make a second check for spell failed so the right SPELL_FAILED message is returned. - //That is needed when your casting is prevented by multiple states and you are only immune to some of them. + // Make a second check for spell failed so the right SPELL_FAILED message is returned. + // That is needed when your casting is prevented by multiple states and you are only immune to some of them. switch(itr->second->GetModifier()->m_auraname) { case SPELL_AURA_MOD_STUN: @@ -4659,16 +4669,16 @@ SpellCastResult Spell::CheckCasterAuras() const case SPELL_AURA_MOD_SILENCE: case SPELL_AURA_MOD_PACIFY: case SPELL_AURA_MOD_PACIFY_SILENCE: - if( m_spellInfo->PreventionType==SPELL_PREVENTION_TYPE_PACIFY) + if( m_spellInfo->PreventionType == SPELL_PREVENTION_TYPE_PACIFY) return SPELL_FAILED_PACIFIED; - else if ( m_spellInfo->PreventionType==SPELL_PREVENTION_TYPE_SILENCE) + else if ( m_spellInfo->PreventionType == SPELL_PREVENTION_TYPE_SILENCE) return SPELL_FAILED_SILENCED; break; } } } } - //You are prevented from casting and the spell casted does not grant immunity. Return a failed error. + // You are prevented from casting and the spell casted does not grant immunity. Return a failed error. else return prevented_reason; } @@ -4679,7 +4689,7 @@ bool Spell::CanAutoCast(Unit* target) { uint64 targetguid = target->GetGUID(); - for(uint32 j = 0;j<3;j++) + for(uint32 j = 0; j < 3; ++j) { if(m_spellInfo->Effect[j] == SPELL_EFFECT_APPLY_AURA) { @@ -4752,9 +4762,9 @@ SpellCastResult Spell::CheckRange(bool strict) if(m_targets.m_targetMask == TARGET_FLAG_DEST_LOCATION && m_targets.m_destX != 0 && m_targets.m_destY != 0 && m_targets.m_destZ != 0) { - if(!m_caster->IsWithinDist3d(m_targets.m_destX, m_targets.m_destY, m_targets.m_destZ,max_range)) + if(!m_caster->IsWithinDist3d(m_targets.m_destX, m_targets.m_destY, m_targets.m_destZ, max_range)) return SPELL_FAILED_OUT_OF_RANGE; - if(m_caster->IsWithinDist3d(m_targets.m_destX, m_targets.m_destY, m_targets.m_destZ,min_range)) + if(m_caster->IsWithinDist3d(m_targets.m_destX, m_targets.m_destY, m_targets.m_destZ, min_range)) return SPELL_FAILED_TOO_CLOSE; } @@ -4872,16 +4882,16 @@ SpellCastResult Spell::CheckItems() if(m_CastItem) { uint32 itemid = m_CastItem->GetEntry(); - if( !p_caster->HasItemCount(itemid,1) ) + if( !p_caster->HasItemCount(itemid, 1) ) return SPELL_FAILED_ITEM_NOT_READY; ItemPrototype const *proto = m_CastItem->GetProto(); if(!proto) return SPELL_FAILED_ITEM_NOT_READY; - for (int i = 0; i<5; ++i) + for (int i = 0; i < 5; ++i) if (proto->Spells[i].SpellCharges) - if(m_CastItem->GetSpellCharges(i)==0) + if(m_CastItem->GetSpellCharges(i) == 0) return SPELL_FAILED_NO_CHARGES_REMAIN; // consumable cast item checks @@ -4964,7 +4974,7 @@ SpellCastResult Spell::CheckItems() GameObject* ok = NULL; MaNGOS::GameObjectFocusCheck go_check(m_caster,m_spellInfo->RequiresSpellFocus); - MaNGOS::GameObjectSearcher checker(m_caster,ok,go_check); + MaNGOS::GameObjectSearcher checker(m_caster, ok, go_check); TypeContainerVisitor, GridTypeMapContainer > object_checker(checker); CellLock cell_lock(cell, p); @@ -4979,7 +4989,7 @@ SpellCastResult Spell::CheckItems() // check reagents (ignore triggered spells with reagents processed by original spell) and special reagent ignore case. if (!m_IsTriggeredSpell && !p_caster->CanNoReagentCast(m_spellInfo)) { - for(uint32 i=0;i<8;++i) + for(uint32 i = 0; i < 8; ++i) { if(m_spellInfo->Reagent[i] <= 0) continue; @@ -4993,7 +5003,7 @@ SpellCastResult Spell::CheckItems() ItemPrototype const *proto = m_CastItem->GetProto(); if(!proto) return SPELL_FAILED_ITEM_NOT_READY; - for(int s=0; s < MAX_ITEM_PROTO_SPELLS; ++s) + for(int s = 0; s < MAX_ITEM_PROTO_SPELLS; ++s) { // CastItem will be used up and does not count as reagent int32 charges = m_CastItem->GetSpellCharges(s); @@ -5004,18 +5014,18 @@ SpellCastResult Spell::CheckItems() } } } - if( !p_caster->HasItemCount(itemid,itemcount) ) + if( !p_caster->HasItemCount(itemid, itemcount) ) return SPELL_FAILED_ITEM_NOT_READY; //0x54 } } // check totem-item requirements (items presence in inventory) uint32 totems = 2; - for(int i=0;i<2;++i) + for(int i = 0; i < 2 ; ++i) { if(m_spellInfo->Totem[i] != 0) { - if( p_caster->HasItemCount(m_spellInfo->Totem[i],1) ) + if( p_caster->HasItemCount(m_spellInfo->Totem[i], 1) ) { totems -= 1; continue; @@ -5028,7 +5038,7 @@ SpellCastResult Spell::CheckItems() // Check items for TotemCategory (items presence in inventory) uint32 TotemCategory = 2; - for(int i=0;i<2;++i) + for(int i= 0; i < 2; ++i) { if(m_spellInfo->TotemCategory[i] != 0) { @@ -5222,11 +5232,11 @@ SpellCastResult Spell::CheckItems() { case ITEM_SUBCLASS_WEAPON_BOW: case ITEM_SUBCLASS_WEAPON_CROSSBOW: - if(ammoProto->SubClass!=ITEM_SUBCLASS_ARROW) + if(ammoProto->SubClass != ITEM_SUBCLASS_ARROW) return SPELL_FAILED_NO_AMMO; break; case ITEM_SUBCLASS_WEAPON_GUN: - if(ammoProto->SubClass!=ITEM_SUBCLASS_BULLET) + if(ammoProto->SubClass != ITEM_SUBCLASS_BULLET) return SPELL_FAILED_NO_AMMO; break; default: @@ -5237,6 +5247,7 @@ SpellCastResult Spell::CheckItems() return SPELL_FAILED_NO_AMMO; }; break; case ITEM_SUBCLASS_WEAPON_WAND: + break; default: break; } @@ -5267,7 +5278,7 @@ void Spell::Delayed() //check pushback reduce int32 delaytime = 500; // spellcasting delay is normally 500ms int32 delayReduce = 100; // must be initialized to 100 for percent modifiers - ((Player*)m_caster)->ApplySpellMod(m_spellInfo->Id,SPELLMOD_NOT_LOSE_CASTING_TIME, delayReduce, this); + ((Player*)m_caster)->ApplySpellMod(m_spellInfo->Id, SPELLMOD_NOT_LOSE_CASTING_TIME, delayReduce, this); delayReduce += m_caster->GetTotalAuraModifier(SPELL_AURA_REDUCE_PUSHBACK) - 100; if(delayReduce >= 100) return; @@ -5282,13 +5293,13 @@ void Spell::Delayed() else m_timer += delaytime; - sLog.outDetail("Spell %u partially interrupted for (%d) ms at damage",m_spellInfo->Id,delaytime); + sLog.outDetail("Spell %u partially interrupted for (%d) ms at damage", m_spellInfo->Id, delaytime); WorldPacket data(SMSG_SPELL_DELAYED, 8+4); data.append(m_caster->GetPackGUID()); data << uint32(delaytime); - m_caster->SendMessageToSet(&data,true); + m_caster->SendMessageToSet(&data, true); } void Spell::DelayedChannel() @@ -5302,7 +5313,7 @@ void Spell::DelayedChannel() //check pushback reduce int32 delaytime = GetSpellDuration(m_spellInfo) * 25 / 100; // channeling delay is normally 25% of its time per hit int32 delayReduce = 100; // must be initialized to 100 for percent modifiers - ((Player*)m_caster)->ApplySpellMod(m_spellInfo->Id,SPELLMOD_NOT_LOSE_CASTING_TIME,delayReduce, this); + ((Player*)m_caster)->ApplySpellMod(m_spellInfo->Id, SPELLMOD_NOT_LOSE_CASTING_TIME, delayReduce, this); delayReduce += m_caster->GetTotalAuraModifier(SPELL_AURA_REDUCE_PUSHBACK) - 100; if(delayReduce >= 100) return; @@ -5319,22 +5330,22 @@ void Spell::DelayedChannel() sLog.outDebug("Spell %u partially interrupted for %i ms, new duration: %u ms", m_spellInfo->Id, delaytime, m_timer); - for(std::list::const_iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit) + for(std::list::const_iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) { if ((*ihit).missCondition == SPELL_MISS_NONE) { - Unit* unit = m_caster->GetGUID()==ihit->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID); + Unit* unit = m_caster->GetGUID() == ihit->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID); if (unit) { - for (int j=0;j<3;j++) - if( ihit->effectMask & (1<effectMask & (1 << j) ) unit->DelayAura(m_spellInfo->Id, j, delaytime); } } } - for(int j = 0; j < 3; j++) + for(int j = 0; j < 3; ++j) { // partially interrupt persistent area auras DynamicObject* dynObj = m_caster->GetDynObject(m_spellInfo->Id, j); @@ -5405,7 +5416,7 @@ CurrentSpellTypes Spell::GetCurrentContainer() bool Spell::CheckTarget( Unit* target, uint32 eff ) { // Check targets for creature type mask and remove not appropriate (skip explicit self target case, maybe need other explicit targets) - if(m_spellInfo->EffectImplicitTargetA[eff]!=TARGET_SELF ) + if(m_spellInfo->EffectImplicitTargetA[eff] != TARGET_SELF ) { if (!CheckTargetCreatureType(target)) return false; @@ -5434,9 +5445,9 @@ bool Spell::CheckTarget( Unit* target, uint32 eff ) } //Check player targets and remove if in GM mode or GM invisibility (for not self casting case) - if( target != m_caster && target->GetTypeId()==TYPEID_PLAYER) + if( target != m_caster && target->GetTypeId() == TYPEID_PLAYER) { - if(((Player*)target)->GetVisibility()==VISIBILITY_OFF) + if(((Player*)target)->GetVisibility() == VISIBILITY_OFF) return false; if(((Player*)target)->isGameMaster() && !IsPositiveSpell(m_spellInfo->Id)) @@ -5449,21 +5460,21 @@ bool Spell::CheckTarget( Unit* target, uint32 eff ) case SPELL_EFFECT_SUMMON_PLAYER: // from anywhere break; case SPELL_EFFECT_DUMMY: - if(m_spellInfo->Id!=20577) // Cannibalize + if(m_spellInfo->Id != 20577) // Cannibalize break; //fall through case SPELL_EFFECT_RESURRECT_NEW: // player far away, maybe his corpse near? - if(target!=m_caster && !target->IsWithinLOSInMap(m_caster)) + if(target != m_caster && !target->IsWithinLOSInMap(m_caster)) { if(!m_targets.getCorpseTargetGUID()) return false; - Corpse *corpse = ObjectAccessor::GetCorpse(*m_caster,m_targets.getCorpseTargetGUID()); + Corpse *corpse = ObjectAccessor::GetCorpse(*m_caster, m_targets.getCorpseTargetGUID()); if(!corpse) return false; - if(target->GetGUID()!=corpse->GetOwnerGUID()) + if(target->GetGUID() != corpse->GetOwnerGUID()) return false; if(!corpse->IsWithinLOSInMap(m_caster)) @@ -5479,7 +5490,7 @@ bool Spell::CheckTarget( Unit* target, uint32 eff ) caster = m_caster->GetMap()->GetGameObject(m_originalCasterGUID); if (!caster) caster = m_caster; - if(target!=m_caster && !target->IsWithinLOSInMap(caster)) + if(target != m_caster && !target->IsWithinLOSInMap(caster)) return false; break; } @@ -5495,16 +5506,16 @@ bool Spell::IsNeedSendToClient() const bool Spell::HaveTargetsForEffect( uint8 effect ) const { - for(std::list::const_iterator itr= m_UniqueTargetInfo.begin();itr != m_UniqueTargetInfo.end();++itr) - if(itr->effectMask & (1<::const_iterator itr = m_UniqueTargetInfo.begin(); itr != m_UniqueTargetInfo.end(); ++itr) + if(itr->effectMask & (1 << effect)) return true; - for(std::list::const_iterator itr= m_UniqueGOTargetInfo.begin();itr != m_UniqueGOTargetInfo.end();++itr) - if(itr->effectMask & (1<::const_iterator itr = m_UniqueGOTargetInfo.begin(); itr != m_UniqueGOTargetInfo.end(); ++itr) + if(itr->effectMask & (1 << effect)) return true; - for(std::list::const_iterator itr= m_UniqueItemInfo.begin();itr != m_UniqueItemInfo.end();++itr) - if(itr->effectMask & (1<::const_iterator itr = m_UniqueItemInfo.begin(); itr != m_UniqueItemInfo.end(); ++itr) + if(itr->effectMask & (1 << effect)) return true; return false; @@ -5527,7 +5538,7 @@ SpellEvent::~SpellEvent() else { sLog.outError("~SpellEvent: %s %u tried to delete non-deletable spell %u. Was not deleted, causes memory leak.", - (m_Spell->GetCaster()->GetTypeId()==TYPEID_PLAYER?"Player":"Creature"), m_Spell->GetCaster()->GetGUIDLow(),m_Spell->m_spellInfo->Id); + (m_Spell->GetCaster()->GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature"), m_Spell->GetCaster()->GetGUIDLow(), m_Spell->m_spellInfo->Id); } } @@ -5546,8 +5557,7 @@ bool SpellEvent::Execute(uint64 e_time, uint32 p_time) if (m_Spell->IsDeletable()) { // check, if we do have unfinished triggered spells - - return(true); // spell is deletable, finish event + return true; // spell is deletable, finish event } // event will be re-added automatically at the end of routine) } break; @@ -5590,7 +5600,7 @@ bool SpellEvent::Execute(uint64 e_time, uint32 p_time) { // re-add us to the queue m_Spell->GetCaster()->m_Events.AddEvent(this, m_Spell->GetDelayStart() + n_offset, false); - return(false); // event not complete + return false; // event not complete } // event complete // finish update event will be re-added automatically at the end of routine) @@ -5602,7 +5612,7 @@ bool SpellEvent::Execute(uint64 e_time, uint32 p_time) m_Spell->SetDelayStart(e_time); // re-plan the event for the delay moment m_Spell->GetCaster()->m_Events.AddEvent(this, e_time + m_Spell->GetDelayMoment(), false); - return(false); // event not complete + return false; // event not complete } } break; @@ -5615,7 +5625,7 @@ bool SpellEvent::Execute(uint64 e_time, uint32 p_time) // spell processing not complete, plan event on the next update interval m_Spell->GetCaster()->m_Events.AddEvent(this, e_time + 1, false); - return(false); // event not complete + return false; // event not complete } void SpellEvent::Abort(uint64 /*e_time*/) diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 74e9446f3..2b4ce206d 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -2584,7 +2584,7 @@ void Aura::HandleAuraModShapeshift(bool apply, bool Real) modelid = 10045; break; case FORM_DIREBEAR: - if(Player::TeamForRace(m_target->getRace())==ALLIANCE) + if(Player::TeamForRace(m_target->getRace()) == ALLIANCE) modelid = 2281; else modelid = 2289; @@ -3414,7 +3414,7 @@ void Aura::HandleAuraModStun(bool apply, bool Real) if(m_target->GetTypeId() != TYPEID_PLAYER) ((Creature*)m_target)->StopMoving(); else - ((Player*)m_target)->m_movementInfo.flags = 0; //Clear movement flags + ((Player*)m_target)->m_movementInfo.flags = 0; // Clear movement flags WorldPacket data(SMSG_FORCE_MOVE_ROOT, 8); data.append(m_target->GetPackGUID()); @@ -4066,7 +4066,7 @@ void Aura::HandleAuraModStateImmunity(bool apply, bool Real) void Aura::HandleAuraModSchoolImmunity(bool apply, bool Real) { - m_target->ApplySpellImmune(GetId(),IMMUNITY_SCHOOL,m_modifier.m_miscvalue,apply); + m_target->ApplySpellImmune(GetId(), IMMUNITY_SCHOOL, m_modifier.m_miscvalue, apply); // remove all flag auras (they are positive, but they must be removed when you are immune) if( this->GetSpellProto()->AttributesEx & SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 0a80ee481..e380ed32b 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -279,7 +279,7 @@ void Spell::EffectInstaKill(uint32 /*i*/) m_caster->CastSpell(m_caster, spellID, true); } - if(m_caster == unitTarget) // prevent interrupt message + if(m_caster == unitTarget) // prevent interrupt message finish(); m_caster->DealDamage(unitTarget, unitTarget->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); @@ -2718,7 +2718,7 @@ void Spell::EffectCreateItem2(uint32 i) // remove reagent uint32 count = 1; - player->DestroyItemCount (item_id, count, true); + player->DestroyItemCount(item_id, count, true); } // create some random items diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 3883bbfb0..89cb0fadc 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -4250,7 +4250,7 @@ void Unit::SendSpellNonMeleeDamageLog(SpellNonMeleeDamage *log) SendMessageToSet( &data, true ); } -void Unit::SendSpellNonMeleeDamageLog(Unit *target, uint32 SpellID,uint32 Damage, SpellSchoolMask damageSchoolMask, uint32 AbsorbedDamage, uint32 Resist,bool PhysicalDamage, uint32 Blocked, bool CriticalHit) +void Unit::SendSpellNonMeleeDamageLog(Unit *target, uint32 SpellID, uint32 Damage, SpellSchoolMask damageSchoolMask, uint32 AbsorbedDamage, uint32 Resist, bool PhysicalDamage, uint32 Blocked, bool CriticalHit) { SpellNonMeleeDamage log(this, target, SpellID, damageSchoolMask); log.damage = Damage - AbsorbedDamage - Resist - Blocked; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index f19858cdd..527d62ebb 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "7910" + #define REVISION_NR "7911" #endif // __REVISION_NR_H__