aboutsummaryrefslogtreecommitdiff
path: root/src/server/game
diff options
context:
space:
mode:
authorShocker <shocker@freakz.ro>2012-03-28 18:00:42 -0700
committerShocker <shocker@freakz.ro>2012-03-28 18:00:42 -0700
commita08cb234c022a6f05cdcc4d4233bea3ee6a63842 (patch)
tree08d0cc81eef8af70abb838afefb5e3904cf0adb5 /src/server/game
parent72d3e856dedaffcddffa6cd36cf56ec5a5809d58 (diff)
parent1544b208da2c2c8522e711db38a598f08105fe51 (diff)
Merge pull request #5918 from GyxTom/master
Core/Misc: Various cleanups
Diffstat (limited to 'src/server/game')
-rw-r--r--src/server/game/AI/SmartScripts/SmartAI.cpp4
-rw-r--r--src/server/game/AI/SmartScripts/SmartAI.h2
-rw-r--r--src/server/game/AI/SmartScripts/SmartScript.cpp18
-rw-r--r--src/server/game/AI/SmartScripts/SmartScriptMgr.cpp172
-rwxr-xr-xsrc/server/game/Battlegrounds/Battleground.cpp3
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundAB.cpp2
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundAV.cpp24
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundIC.cpp2
-rwxr-xr-xsrc/server/game/Chat/Commands/Level0.cpp26
-rwxr-xr-xsrc/server/game/Chat/Commands/Level3.cpp6
-rwxr-xr-xsrc/server/game/Entities/Creature/Creature.h6
-rwxr-xr-xsrc/server/game/Entities/Creature/CreatureGroups.cpp2
-rwxr-xr-xsrc/server/game/Entities/GameObject/GameObject.cpp8
-rwxr-xr-xsrc/server/game/Entities/GameObject/GameObject.h4
-rwxr-xr-xsrc/server/game/Entities/Item/ItemEnchantmentMgr.cpp6
-rwxr-xr-xsrc/server/game/Entities/Object/Object.cpp4
-rwxr-xr-xsrc/server/game/Entities/Object/Object.h4
-rwxr-xr-xsrc/server/game/Entities/Pet/Pet.cpp2
-rwxr-xr-xsrc/server/game/Entities/Player/Player.cpp11
-rwxr-xr-xsrc/server/game/Entities/Player/Player.h2
-rwxr-xr-xsrc/server/game/Entities/Unit/Unit.cpp23
-rwxr-xr-xsrc/server/game/Entities/Unit/Unit.h4
-rwxr-xr-xsrc/server/game/Events/GameEventMgr.cpp2
-rwxr-xr-xsrc/server/game/Globals/ObjectMgr.cpp12
-rwxr-xr-xsrc/server/game/Guilds/Guild.cpp2
-rwxr-xr-xsrc/server/game/Handlers/GroupHandler.cpp5
-rwxr-xr-xsrc/server/game/Handlers/ItemHandler.cpp2
-rwxr-xr-xsrc/server/game/Handlers/LFGHandler.cpp2
-rwxr-xr-xsrc/server/game/Handlers/NPCHandler.cpp4
-rwxr-xr-xsrc/server/game/Loot/LootMgr.cpp20
-rwxr-xr-xsrc/server/game/Maps/Map.h8
-rwxr-xr-xsrc/server/game/Spells/Auras/SpellAuras.cpp72
-rwxr-xr-xsrc/server/game/Spells/Spell.cpp56
-rwxr-xr-xsrc/server/game/Spells/SpellEffects.cpp2
-rwxr-xr-xsrc/server/game/Spells/SpellMgr.cpp100
-rwxr-xr-xsrc/server/game/Spells/SpellMgr.h1
-rwxr-xr-xsrc/server/game/World/World.cpp7
37 files changed, 367 insertions, 263 deletions
diff --git a/src/server/game/AI/SmartScripts/SmartAI.cpp b/src/server/game/AI/SmartScripts/SmartAI.cpp
index d1ea30609dd..4eb7f8a7f50 100644
--- a/src/server/game/AI/SmartScripts/SmartAI.cpp
+++ b/src/server/game/AI/SmartScripts/SmartAI.cpp
@@ -73,7 +73,9 @@ SmartAI::SmartAI(Creature* c) : CreatureAI(c)
void SmartAI::UpdateDespawn(const uint32 diff)
{
- if (mDespawnState <= 1 || mDespawnState > 3) return;
+ if (mDespawnState <= 1 || mDespawnState > 3)
+ return;
+
if (mDespawnTime < diff)
{
if (mDespawnState == 2)
diff --git a/src/server/game/AI/SmartScripts/SmartAI.h b/src/server/game/AI/SmartScripts/SmartAI.h
index e71b82bdab2..94e5e65cf8b 100644
--- a/src/server/game/AI/SmartScripts/SmartAI.h
+++ b/src/server/game/AI/SmartScripts/SmartAI.h
@@ -245,7 +245,7 @@ public:
SmartScript* GetScript() { return &mScript; }
static int Permissible(const GameObject* g);
- bool GossipHello(Player* player) ;
+ bool GossipHello(Player* player);
bool GossipSelect(Player* player, uint32 sender, uint32 action);
bool GossipSelectCode(Player* /*player*/, uint32 /*sender*/, uint32 /*action*/, const char* /*code*/);
bool QuestAccept(Player* player, Quest const* quest);
diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp
index 8eee214e420..b2c4fd29868 100644
--- a/src/server/game/AI/SmartScripts/SmartScript.cpp
+++ b/src/server/game/AI/SmartScripts/SmartScript.cpp
@@ -1954,7 +1954,8 @@ void SmartScript::InstallTemplate(SmartScriptHolder const& e)
}
case SMARTAI_TEMPLATE_CAGED_NPC_PART:
{
- if (!me) return;
+ if (!me)
+ return;
//store cage as id1
AddEvent(SMART_EVENT_DATA_SET, 0, 0, 0, 0, 0, SMART_ACTION_STORE_TARGET_LIST, 1, 0, 0, 0, 0, 0, SMART_TARGET_CLOSEST_GAMEOBJECT, e.action.installTtemplate.param1, 10, 0, 0);
@@ -1976,7 +1977,8 @@ void SmartScript::InstallTemplate(SmartScriptHolder const& e)
}
case SMARTAI_TEMPLATE_CAGED_GO_PART:
{
- if (!go) return;
+ if (!go)
+ return;
//store hostage as id1
AddEvent(SMART_EVENT_GOSSIP_HELLO, 0, 0, 0, 0, 0, SMART_ACTION_STORE_TARGET_LIST, 1, 0, 0, 0, 0, 0, SMART_TARGET_CLOSEST_CREATURE, e.action.installTtemplate.param1, 10, 0, 0);
//store invoker as id2
@@ -2839,8 +2841,12 @@ void SmartScript::InstallEvents()
bool SmartScript::ConditionValid(Unit* u, int32 c, int32 v1, int32 v2, int32 v3)
{
- if (c == 0) return true;
- if (!u || !u->ToPlayer()) return false;
+ if (c == 0)
+ return true;
+
+ if (!u || !u->ToPlayer())
+ return false;
+
Condition cond;
cond.ConditionType = ConditionTypes(uint32(c));
cond.ConditionValue1 = uint32(v1);
@@ -3007,7 +3013,9 @@ void SmartScript::OnMoveInLineOfSight(Unit* who)
{
ProcessEventsFor(SMART_EVENT_OOC_LOS, who);
- if (!me) return;
+ if (!me)
+ return;
+
if (me->getVictim())
return;
diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
index e3264adc310..b0f1fcb8ede 100644
--- a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
+++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
@@ -337,8 +337,11 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
if (e.GetScriptType() == SMART_SCRIPT_TYPE_TIMED_ACTIONLIST)
{
e.event.type = SMART_EVENT_UPDATE_OOC;//force default OOC, can change when calling the script!
- if (!IsMinMaxValid(e, e.event.minMaxRepeat.min, e.event.minMaxRepeat.max)) return false;
- if (!IsMinMaxValid(e, e.event.minMaxRepeat.repeatMin, e.event.minMaxRepeat.repeatMax)) return false;
+ if (!IsMinMaxValid(e, e.event.minMaxRepeat.min, e.event.minMaxRepeat.max))
+ return false;
+
+ if (!IsMinMaxValid(e, e.event.minMaxRepeat.repeatMin, e.event.minMaxRepeat.repeatMax))
+ return false;
}
else
{
@@ -356,8 +359,11 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
case SMART_EVENT_DAMAGED:
case SMART_EVENT_DAMAGED_TARGET:
case SMART_EVENT_RECEIVE_HEAL:
- if (!IsMinMaxValid(e, e.event.minMaxRepeat.min, e.event.minMaxRepeat.max)) return false;
- if (!IsMinMaxValid(e, e.event.minMaxRepeat.repeatMin, e.event.minMaxRepeat.repeatMax)) return false;
+ if (!IsMinMaxValid(e, e.event.minMaxRepeat.min, e.event.minMaxRepeat.max))
+ return false;
+
+ if (!IsMinMaxValid(e, e.event.minMaxRepeat.repeatMin, e.event.minMaxRepeat.repeatMax))
+ return false;
break;
case SMART_EVENT_SPELLHIT:
case SMART_EVENT_SPELLHIT_TARGET:
@@ -375,11 +381,13 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
return false;
}
}
- if (!IsMinMaxValid(e, e.event.spellHit.cooldownMin, e.event.spellHit.cooldownMax)) return false;
+ if (!IsMinMaxValid(e, e.event.spellHit.cooldownMin, e.event.spellHit.cooldownMax))
+ return false;
break;
case SMART_EVENT_OOC_LOS:
case SMART_EVENT_IC_LOS:
- if (!IsMinMaxValid(e, e.event.los.cooldownMin, e.event.los.cooldownMax)) return false;
+ if (!IsMinMaxValid(e, e.event.los.cooldownMin, e.event.los.cooldownMax))
+ return false;
break;
case SMART_EVENT_RESPAWN:
if (e.event.respawn.type == SMART_SCRIPT_RESPAWN_CONDITION_MAP && !sMapStore.LookupEntry(e.event.respawn.map))
@@ -394,32 +402,48 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
}
break;
case SMART_EVENT_FRIENDLY_HEALTH:
- if (!NotNULL(e, e.event.friendlyHealt.radius)) return false;
- if (!IsMinMaxValid(e, e.event.friendlyHealt.repeatMin, e.event.friendlyHealt.repeatMax)) return false;
+ if (!NotNULL(e, e.event.friendlyHealt.radius))
+ return false;
+
+ if (!IsMinMaxValid(e, e.event.friendlyHealt.repeatMin, e.event.friendlyHealt.repeatMax))
+ return false;
break;
case SMART_EVENT_FRIENDLY_IS_CC:
- if (!IsMinMaxValid(e, e.event.friendlyCC.repeatMin, e.event.friendlyCC.repeatMax)) return false;
+ if (!IsMinMaxValid(e, e.event.friendlyCC.repeatMin, e.event.friendlyCC.repeatMax))
+ return false;
break;
case SMART_EVENT_FRIENDLY_MISSING_BUFF:
{
- if (!IsSpellValid(e, e.event.missingBuff.spell)) return false;
- if (!NotNULL(e, e.event.missingBuff.radius)) return false;
- if (!IsMinMaxValid(e, e.event.missingBuff.repeatMin, e.event.missingBuff.repeatMax)) return false;
+ if (!IsSpellValid(e, e.event.missingBuff.spell))
+ return false;
+
+ if (!NotNULL(e, e.event.missingBuff.radius))
+ return false;
+
+ if (!IsMinMaxValid(e, e.event.missingBuff.repeatMin, e.event.missingBuff.repeatMax))
+ return false;
break;
}
case SMART_EVENT_KILL:
- if (!IsMinMaxValid(e, e.event.kill.cooldownMin, e.event.kill.cooldownMax)) return false;
- if (e.event.kill.creature && !IsCreatureValid(e, e.event.kill.creature)) return false;
+ if (!IsMinMaxValid(e, e.event.kill.cooldownMin, e.event.kill.cooldownMax))
+ return false;
+
+ if (e.event.kill.creature && !IsCreatureValid(e, e.event.kill.creature))
+ return false;
break;
case SMART_EVENT_TARGET_CASTING:
case SMART_EVENT_PASSENGER_BOARDED:
case SMART_EVENT_PASSENGER_REMOVED:
- if (!IsMinMaxValid(e, e.event.minMax.repeatMin, e.event.minMax.repeatMax)) return false;
+ if (!IsMinMaxValid(e, e.event.minMax.repeatMin, e.event.minMax.repeatMax))
+ return false;
break;
case SMART_EVENT_SUMMON_DESPAWNED:
case SMART_EVENT_SUMMONED_UNIT:
- if (e.event.summoned.creature && !IsCreatureValid(e, e.event.summoned.creature)) return false;
- if (!IsMinMaxValid(e, e.event.summoned.cooldownMin, e.event.summoned.cooldownMax)) return false;
+ if (e.event.summoned.creature && !IsCreatureValid(e, e.event.summoned.creature))
+ return false;
+
+ if (!IsMinMaxValid(e, e.event.summoned.cooldownMin, e.event.summoned.cooldownMax))
+ return false;
break;
case SMART_EVENT_ACCEPTED_QUEST:
case SMART_EVENT_REWARD_QUEST:
@@ -428,20 +452,27 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
break;
case SMART_EVENT_RECEIVE_EMOTE:
{
- if (e.event.emote.emote && !IsTextEmoteValid(e, e.event.emote.emote)) return false;
- if (!IsMinMaxValid(e, e.event.emote.cooldownMin, e.event.emote.cooldownMax)) return false;
+ if (e.event.emote.emote && !IsTextEmoteValid(e, e.event.emote.emote))
+ return false;
+
+ if (!IsMinMaxValid(e, e.event.emote.cooldownMin, e.event.emote.cooldownMax))
+ return false;
break;
}
case SMART_EVENT_HAS_AURA:
case SMART_EVENT_TARGET_BUFFED:
{
- if (!IsSpellValid(e, e.event.aura.spell)) return false;
- if (!IsMinMaxValid(e, e.event.aura.repeatMin, e.event.aura.repeatMax)) return false;
+ if (!IsSpellValid(e, e.event.aura.spell))
+ return false;
+
+ if (!IsMinMaxValid(e, e.event.aura.repeatMin, e.event.aura.repeatMax))
+ return false;
break;
}
case SMART_EVENT_TRANSPORT_ADDCREATURE:
{
- if (e.event.transportAddCreature.creature && !IsCreatureValid(e, e.event.transportAddCreature.creature)) return false;
+ if (e.event.transportAddCreature.creature && !IsCreatureValid(e, e.event.transportAddCreature.creature))
+ return false;
break;
}
case SMART_EVENT_MOVEMENTINFORM:
@@ -455,12 +486,14 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
}
case SMART_EVENT_DATA_SET:
{
- if (!IsMinMaxValid(e, e.event.dataSet.cooldownMin, e.event.dataSet.cooldownMax)) return false;
+ if (!IsMinMaxValid(e, e.event.dataSet.cooldownMin, e.event.dataSet.cooldownMax))
+ return false;
break;
}
case SMART_EVENT_AREATRIGGER_ONTRIGGER:
{
- if (e.event.areatrigger.id && !IsAreaTriggerValid(e, e.event.areatrigger.id)) return false;
+ if (e.event.areatrigger.id && !IsAreaTriggerValid(e, e.event.areatrigger.id))
+ return false;
break;
}
case SMART_EVENT_TEXT_OVER:
@@ -476,8 +509,11 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
break;
}
case SMART_EVENT_DUMMY_EFFECT:
- if (!IsSpellValid(e, e.event.dummy.spell)) return false;
- if (e.event.dummy.effIndex > EFFECT_2) return false;
+ if (!IsSpellValid(e, e.event.dummy.spell))
+ return false;
+
+ if (e.event.dummy.effIndex > EFFECT_2)
+ return false;
break;
case SMART_EVENT_IS_BEHIND_TARGET:
if (!IsMinMaxValid(e, e.event.behindTarget.cooldownMin, e.event.behindTarget.cooldownMax))
@@ -574,11 +610,13 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
break;
case SMART_ACTION_SET_EMOTE_STATE:
case SMART_ACTION_PLAY_EMOTE:
- if (!IsEmoteValid(e, e.action.emote.emote)) return false;
+ if (!IsEmoteValid(e, e.action.emote.emote))
+ return false;
break;
case SMART_ACTION_FAIL_QUEST:
case SMART_ACTION_ADD_QUEST:
- if (!e.action.quest.quest || !IsQuestValid(e, e.action.quest.quest)) return false;
+ if (!e.action.quest.quest || !IsQuestValid(e, e.action.quest.quest))
+ return false;
break;
case SMART_ACTION_ACTIVATE_TAXI:
{
@@ -590,17 +628,29 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
break;
}
case SMART_ACTION_RANDOM_EMOTE:
- if (e.action.randomEmote.emote1 && !IsEmoteValid(e, e.action.randomEmote.emote1)) return false;
- if (e.action.randomEmote.emote2 && !IsEmoteValid(e, e.action.randomEmote.emote2)) return false;
- if (e.action.randomEmote.emote3 && !IsEmoteValid(e, e.action.randomEmote.emote3)) return false;
- if (e.action.randomEmote.emote4 && !IsEmoteValid(e, e.action.randomEmote.emote4)) return false;
- if (e.action.randomEmote.emote5 && !IsEmoteValid(e, e.action.randomEmote.emote5)) return false;
- if (e.action.randomEmote.emote6 && !IsEmoteValid(e, e.action.randomEmote.emote6)) return false;
+ if (e.action.randomEmote.emote1 && !IsEmoteValid(e, e.action.randomEmote.emote1))
+ return false;
+
+ if (e.action.randomEmote.emote2 && !IsEmoteValid(e, e.action.randomEmote.emote2))
+ return false;
+
+ if (e.action.randomEmote.emote3 && !IsEmoteValid(e, e.action.randomEmote.emote3))
+ return false;
+
+ if (e.action.randomEmote.emote4 && !IsEmoteValid(e, e.action.randomEmote.emote4))
+ return false;
+
+ if (e.action.randomEmote.emote5 && !IsEmoteValid(e, e.action.randomEmote.emote5))
+ return false;
+
+ if (e.action.randomEmote.emote6 && !IsEmoteValid(e, e.action.randomEmote.emote6))
+ return false;
break;
case SMART_ACTION_ADD_AURA:
case SMART_ACTION_CAST:
case SMART_ACTION_INVOKER_CAST:
- if (!IsSpellValid(e, e.action.cast.spell)) return false;
+ if (!IsSpellValid(e, e.action.cast.spell))
+ return false;
break;
case SMART_ACTION_CALL_AREAEXPLOREDOREVENTHAPPENS:
case SMART_ACTION_CALL_GROUPEVENTHAPPENS:
@@ -619,8 +669,11 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
}
break;
case SMART_ACTION_SEND_CASTCREATUREORGO:
- if (!IsQuestValid(e, e.action.castCreatureOrGO.quest)) return false;
- if (!IsSpellValid(e, e.action.castCreatureOrGO.spell)) return false;
+ if (!IsQuestValid(e, e.action.castCreatureOrGO.quest))
+ return false;
+
+ if (!IsSpellValid(e, e.action.castCreatureOrGO.spell))
+ return false;
break;
@@ -644,11 +697,15 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
}
break;
case SMART_ACTION_CALL_CASTEDCREATUREORGO:
- if (!IsCreatureValid(e, e.action.castedCreatureOrGO.creature)) return false;
- if (!IsSpellValid(e, e.action.castedCreatureOrGO.spell)) return false;
+ if (!IsCreatureValid(e, e.action.castedCreatureOrGO.creature))
+ return false;
+
+ if (!IsSpellValid(e, e.action.castedCreatureOrGO.spell))
+ return false;
break;
case SMART_ACTION_REMOVEAURASFROMSPELL:
- if (!IsSpellValid(e, e.action.removeAura.spell)) return false;
+ if (!IsSpellValid(e, e.action.removeAura.spell))
+ return false;
break;
case SMART_ACTION_RANDOM_PHASE:
{
@@ -672,11 +729,13 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u attempts to set invalid phase, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
return false;
}
- if (!IsMinMaxValid(e, e.action.randomPhaseRange.phaseMin, e.action.randomPhaseRange.phaseMax)) return false;
+ if (!IsMinMaxValid(e, e.action.randomPhaseRange.phaseMin, e.action.randomPhaseRange.phaseMax))
+ return false;
break;
}
case SMART_ACTION_SUMMON_CREATURE:
- if (!IsCreatureValid(e, e.action.summonCreature.creature)) return false;
+ if (!IsCreatureValid(e, e.action.summonCreature.creature))
+ return false;
if (e.action.summonCreature.type < TEMPSUMMON_TIMED_OR_DEAD_DESPAWN || e.action.summonCreature.type > TEMPSUMMON_MANUAL_DESPAWN)
{
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses incorrect TempSummonType %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.summonCreature.type);
@@ -684,10 +743,12 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
}
break;
case SMART_ACTION_CALL_KILLEDMONSTER:
- if (!IsCreatureValid(e, e.action.killedMonster.creature)) return false;
+ if (!IsCreatureValid(e, e.action.killedMonster.creature))
+ return false;
break;
case SMART_ACTION_UPDATE_TEMPLATE:
- if (e.action.updateTemplate.creature && !IsCreatureValid(e, e.action.updateTemplate.creature)) return false;
+ if (e.action.updateTemplate.creature && !IsCreatureValid(e, e.action.updateTemplate.creature))
+ return false;
break;
case SMART_ACTION_SET_SHEATH:
if (e.action.setSheath.sheath && e.action.setSheath.sheath >= MAX_SHEATH_STATE)
@@ -706,12 +767,16 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
break;
}
case SMART_ACTION_SUMMON_GO:
- if (!IsGameObjectValid(e, e.action.summonGO.entry)) return false;
+ if (!IsGameObjectValid(e, e.action.summonGO.entry))
+ return false;
break;
case SMART_ACTION_ADD_ITEM:
case SMART_ACTION_REMOVE_ITEM:
- if (!IsItemValid(e, e.action.item.entry)) return false;
- if (!NotNULL(e, e.action.item.count)) return false;
+ if (!IsItemValid(e, e.action.item.entry))
+ return false;
+
+ if (!NotNULL(e, e.action.item.count))
+ return false;
break;
case SMART_ACTION_TELEPORT:
if (!sMapStore.LookupEntry(e.action.teleport.mapID))
@@ -728,7 +793,8 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
}
break;
case SMART_ACTION_WP_STOP:
- if (e.action.wpStop.quest && !IsQuestValid(e, e.action.wpStop.quest)) return false;
+ if (e.action.wpStop.quest && !IsQuestValid(e, e.action.wpStop.quest))
+ return false;
break;
case SMART_ACTION_WP_START:
{
@@ -737,7 +803,8 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
sLog->outErrorDb("SmartAIMgr: Creature %d Event %u Action %u uses non-existent WaypointPath id %u, skipped.", e.entryOrGuid, e.event_id, e.GetActionType(), e.action.wpStart.pathID);
return false;
}
- if (e.action.wpStart.quest && !IsQuestValid(e, e.action.wpStart.quest)) return false;
+ if (e.action.wpStart.quest && !IsQuestValid(e, e.action.wpStart.quest))
+ return false;
if (e.action.wpStart.reactState > REACT_AGGRESSIVE)
{
sLog->outErrorDb("SmartAIMgr: Creature %d Event %u Action %u uses invalid React State %u, skipped.", e.entryOrGuid, e.event_id, e.GetActionType(), e.action.wpStart.reactState);
@@ -747,8 +814,11 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
}
case SMART_ACTION_CREATE_TIMED_EVENT:
{
- if (!IsMinMaxValid(e, e.action.timeEvent.min, e.action.timeEvent.max)) return false;
- if (!IsMinMaxValid(e, e.action.timeEvent.repeatMin, e.action.timeEvent.repeatMax)) return false;
+ if (!IsMinMaxValid(e, e.action.timeEvent.min, e.action.timeEvent.max))
+ return false;
+
+ if (!IsMinMaxValid(e, e.action.timeEvent.repeatMin, e.action.timeEvent.repeatMax))
+ return false;
break;
}
case SMART_ACTION_FOLLOW:
diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp
index 36da0e9a97e..1a5f3412459 100755
--- a/src/server/game/Battlegrounds/Battleground.cpp
+++ b/src/server/game/Battlegrounds/Battleground.cpp
@@ -21,7 +21,6 @@
#include "ArenaTeamMgr.h"
#include "World.h"
#include "WorldPacket.h"
-
#include "ArenaTeam.h"
#include "Battleground.h"
#include "BattlegroundMgr.h"
@@ -259,9 +258,7 @@ void Battleground::Update(uint32 diff)
{
case STATUS_WAIT_JOIN:
if (GetPlayersSize())
- {
_ProcessJoin(diff);
- }
break;
case STATUS_IN_PROGRESS:
_ProcessOfflineQueue();
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp
index 71f0ce29aec..52d2cdefd65 100755
--- a/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp
@@ -549,7 +549,7 @@ void BattlegroundAB::EventPlayerClickedOnFlag(Player* source, GameObject* /*targ
bool BattlegroundAB::SetupBattleground()
{
- for (int i = 0 ; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
+ for (int i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
{
if (!AddObject(BG_AB_OBJECT_BANNER_NEUTRAL + 8*i, BG_AB_OBJECTID_NODE_BANNER_0 + i, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY)
|| !AddObject(BG_AB_OBJECT_BANNER_CONT_A + 8*i, BG_AB_OBJECTID_BANNER_CONT_A, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY)
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp
index 5ea9fc67fed..d2cbab2be54 100755
--- a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp
@@ -1208,7 +1208,7 @@ bool BattlegroundAV::SetupBattleground()
}
//spawn node-objects
- for (uint8 i = BG_AV_NODES_FIRSTAID_STATION ; i < BG_AV_NODES_MAX; ++i)
+ for (uint8 i = BG_AV_NODES_FIRSTAID_STATION; i < BG_AV_NODES_MAX; ++i)
{
if (i <= BG_AV_NODES_FROSTWOLF_HUT)
{
@@ -1293,7 +1293,7 @@ bool BattlegroundAV::SetupBattleground()
return false;
}
}
- for (uint16 i= 0 ; i <= (BG_AV_OBJECT_MINE_SUPPLY_S_MAX-BG_AV_OBJECT_MINE_SUPPLY_S_MIN); i++)
+ for (uint16 i= 0; i <= (BG_AV_OBJECT_MINE_SUPPLY_S_MAX-BG_AV_OBJECT_MINE_SUPPLY_S_MIN); i++)
{
if (!AddObject(BG_AV_OBJECT_MINE_SUPPLY_S_MIN+i, BG_AV_OBJECTID_MINE_S, BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][0], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][1], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][2], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN+i][3]/2), RESPAWN_ONE_DAY))
{
@@ -1324,30 +1324,39 @@ bool BattlegroundAV::SetupBattleground()
// Initial Nodes
for (i = 0; i < BG_AV_OBJECT_MAX; i++)
SpawnBGObject(i, RESPAWN_ONE_DAY);
- for (i = BG_AV_OBJECT_FLAG_A_FIRSTAID_STATION; i <= BG_AV_OBJECT_FLAG_A_STONEHEART_GRAVE ; i++){
+
+ for (i = BG_AV_OBJECT_FLAG_A_FIRSTAID_STATION; i <= BG_AV_OBJECT_FLAG_A_STONEHEART_GRAVE; i++)
+ {
SpawnBGObject(BG_AV_OBJECT_AURA_A_FIRSTAID_STATION+3*i, RESPAWN_IMMEDIATELY);
SpawnBGObject(i, RESPAWN_IMMEDIATELY);
}
- for (i = BG_AV_OBJECT_FLAG_A_DUNBALDAR_SOUTH; i <= BG_AV_OBJECT_FLAG_A_STONEHEART_BUNKER ; i++)
+
+ for (i = BG_AV_OBJECT_FLAG_A_DUNBALDAR_SOUTH; i <= BG_AV_OBJECT_FLAG_A_STONEHEART_BUNKER; i++)
SpawnBGObject(i, RESPAWN_IMMEDIATELY);
- for (i = BG_AV_OBJECT_FLAG_H_ICEBLOOD_GRAVE; i <= BG_AV_OBJECT_FLAG_H_FROSTWOLF_WTOWER ; i++){
+
+ for (i = BG_AV_OBJECT_FLAG_H_ICEBLOOD_GRAVE; i <= BG_AV_OBJECT_FLAG_H_FROSTWOLF_WTOWER; i++)
+ {
SpawnBGObject(i, RESPAWN_IMMEDIATELY);
if (i <= BG_AV_OBJECT_FLAG_H_FROSTWOLF_HUT)
SpawnBGObject(BG_AV_OBJECT_AURA_H_FIRSTAID_STATION+3*GetNodeThroughObject(i), RESPAWN_IMMEDIATELY);
}
+
for (i = BG_AV_OBJECT_TFLAG_A_DUNBALDAR_SOUTH; i <= BG_AV_OBJECT_TFLAG_A_STONEHEART_BUNKER; i+=2)
{
SpawnBGObject(i, RESPAWN_IMMEDIATELY); //flag
SpawnBGObject(i+16, RESPAWN_IMMEDIATELY); //aura
}
+
for (i = BG_AV_OBJECT_TFLAG_H_ICEBLOOD_TOWER; i <= BG_AV_OBJECT_TFLAG_H_FROSTWOLF_WTOWER; i+=2)
{
SpawnBGObject(i, RESPAWN_IMMEDIATELY); //flag
SpawnBGObject(i+16, RESPAWN_IMMEDIATELY); //aura
}
+
//snowfall and the doors
for (i = BG_AV_OBJECT_FLAG_N_SNOWFALL_GRAVE; i <= BG_AV_OBJECT_DOOR_A; i++)
SpawnBGObject(i, RESPAWN_IMMEDIATELY);
+
SpawnBGObject(BG_AV_OBJECT_AURA_N_SNOWFALL_GRAVE, RESPAWN_IMMEDIATELY);
//creatures
@@ -1472,7 +1481,7 @@ void BattlegroundAV::ResetBGSubclass()
{
for (uint8 j=0; j<9; j++)
m_Team_QuestStatus[i][j]=0;
- m_Team_Scores[i]=BG_AV_SCORE_INITIAL_POINTS;
+ m_Team_Scores[i]=BG_AV_SCORE_INITIAL_POINTS;
m_IsInformedNearVictory[i]=false;
m_CaptainAlive[i] = true;
m_CaptainBuffTimer[i] = 120000 + urand(0, 4)* 60; //as far as i could see, the buff is randomly so i make 2minutes (thats the duration of the buff itself) + 0-4minutes TODO get the right times
@@ -1493,7 +1502,6 @@ void BattlegroundAV::ResetBGSubclass()
for (uint16 i = 0; i < AV_CPLACE_MAX+AV_STATICCPLACE_MAX; i++)
if (BgCreatures[i])
DelCreature(i);
-
}
bool BattlegroundAV::IsBothMinesControlledByTeam(uint32 team) const
@@ -1553,4 +1561,4 @@ bool BattlegroundAV::IsAllTowersControlledAndCaptainAlive(uint32 team) const
}
return false;
-} \ No newline at end of file
+}
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp
index e5ec15bf60d..fada4230507 100755
--- a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp
@@ -359,7 +359,7 @@ void BattlegroundIC::FillInitialWorldStates(WorldPacket& data)
data << uint32(uws) << uint32(1);
}
- for (uint8 i = 0 ; i < MAX_NODE_TYPES ; i++)
+ for (uint8 i = 0; i < MAX_NODE_TYPES; i++)
data << uint32(nodePoint[i].worldStates[nodePoint[i].nodeState]) << uint32(1);
}
diff --git a/src/server/game/Chat/Commands/Level0.cpp b/src/server/game/Chat/Commands/Level0.cpp
index bb744016257..b2ac090c313 100755
--- a/src/server/game/Chat/Commands/Level0.cpp
+++ b/src/server/game/Chat/Commands/Level0.cpp
@@ -17,10 +17,8 @@
*/
#include "Common.h"
-#include "DatabaseEnv.h"
#include "World.h"
#include "Player.h"
-#include "Opcodes.h"
#include "Chat.h"
#include "ObjectAccessor.h"
#include "Language.h"
@@ -54,31 +52,31 @@ bool ChatHandler::HandleCommandsCommand(const char* /*args*/)
bool ChatHandler::HandleStartCommand(const char* /*args*/)
{
- Player* chr = m_session->GetPlayer();
+ Player* player = m_session->GetPlayer();
- if (chr->isInFlight())
+ if (player->isInFlight())
{
SendSysMessage(LANG_YOU_IN_FLIGHT);
SetSentErrorMessage(true);
return false;
}
- if (chr->isInCombat())
+ if (player->isInCombat())
{
SendSysMessage(LANG_YOU_IN_COMBAT);
SetSentErrorMessage(true);
return false;
}
- if (chr->isDead() || chr->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST))
+ if (player->isDead() || player->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST))
{
// if player is dead and stuck, send ghost to graveyard
- chr->RepopAtGraveyard();
+ player->RepopAtGraveyard();
return true;
}
// cast spell Stuck
- chr->CastSpell(chr, 7355, false);
+ player->CastSpell(player, 7355, false);
return true;
}
@@ -107,23 +105,25 @@ bool ChatHandler::HandleServerInfoCommand(const char* /*args*/)
bool ChatHandler::HandleDismountCommand(const char* /*args*/)
{
+ Player* player = m_session->GetPlayer();
+
//If player is not mounted, so go out :)
- if (!m_session->GetPlayer()->IsMounted())
+ if (!player->IsMounted())
{
SendSysMessage(LANG_CHAR_NON_MOUNTED);
SetSentErrorMessage(true);
return false;
}
- if (m_session->GetPlayer()->isInFlight())
+ if (player->isInFlight())
{
SendSysMessage(LANG_YOU_IN_FLIGHT);
SetSentErrorMessage(true);
return false;
}
- m_session->GetPlayer()->Dismount();
- m_session->GetPlayer()->RemoveAurasByType(SPELL_AURA_MOUNTED);
+ player->Dismount();
+ player->RemoveAurasByType(SPELL_AURA_MOUNTED);
return true;
}
@@ -144,7 +144,7 @@ bool ChatHandler::HandleSaveCommand(const char* /*args*/)
// save if the player has last been saved over 20 seconds ago
uint32 save_interval = sWorld->getIntConfig(CONFIG_INTERVAL_SAVE);
- if (save_interval == 0 || (save_interval > 20*IN_MILLISECONDS && player->GetSaveTimer() <= save_interval - 20*IN_MILLISECONDS))
+ if (save_interval == 0 || (save_interval > 20 * IN_MILLISECONDS && player->GetSaveTimer() <= save_interval - 20 * IN_MILLISECONDS))
player->SaveToDB();
return true;
diff --git a/src/server/game/Chat/Commands/Level3.cpp b/src/server/game/Chat/Commands/Level3.cpp
index d5dd233b43e..eca5a862ecd 100755
--- a/src/server/game/Chat/Commands/Level3.cpp
+++ b/src/server/game/Chat/Commands/Level3.cpp
@@ -4764,9 +4764,11 @@ bool ChatHandler::HandleBindSightCommand(const char * /*args*/)
bool ChatHandler::HandleUnbindSightCommand(const char * /*args*/)
{
- if (m_session->GetPlayer()->isPossessing())
+ Player* player = m_session->GetPlayer();
+
+ if (player->isPossessing())
return false;
- m_session->GetPlayer()->StopCastingBindSight();
+ player->StopCastingBindSight();
return true;
}
diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h
index a8664047b89..f100d391698 100755
--- a/src/server/game/Entities/Creature/Creature.h
+++ b/src/server/game/Entities/Creature/Creature.h
@@ -338,7 +338,9 @@ struct VendorItemData
VendorItem* GetItem(uint32 slot) const
{
- if (slot >= m_items.size()) return NULL;
+ if (slot >= m_items.size())
+ return NULL;
+
return m_items[slot];
}
bool Empty() const { return m_items.empty(); }
@@ -373,7 +375,7 @@ struct TrainerSpell
{
TrainerSpell() : spell(0), spellCost(0), reqSkill(0), reqSkillValue(0), reqLevel(0)
{
- for (uint8 i = 0; i < MAX_SPELL_EFFECTS ; ++i)
+ for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
learnedSpell[i] = 0;
}
diff --git a/src/server/game/Entities/Creature/CreatureGroups.cpp b/src/server/game/Entities/Creature/CreatureGroups.cpp
index 2104f474072..54953ef5420 100755
--- a/src/server/game/Entities/Creature/CreatureGroups.cpp
+++ b/src/server/game/Entities/Creature/CreatureGroups.cpp
@@ -134,7 +134,7 @@ void FormationMgr::LoadCreatureFormations()
CreatureGroupMap[memberGUID] = group_member;
++count;
}
- while (result->NextRow()) ;
+ while (result->NextRow());
sLog->outString(">> Loaded %u creatures in formations in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog->outString();
diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp
index 910e9c86b42..1fe83023976 100755
--- a/src/server/game/Entities/GameObject/GameObject.cpp
+++ b/src/server/game/Entities/GameObject/GameObject.cpp
@@ -840,7 +840,9 @@ bool GameObject::IsTransport() const
{
// If something is marked as a transport, don't transmit an out of range packet for it.
GameObjectTemplate const* gInfo = GetGOInfo();
- if (!gInfo) return false;
+ if (!gInfo)
+ return false;
+
return gInfo->type == GAMEOBJECT_TYPE_TRANSPORT || gInfo->type == GAMEOBJECT_TYPE_MO_TRANSPORT;
}
@@ -849,7 +851,9 @@ bool GameObject::IsDynTransport() const
{
// If something is marked as a transport, don't transmit an out of range packet for it.
GameObjectTemplate const* gInfo = GetGOInfo();
- if (!gInfo) return false;
+ if (!gInfo)
+ return false;
+
return gInfo->type == GAMEOBJECT_TYPE_MO_TRANSPORT || (gInfo->type == GAMEOBJECT_TYPE_TRANSPORT && !gInfo->transport.pause);
}
diff --git a/src/server/game/Entities/GameObject/GameObject.h b/src/server/game/Entities/GameObject/GameObject.h
index bde8780e78f..a8035043543 100755
--- a/src/server/game/Entities/GameObject/GameObject.h
+++ b/src/server/game/Entities/GameObject/GameObject.h
@@ -730,7 +730,9 @@ class GameObject : public WorldObject, public GridObject<GameObject>
bool IsInSkillupList(uint32 PlayerGuidLow) const
{
for (std::list<uint32>::const_iterator i = m_SkillupList.begin(); i != m_SkillupList.end(); ++i)
- if (*i == PlayerGuidLow) return true;
+ if (*i == PlayerGuidLow)
+ return true;
+
return false;
}
void ClearSkillupList() { m_SkillupList.clear(); }
diff --git a/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp b/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp
index 0236e9450f5..ee809243107 100755
--- a/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp
+++ b/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp
@@ -102,7 +102,8 @@ uint32 GetItemEnchantMod(int32 entry)
{
fCount += ench_iter->chance;
- if (fCount > dRoll) return ench_iter->ench;
+ if (fCount > dRoll)
+ return ench_iter->ench;
}
//we could get here only if sum of all enchantment chances is lower than 100%
@@ -113,7 +114,8 @@ uint32 GetItemEnchantMod(int32 entry)
{
fCount += ench_iter->chance;
- if (fCount > dRoll) return ench_iter->ench;
+ if (fCount > dRoll)
+ return ench_iter->ench;
}
return 0;
diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp
index fe89a346911..2291675c36d 100755
--- a/src/server/game/Entities/Object/Object.cpp
+++ b/src/server/game/Entities/Object/Object.cpp
@@ -1457,7 +1457,9 @@ void Position::GetPositionOffsetTo(const Position & endPos, Position & retOffset
float Position::GetAngle(const Position* obj) const
{
- if (!obj) return 0;
+ if (!obj)
+ return 0;
+
return GetAngle(obj->GetPositionX(), obj->GetPositionY());
}
diff --git a/src/server/game/Entities/Object/Object.h b/src/server/game/Entities/Object/Object.h
index 972be794464..f6bd31f7dc6 100755
--- a/src/server/game/Entities/Object/Object.h
+++ b/src/server/game/Entities/Object/Object.h
@@ -227,7 +227,9 @@ class Object
bool HasFlag(uint16 index, uint32 flag) const
{
- if (index >= m_valuesCount && !PrintIndexError(index, false)) return false;
+ if (index >= m_valuesCount && !PrintIndexError(index, false))
+ return false;
+
return (m_uint32Values[index] & flag) != 0;
}
diff --git a/src/server/game/Entities/Pet/Pet.cpp b/src/server/game/Entities/Pet/Pet.cpp
index d51af9e1ba9..0ee8381d54f 100755
--- a/src/server/game/Entities/Pet/Pet.cpp
+++ b/src/server/game/Entities/Pet/Pet.cpp
@@ -1308,7 +1308,7 @@ void Pet::_SaveAuras(SQLTransaction& trans)
stmt->setUInt32(0, m_charmInfo->GetPetNumber());
trans->Append(stmt);
- for (AuraMap::const_iterator itr = m_ownedAuras.begin(); itr != m_ownedAuras.end() ; ++itr)
+ for (AuraMap::const_iterator itr = m_ownedAuras.begin(); itr != m_ownedAuras.end(); ++itr)
{
// check if the aura has to be saved
if (!itr->second->CanBeSaved() || IsPetAura(itr->second))
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 1961d5dc452..7d2c62feb73 100755
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -4691,7 +4691,7 @@ TrainerSpellState Player::GetTrainerSpellState(TrainerSpell const* trainer_spell
return TRAINER_SPELL_RED;
bool hasSpell = true;
- for (uint8 i = 0; i < MAX_SPELL_EFFECTS ; ++i)
+ for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
if (!trainer_spell->learnedSpell[i])
continue;
@@ -4714,7 +4714,7 @@ TrainerSpellState Player::GetTrainerSpellState(TrainerSpell const* trainer_spell
if (getLevel() < trainer_spell->reqLevel)
return TRAINER_SPELL_RED;
- for (uint8 i = 0; i < MAX_SPELL_EFFECTS ; ++i)
+ for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
if (!trainer_spell->learnedSpell[i])
continue;
@@ -4741,7 +4741,7 @@ TrainerSpellState Player::GetTrainerSpellState(TrainerSpell const* trainer_spell
// check primary prof. limit
// first rank of primary profession spell when there are no proffesions avalible is disabled
- for (uint8 i = 0; i < MAX_SPELL_EFFECTS ; ++i)
+ for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
if (!trainer_spell->learnedSpell[i])
continue;
@@ -18988,7 +18988,7 @@ void Player::_SaveAuras(SQLTransaction& trans)
stmt->setUInt32(0, GetGUIDLow());
trans->Append(stmt);
- for (AuraMap::const_iterator itr = m_ownedAuras.begin(); itr != m_ownedAuras.end() ; ++itr)
+ for (AuraMap::const_iterator itr = m_ownedAuras.begin(); itr != m_ownedAuras.end(); ++itr)
{
if (!itr->second->CanBeSaved())
continue;
@@ -23257,7 +23257,8 @@ void Player::SendCorpseReclaimDelay(bool load)
else
delay = GetCorpseReclaimDelay(pvp);
- if (!delay) return;
+ if (!delay)
+ return;
//! corpse reclaim delay 30 * 1000ms or longer at often deaths
WorldPacket data(SMSG_CORPSE_RECLAIM_DELAY, 4);
diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h
index ac50bbd9d35..b39e2b87750 100755
--- a/src/server/game/Entities/Player/Player.h
+++ b/src/server/game/Entities/Player/Player.h
@@ -1511,7 +1511,7 @@ class Player : public Unit, public GridObject<Player>
static uint32 GetLevelFromDB(uint64 guid);
static bool LoadPositionFromDB(uint32& mapid, float& x, float& y, float& z, float& o, bool& in_flight, uint64 guid);
- static bool IsValidGender(uint8 Gender) { return Gender <= GENDER_FEMALE ; }
+ static bool IsValidGender(uint8 Gender) { return Gender <= GENDER_FEMALE; }
/*********************************************************/
/*** SAVE SYSTEM ***/
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index 70b367b8ce0..30be1a854d0 100755
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -457,7 +457,8 @@ void Unit::resetAttackTimer(WeaponAttackType type)
bool Unit::IsWithinCombatRange(const Unit* obj, float dist2compare) const
{
- if (!obj || !IsInMap(obj)) return false;
+ if (!obj || !IsInMap(obj))
+ return false;
float dx = GetPositionX() - obj->GetPositionX();
float dy = GetPositionY() - obj->GetPositionY();
@@ -472,7 +473,8 @@ bool Unit::IsWithinCombatRange(const Unit* obj, float dist2compare) const
bool Unit::IsWithinMeleeRange(const Unit* obj, float dist) const
{
- if (!obj || !IsInMap(obj)) return false;
+ if (!obj || !IsInMap(obj))
+ return false;
float dx = GetPositionX() - obj->GetPositionX();
float dy = GetPositionY() - obj->GetPositionY();
@@ -2878,7 +2880,8 @@ void Unit::SetCurrentCastedSpell(Spell* pSpell)
CurrentSpellTypes CSpellType = pSpell->GetCurrentContainer();
- if (pSpell == m_currentSpells[CSpellType]) return; // avoid breaking self
+ if (pSpell == m_currentSpells[CSpellType]) // avoid breaking self
+ return;
// break same type spell if it is not delayed
InterruptSpell(CSpellType, false);
@@ -3245,7 +3248,7 @@ void Unit::_ApplyAura(AuraApplication * aurApp, uint8 effMask)
aura->HandleAuraSpecificMods(aurApp, caster, true, false);
// apply effects of the aura
- for (uint8 i = 0 ; i < MAX_SPELL_EFFECTS; ++i)
+ for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
if (effMask & 1<<i && (!aurApp->GetRemoveMode()))
aurApp->_HandleEffect(i, true);
@@ -3304,7 +3307,7 @@ void Unit::_UnapplyAura(AuraApplicationMap::iterator &i, AuraRemoveMode removeMo
aura->_UnapplyForTarget(this, caster, aurApp);
// remove effects of the spell - needs to be done after removing aura from lists
- for (uint8 itr = 0 ; itr < MAX_SPELL_EFFECTS; ++itr)
+ for (uint8 itr = 0; itr < MAX_SPELL_EFFECTS; ++itr)
{
if (aurApp->HasEffect(itr))
aurApp->_HandleEffect(itr, false);
@@ -3481,7 +3484,7 @@ void Unit::RemoveAura(AuraApplication * aurApp, AuraRemoveMode mode)
if (aurApp->GetRemoveMode())
{
// remove remaining effects of an aura
- for (uint8 itr = 0 ; itr < MAX_SPELL_EFFECTS; ++itr)
+ for (uint8 itr = 0; itr < MAX_SPELL_EFFECTS; ++itr)
{
if (aurApp->HasEffect(itr))
aurApp->_HandleEffect(itr, false);
@@ -4619,7 +4622,9 @@ GameObject* Unit::GetGameObject(uint32 spellId) const
void Unit::AddGameObject(GameObject* gameObj)
{
- if (!gameObj || !gameObj->GetOwnerGUID() == 0) return;
+ if (!gameObj || !gameObj->GetOwnerGUID() == 0)
+ return;
+
m_gameObj.push_back(gameObj);
gameObj->SetOwnerGUID(GetGUID());
@@ -11879,7 +11884,9 @@ float Unit::GetWeaponProcChance() const
float Unit::GetPPMProcChance(uint32 WeaponSpeed, float PPM, const SpellInfo* spellProto) const
{
// proc per minute chance calculation
- if (PPM <= 0) return 0.0f;
+ if (PPM <= 0)
+ return 0.0f;
+
// Apply chance modifer aura
if (spellProto)
if (Player* modOwner = GetSpellModOwner())
diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h
index d85b7dd15bf..e37e4d4fedd 100755
--- a/src/server/game/Entities/Unit/Unit.h
+++ b/src/server/game/Entities/Unit/Unit.h
@@ -1336,7 +1336,7 @@ class Unit : public WorldObject
float GetStat(Stats stat) const { return float(GetUInt32Value(UNIT_FIELD_STAT0+stat)); }
void SetStat(Stats stat, int32 val) { SetStatInt32Value(UNIT_FIELD_STAT0+stat, val); }
- uint32 GetArmor() const { return GetResistance(SPELL_SCHOOL_NORMAL) ; }
+ uint32 GetArmor() const { return GetResistance(SPELL_SCHOOL_NORMAL); }
void SetArmor(int32 val) { SetResistance(SPELL_SCHOOL_NORMAL, val); }
uint32 GetResistance(SpellSchools school) const { return GetUInt32Value(UNIT_FIELD_RESISTANCES+school); }
@@ -2026,7 +2026,7 @@ class Unit : public WorldObject
float GetAPMultiplier(WeaponAttackType attType, bool normalized);
void ModifyAuraState(AuraStateType flag, bool apply);
uint32 BuildAuraStateUpdateForTarget(Unit* target) const;
- bool HasAuraState(AuraStateType flag, SpellInfo const* spellProto = NULL, Unit const* Caster = NULL) const ;
+ bool HasAuraState(AuraStateType flag, SpellInfo const* spellProto = NULL, Unit const* Caster = NULL) const;
void UnsummonAllTotems();
Unit* GetMagicHitRedirectTarget(Unit* victim, SpellInfo const* spellInfo);
Unit* GetMeleeHitRedirectTarget(Unit* victim, SpellInfo const* spellInfo = NULL);
diff --git a/src/server/game/Events/GameEventMgr.cpp b/src/server/game/Events/GameEventMgr.cpp
index bdd2ab0377d..bf7bc13345a 100755
--- a/src/server/game/Events/GameEventMgr.cpp
+++ b/src/server/game/Events/GameEventMgr.cpp
@@ -80,7 +80,7 @@ uint32 GameEventMgr::NextCheck(uint16 entry) const
if (mGameEvent[entry].state == GAMEEVENT_WORLD_CONDITIONS)
{
if (mGameEvent[entry].length)
- return mGameEvent[entry].length * 60 ;
+ return mGameEvent[entry].length * 60;
else
return max_ge_check_delay;
}
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp
index d8107576ee4..aab1fc96521 100755
--- a/src/server/game/Globals/ObjectMgr.cpp
+++ b/src/server/game/Globals/ObjectMgr.cpp
@@ -8598,10 +8598,13 @@ uint32 ObjectMgr::GetScriptId(const char *name)
{
// use binary search to find the script name in the sorted vector
// assume "" is the first element
- if (!name) return 0;
- ScriptNameContainer::const_iterator itr =
- std::lower_bound(_scriptNamesStore.begin(), _scriptNamesStore.end(), name);
- if (itr == _scriptNamesStore.end() || *itr != name) return 0;
+ if (!name)
+ return 0;
+
+ ScriptNameContainer::const_iterator itr = std::lower_bound(_scriptNamesStore.begin(), _scriptNamesStore.end(), name);
+ if (itr == _scriptNamesStore.end() || *itr != name)
+ return 0;
+
return uint32(itr - _scriptNamesStore.begin());
}
@@ -8610,6 +8613,7 @@ void ObjectMgr::CheckScripts(ScriptsType type, std::set<int32>& ids)
ScriptMapMap* scripts = GetScriptsMapByType(type);
if (!scripts)
return;
+
for (ScriptMapMap::const_iterator itrMM = scripts->begin(); itrMM != scripts->end(); ++itrMM)
{
for (ScriptMap::const_iterator itrM = itrMM->second.begin(); itrM != itrMM->second.end(); ++itrM)
diff --git a/src/server/game/Guilds/Guild.cpp b/src/server/game/Guilds/Guild.cpp
index 6c9cd428e4f..98707a0b42f 100755
--- a/src/server/game/Guilds/Guild.cpp
+++ b/src/server/game/Guilds/Guild.cpp
@@ -1230,7 +1230,7 @@ void Guild::HandleQuery(WorldSession* session)
data << uint32(m_id);
data << m_name;
- for (uint8 i = 0 ; i < GUILD_RANKS_MAX_COUNT; ++i) // Alwayse show 10 ranks
+ for (uint8 i = 0; i < GUILD_RANKS_MAX_COUNT; ++i) // Alwayse show 10 ranks
{
if (i < _GetRanksSize())
data << m_ranks[i].GetName();
diff --git a/src/server/game/Handlers/GroupHandler.cpp b/src/server/game/Handlers/GroupHandler.cpp
index 637025c7d9e..de8dc2b90f6 100755
--- a/src/server/game/Handlers/GroupHandler.cpp
+++ b/src/server/game/Handlers/GroupHandler.cpp
@@ -248,8 +248,9 @@ void WorldSession::HandleGroupDeclineOpcode(WorldPacket & /*recv_data*/)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GROUP_DECLINE");
- Group *group = GetPlayer()->GetGroupInvite();
- if (!group) return;
+ Group* group = GetPlayer()->GetGroupInvite();
+ if (!group)
+ return;
// Remember leader if online (group pointer will be invalid if group gets disbanded)
Player* leader = ObjectAccessor::FindPlayer(group->GetLeaderGUID());
diff --git a/src/server/game/Handlers/ItemHandler.cpp b/src/server/game/Handlers/ItemHandler.cpp
index 8a60f21dac9..85694dba630 100755
--- a/src/server/game/Handlers/ItemHandler.cpp
+++ b/src/server/game/Handlers/ItemHandler.cpp
@@ -115,7 +115,7 @@ void WorldSession::HandleSwapItem(WorldPacket & recv_data)
//sLog->outDebug(LOG_FILTER_PACKETIO, "WORLD: CMSG_SWAP_ITEM");
uint8 dstbag, dstslot, srcbag, srcslot;
- recv_data >> dstbag >> dstslot >> srcbag >> srcslot ;
+ recv_data >> dstbag >> dstslot >> srcbag >> srcslot;
//sLog->outDebug("STORAGE: receive srcbag = %u, srcslot = %u, dstbag = %u, dstslot = %u", srcbag, srcslot, dstbag, dstslot);
uint16 src = ((srcbag << 8) | srcslot);
diff --git a/src/server/game/Handlers/LFGHandler.cpp b/src/server/game/Handlers/LFGHandler.cpp
index 3c6bd28b5cb..aea7499aaa9 100755
--- a/src/server/game/Handlers/LFGHandler.cpp
+++ b/src/server/game/Handlers/LFGHandler.cpp
@@ -70,7 +70,7 @@ void WorldSession::HandleLfgJoinOpcode(WorldPacket& recv_data)
}
LfgDungeonSet newDungeons;
- for (int8 i = 0 ; i < numDungeons; ++i)
+ for (int8 i = 0; i < numDungeons; ++i)
{
recv_data >> dungeon;
newDungeons.insert((dungeon & 0x00FFFFFF)); // remove the type from the dungeon entry
diff --git a/src/server/game/Handlers/NPCHandler.cpp b/src/server/game/Handlers/NPCHandler.cpp
index 5479791d341..f0c3093aa25 100755
--- a/src/server/game/Handlers/NPCHandler.cpp
+++ b/src/server/game/Handlers/NPCHandler.cpp
@@ -169,7 +169,7 @@ void WorldSession::SendTrainerList(uint64 guid, const std::string& strTitle)
bool valid = true;
bool primary_prof_first_rank = false;
- for (uint8 i = 0; i < MAX_SPELL_EFFECTS ; ++i)
+ for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
if (!tSpell->learnedSpell[i])
continue;
@@ -199,7 +199,7 @@ void WorldSession::SendTrainerList(uint64 guid, const std::string& strTitle)
data << uint32(tSpell->reqSkillValue);
//prev + req or req + 0
uint8 maxReq = 0;
- for (uint8 i = 0; i < MAX_SPELL_EFFECTS ; ++i)
+ for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
if (!tSpell->learnedSpell[i])
continue;
diff --git a/src/server/game/Loot/LootMgr.cpp b/src/server/game/Loot/LootMgr.cpp
index 7c7cc06201c..7efd600baa8 100755
--- a/src/server/game/Loot/LootMgr.cpp
+++ b/src/server/game/Loot/LootMgr.cpp
@@ -512,7 +512,9 @@ QuestItemList* Loot::FillFFALoot(Player* player)
QuestItemList* Loot::FillQuestLoot(Player* player)
{
- if (items.size() == MAX_NR_LOOT_ITEMS) return NULL;
+ if (items.size() == MAX_NR_LOOT_ITEMS)
+ return NULL;
+
QuestItemList* ql = new QuestItemList();
for (uint8 i = 0; i < quest_items.size(); ++i)
@@ -734,7 +736,7 @@ bool Loot::hasItemFor(Player* player) const
if (q_itr != lootPlayerQuestItems.end())
{
QuestItemList* q_list = q_itr->second;
- for (QuestItemList::const_iterator qi = q_list->begin() ; qi != q_list->end(); ++qi)
+ for (QuestItemList::const_iterator qi = q_list->begin(); qi != q_list->end(); ++qi)
{
const LootItem &item = quest_items[qi->index];
if (!qi->is_looted && !item.is_looted)
@@ -747,7 +749,7 @@ bool Loot::hasItemFor(Player* player) const
if (ffa_itr != lootPlayerFFAItems.end())
{
QuestItemList* ffa_list = ffa_itr->second;
- for (QuestItemList::const_iterator fi = ffa_list->begin() ; fi != ffa_list->end(); ++fi)
+ for (QuestItemList::const_iterator fi = ffa_list->begin(); fi != ffa_list->end(); ++fi)
{
const LootItem &item = items[fi->index];
if (!fi->is_looted && !item.is_looted)
@@ -760,7 +762,7 @@ bool Loot::hasItemFor(Player* player) const
if (nn_itr != lootPlayerNonQuestNonFFAConditionalItems.end())
{
QuestItemList* conditional_list = nn_itr->second;
- for (QuestItemList::const_iterator ci = conditional_list->begin() ; ci != conditional_list->end(); ++ci)
+ for (QuestItemList::const_iterator ci = conditional_list->begin(); ci != conditional_list->end(); ++ci)
{
const LootItem &item = items[ci->index];
if (!ci->is_looted && !item.is_looted)
@@ -900,7 +902,7 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv)
if (q_itr != lootPlayerQuestItems.end())
{
QuestItemList* q_list = q_itr->second;
- for (QuestItemList::const_iterator qi = q_list->begin() ; qi != q_list->end(); ++qi)
+ for (QuestItemList::const_iterator qi = q_list->begin(); qi != q_list->end(); ++qi)
{
LootItem &item = l.quest_items[qi->index];
if (!qi->is_looted && !item.is_looted)
@@ -918,7 +920,7 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv)
if (ffa_itr != lootPlayerFFAItems.end())
{
QuestItemList* ffa_list = ffa_itr->second;
- for (QuestItemList::const_iterator fi = ffa_list->begin() ; fi != ffa_list->end(); ++fi)
+ for (QuestItemList::const_iterator fi = ffa_list->begin(); fi != ffa_list->end(); ++fi)
{
LootItem &item = l.items[fi->index];
if (!fi->is_looted && !item.is_looted)
@@ -936,7 +938,7 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv)
if (nn_itr != lootPlayerNonQuestNonFFAConditionalItems.end())
{
QuestItemList* conditional_list = nn_itr->second;
- for (QuestItemList::const_iterator ci = conditional_list->begin() ; ci != conditional_list->end(); ++ci)
+ for (QuestItemList::const_iterator ci = conditional_list->begin(); ci != conditional_list->end(); ++ci)
{
LootItem &item = l.items[ci->index];
if (!ci->is_looted && !item.is_looted)
@@ -1285,7 +1287,7 @@ bool LootTemplate::HasQuestDrop(LootTemplateMap const& store, uint8 groupId) con
}
// Now processing groups
- for (LootGroups::const_iterator i = Groups.begin() ; i != Groups.end(); ++i)
+ for (LootGroups::const_iterator i = Groups.begin(); i != Groups.end(); ++i)
if (i->HasQuestDrop())
return true;
@@ -1303,7 +1305,7 @@ bool LootTemplate::HasQuestDropForPlayer(LootTemplateMap const& store, Player co
}
// Checking non-grouped entries
- for (LootStoreItemList::const_iterator i = Entries.begin() ; i != Entries.end(); ++i)
+ for (LootStoreItemList::const_iterator i = Entries.begin(); i != Entries.end(); ++i)
{
if (i->mincountOrRef < 0) // References processing
{
diff --git a/src/server/game/Maps/Map.h b/src/server/game/Maps/Map.h
index d0f99610262..766e3d23f93 100755
--- a/src/server/game/Maps/Map.h
+++ b/src/server/game/Maps/Map.h
@@ -245,8 +245,12 @@ class Map : public GridRefManager<NGridType>
// currently unused for normal maps
bool CanUnload(uint32 diff)
{
- if (!m_unloadTimer) return false;
- if (m_unloadTimer <= diff) return true;
+ if (!m_unloadTimer)
+ return false;
+
+ if (m_unloadTimer <= diff)
+ return true;
+
m_unloadTimer -= diff;
return false;
}
diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp
index a22b9e73fc6..d721b5e0646 100755
--- a/src/server/game/Spells/Auras/SpellAuras.cpp
+++ b/src/server/game/Spells/Auras/SpellAuras.cpp
@@ -350,7 +350,7 @@ m_isRemoved(false), m_isSingleTarget(false), m_isUsingCharges(false)
void Aura::_InitEffects(uint8 effMask, Unit* caster, int32 *baseAmount)
{
// shouldn't be in constructor - functions in AuraEffect::AuraEffect use polymorphism
- for (uint8 i=0 ; i<MAX_SPELL_EFFECTS; ++i)
+ for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
if (effMask & (uint8(1) << i))
m_effects[i] = new AuraEffect(this, i, baseAmount ? baseAmount + i : NULL, caster);
@@ -371,7 +371,7 @@ Aura::~Aura()
}
// free effects memory
- for (uint8 i = 0 ; i < MAX_SPELL_EFFECTS; ++i)
+ for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
delete m_effects[i];
ASSERT(m_applications.empty());
@@ -2043,7 +2043,7 @@ void Aura::_DeleteRemovedApplications()
void Aura::LoadScripts()
{
sScriptMgr->CreateAuraScripts(m_spellInfo->Id, m_loadedScripts);
- for (std::list<AuraScript*>::iterator itr = m_loadedScripts.begin(); itr != m_loadedScripts.end() ;)
+ for (std::list<AuraScript*>::iterator itr = m_loadedScripts.begin(); itr != m_loadedScripts.end();)
{
if (!(*itr)->_Load(this))
{
@@ -2060,11 +2060,11 @@ void Aura::LoadScripts()
bool Aura::CallScriptCheckAreaTargetHandlers(Unit* target)
{
- for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr)
+ for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
{
(*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_CHECK_AREA_TARGET);
std::list<AuraScript::CheckAreaTargetHandler>::iterator hookItrEnd = (*scritr)->DoCheckAreaTarget.end(), hookItr = (*scritr)->DoCheckAreaTarget.begin();
- for (; hookItr != hookItrEnd ; ++hookItr)
+ for (; hookItr != hookItrEnd; ++hookItr)
if (!(*hookItr).Call(*scritr, target))
return false;
(*scritr)->_FinishScriptCall();
@@ -2074,11 +2074,11 @@ bool Aura::CallScriptCheckAreaTargetHandlers(Unit* target)
void Aura::CallScriptDispel(DispelInfo* dispelInfo)
{
- for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr)
+ for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
{
(*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_DISPEL);
std::list<AuraScript::AuraDispelHandler>::iterator hookItrEnd = (*scritr)->OnDispel.end(), hookItr = (*scritr)->OnDispel.begin();
- for (; hookItr != hookItrEnd ; ++hookItr)
+ for (; hookItr != hookItrEnd; ++hookItr)
(*hookItr).Call(*scritr, dispelInfo);
(*scritr)->_FinishScriptCall();
}
@@ -2086,11 +2086,11 @@ void Aura::CallScriptDispel(DispelInfo* dispelInfo)
void Aura::CallScriptAfterDispel(DispelInfo* dispelInfo)
{
- for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr)
+ for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
{
(*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_AFTER_DISPEL);
std::list<AuraScript::AuraDispelHandler>::iterator hookItrEnd = (*scritr)->AfterDispel.end(), hookItr = (*scritr)->AfterDispel.begin();
- for (; hookItr != hookItrEnd ; ++hookItr)
+ for (; hookItr != hookItrEnd; ++hookItr)
(*hookItr).Call(*scritr, dispelInfo);
(*scritr)->_FinishScriptCall();
}
@@ -2099,11 +2099,11 @@ void Aura::CallScriptAfterDispel(DispelInfo* dispelInfo)
bool Aura::CallScriptEffectApplyHandlers(AuraEffect const* aurEff, AuraApplication const* aurApp, AuraEffectHandleModes mode)
{
bool preventDefault = false;
- for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr)
+ for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
{
(*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_APPLY, aurApp);
std::list<AuraScript::EffectApplyHandler>::iterator effEndItr = (*scritr)->OnEffectApply.end(), effItr = (*scritr)->OnEffectApply.begin();
- for (; effItr != effEndItr ; ++effItr)
+ for (; effItr != effEndItr; ++effItr)
{
if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
(*effItr).Call(*scritr, aurEff, mode);
@@ -2118,11 +2118,11 @@ bool Aura::CallScriptEffectApplyHandlers(AuraEffect const* aurEff, AuraApplicati
bool Aura::CallScriptEffectRemoveHandlers(AuraEffect const* aurEff, AuraApplication const* aurApp, AuraEffectHandleModes mode)
{
bool preventDefault = false;
- for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr)
+ for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
{
(*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_REMOVE, aurApp);
std::list<AuraScript::EffectApplyHandler>::iterator effEndItr = (*scritr)->OnEffectRemove.end(), effItr = (*scritr)->OnEffectRemove.begin();
- for (; effItr != effEndItr ; ++effItr)
+ for (; effItr != effEndItr; ++effItr)
{
if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
(*effItr).Call(*scritr, aurEff, mode);
@@ -2136,11 +2136,11 @@ bool Aura::CallScriptEffectRemoveHandlers(AuraEffect const* aurEff, AuraApplicat
void Aura::CallScriptAfterEffectApplyHandlers(AuraEffect const* aurEff, AuraApplication const* aurApp, AuraEffectHandleModes mode)
{
- for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr)
+ for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
{
(*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_AFTER_APPLY, aurApp);
std::list<AuraScript::EffectApplyHandler>::iterator effEndItr = (*scritr)->AfterEffectApply.end(), effItr = (*scritr)->AfterEffectApply.begin();
- for (; effItr != effEndItr ; ++effItr)
+ for (; effItr != effEndItr; ++effItr)
{
if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
(*effItr).Call(*scritr, aurEff, mode);
@@ -2151,11 +2151,11 @@ void Aura::CallScriptAfterEffectApplyHandlers(AuraEffect const* aurEff, AuraAppl
void Aura::CallScriptAfterEffectRemoveHandlers(AuraEffect const* aurEff, AuraApplication const* aurApp, AuraEffectHandleModes mode)
{
- for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr)
+ for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
{
(*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_AFTER_REMOVE, aurApp);
std::list<AuraScript::EffectApplyHandler>::iterator effEndItr = (*scritr)->AfterEffectRemove.end(), effItr = (*scritr)->AfterEffectRemove.begin();
- for (; effItr != effEndItr ; ++effItr)
+ for (; effItr != effEndItr; ++effItr)
{
if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
(*effItr).Call(*scritr, aurEff, mode);
@@ -2167,11 +2167,11 @@ void Aura::CallScriptAfterEffectRemoveHandlers(AuraEffect const* aurEff, AuraApp
bool Aura::CallScriptEffectPeriodicHandlers(AuraEffect const* aurEff, AuraApplication const* aurApp)
{
bool preventDefault = false;
- for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr)
+ for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
{
(*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_PERIODIC, aurApp);
std::list<AuraScript::EffectPeriodicHandler>::iterator effEndItr = (*scritr)->OnEffectPeriodic.end(), effItr = (*scritr)->OnEffectPeriodic.begin();
- for (; effItr != effEndItr ; ++effItr)
+ for (; effItr != effEndItr; ++effItr)
{
if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
(*effItr).Call(*scritr, aurEff);
@@ -2185,11 +2185,11 @@ bool Aura::CallScriptEffectPeriodicHandlers(AuraEffect const* aurEff, AuraApplic
void Aura::CallScriptEffectUpdatePeriodicHandlers(AuraEffect* aurEff)
{
- for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr)
+ for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
{
(*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_UPDATE_PERIODIC);
std::list<AuraScript::EffectUpdatePeriodicHandler>::iterator effEndItr = (*scritr)->OnEffectUpdatePeriodic.end(), effItr = (*scritr)->OnEffectUpdatePeriodic.begin();
- for (; effItr != effEndItr ; ++effItr)
+ for (; effItr != effEndItr; ++effItr)
{
if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
(*effItr).Call(*scritr, aurEff);
@@ -2200,11 +2200,11 @@ void Aura::CallScriptEffectUpdatePeriodicHandlers(AuraEffect* aurEff)
void Aura::CallScriptEffectCalcAmountHandlers(AuraEffect const* aurEff, int32 & amount, bool & canBeRecalculated)
{
- for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr)
+ for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
{
(*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_CALC_AMOUNT);
std::list<AuraScript::EffectCalcAmountHandler>::iterator effEndItr = (*scritr)->DoEffectCalcAmount.end(), effItr = (*scritr)->DoEffectCalcAmount.begin();
- for (; effItr != effEndItr ; ++effItr)
+ for (; effItr != effEndItr; ++effItr)
{
if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
(*effItr).Call(*scritr, aurEff, amount, canBeRecalculated);
@@ -2215,11 +2215,11 @@ void Aura::CallScriptEffectCalcAmountHandlers(AuraEffect const* aurEff, int32 &
void Aura::CallScriptEffectCalcPeriodicHandlers(AuraEffect const* aurEff, bool & isPeriodic, int32 & amplitude)
{
- for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr)
+ for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
{
(*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_CALC_PERIODIC);
std::list<AuraScript::EffectCalcPeriodicHandler>::iterator effEndItr = (*scritr)->DoEffectCalcPeriodic.end(), effItr = (*scritr)->DoEffectCalcPeriodic.begin();
- for (; effItr != effEndItr ; ++effItr)
+ for (; effItr != effEndItr; ++effItr)
{
if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
(*effItr).Call(*scritr, aurEff, isPeriodic, amplitude);
@@ -2230,11 +2230,11 @@ void Aura::CallScriptEffectCalcPeriodicHandlers(AuraEffect const* aurEff, bool &
void Aura::CallScriptEffectCalcSpellModHandlers(AuraEffect const* aurEff, SpellModifier* & spellMod)
{
- for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr)
+ for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
{
(*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_CALC_SPELLMOD);
std::list<AuraScript::EffectCalcSpellModHandler>::iterator effEndItr = (*scritr)->DoEffectCalcSpellMod.end(), effItr = (*scritr)->DoEffectCalcSpellMod.begin();
- for (; effItr != effEndItr ; ++effItr)
+ for (; effItr != effEndItr; ++effItr)
{
if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
(*effItr).Call(*scritr, aurEff, spellMod);
@@ -2245,11 +2245,11 @@ void Aura::CallScriptEffectCalcSpellModHandlers(AuraEffect const* aurEff, SpellM
void Aura::CallScriptEffectAbsorbHandlers(AuraEffect* aurEff, AuraApplication const* aurApp, DamageInfo & dmgInfo, uint32 & absorbAmount, bool & /*defaultPrevented*/)
{
- for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr)
+ for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
{
(*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_ABSORB, aurApp);
std::list<AuraScript::EffectAbsorbHandler>::iterator effEndItr = (*scritr)->OnEffectAbsorb.end(), effItr = (*scritr)->OnEffectAbsorb.begin();
- for (; effItr != effEndItr ; ++effItr)
+ for (; effItr != effEndItr; ++effItr)
{
if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
(*effItr).Call(*scritr, aurEff, dmgInfo, absorbAmount);
@@ -2260,11 +2260,11 @@ void Aura::CallScriptEffectAbsorbHandlers(AuraEffect* aurEff, AuraApplication co
void Aura::CallScriptEffectAfterAbsorbHandlers(AuraEffect* aurEff, AuraApplication const* aurApp, DamageInfo & dmgInfo, uint32 & absorbAmount)
{
- for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr)
+ for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
{
(*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_AFTER_ABSORB, aurApp);
std::list<AuraScript::EffectAbsorbHandler>::iterator effEndItr = (*scritr)->AfterEffectAbsorb.end(), effItr = (*scritr)->AfterEffectAbsorb.begin();
- for (; effItr != effEndItr ; ++effItr)
+ for (; effItr != effEndItr; ++effItr)
{
if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
(*effItr).Call(*scritr, aurEff, dmgInfo, absorbAmount);
@@ -2275,11 +2275,11 @@ void Aura::CallScriptEffectAfterAbsorbHandlers(AuraEffect* aurEff, AuraApplicati
void Aura::CallScriptEffectManaShieldHandlers(AuraEffect* aurEff, AuraApplication const* aurApp, DamageInfo & dmgInfo, uint32 & absorbAmount, bool & /*defaultPrevented*/)
{
- for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr)
+ for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
{
(*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_MANASHIELD, aurApp);
std::list<AuraScript::EffectManaShieldHandler>::iterator effEndItr = (*scritr)->OnEffectManaShield.end(), effItr = (*scritr)->OnEffectManaShield.begin();
- for (; effItr != effEndItr ; ++effItr)
+ for (; effItr != effEndItr; ++effItr)
{
if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
(*effItr).Call(*scritr, aurEff, dmgInfo, absorbAmount);
@@ -2290,11 +2290,11 @@ void Aura::CallScriptEffectManaShieldHandlers(AuraEffect* aurEff, AuraApplicatio
void Aura::CallScriptEffectAfterManaShieldHandlers(AuraEffect* aurEff, AuraApplication const* aurApp, DamageInfo & dmgInfo, uint32 & absorbAmount)
{
- for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr)
+ for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
{
(*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_AFTER_MANASHIELD, aurApp);
std::list<AuraScript::EffectManaShieldHandler>::iterator effEndItr = (*scritr)->AfterEffectManaShield.end(), effItr = (*scritr)->AfterEffectManaShield.begin();
- for (; effItr != effEndItr ; ++effItr)
+ for (; effItr != effEndItr; ++effItr)
{
if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
(*effItr).Call(*scritr, aurEff, dmgInfo, absorbAmount);
@@ -2339,7 +2339,7 @@ void UnitAura::Remove(AuraRemoveMode removeMode)
void UnitAura::FillTargetMap(std::map<Unit*, uint8> & targets, Unit* caster)
{
- for (uint8 effIndex = 0; effIndex < MAX_SPELL_EFFECTS ; ++effIndex)
+ for (uint8 effIndex = 0; effIndex < MAX_SPELL_EFFECTS; ++effIndex)
{
if (!HasEffect(effIndex))
continue;
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index ee5e4bc0efa..52a2f1f9da8 100755
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -1274,7 +1274,7 @@ void Spell::SelectImplicitAreaTargets(SpellEffIndex effIndex, SpellImplicitTarge
break;
// Remove targets outside caster's raid
- for (std::list<Unit*>::iterator itr = unitTargets.begin() ; itr != unitTargets.end();)
+ for (std::list<Unit*>::iterator itr = unitTargets.begin(); itr != unitTargets.end();)
{
if (!(*itr)->IsInRaidWith(m_caster))
itr = unitTargets.erase(itr);
@@ -1291,7 +1291,7 @@ void Spell::SelectImplicitAreaTargets(SpellEffIndex effIndex, SpellImplicitTarge
else if (m_spellInfo->SpellFamilyFlags[2] == 0x0100) // Starfall
{
// Remove targets not in LoS or in stealth
- for (std::list<Unit*>::iterator itr = unitTargets.begin() ; itr != unitTargets.end();)
+ for (std::list<Unit*>::iterator itr = unitTargets.begin(); itr != unitTargets.end();)
{
if ((*itr)->HasStealthAura() || (*itr)->HasInvisibilityAura() || !(*itr)->IsWithinLOSInMap(m_caster))
itr = unitTargets.erase(itr);
@@ -1304,7 +1304,7 @@ void Spell::SelectImplicitAreaTargets(SpellEffIndex effIndex, SpellImplicitTarge
break;
// Remove targets outside caster's raid
- for (std::list<Unit*>::iterator itr = unitTargets.begin() ; itr != unitTargets.end();)
+ for (std::list<Unit*>::iterator itr = unitTargets.begin(); itr != unitTargets.end();)
if (!(*itr)->IsInRaidWith(m_caster))
itr = unitTargets.erase(itr);
else
@@ -1326,7 +1326,7 @@ void Spell::SelectImplicitAreaTargets(SpellEffIndex effIndex, SpellImplicitTarge
}
else
{
- for (std::list<Unit*>::iterator itr = unitTargets.begin() ; itr != unitTargets.end();)
+ for (std::list<Unit*>::iterator itr = unitTargets.begin(); itr != unitTargets.end();)
if ((*itr)->getPowerType() != (Powers)power)
itr = unitTargets.erase(itr);
else
@@ -6039,7 +6039,7 @@ SpellCastResult Spell::CheckItems()
// check totem-item requirements (items presence in inventory)
uint32 totems = 2;
- for (int i = 0; i < 2 ; ++i)
+ for (int i = 0; i < 2; ++i)
{
if (m_spellInfo->Totem[i] != 0)
{
@@ -6262,9 +6262,12 @@ SpellCastResult Spell::CheckItems()
case SPELL_EFFECT_WEAPON_DAMAGE:
case SPELL_EFFECT_WEAPON_DAMAGE_NOSCHOOL:
{
- if (m_caster->GetTypeId() != TYPEID_PLAYER) return SPELL_FAILED_TARGET_NOT_PLAYER;
+ if (m_caster->GetTypeId() != TYPEID_PLAYER)
+ return SPELL_FAILED_TARGET_NOT_PLAYER;
+
if (m_attackType != RANGED_ATTACK)
break;
+
Item* pItem = m_caster->ToPlayer()->GetWeaponForAttack(m_attackType);
if (!pItem || pItem->IsBroken())
return SPELL_FAILED_EQUIPPED_ITEM;
@@ -6276,7 +6279,8 @@ SpellCastResult Spell::CheckItems()
uint32 ammo = pItem->GetEntry();
if (!m_caster->ToPlayer()->HasItemCount(ammo, 1))
return SPELL_FAILED_NO_AMMO;
- }; break;
+ };
+ break;
case ITEM_SUBCLASS_WEAPON_GUN:
case ITEM_SUBCLASS_WEAPON_BOW:
case ITEM_SUBCLASS_WEAPON_CROSSBOW:
@@ -6987,7 +6991,7 @@ void Spell::CheckEffectExecuteData()
void Spell::LoadScripts()
{
sScriptMgr->CreateSpellScripts(m_spellInfo->Id, m_loadedScripts);
- for (std::list<SpellScript*>::iterator itr = m_loadedScripts.begin(); itr != m_loadedScripts.end() ;)
+ for (std::list<SpellScript*>::iterator itr = m_loadedScripts.begin(); itr != m_loadedScripts.end();)
{
if (!(*itr)->_Load(this))
{
@@ -7004,11 +7008,11 @@ void Spell::LoadScripts()
void Spell::CallScriptBeforeCastHandlers()
{
- for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr)
+ for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
{
(*scritr)->_PrepareScriptCall(SPELL_SCRIPT_HOOK_BEFORE_CAST);
std::list<SpellScript::CastHandler>::iterator hookItrEnd = (*scritr)->BeforeCast.end(), hookItr = (*scritr)->BeforeCast.begin();
- for (; hookItr != hookItrEnd ; ++hookItr)
+ for (; hookItr != hookItrEnd; ++hookItr)
(*hookItr).Call(*scritr);
(*scritr)->_FinishScriptCall();
@@ -7017,11 +7021,11 @@ void Spell::CallScriptBeforeCastHandlers()
void Spell::CallScriptOnCastHandlers()
{
- for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr)
+ for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
{
(*scritr)->_PrepareScriptCall(SPELL_SCRIPT_HOOK_ON_CAST);
std::list<SpellScript::CastHandler>::iterator hookItrEnd = (*scritr)->OnCast.end(), hookItr = (*scritr)->OnCast.begin();
- for (; hookItr != hookItrEnd ; ++hookItr)
+ for (; hookItr != hookItrEnd; ++hookItr)
(*hookItr).Call(*scritr);
(*scritr)->_FinishScriptCall();
@@ -7030,11 +7034,11 @@ void Spell::CallScriptOnCastHandlers()
void Spell::CallScriptAfterCastHandlers()
{
- for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr)
+ for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
{
(*scritr)->_PrepareScriptCall(SPELL_SCRIPT_HOOK_AFTER_CAST);
std::list<SpellScript::CastHandler>::iterator hookItrEnd = (*scritr)->AfterCast.end(), hookItr = (*scritr)->AfterCast.begin();
- for (; hookItr != hookItrEnd ; ++hookItr)
+ for (; hookItr != hookItrEnd; ++hookItr)
(*hookItr).Call(*scritr);
(*scritr)->_FinishScriptCall();
@@ -7044,7 +7048,7 @@ void Spell::CallScriptAfterCastHandlers()
SpellCastResult Spell::CallScriptCheckCastHandlers()
{
SpellCastResult retVal = SPELL_CAST_OK;
- for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr)
+ for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
{
(*scritr)->_PrepareScriptCall(SPELL_SCRIPT_HOOK_CHECK_CAST);
std::list<SpellScript::CheckCastHandler>::iterator hookItrEnd = (*scritr)->OnCheckCast.end(), hookItr = (*scritr)->OnCheckCast.begin();
@@ -7062,7 +7066,7 @@ SpellCastResult Spell::CallScriptCheckCastHandlers()
void Spell::PrepareScriptHitHandlers()
{
- for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr)
+ for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
(*scritr)->_InitHit();
}
@@ -7070,7 +7074,7 @@ bool Spell::CallScriptEffectHandlers(SpellEffIndex effIndex, SpellEffectHandleMo
{
// execute script effect handler hooks and check if effects was prevented
bool preventDefault = false;
- for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr)
+ for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
{
std::list<SpellScript::EffectHandler>::iterator effItr, effEndItr;
SpellScriptHookType hookType;
@@ -7101,7 +7105,7 @@ bool Spell::CallScriptEffectHandlers(SpellEffIndex effIndex, SpellEffectHandleMo
return false;
}
(*scritr)->_PrepareScriptCall(hookType);
- for (; effItr != effEndItr ; ++effItr)
+ for (; effItr != effEndItr; ++effItr)
// effect execution can be prevented
if (!(*scritr)->_IsEffectPrevented(effIndex) && (*effItr).IsEffectAffected(m_spellInfo, effIndex))
(*effItr).Call(*scritr, effIndex);
@@ -7116,11 +7120,11 @@ bool Spell::CallScriptEffectHandlers(SpellEffIndex effIndex, SpellEffectHandleMo
void Spell::CallScriptBeforeHitHandlers()
{
- for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr)
+ for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
{
(*scritr)->_PrepareScriptCall(SPELL_SCRIPT_HOOK_BEFORE_HIT);
std::list<SpellScript::HitHandler>::iterator hookItrEnd = (*scritr)->BeforeHit.end(), hookItr = (*scritr)->BeforeHit.begin();
- for (; hookItr != hookItrEnd ; ++hookItr)
+ for (; hookItr != hookItrEnd; ++hookItr)
(*hookItr).Call(*scritr);
(*scritr)->_FinishScriptCall();
@@ -7129,11 +7133,11 @@ void Spell::CallScriptBeforeHitHandlers()
void Spell::CallScriptOnHitHandlers()
{
- for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr)
+ for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
{
(*scritr)->_PrepareScriptCall(SPELL_SCRIPT_HOOK_HIT);
std::list<SpellScript::HitHandler>::iterator hookItrEnd = (*scritr)->OnHit.end(), hookItr = (*scritr)->OnHit.begin();
- for (; hookItr != hookItrEnd ; ++hookItr)
+ for (; hookItr != hookItrEnd; ++hookItr)
(*hookItr).Call(*scritr);
(*scritr)->_FinishScriptCall();
@@ -7142,11 +7146,11 @@ void Spell::CallScriptOnHitHandlers()
void Spell::CallScriptAfterHitHandlers()
{
- for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr)
+ for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
{
(*scritr)->_PrepareScriptCall(SPELL_SCRIPT_HOOK_AFTER_HIT);
std::list<SpellScript::HitHandler>::iterator hookItrEnd = (*scritr)->AfterHit.end(), hookItr = (*scritr)->AfterHit.begin();
- for (; hookItr != hookItrEnd ; ++hookItr)
+ for (; hookItr != hookItrEnd; ++hookItr)
(*hookItr).Call(*scritr);
(*scritr)->_FinishScriptCall();
@@ -7155,11 +7159,11 @@ void Spell::CallScriptAfterHitHandlers()
void Spell::CallScriptAfterUnitTargetSelectHandlers(std::list<Unit*>& unitTargets, SpellEffIndex effIndex)
{
- for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr)
+ for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
{
(*scritr)->_PrepareScriptCall(SPELL_SCRIPT_HOOK_UNIT_TARGET_SELECT);
std::list<SpellScript::UnitTargetHandler>::iterator hookItrEnd = (*scritr)->OnUnitTargetSelect.end(), hookItr = (*scritr)->OnUnitTargetSelect.begin();
- for (; hookItr != hookItrEnd ; ++hookItr)
+ for (; hookItr != hookItrEnd; ++hookItr)
if ((*hookItr).IsEffectAffected(m_spellInfo, effIndex))
(*hookItr).Call(*scritr, unitTargets);
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp
index 56cc6b6f8ec..64aeb8c0e41 100755
--- a/src/server/game/Spells/SpellEffects.cpp
+++ b/src/server/game/Spells/SpellEffects.cpp
@@ -1992,7 +1992,7 @@ void Spell::EffectEnergize(SpellEffIndex effIndex)
sSpellMgr->GetSetOfSpellsInSpellGroup(SPELL_GROUP_ELIXIR_GUARDIAN, avalibleElixirs);
if (!battleFound)
sSpellMgr->GetSetOfSpellsInSpellGroup(SPELL_GROUP_ELIXIR_BATTLE, avalibleElixirs);
- for (std::set<uint32>::iterator itr = avalibleElixirs.begin(); itr != avalibleElixirs.end() ;)
+ for (std::set<uint32>::iterator itr = avalibleElixirs.begin(); itr != avalibleElixirs.end();)
{
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(*itr);
if (spellInfo->SpellLevel < m_spellInfo->SpellLevel || spellInfo->SpellLevel > unitTarget->getLevel())
diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp
index 2b9e17c1284..37d79225169 100755
--- a/src/server/game/Spells/SpellMgr.cpp
+++ b/src/server/game/Spells/SpellMgr.cpp
@@ -643,7 +643,7 @@ SpellSpellGroupMapBounds SpellMgr::GetSpellSpellGroupMapBounds(uint32 spell_id)
uint32 SpellMgr::IsSpellMemberOfSpellGroup(uint32 spellid, SpellGroup groupid) const
{
SpellSpellGroupMapBounds spellGroup = GetSpellSpellGroupMapBounds(spellid);
- for (SpellSpellGroupMap::const_iterator itr = spellGroup.first; itr != spellGroup.second ; ++itr)
+ for (SpellSpellGroupMap::const_iterator itr = spellGroup.first; itr != spellGroup.second; ++itr)
{
if (itr->second == groupid)
return true;
@@ -669,7 +669,7 @@ void SpellMgr::GetSetOfSpellsInSpellGroup(SpellGroup group_id, std::set<uint32>&
usedGroups.insert(group_id);
SpellGroupSpellMapBounds groupSpell = GetSpellGroupSpellMapBounds(group_id);
- for (SpellGroupSpellMap::const_iterator itr = groupSpell.first; itr != groupSpell.second ; ++itr)
+ for (SpellGroupSpellMap::const_iterator itr = groupSpell.first; itr != groupSpell.second; ++itr)
{
if (itr->second < 0)
{
@@ -688,7 +688,7 @@ bool SpellMgr::AddSameEffectStackRuleSpellGroups(SpellInfo const* spellInfo, int
uint32 spellId = spellInfo->GetFirstRankSpell()->Id;
SpellSpellGroupMapBounds spellGroup = GetSpellSpellGroupMapBounds(spellId);
// Find group with SPELL_GROUP_STACK_RULE_EXCLUSIVE_SAME_EFFECT if it belongs to one
- for (SpellSpellGroupMap::const_iterator itr = spellGroup.first; itr != spellGroup.second ; ++itr)
+ for (SpellSpellGroupMap::const_iterator itr = spellGroup.first; itr != spellGroup.second; ++itr)
{
SpellGroup group = itr->second;
SpellGroupStackMap::const_iterator found = mSpellGroupStack.find(group);
@@ -724,13 +724,13 @@ SpellGroupStackRule SpellMgr::CheckSpellGroupStackRules(SpellInfo const* spellIn
// find SpellGroups which are common for both spells
SpellSpellGroupMapBounds spellGroup1 = GetSpellSpellGroupMapBounds(spellid_1);
std::set<SpellGroup> groups;
- for (SpellSpellGroupMap::const_iterator itr = spellGroup1.first; itr != spellGroup1.second ; ++itr)
+ for (SpellSpellGroupMap::const_iterator itr = spellGroup1.first; itr != spellGroup1.second; ++itr)
{
if (IsSpellMemberOfSpellGroup(spellid_2, itr->second))
{
bool add = true;
SpellGroupSpellMapBounds groupSpell = GetSpellGroupSpellMapBounds(itr->second);
- for (SpellGroupSpellMap::const_iterator itr2 = groupSpell.first; itr2 != groupSpell.second ; ++itr2)
+ for (SpellGroupSpellMap::const_iterator itr2 = groupSpell.first; itr2 != groupSpell.second; ++itr2)
{
if (itr2->second < 0)
{
@@ -749,7 +749,7 @@ SpellGroupStackRule SpellMgr::CheckSpellGroupStackRules(SpellInfo const* spellIn
SpellGroupStackRule rule = SPELL_GROUP_STACK_RULE_DEFAULT;
- for (std::set<SpellGroup>::iterator itr = groups.begin() ; itr!= groups.end() ; ++itr)
+ for (std::set<SpellGroup>::iterator itr = groups.begin(); itr!= groups.end(); ++itr)
{
SpellGroupStackMap::const_iterator found = mSpellGroupStack.find(*itr);
if (found != mSpellGroupStack.end())
@@ -1140,11 +1140,6 @@ bool SpellArea::IsFitToRequirements(Player const* player, uint32 newZone, uint32
return true;
}
-void SpellMgr::LoadSpellInfos()
-{
-
-}
-
void SpellMgr::LoadSpellRanks()
{
uint32 oldMSTime = getMSTime();
@@ -1160,13 +1155,12 @@ void SpellMgr::LoadSpellRanks()
if (!result)
{
- sLog->outString(">> Loaded 0 spell rank records");
+ sLog->outString(">> Loaded 0 spell rank records. DB table `spell_ranks` is empty.");
sLog->outString();
- sLog->outErrorDb("`spell_ranks` table is empty!");
return;
}
- uint32 rows = 0;
+ uint32 count = 0;
bool finished = false;
do
@@ -1213,7 +1207,7 @@ void SpellMgr::LoadSpellRanks()
int32 curRank = 0;
bool valid = true;
// check spells in chain
- for (std::list<std::pair<int32, int32> >::iterator itr = rankChain.begin() ; itr!= rankChain.end(); ++itr)
+ for (std::list<std::pair<int32, int32> >::iterator itr = rankChain.begin(); itr!= rankChain.end(); ++itr)
{
SpellInfo const* spell = GetSpellInfo(itr->first);
if (!spell)
@@ -1237,7 +1231,7 @@ void SpellMgr::LoadSpellRanks()
std::list<std::pair<int32, int32> >::iterator itr = rankChain.begin();
do
{
- ++rows;
+ ++count;
int32 addedSpell = itr->first;
mSpellChains[addedSpell].first = GetSpellInfo(lastSpell);
mSpellChains[addedSpell].last = GetSpellInfo(rankChain.back().first);
@@ -1257,7 +1251,7 @@ void SpellMgr::LoadSpellRanks()
while (true);
} while (!finished);
- sLog->outString(">> Loaded %u spell rank records in %u ms", rows, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outString(">> Loaded %u spell rank records in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog->outString();
}
@@ -1273,19 +1267,19 @@ void SpellMgr::LoadSpellRequired()
if (!result)
{
- sLog->outString(">> Loaded 0 spell required records");
+ sLog->outString(">> Loaded 0 spell required records. DB table `spell_required` is empty.");
sLog->outString();
- sLog->outErrorDb("`spell_required` table is empty!");
return;
}
- uint32 rows = 0;
+ uint32 count = 0;
do
{
Field* fields = result->Fetch();
uint32 spell_id = fields[0].GetUInt32();
uint32 spell_req = fields[1].GetUInt32();
+
// check if chain is made with valid first spell
SpellInfo const* spell = GetSpellInfo(spell_id);
if (!spell)
@@ -1293,17 +1287,20 @@ void SpellMgr::LoadSpellRequired()
sLog->outErrorDb("spell_id %u in `spell_required` table is not found in dbcs, skipped", spell_id);
continue;
}
+
SpellInfo const* req_spell = GetSpellInfo(spell_req);
if (!req_spell)
{
sLog->outErrorDb("req_spell %u in `spell_required` table is not found in dbcs, skipped", spell_req);
continue;
}
+
if (GetFirstSpellInChain(spell_id) == GetFirstSpellInChain(spell_req))
{
sLog->outErrorDb("req_spell %u and spell_id %u in `spell_required` table are ranks of the same spell, entry not needed, skipped", spell_req, spell_id);
continue;
}
+
if (IsSpellRequiringSpell(spell_id, spell_req))
{
sLog->outErrorDb("duplicated entry of req_spell %u and spell_id %u in `spell_required`, skipped", spell_req, spell_id);
@@ -1312,10 +1309,10 @@ void SpellMgr::LoadSpellRequired()
mSpellReq.insert (std::pair<uint32, uint32>(spell_id, spell_req));
mSpellsReqSpell.insert (std::pair<uint32, uint32>(spell_req, spell_id));
- ++rows;
+ ++count;
} while (result->NextRow());
- sLog->outString(">> Loaded %u spell required records in %u ms", rows, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outString(">> Loaded %u spell required records in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog->outString();
}
@@ -1367,14 +1364,12 @@ void SpellMgr::LoadSpellLearnSpells()
QueryResult result = WorldDatabase.Query("SELECT entry, SpellID, Active FROM spell_learn_spell");
if (!result)
{
- sLog->outString(">> Loaded 0 spell learn spells");
+ sLog->outString(">> Loaded 0 spell learn spells. DB table `spell_learn_spell` is empty.");
sLog->outString();
- sLog->outErrorDb("`spell_learn_spell` table is empty!");
return;
}
uint32 count = 0;
-
do
{
Field* fields = result->Fetch();
@@ -1382,9 +1377,9 @@ void SpellMgr::LoadSpellLearnSpells()
uint32 spell_id = fields[0].GetUInt16();
SpellLearnSpellNode node;
- node.spell = fields[1].GetUInt16();
- node.active = fields[2].GetBool();
- node.autoLearned= false;
+ node.spell = fields[1].GetUInt16();
+ node.active = fields[2].GetBool();
+ node.autoLearned = false;
if (!GetSpellInfo(spell_id))
{
@@ -1478,7 +1473,6 @@ void SpellMgr::LoadSpellTargetPositions()
}
uint32 count = 0;
-
do
{
Field* fields = result->Fetch();
@@ -1590,19 +1584,17 @@ void SpellMgr::LoadSpellGroups()
mSpellSpellGroup.clear(); // need for reload case
mSpellGroupSpell.clear();
- uint32 count = 0;
-
// 0 1
QueryResult result = WorldDatabase.Query("SELECT id, spell_id FROM spell_group");
if (!result)
{
+ sLog->outString(">> Loaded 0 spell group definitions. DB table `spell_group` is empty.");
sLog->outString();
- sLog->outString(">> Loaded %u spell group definitions", count);
return;
}
std::set<uint32> groups;
-
+ uint32 count = 0;
do
{
Field* fields = result->Fetch();
@@ -1620,7 +1612,7 @@ void SpellMgr::LoadSpellGroups()
} while (result->NextRow());
- for (SpellGroupSpellMap::iterator itr = mSpellGroupSpell.begin(); itr!= mSpellGroupSpell.end() ;)
+ for (SpellGroupSpellMap::iterator itr = mSpellGroupSpell.begin(); itr!= mSpellGroupSpell.end();)
{
if (itr->second < 0)
{
@@ -1651,12 +1643,12 @@ void SpellMgr::LoadSpellGroups()
}
}
- for (std::set<uint32>::iterator groupItr = groups.begin() ; groupItr != groups.end() ; ++groupItr)
+ for (std::set<uint32>::iterator groupItr = groups.begin(); groupItr != groups.end(); ++groupItr)
{
std::set<uint32> spells;
GetSetOfSpellsInSpellGroup(SpellGroup(*groupItr), spells);
- for (std::set<uint32>::iterator spellItr = spells.begin() ; spellItr != spells.end() ; ++spellItr)
+ for (std::set<uint32>::iterator spellItr = spells.begin(); spellItr != spells.end(); ++spellItr)
{
++count;
mSpellSpellGroup.insert(SpellSpellGroupMap::value_type(*spellItr, SpellGroup(*groupItr)));
@@ -1673,17 +1665,16 @@ void SpellMgr::LoadSpellGroupStackRules()
mSpellGroupStack.clear(); // need for reload case
- uint32 count = 0;
-
// 0 1
QueryResult result = WorldDatabase.Query("SELECT group_id, stack_rule FROM spell_group_stack_rules");
if (!result)
{
- sLog->outString(">> Loaded 0 spell group stack rules");
+ sLog->outString(">> Loaded 0 spell group stack rules. DB table `spell_group_stack_rules` is empty.");
sLog->outString();
return;
}
+ uint32 count = 0;
do
{
Field* fields = result->Fetch();
@@ -1719,17 +1710,16 @@ void SpellMgr::LoadSpellProcEvents()
mSpellProcEventMap.clear(); // need for reload case
- uint32 count = 0;
-
// 0 1 2 3 4 5 6 7 8 9 10
QueryResult result = WorldDatabase.Query("SELECT entry, SchoolMask, SpellFamilyName, SpellFamilyMask0, SpellFamilyMask1, SpellFamilyMask2, procFlags, procEx, ppmRate, CustomChance, Cooldown FROM spell_proc_event");
if (!result)
{
- sLog->outString(">> Loaded %u spell proc event conditions", count);
+ sLog->outString(">> Loaded 0 spell proc event conditions. DB table `spell_proc_event` is empty.");
sLog->outString();
return;
}
+ uint32 count = 0;
uint32 customProc = 0;
do
{
@@ -1784,17 +1774,16 @@ void SpellMgr::LoadSpellProcs()
mSpellProcMap.clear(); // need for reload case
- uint32 count = 0;
-
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
QueryResult result = WorldDatabase.Query("SELECT spellId, schoolMask, spellFamilyName, spellFamilyMask0, spellFamilyMask1, spellFamilyMask2, typeMask, spellTypeMask, spellPhaseMask, hitMask, attributesMask, ratePerMinute, chance, cooldown, charges FROM spell_proc");
if (!result)
{
- sLog->outString(">> Loaded %u spell proc conditions and data", count);
+ sLog->outString(">> Loaded 0 spell proc conditions and data. DB table `spell_proc` is empty.");
sLog->outString();
return;
}
+ uint32 count = 0;
do
{
Field* fields = result->Fetch();
@@ -1925,16 +1914,17 @@ void SpellMgr::LoadSpellBonusess()
uint32 oldMSTime = getMSTime();
mSpellBonusMap.clear(); // need for reload case
- uint32 count = 0;
+
// 0 1 2 3 4
QueryResult result = WorldDatabase.Query("SELECT entry, direct_bonus, dot_bonus, ap_bonus, ap_dot_bonus FROM spell_bonus_data");
if (!result)
{
- sLog->outString(">> Loaded %u spell bonus data", count);
+ sLog->outString(">> Loaded 0 spell bonus data. DB table `spell_bonus_data` is empty.");
sLog->outString();
return;
}
+ uint32 count = 0;
do
{
Field* fields = result->Fetch();
@@ -1966,17 +1956,16 @@ void SpellMgr::LoadSpellThreats()
mSpellThreatMap.clear(); // need for reload case
- uint32 count = 0;
-
// 0 1 2 3
QueryResult result = WorldDatabase.Query("SELECT entry, flatMod, pctMod, apPctMod FROM spell_threat");
if (!result)
{
- sLog->outString(">> Loaded 0 aggro generating spells");
+ sLog->outString(">> Loaded 0 aggro generating spells. DB table `spell_threat` is empty.");
sLog->outString();
return;
}
+ uint32 count = 0;
do
{
Field* fields = result->Fetch();
@@ -2040,7 +2029,6 @@ void SpellMgr::LoadSpellPetAuras()
}
uint32 count = 0;
-
do
{
Field* fields = result->Fetch();
@@ -2095,11 +2083,10 @@ void SpellMgr::LoadEnchantCustomAttr()
uint32 size = sSpellItemEnchantmentStore.GetNumRows();
mEnchantCustomAttr.resize(size);
- uint32 count = 0;
-
for (uint32 i = 0; i < size; ++i)
mEnchantCustomAttr[i] = 0;
+ uint32 count = 0;
for (uint32 i = 0; i < GetSpellInfoStoreSize(); ++i)
{
SpellInfo const* spellInfo = GetSpellInfo(i);
@@ -2135,17 +2122,16 @@ void SpellMgr::LoadSpellEnchantProcData()
mSpellEnchantProcEventMap.clear(); // need for reload case
- uint32 count = 0;
-
// 0 1 2 3
QueryResult result = WorldDatabase.Query("SELECT entry, customChance, PPMChance, procEx FROM spell_enchant_proc_data");
if (!result)
{
- sLog->outString(">> Loaded %u spell enchant proc event conditions", count);
+ sLog->outString(">> Loaded 0 spell enchant proc event conditions. DB table `spell_enchant_proc_data` is empty.");
sLog->outString();
return;
}
+ uint32 count = 0;
do
{
Field* fields = result->Fetch();
@@ -2190,7 +2176,6 @@ void SpellMgr::LoadSpellLinked()
}
uint32 count = 0;
-
do
{
Field* fields = result->Fetch();
@@ -2435,7 +2420,6 @@ void SpellMgr::LoadSpellAreas()
}
uint32 count = 0;
-
do
{
Field* fields = result->Fetch();
diff --git a/src/server/game/Spells/SpellMgr.h b/src/server/game/Spells/SpellMgr.h
index 9fffd474651..521070f7879 100755
--- a/src/server/game/Spells/SpellMgr.h
+++ b/src/server/game/Spells/SpellMgr.h
@@ -693,7 +693,6 @@ class SpellMgr
public:
// Loading data at server startup
- void LoadSpellInfos();
void LoadSpellRanks();
void LoadSpellRequired();
void LoadSpellLearnSkills();
diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp
index f4eff49f439..a842c288c89 100755
--- a/src/server/game/World/World.cpp
+++ b/src/server/game/World/World.cpp
@@ -207,6 +207,7 @@ bool World::RemoveSession(uint32 id)
{
if (itr->second->PlayerLoading())
return false;
+
itr->second->KickPlayer();
}
@@ -218,8 +219,7 @@ void World::AddSession(WorldSession* s)
addSessQueue.add(s);
}
-void
-World::AddSession_(WorldSession* s)
+void World::AddSession_(WorldSession* s)
{
ASSERT (s);
@@ -272,11 +272,8 @@ World::AddSession_(WorldSession* s)
}
s->SendAuthResponse(AUTH_OK, true);
-
s->SendAddonsInfo();
-
s->SendClientCacheVersion(sWorld->getIntConfig(CONFIG_CLIENTCACHE_VERSION));
-
s->SendTutorialsData();
UpdateMaxSessionCounters();