diff options
author | Shauren <shauren.trinity@gmail.com> | 2011-03-19 10:54:16 +0100 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2011-03-19 10:54:16 +0100 |
commit | 1a4a618d81067969d7eec3725988a8bf0f845881 (patch) | |
tree | 195d616efde474fc13a65e0ef50f2b2e402eaf70 | |
parent | 6eb5014182a63640e3e3d2a4460aecde83f4d63f (diff) |
Core/Scripts: Code style cleanup in ScriptedAI and BossAI
19 files changed, 266 insertions, 250 deletions
diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp index cf2a491d33f..d72f19f4f29 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp @@ -111,11 +111,11 @@ bool SummonList::HasEntry(uint32 entry) ScriptedAI::ScriptedAI(Creature* pCreature) : CreatureAI(pCreature), me(pCreature), IsFleeing(false), - m_bCombatMovement(true), - m_uiEvadeCheckCooldown(2500) + _isCombatMovementAllowed(true), + _evadeCheckCooldown(2500) { - m_heroicMode = me->GetMap()->IsHeroic(); - m_difficulty = Difficulty(me->GetMap()->GetSpawnMode()); + _isHeroic = me->GetMap()->IsHeroic(); + _difficulty = Difficulty(me->GetMap()->GetSpawnMode()); } void ScriptedAI::AttackStartNoMove(Unit* pWho) @@ -187,15 +187,15 @@ void ScriptedAI::DoPlaySoundToSet(WorldObject* pSource, uint32 uiSoundId) pSource->PlayDirectSound(uiSoundId); } -Creature* ScriptedAI::DoSpawnCreature(uint32 uiId, float fX, float fY, float fZ, float fAngle, uint32 uiType, uint32 uiDespawntime) +Creature* ScriptedAI::DoSpawnCreature(uint32 entry, float offsetX, float offsetY, float offsetZ, float angle, uint32 type, uint32 despawntime) { - return me->SummonCreature(uiId, me->GetPositionX()+fX, me->GetPositionY()+fY, me->GetPositionZ()+fZ, fAngle, (TempSummonType)uiType, uiDespawntime); + return me->SummonCreature(entry, me->GetPositionX() + offsetX, me->GetPositionY() + offsetY, me->GetPositionZ() + offsetZ, angle, TempSummonType(type), despawntime); } -SpellEntry const* ScriptedAI::SelectSpell(Unit* pTarget, uint32 uiSchool, uint32 uiMechanic, SelectTargetType selectTargets, uint32 uiPowerCostMin, uint32 uiPowerCostMax, float fRangeMin, float fRangeMax, SelectEffect selectEffects) +SpellEntry const* ScriptedAI::SelectSpell(Unit* target, uint32 school, uint32 mechanic, SelectTargetType targets, uint32 powerCostMin, uint32 powerCostMax, float rangeMin, float rangeMax, SelectEffect effects) { //No target so we can't cast - if (!pTarget) + if (!target) return false; //Silenced so we can't cast @@ -204,101 +204,101 @@ SpellEntry const* ScriptedAI::SelectSpell(Unit* pTarget, uint32 uiSchool, uint32 //Using the extended script system we first create a list of viable spells SpellEntry const* apSpell[CREATURE_MAX_SPELLS]; - memset(apSpell, 0, sizeof(SpellEntry*)*CREATURE_MAX_SPELLS); + memset(apSpell, 0, CREATURE_MAX_SPELLS * sizeof(SpellEntry*)); - uint32 uiSpellCount = 0; + uint32 spellCount = 0; - SpellEntry const* pTempSpell; - SpellRangeEntry const* pTempRange; + SpellEntry const* tempSpell = NULL; + SpellRangeEntry const* tempRange = NULL; //Check if each spell is viable(set it to null if not) for (uint32 i = 0; i < CREATURE_MAX_SPELLS; i++) { - pTempSpell = GetSpellStore()->LookupEntry(me->m_spells[i]); + tempSpell = sSpellStore.LookupEntry(me->m_spells[i]); //This spell doesn't exist - if (!pTempSpell) + if (!tempSpell) continue; // Targets and Effects checked first as most used restrictions //Check the spell targets if specified - if (selectTargets && !(SpellSummary[me->m_spells[i]].Targets & (1 << (selectTargets-1)))) + if (targets && !(SpellSummary[me->m_spells[i]].Targets & (1 << (targets-1)))) continue; //Check the type of spell if we are looking for a specific spell type - if (selectEffects && !(SpellSummary[me->m_spells[i]].Effects & (1 << (selectEffects-1)))) + if (effects && !(SpellSummary[me->m_spells[i]].Effects & (1 << (effects-1)))) continue; //Check for school if specified - if (uiSchool && (pTempSpell->SchoolMask & uiSchool) == 0) + if (school && (tempSpell->SchoolMask & school) == 0) continue; //Check for spell mechanic if specified - if (uiMechanic && pTempSpell->Mechanic != uiMechanic) + if (mechanic && tempSpell->Mechanic != mechanic) continue; //Make sure that the spell uses the requested amount of power - if (uiPowerCostMin && pTempSpell->manaCost < uiPowerCostMin) + if (powerCostMin && tempSpell->manaCost < powerCostMin) continue; - if (uiPowerCostMax && pTempSpell->manaCost > uiPowerCostMax) + if (powerCostMax && tempSpell->manaCost > powerCostMax) continue; //Continue if we don't have the mana to actually cast this spell - if (pTempSpell->manaCost > me->GetPower((Powers)pTempSpell->powerType)) + if (tempSpell->manaCost > me->GetPower(Powers(tempSpell->powerType))) continue; //Get the Range - pTempRange = GetSpellRangeStore()->LookupEntry(pTempSpell->rangeIndex); + tempRange = GetSpellRangeStore()->LookupEntry(tempSpell->rangeIndex); //Spell has invalid range store so we can't use it - if (!pTempRange) + if (!tempRange) continue; //Check if the spell meets our range requirements - if (fRangeMin && me->GetSpellMinRangeForTarget(pTarget, pTempRange) < fRangeMin) + if (rangeMin && me->GetSpellMinRangeForTarget(target, tempRange) < rangeMin) continue; - if (fRangeMax && me->GetSpellMaxRangeForTarget(pTarget, pTempRange) > fRangeMax) + if (rangeMax && me->GetSpellMaxRangeForTarget(target, tempRange) > rangeMax) continue; //Check if our target is in range - if (me->IsWithinDistInMap(pTarget, (float)me->GetSpellMinRangeForTarget(pTarget, pTempRange)) || !me->IsWithinDistInMap(pTarget, (float)me->GetSpellMaxRangeForTarget(pTarget, pTempRange))) + if (me->IsWithinDistInMap(target, float(me->GetSpellMinRangeForTarget(target, tempRange))) || !me->IsWithinDistInMap(target, float(me->GetSpellMaxRangeForTarget(target, tempRange)))) continue; //All good so lets add it to the spell list - apSpell[uiSpellCount] = pTempSpell; - ++uiSpellCount; + apSpell[spellCount] = tempSpell; + ++spellCount; } //We got our usable spells so now lets randomly pick one - if (!uiSpellCount) + if (!spellCount) return NULL; - return apSpell[rand()%uiSpellCount]; + return apSpell[urand(0, spellCount - 1)]; } -bool ScriptedAI::CanCast(Unit* pTarget, SpellEntry const* pSpell, bool bTriggered) +bool ScriptedAI::CanCast(Unit* target, SpellEntry const* spell, bool triggered /*= false*/) { //No target so we can't cast - if (!pTarget || !pSpell) + if (!target || !spell) return false; //Silenced so we can't cast - if (!bTriggered && me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED)) + if (!triggered && me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED)) return false; //Check for power - if (!bTriggered && me->GetPower((Powers)pSpell->powerType) < pSpell->manaCost) + if (!triggered && me->GetPower(Powers(spell->powerType)) < spell->manaCost) return false; - SpellRangeEntry const* pTempRange = GetSpellRangeStore()->LookupEntry(pSpell->rangeIndex); + SpellRangeEntry const* tempRange = GetSpellRangeStore()->LookupEntry(spell->rangeIndex); //Spell has invalid range store so we can't use it - if (!pTempRange) + if (!tempRange) return false; //Unit is out of range of this spell - if (me->IsInRange(pTarget, (float)me->GetSpellMinRangeForTarget(pTarget, pTempRange), (float)me->GetSpellMaxRangeForTarget(pTarget, pTempRange))) + if (me->IsInRange(target, float(me->GetSpellMinRangeForTarget(target, tempRange)), float(me->GetSpellMaxRangeForTarget(target, tempRange)))) return false; return true; @@ -417,29 +417,29 @@ Player* ScriptedAI::GetPlayerAtMinimumRange(float fMinimumRange) return pPlayer; } -void ScriptedAI::SetEquipmentSlots(bool bLoadDefault, int32 uiMainHand, int32 uiOffHand, int32 uiRanged) +void ScriptedAI::SetEquipmentSlots(bool loadDefault, int32 mainHand /*= EQUIP_NO_CHANGE*/, int32 offHand /*= EQUIP_NO_CHANGE*/, int32 ranged /*= EQUIP_NO_CHANGE*/) { - if (bLoadDefault) + if (loadDefault) { - if (CreatureInfo const* pInfo = GetCreatureTemplateStore(me->GetEntry())) - me->LoadEquipment(pInfo->equipmentId,true); + if (CreatureInfo const* creatureInfo = ObjectMgr::GetCreatureTemplate(me->GetEntry())) + me->LoadEquipment(creatureInfo->equipmentId, true); return; } - if (uiMainHand >= 0) - me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, uint32(uiMainHand)); + if (mainHand >= 0) + me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, uint32(mainHand)); - if (uiOffHand >= 0) - me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, uint32(uiOffHand)); + if (offHand >= 0) + me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, uint32(offHand)); - if (uiRanged >= 0) - me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2, uint32(uiRanged)); + if (ranged >= 0) + me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2, uint32(ranged)); } -void ScriptedAI::SetCombatMovement(bool bCombatMove) +void ScriptedAI::SetCombatMovement(bool allowMovement) { - m_bCombatMovement = bCombatMove; + _isCombatMovementAllowed = allowMovement; } enum eNPCs @@ -452,13 +452,13 @@ enum eNPCs // Hacklike storage used for misc creatures that are expected to evade of outside of a certain area. // It is assumed the information is found elswehere and can be handled by the core. So far no luck finding such information/way to extract it. -bool ScriptedAI::EnterEvadeIfOutOfCombatArea(const uint32 uiDiff) +bool ScriptedAI::EnterEvadeIfOutOfCombatArea(uint32 const diff) { - if (m_uiEvadeCheckCooldown <= uiDiff) - m_uiEvadeCheckCooldown = 2500; + if (_evadeCheckCooldown <= diff) + _evadeCheckCooldown = 2500; else { - m_uiEvadeCheckCooldown -= uiDiff; + _evadeCheckCooldown -= diff; return false; } @@ -496,20 +496,18 @@ bool ScriptedAI::EnterEvadeIfOutOfCombatArea(const uint32 uiDiff) return true; } -void Scripted_NoMovementAI::AttackStart(Unit* pWho) +void Scripted_NoMovementAI::AttackStart(Unit* target) { - if (!pWho) + if (!target) return; - if (me->Attack(pWho, true)) - { - DoStartNoMovement(pWho); - } + if (me->Attack(target, true)) + DoStartNoMovement(target); } -BossAI::BossAI(Creature *c, uint32 id) : ScriptedAI(c) -, bossId(id), summons(me), instance(c->GetInstanceScript()) -, boundary(instance ? instance->GetBossBoundary(id) : NULL) +BossAI::BossAI(Creature* creature, uint32 bossId) : ScriptedAI(creature) +, _bossId(bossId), summons(creature), instance(creature->GetInstanceScript()) +, _boundary(instance ? instance->GetBossBoundary(bossId) : NULL) { } @@ -522,7 +520,7 @@ void BossAI::_Reset() events.Reset(); summons.DespawnAll(); if (instance) - instance->SetBossState(bossId, NOT_STARTED); + instance->SetBossState(_bossId, NOT_STARTED); } void BossAI::_JustDied() @@ -531,7 +529,7 @@ void BossAI::_JustDied() summons.DespawnAll(); if (instance) { - instance->SetBossState(bossId, DONE); + instance->SetBossState(_bossId, DONE); instance->SaveToDB(); } } @@ -543,12 +541,12 @@ void BossAI::_EnterCombat() if (instance) { // bosses do not respawn, check only on enter combat - if (!instance->CheckRequiredBosses(bossId)) + if (!instance->CheckRequiredBosses(_bossId)) { EnterEvadeMode(); return; } - instance->SetBossState(bossId, IN_PROGRESS); + instance->SetBossState(_bossId, IN_PROGRESS); } } @@ -556,18 +554,19 @@ void BossAI::TeleportCheaters() { float x, y, z; me->GetPosition(x, y, z); - std::list<HostileReference*> &m_threatlist = me->getThreatManager().getThreatList(); - for (std::list<HostileReference*>::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); + std::list<HostileReference*>& threatList = me->getThreatManager().getThreatList(); + for (std::list<HostileReference*>::iterator itr = threatList.begin(); itr != threatList.end(); ++itr) + if (Unit* target = (*itr)->getTarget()) + if (target->GetTypeId() == TYPEID_PLAYER && !CheckBoundary(target)) + target->NearTeleportTo(x, y, z, 0); } -bool BossAI::CheckBoundary(Unit *who) +bool BossAI::CheckBoundary(Unit* who) { - if (!boundary || !who) + if (!GetBoundary() || !who) return true; - for (BossBoundaryMap::const_iterator itr = boundary->begin(); itr != boundary->end(); ++itr) + for (BossBoundaryMap::const_iterator itr = GetBoundary()->begin(); itr != GetBoundary()->end(); ++itr) { switch (itr->first) { @@ -611,32 +610,35 @@ bool BossAI::CheckBoundary(Unit *who) return true; } -void BossAI::JustSummoned(Creature *summon) +void BossAI::JustSummoned(Creature* summon) { summons.Summon(summon); if (me->isInCombat()) DoZoneInCombat(summon); } -void BossAI::SummonedCreatureDespawn(Creature *summon) +void BossAI::SummonedCreatureDespawn(Creature* summon) { summons.Despawn(summon); } // SD2 grid searchers. -Creature *GetClosestCreatureWithEntry(WorldObject *pSource, uint32 uiEntry, float fMaxSearchRange, bool bAlive) +Creature* GetClosestCreatureWithEntry(WorldObject* source, uint32 entry, float maxSearchRange, bool alive /*= true*/) { - return pSource->FindNearestCreature(uiEntry, fMaxSearchRange, bAlive); + return source->FindNearestCreature(entry, maxSearchRange, alive); } -GameObject *GetClosestGameObjectWithEntry(WorldObject *pSource, uint32 uiEntry, float fMaxSearchRange) + +GameObject* GetClosestGameObjectWithEntry(WorldObject* source, uint32 entry, float maxSearchRange) { - return pSource->FindNearestGameObject(uiEntry, fMaxSearchRange); + return source->FindNearestGameObject(entry, maxSearchRange); } -void GetCreatureListWithEntryInGrid(std::list<Creature*>& lList, WorldObject *pSource, uint32 uiEntry, float fMaxSearchRange) + +void GetCreatureListWithEntryInGrid(std::list<Creature*>& list, WorldObject* source, uint32 entry, float maxSearchRange) { - return pSource->GetCreatureListWithEntryInGrid(lList, uiEntry, fMaxSearchRange); + source->GetCreatureListWithEntryInGrid(list, entry, maxSearchRange); } -void GetGameObjectListWithEntryInGrid(std::list<GameObject*>& lList, WorldObject *pSource, uint32 uiEntry, float fMaxSearchRange) + +void GetGameObjectListWithEntryInGrid(std::list<GameObject*>& list, WorldObject* source, uint32 entry, float maxSearchRange) { - return pSource->GetGameObjectListWithEntryInGrid(lList, uiEntry, fMaxSearchRange); + source->GetGameObjectListWithEntryInGrid(list, entry, maxSearchRange); } diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.h b/src/server/game/AI/ScriptedAI/ScriptedCreature.h index b933bb31a17..85eac24a657 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedCreature.h +++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.h @@ -30,8 +30,8 @@ class SummonList : public std::list<uint64> { public: explicit SummonList(Creature* creature) : me(creature) {} - void Summon(Creature *summon) { push_back(summon->GetGUID()); } - void Despawn(Creature *summon) { remove(summon->GetGUID()); } + void Summon(Creature* summon) { push_back(summon->GetGUID()); } + void Despawn(Creature* summon) { remove(summon->GetGUID()); } void DespawnEntry(uint32 entry); void DespawnAll(); void DoAction(uint32 entry, int32 info); @@ -39,46 +39,46 @@ class SummonList : public std::list<uint64> void RemoveNotExisting(); bool HasEntry(uint32 entry); private: - Creature *me; + Creature* me; }; struct ScriptedAI : public CreatureAI { - explicit ScriptedAI(Creature* pCreature); + explicit ScriptedAI(Creature* creature); virtual ~ScriptedAI() {} // ************* //CreatureAI Functions // ************* - void AttackStartNoMove(Unit *pTarget); + void AttackStartNoMove(Unit* target); // Called at any Damage from any attacker (before damage apply) - void DamageTaken(Unit* /*pDone_by*/, uint32& /*uiDamage*/) {} + void DamageTaken(Unit* /*attacker*/, uint32& /*damage*/) {} //Called at World update tick void UpdateAI(const uint32); //Called at creature death - void JustDied(Unit* /*who*/){} + void JustDied(Unit* /*killer*/) {} //Called at creature killing another unit - void KilledUnit(Unit* /*who*/){} + void KilledUnit(Unit* /*victim*/) {} // Called when the creature summon successfully other creature - void JustSummoned(Creature*) {} + void JustSummoned(Creature* /*summon*/) {} // Called when a summoned creature is despawned - void SummonedCreatureDespawn(Creature*) {} + void SummonedCreatureDespawn(Creature* /*summon*/) {} // Called when hit by a spell - void SpellHit(Unit* /*caster*/, const SpellEntry * /*spell*/) {} + void SpellHit(Unit* /*caster*/, SpellEntry const* /*spell*/) {} // Called when spell hits a target - void SpellHitTarget(Unit * /*pTarget*/, const SpellEntry * /*spell*/) {} + void SpellHitTarget(Unit * /*target*/, SpellEntry const* /*spell*/) {} //Called at waypoint reached or PointMovement end - void MovementInform(uint32 /*type*/, uint32 /*id*/){} + void MovementInform(uint32 /*type*/, uint32 /*id*/) {} // Called when AI is temporarily replaced or put back when possess is applied or removed void OnPossess(bool /*apply*/) {} @@ -101,98 +101,98 @@ struct ScriptedAI : public CreatureAI void Reset() {} //Called at creature aggro either by MoveInLOS or Attack Start - void EnterCombat(Unit* /*who*/) {} + void EnterCombat(Unit* /*victim*/) {} // ************* //AI Helper Functions // ************* //Start movement toward victim - void DoStartMovement(Unit* pVictim, float fDistance = 0, float fAngle = 0); + void DoStartMovement(Unit* target, float distance = 0.0f, float angle = 0.0f); //Start no movement on victim - void DoStartNoMovement(Unit* pVictim); + void DoStartNoMovement(Unit* target); //Stop attack of current victim void DoStopAttack(); //Cast spell by spell info - void DoCastSpell(Unit* pTarget, SpellEntry const* pSpellInfo, bool bTriggered = false); + void DoCastSpell(Unit* target, SpellEntry const* spellInfo, bool triggered = false); //Plays a sound to all nearby players - void DoPlaySoundToSet(WorldObject* pSource, uint32 sound); + void DoPlaySoundToSet(WorldObject* source, uint32 soundId); //Drops all threat to 0%. Does not remove players from the threat list void DoResetThreat(); - float DoGetThreat(Unit* u); - void DoModifyThreatPercent(Unit* pUnit, int32 pct); + float DoGetThreat(Unit* unit); + void DoModifyThreatPercent(Unit* unit, int32 pct); - void DoTeleportTo(float fX, float fY, float fZ, uint32 uiTime = 0); - void DoTeleportTo(const float pos[4]); + void DoTeleportTo(float x, float y, float z, uint32 time = 0); + void DoTeleportTo(float const pos[4]); - void DoAction(const int32 /*param*/) {} + void DoAction(int32 const /*param*/) {} //Teleports a player without dropping threat (only teleports to same map) - void DoTeleportPlayer(Unit* pUnit, float fX, float fY, float fZ, float fO); - void DoTeleportAll(float fX, float fY, float fZ, float fO); + void DoTeleportPlayer(Unit* unit, float x, float y, float z, float o); + void DoTeleportAll(float x, float y, float z, float o); //Returns friendly unit with the most amount of hp missing from max hp - Unit* DoSelectLowestHpFriendly(float fRange, uint32 uiMinHPDiff = 1); + Unit* DoSelectLowestHpFriendly(float range, uint32 minHPDiff = 1); //Returns a list of friendly CC'd units within range - std::list<Creature*> DoFindFriendlyCC(float fRange); + std::list<Creature*> DoFindFriendlyCC(float range); //Returns a list of all friendly units missing a specific buff within range - std::list<Creature*> DoFindFriendlyMissingBuff(float fRange, uint32 uiSpellId); + std::list<Creature*> DoFindFriendlyMissingBuff(float range, uint32 spellId); //Return a player with at least minimumRange from me - Player* GetPlayerAtMinimumRange(float fMinimumRange); + Player* GetPlayerAtMinimumRange(float minRange); //Spawns a creature relative to me - Creature* DoSpawnCreature(uint32 uiId, float fX, float fY, float fZ, float fAngle, uint32 uiType, uint32 uiDespawntime); + Creature* DoSpawnCreature(uint32 entry, float offsetX, float offsetY, float offsetZ, float angle, uint32 type, uint32 despawntime); bool HealthBelowPct(uint32 pct) const { return me->HealthBelowPct(pct); } bool HealthAbovePct(uint32 pct) const { return me->HealthAbovePct(pct); } //Returns spells that meet the specified criteria from the creatures spell list - SpellEntry const* SelectSpell(Unit* Target, uint32 School, uint32 Mechanic, SelectTargetType Targets, uint32 PowerCostMin, uint32 PowerCostMax, float RangeMin, float RangeMax, SelectEffect Effect); + SpellEntry const* SelectSpell(Unit* target, uint32 school, uint32 mechanic, SelectTargetType targets, uint32 powerCostMin, uint32 powerCostMax, float rangeMin, float rangeMax, SelectEffect effect); //Checks if you can cast the specified spell - bool CanCast(Unit* pTarget, SpellEntry const* pSpell, bool bTriggered = false); + bool CanCast(Unit* target, SpellEntry const* spell, bool triggered = false); - void SetEquipmentSlots(bool bLoadDefault, int32 uiMainHand = EQUIP_NO_CHANGE, int32 uiOffHand = EQUIP_NO_CHANGE, int32 uiRanged = EQUIP_NO_CHANGE); + void SetEquipmentSlots(bool loadDefault, int32 mainHand = EQUIP_NO_CHANGE, int32 offHand = EQUIP_NO_CHANGE, int32 ranged = EQUIP_NO_CHANGE); //Generally used to control if MoveChase() is to be used or not in AttackStart(). Some creatures does not chase victims - void SetCombatMovement(bool CombatMove); - bool IsCombatMovement() { return m_bCombatMovement; } + void SetCombatMovement(bool allowMovement); + bool IsCombatMovementAllowed() { return _isCombatMovementAllowed; } - bool EnterEvadeIfOutOfCombatArea(const uint32 uiDiff); + bool EnterEvadeIfOutOfCombatArea(uint32 const diff); // return true for heroic mode. i.e. // - for dungeon in mode 10-heroic, // - for raid in mode 10-Heroic // - for raid in mode 25-heroic // DO NOT USE to check raid in mode 25-normal. - bool IsHeroic() { return m_heroicMode; } + bool IsHeroic() { return _isHeroic; } // return the dungeon or raid difficulty - Difficulty getDifficulty() { return m_difficulty; } + Difficulty GetDifficulty() { return _difficulty; } // return true for 25 man or 25 man heroic mode - bool Is25ManRaid() { return m_difficulty & 1; } + bool Is25ManRaid() { return _difficulty & 1; } template<class T> inline const T& DUNGEON_MODE(const T& normal5, const T& heroic10) { - switch(m_difficulty) + switch (_difficulty) { - case DUNGEON_DIFFICULTY_NORMAL: - return normal5; - case DUNGEON_DIFFICULTY_HEROIC: - return heroic10; - default: - break; + case DUNGEON_DIFFICULTY_NORMAL: + return normal5; + case DUNGEON_DIFFICULTY_HEROIC: + return heroic10; + default: + break; } return heroic10; @@ -201,14 +201,14 @@ struct ScriptedAI : public CreatureAI template<class T> inline const T& RAID_MODE(const T& normal10, const T& normal25) { - switch(m_difficulty) + switch (_difficulty) { - case RAID_DIFFICULTY_10MAN_NORMAL: - return normal10; - case RAID_DIFFICULTY_25MAN_NORMAL: - return normal25; - default: - break; + case RAID_DIFFICULTY_10MAN_NORMAL: + return normal10; + case RAID_DIFFICULTY_25MAN_NORMAL: + return normal25; + default: + break; } return normal25; @@ -217,27 +217,28 @@ struct ScriptedAI : public CreatureAI template<class T> inline const T& RAID_MODE(const T& normal10, const T& normal25, const T& heroic10, const T& heroic25) { - switch(m_difficulty) + switch (_difficulty) { - case RAID_DIFFICULTY_10MAN_NORMAL: - return normal10; - case RAID_DIFFICULTY_25MAN_NORMAL: - return normal25; - case RAID_DIFFICULTY_10MAN_HEROIC: - return heroic10; - case RAID_DIFFICULTY_25MAN_HEROIC: - return heroic25; + case RAID_DIFFICULTY_10MAN_NORMAL: + return normal10; + case RAID_DIFFICULTY_25MAN_NORMAL: + return normal25; + case RAID_DIFFICULTY_10MAN_HEROIC: + return heroic10; + case RAID_DIFFICULTY_25MAN_HEROIC: + return heroic25; + default: + break; } return heroic25; } private: - bool m_bCombatMovement; - uint32 m_uiEvadeCheckCooldown; - - bool m_heroicMode; - Difficulty m_difficulty; + Difficulty _difficulty; + uint32 _evadeCheckCooldown; + bool _isCombatMovementAllowed; + bool _isHeroic; }; struct Scripted_NoMovementAI : public ScriptedAI @@ -246,29 +247,27 @@ struct Scripted_NoMovementAI : public ScriptedAI virtual ~Scripted_NoMovementAI() {} //Called at each attack of me by any victim - void AttackStart(Unit* who); + void AttackStart(Unit* target); }; -struct BossAI : public ScriptedAI +class BossAI : public ScriptedAI { - BossAI(Creature *c, uint32 id); - virtual ~BossAI() {} + public: + BossAI(Creature* creature, uint32 bossId); + virtual ~BossAI() {} - const uint32 bossId; - EventMap events; - SummonList summons; - InstanceScript * const instance; - const BossBoundaryMap * const boundary; + InstanceScript* const instance; + BossBoundaryMap const* GetBoundary() const { return _boundary; } - void JustSummoned(Creature *summon); - void SummonedCreatureDespawn(Creature *summon); + void JustSummoned(Creature* summon); + void SummonedCreatureDespawn(Creature* summon); - void UpdateAI(const uint32 diff) = 0; + void UpdateAI(uint32 const diff) = 0; - void Reset() { _Reset(); } - void EnterCombat(Unit * /*who*/) { _EnterCombat(); } - void JustDied(Unit * /*killer*/) { _JustDied(); } - void JustReachedHome() { _JustReachedHome(); } + void Reset() { _Reset(); } + void EnterCombat(Unit* /*who*/) { _EnterCombat(); } + void JustDied(Unit* /*killer*/) { _JustDied(); } + void JustReachedHome() { _JustReachedHome(); } protected: void _Reset(); @@ -280,18 +279,26 @@ struct BossAI : public ScriptedAI { if (CheckBoundary(me)) return true; + EnterEvadeMode(); return false; } - bool CheckBoundary(Unit *who); + + bool CheckBoundary(Unit* who); void TeleportCheaters(); + + EventMap events; + SummonList summons; + + private: + BossBoundaryMap const* const _boundary; + const uint32 _bossId; }; // 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); +Creature *GetClosestCreatureWithEntry(WorldObject* source, uint32 entry, float maxSearchRange, bool alive = true); +GameObject* GetClosestGameObjectWithEntry(WorldObject* source, uint32 entry, float maxSearchRange); +void GetCreatureListWithEntryInGrid(std::list<Creature*>& list, WorldObject* source, uint32 entry, float maxSearchRange); +void GetGameObjectListWithEntryInGrid(std::list<GameObject*>& list, WorldObject* source, uint32 entry, float maxSearchRange); #endif - diff --git a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp index 1e4e86b9d48..2c39bdc86d3 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp @@ -45,7 +45,7 @@ void npc_escortAI::AttackStart(Unit* pWho) if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == POINT_MOTION_TYPE) me->GetMotionMaster()->MovementExpired(); - if (IsCombatMovement()) + if (IsCombatMovementAllowed()) me->GetMotionMaster()->MoveChase(pWho); } } @@ -148,7 +148,7 @@ void npc_escortAI::JustRespawned() { m_uiEscortState = STATE_ESCORT_NONE; - if (!IsCombatMovement()) + if (!IsCombatMovementAllowed()) SetCombatMovement(true); //add a small delay before going to first waypoint, normal in near all cases diff --git a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp index 8b2eef48d56..036d43229ff 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp @@ -41,7 +41,7 @@ void FollowerAI::AttackStart(Unit* pWho) if (me->HasUnitState(UNIT_STAT_FOLLOW)) me->ClearUnitState(UNIT_STAT_FOLLOW); - if (IsCombatMovement()) + if (IsCombatMovementAllowed()) me->GetMotionMaster()->MoveChase(pWho); } } @@ -147,7 +147,7 @@ void FollowerAI::JustRespawned() { m_uiFollowState = STATE_FOLLOW_NONE; - if (!IsCombatMovement()) + if (!IsCombatMovementAllowed()) SetCombatMovement(true); if (me->getFaction() != me->GetCreatureInfo()->faction_A) diff --git a/src/server/game/Instances/InstanceScript.h b/src/server/game/Instances/InstanceScript.h index 6943ff38c20..b6b9cc84d4f 100755 --- a/src/server/game/Instances/InstanceScript.h +++ b/src/server/game/Instances/InstanceScript.h @@ -135,7 +135,7 @@ class InstanceScript : public ZoneScript virtual void Initialize() {} //On load - virtual void Load(const char * data) { LoadBossState(data); } + virtual void Load(char const* data) { LoadBossState(data); } //When save is needed, this function generates the data virtual std::string GetSaveData() { return GetBossSaveData(); } @@ -149,30 +149,30 @@ class InstanceScript : public ZoneScript virtual bool IsEncounterInProgress() const; //Called when a player successfully enters the instance. - virtual void OnPlayerEnter(Player *) {} + virtual void OnPlayerEnter(Player* /*player*/) {} //Handle open / close objects //use HandleGameObject(0, boolen, GO); in OnObjectCreate in instance scripts //use HandleGameObject(GUID, boolen, NULL); in any other script - void HandleGameObject(uint64 GUID, bool open, GameObject *go = NULL); + void HandleGameObject(uint64 guid, bool open, GameObject* go = NULL); //change active state of doors or buttons - void DoUseDoorOrButton(uint64 uiGuid, uint32 uiWithRestoreTime = 0, bool bUseAlternativeState = false); + void DoUseDoorOrButton(uint64 guid, uint32 withRestoreTime = 0, bool useAlternativeState = false); //Respawns a GO having negative spawntimesecs in gameobject-table - void DoRespawnGameObject(uint64 uiGuid, uint32 uiTimeToDespawn = MINUTE); + void DoRespawnGameObject(uint64 guid, uint32 timeToDespawn = MINUTE); //sends world state update to all players in instance - void DoUpdateWorldState(uint32 uiStateId, uint32 uiStateData); + void DoUpdateWorldState(uint32 worldstateId, uint32 worldstateValue); // Send Notify to all players in instance - void DoSendNotifyToInstance(const char *format,...); + void DoSendNotifyToInstance(char const* format, ...); // Complete Achievement for all players in instance void DoCompleteAchievement(uint32 achievement); // Update Achievement Criteria for all players in instance - void DoUpdateAchievementCriteria(AchievementCriteriaTypes type, uint32 miscvalue1=0, uint32 miscvalue2=0, Unit *unit=NULL, uint32 time=0); + void DoUpdateAchievementCriteria(AchievementCriteriaTypes type, uint32 miscvalue1 = 0, uint32 miscvalue2 = 0, Unit* unit = NULL, uint32 time = 0); // Start/Stop Timed Achievement Criteria for all players in instance void DoStartTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry); @@ -189,7 +189,7 @@ class InstanceScript : public ZoneScript virtual bool SetBossState(uint32 id, EncounterState state); EncounterState GetBossState(uint32 id) const { return id < bosses.size() ? bosses[id].state : TO_BE_DECIDED; } - const BossBoundaryMap * GetBossBoundary(uint32 id) const { return id < bosses.size() ? &bosses[id].boundary : NULL; } + BossBoundaryMap const* GetBossBoundary(uint32 id) const { return id < bosses.size() ? &bosses[id].boundary : NULL; } // Achievement criteria additional requirements check // NOTE: not use this if same can be checked existed requirement types from AchievementCriteriaRequirementType @@ -213,16 +213,16 @@ class InstanceScript : public ZoneScript protected: void SetBossNumber(uint32 number) { bosses.resize(number); } - void LoadDoorData(const DoorData *data); - void LoadMinionData(const MinionData *data); + void LoadDoorData(DoorData const* data); + void LoadMinionData(MinionData const* data); - void AddDoor(GameObject *door, bool add); - void AddMinion(Creature *minion, bool add); + void AddDoor(GameObject* door, bool add); + void AddMinion(Creature* minion, bool add); void UpdateDoorState(GameObject *door); void UpdateMinionState(Creature *minion, EncounterState state); - std::string LoadBossState(const char * data); + std::string LoadBossState(char const* data); std::string GetBossSaveData(); private: std::vector<BossInfo> bosses; diff --git a/src/server/game/Maps/ZoneScript.h b/src/server/game/Maps/ZoneScript.h index 0147e333f41..e3a0de7f22b 100755 --- a/src/server/game/Maps/ZoneScript.h +++ b/src/server/game/Maps/ZoneScript.h @@ -30,13 +30,13 @@ class ZoneScript public: explicit ZoneScript() {} - virtual uint32 GetCreatureEntry(uint32 /*guidlow*/, const CreatureData *data) { return data->id; } + virtual uint32 GetCreatureEntry(uint32 /*guidlow*/, CreatureData const* data) { return data->id; } virtual uint32 GetGameObjectEntry(uint32 /*guidlow*/, uint32 entry) { return entry; } - virtual void OnCreatureCreate(Creature *) {} - virtual void OnCreatureRemove(Creature *) {} - virtual void OnGameObjectCreate(GameObject *) {} - virtual void OnGameObjectRemove(GameObject *) {} + virtual void OnCreatureCreate(Creature* /*creature*/) {} + virtual void OnCreatureRemove(Creature* /*creature*/) {} + virtual void OnGameObjectCreate(GameObject* /*go*/) {} + virtual void OnGameObjectRemove(GameObject* /*go*/) {} virtual void OnCreatureDeath(Creature* /*creature*/) {} @@ -48,7 +48,7 @@ class ZoneScript virtual uint32 GetData(uint32 /*DataId*/) { return 0; } virtual void SetData(uint32 /*DataId*/, uint32 /*Value*/) {} - virtual void ProcessEvent(GameObject * /*obj*/, uint32 /*eventId*/) {} + virtual void ProcessEvent(GameObject* /*obj*/, uint32 /*eventId*/) {} virtual void ProcessEvent(Unit* /*unit*/, uint32 /*eventId*/) {} }; diff --git a/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp b/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp index 3d42561ec0d..720e4603b1f 100644 --- a/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp +++ b/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp @@ -144,7 +144,7 @@ public: void Reset() { - if (!IsCombatMovement()) + if (!IsCombatMovementAllowed()) SetCombatMovement(true); m_uiPhase = PHASE_START; diff --git a/src/server/scripts/Kalimdor/dustwallow_marsh.cpp b/src/server/scripts/Kalimdor/dustwallow_marsh.cpp index 26650149342..cf76044a01d 100644 --- a/src/server/scripts/Kalimdor/dustwallow_marsh.cpp +++ b/src/server/scripts/Kalimdor/dustwallow_marsh.cpp @@ -547,7 +547,7 @@ public: me->SetInCombatWith(pWho); pWho->SetInCombatWith(me); - if (IsCombatMovement()) + if (IsCombatMovementAllowed()) me->GetMotionMaster()->MoveChase(pWho); } } diff --git a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_hadronox.cpp b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_hadronox.cpp index f94a0262612..8b572323e16 100644 --- a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_hadronox.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_hadronox.cpp @@ -143,10 +143,10 @@ public: if (me->HasAura(SPELL_WEB_FRONT_DOORS) || me->HasAura(SPELL_WEB_SIDE_DOORS)) { - if (IsCombatMovement()) + if (IsCombatMovementAllowed()) SetCombatMovement(false); } - else if (!IsCombatMovement()) + else if (!IsCombatMovementAllowed()) SetCombatMovement(true); if (uiPierceTimer <= diff) diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp index abddb684148..5dda6555bf1 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp @@ -234,7 +234,7 @@ public: m_uiLegionFlameTimer = 30*IN_MILLISECONDS; } else m_uiLegionFlameTimer -= uiDiff; - if (getDifficulty() == RAID_DIFFICULTY_25MAN_HEROIC && m_uiTouchOfJaraxxusTimer <= uiDiff) + if (GetDifficulty() == RAID_DIFFICULTY_25MAN_HEROIC && m_uiTouchOfJaraxxusTimer <= uiDiff) { if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0)) DoCast(pTarget, SPELL_TOUCH_OF_JARAXXUS); diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp index f78c1164a35..44382ebc7c8 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp @@ -140,8 +140,8 @@ public: m_uiStaggeringStompTimer = 15*IN_MILLISECONDS; m_uiSummonTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS);; - if (getDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL || - getDifficulty() == RAID_DIFFICULTY_25MAN_HEROIC) + if (GetDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL || + GetDifficulty() == RAID_DIFFICULTY_25MAN_HEROIC) m_uiSummonCount = 5; else m_uiSummonCount = 4; diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp index 314690d18fd..24c6029c23f 100755 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp @@ -293,7 +293,7 @@ class boss_lady_deathwhisper : public CreatureScript events.ScheduleEvent(EVENT_P1_SUMMON_WAVE, 5000, 0, PHASE_ONE); events.ScheduleEvent(EVENT_P1_SHADOW_BOLT, urand(5500, 6000), 0, PHASE_ONE); events.ScheduleEvent(EVENT_P1_EMPOWER_CULTIST, urand(20000, 30000), 0, PHASE_ONE); - if (getDifficulty() != RAID_DIFFICULTY_10MAN_NORMAL) + if (GetDifficulty() != RAID_DIFFICULTY_10MAN_NORMAL) events.ScheduleEvent(EVENT_DOMINATE_MIND_H, 27000); Talk(SAY_AGGRO); diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp index 3a4cdcb1d9a..e9863d38f6f 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp @@ -1418,40 +1418,6 @@ class spell_frostwarden_handler_focus_fire : public SpellScriptLoader } }; -class spell_trigger_spell_from_caster : public SpellScriptLoader -{ - public: - spell_trigger_spell_from_caster(char const* scriptName, uint32 _triggerId) : SpellScriptLoader(scriptName), triggerId(_triggerId) { } - - class spell_trigger_spell_from_caster_SpellScript : public SpellScript - { - PrepareSpellScript(spell_trigger_spell_from_caster_SpellScript); - - public: - spell_trigger_spell_from_caster_SpellScript(uint32 _triggerId) : SpellScript(), triggerId(_triggerId) { } - - void HandleTrigger() - { - GetCaster()->CastSpell(GetHitUnit(), triggerId, true); - } - - void Register() - { - AfterHit += SpellHitFn(spell_trigger_spell_from_caster_SpellScript::HandleTrigger); - } - - uint32 triggerId; - }; - - SpellScript* GetSpellScript() const - { - return new spell_trigger_spell_from_caster_SpellScript(triggerId); - } - - private: - uint32 triggerId; -}; - class at_sindragosa_lair : public AreaTriggerScript { public: diff --git a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.h b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.h index 5496f6ba7a4..2ea0bd43f78 100755 --- a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.h +++ b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.h @@ -326,4 +326,45 @@ enum WorldStatesICC WORLDSTATE_ATTEMPTS_MAX = 4942, }; +class spell_trigger_spell_from_caster : public SpellScriptLoader +{ + public: + spell_trigger_spell_from_caster(char const* scriptName, uint32 _triggerId) : SpellScriptLoader(scriptName), triggerId(_triggerId) { } + + class spell_trigger_spell_from_caster_SpellScript : public SpellScript + { + PrepareSpellScript(spell_trigger_spell_from_caster_SpellScript); + + public: + spell_trigger_spell_from_caster_SpellScript(uint32 _triggerId) : SpellScript(), triggerId(_triggerId) { } + + bool Validate(SpellEntry const* /*spell*/) + { + if (!sSpellStore.LookupEntry(triggerId)) + return false; + return true; + } + + void HandleTrigger() + { + GetCaster()->CastSpell(GetHitUnit(), triggerId, true); + } + + void Register() + { + AfterHit += SpellHitFn(spell_trigger_spell_from_caster_SpellScript::HandleTrigger); + } + + uint32 triggerId; + }; + + SpellScript* GetSpellScript() const + { + return new spell_trigger_spell_from_caster_SpellScript(triggerId); + } + + private: + uint32 triggerId; +}; + #endif // ICECROWN_CITADEL_H_ diff --git a/src/server/scripts/Northrend/Naxxramas/boss_anubrekhan.cpp b/src/server/scripts/Northrend/Naxxramas/boss_anubrekhan.cpp index 43d7e26415f..092919435e2 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_anubrekhan.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_anubrekhan.cpp @@ -73,7 +73,7 @@ public: hasTaunted = false; - if (getDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL) + if (GetDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL) { Position pos; @@ -115,7 +115,7 @@ public: events.ScheduleEvent(EVENT_LOCUST, 90000); events.ScheduleEvent(EVENT_BERSERK, 600000); - if (getDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL) + if (GetDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL) events.ScheduleEvent(EVENT_SPAWN_GUARDIAN_NORMAL, urand(15000,20000)); } diff --git a/src/server/scripts/Northrend/Naxxramas/boss_faerlina.cpp b/src/server/scripts/Northrend/Naxxramas/boss_faerlina.cpp index e08eee75092..b5660d369ab 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_faerlina.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_faerlina.cpp @@ -197,7 +197,7 @@ public: void Reset() { - if (getDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL) { + if (GetDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL) { me->ApplySpellImmune(0, IMMUNITY_MECHANIC, SPELL_EFFECT_BIND, true); me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_CHARM, true); } @@ -205,7 +205,7 @@ public: void JustDied(Unit * /*killer*/) { - if (pInstance && getDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL) + if (pInstance && GetDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL) { if (Creature *pFaerlina = pInstance->instance->GetCreature(pInstance->GetData64(DATA_FAERLINA))) DoCast(pFaerlina, SPELL_WIDOWS_EMBRACE); diff --git a/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp b/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp index 5b1224508a4..c3bd60e82d3 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp @@ -248,9 +248,9 @@ public: void DoGothikSummon(uint32 entry) { - if (getDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL) + if (GetDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL) { - switch(entry) + switch (entry) { case MOB_LIVE_TRAINEE: { @@ -406,9 +406,9 @@ public: case EVENT_SUMMON: if (waves[waveCount].entry) { - if ((waves[waveCount].mode == 2) && (getDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL)) + if ((waves[waveCount].mode == 2) && (GetDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL)) DoGothikSummon(waves[waveCount].entry); - else if ((waves[waveCount].mode == 0) && (getDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL)) + else if ((waves[waveCount].mode == 0) && (GetDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL)) DoGothikSummon(waves[waveCount].entry); else if (waves[waveCount].mode == 1) DoGothikSummon(waves[waveCount].entry); @@ -428,9 +428,9 @@ public: if (waves[waveCount].mode == 1) events.ScheduleEvent(EVENT_SUMMON,waves[waveCount].time); - else if ((waves[waveCount].mode == 2) && (getDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL)) + else if ((waves[waveCount].mode == 2) && (GetDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL)) events.ScheduleEvent(EVENT_SUMMON,waves[waveCount].time); - else if ((waves[waveCount].mode == 0) && (getDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL)) + else if ((waves[waveCount].mode == 0) && (GetDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL)) events.ScheduleEvent(EVENT_SUMMON,waves[waveCount].time); else events.ScheduleEvent(EVENT_SUMMON, 0); diff --git a/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp b/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp index d30a0bc442c..9d034723299 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp @@ -430,7 +430,7 @@ public: events.ScheduleEvent(EVENT_DETONATE, urand(30000,40000)); events.ScheduleEvent(EVENT_FISSURE, urand(10000,30000)); events.ScheduleEvent(EVENT_BLAST, urand(60000,120000)); - if (getDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL) + if (GetDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL) events.ScheduleEvent(EVENT_CHAIN, urand(30000,60000)); Phase = 2; break; diff --git a/src/server/scripts/Northrend/Naxxramas/boss_noth.cpp b/src/server/scripts/Northrend/Naxxramas/boss_noth.cpp index eeddfabeab1..0cd4cee813c 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_noth.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_noth.cpp @@ -106,7 +106,7 @@ public: events.ScheduleEvent(EVENT_BALCONY, 110000); events.ScheduleEvent(EVENT_CURSE, 10000+rand()%15000); events.ScheduleEvent(EVENT_WARRIOR, 30000); - if (getDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL) + if (GetDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL) events.ScheduleEvent(EVENT_BLINK, 20000 + rand()%20000); } } |