Core/Scripts: Code style cleanup in ScriptedAI and BossAI

This commit is contained in:
Shauren
2011-03-19 10:54:16 +01:00
parent 6eb5014182
commit 1a4a618d81
19 changed files with 266 additions and 250 deletions
@@ -111,11 +111,11 @@ bool SummonList::HasEntry(uint32 entry)
ScriptedAI::ScriptedAI(Creature* pCreature) : CreatureAI(pCreature), ScriptedAI::ScriptedAI(Creature* pCreature) : CreatureAI(pCreature),
me(pCreature), me(pCreature),
IsFleeing(false), IsFleeing(false),
m_bCombatMovement(true), _isCombatMovementAllowed(true),
m_uiEvadeCheckCooldown(2500) _evadeCheckCooldown(2500)
{ {
m_heroicMode = me->GetMap()->IsHeroic(); _isHeroic = me->GetMap()->IsHeroic();
m_difficulty = Difficulty(me->GetMap()->GetSpawnMode()); _difficulty = Difficulty(me->GetMap()->GetSpawnMode());
} }
void ScriptedAI::AttackStartNoMove(Unit* pWho) void ScriptedAI::AttackStartNoMove(Unit* pWho)
@@ -187,15 +187,15 @@ void ScriptedAI::DoPlaySoundToSet(WorldObject* pSource, uint32 uiSoundId)
pSource->PlayDirectSound(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 //No target so we can't cast
if (!pTarget) if (!target)
return false; return false;
//Silenced so we can't cast //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 //Using the extended script system we first create a list of viable spells
SpellEntry const* apSpell[CREATURE_MAX_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; SpellEntry const* tempSpell = NULL;
SpellRangeEntry const* pTempRange; SpellRangeEntry const* tempRange = NULL;
//Check if each spell is viable(set it to null if not) //Check if each spell is viable(set it to null if not)
for (uint32 i = 0; i < CREATURE_MAX_SPELLS; i++) 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 //This spell doesn't exist
if (!pTempSpell) if (!tempSpell)
continue; continue;
// Targets and Effects checked first as most used restrictions // Targets and Effects checked first as most used restrictions
//Check the spell targets if specified //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; continue;
//Check the type of spell if we are looking for a specific spell type //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; continue;
//Check for school if specified //Check for school if specified
if (uiSchool && (pTempSpell->SchoolMask & uiSchool) == 0) if (school && (tempSpell->SchoolMask & school) == 0)
continue; continue;
//Check for spell mechanic if specified //Check for spell mechanic if specified
if (uiMechanic && pTempSpell->Mechanic != uiMechanic) if (mechanic && tempSpell->Mechanic != mechanic)
continue; continue;
//Make sure that the spell uses the requested amount of power //Make sure that the spell uses the requested amount of power
if (uiPowerCostMin && pTempSpell->manaCost < uiPowerCostMin) if (powerCostMin && tempSpell->manaCost < powerCostMin)
continue; continue;
if (uiPowerCostMax && pTempSpell->manaCost > uiPowerCostMax) if (powerCostMax && tempSpell->manaCost > powerCostMax)
continue; continue;
//Continue if we don't have the mana to actually cast this spell //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; continue;
//Get the Range //Get the Range
pTempRange = GetSpellRangeStore()->LookupEntry(pTempSpell->rangeIndex); tempRange = GetSpellRangeStore()->LookupEntry(tempSpell->rangeIndex);
//Spell has invalid range store so we can't use it //Spell has invalid range store so we can't use it
if (!pTempRange) if (!tempRange)
continue; continue;
//Check if the spell meets our range requirements //Check if the spell meets our range requirements
if (fRangeMin && me->GetSpellMinRangeForTarget(pTarget, pTempRange) < fRangeMin) if (rangeMin && me->GetSpellMinRangeForTarget(target, tempRange) < rangeMin)
continue; continue;
if (fRangeMax && me->GetSpellMaxRangeForTarget(pTarget, pTempRange) > fRangeMax) if (rangeMax && me->GetSpellMaxRangeForTarget(target, tempRange) > rangeMax)
continue; continue;
//Check if our target is in range //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; continue;
//All good so lets add it to the spell list //All good so lets add it to the spell list
apSpell[uiSpellCount] = pTempSpell; apSpell[spellCount] = tempSpell;
++uiSpellCount; ++spellCount;
} }
//We got our usable spells so now lets randomly pick one //We got our usable spells so now lets randomly pick one
if (!uiSpellCount) if (!spellCount)
return NULL; 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 //No target so we can't cast
if (!pTarget || !pSpell) if (!target || !spell)
return false; return false;
//Silenced so we can't cast //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; return false;
//Check for power //Check for power
if (!bTriggered && me->GetPower((Powers)pSpell->powerType) < pSpell->manaCost) if (!triggered && me->GetPower(Powers(spell->powerType)) < spell->manaCost)
return false; 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 //Spell has invalid range store so we can't use it
if (!pTempRange) if (!tempRange)
return false; return false;
//Unit is out of range of this spell //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 false;
return true; return true;
@@ -417,29 +417,29 @@ Player* ScriptedAI::GetPlayerAtMinimumRange(float fMinimumRange)
return pPlayer; 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())) if (CreatureInfo const* creatureInfo = ObjectMgr::GetCreatureTemplate(me->GetEntry()))
me->LoadEquipment(pInfo->equipmentId,true); me->LoadEquipment(creatureInfo->equipmentId, true);
return; return;
} }
if (uiMainHand >= 0) if (mainHand >= 0)
me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, uint32(uiMainHand)); me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, uint32(mainHand));
if (uiOffHand >= 0) if (offHand >= 0)
me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, uint32(uiOffHand)); me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, uint32(offHand));
if (uiRanged >= 0) if (ranged >= 0)
me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2, uint32(uiRanged)); 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 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. // 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. // 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) if (_evadeCheckCooldown <= diff)
m_uiEvadeCheckCooldown = 2500; _evadeCheckCooldown = 2500;
else else
{ {
m_uiEvadeCheckCooldown -= uiDiff; _evadeCheckCooldown -= diff;
return false; return false;
} }
@@ -496,20 +496,18 @@ bool ScriptedAI::EnterEvadeIfOutOfCombatArea(const uint32 uiDiff)
return true; return true;
} }
void Scripted_NoMovementAI::AttackStart(Unit* pWho) void Scripted_NoMovementAI::AttackStart(Unit* target)
{ {
if (!pWho) if (!target)
return; return;
if (me->Attack(pWho, true)) if (me->Attack(target, true))
{ DoStartNoMovement(target);
DoStartNoMovement(pWho);
}
} }
BossAI::BossAI(Creature *c, uint32 id) : ScriptedAI(c) BossAI::BossAI(Creature* creature, uint32 bossId) : ScriptedAI(creature)
, bossId(id), summons(me), instance(c->GetInstanceScript()) , _bossId(bossId), summons(creature), instance(creature->GetInstanceScript())
, boundary(instance ? instance->GetBossBoundary(id) : NULL) , _boundary(instance ? instance->GetBossBoundary(bossId) : NULL)
{ {
} }
@@ -522,7 +520,7 @@ void BossAI::_Reset()
events.Reset(); events.Reset();
summons.DespawnAll(); summons.DespawnAll();
if (instance) if (instance)
instance->SetBossState(bossId, NOT_STARTED); instance->SetBossState(_bossId, NOT_STARTED);
} }
void BossAI::_JustDied() void BossAI::_JustDied()
@@ -531,7 +529,7 @@ void BossAI::_JustDied()
summons.DespawnAll(); summons.DespawnAll();
if (instance) if (instance)
{ {
instance->SetBossState(bossId, DONE); instance->SetBossState(_bossId, DONE);
instance->SaveToDB(); instance->SaveToDB();
} }
} }
@@ -543,12 +541,12 @@ void BossAI::_EnterCombat()
if (instance) if (instance)
{ {
// bosses do not respawn, check only on enter combat // bosses do not respawn, check only on enter combat
if (!instance->CheckRequiredBosses(bossId)) if (!instance->CheckRequiredBosses(_bossId))
{ {
EnterEvadeMode(); EnterEvadeMode();
return; return;
} }
instance->SetBossState(bossId, IN_PROGRESS); instance->SetBossState(_bossId, IN_PROGRESS);
} }
} }
@@ -556,18 +554,19 @@ void BossAI::TeleportCheaters()
{ {
float x, y, z; float x, y, z;
me->GetPosition(x, y, z); me->GetPosition(x, y, z);
std::list<HostileReference*> &m_threatlist = me->getThreatManager().getThreatList(); std::list<HostileReference*>& threatList = me->getThreatManager().getThreatList();
for (std::list<HostileReference*>::iterator itr = m_threatlist.begin(); itr != m_threatlist.end(); ++itr) for (std::list<HostileReference*>::iterator itr = threatList.begin(); itr != threatList.end(); ++itr)
if ((*itr)->getTarget()->GetTypeId() == TYPEID_PLAYER && !CheckBoundary((*itr)->getTarget())) if (Unit* target = (*itr)->getTarget())
(*itr)->getTarget()->NearTeleportTo(x, y, z, 0); 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; 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) switch (itr->first)
{ {
@@ -624,19 +623,22 @@ void BossAI::SummonedCreatureDespawn(Creature *summon)
} }
// SD2 grid searchers. // 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);
} }
@@ -44,38 +44,38 @@ class SummonList : public std::list<uint64>
struct ScriptedAI : public CreatureAI struct ScriptedAI : public CreatureAI
{ {
explicit ScriptedAI(Creature* pCreature); explicit ScriptedAI(Creature* creature);
virtual ~ScriptedAI() {} virtual ~ScriptedAI() {}
// ************* // *************
//CreatureAI Functions //CreatureAI Functions
// ************* // *************
void AttackStartNoMove(Unit *pTarget); void AttackStartNoMove(Unit* target);
// Called at any Damage from any attacker (before damage apply) // 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 //Called at World update tick
void UpdateAI(const uint32); void UpdateAI(const uint32);
//Called at creature death //Called at creature death
void JustDied(Unit* /*who*/){} void JustDied(Unit* /*killer*/) {}
//Called at creature killing another unit //Called at creature killing another unit
void KilledUnit(Unit* /*who*/){} void KilledUnit(Unit* /*victim*/) {}
// Called when the creature summon successfully other creature // Called when the creature summon successfully other creature
void JustSummoned(Creature*) {} void JustSummoned(Creature* /*summon*/) {}
// Called when a summoned creature is despawned // Called when a summoned creature is despawned
void SummonedCreatureDespawn(Creature*) {} void SummonedCreatureDespawn(Creature* /*summon*/) {}
// Called when hit by a spell // 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 // 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 //Called at waypoint reached or PointMovement end
void MovementInform(uint32 /*type*/, uint32 /*id*/) {} void MovementInform(uint32 /*type*/, uint32 /*id*/) {}
@@ -101,91 +101,91 @@ struct ScriptedAI : public CreatureAI
void Reset() {} void Reset() {}
//Called at creature aggro either by MoveInLOS or Attack Start //Called at creature aggro either by MoveInLOS or Attack Start
void EnterCombat(Unit* /*who*/) {} void EnterCombat(Unit* /*victim*/) {}
// ************* // *************
//AI Helper Functions //AI Helper Functions
// ************* // *************
//Start movement toward victim //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 //Start no movement on victim
void DoStartNoMovement(Unit* pVictim); void DoStartNoMovement(Unit* target);
//Stop attack of current victim //Stop attack of current victim
void DoStopAttack(); void DoStopAttack();
//Cast spell by spell info //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 //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 //Drops all threat to 0%. Does not remove players from the threat list
void DoResetThreat(); void DoResetThreat();
float DoGetThreat(Unit* u); float DoGetThreat(Unit* unit);
void DoModifyThreatPercent(Unit* pUnit, int32 pct); void DoModifyThreatPercent(Unit* unit, int32 pct);
void DoTeleportTo(float fX, float fY, float fZ, uint32 uiTime = 0); void DoTeleportTo(float x, float y, float z, uint32 time = 0);
void DoTeleportTo(const float pos[4]); 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) //Teleports a player without dropping threat (only teleports to same map)
void DoTeleportPlayer(Unit* pUnit, float fX, float fY, float fZ, float fO); void DoTeleportPlayer(Unit* unit, float x, float y, float z, float o);
void DoTeleportAll(float fX, float fY, float fZ, float fO); void DoTeleportAll(float x, float y, float z, float o);
//Returns friendly unit with the most amount of hp missing from max hp //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 //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 //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 //Return a player with at least minimumRange from me
Player* GetPlayerAtMinimumRange(float fMinimumRange); Player* GetPlayerAtMinimumRange(float minRange);
//Spawns a creature relative to me //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 HealthBelowPct(uint32 pct) const { return me->HealthBelowPct(pct); }
bool HealthAbovePct(uint32 pct) const { return me->HealthAbovePct(pct); } bool HealthAbovePct(uint32 pct) const { return me->HealthAbovePct(pct); }
//Returns spells that meet the specified criteria from the creatures spell list //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 //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 //Generally used to control if MoveChase() is to be used or not in AttackStart(). Some creatures does not chase victims
void SetCombatMovement(bool CombatMove); void SetCombatMovement(bool allowMovement);
bool IsCombatMovement() { return m_bCombatMovement; } bool IsCombatMovementAllowed() { return _isCombatMovementAllowed; }
bool EnterEvadeIfOutOfCombatArea(const uint32 uiDiff); bool EnterEvadeIfOutOfCombatArea(uint32 const diff);
// return true for heroic mode. i.e. // return true for heroic mode. i.e.
// - for dungeon in mode 10-heroic, // - for dungeon in mode 10-heroic,
// - for raid in mode 10-Heroic // - for raid in mode 10-Heroic
// - for raid in mode 25-heroic // - for raid in mode 25-heroic
// DO NOT USE to check raid in mode 25-normal. // 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 // 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 // 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 template<class T> inline
const T& DUNGEON_MODE(const T& normal5, const T& heroic10) const T& DUNGEON_MODE(const T& normal5, const T& heroic10)
{ {
switch(m_difficulty) switch (_difficulty)
{ {
case DUNGEON_DIFFICULTY_NORMAL: case DUNGEON_DIFFICULTY_NORMAL:
return normal5; return normal5;
@@ -201,7 +201,7 @@ struct ScriptedAI : public CreatureAI
template<class T> inline template<class T> inline
const T& RAID_MODE(const T& normal10, const T& normal25) const T& RAID_MODE(const T& normal10, const T& normal25)
{ {
switch(m_difficulty) switch (_difficulty)
{ {
case RAID_DIFFICULTY_10MAN_NORMAL: case RAID_DIFFICULTY_10MAN_NORMAL:
return normal10; return normal10;
@@ -217,7 +217,7 @@ struct ScriptedAI : public CreatureAI
template<class T> inline template<class T> inline
const T& RAID_MODE(const T& normal10, const T& normal25, const T& heroic10, const T& heroic25) 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: case RAID_DIFFICULTY_10MAN_NORMAL:
return normal10; return normal10;
@@ -227,17 +227,18 @@ struct ScriptedAI : public CreatureAI
return heroic10; return heroic10;
case RAID_DIFFICULTY_25MAN_HEROIC: case RAID_DIFFICULTY_25MAN_HEROIC:
return heroic25; return heroic25;
default:
break;
} }
return heroic25; return heroic25;
} }
private: private:
bool m_bCombatMovement; Difficulty _difficulty;
uint32 m_uiEvadeCheckCooldown; uint32 _evadeCheckCooldown;
bool _isCombatMovementAllowed;
bool m_heroicMode; bool _isHeroic;
Difficulty m_difficulty;
}; };
struct Scripted_NoMovementAI : public ScriptedAI struct Scripted_NoMovementAI : public ScriptedAI
@@ -246,24 +247,22 @@ struct Scripted_NoMovementAI : public ScriptedAI
virtual ~Scripted_NoMovementAI() {} virtual ~Scripted_NoMovementAI() {}
//Called at each attack of me by any victim //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); public:
BossAI(Creature* creature, uint32 bossId);
virtual ~BossAI() {} virtual ~BossAI() {}
const uint32 bossId;
EventMap events;
SummonList summons;
InstanceScript* const instance; InstanceScript* const instance;
const BossBoundaryMap * const boundary; BossBoundaryMap const* GetBoundary() const { return _boundary; }
void JustSummoned(Creature* summon); void JustSummoned(Creature* summon);
void SummonedCreatureDespawn(Creature* summon); void SummonedCreatureDespawn(Creature* summon);
void UpdateAI(const uint32 diff) = 0; void UpdateAI(uint32 const diff) = 0;
void Reset() { _Reset(); } void Reset() { _Reset(); }
void EnterCombat(Unit* /*who*/) { _EnterCombat(); } void EnterCombat(Unit* /*who*/) { _EnterCombat(); }
@@ -280,18 +279,26 @@ struct BossAI : public ScriptedAI
{ {
if (CheckBoundary(me)) if (CheckBoundary(me))
return true; return true;
EnterEvadeMode(); EnterEvadeMode();
return false; return false;
} }
bool CheckBoundary(Unit* who); bool CheckBoundary(Unit* who);
void TeleportCheaters(); void TeleportCheaters();
EventMap events;
SummonList summons;
private:
BossBoundaryMap const* const _boundary;
const uint32 _bossId;
}; };
// SD2 grid searchers. // SD2 grid searchers.
Creature *GetClosestCreatureWithEntry(WorldObject *pSource, uint32 uiEntry, float fMaxSearchRange, bool bAlive = true); Creature *GetClosestCreatureWithEntry(WorldObject* source, uint32 entry, float maxSearchRange, bool alive = true);
GameObject *GetClosestGameObjectWithEntry(WorldObject *pSource, uint32 uiEntry, float fMaxSearchRange); GameObject* GetClosestGameObjectWithEntry(WorldObject* source, uint32 entry, float 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);
void GetGameObjectListWithEntryInGrid(std::list<GameObject*>& lList, WorldObject* pSource, uint32 uiEntry, float fMaxSearchRange); void GetGameObjectListWithEntryInGrid(std::list<GameObject*>& list, WorldObject* source, uint32 entry, float maxSearchRange);
#endif #endif
@@ -45,7 +45,7 @@ void npc_escortAI::AttackStart(Unit* pWho)
if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == POINT_MOTION_TYPE) if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == POINT_MOTION_TYPE)
me->GetMotionMaster()->MovementExpired(); me->GetMotionMaster()->MovementExpired();
if (IsCombatMovement()) if (IsCombatMovementAllowed())
me->GetMotionMaster()->MoveChase(pWho); me->GetMotionMaster()->MoveChase(pWho);
} }
} }
@@ -148,7 +148,7 @@ void npc_escortAI::JustRespawned()
{ {
m_uiEscortState = STATE_ESCORT_NONE; m_uiEscortState = STATE_ESCORT_NONE;
if (!IsCombatMovement()) if (!IsCombatMovementAllowed())
SetCombatMovement(true); SetCombatMovement(true);
//add a small delay before going to first waypoint, normal in near all cases //add a small delay before going to first waypoint, normal in near all cases
@@ -41,7 +41,7 @@ void FollowerAI::AttackStart(Unit* pWho)
if (me->HasUnitState(UNIT_STAT_FOLLOW)) if (me->HasUnitState(UNIT_STAT_FOLLOW))
me->ClearUnitState(UNIT_STAT_FOLLOW); me->ClearUnitState(UNIT_STAT_FOLLOW);
if (IsCombatMovement()) if (IsCombatMovementAllowed())
me->GetMotionMaster()->MoveChase(pWho); me->GetMotionMaster()->MoveChase(pWho);
} }
} }
@@ -147,7 +147,7 @@ void FollowerAI::JustRespawned()
{ {
m_uiFollowState = STATE_FOLLOW_NONE; m_uiFollowState = STATE_FOLLOW_NONE;
if (!IsCombatMovement()) if (!IsCombatMovementAllowed())
SetCombatMovement(true); SetCombatMovement(true);
if (me->getFaction() != me->GetCreatureInfo()->faction_A) if (me->getFaction() != me->GetCreatureInfo()->faction_A)
+11 -11
View File
@@ -135,7 +135,7 @@ class InstanceScript : public ZoneScript
virtual void Initialize() {} virtual void Initialize() {}
//On load //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 //When save is needed, this function generates the data
virtual std::string GetSaveData() { return GetBossSaveData(); } virtual std::string GetSaveData() { return GetBossSaveData(); }
@@ -149,24 +149,24 @@ class InstanceScript : public ZoneScript
virtual bool IsEncounterInProgress() const; virtual bool IsEncounterInProgress() const;
//Called when a player successfully enters the instance. //Called when a player successfully enters the instance.
virtual void OnPlayerEnter(Player *) {} virtual void OnPlayerEnter(Player* /*player*/) {}
//Handle open / close objects //Handle open / close objects
//use HandleGameObject(0, boolen, GO); in OnObjectCreate in instance scripts //use HandleGameObject(0, boolen, GO); in OnObjectCreate in instance scripts
//use HandleGameObject(GUID, boolen, NULL); in any other script //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 //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 //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 //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 // Send Notify to all players in instance
void DoSendNotifyToInstance(const char *format,...); void DoSendNotifyToInstance(char const* format, ...);
// Complete Achievement for all players in instance // Complete Achievement for all players in instance
void DoCompleteAchievement(uint32 achievement); void DoCompleteAchievement(uint32 achievement);
@@ -189,7 +189,7 @@ class InstanceScript : public ZoneScript
virtual bool SetBossState(uint32 id, EncounterState state); virtual bool SetBossState(uint32 id, EncounterState state);
EncounterState GetBossState(uint32 id) const { return id < bosses.size() ? bosses[id].state : TO_BE_DECIDED; } 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 // Achievement criteria additional requirements check
// NOTE: not use this if same can be checked existed requirement types from AchievementCriteriaRequirementType // NOTE: not use this if same can be checked existed requirement types from AchievementCriteriaRequirementType
@@ -213,8 +213,8 @@ class InstanceScript : public ZoneScript
protected: protected:
void SetBossNumber(uint32 number) { bosses.resize(number); } void SetBossNumber(uint32 number) { bosses.resize(number); }
void LoadDoorData(const DoorData *data); void LoadDoorData(DoorData const* data);
void LoadMinionData(const MinionData *data); void LoadMinionData(MinionData const* data);
void AddDoor(GameObject* door, bool add); void AddDoor(GameObject* door, bool add);
void AddMinion(Creature* minion, bool add); void AddMinion(Creature* minion, bool add);
@@ -222,7 +222,7 @@ class InstanceScript : public ZoneScript
void UpdateDoorState(GameObject *door); void UpdateDoorState(GameObject *door);
void UpdateMinionState(Creature *minion, EncounterState state); void UpdateMinionState(Creature *minion, EncounterState state);
std::string LoadBossState(const char * data); std::string LoadBossState(char const* data);
std::string GetBossSaveData(); std::string GetBossSaveData();
private: private:
std::vector<BossInfo> bosses; std::vector<BossInfo> bosses;
+5 -5
View File
@@ -30,13 +30,13 @@ class ZoneScript
public: public:
explicit ZoneScript() {} 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 uint32 GetGameObjectEntry(uint32 /*guidlow*/, uint32 entry) { return entry; }
virtual void OnCreatureCreate(Creature *) {} virtual void OnCreatureCreate(Creature* /*creature*/) {}
virtual void OnCreatureRemove(Creature *) {} virtual void OnCreatureRemove(Creature* /*creature*/) {}
virtual void OnGameObjectCreate(GameObject *) {} virtual void OnGameObjectCreate(GameObject* /*go*/) {}
virtual void OnGameObjectRemove(GameObject *) {} virtual void OnGameObjectRemove(GameObject* /*go*/) {}
virtual void OnCreatureDeath(Creature* /*creature*/) {} virtual void OnCreatureDeath(Creature* /*creature*/) {}
@@ -144,7 +144,7 @@ public:
void Reset() void Reset()
{ {
if (!IsCombatMovement()) if (!IsCombatMovementAllowed())
SetCombatMovement(true); SetCombatMovement(true);
m_uiPhase = PHASE_START; m_uiPhase = PHASE_START;
@@ -547,7 +547,7 @@ public:
me->SetInCombatWith(pWho); me->SetInCombatWith(pWho);
pWho->SetInCombatWith(me); pWho->SetInCombatWith(me);
if (IsCombatMovement()) if (IsCombatMovementAllowed())
me->GetMotionMaster()->MoveChase(pWho); me->GetMotionMaster()->MoveChase(pWho);
} }
} }
@@ -143,10 +143,10 @@ public:
if (me->HasAura(SPELL_WEB_FRONT_DOORS) || me->HasAura(SPELL_WEB_SIDE_DOORS)) if (me->HasAura(SPELL_WEB_FRONT_DOORS) || me->HasAura(SPELL_WEB_SIDE_DOORS))
{ {
if (IsCombatMovement()) if (IsCombatMovementAllowed())
SetCombatMovement(false); SetCombatMovement(false);
} }
else if (!IsCombatMovement()) else if (!IsCombatMovementAllowed())
SetCombatMovement(true); SetCombatMovement(true);
if (uiPierceTimer <= diff) if (uiPierceTimer <= diff)
@@ -234,7 +234,7 @@ public:
m_uiLegionFlameTimer = 30*IN_MILLISECONDS; m_uiLegionFlameTimer = 30*IN_MILLISECONDS;
} else m_uiLegionFlameTimer -= uiDiff; } 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)) if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0))
DoCast(pTarget, SPELL_TOUCH_OF_JARAXXUS); DoCast(pTarget, SPELL_TOUCH_OF_JARAXXUS);
@@ -140,8 +140,8 @@ public:
m_uiStaggeringStompTimer = 15*IN_MILLISECONDS; m_uiStaggeringStompTimer = 15*IN_MILLISECONDS;
m_uiSummonTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS);; m_uiSummonTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS);;
if (getDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL || if (GetDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL ||
getDifficulty() == RAID_DIFFICULTY_25MAN_HEROIC) GetDifficulty() == RAID_DIFFICULTY_25MAN_HEROIC)
m_uiSummonCount = 5; m_uiSummonCount = 5;
else else
m_uiSummonCount = 4; m_uiSummonCount = 4;
@@ -293,7 +293,7 @@ class boss_lady_deathwhisper : public CreatureScript
events.ScheduleEvent(EVENT_P1_SUMMON_WAVE, 5000, 0, PHASE_ONE); 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_SHADOW_BOLT, urand(5500, 6000), 0, PHASE_ONE);
events.ScheduleEvent(EVENT_P1_EMPOWER_CULTIST, urand(20000, 30000), 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); events.ScheduleEvent(EVENT_DOMINATE_MIND_H, 27000);
Talk(SAY_AGGRO); Talk(SAY_AGGRO);
@@ -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 class at_sindragosa_lair : public AreaTriggerScript
{ {
public: public:
@@ -326,4 +326,45 @@ enum WorldStatesICC
WORLDSTATE_ATTEMPTS_MAX = 4942, 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_ #endif // ICECROWN_CITADEL_H_
@@ -73,7 +73,7 @@ public:
hasTaunted = false; hasTaunted = false;
if (getDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL) if (GetDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL)
{ {
Position pos; Position pos;
@@ -115,7 +115,7 @@ public:
events.ScheduleEvent(EVENT_LOCUST, 90000); events.ScheduleEvent(EVENT_LOCUST, 90000);
events.ScheduleEvent(EVENT_BERSERK, 600000); 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)); events.ScheduleEvent(EVENT_SPAWN_GUARDIAN_NORMAL, urand(15000,20000));
} }
@@ -197,7 +197,7 @@ public:
void Reset() 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, SPELL_EFFECT_BIND, true);
me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_CHARM, true); me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_CHARM, true);
} }
@@ -205,7 +205,7 @@ public:
void JustDied(Unit * /*killer*/) 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))) if (Creature *pFaerlina = pInstance->instance->GetCreature(pInstance->GetData64(DATA_FAERLINA)))
DoCast(pFaerlina, SPELL_WIDOWS_EMBRACE); DoCast(pFaerlina, SPELL_WIDOWS_EMBRACE);
@@ -248,7 +248,7 @@ public:
void DoGothikSummon(uint32 entry) void DoGothikSummon(uint32 entry)
{ {
if (getDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL) if (GetDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL)
{ {
switch (entry) switch (entry)
{ {
@@ -406,9 +406,9 @@ public:
case EVENT_SUMMON: case EVENT_SUMMON:
if (waves[waveCount].entry) 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); 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); DoGothikSummon(waves[waveCount].entry);
else if (waves[waveCount].mode == 1) else if (waves[waveCount].mode == 1)
DoGothikSummon(waves[waveCount].entry); DoGothikSummon(waves[waveCount].entry);
@@ -428,9 +428,9 @@ public:
if (waves[waveCount].mode == 1) if (waves[waveCount].mode == 1)
events.ScheduleEvent(EVENT_SUMMON,waves[waveCount].time); 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); 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); events.ScheduleEvent(EVENT_SUMMON,waves[waveCount].time);
else else
events.ScheduleEvent(EVENT_SUMMON, 0); events.ScheduleEvent(EVENT_SUMMON, 0);
@@ -430,7 +430,7 @@ public:
events.ScheduleEvent(EVENT_DETONATE, urand(30000,40000)); events.ScheduleEvent(EVENT_DETONATE, urand(30000,40000));
events.ScheduleEvent(EVENT_FISSURE, urand(10000,30000)); events.ScheduleEvent(EVENT_FISSURE, urand(10000,30000));
events.ScheduleEvent(EVENT_BLAST, urand(60000,120000)); 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)); events.ScheduleEvent(EVENT_CHAIN, urand(30000,60000));
Phase = 2; Phase = 2;
break; break;
@@ -106,7 +106,7 @@ public:
events.ScheduleEvent(EVENT_BALCONY, 110000); events.ScheduleEvent(EVENT_BALCONY, 110000);
events.ScheduleEvent(EVENT_CURSE, 10000+rand()%15000); events.ScheduleEvent(EVENT_CURSE, 10000+rand()%15000);
events.ScheduleEvent(EVENT_WARRIOR, 30000); events.ScheduleEvent(EVENT_WARRIOR, 30000);
if (getDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL) if (GetDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL)
events.ScheduleEvent(EVENT_BLINK, 20000 + rand()%20000); events.ScheduleEvent(EVENT_BLINK, 20000 + rand()%20000);
} }
} }