diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 3ce6649c2..5869820e9 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -422,6 +422,9 @@ Player::Player (WorldSession *session): Unit(), m_achievementMgr(this), m_reputa m_lastPotionId = 0; + m_activeSpec = 0; + m_speakCount = 0; + for (int i = 0; i < BASEMOD_END; ++i) { m_auraBaseMod[i][FLAT_MOD] = 0.0f; @@ -2740,7 +2743,7 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen if(next_active_spell_id) { // update spell ranks in spellbook and action bar - WorldPacket data(SMSG_SUPERCEDED_SPELL, (4)); + WorldPacket data(SMSG_SUPERCEDED_SPELL, 4 + 4); data << uint32(spell_id); data << uint32(next_active_spell_id); GetSession()->SendPacket( &data ); @@ -2839,7 +2842,7 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen { if(IsInWorld()) // not send spell (re-/over-)learn packets at loading { - WorldPacket data(SMSG_SUPERCEDED_SPELL, (4)); + WorldPacket data(SMSG_SUPERCEDED_SPELL, 4 + 4); data << uint32(itr2->first); data << uint32(spell_id); GetSession()->SendPacket( &data ); @@ -2855,7 +2858,7 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen { if(IsInWorld()) // not send spell (re-/over-)learn packets at loading { - WorldPacket data(SMSG_SUPERCEDED_SPELL, (4)); + WorldPacket data(SMSG_SUPERCEDED_SPELL, 4 + 4); data << uint32(spell_id); data << uint32(itr2->first); GetSession()->SendPacket( &data ); @@ -3003,7 +3006,7 @@ bool Player::IsNeedCastPassiveSpellAtLearn(SpellEntry const* spellInfo) const switch(spellInfo->Id) { - // some spells not have stance data expacted cast at form change or present + // some spells not have stance data expected cast at form change or present case 5420: need_cast = (m_form == FORM_TREE); break; case 5419: need_cast = (m_form == FORM_TRAVEL); break; case 7376: need_cast = (m_form == FORM_DEFENSIVESTANCE); break; @@ -3213,7 +3216,7 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool update_action_bar_ if(update_action_bar_for_low_rank) { // downgrade spell ranks in spellbook and action bar - WorldPacket data(SMSG_SUPERCEDED_SPELL, (4)); + WorldPacket data(SMSG_SUPERCEDED_SPELL, 4 + 4); data << uint32(spell_id); data << uint32(prev_id); GetSession()->SendPacket( &data ); @@ -3241,7 +3244,7 @@ void Player::RemoveSpellCooldown( uint32 spell_id, bool update /* = false */ ) if(update) { - WorldPacket data(SMSG_CLEAR_COOLDOWN, (4+8)); + WorldPacket data(SMSG_CLEAR_COOLDOWN, 4+8); data << uint32(spell_id); data << uint64(GetGUID()); SendDirectMessage(&data); @@ -3264,7 +3267,7 @@ void Player::RemoveArenaSpellCooldowns() entry->CategoryRecoveryTime <= 15 * MINUTE * IN_MILISECONDS ) { // notify player - WorldPacket data(SMSG_CLEAR_COOLDOWN, (4+8)); + WorldPacket data(SMSG_CLEAR_COOLDOWN, 4+8); data << uint32(itr->first); data << uint64(GetGUID()); GetSession()->SendPacket(&data); @@ -3280,7 +3283,7 @@ void Player::RemoveAllSpellCooldown() { for(SpellCooldowns::const_iterator itr = m_spellCooldowns.begin();itr != m_spellCooldowns.end(); ++itr) { - WorldPacket data(SMSG_CLEAR_COOLDOWN, (4+8)); + WorldPacket data(SMSG_CLEAR_COOLDOWN, 4+8); data << uint32(itr->first); data << uint64(GetGUID()); GetSession()->SendPacket(&data); @@ -14921,18 +14924,18 @@ void Player::_LoadQuestStatus(QueryResult *result) // add to quest log if( slot < MAX_QUEST_LOG_SIZE && - ( questStatusData.m_status==QUEST_STATUS_INCOMPLETE || - questStatusData.m_status==QUEST_STATUS_COMPLETE && + ( questStatusData.m_status == QUEST_STATUS_INCOMPLETE || + questStatusData.m_status == QUEST_STATUS_COMPLETE && (!questStatusData.m_rewarded || pQuest->IsDaily()) ) ) { - SetQuestSlot(slot,quest_id,quest_time); + SetQuestSlot(slot, quest_id, quest_time); if(questStatusData.m_status == QUEST_STATUS_COMPLETE) - SetQuestSlotState(slot,QUEST_STATE_COMPLETE); + SetQuestSlotState(slot, QUEST_STATE_COMPLETE); for(uint8 idx = 0; idx < QUEST_OBJECTIVES_COUNT; ++idx) if(questStatusData.m_creatureOrGOcount[idx]) - SetQuestSlotCounter(slot,idx,questStatusData.m_creatureOrGOcount[idx]); + SetQuestSlotCounter(slot, idx, questStatusData.m_creatureOrGOcount[idx]); ++slot; } @@ -14950,7 +14953,7 @@ void Player::_LoadQuestStatus(QueryResult *result) } if(pQuest->GetBonusTalents()) - m_questRewardTalentCount+=pQuest->GetBonusTalents(); + m_questRewardTalentCount += pQuest->GetBonusTalents(); } sLog.outDebug("Quest status is {%u} for quest {%u} for player (GUID: %u)", questStatusData.m_status, quest_id, GetGUIDLow()); @@ -14963,7 +14966,7 @@ void Player::_LoadQuestStatus(QueryResult *result) // clear quest log tail for ( uint16 i = slot; i < MAX_QUEST_LOG_SIZE; ++i ) - SetQuestSlot(i,0); + SetQuestSlot(i, 0); } void Player::_LoadDailyQuestStatus(QueryResult *result) @@ -15177,7 +15180,7 @@ void Player::SendRaidInfo() } } } - data.put(p_counter,counter); + data.put(p_counter, counter); GetSession()->SendPacket(&data); } @@ -16962,8 +16965,8 @@ void Player::ProhibitSpellScholl(SpellSchoolMask idSchoolMask, uint32 unTimeMs ) if((idSchoolMask & GetSpellSchoolMask(spellInfo)) && GetSpellCooldownDelay(unSpellId) < unTimeMs ) { - data << unSpellId; - data << unTimeMs; // in m.secs + data << uint32(unSpellId); + data << uint32(unTimeMs); // in m.secs AddSpellCooldown(unSpellId, 0, curTime + unTimeMs/IN_MILISECONDS); } } @@ -17954,7 +17957,7 @@ void Player::SendInitialPacketsBeforeAddToMap() SendEquipmentSetList(); - data.Initialize(SMSG_LOGIN_SETTIMESPEED, 8); + data.Initialize(SMSG_LOGIN_SETTIMESPEED, 4 + 4 + 4); data << uint32(secsToTimeBitFields(sWorld.GetGameTime())); data << (float)0.01666667f; // game speed data << uint32(0); // added in 3.1.2 @@ -20280,4 +20283,12 @@ void Player::DeleteEquipmentSet(uint64 setGuid) break; } } +} + +void Player::ActivateSpec(uint32 specNum) +{ + if(GetActiveSpec() == specNum) + return; + + resetTalents(true); } \ No newline at end of file diff --git a/src/game/Player.h b/src/game/Player.h index 5a9197010..e22ee70a6 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -1402,6 +1402,13 @@ class MANGOS_DLL_SPEC Player : public Unit uint32 CalculateTalentsPoints() const; + // Dual Spec + uint32 GetActiveSpec() { return m_activeSpec; } + void SetActiveSpec(uint32 spec) { m_activeSpec = spec; } + uint32 GetSpecsCount() { return m_specsCount; } + void SetSpecsCount(uint32 count) { m_specsCount = count; } + void ActivateSpec(uint32 specNum); + void InitGlyphsForLevel(); void SetGlyphSlot(uint8 slot, uint32 slottype) { SetUInt32Value(PLAYER_FIELD_GLYPH_SLOTS_1 + slot, slottype); } uint32 GetGlyphSlot(uint8 slot) { return GetUInt32Value(PLAYER_FIELD_GLYPH_SLOTS_1 + slot); } @@ -2209,6 +2216,9 @@ class MANGOS_DLL_SPEC Player : public Unit SpellCooldowns m_spellCooldowns; uint32 m_lastPotionId; // last used health/mana potion in combat, that block next potion use + uint32 m_activeSpec; + uint32 m_specsCount; + ActionButtonList m_actionButtons; float m_auraBaseMod[BASEMOD_END][MOD_END]; diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 34d0bd167..24799c189 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -390,12 +390,12 @@ m_isRemovedOnShapeLost(true), m_updated(false), m_in_use(false) ItemRandomSuffixEntry const *item_rand_suffix = sItemRandomSuffixStore.LookupEntry(abs(castItem->GetItemRandomPropertyId())); if(item_rand_suffix) { - for (int k=0; k<3; k++) + for (int k = 0; k < 3; ++k) { SpellItemEnchantmentEntry const *pEnchant = sSpellItemEnchantmentStore.LookupEntry(item_rand_suffix->enchant_id[k]); if(pEnchant) { - for (int t=0; t<3; t++) + for (int t = 0; t < 3; ++t) if(pEnchant->spellid[t] == m_spellProto->Id) { damage = uint32((item_rand_suffix->prefix[k]*castItem->GetItemSuffixFactor()) / 10000 ); @@ -562,7 +562,7 @@ Unit* Aura::GetCaster() const void Aura::SetModifier(AuraType t, int32 a, uint32 pt, int32 miscValue) { m_modifier.m_auraname = t; - m_modifier.m_amount = a; + m_modifier.m_amount = a; m_modifier.m_miscvalue = miscValue; m_modifier.periodictime = pt; } @@ -602,7 +602,7 @@ void Aura::Update(uint32 diff) Unit* caster = GetCaster(); if(!caster) { - m_target->RemoveAura(GetId(),GetEffIndex()); + m_target->RemoveAura(GetId(), GetEffIndex()); return; } @@ -621,11 +621,11 @@ void Aura::Update(uint32 diff) } if(Player* modOwner = caster->GetSpellModOwner()) - modOwner->ApplySpellMod(GetId(), mod, radius,NULL); + modOwner->ApplySpellMod(GetId(), mod, radius, NULL); - if(!caster->IsWithinDistInMap(m_target,radius)) + if(!caster->IsWithinDistInMap(m_target, radius)) { - m_target->RemoveAura(GetId(),GetEffIndex()); + m_target->RemoveAura(GetId(), GetEffIndex()); return; } } @@ -890,8 +890,8 @@ void Aura::ApplyModifier(bool apply, bool Real) AuraType aura = m_modifier.m_auraname; m_in_use = true; - if(auraGetAuras().lower_bound(spair); itr != m_target->GetAuras().upper_bound(spair); ++itr) @@ -978,7 +978,7 @@ void Aura::_AddAura() // register aura diminishing on apply if (getDiminishGroup() != DIMINISHING_NONE ) - m_target->ApplyDiminishingAura(getDiminishGroup(),true); + m_target->ApplyDiminishingAura(getDiminishGroup(), true); // Update Seals information if (IsSealSpell(m_spellProto)) @@ -1043,12 +1043,12 @@ void Aura::_RemoveAura() bool lastaura = true; // find other aura in same slot (current already removed from list) - for(uint8 i = 0; i < 3; i++) + for(uint8 i = 0; i < 3; ++i) { Unit::spellEffectPair spair = Unit::spellEffectPair(GetId(), i); for(Unit::AuraMap::const_iterator itr = m_target->GetAuras().lower_bound(spair); itr != m_target->GetAuras().upper_bound(spair); ++itr) { - if(itr->second->GetAuraSlot()==slot) + if(itr->second->GetAuraSlot() == slot) { lastaura = false; break; @@ -1063,7 +1063,7 @@ void Aura::_RemoveAura() { // unregister aura diminishing (and store last time) if (getDiminishGroup() != DIMINISHING_NONE ) - m_target->ApplyDiminishingAura(getDiminishGroup(),false); + m_target->ApplyDiminishingAura(getDiminishGroup(), false); SetAura(true); SetAuraFlags(AFLAG_NONE); @@ -1306,7 +1306,7 @@ void Aura::HandleAddModifier(bool apply, bool Real) m_target->RemoveAurasDueToSpell(45471); if(apply) - m_target->CastSpell(m_target,45471,true); + m_target->CastSpell(m_target, 45471, true); } } void Aura::HandleAddTargetTrigger(bool apply, bool /*Real*/) @@ -1500,7 +1500,7 @@ void Aura::TriggerSpell() case 27808: { int32 bpDamage = target->GetMaxHealth()*26/100; - caster->CastCustomSpell(target,29879,&bpDamage,NULL,NULL,true,NULL,this); + caster->CastCustomSpell(target, 29879, &bpDamage, NULL, NULL, true, NULL, this); return; } // // Detonate Mana @@ -1525,7 +1525,7 @@ void Aura::TriggerSpell() // case 29519: break; // Inoculate Nestlewood Owlkin case 29528: - if(target->GetTypeId()!=TYPEID_UNIT)// prevent error reports in case ignored player target + if(target->GetTypeId() != TYPEID_UNIT)// prevent error reports in case ignored player target return; break; // // Overload @@ -1618,9 +1618,9 @@ void Aura::TriggerSpell() { // cast 24 spells 34269-34289, 34314-34316 for(uint32 spell_id = 34269; spell_id != 34290; ++spell_id) - caster->CastSpell(m_target,spell_id,true); + caster->CastSpell(m_target, spell_id, true); for(uint32 spell_id = 34314; spell_id != 34317; ++spell_id) - caster->CastSpell(m_target,spell_id,true); + caster->CastSpell(m_target, spell_id, true); return; } // // Gravity Lapse @@ -1859,7 +1859,7 @@ void Aura::TriggerSpell() lRage = 100; m_target->ModifyPower(POWER_RAGE, -lRage); int32 FRTriggerBasePoints = int32(lRage*LifePerRage/10); - m_target->CastCustomSpell(m_target,22845,&FRTriggerBasePoints,NULL,NULL,true,NULL,this); + m_target->CastCustomSpell(m_target, 22845, &FRTriggerBasePoints, NULL, NULL, true, NULL, this); return; } default: @@ -1936,7 +1936,7 @@ void Aura::TriggerSpell() } if(all) - caster->CastSpell(caster,38437,true); + caster->CastSpell(caster, 38437, true); else caster->RemoveAurasDueToSpell(38437); return; @@ -2051,7 +2051,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real) case 13139: // net-o-matic // root to self part of (root_target->charge->root_self sequence if(caster) - caster->CastSpell(caster,13138,true,NULL,this); + caster->CastSpell(caster, 13138, true, NULL, this); return; case 39850: // Rocket Blast if(roll_chance_i(20)) // backfire stun @@ -2066,10 +2066,10 @@ void Aura::HandleAuraDummy(bool apply, bool Real) switch(caster->getGender()) { case GENDER_FEMALE: - caster->CastSpell(m_target,46356,true,NULL,this); + caster->CastSpell(m_target, 46356, true, NULL, this); break; case GENDER_MALE: - caster->CastSpell(m_target,46355,true,NULL,this); + caster->CastSpell(m_target, 46355, true, NULL, this); break; default: break; @@ -2077,7 +2077,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real) } return; case 46699: // Requires No Ammo - if(m_target->GetTypeId()==TYPEID_PLAYER) + if(m_target->GetTypeId() == TYPEID_PLAYER) ((Player*)m_target)->RemoveAmmo(); // not use ammo and not allow use return; } @@ -2086,7 +2086,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real) if ( caster && GetSpellProto()->SpellFamilyName == SPELLFAMILY_SHAMAN && (GetSpellProto()->SpellFamilyFlags & 0x40000000000LL)) { // prevent double apply bonuses - if(m_target->GetTypeId()!=TYPEID_PLAYER || !((Player*)m_target)->GetSession()->PlayerLoading()) + if(m_target->GetTypeId() != TYPEID_PLAYER || !((Player*)m_target)->GetSession()->PlayerLoading()) m_modifier.m_amount = caster->SpellHealingBonus(m_target, GetSpellProto(), m_modifier.m_amount, SPELL_DIRECT_DAMAGE); return; } @@ -2131,7 +2131,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real) } if(finalSpelId) - caster->CastSpell(m_target,finalSpelId,true,NULL,this); + caster->CastSpell(m_target, finalSpelId, true, NULL, this); return; } @@ -2155,7 +2155,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real) case 46308: // Burning Winds { // casted only at creatures at spawn - m_target->CastSpell(m_target,47287,true,NULL,this); + m_target->CastSpell(m_target, 47287, true, NULL, this); return; } } @@ -2231,7 +2231,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real) if (owner && owner->GetTypeId() == TYPEID_PLAYER) { if(apply) - owner->CastSpell(owner,8985,true); + owner->CastSpell(owner, 8985, true); else ((Player*)owner)->RemovePet(NULL, PET_SAVE_NOT_IN_SLOT, true); } @@ -2247,7 +2247,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real) if (owner && owner->GetTypeId() == TYPEID_PLAYER) { if(apply) - owner->CastSpell(owner,19704,true); + owner->CastSpell(owner, 19704, true); else ((Player*)owner)->RemovePet(NULL, PET_SAVE_NOT_IN_SLOT, true); } @@ -2361,7 +2361,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real) else { // Final heal only on dispelled or duration end - if ( !(GetAuraDuration() <= 0 || m_removeMode==AURA_REMOVE_BY_DISPEL) ) + if ( !(GetAuraDuration() <= 0 || m_removeMode == AURA_REMOVE_BY_DISPEL) ) return; // have a look if there is still some other Lifebloom dummy aura @@ -2375,7 +2375,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real) if(m_target->IsInWorld() && m_stackAmount > 0) { int32 amount = m_modifier.m_amount / m_stackAmount; - m_target->CastCustomSpell(m_target,33778,&amount,NULL,NULL,true,NULL,this,GetCasterGUID()); + m_target->CastCustomSpell(m_target, 33778, &amount, NULL, NULL, true, NULL, this, GetCasterGUID()); } } return; @@ -2441,18 +2441,18 @@ void Aura::HandleAuraDummy(bool apply, bool Real) if(saBounds.first != saBounds.second) { uint32 zone, area; - m_target->GetZoneAndAreaId(zone,area); + m_target->GetZoneAndAreaId(zone, area); for(SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr) { // some auras remove at aura remove - if(!itr->second->IsFitToRequirements((Player*)m_target,zone,area)) + if(!itr->second->IsFitToRequirements((Player*)m_target, zone, area)) m_target->RemoveAurasDueToSpell(itr->second->spellId); // some auras applied at aura apply else if(itr->second->autocast) { - if( !m_target->HasAura(itr->second->spellId,0) ) - m_target->CastSpell(m_target,itr->second->spellId,true); + if( !m_target->HasAura(itr->second->spellId, 0) ) + m_target->CastSpell(m_target, itr->second->spellId, true); } } } @@ -2504,7 +2504,7 @@ void Aura::HandleAuraWaterWalk(bool apply, bool Real) data.Initialize(SMSG_MOVE_LAND_WALK, 8+4); data.append(m_target->GetPackGUID()); data << uint32(0); - m_target->SendMessageToSet(&data,true); + m_target->SendMessageToSet(&data, true); } void Aura::HandleAuraFeatherFall(bool apply, bool Real) @@ -2519,8 +2519,8 @@ void Aura::HandleAuraFeatherFall(bool apply, bool Real) else data.Initialize(SMSG_MOVE_NORMAL_FALL, 8+4); data.append(m_target->GetPackGUID()); - data << (uint32)0; - m_target->SendMessageToSet(&data,true); + data << uint32(0); + m_target->SendMessageToSet(&data, true); } void Aura::HandleAuraHover(bool apply, bool Real) @@ -2536,7 +2536,7 @@ void Aura::HandleAuraHover(bool apply, bool Real) data.Initialize(SMSG_MOVE_UNSET_HOVER, 8+4); data.append(m_target->GetPackGUID()); data << uint32(0); - m_target->SendMessageToSet(&data,true); + m_target->SendMessageToSet(&data, true); } void Aura::HandleWaterBreathing(bool /*apply*/, bool /*Real*/) @@ -2557,7 +2557,7 @@ void Aura::HandleAuraModShapeshift(bool apply, bool Real) switch(form) { case FORM_CAT: - if(Player::TeamForRace(m_target->getRace())==ALLIANCE) + if(Player::TeamForRace(m_target->getRace()) == ALLIANCE) modelid = 892; else modelid = 8571; @@ -2567,20 +2567,20 @@ void Aura::HandleAuraModShapeshift(bool apply, bool Real) modelid = 632; break; case FORM_AQUA: - if(Player::TeamForRace(m_target->getRace())==ALLIANCE) + if(Player::TeamForRace(m_target->getRace()) == ALLIANCE) modelid = 2428; else modelid = 2428; break; case FORM_BEAR: - if(Player::TeamForRace(m_target->getRace())==ALLIANCE) + if(Player::TeamForRace(m_target->getRace()) == ALLIANCE) modelid = 2281; else modelid = 2289; PowerType = POWER_RAGE; break; case FORM_GHOUL: - if(Player::TeamForRace(m_target->getRace())==ALLIANCE) + if(Player::TeamForRace(m_target->getRace()) == ALLIANCE) modelid = 10045; break; case FORM_DIREBEAR: @@ -2597,19 +2597,19 @@ void Aura::HandleAuraModShapeshift(bool apply, bool Real) modelid = 4613; break; case FORM_FLIGHT: - if(Player::TeamForRace(m_target->getRace())==ALLIANCE) + if(Player::TeamForRace(m_target->getRace()) == ALLIANCE) modelid = 20857; else modelid = 20872; break; case FORM_MOONKIN: - if(Player::TeamForRace(m_target->getRace())==ALLIANCE) + if(Player::TeamForRace(m_target->getRace()) == ALLIANCE) modelid = 15374; else modelid = 15375; break; case FORM_FLIGHT_EPIC: - if(Player::TeamForRace(m_target->getRace())==ALLIANCE) + if(Player::TeamForRace(m_target->getRace()) == ALLIANCE) modelid = 21243; else modelid = 21244; @@ -2664,7 +2664,7 @@ void Aura::HandleAuraModShapeshift(bool apply, bool Real) { // remove other shapeshift before applying a new one if(m_target->m_ShapeShiftFormSpellId) - m_target->RemoveAurasDueToSpell(m_target->m_ShapeShiftFormSpellId,this); + m_target->RemoveAurasDueToSpell(m_target->m_ShapeShiftFormSpellId, this); m_target->SetByteValue(UNIT_FIELD_BYTES_2, 3, form); @@ -2674,7 +2674,7 @@ void Aura::HandleAuraModShapeshift(bool apply, bool Real) if(PowerType != POWER_MANA) { // reset power to default values only at power change - if(m_target->getPowerType()!=PowerType) + if(m_target->getPowerType() != PowerType) m_target->setPowerType(PowerType); switch(form) @@ -2697,15 +2697,15 @@ void Aura::HandleAuraModShapeshift(bool apply, bool Real) if (m_modifier.m_miscvalue == FORM_CAT) { - m_target->SetPower(POWER_ENERGY,0); + m_target->SetPower(POWER_ENERGY, 0); if(urand(1,100) <= FurorChance) - m_target->CastSpell(m_target,17099,true,NULL,this); + m_target->CastSpell(m_target, 17099, true, NULL, this); } else { - m_target->SetPower(POWER_RAGE,0); + m_target->SetPower(POWER_RAGE, 0); if(urand(1,100) <= FurorChance) - m_target->CastSpell(m_target,17057,true,NULL,this); + m_target->CastSpell(m_target, 17057, true, NULL, this); } break; } @@ -2723,12 +2723,12 @@ void Aura::HandleAuraModShapeshift(bool apply, bool Real) if(itr->second->state == PLAYERSPELL_REMOVED) continue; SpellEntry const *spellInfo = sSpellStore.LookupEntry(itr->first); if (spellInfo && spellInfo->SpellFamilyName == SPELLFAMILY_WARRIOR && spellInfo->SpellIconID == 139) - Rage_val += m_target->CalculateSpellDamage(spellInfo,0,spellInfo->EffectBasePoints[0],m_target) * 10; + Rage_val += m_target->CalculateSpellDamage(spellInfo, 0, spellInfo->EffectBasePoints[0], m_target) * 10; } } if (m_target->GetPower(POWER_RAGE) > Rage_val) - m_target->SetPower(POWER_RAGE,Rage_val); + m_target->SetPower(POWER_RAGE, Rage_val); break; } default: @@ -2756,12 +2756,12 @@ void Aura::HandleAuraModShapeshift(bool apply, bool Real) case FORM_DIREBEAR: case FORM_CAT: if(Aura* dummy = m_target->GetDummyAura(37315) ) - m_target->CastSpell(m_target,37316,true,NULL,dummy); + m_target->CastSpell(m_target, 37316, true, NULL, dummy); break; // Nordrassil Regalia - bonus case FORM_MOONKIN: if(Aura* dummy = m_target->GetDummyAura(37324) ) - m_target->CastSpell(m_target,37325,true,NULL,dummy); + m_target->CastSpell(m_target, 37325, true, NULL, dummy); break; default: break; @@ -2772,7 +2772,7 @@ void Aura::HandleAuraModShapeshift(bool apply, bool Real) // add/remove the shapeshift aura's boosts HandleShapeshiftBoosts(apply); - if(m_target->GetTypeId()==TYPEID_PLAYER) + if(m_target->GetTypeId() == TYPEID_PLAYER) ((Player*)m_target)->InitDataForForm(); } @@ -2781,10 +2781,10 @@ void Aura::HandleAuraTransform(bool apply, bool Real) if (apply) { // special case (spell specific functionality) - if (m_modifier.m_miscvalue==0) + if (m_modifier.m_miscvalue == 0) { // player applied only - if (m_target->GetTypeId()!=TYPEID_PLAYER) + if (m_target->GetTypeId() != TYPEID_PLAYER) return; switch (GetId()) @@ -2906,7 +2906,7 @@ void Aura::HandleAuraTransform(bool apply, bool Real) } // Dragonmaw Illusion (restore mount model) - if (GetId()==42016 && m_target->GetMountID()==16314) + if (GetId() == 42016 && m_target->GetMountID() == 16314) { if (!m_target->GetAurasByType(SPELL_AURA_MOUNTED).empty()) { @@ -2914,15 +2914,15 @@ void Aura::HandleAuraTransform(bool apply, bool Real) if (CreatureInfo const* ci = objmgr.GetCreatureTemplate(cr_id)) { uint32 team = 0; - if (m_target->GetTypeId()==TYPEID_PLAYER) + if (m_target->GetTypeId() == TYPEID_PLAYER) team = ((Player*)m_target)->GetTeam(); - uint32 display_id = objmgr.ChooseDisplayId(team,ci); + uint32 display_id = objmgr.ChooseDisplayId(team, ci); CreatureModelInfo const *minfo = objmgr.GetCreatureModelRandomGender(display_id); if (minfo) display_id = minfo->modelid; - m_target->SetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID,display_id); + m_target->SetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID, display_id); } } } @@ -2942,7 +2942,7 @@ void Aura::HandleForceReaction(bool apply, bool Real) uint32 faction_id = m_modifier.m_miscvalue; uint32 faction_rank = m_modifier.m_amount; - player->GetReputationMgr().ApplyForceReaction(faction_id,ReputationRank(faction_rank),apply); + player->GetReputationMgr().ApplyForceReaction(faction_id, ReputationRank(faction_rank), apply); player->GetReputationMgr().SendForceReactions(); } @@ -2954,7 +2954,7 @@ void Aura::HandleAuraModSkill(bool apply, bool /*Real*/) uint32 prot=GetSpellProto()->EffectMiscValue[m_effIndex]; int32 points = GetModifier()->m_amount; - ((Player*)m_target)->ModifySkillBonus(prot,(apply ? points: -points),m_modifier.m_auraname==SPELL_AURA_MOD_SKILL_TALENT); + ((Player*)m_target)->ModifySkillBonus(prot, (apply ? points: -points), m_modifier.m_auraname == SPELL_AURA_MOD_SKILL_TALENT); if(prot == SKILL_DEFENSE) ((Player*)m_target)->UpdateDefenseBonusesMod(); } @@ -2965,7 +2965,7 @@ void Aura::HandleChannelDeathItem(bool apply, bool Real) { Unit* caster = GetCaster(); Unit* victim = GetTarget(); - if(!caster || caster->GetTypeId() != TYPEID_PLAYER || !victim || m_removeMode!=AURA_REMOVE_BY_DEATH) + if(!caster || caster->GetTypeId() != TYPEID_PLAYER || !victim || m_removeMode != AURA_REMOVE_BY_DEATH) return; // Item amount if (m_modifier.m_amount <= 0) @@ -3045,12 +3045,12 @@ void Aura::HandleAuraTrackStealthed(bool apply, bool /*Real*/) if(apply) m_target->RemoveNoStackAurasDueToAura(this); - m_target->ApplyModFlag(PLAYER_FIELD_BYTES,PLAYER_FIELD_BYTE_TRACK_STEALTHED,apply); + m_target->ApplyModFlag(PLAYER_FIELD_BYTES, PLAYER_FIELD_BYTE_TRACK_STEALTHED, apply); } void Aura::HandleAuraModScale(bool apply, bool /*Real*/) { - m_target->ApplyPercentModFloatValue(OBJECT_FIELD_SCALE_X,m_modifier.m_amount,apply); + m_target->ApplyPercentModFloatValue(OBJECT_FIELD_SCALE_X, m_modifier.m_amount, apply); } void Aura::HandleModPossess(bool apply, bool Real) @@ -3072,7 +3072,7 @@ void Aura::HandleModPossess(bool apply, bool Real) if( apply ) { m_target->SetCharmerGUID(GetCasterGUID()); - m_target->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE,caster->getFaction()); + m_target->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, caster->getFaction()); caster->SetCharm(m_target); @@ -3114,7 +3114,7 @@ void Aura::HandleModPossess(bool apply, bool Real) else if(m_target->GetTypeId() == TYPEID_UNIT) { CreatureInfo const *cinfo = ((Creature*)m_target)->GetCreatureInfo(); - m_target->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE,cinfo->faction_A); + m_target->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, cinfo->faction_A); } caster->SetCharm(NULL); @@ -3122,7 +3122,7 @@ void Aura::HandleModPossess(bool apply, bool Real) if(caster->GetTypeId() == TYPEID_PLAYER) { ((Player*)caster)->SetFarSightGUID(0); - ((Player*)caster)->SetClientControl(m_target,0); + ((Player*)caster)->SetClientControl(m_target, 0); WorldPacket data(SMSG_PET_SPELLS, 8); data << uint64(0); @@ -3203,8 +3203,8 @@ void Aura::HandleModCharm(bool apply, bool Real) if( apply ) { m_target->SetCharmerGUID(GetCasterGUID()); - m_target->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE,caster->getFaction()); - m_target->CastStop(m_target==caster ? GetId() : 0); + m_target->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, caster->getFaction()); + m_target->CastStop(m_target == caster ? GetId() : 0); caster->SetCharm(m_target); m_target->CombatStop(); @@ -3251,12 +3251,12 @@ void Aura::HandleModCharm(bool apply, bool Real) if(((Creature*)m_target)->isPet()) { if(Unit* owner = m_target->GetOwner()) - m_target->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE,owner->getFaction()); + m_target->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, owner->getFaction()); else if(cinfo) - m_target->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE,cinfo->faction_A); + m_target->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, cinfo->faction_A); } else if(cinfo) // normal creature - m_target->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE,cinfo->faction_A); + m_target->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, cinfo->faction_A); // restore UNIT_FIELD_BYTES_0 if(cinfo && caster->GetTypeId() == TYPEID_PLAYER && caster->getClass() == CLASS_WARLOCK && cinfo->type == CREATURE_TYPE_DEMON) @@ -3414,10 +3414,9 @@ void Aura::HandleAuraModStun(bool apply, bool Real) ((Player*)m_target)->m_movementInfo.flags = 0; //Clear movement flags WorldPacket data(SMSG_FORCE_MOVE_ROOT, 8); - data.append(m_target->GetPackGUID()); data << uint32(0); - m_target->SendMessageToSet(&data,true); + m_target->SendMessageToSet(&data, true); // Summon the Naj'entus Spine GameObject on target if spell is Impaling Spine if(GetId() == 39837) @@ -3475,7 +3474,7 @@ void Aura::HandleAuraModStun(bool apply, bool Real) WorldPacket data(SMSG_FORCE_MOVE_UNROOT, 8+4); data.append(m_target->GetPackGUID()); data << uint32(0); - m_target->SendMessageToSet(&data,true); + m_target->SendMessageToSet(&data, true); } // Wyvern Sting @@ -3588,7 +3587,7 @@ void Aura::HandleModStealth(bool apply, bool Real) { // Master of Subtlety if ((*i)->GetSpellProto()->SpellIconID == 2114) - pTarget->CastSpell(pTarget,31666,true); + pTarget->CastSpell(pTarget, 31666, true); // Overkill else if ((*i)->GetId() == 58426 && pSpellInfo->SpellFamilyFlags & 0x0000000000400000LL) pTarget->CastSpell(pTarget, 58428, true); @@ -3613,7 +3612,7 @@ void Aura::HandleInvisibility(bool apply, bool Real) } // apply only if not in GM invisibility and not stealth - if(m_target->GetVisibility()==VISIBILITY_ON) + if(m_target->GetVisibility() == VISIBILITY_ON) { // Aura not added yet but visibility code expect temporary add aura m_target->SetVisibility(VISIBILITY_GROUP_NO_DETECT); @@ -3629,14 +3628,14 @@ void Aura::HandleInvisibility(bool apply, bool Real) m_target->m_invisibilityMask |= (1 << m_modifier.m_miscvalue); // only at real aura remove and if not have different invisibility auras. - if(Real && m_target->m_invisibilityMask==0) + if(Real && m_target->m_invisibilityMask == 0) { // remove glow vision if(m_target->GetTypeId() == TYPEID_PLAYER) m_target->RemoveFlag(PLAYER_FIELD_BYTES2,PLAYER_FIELD_BYTE2_INVISIBILITY_GLOW); // apply only if not in GM invisibility & not stealthed while invisible - if(m_target->GetVisibility()!=VISIBILITY_OFF) + if(m_target->GetVisibility() != VISIBILITY_OFF) { // if have stealth aura then already have stealth visibility if(!m_target->HasAuraType(SPELL_AURA_MOD_STEALTH)) @@ -3691,7 +3690,7 @@ void Aura::HandleAuraModRoot(bool apply, bool Real) WorldPacket data(SMSG_FORCE_MOVE_ROOT, 10); data.append(m_target->GetPackGUID()); data << (uint32)2; - m_target->SendMessageToSet(&data,true); + m_target->SendMessageToSet(&data, true); //Clear unit movement flags ((Player*)m_target)->m_movementInfo.flags = 0; @@ -3736,14 +3735,14 @@ void Aura::HandleAuraModRoot(bool apply, bool Real) if(!m_target->hasUnitState(UNIT_STAT_STUNNED)) // prevent allow move if have also stun effect { if(m_target->getVictim() && m_target->isAlive()) - m_target->SetUInt64Value (UNIT_FIELD_TARGET,m_target->getVictim()->GetGUID() ); + m_target->SetUInt64Value (UNIT_FIELD_TARGET, m_target->getVictim()->GetGUID() ); if(m_target->GetTypeId() == TYPEID_PLAYER) { WorldPacket data(SMSG_FORCE_MOVE_UNROOT, 10); data.append(m_target->GetPackGUID()); data << (uint32)2; - m_target->SendMessageToSet(&data,true); + m_target->SendMessageToSet(&data, true); } } } @@ -3761,7 +3760,7 @@ void Aura::HandleAuraModSilence(bool apply, bool Real) // Stop cast only spells vs PreventionType == SPELL_PREVENTION_TYPE_SILENCE for (uint32 i = CURRENT_MELEE_SPELL; i < CURRENT_MAX_SPELL;i++) if (m_target->m_currentSpells[i] && m_target->m_currentSpells[i]->m_spellInfo->PreventionType == SPELL_PREVENTION_TYPE_SILENCE) - m_target->InterruptSpell(i,false); // Stop spells on prepare or casting state + m_target->InterruptSpell(i, false); // Stop spells on prepare or casting state switch (GetId()) { @@ -3958,9 +3957,9 @@ void Aura::HandleAuraModUseNormalSpeed(bool /*apply*/, bool Real) if(!Real) return; - m_target->UpdateSpeed(MOVE_RUN, true); + m_target->UpdateSpeed(MOVE_RUN, true); m_target->UpdateSpeed(MOVE_SWIM, true); - m_target->UpdateSpeed(MOVE_FLIGHT, true); + m_target->UpdateSpeed(MOVE_FLIGHT, true); } /*********************************************************/ @@ -3972,13 +3971,13 @@ void Aura::HandleModMechanicImmunity(bool apply, bool /*Real*/) uint32 mechanic = 1 << m_modifier.m_miscvalue; //immune movement impairment and loss of control - if(GetId()==42292 || GetId()==59752) + if(GetId() == 42292 || GetId() == 59752) mechanic=IMMUNE_TO_MOVEMENT_IMPAIRMENT_AND_LOSS_CONTROL_MASK; // cache values in local vars for prevent access to possible deleted aura data SpellEntry const* spellInfo = GetSpellProto(); - uint32 misc = m_modifier.m_miscvalue; - Unit* target = m_target; + uint32 misc = m_modifier.m_miscvalue; + Unit* target = m_target; if(apply && spellInfo->AttributesEx & SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY) { @@ -4033,10 +4032,10 @@ void Aura::HandleModMechanicImmunity(bool apply, bool /*Real*/) { if (apply) { - target->CastSpell(target,24395,true); - target->CastSpell(target,24396,true); - target->CastSpell(target,24397,true); - target->CastSpell(target,26592,true); + target->CastSpell(target, 24395, true); + target->CastSpell(target, 24396, true); + target->CastSpell(target, 24397, true); + target->CastSpell(target, 26592, true); } else { @@ -4059,7 +4058,7 @@ void Aura::HandleAuraModEffectImmunity(bool apply, bool /*Real*/) bg->EventPlayerDroppedFlag(((Player*)m_target)); } - m_target->ApplySpellImmune(GetId(),IMMUNITY_EFFECT,m_modifier.m_miscvalue,apply); + m_target->ApplySpellImmune(GetId(), IMMUNITY_EFFECT, m_modifier.m_miscvalue, apply); } void Aura::HandleAuraModStateImmunity(bool apply, bool Real) @@ -4079,7 +4078,7 @@ void Aura::HandleAuraModStateImmunity(bool apply, bool Real) } } - m_target->ApplySpellImmune(GetId(),IMMUNITY_STATE,m_modifier.m_miscvalue,apply); + m_target->ApplySpellImmune(GetId(), IMMUNITY_STATE, m_modifier.m_miscvalue, apply); } void Aura::HandleAuraModSchoolImmunity(bool apply, bool Real) @@ -4127,7 +4126,7 @@ void Aura::HandleAuraModSchoolImmunity(bool apply, bool Real) void Aura::HandleAuraModDmgImmunity(bool apply, bool /*Real*/) { - m_target->ApplySpellImmune(GetId(),IMMUNITY_DAMAGE,m_modifier.m_miscvalue,apply); + m_target->ApplySpellImmune(GetId(), IMMUNITY_DAMAGE, m_modifier.m_miscvalue, apply); } void Aura::HandleAuraModDispelImmunity(bool apply, bool Real) @@ -4446,7 +4445,7 @@ void Aura::HandleAuraModResistanceExclusive(bool apply, bool /*Real*/) { m_target->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + x), BASE_VALUE, float(m_modifier.m_amount), apply); if(m_target->GetTypeId() == TYPEID_PLAYER) - m_target->ApplyResistanceBuffModsMod(SpellSchools(x),m_positive,m_modifier.m_amount, apply); + m_target->ApplyResistanceBuffModsMod(SpellSchools(x), m_positive, m_modifier.m_amount, apply); } } } @@ -4459,7 +4458,7 @@ void Aura::HandleAuraModResistance(bool apply, bool /*Real*/) { m_target->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + x), TOTAL_VALUE, float(m_modifier.m_amount), apply); if(m_target->GetTypeId() == TYPEID_PLAYER || ((Creature*)m_target)->isPet()) - m_target->ApplyResistanceBuffModsMod(SpellSchools(x),m_positive,m_modifier.m_amount, apply); + m_target->ApplyResistanceBuffModsMod(SpellSchools(x), m_positive, m_modifier.m_amount, apply); } } } @@ -4492,8 +4491,8 @@ void Aura::HandleModResistancePercent(bool apply, bool /*Real*/) m_target->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + i), TOTAL_PCT, float(m_modifier.m_amount), apply); if(m_target->GetTypeId() == TYPEID_PLAYER || ((Creature*)m_target)->isPet()) { - m_target->ApplyResistanceBuffModsPercentMod(SpellSchools(i),true,m_modifier.m_amount, apply); - m_target->ApplyResistanceBuffModsPercentMod(SpellSchools(i),false,m_modifier.m_amount, apply); + m_target->ApplyResistanceBuffModsPercentMod(SpellSchools(i), true, m_modifier.m_amount, apply); + m_target->ApplyResistanceBuffModsPercentMod(SpellSchools(i), false, m_modifier.m_amount, apply); } } } @@ -4536,7 +4535,7 @@ void Aura::HandleAuraModStat(bool apply, bool /*Real*/) //m_target->ApplyStatMod(Stats(i), m_modifier.m_amount,apply); m_target->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_VALUE, float(m_modifier.m_amount), apply); if(m_target->GetTypeId() == TYPEID_PLAYER || ((Creature*)m_target)->isPet()) - m_target->ApplyStatBuffMod(Stats(i),m_modifier.m_amount,apply); + m_target->ApplyStatBuffMod(Stats(i), m_modifier.m_amount, apply); } } } @@ -4585,8 +4584,8 @@ void Aura::HandleAuraModDispelResist(bool apply, bool Real) if(!Real || !apply) return; - if(GetId()==33206) - m_target->CastSpell(m_target,44416,true,NULL,this,GetCasterGUID()); + if(GetId() == 33206) + m_target->CastSpell(m_target, 44416, true, NULL, this, GetCasterGUID()); } void Aura::HandleModSpellDamagePercentFromAttackPower(bool /*apply*/, bool /*Real*/) @@ -4841,7 +4840,7 @@ void Aura::HandleAuraIncreaseBaseHealthPercent(bool apply, bool /*Real*/) void Aura::HandleAuraModParryPercent(bool /*apply*/, bool /*Real*/) { - if(m_target->GetTypeId()!=TYPEID_PLAYER) + if(m_target->GetTypeId() != TYPEID_PLAYER) return; ((Player*)m_target)->UpdateParryPercentage(); @@ -4849,7 +4848,7 @@ void Aura::HandleAuraModParryPercent(bool /*apply*/, bool /*Real*/) void Aura::HandleAuraModDodgePercent(bool /*apply*/, bool /*Real*/) { - if(m_target->GetTypeId()!=TYPEID_PLAYER) + if(m_target->GetTypeId() != TYPEID_PLAYER) return; ((Player*)m_target)->UpdateDodgePercentage(); @@ -4858,7 +4857,7 @@ void Aura::HandleAuraModDodgePercent(bool /*apply*/, bool /*Real*/) void Aura::HandleAuraModBlockPercent(bool /*apply*/, bool /*Real*/) { - if(m_target->GetTypeId()!=TYPEID_PLAYER) + if(m_target->GetTypeId() != TYPEID_PLAYER) return; ((Player*)m_target)->UpdateBlockPercentage(); @@ -4871,7 +4870,7 @@ void Aura::HandleAuraModRegenInterrupt(bool /*apply*/, bool Real) if(!Real) return; - if(m_target->GetTypeId()!=TYPEID_PLAYER) + if(m_target->GetTypeId() != TYPEID_PLAYER) return; ((Player*)m_target)->UpdateManaRegen(); @@ -4879,7 +4878,7 @@ void Aura::HandleAuraModRegenInterrupt(bool /*apply*/, bool Real) void Aura::HandleAuraModCritPercent(bool apply, bool Real) { - if(m_target->GetTypeId()!=TYPEID_PLAYER) + if(m_target->GetTypeId() != TYPEID_PLAYER) return; // apply item specific bonuses for already equipped weapon @@ -4887,7 +4886,7 @@ void Aura::HandleAuraModCritPercent(bool apply, bool Real) { for(int i = 0; i < MAX_ATTACK; ++i) if(Item* pItem = ((Player*)m_target)->GetWeaponForAttack(WeaponAttackType(i))) - ((Player*)m_target)->_ApplyWeaponDependentAuraCritMod(pItem,WeaponAttackType(i),this,apply); + ((Player*)m_target)->_ApplyWeaponDependentAuraCritMod(pItem, WeaponAttackType(i), this, apply); } // mods must be applied base at equipped weapon class and subclass comparison @@ -4973,16 +4972,16 @@ void Aura::HandleModCastingSpeed(bool apply, bool /*Real*/) void Aura::HandleModMeleeRangedSpeedPct(bool apply, bool /*Real*/) { - m_target->ApplyAttackTimePercentMod(BASE_ATTACK,m_modifier.m_amount,apply); - m_target->ApplyAttackTimePercentMod(OFF_ATTACK,m_modifier.m_amount,apply); + m_target->ApplyAttackTimePercentMod(BASE_ATTACK, m_modifier.m_amount, apply); + m_target->ApplyAttackTimePercentMod(OFF_ATTACK, m_modifier.m_amount, apply); m_target->ApplyAttackTimePercentMod(RANGED_ATTACK, m_modifier.m_amount, apply); } void Aura::HandleModCombatSpeedPct(bool apply, bool /*Real*/) { - m_target->ApplyCastTimePercentMod(m_modifier.m_amount,apply); - m_target->ApplyAttackTimePercentMod(BASE_ATTACK,m_modifier.m_amount,apply); - m_target->ApplyAttackTimePercentMod(OFF_ATTACK,m_modifier.m_amount,apply); + m_target->ApplyCastTimePercentMod(m_modifier.m_amount, apply); + m_target->ApplyAttackTimePercentMod(BASE_ATTACK, m_modifier.m_amount, apply); + m_target->ApplyAttackTimePercentMod(OFF_ATTACK, m_modifier.m_amount, apply); m_target->ApplyAttackTimePercentMod(RANGED_ATTACK, m_modifier.m_amount, apply); } @@ -4996,9 +4995,9 @@ void Aura::HandleModAttackSpeed(bool apply, bool /*Real*/) void Aura::HandleHaste(bool apply, bool /*Real*/) { - m_target->ApplyAttackTimePercentMod(BASE_ATTACK, m_modifier.m_amount,apply); - m_target->ApplyAttackTimePercentMod(OFF_ATTACK, m_modifier.m_amount,apply); - m_target->ApplyAttackTimePercentMod(RANGED_ATTACK,m_modifier.m_amount,apply); + m_target->ApplyAttackTimePercentMod(BASE_ATTACK, m_modifier.m_amount, apply); + m_target->ApplyAttackTimePercentMod(OFF_ATTACK, m_modifier.m_amount, apply); + m_target->ApplyAttackTimePercentMod(RANGED_ATTACK, m_modifier.m_amount, apply); } void Aura::HandleAuraModRangedHaste(bool apply, bool /*Real*/) @@ -5073,11 +5072,11 @@ void Aura::HandleAuraModAttackPowerOfStatPercent(bool /*apply*/, bool Real) void Aura::HandleModDamageDone(bool apply, bool Real) { // apply item specific bonuses for already equipped weapon - if(Real && m_target->GetTypeId()==TYPEID_PLAYER) + if(Real && m_target->GetTypeId() == TYPEID_PLAYER) { for(int i = 0; i < MAX_ATTACK; ++i) if(Item* pItem = ((Player*)m_target)->GetWeaponForAttack(WeaponAttackType(i))) - ((Player*)m_target)->_ApplyWeaponDependentAuraDamageMod(pItem,WeaponAttackType(i),this,apply); + ((Player*)m_target)->_ApplyWeaponDependentAuraDamageMod(pItem, WeaponAttackType(i), this, apply); } // m_modifier.m_miscvalue is bitmask of spell schools @@ -5106,9 +5105,9 @@ void Aura::HandleModDamageDone(bool apply, bool Real) if(m_target->GetTypeId() == TYPEID_PLAYER) { if(m_positive) - m_target->ApplyModUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS,m_modifier.m_amount,apply); + m_target->ApplyModUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS, m_modifier.m_amount, apply); else - m_target->ApplyModUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG,m_modifier.m_amount,apply); + m_target->ApplyModUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG, m_modifier.m_amount, apply); } } @@ -5131,18 +5130,18 @@ void Aura::HandleModDamageDone(bool apply, bool Real) { if(m_positive) { - for(int i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; i++) + for(int i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i) { if((m_modifier.m_miscvalue & (1<ApplyModUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS+i,m_modifier.m_amount,apply); + m_target->ApplyModUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + i, m_modifier.m_amount, apply); } } else { - for(int i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; i++) + for(int i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i) { if((m_modifier.m_miscvalue & (1<ApplyModUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG+i,m_modifier.m_amount,apply); + m_target->ApplyModUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + i, m_modifier.m_amount, apply); } } Pet* pet = m_target->GetPet(); @@ -5156,11 +5155,11 @@ void Aura::HandleModDamagePercentDone(bool apply, bool Real) sLog.outDebug("AURA MOD DAMAGE type:%u negative:%u", m_modifier.m_miscvalue, m_positive ? 0 : 1); // apply item specific bonuses for already equipped weapon - if(Real && m_target->GetTypeId()==TYPEID_PLAYER) + if(Real && m_target->GetTypeId() == TYPEID_PLAYER) { for(int i = 0; i < MAX_ATTACK; ++i) if(Item* pItem = ((Player*)m_target)->GetWeaponForAttack(WeaponAttackType(i))) - ((Player*)m_target)->_ApplyWeaponDependentAuraDamageMod(pItem,WeaponAttackType(i),this,apply); + ((Player*)m_target)->_ApplyWeaponDependentAuraDamageMod(pItem, WeaponAttackType(i), this, apply); } // m_modifier.m_miscvalue is bitmask of spell schools @@ -5187,7 +5186,7 @@ void Aura::HandleModDamagePercentDone(bool apply, bool Real) } // For show in client if(m_target->GetTypeId() == TYPEID_PLAYER) - m_target->ApplyModSignedFloatValue(PLAYER_FIELD_MOD_DAMAGE_DONE_PCT,m_modifier.m_amount/100.0f,apply); + m_target->ApplyModSignedFloatValue(PLAYER_FIELD_MOD_DAMAGE_DONE_PCT, m_modifier.m_amount/100.0f, apply); } // Skip non magic case for speedup @@ -5207,7 +5206,7 @@ void Aura::HandleModDamagePercentDone(bool apply, bool Real) // Send info to client if(m_target->GetTypeId() == TYPEID_PLAYER) for(int i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i) - m_target->ApplyModSignedFloatValue(PLAYER_FIELD_MOD_DAMAGE_DONE_PCT+i,m_modifier.m_amount/100.0f,apply); + m_target->ApplyModSignedFloatValue(PLAYER_FIELD_MOD_DAMAGE_DONE_PCT + i, m_modifier.m_amount/100.0f, apply); } void Aura::HandleModOffhandDamagePercent(bool apply, bool Real) @@ -5234,7 +5233,7 @@ void Aura::HandleModPowerCostPCT(bool apply, bool Real) float amount = m_modifier.m_amount/100.0f; for(int i = 0; i < MAX_SPELL_SCHOOL; ++i) if(m_modifier.m_miscvalue & (1<ApplyModSignedFloatValue(UNIT_FIELD_POWER_COST_MULTIPLIER+i,amount,apply); + m_target->ApplyModSignedFloatValue(UNIT_FIELD_POWER_COST_MULTIPLIER + i, amount, apply); } void Aura::HandleModPowerCost(bool apply, bool Real) @@ -5245,7 +5244,7 @@ void Aura::HandleModPowerCost(bool apply, bool Real) for(int i = 0; i < MAX_SPELL_SCHOOL; ++i) if(m_modifier.m_miscvalue & (1<ApplyModInt32Value(UNIT_FIELD_POWER_COST_MODIFIER+i,m_modifier.m_amount,apply); + m_target->ApplyModInt32Value(UNIT_FIELD_POWER_COST_MODIFIER + i, m_modifier.m_amount, apply); } void Aura::HandleNoReagentUseAura(bool /*Apply*/, bool Real) @@ -5260,12 +5259,12 @@ void Aura::HandleNoReagentUseAura(bool /*Apply*/, bool Real) for(Unit::AuraList::const_iterator i = noReagent.begin(); i != noReagent.end(); ++i) { uint32 const *ptr = (*i)->getAuraSpellClassMask(); - mask[0]|=ptr[0]; - mask[1]|=ptr[1]; - mask[2]|=ptr[2]; + mask[0] |= ptr[0]; + mask[1] |= ptr[1]; + mask[2] |= ptr[2]; } - m_target->SetUInt32Value(PLAYER_NO_REAGENT_COST_1 , mask[0]); + m_target->SetUInt32Value(PLAYER_NO_REAGENT_COST_1+0, mask[0]); m_target->SetUInt32Value(PLAYER_NO_REAGENT_COST_1+1, mask[1]); m_target->SetUInt32Value(PLAYER_NO_REAGENT_COST_1+2, mask[2]); } @@ -5362,7 +5361,8 @@ void Aura::HandleShapeshiftBoosts(bool apply) if(itr->second->state == PLAYERSPELL_REMOVED) continue; if(itr->first==spellId || itr->first==spellId2) continue; SpellEntry const *spellInfo = sSpellStore.LookupEntry(itr->first); - if (!spellInfo || !(spellInfo->Attributes & (SPELL_ATTR_PASSIVE | (1<<7)))) continue; + if (!spellInfo || !(spellInfo->Attributes & (SPELL_ATTR_PASSIVE | (1<<7)))) + continue; if (spellInfo->Stances & (1<CastSpell(m_target, itr->first, true, NULL, this); } @@ -5447,8 +5447,8 @@ void Aura::HandleAuraModPacify(bool apply, bool /*Real*/) void Aura::HandleAuraModPacifyAndSilence(bool apply, bool Real) { - HandleAuraModPacify(apply,Real); - HandleAuraModSilence(apply,Real); + HandleAuraModPacify(apply, Real); + HandleAuraModSilence(apply, Real); } void Aura::HandleAuraGhost(bool apply, bool /*Real*/) @@ -5539,11 +5539,11 @@ void Aura::HandleModTargetResistance(bool apply, bool Real) // show armor penetration if (m_target->GetTypeId() == TYPEID_PLAYER && (m_modifier.m_miscvalue & SPELL_SCHOOL_MASK_NORMAL)) - m_target->ApplyModInt32Value(PLAYER_FIELD_MOD_TARGET_PHYSICAL_RESISTANCE,m_modifier.m_amount, apply); + m_target->ApplyModInt32Value(PLAYER_FIELD_MOD_TARGET_PHYSICAL_RESISTANCE, m_modifier.m_amount, apply); // show as spell penetration only full spell penetration bonuses (all resistances except armor and holy if (m_target->GetTypeId() == TYPEID_PLAYER && (m_modifier.m_miscvalue & SPELL_SCHOOL_MASK_SPELL)==SPELL_SCHOOL_MASK_SPELL) - m_target->ApplyModInt32Value(PLAYER_FIELD_MOD_TARGET_RESISTANCE,m_modifier.m_amount, apply); + m_target->ApplyModInt32Value(PLAYER_FIELD_MOD_TARGET_RESISTANCE, m_modifier.m_amount, apply); } void Aura::HandleShieldBlockValue(bool apply, bool /*Real*/) @@ -5703,8 +5703,8 @@ void Aura::PeriodicTick() if(!pCaster) return; - if( GetSpellProto()->Effect[GetEffIndex()]==SPELL_EFFECT_PERSISTENT_AREA_AURA && - pCaster->SpellHitResult(m_target,GetSpellProto(),false)!=SPELL_MISS_NONE) + if( GetSpellProto()->Effect[GetEffIndex()] == SPELL_EFFECT_PERSISTENT_AREA_AURA && + pCaster->SpellHitResult(m_target, GetSpellProto(), false) != SPELL_MISS_NONE) return; // Check for immune (not use charges) @@ -5712,7 +5712,7 @@ void Aura::PeriodicTick() return; // some auras remove at specific health level or more - if(m_modifier.m_auraname==SPELL_AURA_PERIODIC_DAMAGE) + if(m_modifier.m_auraname == SPELL_AURA_PERIODIC_DAMAGE) { switch(GetId()) { @@ -5742,8 +5742,8 @@ void Aura::PeriodicTick() } } - uint32 absorb=0; - uint32 resist=0; + uint32 absorb = 0; + uint32 resist = 0; CleanDamage cleanDamage = CleanDamage(0, BASE_ATTACK, MELEE_HIT_NORMAL ); // ignore non positive values (can be result apply spellmods to aura damage @@ -5784,7 +5784,7 @@ void Aura::PeriodicTick() //As of 2.2 resilience reduces damage from DoT ticks as much as the chance to not be critically hit // Reduce dot damage from resilience for players - if (m_target->GetTypeId()==TYPEID_PLAYER) + if (m_target->GetTypeId() == TYPEID_PLAYER) pdamage-=((Player*)m_target)->GetDotDamageReduction(pdamage); pCaster->CalcAbsorbResist(m_target, GetSpellSchoolMask(GetSpellProto()), DOT, pdamage, &absorb, &resist); @@ -5805,7 +5805,7 @@ void Aura::PeriodicTick() data << (uint32)GetSpellSchoolMask(GetSpellProto()); // will be mask in 2.4.x data << (uint32)absorb; data << (uint32)resist; - m_target->SendMessageToSet(&data,true); + m_target->SendMessageToSet(&data, true); Unit* target = m_target; // aura can be deleted in DealDamage SpellEntry const* spellProto = GetSpellProto(); @@ -5831,8 +5831,8 @@ void Aura::PeriodicTick() if(!pCaster->isAlive()) return; - if( GetSpellProto()->Effect[GetEffIndex()]==SPELL_EFFECT_PERSISTENT_AREA_AURA && - pCaster->SpellHitResult(m_target,GetSpellProto(),false)!=SPELL_MISS_NONE) + if( GetSpellProto()->Effect[GetEffIndex()] == SPELL_EFFECT_PERSISTENT_AREA_AURA && + pCaster->SpellHitResult(m_target, GetSpellProto(), false) != SPELL_MISS_NONE) return; // Check for immune @@ -5938,7 +5938,7 @@ void Aura::PeriodicTick() data << uint32(m_modifier.m_auraname); data << (uint32)pdamage; data << uint32(0); // wotlk - m_target->SendMessageToSet(&data,true); + m_target->SendMessageToSet(&data, true); int32 gain = m_target->ModifyHealth(pdamage); @@ -5952,7 +5952,7 @@ void Aura::PeriodicTick() SpellEntry const* spellProto = GetSpellProto(); // heal for caster damage - if(m_target!=pCaster && spellProto->SpellVisual[0]==163) + if(m_target!=pCaster && spellProto->SpellVisual[0] == 163) { uint32 dmg = spellProto->manaPerSecond; if(pCaster->GetHealth() <= dmg && pCaster->GetTypeId()==TYPEID_PLAYER) @@ -6008,7 +6008,7 @@ void Aura::PeriodicTick() return; if( GetSpellProto()->Effect[GetEffIndex()]==SPELL_EFFECT_PERSISTENT_AREA_AURA && - pCaster->SpellHitResult(m_target,GetSpellProto(),false)!=SPELL_MISS_NONE) + pCaster->SpellHitResult(m_target, GetSpellProto(), false) != SPELL_MISS_NONE) return; // Check for immune (not use charges) @@ -6059,7 +6059,7 @@ void Aura::PeriodicTick() data << (uint32)power; // power type data << (uint32)drain_amount; data << (float)gain_multiplier; - m_target->SendMessageToSet(&data,true); + m_target->SendMessageToSet(&data, true); int32 gain_amount = int32(drain_amount*gain_multiplier); @@ -6094,7 +6094,7 @@ void Aura::PeriodicTick() data << uint32(m_modifier.m_auraname); data << (uint32)power; // power type data << (uint32)pdamage; - m_target->SendMessageToSet(&data,true); + m_target->SendMessageToSet(&data, true); int32 gain = m_target->ModifyPower(power,pdamage); @@ -6161,7 +6161,7 @@ void Aura::PeriodicTick() SpellNonMeleeDamage damageInfo(pCaster, m_target, spellProto->Id, spellProto->SchoolMask); pCaster->CalculateSpellDamage(&damageInfo, gain, spellProto); - pCaster->DealDamageMods(damageInfo.target,damageInfo.damage,&damageInfo.absorb); + pCaster->DealDamageMods(damageInfo.target, damageInfo.damage, &damageInfo.absorb); pCaster->SendSpellNonMeleeDamageLog(&damageInfo); @@ -6480,7 +6480,7 @@ void Aura::PeriodicDummyTick() { // Converts up to 10 rage per second into health for $d. Each point of rage is converted into ${$m2/10}.1% of max health. // Should be manauser - if (m_target->getPowerType()!=POWER_RAGE) + if (m_target->getPowerType() != POWER_RAGE) return; uint32 rage = m_target->GetPower(POWER_RAGE); // Nothing todo @@ -6691,7 +6691,7 @@ void Aura::HandleAuraControlVehicle(bool apply, bool Real) Unit *player = GetCaster(); Vehicle *vehicle = dynamic_cast(m_target); - if(!player || player->GetTypeId()!=TYPEID_PLAYER || !vehicle) + if(!player || player->GetTypeId() != TYPEID_PLAYER || !vehicle) return; if (apply) @@ -6756,13 +6756,13 @@ void Aura::HandlePhase(bool apply, bool Real) { Unit::AuraList const& phases = m_target->GetAurasByType(SPELL_AURA_PHASE); if(!phases.empty()) - m_target->RemoveAurasDueToSpell(phases.front()->GetId(),this); + m_target->RemoveAurasDueToSpell(phases.front()->GetId(), this); } // no-phase is also phase state so same code for apply and remove // phase auras normally not expected at BG but anyway better check - if(m_target->GetTypeId()==TYPEID_PLAYER) + if(m_target->GetTypeId() == TYPEID_PLAYER) { // drop flag at invisible in bg if(((Player*)m_target)->InBattleGround()) @@ -6771,7 +6771,7 @@ void Aura::HandlePhase(bool apply, bool Real) // GM-mode have mask 0xFFFFFFFF if(!((Player*)m_target)->isGameMaster()) - m_target->SetPhaseMask(apply ? GetMiscValue() : PHASEMASK_NORMAL,false); + m_target->SetPhaseMask(apply ? GetMiscValue() : PHASEMASK_NORMAL, false); ((Player*)m_target)->GetSession()->SendSetPhaseShift(apply ? GetMiscValue() : PHASEMASK_NORMAL); @@ -6781,28 +6781,28 @@ void Aura::HandlePhase(bool apply, bool Real) if(saBounds.first != saBounds.second) { uint32 zone, area; - m_target->GetZoneAndAreaId(zone,area); + m_target->GetZoneAndAreaId(zone, area); for(SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr) { // some auras remove at aura remove - if(!itr->second->IsFitToRequirements((Player*)m_target,zone,area)) + if(!itr->second->IsFitToRequirements((Player*)m_target, zone, area)) m_target->RemoveAurasDueToSpell(itr->second->spellId); // some auras applied at aura apply else if(itr->second->autocast) { - if( !m_target->HasAura(itr->second->spellId,0) ) - m_target->CastSpell(m_target,itr->second->spellId,true); + if( !m_target->HasAura(itr->second->spellId, 0) ) + m_target->CastSpell(m_target, itr->second->spellId, true); } } } } } else - m_target->SetPhaseMask(apply ? GetMiscValue() : PHASEMASK_NORMAL,false); + m_target->SetPhaseMask(apply ? GetMiscValue() : PHASEMASK_NORMAL, false); // need triggering visibility update base at phase update of not GM invisible (other GMs anyway see in any phases) - if(m_target->GetVisibility()!=VISIBILITY_OFF) + if(m_target->GetVisibility() != VISIBILITY_OFF) m_target->SetVisibility(m_target->GetVisibility()); } @@ -6830,6 +6830,6 @@ void Aura::HandleAuraSafeFall( bool Apply, bool Real ) // implemented in WorldSession::HandleMovementOpcodes // only special case - if(Apply && Real && GetId()==32474 && m_target->GetTypeId()==TYPEID_PLAYER) - ((Player*)m_target)->ActivateTaxiPathTo(506,GetId()); + if(Apply && Real && GetId() == 32474 && m_target->GetTypeId() == TYPEID_PLAYER) + ((Player*)m_target)->ActivateTaxiPathTo(506, GetId()); } diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 1b4a5d07c..3c39a6049 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -272,14 +272,14 @@ void Spell::EffectInstaKill(uint32 /*i*/) case 1863: spellID=18791; break; //succubus case 17252: spellID=35701; break; //fellguard default: - sLog.outError("EffectInstaKill: Unhandled creature entry (%u) case.",entry); + sLog.outError("EffectInstaKill: Unhandled creature entry (%u) case.", entry); return; } - m_caster->CastSpell(m_caster,spellID,true); + 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); @@ -295,11 +295,11 @@ void Spell::EffectEnvirinmentalDMG(uint32 i) // currently each enemy selected explicitly and self cast damage, we prevent apply self casted spell bonuses/etc damage = m_spellInfo->CalculateSimpleValue(i); - m_caster->CalcAbsorbResist(m_caster,GetSpellSchoolMask(m_spellInfo), SPELL_DIRECT_DAMAGE, damage, &absorb, &resist); + m_caster->CalcAbsorbResist(m_caster, GetSpellSchoolMask(m_spellInfo), SPELL_DIRECT_DAMAGE, damage, &absorb, &resist); m_caster->SendSpellNonMeleeDamageLog(m_caster, m_spellInfo->Id, damage, GetSpellSchoolMask(m_spellInfo), absorb, resist, false, 0, false); if(m_caster->GetTypeId() == TYPEID_PLAYER) - ((Player*)m_caster)->EnvironmentalDamage(DAMAGE_FIRE,damage); + ((Player*)m_caster)->EnvironmentalDamage(DAMAGE_FIRE, damage); } void Spell::EffectSchoolDMG(uint32 effect_idx) @@ -364,7 +364,7 @@ void Spell::EffectSchoolDMG(uint32 effect_idx) // Arcane Blast if(m_spellInfo->SpellFamilyFlags & 0x20000000LL) { - m_caster->CastSpell(m_caster,36032,true); + m_caster->CastSpell(m_caster, 36032, true); } break; } @@ -606,7 +606,7 @@ void Spell::EffectSchoolDMG(uint32 effect_idx) } if(damage >= 0) - m_damage+= damage; + m_damage += damage; } } @@ -636,7 +636,7 @@ void Spell::EffectDummy(uint32 i) case 4: spell_id = 8067; break; // Party Time! case 5: spell_id = 8068; break; // Healthy Spirit } - m_caster->CastSpell(m_caster,spell_id,true,NULL); + m_caster->CastSpell(m_caster, spell_id, true, NULL); return; } case 8213: // Savory Deviate Delight @@ -658,7 +658,7 @@ void Spell::EffectDummy(uint32 i) case 8593: // Symbol of life (restore creature to life) case 31225: // Shimmering Vessel (restore creature to life) { - if(!unitTarget || unitTarget->GetTypeId()!=TYPEID_UNIT) + if(!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT) return; ((Creature*)unitTarget)->setDeathState(JUST_ALIVED); return; @@ -742,18 +742,18 @@ void Spell::EffectDummy(uint32 i) } case 16589: // Noggenfogger Elixir { - if(m_caster->GetTypeId()!=TYPEID_PLAYER) + if(m_caster->GetTypeId() != TYPEID_PLAYER) return; uint32 spell_id = 0; - switch(urand(1,3)) + switch(urand(1, 3)) { case 1: spell_id = 16595; break; case 2: spell_id = 16593; break; default:spell_id = 16591; break; } - m_caster->CastSpell(m_caster,spell_id,true,NULL); + m_caster->CastSpell(m_caster, spell_id, true, NULL); return; } case 17251: // Spirit Healer Res @@ -764,7 +764,7 @@ void Spell::EffectDummy(uint32 i) if(m_originalCaster->GetTypeId() == TYPEID_PLAYER) { WorldPacket data(SMSG_SPIRIT_HEALER_CONFIRM, 8); - data << unitTarget->GetGUID(); + data << uint64(unitTarget->GetGUID()); ((Player*)m_originalCaster)->GetSession()->SendPacket( &data ); } return; @@ -776,12 +776,12 @@ void Spell::EffectDummy(uint32 i) uint32 spell_id = roll_chance_i(50) ? 17269 : 17270; - m_caster->CastSpell(m_caster,spell_id,true,NULL); + m_caster->CastSpell(m_caster, spell_id, true, NULL); return; } case 20577: // Cannibalize if (unitTarget) - m_caster->CastSpell(m_caster,20578,false,NULL); + m_caster->CastSpell(m_caster, 20578, false, NULL); return; case 23019: // Crystal Prison Dummy DND { @@ -819,49 +819,49 @@ void Spell::EffectDummy(uint32 i) WorldPacket data(SMSG_GAMEOBJECT_SPAWN_ANIM_OBSOLETE, 8); data << uint64(pGameObj->GetGUID()); - m_caster->SendMessageToSet(&data,true); + m_caster->SendMessageToSet(&data, true); return; } case 23074: // Arcanite Dragonling if (!m_CastItem) return; - m_caster->CastSpell(m_caster,19804,true,m_CastItem); + m_caster->CastSpell(m_caster, 19804, true, m_CastItem); return; case 23075: // Mithril Mechanical Dragonling if (!m_CastItem) return; - m_caster->CastSpell(m_caster,12749,true,m_CastItem); + m_caster->CastSpell(m_caster, 12749, true, m_CastItem); return; case 23076: // Mechanical Dragonling if (!m_CastItem) return; - m_caster->CastSpell(m_caster,4073,true,m_CastItem); + m_caster->CastSpell(m_caster, 4073, true, m_CastItem); return; case 23133: // Gnomish Battle Chicken if (!m_CastItem) return; - m_caster->CastSpell(m_caster,13166,true,m_CastItem); + m_caster->CastSpell(m_caster, 13166, true, m_CastItem); return; case 23448: // Ultrasafe Transporter: Gadgetzan - backfires { int32 r = irand(0, 119); if ( r < 20 ) // 1/6 polymorph - m_caster->CastSpell(m_caster,23444,true); + m_caster->CastSpell(m_caster, 23444, true); else if ( r < 100 ) // 4/6 evil twin - m_caster->CastSpell(m_caster,23445,true); + m_caster->CastSpell(m_caster, 23445, true); else // 1/6 miss the target - m_caster->CastSpell(m_caster,36902,true); + m_caster->CastSpell(m_caster, 36902, true); return; } case 23453: // Ultrasafe Transporter: Gadgetzan if ( roll_chance_i(50) ) // success - m_caster->CastSpell(m_caster,23441,true); + m_caster->CastSpell(m_caster, 23441, true); else // failure - m_caster->CastSpell(m_caster,23446,true); + m_caster->CastSpell(m_caster, 23446, true); return; case 23645: // Hourglass Sand m_caster->RemoveAurasDueToSpell(23170); return; case 23725: // Gift of Life (warrior bwl trinket) - m_caster->CastSpell(m_caster,23782,true); - m_caster->CastSpell(m_caster,23783,true); + m_caster->CastSpell(m_caster, 23782, true); + m_caster->CastSpell(m_caster, 23783, true); return; case 25860: // Reindeer Transformation { @@ -892,7 +892,7 @@ void Spell::EffectDummy(uint32 i) case 28006: // Arcane Cloaking { if (unitTarget && unitTarget->GetTypeId() == TYPEID_PLAYER ) - m_caster->CastSpell(unitTarget,29294,true); + m_caster->CastSpell(unitTarget, 29294, true); return; } case 28730: // Arcane Torrent (Mana) @@ -950,7 +950,7 @@ void Spell::EffectDummy(uint32 i) case 5: spell_id = 33064; break; } - m_caster->CastSpell(m_caster,spell_id,true,NULL); + m_caster->CastSpell(m_caster, spell_id, true, NULL); return; } case 35745: @@ -963,7 +963,7 @@ void Spell::EffectDummy(uint32 i) default: return; } - m_caster->CastSpell(m_caster,spell_id,true); + m_caster->CastSpell(m_caster, spell_id, true); return; } case 37674: // Chaos Blast @@ -972,14 +972,14 @@ void Spell::EffectDummy(uint32 i) return; int32 basepoints0 = 100; - m_caster->CastCustomSpell(unitTarget,37675,&basepoints0,NULL,NULL,true); + m_caster->CastCustomSpell(unitTarget, 37675, &basepoints0, NULL, NULL, true); return; } case 40802: // Mingo's Fortune Generator (Mingo's Fortune Giblets) { // selecting one from Bloodstained Fortune item uint32 newitemid; - switch(urand(1,20)) + switch(urand(1, 20)) { case 1: newitemid = 32688; break; case 2: newitemid = 32689; break; @@ -1005,7 +1005,7 @@ void Spell::EffectDummy(uint32 i) return; } - DoCreateItem(i,newitemid); + DoCreateItem(i, newitemid); return; } // Demon Broiled Surprise @@ -1031,7 +1031,7 @@ void Spell::EffectDummy(uint32 i) creatureTarget->SetHealth(0); // just for nice GM-mode view //cast spell Raptor Capture Credit - m_caster->CastSpell(m_caster,42337,true,NULL); + m_caster->CastSpell(m_caster, 42337, true, NULL); return; } case 34665: //Administer Antidote @@ -1059,7 +1059,7 @@ void Spell::EffectDummy(uint32 i) return; pCreature->SetHealth(health); - ((Player*)m_caster)->RewardPlayerAndGroupAtEvent(16992,pCreature); + ((Player*)m_caster)->RewardPlayerAndGroupAtEvent(16992, pCreature); if (pCreature->AI()) pCreature->AI()->AttackStart(m_caster); @@ -1133,7 +1133,7 @@ void Spell::EffectDummy(uint32 i) uint32 reqAuraID = m_spellInfo->CalculateSimpleValue(1); if (m_caster->HasAura(reqAuraID,0)) - m_caster->CastSpell(m_caster,spellID,true,NULL); + m_caster->CastSpell(m_caster, spellID, true, NULL); return; } case 1: @@ -1144,7 +1144,7 @@ void Spell::EffectDummy(uint32 i) case 53341: case 53343: { - m_caster->CastSpell(m_caster,54586,true); + m_caster->CastSpell(m_caster, 54586, true); return; } case 58418: // Portal to Orgrimmar @@ -1171,7 +1171,7 @@ void Spell::EffectDummy(uint32 i) // FIXME: custom spell required this aura state by some unknown reason, we not need remove it anyway m_caster->ModifyAuraState(AURA_STATE_BERSERKING,true); - m_caster->CastCustomSpell(m_caster,26635,&hasteModBasePoints0,&hasteModBasePoints1,&hasteModBasePoints2,true,NULL); + m_caster->CastCustomSpell(m_caster, 26635, &hasteModBasePoints0, &hasteModBasePoints1, &hasteModBasePoints2, true, NULL); return; } } @@ -1199,7 +1199,7 @@ void Spell::EffectDummy(uint32 i) (GetSpellSchoolMask(spellInfo) & SPELL_SCHOOL_MASK_FROST) && spellInfo->Id != 11958 && GetSpellRecoveryTime(spellInfo) > 0 ) { - ((Player*)m_caster)->RemoveSpellCooldown(classspell,true); + ((Player*)m_caster)->RemoveSpellCooldown(classspell, true); } } return; @@ -1221,7 +1221,7 @@ void Spell::EffectDummy(uint32 i) if(m_spellInfo->SpellFamilyFlags & 0x1 && m_spellInfo->SpellVisual[0] == 867) { int32 chargeBasePoints0 = damage; - m_caster->CastCustomSpell(m_caster,34846,&chargeBasePoints0,NULL,NULL,true); + m_caster->CastCustomSpell(m_caster, 34846, &chargeBasePoints0, NULL, NULL, true); return; } // Execute @@ -1238,7 +1238,7 @@ void Spell::EffectDummy(uint32 i) int32 basePoints0 = damage+int32(rage * m_spellInfo->DmgMultiplier[i] + m_caster->GetTotalAttackPowerValue(BASE_ATTACK)*0.2f); m_caster->CastCustomSpell(unitTarget, 20647, &basePoints0, NULL, NULL, true, 0); - m_caster->SetPower(POWER_RAGE,0); + m_caster->SetPower(POWER_RAGE, 0); return; } // Slam @@ -1263,7 +1263,7 @@ void Spell::EffectDummy(uint32 i) { if(!unitTarget) return; - m_caster->CastSpell(unitTarget,21887,true); // spell mod + m_caster->CastSpell(unitTarget, 21887, true);// spell mod return; } // Last Stand @@ -1448,7 +1448,7 @@ void Spell::EffectDummy(uint32 i) } case 31231: // Cheat Death { - m_caster->CastSpell(m_caster,45182,true); + m_caster->CastSpell(m_caster, 45182, true); return; } } @@ -1564,12 +1564,12 @@ void Spell::EffectDummy(uint32 i) mod->mask2= 0LL; ((Player*)m_caster)->AddSpellMod(mod, true); - m_caster->CastSpell(unitTarget,spell_proto,true,NULL); + m_caster->CastSpell(unitTarget, spell_proto, true, NULL); // mod deleted ((Player*)m_caster)->AddSpellMod(mod, false); } else - m_caster->CastSpell(unitTarget,spell_proto,true,NULL); + m_caster->CastSpell(unitTarget, spell_proto, true, NULL); return; } @@ -1635,7 +1635,7 @@ void Spell::EffectDummy(uint32 i) default: return; // ignore for not healing classes } - m_caster->CastSpell(m_caster,spell_id,true); + m_caster->CastSpell(m_caster, spell_id, true); return; } } @@ -1654,7 +1654,7 @@ void Spell::EffectDummy(uint32 i) case 8019: spell_id = 36755; break; // Rank 3 case 10399: spell_id = 36759; break; // Rank 4 default: - sLog.outError("Spell::EffectDummy: Spell %u not handled in RW",m_spellInfo->Id); + sLog.outError("Spell::EffectDummy: Spell %u not handled in RW", m_spellInfo->Id); return; } @@ -1715,7 +1715,7 @@ void Spell::EffectDummy(uint32 i) damage+=dummy->GetModifier()->m_amount; // Regenerate 6% of Total Mana Every 3 secs int32 EffectBasePoints0 = unitTarget->GetMaxPower(POWER_MANA) * damage / 100; - m_caster->CastCustomSpell(unitTarget,39609,&EffectBasePoints0,NULL,NULL,true,NULL,NULL,m_originalCasterGUID); + m_caster->CastCustomSpell(unitTarget, 39609, &EffectBasePoints0, NULL, NULL, true, NULL, NULL, m_originalCasterGUID); return; } // Lava Lash @@ -1752,12 +1752,12 @@ void Spell::EffectDummy(uint32 i) return; int32 bp = damage * 1.5f; - m_caster->CastCustomSpell(unitTarget,47633,&bp,NULL,NULL,true); + m_caster->CastCustomSpell(unitTarget, 47633, &bp, NULL, NULL, true); } else { int32 bp = damage; - m_caster->CastCustomSpell(unitTarget,47632,&bp,NULL,NULL,true); + m_caster->CastCustomSpell(unitTarget, 47632, &bp, NULL, NULL, true); } return; } @@ -1837,7 +1837,7 @@ void Spell::EffectForceCast(uint32 i) return; } - unitTarget->CastSpell(unitTarget,spellInfo,true,NULL,NULL,m_originalCasterGUID); + unitTarget->CastSpell(unitTarget, spellInfo, true, NULL, NULL, m_originalCasterGUID); } void Spell::EffectTriggerSpell(uint32 i) @@ -1901,7 +1901,7 @@ void Spell::EffectTriggerSpell(uint32 i) return; for (int j=0; j < spell->StackAmount; ++j) - m_caster->CastSpell(unitTarget,spell->Id, true, m_CastItem, NULL, m_originalCasterGUID); + m_caster->CastSpell(unitTarget, spell->Id, true, m_CastItem, NULL, m_originalCasterGUID); return; } // Mercurial Shield - (need add max stack of 26464 Mercurial Shield) @@ -1912,13 +1912,13 @@ void Spell::EffectTriggerSpell(uint32 i) return; for (int j=0; j < spell->StackAmount; ++j) - m_caster->CastSpell(unitTarget,spell->Id, true, m_CastItem, NULL, m_originalCasterGUID); + m_caster->CastSpell(unitTarget, spell->Id, true, m_CastItem, NULL, m_originalCasterGUID); return; } // Righteous Defense case 31980: { - m_caster->CastSpell(unitTarget, 31790, true,m_CastItem,NULL,m_originalCasterGUID); + m_caster->CastSpell(unitTarget, 31790, true, m_CastItem, NULL, m_originalCasterGUID); return; } // Cloak of Shadows @@ -2075,7 +2075,7 @@ void Spell::EffectJump(uint32 i) return; } - m_caster->NearTeleportTo(x,y,z,o,true); + m_caster->NearTeleportTo(x, y, z, o, true); } void Spell::EffectTeleportUnits(uint32 i) @@ -2160,9 +2160,9 @@ void Spell::EffectTeleportUnits(uint32 i) if ( r >= 70 ) // 7/12 success { if ( r < 100 ) // 4/12 evil twin - m_caster->CastSpell(m_caster,23445,true); + m_caster->CastSpell(m_caster, 23445, true); else // 1/12 fire - m_caster->CastSpell(m_caster,23449,true); + m_caster->CastSpell(m_caster, 23449, true); } return; } @@ -2171,41 +2171,41 @@ void Spell::EffectTeleportUnits(uint32 i) { if ( roll_chance_i(50) ) // 50% success { - int32 rand_eff = urand(1,7); + int32 rand_eff = urand(1, 7); switch ( rand_eff ) { case 1: // soul split - evil - m_caster->CastSpell(m_caster,36900,true); + m_caster->CastSpell(m_caster, 36900, true); break; case 2: // soul split - good - m_caster->CastSpell(m_caster,36901,true); + m_caster->CastSpell(m_caster, 36901, true); break; case 3: // Increase the size - m_caster->CastSpell(m_caster,36895,true); + m_caster->CastSpell(m_caster, 36895, true); break; case 4: // Decrease the size - m_caster->CastSpell(m_caster,36893,true); + m_caster->CastSpell(m_caster, 36893, true); break; case 5: // Transform { if (((Player*)m_caster)->GetTeam() == ALLIANCE ) - m_caster->CastSpell(m_caster,36897,true); + m_caster->CastSpell(m_caster, 36897, true); else - m_caster->CastSpell(m_caster,36899,true); + m_caster->CastSpell(m_caster, 36899, true); break; } case 6: // chicken - m_caster->CastSpell(m_caster,36940,true); + m_caster->CastSpell(m_caster, 36940, true); break; case 7: // evil twin - m_caster->CastSpell(m_caster,23445,true); + m_caster->CastSpell(m_caster, 23445, true); break; } } @@ -2216,28 +2216,28 @@ void Spell::EffectTeleportUnits(uint32 i) { if ( roll_chance_i(50) ) // 50% success { - int32 rand_eff = urand(1,4); + int32 rand_eff = urand(1, 4); switch ( rand_eff ) { case 1: // soul split - evil - m_caster->CastSpell(m_caster,36900,true); + m_caster->CastSpell(m_caster, 36900, true); break; case 2: // soul split - good - m_caster->CastSpell(m_caster,36901,true); + m_caster->CastSpell(m_caster, 36901, true); break; case 3: // Increase the size - m_caster->CastSpell(m_caster,36895,true); + m_caster->CastSpell(m_caster, 36895, true); break; case 4: // Transform { if (((Player*)m_caster)->GetTeam() == ALLIANCE ) - m_caster->CastSpell(m_caster,36897,true); + m_caster->CastSpell(m_caster, 36897, true); else - m_caster->CastSpell(m_caster,36899,true); + m_caster->CastSpell(m_caster, 36899, true); break; } } @@ -2267,7 +2267,7 @@ void Spell::EffectApplyAura(uint32 i) // Now Reduce spell duration using data received at spell hit int32 duration = Aur->GetAuraMaxDuration(); - unitTarget->ApplyDiminishingToDuration(m_diminishGroup,duration,m_caster,m_diminishLevel); + unitTarget->ApplyDiminishingToDuration(m_diminishGroup, duration, m_caster, m_diminishLevel); Aur->setDiminishGroup(m_diminishGroup); // if Aura removed and deleted, do not continue. @@ -2356,11 +2356,11 @@ void Spell::EffectPowerDrain(uint32 i) if(Player *modOwner = m_caster->GetSpellModOwner()) modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_MULTIPLE_VALUE, manaMultiplier); - int32 gain = int32(new_damage*manaMultiplier); + int32 gain = int32(new_damage * manaMultiplier); m_caster->ModifyPower(POWER_MANA,gain); //send log - m_caster->SendEnergizeSpellLog(m_caster, m_spellInfo->Id,gain,POWER_MANA); + m_caster->SendEnergizeSpellLog(m_caster, m_spellInfo->Id, gain, POWER_MANA); } } @@ -2406,14 +2406,14 @@ void Spell::EffectPowerBurn(uint32 i) int32 new_damage = (curPower < power) ? curPower : power; - unitTarget->ModifyPower(powertype,-new_damage); + unitTarget->ModifyPower(powertype, -new_damage); float multiplier = m_spellInfo->EffectMultipleValue[i]; if(Player *modOwner = m_caster->GetSpellModOwner()) modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_MULTIPLE_VALUE, multiplier); - new_damage = int32(new_damage*multiplier); - m_damage+=new_damage; + new_damage = int32(new_damage * multiplier); + m_damage += new_damage; } void Spell::EffectHeal( uint32 /*i*/ ) @@ -2435,7 +2435,7 @@ void Spell::EffectHeal( uint32 /*i*/ ) // Amount of heal - depends from stacked Holy Energy int damageAmount = 0; Unit::AuraList const& mDummyAuras = m_caster->GetAurasByType(SPELL_AURA_DUMMY); - for(Unit::AuraList::const_iterator i = mDummyAuras.begin();i != mDummyAuras.end(); ++i) + for(Unit::AuraList::const_iterator i = mDummyAuras.begin(); i != mDummyAuras.end(); ++i) if((*i)->GetId() == 45062) damageAmount+=(*i)->GetModifier()->m_amount; if (damageAmount) @@ -2645,7 +2645,7 @@ void Spell::DoCreateItem(uint32 i, uint32 itemtype) // set the "Crafted by ..." property of the item if( pItem->GetProto()->Class != ITEM_CLASS_CONSUMABLE && pItem->GetProto()->Class != ITEM_CLASS_QUEST) - pItem->SetUInt32Value(ITEM_FIELD_CREATOR,player->GetGUIDLow()); + pItem->SetUInt32Value(ITEM_FIELD_CREATOR, player->GetGUIDLow()); // send info to the client if(pItem) @@ -2678,7 +2678,7 @@ void Spell::DoCreateItem(uint32 i, uint32 itemtype) } if(BattleGround* bg = sBattleGroundMgr.GetBattleGroundTemplate(bgType)) - bg->SendRewardMarkByMail(player,newitemid,no_space); + bg->SendRewardMarkByMail(player, newitemid, no_space); } } @@ -2696,7 +2696,7 @@ void Spell::EffectCreateItem2(uint32 i) return; // create some random items - ((Player*)m_caster)->AutoStoreLoot(m_spellInfo->Id,LootTemplates_Spell); + ((Player*)m_caster)->AutoStoreLoot(m_spellInfo->Id, LootTemplates_Spell); return; } DoCreateItem(i,m_spellInfo->EffectItemType[i]); @@ -2977,7 +2977,7 @@ void Spell::EffectOpenLock(uint32 effIndex) int32 reqSkillValue = 0; int32 skillValue; - SpellCastResult res = CanOpenLock(effIndex,lockId,skillId,reqSkillValue,skillValue); + SpellCastResult res = CanOpenLock(effIndex, lockId, skillId, reqSkillValue, skillValue); if(res != SPELL_CAST_OK) { SendCastResult(res); @@ -3051,7 +3051,7 @@ void Spell::EffectSummonChangeItem(uint32 i) uint8 msg = player->CanStoreItem( m_CastItem->GetBagSlot(), m_CastItem->GetSlot(), dest, pNewItem, true ); if( msg == EQUIP_ERR_OK ) { - player->DestroyItem(m_CastItem->GetBagSlot(), m_CastItem->GetSlot(),true); + player->DestroyItem(m_CastItem->GetBagSlot(), m_CastItem->GetSlot(), true); // prevent crash at access and unexpected charges counting with item update queue corrupt if(m_CastItem==m_targets.getItemTarget()) @@ -3069,7 +3069,7 @@ void Spell::EffectSummonChangeItem(uint32 i) uint8 msg = player->CanBankItem( m_CastItem->GetBagSlot(), m_CastItem->GetSlot(), dest, pNewItem, true ); if( msg == EQUIP_ERR_OK ) { - player->DestroyItem(m_CastItem->GetBagSlot(), m_CastItem->GetSlot(),true); + player->DestroyItem(m_CastItem->GetBagSlot(), m_CastItem->GetSlot(), true); // prevent crash at access and unexpected charges counting with item update queue corrupt if(m_CastItem==m_targets.getItemTarget()) @@ -3087,7 +3087,7 @@ void Spell::EffectSummonChangeItem(uint32 i) uint8 msg = player->CanEquipItem( m_CastItem->GetSlot(), dest, pNewItem, true ); if( msg == EQUIP_ERR_OK ) { - player->DestroyItem(m_CastItem->GetBagSlot(), m_CastItem->GetSlot(),true); + player->DestroyItem(m_CastItem->GetBagSlot(), m_CastItem->GetSlot(), true); // prevent crash at access and unexpected charges counting with item update queue corrupt if(m_CastItem==m_targets.getItemTarget()) @@ -3117,15 +3117,15 @@ void Spell::EffectProficiency(uint32 /*i*/) Player *p_target = (Player*)unitTarget; uint32 subClassMask = m_spellInfo->EquippedItemSubClassMask; - if(m_spellInfo->EquippedItemClass == 2 && !(p_target->GetWeaponProficiency() & subClassMask)) + if(m_spellInfo->EquippedItemClass == ITEM_CLASS_WEAPON && !(p_target->GetWeaponProficiency() & subClassMask)) { p_target->AddWeaponProficiency(subClassMask); - p_target->SendProficiency(uint8(0x02),p_target->GetWeaponProficiency()); + p_target->SendProficiency(ITEM_CLASS_WEAPON, p_target->GetWeaponProficiency()); } - if(m_spellInfo->EquippedItemClass == 4 && !(p_target->GetArmorProficiency() & subClassMask)) + if(m_spellInfo->EquippedItemClass == ITEM_CLASS_ARMOR && !(p_target->GetArmorProficiency() & subClassMask)) { p_target->AddArmorProficiency(subClassMask); - p_target->SendProficiency(uint8(0x04),p_target->GetArmorProficiency()); + p_target->SendProficiency(ITEM_CLASS_ARMOR, p_target->GetArmorProficiency()); } } @@ -3209,7 +3209,7 @@ void Spell::EffectSummon(uint32 i) Map *map = m_caster->GetMap(); uint32 pet_number = objmgr.GeneratePetNumber(); - if(!spawnCreature->Create(objmgr.GenerateLowGuid(HIGHGUID_PET),map,m_caster->GetPhaseMask(), + if(!spawnCreature->Create(objmgr.GenerateLowGuid(HIGHGUID_PET), map, m_caster->GetPhaseMask(), m_spellInfo->EffectMiscValue[i], pet_number)) { sLog.outErrorDb("Spell::EffectSummon: no such creature entry %u",m_spellInfo->EffectMiscValue[i]); @@ -3218,7 +3218,7 @@ void Spell::EffectSummon(uint32 i) } // Summon in dest location - float x,y,z; + float x, y, z; if(m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION) { x = m_targets.m_destX; @@ -3226,9 +3226,9 @@ void Spell::EffectSummon(uint32 i) z = m_targets.m_destZ; } else - m_caster->GetClosePoint(x,y,z,spawnCreature->GetObjectSize()); + m_caster->GetClosePoint(x, y, z, spawnCreature->GetObjectSize()); - spawnCreature->Relocate(x,y,z,-m_caster->GetOrientation()); + spawnCreature->Relocate(x, y, z, -m_caster->GetOrientation()); if(!spawnCreature->IsPositionValid()) { @@ -3468,7 +3468,7 @@ void Spell::EffectDistract(uint32 /*i*/) // Set creature Distracted, Stop it, And turn it unitTarget->SetOrientation(angle); unitTarget->StopMoving(); - unitTarget->GetMotionMaster()->MoveDistract(damage*IN_MILISECONDS); + unitTarget->GetMotionMaster()->MoveDistract(damage * IN_MILISECONDS); } } @@ -3566,17 +3566,17 @@ void Spell::EffectSummonWild(uint32 i) } // Summon in random point all other units if location present else - m_caster->GetRandomPoint(center_x,center_y,center_z,radius,px,py,pz); + m_caster->GetRandomPoint(center_x, center_y, center_z, radius, px, py, pz); } // Summon if dest location not present near caster else - m_caster->GetClosePoint(px,py,pz,3.0f); + m_caster->GetClosePoint(px, py, pz, 3.0f); int32 duration = GetSpellDuration(m_spellInfo); TempSummonType summonType = (duration == 0) ? TEMPSUMMON_DEAD_DESPAWN : TEMPSUMMON_TIMED_OR_DEAD_DESPAWN; - m_caster->SummonCreature(creature_entry,px,py,pz,m_caster->GetOrientation(),summonType,duration); + m_caster->SummonCreature(creature_entry, px, py, pz, m_caster->GetOrientation(), summonType, duration); } } @@ -3587,7 +3587,7 @@ void Spell::EffectSummonGuardian(uint32 i) return; // Jewelery statue case (totem like) - if(m_spellInfo->SpellIconID==2056) + if(m_spellInfo->SpellIconID == 2056) { EffectSummonTotem(i); return; @@ -3599,7 +3599,7 @@ void Spell::EffectSummonGuardian(uint32 i) // Search old Guardian only for players (if casted spell not have duration or cooldown) // FIXME: some guardians have control spell applied and controlled by player and anyway player can't summon in this time // so this code hack in fact - if( m_caster->GetTypeId() == TYPEID_PLAYER && (duration <= 0 || GetSpellRecoveryTime(m_spellInfo)==0) ) + if( m_caster->GetTypeId() == TYPEID_PLAYER && (duration <= 0 || GetSpellRecoveryTime(m_spellInfo) == 0) ) if(((Player*)m_caster)->HasGuardianWithEntry(pet_entry)) return; // find old guardian, ignore summon @@ -3607,7 +3607,7 @@ void Spell::EffectSummonGuardian(uint32 i) uint32 level = m_caster->getLevel(); // level of pet summoned using engineering item based at engineering skill level - if(m_caster->GetTypeId()==TYPEID_PLAYER && m_CastItem) + if(m_caster->GetTypeId() == TYPEID_PLAYER && m_CastItem) { ItemPrototype const *proto = m_CastItem->GetProto(); if(proto && proto->RequiredSkill == SKILL_ENGINERING) @@ -3615,7 +3615,7 @@ void Spell::EffectSummonGuardian(uint32 i) uint16 skill202 = ((Player*)m_caster)->GetSkillValue(SKILL_ENGINERING); if(skill202) { - level = skill202/5; + level = skill202 / 5; } } } @@ -3638,7 +3638,7 @@ void Spell::EffectSummonGuardian(uint32 i) if(!spawnCreature->Create(objmgr.GenerateLowGuid(HIGHGUID_PET), map,m_caster->GetPhaseMask(), m_spellInfo->EffectMiscValue[i], pet_number)) { - sLog.outError("no such creature entry %u",m_spellInfo->EffectMiscValue[i]); + sLog.outError("no such creature entry %u", m_spellInfo->EffectMiscValue[i]); delete spawnCreature; return; } @@ -3656,13 +3656,13 @@ void Spell::EffectSummonGuardian(uint32 i) } // Summon in random point all other units if location present else - m_caster->GetRandomPoint(center_x,center_y,center_z,radius,px,py,pz); + m_caster->GetRandomPoint(center_x, center_y, center_z, radius, px, py, pz); } // Summon if dest location not present near caster else - m_caster->GetClosePoint(px,py,pz,spawnCreature->GetObjectSize()); + m_caster->GetClosePoint(px, py, pz,spawnCreature->GetObjectSize()); - spawnCreature->Relocate(px,py,pz,m_caster->GetOrientation()); + spawnCreature->Relocate(px, py, pz, m_caster->GetOrientation()); if(!spawnCreature->IsPositionValid()) { @@ -3677,11 +3677,11 @@ void Spell::EffectSummonGuardian(uint32 i) spawnCreature->SetOwnerGUID(m_caster->GetGUID()); spawnCreature->setPowerType(POWER_MANA); - spawnCreature->SetUInt32Value(UNIT_NPC_FLAGS , 0); - spawnCreature->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE,m_caster->getFaction()); - spawnCreature->SetUInt32Value(UNIT_FIELD_FLAGS,0); - spawnCreature->SetUInt32Value(UNIT_FIELD_BYTES_1,0); - spawnCreature->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP,0); + spawnCreature->SetUInt32Value(UNIT_NPC_FLAGS, 0); + spawnCreature->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, m_caster->getFaction()); + spawnCreature->SetUInt32Value(UNIT_FIELD_FLAGS, 0); + spawnCreature->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); + spawnCreature->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, 0); spawnCreature->SetCreatorGUID(m_caster->GetGUID()); spawnCreature->SetUInt32Value(UNIT_CREATED_BY_SPELL, m_spellInfo->Id); @@ -3707,10 +3707,10 @@ void Spell::EffectTeleUnitsFaceCaster(uint32 i) float dis = GetSpellRadius(sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[i])); - float fx,fy,fz; - m_caster->GetClosePoint(fx,fy,fz,unitTarget->GetObjectSize(),dis); + float fx, fy, fz; + m_caster->GetClosePoint(fx, fy, fz, unitTarget->GetObjectSize(), dis); - unitTarget->NearTeleportTo(fx,fy,fz,-m_caster->GetOrientation(),unitTarget==m_caster); + unitTarget->NearTeleportTo(fx, fy, fz, -m_caster->GetOrientation(), unitTarget==m_caster); } void Spell::EffectLearnSkill(uint32 i) @@ -3723,7 +3723,7 @@ void Spell::EffectLearnSkill(uint32 i) uint32 skillid = m_spellInfo->EffectMiscValue[i]; uint16 skillval = ((Player*)unitTarget)->GetPureSkillValue(skillid); - ((Player*)unitTarget)->SetSkill(skillid, skillval?skillval:1, damage*75); + ((Player*)unitTarget)->SetSkill(skillid, skillval ? skillval : 1, damage * 75); } void Spell::EffectAddHonor(uint32 /*i*/) @@ -3734,7 +3734,7 @@ void Spell::EffectAddHonor(uint32 /*i*/) // not scale value for item based reward (/10 value expected) if(m_CastItem) { - ((Player*)unitTarget)->RewardHonor(NULL, 1, damage/10); + ((Player*)unitTarget)->RewardHonor(NULL, 1, damage / 10); sLog.outError("SpellEffect::AddHonor (spell_id %u) rewards %d honor points (item %u) for player: %u", m_spellInfo->Id, damage/10, m_CastItem->GetEntry(),((Player*)unitTarget)->GetGUIDLow()); return; } @@ -3946,26 +3946,26 @@ void Spell::EffectEnchantItemTmp(uint32 i) uint32 duration; // rogue family enchantments exception by duration - if(m_spellInfo->Id==38615) + if(m_spellInfo->Id == 38615) duration = 1800; // 30 mins // other rogue family enchantments always 1 hour (some have spell damage=0, but some have wrong data in EffBasePoints) - else if(m_spellInfo->SpellFamilyName==SPELLFAMILY_ROGUE) + else if(m_spellInfo->SpellFamilyName == SPELLFAMILY_ROGUE) duration = 3600; // 1 hour // shaman family enchantments - else if(m_spellInfo->SpellFamilyName==SPELLFAMILY_SHAMAN) + else if(m_spellInfo->SpellFamilyName == SPELLFAMILY_SHAMAN) duration = 1800; // 30 mins // other cases with this SpellVisual already selected - else if(m_spellInfo->SpellVisual[0]==215) + else if(m_spellInfo->SpellVisual[0] == 215) duration = 1800; // 30 mins // some fishing pole bonuses - else if(m_spellInfo->SpellVisual[0]==563) + else if(m_spellInfo->SpellVisual[0] == 563) duration = 600; // 10 mins // shaman rockbiter enchantments - else if(m_spellInfo->SpellVisual[0]==0) + else if(m_spellInfo->SpellVisual[0] == 0) duration = 1800; // 30 mins - else if(m_spellInfo->Id==29702) + else if(m_spellInfo->Id == 29702) duration = 300; // 5 mins - else if(m_spellInfo->Id==37360) + else if(m_spellInfo->Id == 37360) duration = 300; // 5 mins // default case else @@ -3979,18 +3979,18 @@ void Spell::EffectEnchantItemTmp(uint32 i) if(item_owner!=p_caster && p_caster->GetSession()->GetSecurity() > SEC_PLAYER && sWorld.getConfig(CONFIG_GM_LOG_TRADE) ) { sLog.outCommand(p_caster->GetSession()->GetAccountId(),"GM %s (Account: %u) enchanting(temp): %s (Entry: %d) for player: %s (Account: %u)", - p_caster->GetName(),p_caster->GetSession()->GetAccountId(), - itemTarget->GetProto()->Name1,itemTarget->GetEntry(), - item_owner->GetName(),item_owner->GetSession()->GetAccountId()); + p_caster->GetName(), p_caster->GetSession()->GetAccountId(), + itemTarget->GetProto()->Name1, itemTarget->GetEntry(), + item_owner->GetName(), item_owner->GetSession()->GetAccountId()); } // remove old enchanting before applying new if equipped - item_owner->ApplyEnchantment(itemTarget,TEMP_ENCHANTMENT_SLOT,false); + item_owner->ApplyEnchantment(itemTarget,TEMP_ENCHANTMENT_SLOT, false); - itemTarget->SetEnchantment(TEMP_ENCHANTMENT_SLOT, enchant_id, duration*1000, 0); + itemTarget->SetEnchantment(TEMP_ENCHANTMENT_SLOT, enchant_id, duration * 1000, 0); // add new enchanting if equipped - item_owner->ApplyEnchantment(itemTarget,TEMP_ENCHANTMENT_SLOT,true); + item_owner->ApplyEnchantment(itemTarget, TEMP_ENCHANTMENT_SLOT, true); } void Spell::EffectTameCreature(uint32 /*i*/) @@ -4092,7 +4092,7 @@ void Spell::EffectSummonPet(uint32 i) Unit::AuraList const& auraClassScripts = m_caster->GetAurasByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS); for(Unit::AuraList::const_iterator itr = auraClassScripts.begin();itr!=auraClassScripts.end();) { - if((*itr)->GetModifier()->m_miscvalue==2228) + if((*itr)->GetModifier()->m_miscvalue == 2228) { m_caster->RemoveAurasDueToSpell((*itr)->GetId()); itr = auraClassScripts.begin(); @@ -4271,7 +4271,7 @@ void Spell::EffectWeaponDmg(uint32 i) // multiple weapon dmg effect workaround // execute only the last weapon damage // and handle all effects at once - for (int j = 0; j < 3; j++) + for (int j = 0; j < 3; ++j) { switch(m_spellInfo->Effect[j]) { @@ -4376,7 +4376,7 @@ void Spell::EffectWeaponDmg(uint32 i) // Stormstrike AP Buff if ( (*citr)->GetModifier()->m_miscvalue == 5634 ) { - m_caster->CastSpell(m_caster,38430,true,NULL,*citr); + m_caster->CastSpell(m_caster, 38430, true, NULL, *citr); break; } } @@ -4385,20 +4385,20 @@ void Spell::EffectWeaponDmg(uint32 i) } int32 fixed_bonus = 0; - for (int j = 0; j < 3; j++) + for (int j = 0; j < 3; ++j) { switch(m_spellInfo->Effect[j]) { case SPELL_EFFECT_WEAPON_DAMAGE: case SPELL_EFFECT_WEAPON_DAMAGE_NOSCHOOL: - fixed_bonus += CalculateDamage(j,unitTarget); + fixed_bonus += CalculateDamage(j, unitTarget); break; case SPELL_EFFECT_NORMALIZED_WEAPON_DMG: - fixed_bonus += CalculateDamage(j,unitTarget); + fixed_bonus += CalculateDamage(j, unitTarget); normalized = true; break; case SPELL_EFFECT_WEAPON_PERCENT_DAMAGE: - weaponDamagePercentMod *= float(CalculateDamage(j,unitTarget)) / 100.0f; + weaponDamagePercentMod *= float(CalculateDamage(j, unitTarget)) / 100.0f; // applied only to prev.effects fixed damage fixed_bonus = int32(fixed_bonus*weaponDamagePercentMod); @@ -4455,7 +4455,7 @@ void Spell::EffectWeaponDmg(uint32 i) if(m_spellInfo->SpellFamilyName==SPELLFAMILY_DRUID && (m_spellInfo->SpellFamilyFlags==0x0000040000000000LL)) { if(m_caster->GetTypeId()==TYPEID_PLAYER) - ((Player*)m_caster)->AddComboPoints(unitTarget,1); + ((Player*)m_caster)->AddComboPoints(unitTarget, 1); } // take ammo @@ -4464,7 +4464,7 @@ void Spell::EffectWeaponDmg(uint32 i) Item *pItem = ((Player*)m_caster)->GetWeaponForAttack( RANGED_ATTACK ); // wands don't have ammo - if(!pItem || pItem->IsBroken() || pItem->GetProto()->SubClass==ITEM_SUBCLASS_WEAPON_WAND) + if(!pItem || pItem->IsBroken() || pItem->GetProto()->SubClass == ITEM_SUBCLASS_WEAPON_WAND) return; if( pItem->GetProto()->InventoryType == INVTYPE_THROWN ) @@ -4506,7 +4506,7 @@ void Spell::EffectHealMaxHealth(uint32 /*i*/) uint32 heal = m_caster->GetMaxHealth(); - m_healing+=heal; + m_healing += heal; } void Spell::EffectInterruptCast(uint32 /*i*/) @@ -4542,7 +4542,7 @@ void Spell::EffectSummonObjectWild(uint32 i) if( !target ) target = m_caster; - float x,y,z; + float x, y, z; if(m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION) { x = m_targets.m_destX; @@ -4550,7 +4550,7 @@ void Spell::EffectSummonObjectWild(uint32 i) z = m_targets.m_destZ; } else - m_caster->GetClosePoint(x,y,z,DEFAULT_WORLD_OBJECT_SIZE); + m_caster->GetClosePoint(x, y, z, DEFAULT_WORLD_OBJECT_SIZE); Map *map = target->GetMap(); @@ -4654,7 +4654,7 @@ void Spell::EffectScriptEffect(uint32 effIndex) return; uint32 spell_id = 0; - switch(urand(1,5)) + switch(urand(1, 5)) { case 1: spell_id = 8854; break; default: spell_id = 8855; break; @@ -4763,14 +4763,17 @@ void Spell::EffectScriptEffect(uint32 effIndex) case 29830: { uint32 item = 0; - switch ( urand(1,6) ) + switch ( urand(1, 6) ) { - case 1:case 2:case 3: - item = 23584;break; // Loch Modan Lager - case 4:case 5: - item = 23585;break; // Stouthammer Lite + case 1: + case 2: + case 3: + item = 23584; break; // Loch Modan Lager + case 4: + case 5: + item = 23585; break; // Stouthammer Lite case 6: - item = 23586;break; // Aerie Peak Pale Ale + item = 23586; break; // Aerie Peak Pale Ale } if (item) DoCreateItem(effIndex,item); @@ -4827,7 +4830,7 @@ void Spell::EffectScriptEffect(uint32 effIndex) return; uint32 spellId = 0; - switch(rand()%4) + switch(rand() % 4) { case 0: spellId = 46740; break; case 1: spellId = 46739; break; @@ -4853,7 +4856,7 @@ void Spell::EffectScriptEffect(uint32 effIndex) if(!unitTarget) return; - unitTarget->CastSpell(unitTarget,51771,false); + unitTarget->CastSpell(unitTarget, 51771, false); break; } // Death Gate @@ -4922,26 +4925,26 @@ void Spell::EffectScriptEffect(uint32 effIndex) return; } - if(m_caster->GetTypeId()!=TYPEID_PLAYER) + if(m_caster->GetTypeId() != TYPEID_PLAYER) return; Player* player = (Player*)m_caster; // need replace effect 0 item by loot uint32 reagent_id = m_spellInfo->EffectItemType[0]; - if(!player->HasItemCount(reagent_id,1)) + if(!player->HasItemCount(reagent_id, 1)) return; // remove reagent uint32 count = 1; - player->DestroyItemCount (reagent_id,count,true); + player->DestroyItemCount(reagent_id, count, true); // create some random items - player->AutoStoreLoot(m_spellInfo->Id,LootTemplates_Spell); + player->AutoStoreLoot(m_spellInfo->Id, LootTemplates_Spell); // learn random explicit discovery recipe (if any) if(uint32 discoveredSpell = GetExplicitDiscoverySpell(m_spellInfo->Id, player)) - player->learnSpell(discoveredSpell,false); + player->learnSpell(discoveredSpell, false); return; } } @@ -4979,14 +4982,14 @@ void Spell::EffectScriptEffect(uint32 effIndex) } static uint32 const itypes[8][3] = { - { 5512,19004,19005}, // Minor Healthstone - { 5511,19006,19007}, // Lesser Healthstone - { 5509,19008,19009}, // Healthstone - { 5510,19010,19011}, // Greater Healthstone - { 9421,19012,19013}, // Major Healthstone - {22103,22104,22105}, // Master Healthstone - {36889,36890,36891}, // Demonic Healthstone - {36892,36893,36894} // Fel Healthstone + { 5512, 19004, 19005}, // Minor Healthstone + { 5511, 19006, 19007}, // Lesser Healthstone + { 5509, 19008, 19009}, // Healthstone + { 5510, 19010, 19011}, // Greater Healthstone + { 9421, 19012, 19013}, // Major Healthstone + {22103, 22104, 22105}, // Master Healthstone + {36889, 36890, 36891}, // Demonic Healthstone + {36892, 36893, 36894} // Fel Healthstone }; switch(m_spellInfo->Id) @@ -5182,8 +5185,8 @@ void Spell::EffectScriptEffect(uint32 effIndex) const uint32 spellid = 28703; // don't overwrite an existing aura - for(uint8 i=0; i<5; i++) - if(unitTarget->HasAura(spellid+i, 0)) + for(uint8 i = 0; i < 5; ++i) + if(unitTarget->HasAura(spellid + i, 0)) return; unitTarget->CastSpell(unitTarget, spellid+urand(0, 4), true); break; @@ -5305,9 +5308,9 @@ void Spell::EffectDuel(uint32 i) //END // Send request - WorldPacket data(SMSG_DUEL_REQUESTED, 16); - data << pGameObj->GetGUID(); - data << caster->GetGUID(); + WorldPacket data(SMSG_DUEL_REQUESTED, 8 + 8); + data << uint64(pGameObj->GetGUID()); + data << uint64(caster->GetGUID()); caster->GetSession()->SendPacket(&data); target->GetSession()->SendPacket(&data); @@ -5326,8 +5329,8 @@ void Spell::EffectDuel(uint32 i) duel2->startTimer = 0; target->duel = duel2; - caster->SetUInt64Value(PLAYER_DUEL_ARBITER,pGameObj->GetGUID()); - target->SetUInt64Value(PLAYER_DUEL_ARBITER,pGameObj->GetGUID()); + caster->SetUInt64Value(PLAYER_DUEL_ARBITER, pGameObj->GetGUID()); + target->SetUInt64Value(PLAYER_DUEL_ARBITER, pGameObj->GetGUID()); } void Spell::EffectStuck(uint32 /*i*/) @@ -5353,7 +5356,7 @@ void Spell::EffectStuck(uint32 /*i*/) SpellEntry const *spellInfo = sSpellStore.LookupEntry(8690); if(!spellInfo) return; - Spell spell(pTarget,spellInfo,true,0); + Spell spell(pTarget, spellInfo, true, 0); spell.SendSpellCooldown(); } @@ -5366,8 +5369,8 @@ void Spell::EffectSummonPlayer(uint32 /*i*/) if(unitTarget->GetDummyAura(23445)) return; - float x,y,z; - m_caster->GetClosePoint(x,y,z,unitTarget->GetObjectSize()); + float x, y, z; + m_caster->GetClosePoint(x, y, z, unitTarget->GetObjectSize()); ((Player*)unitTarget)->SetSummonPoint(m_caster->GetMapId(),x,y,z); @@ -5477,8 +5480,8 @@ void Spell::EffectSummonTotem(uint32 i) float angle = slot < MAX_TOTEM ? M_PI/MAX_TOTEM - (slot*2*M_PI/MAX_TOTEM) : 0; - float x,y,z; - m_caster->GetClosePoint(x,y,z,pTotem->GetObjectSize(),2.0f,angle); + float x, y, z; + m_caster->GetClosePoint(x, y, z, pTotem->GetObjectSize(), 2.0f, angle); // totem must be at same Z in case swimming caster and etc. if( fabs( z - m_caster->GetPositionZ() ) > 5 ) @@ -5494,7 +5497,7 @@ void Spell::EffectSummonTotem(uint32 i) int32 duration=GetSpellDuration(m_spellInfo); if(Player* modOwner = m_caster->GetSpellModOwner()) - modOwner->ApplySpellMod(m_spellInfo->Id,SPELLMOD_DURATION, duration); + modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_DURATION, duration); pTotem->SetDuration(duration); if (damage) // if not spell info, DB values used @@ -5503,16 +5506,16 @@ void Spell::EffectSummonTotem(uint32 i) pTotem->SetHealth(damage); } - pTotem->SetUInt32Value(UNIT_CREATED_BY_SPELL,m_spellInfo->Id); + pTotem->SetUInt32Value(UNIT_CREATED_BY_SPELL, m_spellInfo->Id); if(m_caster->GetTypeId() == TYPEID_PLAYER) - pTotem->SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_PVP_ATTACKABLE); + pTotem->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE); pTotem->Summon(m_caster); if(slot < MAX_TOTEM && m_caster->GetTypeId() == TYPEID_PLAYER) { - WorldPacket data(SMSG_TOTEM_CREATED, 1+8+4+4); + WorldPacket data(SMSG_TOTEM_CREATED, 1 + 8 + 4 + 4); data << uint8(slot); data << uint64(pTotem->GetGUID()); data << uint32(duration); @@ -5559,7 +5562,7 @@ void Spell::EffectEnchantHeldItem(uint32 i) // Apply the temporary enchantment item->SetEnchantment(slot, enchant_id, duration*IN_MILISECONDS, 0); - item_owner->ApplyEnchantment(item,slot,true); + item_owner->ApplyEnchantment(item, slot, true); } } @@ -5591,7 +5594,7 @@ void Spell::EffectInebriate(uint32 /*i*/) currentDrunk = 0xFFFF; else currentDrunk += drunkMod; - player->SetDrunkValue(currentDrunk, m_CastItem?m_CastItem->GetEntry():0); + player->SetDrunkValue(currentDrunk, m_CastItem ? m_CastItem->GetEntry() : 0); } void Spell::EffectFeedPet(uint32 i) @@ -5620,7 +5623,7 @@ void Spell::EffectFeedPet(uint32 i) _player->DestroyItemCount(foodItem,count,true); // TODO: fix crash when a spell has two effects, both pointed at the same item target - m_caster->CastCustomSpell(pet,m_spellInfo->EffectTriggerSpell[i],&benefit,NULL,NULL,true); + m_caster->CastCustomSpell(pet, m_spellInfo->EffectTriggerSpell[i], &benefit, NULL, NULL, true); } void Spell::EffectDismissPet(uint32 /*i*/) @@ -5634,7 +5637,7 @@ void Spell::EffectDismissPet(uint32 /*i*/) if(!pet||!pet->isAlive()) return; - ((Player*)m_caster)->RemovePet(pet,PET_SAVE_NOT_IN_SLOT); + ((Player*)m_caster)->RemovePet(pet, PET_SAVE_NOT_IN_SLOT); } void Spell::EffectSummonObject(uint32 i) @@ -5664,7 +5667,7 @@ void Spell::EffectSummonObject(uint32 i) GameObject* pGameObj = new GameObject; - float x,y,z; + float x, y, z; // If dest location if present if (m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION) { @@ -5674,7 +5677,7 @@ void Spell::EffectSummonObject(uint32 i) } // Summon in random point all other units if location present else - m_caster->GetClosePoint(x,y,z,DEFAULT_WORLD_OBJECT_SIZE); + m_caster->GetClosePoint(x, y, z, DEFAULT_WORLD_OBJECT_SIZE); Map *map = m_caster->GetMap(); if(!pGameObj->Create(objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), go_id, map, @@ -5692,8 +5695,8 @@ void Spell::EffectSummonObject(uint32 i) map->Add(pGameObj); WorldPacket data(SMSG_GAMEOBJECT_SPAWN_ANIM_OBSOLETE, 8); - data << pGameObj->GetGUID(); - m_caster->SendMessageToSet(&data,true); + data << uint64(pGameObj->GetGUID()); + m_caster->SendMessageToSet(&data, true); m_caster->m_ObjectSlot[slot] = pGameObj->GetGUID(); } @@ -5772,26 +5775,26 @@ void Spell::EffectMomentMove(uint32 i) if(unitTarget->isInFlight()) return; - if( m_spellInfo->rangeIndex== 1) //self range + if( m_spellInfo->rangeIndex == 1) //self range { float dis = GetSpellRadius(sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[i])); // before caster - float fx,fy,fz; - unitTarget->GetClosePoint(fx,fy,fz,unitTarget->GetObjectSize(),dis); - float ox,oy,oz; - unitTarget->GetPosition(ox,oy,oz); + float fx, fy, fz; + unitTarget->GetClosePoint(fx, fy, fz, unitTarget->GetObjectSize(), dis); + float ox, oy, oz; + unitTarget->GetPosition(ox, oy, oz); - float fx2,fy2,fz2; // getObjectHitPos overwrite last args in any result case + float fx2, fy2, fz2; // getObjectHitPos overwrite last args in any result case if(VMAP::VMapFactory::createOrGetVMapManager()->getObjectHitPos(unitTarget->GetMapId(), ox,oy,oz+0.5, fx,fy,oz+0.5,fx2,fy2,fz2, -0.5)) { fx = fx2; fy = fy2; fz = fz2; - unitTarget->UpdateGroundPositionZ(fx,fy,fz); + unitTarget->UpdateGroundPositionZ(fx, fy, fz); } - unitTarget->NearTeleportTo(fx, fy, fz, unitTarget->GetOrientation(),unitTarget==m_caster); + unitTarget->NearTeleportTo(fx, fy, fz, unitTarget->GetOrientation(), unitTarget == m_caster); } } @@ -5811,7 +5814,7 @@ void Spell::EffectReputation(uint32 i) if(!factionEntry) return; - _player->GetReputationMgr().ModifyReputation(factionEntry,rep_change); + _player->GetReputationMgr().ModifyReputation(factionEntry, rep_change); } void Spell::EffectQuestComplete(uint32 i) @@ -5944,7 +5947,7 @@ void Spell::EffectSummonCritter(uint32 i) return; } - float x,y,z; + float x, y, z; // If dest location if present if (m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION) { @@ -5954,9 +5957,9 @@ void Spell::EffectSummonCritter(uint32 i) } // Summon if dest location not present near caster else - m_caster->GetClosePoint(x,y,z,critter->GetObjectSize()); + m_caster->GetClosePoint(x, y, z, critter->GetObjectSize()); - critter->Relocate(x,y,z,m_caster->GetOrientation()); + critter->Relocate(x, y, z, m_caster->GetOrientation()); if(!critter->IsPositionValid()) { @@ -6003,7 +6006,7 @@ void Spell::EffectKnockBack(uint32 i) float vsin = sin(m_caster->GetAngle(unitTarget)); float vcos = cos(m_caster->GetAngle(unitTarget)); - WorldPacket data(SMSG_MOVE_KNOCK_BACK, (8+4+4+4+4+4)); + WorldPacket data(SMSG_MOVE_KNOCK_BACK, 8+4+4+4+4+4); data.append(unitTarget->GetPackGUID()); data << uint32(0); // Sequence data << float(vcos); // x direction @@ -6034,7 +6037,7 @@ void Spell::EffectPlayerPull(uint32 i) float vsin = sin(unitTarget->GetAngle(m_caster)); float vcos = cos(unitTarget->GetAngle(m_caster)); - WorldPacket data(SMSG_MOVE_KNOCK_BACK, (8+4+4+4+4+4)); + WorldPacket data(SMSG_MOVE_KNOCK_BACK, 8+4+4+4+4+4); data.append(unitTarget->GetPackGUID()); data << uint32(0); // Sequence data << float(vcos); // x direction @@ -6132,7 +6135,7 @@ void Spell::EffectDurabilityDamage(uint32 i) // Possibly its mean -1 all player equipped items and -2 all items if(slot < 0) { - ((Player*)unitTarget)->DurabilityPointsLossAll(damage,(slot < -1)); + ((Player*)unitTarget)->DurabilityPointsLossAll(damage, (slot < -1)); return; } @@ -6140,8 +6143,8 @@ void Spell::EffectDurabilityDamage(uint32 i) if(slot >= INVENTORY_SLOT_BAG_END) return; - if(Item* item = ((Player*)unitTarget)->GetItemByPos(INVENTORY_SLOT_BAG_0,slot)) - ((Player*)unitTarget)->DurabilityPointsLoss(item,damage); + if(Item* item = ((Player*)unitTarget)->GetItemByPos(INVENTORY_SLOT_BAG_0, slot)) + ((Player*)unitTarget)->DurabilityPointsLoss(item, damage); } void Spell::EffectDurabilityDamagePCT(uint32 i) @@ -6155,7 +6158,7 @@ void Spell::EffectDurabilityDamagePCT(uint32 i) // Possibly its mean -1 all player equipped items and -2 all items if(slot < 0) { - ((Player*)unitTarget)->DurabilityLossAll(double(damage)/100.0f,(slot < -1)); + ((Player*)unitTarget)->DurabilityLossAll(double(damage)/100.0f, (slot < -1)); return; } @@ -6166,8 +6169,8 @@ void Spell::EffectDurabilityDamagePCT(uint32 i) if(damage <= 0) return; - if(Item* item = ((Player*)unitTarget)->GetItemByPos(INVENTORY_SLOT_BAG_0,slot)) - ((Player*)unitTarget)->DurabilityLoss(item,double(damage)/100.0f); + if(Item* item = ((Player*)unitTarget)->GetItemByPos(INVENTORY_SLOT_BAG_0, slot)) + ((Player*)unitTarget)->DurabilityLoss(item, double(damage)/100.0f); } void Spell::EffectModifyThreatPercent(uint32 /*effIndex*/) @@ -6190,7 +6193,7 @@ void Spell::EffectTransmitted(uint32 effIndex) return; } - float fx,fy,fz; + float fx, fy, fz; if(m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION) { @@ -6202,7 +6205,7 @@ void Spell::EffectTransmitted(uint32 effIndex) else if(m_spellInfo->EffectRadiusIndex[effIndex] && m_spellInfo->speed==0) { float dis = GetSpellRadius(sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[effIndex])); - m_caster->GetClosePoint(fx,fy,fz,DEFAULT_WORLD_OBJECT_SIZE, dis); + m_caster->GetClosePoint(fx, fy, fz, DEFAULT_WORLD_OBJECT_SIZE, dis); } else { @@ -6210,14 +6213,14 @@ void Spell::EffectTransmitted(uint32 effIndex) float max_dis = GetSpellMaxRange(sSpellRangeStore.LookupEntry(m_spellInfo->rangeIndex)); float dis = rand_norm() * (max_dis - min_dis) + min_dis; - m_caster->GetClosePoint(fx,fy,fz,DEFAULT_WORLD_OBJECT_SIZE, dis); + m_caster->GetClosePoint(fx, fy, fz, DEFAULT_WORLD_OBJECT_SIZE, dis); } Map *cMap = m_caster->GetMap(); if(goinfo->type==GAMEOBJECT_TYPE_FISHINGNODE) { - if ( !cMap->IsInWater(fx,fy,fz-0.5f)) // Hack to prevent fishing bobber from failing to land on fishing hole + if ( !cMap->IsInWater(fx, fy, fz-0.5f)) // Hack to prevent fishing bobber from failing to land on fishing hole { // but this is not proper, we really need to ignore not materialized objects SendCastResult(SPELL_FAILED_NOT_HERE); SendChannelUpdate(0); @@ -6225,12 +6228,12 @@ void Spell::EffectTransmitted(uint32 effIndex) } // replace by water level in this case - fz = cMap->GetWaterLevel(fx,fy); + fz = cMap->GetWaterLevel(fx, fy); } // if gameobject is summoning object, it should be spawned right on caster's position else if(goinfo->type==GAMEOBJECT_TYPE_SUMMONING_RITUAL) { - m_caster->GetPosition(fx,fy,fz); + m_caster->GetPosition(fx, fy, fz); } GameObject* pGameObj = new GameObject; @@ -6267,7 +6270,7 @@ void Spell::EffectTransmitted(uint32 effIndex) } case GAMEOBJECT_TYPE_SUMMONING_RITUAL: { - if(m_caster->GetTypeId()==TYPEID_PLAYER) + if(m_caster->GetTypeId() == TYPEID_PLAYER) { pGameObj->AddUniqueUse((Player*)m_caster); m_caster->AddGameObject(pGameObj); // will removed at spell cancel diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index b2ba8a4b5..e14313364 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -305,7 +305,7 @@ void Unit::SendMonsterMoveByPath(Path const& path, uint32 start, uint32 end, uin { uint32 traveltime = uint32(path.GetTotalLength(start, end) * 32); - uint32 pathSize = end-start; + uint32 pathSize = end - start; WorldPacket data( SMSG_MONSTER_MOVE, (GetPackGUID().size()+1+4+4+4+4+1+4+4+4+pathSize*4*3) ); data.append(GetPackGUID()); @@ -551,7 +551,6 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa if (pVictim->GetTypeId() == TYPEID_PLAYER) ((Player*)pVictim)->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_TOTAL_DAMAGE_RECEIVED, health); - // find player: owner of controlled `this` or `this` itself maybe Player *player = GetCharmerOrOwnerPlayerOrPlayerItself(); @@ -1154,7 +1153,7 @@ void Unit::DealSpellDamage(SpellNonMeleeDamage *damageInfo, bool durabilityLoss) if(pVictim != this && GetTypeId() == TYPEID_PLAYER && pVictim->GetTypeId() == TYPEID_PLAYER) { const AreaTableEntry *area = GetAreaEntryByAreaID(pVictim->GetAreaId()); - if(area && area->flags & 0x800) //sanctuary + if(area && area->flags & AREA_FLAG_SANCTUARY) // sanctuary return; } @@ -1429,11 +1428,11 @@ void Unit::DealMeleeDamage(CalcDamageInfo *damageInfo, bool durabilityLoss) if(pVictim != this && GetTypeId() == TYPEID_PLAYER && pVictim->GetTypeId() == TYPEID_PLAYER) { const AreaTableEntry *area = GetAreaEntryByAreaID(pVictim->GetAreaId()); - if(area && area->flags & 0x800) //sanctuary + if(area && area->flags & AREA_FLAG_SANCTUARY) // sanctuary return; } - // Hmmmm dont like this emotes cloent must by self do all animations + // Hmmmm dont like this emotes client must by self do all animations if (damageInfo->HitInfo&HITINFO_CRITICALHIT) pVictim->HandleEmoteCommand(EMOTE_ONESHOT_WOUNDCRITICAL); if(damageInfo->blocked_amount && damageInfo->TargetState!=VICTIMSTATE_BLOCKS) @@ -1558,7 +1557,7 @@ void Unit::DealMeleeDamage(CalcDamageInfo *damageInfo, bool durabilityLoss) void Unit::HandleEmoteCommand(uint32 anim_id) { - WorldPacket data( SMSG_EMOTE, 12 ); + WorldPacket data( SMSG_EMOTE, 4 + 8 ); data << uint32(anim_id); data << uint64(GetGUID()); SendMessageToSet(&data, true); @@ -2326,7 +2325,7 @@ float Unit::CalculateLevelPenalty(SpellEntry const* spellProto) const void Unit::SendAttackStart(Unit* pVictim) { - WorldPacket data( SMSG_ATTACKSTART, 16 ); + WorldPacket data( SMSG_ATTACKSTART, 8 + 8 ); data << uint64(GetGUID()); data << uint64(pVictim->GetGUID()); @@ -4234,7 +4233,7 @@ void Unit::RemoveAllGameObjects() void Unit::SendSpellNonMeleeDamageLog(SpellNonMeleeDamage *log) { - WorldPacket data(SMSG_SPELLNONMELEEDAMAGELOG, (16+4+4+1+4+4+1+1+4+4+1)); // we guess size + WorldPacket data(SMSG_SPELLNONMELEEDAMAGELOG, (16+4+4+4+1+4+4+1+1+4+4+1)); // we guess size data.append(log->target->GetPackGUID()); data.append(log->attacker->GetPackGUID()); data << uint32(log->SpellID); @@ -4292,41 +4291,42 @@ void Unit::SendSpellMiss(Unit *target, uint32 spellID, SpellMissInfo missInfo) void Unit::SendAttackStateUpdate(CalcDamageInfo *damageInfo) { - uint32 count = 1; - WorldPacket data(SMSG_ATTACKERSTATEUPDATE, (16+45)); // we guess size - data << (uint32)damageInfo->HitInfo; - data.append(GetPackGUID()); - data.append(damageInfo->target->GetPackGUID()); - data << (uint32)(damageInfo->damage); // Full damage - data << uint32(0); // overkill value + sLog.outDebug("WORLD: Sending SMSG_ATTACKERSTATEUPDATE"); - data << (uint8)count; // Sub damage count + uint32 count = 1; + WorldPacket data(SMSG_ATTACKERSTATEUPDATE, 16 + 45); // we guess size + data << uint32(damageInfo->HitInfo); + data.append(damageInfo->attacker->GetPackGUID()); + data.append(damageInfo->target->GetPackGUID()); + data << uint32(damageInfo->damage); // Full damage + data << uint32(0); // overkill value + data << uint8(count); // Sub damage count for(int i = 0; i < count; ++i) { - data << (uint32)(damageInfo->damageSchoolMask); // School of sub damage - data << (float)damageInfo->damage; // sub damage - data << (uint32)damageInfo->damage; // Sub Damage + data << uint32(damageInfo->damageSchoolMask); // School of sub damage + data << float(damageInfo->damage); // sub damage + data << uint32(damageInfo->damage); // Sub Damage } if(damageInfo->HitInfo & (HITINFO_ABSORB | HITINFO_ABSORB2)) { for(int i = 0; i < count; ++i) - data << (uint32)damageInfo->absorb; // Absorb + data << uint32(damageInfo->absorb); // Absorb } if(damageInfo->HitInfo & (HITINFO_RESIST | HITINFO_RESIST2)) { for(int i = 0; i < count; ++i) - data << (uint32)damageInfo->resist; // Resist + data << uint32(damageInfo->resist); // Resist } - data << (uint8)damageInfo->TargetState; - data << (uint32)0; - data << (uint32)0; + data << uint8(damageInfo->TargetState); + data << uint32(0); + data << uint32(0); if(damageInfo->HitInfo & HITINFO_BLOCK) - data << (uint32)damageInfo->blocked_amount; + data << uint32(damageInfo->blocked_amount); if(damageInfo->HitInfo & HITINFO_UNK3) data << uint32(0); @@ -4355,71 +4355,17 @@ void Unit::SendAttackStateUpdate(CalcDamageInfo *damageInfo) void Unit::SendAttackStateUpdate(uint32 HitInfo, Unit *target, uint8 SwingType, SpellSchoolMask damageSchoolMask, uint32 Damage, uint32 AbsorbDamage, uint32 Resist, VictimState TargetState, uint32 BlockedAmount) { - sLog.outDebug("WORLD: Sending SMSG_ATTACKERSTATEUPDATE"); - - WorldPacket data(SMSG_ATTACKERSTATEUPDATE, (16+45)); // we guess size - data << uint32(HitInfo); // flags - data.append(GetPackGUID()); - data.append(target->GetPackGUID()); - data << uint32(Damage-AbsorbDamage-Resist-BlockedAmount);// damage - data << uint32(0); // overkill value - - data << (uint8)SwingType; // count? - - // for(i = 0; i < SwingType; ++i) - data << (uint32)damageSchoolMask; - data << (float)(Damage-AbsorbDamage-Resist-BlockedAmount); - data << (uint32)(Damage-AbsorbDamage-Resist-BlockedAmount); - // end loop - - if(HitInfo & (HITINFO_ABSORB | HITINFO_ABSORB2)) - { - // for(i = 0; i < SwingType; ++i) - data << uint32(AbsorbDamage); - // end loop - } - - if(HitInfo & (HITINFO_RESIST | HITINFO_RESIST2)) - { - // for(i = 0; i < SwingType; ++i) - data << uint32(Resist); - // end loop - } - - data << (uint8)TargetState; - data << (uint32)0; - data << (uint32)0; - - if(HitInfo & HITINFO_BLOCK) - { - data << uint32(BlockedAmount); - } - - if(HitInfo & HITINFO_UNK3) - { - data << uint32(0); - } - - if(HitInfo & HITINFO_UNK1) - { - data << uint32(0); - data << float(0); - data << float(0); - data << float(0); - data << float(0); - data << float(0); - data << float(0); - data << float(0); - data << float(0); - for(uint8 i = 0; i < 5; ++i) - { - data << float(0); - data << float(0); - } - data << uint32(0); - } - - SendMessageToSet( &data, true ); + CalcDamageInfo dmgInfo; + dmgInfo.HitInfo = HitInfo; + dmgInfo.attacker = this; + dmgInfo.target = target; + dmgInfo.damage = Damage - AbsorbDamage - Resist - BlockedAmount; + dmgInfo.damageSchoolMask = damageSchoolMask; + dmgInfo.absorb = AbsorbDamage; + dmgInfo.resist = Resist; + dmgInfo.TargetState = TargetState; + dmgInfo.blocked_amount = BlockedAmount; + SendAttackStateUpdate(&dmgInfo); } bool Unit::HandleHasteAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAura, SpellEntry const * /*procSpell*/, uint32 /*procFlag*/, uint32 /*procEx*/, uint32 cooldown) @@ -6595,7 +6541,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, Aura* triggeredB if( m_extraAttacks && IsSpellHaveEffect(triggerEntry, SPELL_EFFECT_ADD_EXTRA_ATTACKS) ) return false; - // Costum requirements (not listed in procEx) Warning! damage dealing after this + // Custom requirements (not listed in procEx) Warning! damage dealing after this // Custom triggered spells switch (auraSpellInfo->Id) { @@ -6629,7 +6575,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, Aura* triggeredB // Greater Heal Refund (Avatar Raiment set) case 37594: { - // Not give if target alredy have full health + // Not give if target already have full health if (pVictim->GetHealth() == pVictim->GetMaxHealth()) return false; // If your Greater Heal brings the target to full health, you gain $37595s1 mana. @@ -6664,7 +6610,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, Aura* triggeredB } } - // Costum basepoints/target for exist spell + // Custom basepoints/target for exist spell // dummy basepoints or other customs switch(trigger_spell_id) { @@ -6677,7 +6623,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, Aura* triggeredB target = pVictim; break; } - // Combo points add triggers (need add combopoint only for main tatget, and after possible combopoints reset) + // Combo points add triggers (need add combopoint only for main target, and after possible combopoints reset) case 15250: // Rogue Setup { if(!pVictim || pVictim != getVictim()) // applied only for main target @@ -9389,7 +9335,7 @@ void Unit::SetSpeed(UnitMoveType mtype, float rate, bool forced) void Unit::SetHover(bool on) { if(on) - CastSpell(this,11010,true); + CastSpell(this, 11010, true); else RemoveAurasDueToSpell(11010); } @@ -10834,7 +10780,7 @@ void Unit::SendPetCastFail(uint32 spellid, SpellCastResult msg) if(!owner || owner->GetTypeId() != TYPEID_PLAYER) return; - WorldPacket data(SMSG_PET_CAST_FAILED, (4+1)); + WorldPacket data(SMSG_PET_CAST_FAILED, 1 + 4 + 1); data << uint8(0); // cast count? data << uint32(spellid); data << uint8(msg); @@ -10860,7 +10806,7 @@ void Unit::SendPetTalk (uint32 pettalk) if(!owner || owner->GetTypeId() != TYPEID_PLAYER) return; - WorldPacket data(SMSG_PET_ACTION_SOUND, 8+4); + WorldPacket data(SMSG_PET_ACTION_SOUND, 8 + 4); data << uint64(GetGUID()); data << uint32(pettalk); ((Player*)owner)->GetSession()->SendPacket(&data); @@ -10887,7 +10833,7 @@ void Unit::SendPetClearCooldown (uint32 spellid) if(!owner || owner->GetTypeId() != TYPEID_PLAYER) return; - WorldPacket data(SMSG_CLEAR_COOLDOWN, (4+8)); + WorldPacket data(SMSG_CLEAR_COOLDOWN, 4+8); data << uint32(spellid); data << uint64(GetGUID()); ((Player*)owner)->GetSession()->SendPacket(&data); @@ -10899,8 +10845,9 @@ void Unit::SendPetAIReaction(uint64 guid) if(!owner || owner->GetTypeId() != TYPEID_PLAYER) return; - WorldPacket data(SMSG_AI_REACTION, 12); - data << uint64(guid) << uint32(00000002); + WorldPacket data(SMSG_AI_REACTION, 8 + 4); + data << uint64(guid); + data << uint32(AI_REACTION_AGGRO); ((Player*)owner)->GetSession()->SendPacket(&data); }