aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/bindings/scripts/include/sc_creature.cpp96
-rw-r--r--src/bindings/scripts/include/sc_creature.h12
-rw-r--r--src/bindings/scripts/scripts/world/go_scripts.cpp2
-rw-r--r--src/bindings/scripts/scripts/world/item_scripts.cpp18
-rw-r--r--src/game/GridNotifiers.h4
-rw-r--r--src/game/Object.cpp54
-rw-r--r--src/game/Object.h6
-rw-r--r--src/game/SpellEffects.cpp22
-rw-r--r--src/game/SpellMgr.h26
9 files changed, 83 insertions, 157 deletions
diff --git a/src/bindings/scripts/include/sc_creature.cpp b/src/bindings/scripts/include/sc_creature.cpp
index 9f643eae30d..bb4d3e68888 100644
--- a/src/bindings/scripts/include/sc_creature.cpp
+++ b/src/bindings/scripts/include/sc_creature.cpp
@@ -637,50 +637,50 @@ void BossAI::TeleportCheaters()
float x, y, z;
me->GetPosition(x, y, z);
std::list<HostilReference*> &m_threatlist = me->getThreatManager().getThreatList();
- for (std::list<HostilReference*>::iterator itr = m_threatlist.begin(); itr!= m_threatlist.end(); ++itr)
+ for (std::list<HostilReference*>::iterator itr = m_threatlist.begin(); itr != m_threatlist.end(); ++itr)
if((*itr)->getTarget()->GetTypeId() == TYPEID_PLAYER && !CheckBoundary((*itr)->getTarget()))
(*itr)->getTarget()->NearTeleportTo(x, y, z, 0);
}
bool BossAI::CheckBoundary(Unit *who)
{
- if(!boundary || !who)
+ if (!boundary || !who)
return true;
for (BossBoundaryMap::const_iterator itr = boundary->begin(); itr != boundary->end(); ++itr)
{
- switch(itr->first)
+ switch (itr->first)
{
case BOUNDARY_N:
- if(me->GetPositionX() > itr->second)
+ if (me->GetPositionX() > itr->second)
return false;
break;
case BOUNDARY_S:
- if(me->GetPositionX() < itr->second)
+ if (me->GetPositionX() < itr->second)
return false;
break;
case BOUNDARY_E:
- if(me->GetPositionY() < itr->second)
+ if (me->GetPositionY() < itr->second)
return false;
break;
case BOUNDARY_W:
- if(me->GetPositionY() > itr->second)
+ if (me->GetPositionY() > itr->second)
return false;
break;
case BOUNDARY_NW:
- if(me->GetPositionX() + me->GetPositionY() > itr->second)
+ if (me->GetPositionX() + me->GetPositionY() > itr->second)
return false;
break;
case BOUNDARY_SE:
- if(me->GetPositionX() + me->GetPositionY() < itr->second)
+ if (me->GetPositionX() + me->GetPositionY() < itr->second)
return false;
break;
case BOUNDARY_NE:
- if(me->GetPositionX() - me->GetPositionY() > itr->second)
+ if (me->GetPositionX() - me->GetPositionY() > itr->second)
return false;
break;
case BOUNDARY_SW:
- if(me->GetPositionX() - me->GetPositionY() < itr->second)
+ if (me->GetPositionX() - me->GetPositionY() < itr->second)
return false;
break;
}
@@ -752,76 +752,20 @@ void LoadOverridenDBCData()
}
}
-//return closest GO in grid, with range from pSource
-GameObject* GetClosestGameObjectWithEntry(WorldObject* pSource, uint32 uiEntry, float fMaxSearchRange)
+// SD2 grid searchers.
+Creature *GetClosestCreatureWithEntry(WorldObject *pSource, uint32 uiEntry, float fMaxSearchRange, bool bAlive)
{
- GameObject* pGo = NULL;
-
- CellPair pair(MaNGOS::ComputeCellPair(pSource->GetPositionX(), pSource->GetPositionY()));
- Cell cell(pair);
- cell.data.Part.reserved = ALL_DISTRICT;
- cell.SetNoCreate();
-
- MaNGOS::NearestGameObjectEntryInObjectRangeCheck go_check(*pSource, uiEntry, fMaxSearchRange);
- MaNGOS::GameObjectLastSearcher<MaNGOS::NearestGameObjectEntryInObjectRangeCheck> searcher(pSource, pGo, go_check);
-
- TypeContainerVisitor<MaNGOS::GameObjectLastSearcher<MaNGOS::NearestGameObjectEntryInObjectRangeCheck>, GridTypeMapContainer> go_searcher(searcher);
-
- CellLock<GridReadGuard> cell_lock(cell, pair);
- cell_lock->Visit(cell_lock, go_searcher, *pSource->GetMap(), *pSource, fMaxSearchRange);
-
- return pGo;
+ return pSource->FindNearestCreature(uiEntry, fMaxSearchRange, bAlive);
}
-
-//return closest creature alive in grid, with range from pSource
-Creature* GetClosestCreatureWithEntry(WorldObject* pSource, uint32 uiEntry, float fMaxSearchRange)
+GameObject *GetClosestGameObjectWithEntry(WorldObject *pSource, uint32 uiEntry, float fMaxSearchRange)
{
- Creature* pCreature = NULL;
-
- CellPair pair(MaNGOS::ComputeCellPair(pSource->GetPositionX(), pSource->GetPositionY()));
- Cell cell(pair);
- cell.data.Part.reserved = ALL_DISTRICT;
- cell.SetNoCreate();
-
- MaNGOS::NearestCreatureEntryWithLiveStateInObjectRangeCheck creature_check(*pSource, uiEntry, true, fMaxSearchRange);
- MaNGOS::CreatureLastSearcher<MaNGOS::NearestCreatureEntryWithLiveStateInObjectRangeCheck> searcher(pSource, pCreature, creature_check);
-
- TypeContainerVisitor<MaNGOS::CreatureLastSearcher<MaNGOS::NearestCreatureEntryWithLiveStateInObjectRangeCheck>, GridTypeMapContainer> creature_searcher(searcher);
-
- CellLock<GridReadGuard> cell_lock(cell, pair);
- cell_lock->Visit(cell_lock, creature_searcher,*(pSource->GetMap()), *pSource, fMaxSearchRange);
-
- return pCreature;
+ return pSource->FindNearestGameObject(uiEntry, fMaxSearchRange);
}
-
-/*
-void GetGameObjectListWithEntryInGrid(std::list<GameObject*>& lList , WorldObject* pSource, uint32 uiEntry, float fMaxSearchRange)
+void GetCreatureListWithEntryInGrid(std::list<Creature*>& lList, WorldObject *pSource, uint32 uiEntry, float fMaxSearchRange)
{
- CellPair pair(MaNGOS::ComputeCellPair(pSource->GetPositionX(), pSource->GetPositionY()));
- Cell cell(pair);
- cell.data.Part.reserved = ALL_DISTRICT;
- cell.SetNoCreate();
-
- AllGameObjectsWithEntryInRange check(pSource, uiEntry, fMaxSearchRange);
- MaNGOS::GameObjectListSearcher<AllGameObjectsWithEntryInRange> searcher(pSource, lList, check);
- TypeContainerVisitor<MaNGOS::GameObjectListSearcher<AllGameObjectsWithEntryInRange>, GridTypeMapContainer> visitor(searcher);
-
- CellLock<GridReadGuard> cell_lock(cell, pair);
- cell_lock->Visit(cell_lock, visitor, *(pSource->GetMap()), *pSource, fMaxSearchRange);
+ return pSource->GetCreatureListWithEntryInGrid(lList, uiEntry, fMaxSearchRange);
}
-
-void GetCreatureListWithEntryInGrid(std::list<Creature*>& lList, WorldObject* pSource, uint32 uiEntry, float fMaxSearchRange)
+void GetGameObjectListWithEntryInGrid(std::list<GameObject*>& lList, WorldObject *pSource, uint32 uiEntry, float fMaxSearchRange)
{
- CellPair pair(MaNGOS::ComputeCellPair(pSource->GetPositionX(), pSource->GetPositionY()));
- Cell cell(pair);
- cell.data.Part.reserved = ALL_DISTRICT;
- cell.SetNoCreate();
-
- AllCreaturesOfEntryInRange check(pSource, uiEntry, fMaxSearchRange);
- MaNGOS::CreatureListSearcher<AllCreaturesOfEntryInRange> searcher(pSource, lList, check);
- TypeContainerVisitor<MaNGOS::CreatureListSearcher<AllCreaturesOfEntryInRange>, GridTypeMapContainer> visitor(searcher);
-
- CellLock<GridReadGuard> cell_lock(cell, pair);
- cell_lock->Visit(cell_lock, visitor, *(pSource->GetMap()), *pSource, fMaxSearchRange);
+ return pSource->GetGameObjectListWithEntryInGrid(lList, uiEntry, fMaxSearchRange);
}
-*/
diff --git a/src/bindings/scripts/include/sc_creature.h b/src/bindings/scripts/include/sc_creature.h
index 4b461296775..fdeea02997c 100644
--- a/src/bindings/scripts/include/sc_creature.h
+++ b/src/bindings/scripts/include/sc_creature.h
@@ -221,13 +221,11 @@ struct TRINITY_DLL_DECL BossAI : public ScriptedAI
void TeleportCheaters();
};
-// SD2's grid searchers
-
-//return closest gameobject in grid, with range from pSource
-GameObject* GetClosestGameObjectWithEntry(WorldObject *pSource, uint32 uiEntry, float fMaxSearchRange);
-
-//return closest creature alive in grid, with range from pSource
-Creature* GetClosestCreatureWithEntry(WorldObject *pSource, uint32 Entry, float fMaxSearchRange);
+// SD2 grid searchers.
+Creature *GetClosestCreatureWithEntry(WorldObject *pSource, uint32 uiEntry, float fMaxSearchRange, bool bAlive = true);
+GameObject *GetClosestGameObjectWithEntry(WorldObject *pSource, uint32 uiEntry, float fMaxSearchRange);
+void GetCreatureListWithEntryInGrid(std::list<Creature*>& lList, WorldObject* pSource, uint32 uiEntry, float fMaxSearchRange);
+void GetGameObjectListWithEntryInGrid(std::list<GameObject*>& lList, WorldObject* pSource, uint32 uiEntry, float fMaxSearchRange);
#endif
diff --git a/src/bindings/scripts/scripts/world/go_scripts.cpp b/src/bindings/scripts/scripts/world/go_scripts.cpp
index 9f6b90f6af0..052310ad057 100644
--- a/src/bindings/scripts/scripts/world/go_scripts.cpp
+++ b/src/bindings/scripts/scripts/world/go_scripts.cpp
@@ -521,7 +521,7 @@ bool GOHello_go_matrix_punchograph(Player *pPlayer, GameObject *pGO)
if(pPlayer->HasItemCount(ITEM_RED_PUNCH_CARD, 1))
{
pPlayer->DestroyItemCount(ITEM_RED_PUNCH_CARD, 1, true);
- pPlayer->CastSpell(pPlayer,SPELL_PRISMATIC_PUNCH_CARD,true);
+ pPlayer->CastSpell(pPlayer, SPELL_PRISMATIC_PUNCH_CARD, true);
}
break;
default:
diff --git a/src/bindings/scripts/scripts/world/item_scripts.cpp b/src/bindings/scripts/scripts/world/item_scripts.cpp
index 0c3b470ce1d..04654be37b5 100644
--- a/src/bindings/scripts/scripts/world/item_scripts.cpp
+++ b/src/bindings/scripts/scripts/world/item_scripts.cpp
@@ -148,7 +148,7 @@ bool ItemUse_item_flying_machine(Player* pPlayer, Item* pItem, SpellCastTargets
# item_gor_dreks_ointment
#####*/
-bool ItemUse_item_gor_dreks_ointment(Player* pPlayer, Item* pItem, SpellCastTargets const& targets)
+bool ItemUse_item_gor_dreks_ointment(Player *pPlayer, Item *pItem, SpellCastTargets const& targets)
{
if (targets.getUnitTarget() && targets.getUnitTarget()->GetTypeId() == TYPEID_UNIT &&
targets.getUnitTarget()->GetEntry() == 20748 && !targets.getUnitTarget()->HasAura(32578))
@@ -162,7 +162,7 @@ bool ItemUse_item_gor_dreks_ointment(Player* pPlayer, Item* pItem, SpellCastTarg
# item_incendiary_explosives
#####*/
-bool ItemUse_item_incendiary_explosives(Player* pPlayer, Item* pItem, SpellCastTargets const& targets)
+bool ItemUse_item_incendiary_explosives(Player *pPlayer, Item *pItem, SpellCastTargets const &targets)
{
if (pPlayer->FindNearestCreature(26248,15) || pPlayer->FindNearestCreature(26249,15))
return false;
@@ -177,7 +177,7 @@ bool ItemUse_item_incendiary_explosives(Player* pPlayer, Item* pItem, SpellCastT
# item_mysterious_egg
#####*/
-bool ItemExpire_item_mysterious_egg(Player* pPlayer, ItemPrototype const * pItemProto)
+bool ItemExpire_item_mysterious_egg(Player *pPlayer, ItemPrototype const *pItemProto)
{
ItemPosCountVec dest;
uint8 msg = pPlayer->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, 39883, 1); // Cracked Egg
@@ -191,7 +191,7 @@ bool ItemExpire_item_mysterious_egg(Player* pPlayer, ItemPrototype const * pItem
# item_disgusting_jar
#####*/
-bool ItemExpire_item_disgusting_jar(Player* pPlayer, ItemPrototype const * pItemProto)
+bool ItemExpire_item_disgusting_jar(Player *pPlayer, ItemPrototype const *pItemProto)
{
ItemPosCountVec dest;
uint8 msg = pPlayer->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, 44718, 1); // Ripe Disgusting Jar
@@ -226,8 +226,7 @@ bool ItemUse_item_harvesters_gift(Player* pPlayer, Item* pItem, SpellCastTargets
else
return false;
}
- else
- return true;
+ return true;
}
/*#####
@@ -254,7 +253,7 @@ enum ePileFakeFur
GO_HIGH_QUALITY_FUR = 187983,
NPC_NESINGWARY_TRAPPER = 25835
};
-bool ItemUse_item_pile_fake_furs(Player* pPlayer, Item* _Item, SpellCastTargets const& targets)
+bool ItemUse_item_pile_fake_furs(Player *pPlayer, Item *pItem, SpellCastTargets const &targets)
{
GameObject* pGo;
if ((pGo = pPlayer->FindNearestGameObject(GO_CARIBOU_TRAP_1, 5.0f)) ||
@@ -273,7 +272,7 @@ bool ItemUse_item_pile_fake_furs(Player* pPlayer, Item* _Item, SpellCastTargets
(pGo = pPlayer->FindNearestGameObject(GO_CARIBOU_TRAP_14, 5.0f)) ||
(pGo = pPlayer->FindNearestGameObject(GO_CARIBOU_TRAP_15, 5.0f)))
{
- if (pGo->FindNearestCreature(NPC_NESINGWARY_TRAPPER,10.0f,true) || pGo->FindNearestCreature(NPC_NESINGWARY_TRAPPER,10.0f,false) || pGo->FindNearestGameObject(GO_HIGH_QUALITY_FUR,2.0f))
+ if (pGo->FindNearestCreature(NPC_NESINGWARY_TRAPPER, 10.0f, true) || pGo->FindNearestCreature(NPC_NESINGWARY_TRAPPER, 10.0f, false) || pGo->FindNearestGameObject(GO_HIGH_QUALITY_FUR, 2.0f))
return true;
float x, y, z;
pGo->GetClosePoint(x, y, z, pGo->GetObjectSize() / 3, 7.0f);
@@ -284,8 +283,7 @@ bool ItemUse_item_pile_fake_furs(Player* pPlayer, Item* _Item, SpellCastTargets
summon->SetReactState(REACT_PASSIVE);
summon->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE);
}
- } else
- return true;
+ }
}
void AddSC_item_scripts()
diff --git a/src/game/GridNotifiers.h b/src/game/GridNotifiers.h
index 424be2121d2..ed6232b101f 100644
--- a/src/game/GridNotifiers.h
+++ b/src/game/GridNotifiers.h
@@ -1072,12 +1072,12 @@ namespace Trinity
class NearestCreatureEntryWithLiveStateInObjectRangeCheck
{
public:
- NearestCreatureEntryWithLiveStateInObjectRangeCheck(WorldObject const& obj,uint32 entry, bool alive, float range)
+ NearestCreatureEntryWithLiveStateInObjectRangeCheck(WorldObject const& obj, uint32 entry, bool alive, float range)
: i_obj(obj), i_entry(entry), i_alive(alive), i_range(range) {}
bool operator()(Creature* u)
{
- if(u->GetEntry() == i_entry && u->isAlive()==i_alive && i_obj.IsWithinDistInMap(u, i_range))
+ if (u->GetEntry() == i_entry && u->isAlive() == i_alive && i_obj.IsWithinDistInMap(u, i_range))
{
i_range = i_obj.GetDistance(u); // use found unit range as new range limit for next check
return true;
diff --git a/src/game/Object.cpp b/src/game/Object.cpp
index bfca0c91861..68f7d08be68 100644
--- a/src/game/Object.cpp
+++ b/src/game/Object.cpp
@@ -1931,52 +1931,38 @@ Creature* WorldObject::SummonTrigger(float x, float y, float z, float ang, uint3
return summon;
}
-Creature* WorldObject::FindNearestCreature(uint32 entry, float range, bool alive)
+Creature* WorldObject::FindNearestCreature(uint32 uiEntry, float fMaxSearchRange, bool bAlive)
{
- Creature *creature = NULL;
- Trinity::NearestCreatureEntryWithLiveStateInObjectRangeCheck checker(*this, entry, alive, range);
- Trinity::CreatureLastSearcher<Trinity::NearestCreatureEntryWithLiveStateInObjectRangeCheck> searcher(this, creature, checker);
- VisitNearbyObject(range, searcher);
- return creature;
+ Creature *pCreature = NULL;
+ Trinity::NearestCreatureEntryWithLiveStateInObjectRangeCheck checker(*this, uiEntry, bAlive, fMaxSearchRange);
+ Trinity::CreatureLastSearcher<Trinity::NearestCreatureEntryWithLiveStateInObjectRangeCheck> searcher(this, pCreature, checker);
+ VisitNearbyObject(fMaxSearchRange, searcher);
+ return pCreature;
}
-GameObject* WorldObject::FindNearestGameObject(uint32 entry, float range)
+GameObject* WorldObject::FindNearestGameObject(uint32 uiEntry, float fMaxSearchRange)
{
- GameObject *go = NULL;
- Trinity::NearestGameObjectEntryInObjectRangeCheck checker(*this, entry, range);
- Trinity::GameObjectLastSearcher<Trinity::NearestGameObjectEntryInObjectRangeCheck> searcher(this, go, checker);
- VisitNearbyGridObject(range, searcher);
- return go;
-}
-
-void WorldObject::GetGameObjectListWithEntryInGrid(std::list<GameObject*>& lList, uint32 uiEntry, float fMaxSearchRange)
-{
- CellPair pair(Trinity::ComputeCellPair(this->GetPositionX(), this->GetPositionY()));
- Cell cell(pair);
- cell.data.Part.reserved = ALL_DISTRICT;
- cell.SetNoCreate();
-
- Trinity::AllGameObjectsWithEntryInRange check(this, uiEntry, fMaxSearchRange);
- Trinity::GameObjectListSearcher<Trinity::AllGameObjectsWithEntryInRange> searcher(this, lList, check);
- TypeContainerVisitor<Trinity::GameObjectListSearcher<Trinity::AllGameObjectsWithEntryInRange>, GridTypeMapContainer> visitor(searcher);
-
- CellLock<GridReadGuard> cell_lock(cell, pair);
- cell_lock->Visit(cell_lock, visitor, *(this->GetMap()));
+ GameObject *pGO = NULL;
+ Trinity::NearestGameObjectEntryInObjectRangeCheck checker(*this, uiEntry, fMaxSearchRange);
+ Trinity::GameObjectLastSearcher<Trinity::NearestGameObjectEntryInObjectRangeCheck> searcher(this, pGO, checker);
+ VisitNearbyGridObject(fMaxSearchRange, searcher);
+ return pGO;
}
void WorldObject::GetCreatureListWithEntryInGrid(std::list<Creature*>& lList, uint32 uiEntry, float fMaxSearchRange)
{
- CellPair pair(Trinity::ComputeCellPair(this->GetPositionX(), this->GetPositionY()));
- Cell cell(pair);
- cell.data.Part.reserved = ALL_DISTRICT;
- cell.SetNoCreate();
-
Trinity::AllCreaturesOfEntryInRange check(this, uiEntry, fMaxSearchRange);
Trinity::CreatureListSearcher<Trinity::AllCreaturesOfEntryInRange> searcher(this, lList, check);
TypeContainerVisitor<Trinity::CreatureListSearcher<Trinity::AllCreaturesOfEntryInRange>, GridTypeMapContainer> visitor(searcher);
+ VisitNearbyObject(fMaxSearchRange, searcher);
+}
- CellLock<GridReadGuard> cell_lock(cell, pair);
- cell_lock->Visit(cell_lock, visitor, *(this->GetMap()));
+void WorldObject::GetGameObjectListWithEntryInGrid(std::list<GameObject*>& lList, uint32 uiEntry, float fMaxSearchRange)
+{
+ Trinity::AllGameObjectsWithEntryInRange check(this, uiEntry, fMaxSearchRange);
+ Trinity::GameObjectListSearcher<Trinity::AllGameObjectsWithEntryInRange> searcher(this, lList, check);
+ TypeContainerVisitor<Trinity::GameObjectListSearcher<Trinity::AllGameObjectsWithEntryInRange>, GridTypeMapContainer> visitor(searcher);
+ VisitNearbyGridObject(fMaxSearchRange, searcher);
}
/*
diff --git a/src/game/Object.h b/src/game/Object.h
index 826775500d2..3d07b4625e6 100644
--- a/src/game/Object.h
+++ b/src/game/Object.h
@@ -610,11 +610,11 @@ class TRINITY_DLL_SPEC WorldObject : public Object, public WorldLocation
GameObject* SummonGameObject(uint32 entry, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime);
Creature* SummonTrigger(float x, float y, float z, float ang, uint32 dur, CreatureAI* (*GetAI)(Creature*) = NULL);
- Creature* FindNearestCreature(uint32 entry, float range, bool alive = true);
- GameObject* FindNearestGameObject(uint32 entry, float range);
+ Creature* FindNearestCreature(uint32 uiEntry, float fMaxSearchRange, bool bAlive = true);
+ GameObject* FindNearestGameObject(uint32 uiEntry, float fMaxSearchRange);
- void GetGameObjectListWithEntryInGrid(std::list<GameObject*>& lList, uint32 uiEntry, float fMaxSearchRange);
void GetCreatureListWithEntryInGrid(std::list<Creature*>& lList, uint32 uiEntry, float fMaxSearchRange);
+ void GetGameObjectListWithEntryInGrid(std::list<GameObject*>& lList, uint32 uiEntry, float fMaxSearchRange);
void DestroyForNearbyPlayers();
diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp
index fb4c36ced1a..538a945ee26 100644
--- a/src/game/SpellEffects.cpp
+++ b/src/game/SpellEffects.cpp
@@ -4637,10 +4637,10 @@ void Spell::SpellDamageWeaponDmg(uint32 i)
}
bool normalized = false;
- float weaponDamagePercentMod = 1.0;
- for (int j = 0; j < 3; ++j)
+ float weaponDamagePercentMod = 1.0f;
+ for (uint8 j = 0; j < 3; ++j)
{
- switch(m_spellInfo->Effect[j])
+ switch (m_spellInfo->Effect[j])
{
case SPELL_EFFECT_WEAPON_DAMAGE:
case SPELL_EFFECT_WEAPON_DAMAGE_NOSCHOOL:
@@ -4659,10 +4659,10 @@ void Spell::SpellDamageWeaponDmg(uint32 i)
}
// apply to non-weapon bonus weapon total pct effect, weapon total flat effect included in weapon damage
- if(fixed_bonus || spell_bonus)
+ if (fixed_bonus || spell_bonus)
{
UnitMods unitMod;
- switch(m_attackType)
+ switch (m_attackType)
{
default:
case BASE_ATTACK: unitMod = UNIT_MOD_DAMAGE_MAINHAND; break;
@@ -4671,23 +4671,23 @@ void Spell::SpellDamageWeaponDmg(uint32 i)
}
float weapon_total_pct = 1.0f;
- if ( m_spellInfo->SchoolMask & SPELL_SCHOOL_MASK_NORMAL )
+ if (m_spellInfo->SchoolMask & SPELL_SCHOOL_MASK_NORMAL)
weapon_total_pct = m_caster->GetModifierValue(unitMod, TOTAL_PCT);
- if(fixed_bonus)
+ if (fixed_bonus)
fixed_bonus = int32(fixed_bonus * weapon_total_pct);
- if(spell_bonus)
+ if (spell_bonus)
spell_bonus = int32(spell_bonus * weapon_total_pct);
}
int32 weaponDamage = m_caster->CalculateDamage(m_attackType, normalized, true);
// Sequence is important
- for (int j = 0; j < 3; ++j)
+ for (uint8 j = 0; j < 3; ++j)
{
// We assume that a spell have at most one fixed_bonus
// and at most one weaponDamagePercentMod
- switch(m_spellInfo->Effect[j])
+ switch (m_spellInfo->Effect[j])
{
case SPELL_EFFECT_WEAPON_DAMAGE:
case SPELL_EFFECT_WEAPON_DAMAGE_NOSCHOOL:
@@ -4714,7 +4714,7 @@ void Spell::SpellDamageWeaponDmg(uint32 i)
// Add melee damage bonuses (also check for negative)
m_caster->MeleeDamageBonus(unitTarget, &eff_damage, m_attackType, m_spellInfo);
- m_damage+= eff_damage;
+ m_damage += eff_damage;
}
void Spell::EffectThreat(uint32 /*i*/)
diff --git a/src/game/SpellMgr.h b/src/game/SpellMgr.h
index da5a6affde7..b3f98ec7fe3 100644
--- a/src/game/SpellMgr.h
+++ b/src/game/SpellMgr.h
@@ -810,7 +810,7 @@ class SpellMgr
uint32 GetSpellElixirMask(uint32 spellid) const
{
SpellElixirMap::const_iterator itr = mSpellElixirs.find(spellid);
- if(itr==mSpellElixirs.end())
+ if (itr == mSpellElixirs.end())
return 0x0;
return itr->second;
@@ -819,13 +819,13 @@ class SpellMgr
SpellSpecific GetSpellElixirSpecific(uint32 spellid) const
{
uint32 mask = GetSpellElixirMask(spellid);
- if((mask & ELIXIR_FLASK_MASK)==ELIXIR_FLASK_MASK)
+ if ((mask & ELIXIR_FLASK_MASK) == ELIXIR_FLASK_MASK)
return SPELL_FLASK_ELIXIR;
- else if(mask & ELIXIR_BATTLE_MASK)
+ else if (mask & ELIXIR_BATTLE_MASK)
return SPELL_BATTLE_ELIXIR;
- else if(mask & ELIXIR_GUARDIAN_MASK)
+ else if (mask & ELIXIR_GUARDIAN_MASK)
return SPELL_GUARDIAN_ELIXIR;
- else if(mask & ELIXIR_WELL_FED)
+ else if (mask & ELIXIR_WELL_FED)
return SPELL_WELL_FED;
else
return SPELL_NORMAL;
@@ -834,7 +834,7 @@ class SpellMgr
uint16 GetSpellThreat(uint32 spellid) const
{
SpellThreatMap::const_iterator itr = mSpellThreatMap.find(spellid);
- if(itr==mSpellThreatMap.end())
+ if (itr == mSpellThreatMap.end())
return 0;
return itr->second;
@@ -844,7 +844,7 @@ class SpellMgr
SpellProcEventEntry const* GetSpellProcEvent(uint32 spellId) const
{
SpellProcEventMap::const_iterator itr = mSpellProcEventMap.find(spellId);
- if( itr != mSpellProcEventMap.end( ) )
+ if (itr != mSpellProcEventMap.end())
return &itr->second;
return NULL;
}
@@ -854,7 +854,7 @@ class SpellMgr
SpellEnchantProcEntry const* GetSpellEnchantProcEvent(uint32 enchId) const
{
SpellEnchantProcEventMap::const_iterator itr = mSpellEnchantProcEventMap.find(enchId);
- if( itr != mSpellEnchantProcEventMap.end( ) )
+ if (itr != mSpellEnchantProcEventMap.end())
return &itr->second;
return NULL;
}
@@ -864,13 +864,13 @@ class SpellMgr
{
// Lookup data
SpellBonusMap::const_iterator itr = mSpellBonusMap.find(spellId);
- if( itr != mSpellBonusMap.end( ) )
+ if (itr != mSpellBonusMap.end())
return &itr->second;
// Not found, try lookup for 1 spell rank if exist
if (uint32 rank_1 = GetFirstSpellInChain(spellId))
{
SpellBonusMap::const_iterator itr2 = mSpellBonusMap.find(rank_1);
- if( itr2 != mSpellBonusMap.end( ) )
+ if (itr2 != mSpellBonusMap.end())
return &itr2->second;
}
return NULL;
@@ -880,7 +880,7 @@ class SpellMgr
SpellTargetPosition const* GetSpellTargetPosition(uint32 spell_id) const
{
SpellTargetPositionMap::const_iterator itr = mSpellTargetPositions.find( spell_id );
- if( itr != mSpellTargetPositions.end( ) )
+ if (itr != mSpellTargetPositions.end())
return &itr->second;
return NULL;
}
@@ -889,7 +889,7 @@ class SpellMgr
SpellChainNode const* GetSpellChainNode(uint32 spell_id) const
{
SpellChainMap::const_iterator itr = mSpellChains.find(spell_id);
- if(itr == mSpellChains.end())
+ if (itr == mSpellChains.end())
return NULL;
return &itr->second;
@@ -1009,7 +1009,7 @@ class SpellMgr
{
SpellLearnSpellMapBounds bounds = GetSpellLearnSpellMapBounds(spell_id1);
for (SpellLearnSpellMap::const_iterator i = bounds.first; i != bounds.second; ++i)
- if (i->second.spell==spell_id2)
+ if (i->second.spell == spell_id2)
return true;
return false;
}