Fix timed achievement checks for boss killed in instance.

Requires DB update.

--HG--
branch : trunk
This commit is contained in:
Trazom62
2010-04-27 22:26:30 +02:00
parent 36ebd58b37
commit e719bd32a3
17 changed files with 240 additions and 119 deletions
+22
View File
@@ -339,6 +339,28 @@ void InstanceData::DoUpdateAchievementCriteria(AchievementCriteriaTypes type, ui
pPlayer->UpdateAchievementCriteria(type, miscvalue1, miscvalue2, unit, time); pPlayer->UpdateAchievementCriteria(type, miscvalue1, miscvalue2, unit, time);
} }
// Start timed achievement for all players in instance
void InstanceData::DoStartTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry)
{
Map::PlayerList const &PlayerList = instance->GetPlayers();
if (!PlayerList.isEmpty())
for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
if (Player *pPlayer = i->getSource())
pPlayer->GetAchievementMgr().StartTimedAchievement(type, entry);
}
// Stop timed achievement for all players in instance
void InstanceData::DoStopTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry)
{
Map::PlayerList const &PlayerList = instance->GetPlayers();
if (!PlayerList.isEmpty())
for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
if (Player *pPlayer = i->getSource())
pPlayer->GetAchievementMgr().RemoveTimedAchievement(type, entry);
}
// Remove Auras due to Spell on all players in instance // Remove Auras due to Spell on all players in instance
void InstanceData::DoRemoveAurasDueToSpellOnPlayers(uint32 spell) void InstanceData::DoRemoveAurasDueToSpellOnPlayers(uint32 spell)
{ {
+4
View File
@@ -162,6 +162,10 @@ class InstanceData : public ZoneScript
// Update Achievement Criteria for all players in instance // 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);
void DoStopTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry);
// Remove Auras due to Spell on all players in instance // Remove Auras due to Spell on all players in instance
void DoRemoveAurasDueToSpellOnPlayers(uint32 spell); void DoRemoveAurasDueToSpellOnPlayers(uint32 spell);
@@ -66,7 +66,9 @@ enum
PHASE_START = 1, PHASE_START = 1,
PHASE_BREATH = 2, PHASE_BREATH = 2,
PHASE_END = 3 PHASE_END = 3,
ACHIEV_TIMED_START_EVENT = 6601,
}; };
struct sOnyxMove struct sOnyxMove
@@ -97,7 +99,12 @@ static float afSpawnLocations[2][3]=
struct boss_onyxiaAI : public ScriptedAI struct boss_onyxiaAI : public ScriptedAI
{ {
boss_onyxiaAI(Creature* pCreature) : ScriptedAI(pCreature) {Reset();} boss_onyxiaAI(Creature* pCreature) : ScriptedAI(pCreature)
{
instance = me->GetInstanceData();
}
InstanceData *instance;
uint32 m_uiPhase; uint32 m_uiPhase;
@@ -122,6 +129,9 @@ struct boss_onyxiaAI : public ScriptedAI
void Reset() void Reset()
{ {
if (instance)
instance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT);
if (!IsCombatMovement()) if (!IsCombatMovement())
SetCombatMovement(true); SetCombatMovement(true);
@@ -147,10 +157,13 @@ struct boss_onyxiaAI : public ScriptedAI
m_bIsSummoningLairGuards = false; m_bIsSummoningLairGuards = false;
} }
void Aggro(Unit* /*pWho*/) void EnterCombat(Unit* /*pWho*/)
{ {
DoScriptText(SAY_AGGRO, me); DoScriptText(SAY_AGGRO, me);
me->SetInCombatWithZone(); me->SetInCombatWithZone();
if (instance)
instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT);
} }
void JustSummoned(Creature *pSummoned) void JustSummoned(Creature *pSummoned)
@@ -61,7 +61,7 @@ enum Yells
enum Achievements enum Achievements
{ {
ACHIEV_QUICK_DEMISE = 1862 ACHIEV_QUICK_DEMISE_START_EVENT = 20382,
}; };
struct boss_volazjAI : public ScriptedAI struct boss_volazjAI : public ScriptedAI
@@ -76,7 +76,6 @@ struct boss_volazjAI : public ScriptedAI
uint32 uiMindFlayTimer; uint32 uiMindFlayTimer;
uint32 uiShadowBoltVolleyTimer; uint32 uiShadowBoltVolleyTimer;
uint32 uiShiverTimer; uint32 uiShiverTimer;
uint32 uiEncounterTimer;
uint32 insanityHandled; uint32 insanityHandled;
SummonList Summons; SummonList Summons;
@@ -143,13 +142,15 @@ struct boss_volazjAI : public ScriptedAI
void Reset() void Reset()
{ {
uiEncounterTimer = 0;
uiMindFlayTimer = 8*IN_MILISECONDS; uiMindFlayTimer = 8*IN_MILISECONDS;
uiShadowBoltVolleyTimer = 5*IN_MILISECONDS; uiShadowBoltVolleyTimer = 5*IN_MILISECONDS;
uiShiverTimer = 15*IN_MILISECONDS; uiShiverTimer = 15*IN_MILISECONDS;
if (pInstance) if (pInstance)
{
pInstance->SetData(DATA_HERALD_VOLAZJ, NOT_STARTED); pInstance->SetData(DATA_HERALD_VOLAZJ, NOT_STARTED);
pInstance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_QUICK_DEMISE_START_EVENT);
}
// Visible for all players in insanity // Visible for all players in insanity
me->SetPhaseMask((1|16|32|64|128|256),true); me->SetPhaseMask((1|16|32|64|128|256),true);
@@ -166,7 +167,10 @@ struct boss_volazjAI : public ScriptedAI
DoScriptText(SAY_AGGRO, me); DoScriptText(SAY_AGGRO, me);
if (pInstance) if (pInstance)
{
pInstance->SetData(DATA_HERALD_VOLAZJ, IN_PROGRESS); pInstance->SetData(DATA_HERALD_VOLAZJ, IN_PROGRESS);
pInstance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_QUICK_DEMISE_START_EVENT);
}
} }
void JustSummoned(Creature *summon) void JustSummoned(Creature *summon)
@@ -278,20 +282,15 @@ struct boss_volazjAI : public ScriptedAI
uiShiverTimer = 15*IN_MILISECONDS; uiShiverTimer = 15*IN_MILISECONDS;
} else uiShiverTimer -= diff; } else uiShiverTimer -= diff;
uiEncounterTimer += diff;
DoMeleeAttackIfReady(); DoMeleeAttackIfReady();
} }
void JustDied(Unit* /*killer*/) void JustDied(Unit* /*killer*/)
{ {
DoScriptText(SAY_DEATH_1, me); DoScriptText(SAY_DEATH_1, me);
if (pInstance) if (pInstance)
{
pInstance->SetData(DATA_HERALD_VOLAZJ, DONE); pInstance->SetData(DATA_HERALD_VOLAZJ, DONE);
if (IsHeroic() && uiEncounterTimer < 120*IN_MILISECONDS)
pInstance->DoCompleteAchievement(ACHIEV_QUICK_DEMISE);
}
Summons.DespawnAll(); Summons.DespawnAll();
} }
@@ -54,6 +54,11 @@ enum Yells
SAY_DEATH = -1601004 SAY_DEATH = -1601004
}; };
enum
{
ACHIEV_TIMED_START_EVENT = 20381,
};
const Position SpawnPoint[2] = const Position SpawnPoint[2] =
{ {
{ 550.7, 282.8, 224.3 }, { 550.7, 282.8, 224.3 },
@@ -105,16 +110,21 @@ struct boss_anub_arakAI : public ScriptedAI
lSummons.DespawnAll(); lSummons.DespawnAll();
if (pInstance) if (pInstance)
{
pInstance->SetData(DATA_ANUBARAK_EVENT, NOT_STARTED); pInstance->SetData(DATA_ANUBARAK_EVENT, NOT_STARTED);
pInstance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT);
}
} }
void EnterCombat(Unit * /*who*/) void EnterCombat(Unit * /*who*/)
{ {
DoScriptText(SAY_AGGRO, me); DoScriptText(SAY_AGGRO, me);
if (pInstance) if (pInstance)
{
pInstance->SetData(DATA_ANUBARAK_EVENT, IN_PROGRESS); pInstance->SetData(DATA_ANUBARAK_EVENT, IN_PROGRESS);
pInstance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT);
}
} }
@@ -45,6 +45,11 @@ enum Spells
SPELL_BERSERK = 27680, SPELL_BERSERK = 27680,
}; };
enum
{
ACHIEV_TIMED_START_EVENT = 9891,
};
struct boss_anubrekhanAI : public BossAI struct boss_anubrekhanAI : public BossAI
{ {
boss_anubrekhanAI(Creature *c) : BossAI(c, BOSS_ANUBREKHAN) {} boss_anubrekhanAI(Creature *c) : BossAI(c, BOSS_ANUBREKHAN) {}
@@ -83,6 +88,14 @@ struct boss_anubrekhanAI : public BossAI
DoScriptText(SAY_SLAY, me); DoScriptText(SAY_SLAY, me);
} }
void JustDied(Unit *)
{
_JustDied();
// start achievement timer (kill Maexna within 20 min)
if (instance)
instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT);
}
void EnterCombat(Unit * /*who*/) void EnterCombat(Unit * /*who*/)
{ {
_EnterCombat(); _EnterCombat();
@@ -44,8 +44,10 @@ enum Events
EVENT_SLIME EVENT_SLIME
}; };
#define ACHIEVEMENT_MAKE_QUICK_WERK_OF_HIM RAID_MODE(1856, 1857) enum
#define MAX_ENCOUNTER_TIME 3 * 60 * 1000 {
ACHIEV_MAKE_QUICK_WERK_OF_HIM_STARTING_EVENT = 10286,
};
struct boss_patchwerkAI : public BossAI struct boss_patchwerkAI : public BossAI
{ {
@@ -53,7 +55,13 @@ struct boss_patchwerkAI : public BossAI
bool Enraged; bool Enraged;
uint32 EncounterTime; void Reset()
{
_Reset();
if (instance)
instance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_MAKE_QUICK_WERK_OF_HIM_STARTING_EVENT);
}
void KilledUnit(Unit* /*Victim*/) void KilledUnit(Unit* /*Victim*/)
{ {
@@ -65,31 +73,18 @@ struct boss_patchwerkAI : public BossAI
{ {
_JustDied(); _JustDied();
DoScriptText(SAY_DEATH, me); DoScriptText(SAY_DEATH, me);
if (EncounterTime <= MAX_ENCOUNTER_TIME)
{
AchievementEntry const *AchievMakeQuickWerkOfHim = GetAchievementStore()->LookupEntry(ACHIEVEMENT_MAKE_QUICK_WERK_OF_HIM);
if (AchievMakeQuickWerkOfHim)
{
Map *pMap = me->GetMap();
if (pMap && pMap->IsDungeon())
{
Map::PlayerList const &players = pMap->GetPlayers();
for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
itr->getSource()->CompletedAchievement(AchievMakeQuickWerkOfHim);
}
}
}
} }
void EnterCombat(Unit * /*who*/) void EnterCombat(Unit * /*who*/)
{ {
_EnterCombat(); _EnterCombat();
Enraged = false; Enraged = false;
EncounterTime = 0;
DoScriptText(RAND(SAY_AGGRO_1,SAY_AGGRO_2), me); DoScriptText(RAND(SAY_AGGRO_1,SAY_AGGRO_2), me);
events.ScheduleEvent(EVENT_HATEFUL, 1200); events.ScheduleEvent(EVENT_HATEFUL, 1200);
events.ScheduleEvent(EVENT_BERSERK, 360000); events.ScheduleEvent(EVENT_BERSERK, 360000);
if (instance)
instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_MAKE_QUICK_WERK_OF_HIM_STARTING_EVENT);
} }
void UpdateAI(const uint32 diff) void UpdateAI(const uint32 diff)
@@ -99,8 +94,6 @@ struct boss_patchwerkAI : public BossAI
events.Update(diff); events.Update(diff);
EncounterTime += diff;
while (uint32 eventId = events.ExecuteEvent()) while (uint32 eventId = events.ExecuteEvent())
{ {
switch(eventId) switch(eventId)
@@ -83,37 +83,54 @@ After all of the NPCs riding on the disks die, the players on the disks need to
#define SAY_PHASE3_SLAY_3 -1616027 #define SAY_PHASE3_SLAY_3 -1616027
#define SAY_PHASE3_BIG_ATTACK -1616028 #define SAY_PHASE3_BIG_ATTACK -1616028
enum
{
ACHIEV_TIMED_START_EVENT = 20387,
};
struct boss_malygosAI : public ScriptedAI struct boss_malygosAI : public ScriptedAI
{ {
boss_malygosAI(Creature *c) : ScriptedAI(c) {} boss_malygosAI(Creature *c) : ScriptedAI(c)
{
instance = me->GetInstanceData();
}
uint32 phase, InstanceData *instance;
enrage;
uint32 phase;
uint32 enrage;
void Reset() void Reset()
{ {
//Source Deadly Boss Mod phase = 1;
enrage = 615000; //10 min enrage = 615000; //Source Deadly Boss Mod
if (instance)
instance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT);
} }
void EnterCombat(Unit* /*who*/) void EnterCombat(Unit* /*who*/)
{ {
if (phase == 1) if (phase == 1)
{
DoScriptText(SAY_PHASE1_AGGRO, me); DoScriptText(SAY_PHASE1_AGGRO, me);
if (instance)
instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT);
}
if (phase == 2) if (phase == 2)
DoScriptText(SAY_PHASE1_AGGRO, me); DoScriptText(SAY_PHASE1_AGGRO, me);
if (phase == 3) if (phase == 3)
DoScriptText(SAY_PHASE1_AGGRO, me); DoScriptText(SAY_PHASE1_AGGRO, me);
} }
void AttackStart(Unit* /*who*/) {}
void MoveInLineOfSight(Unit* /*who*/) {}
void UpdateAI(const uint32 /*diff*/) void UpdateAI(const uint32 /*diff*/)
{ {
phase =1;
//Return since we have no target //Return since we have no target
if (!UpdateVictim()) if (!UpdateVictim())
return; return;
if ((me->GetHealth()*100 / me->GetMaxHealth()) <= 50){ if (phase == 1 && HealthBelowPct(50)) {
phase = 2; phase = 2;
//spawn adds //spawn adds
//set malygos unatackable untill all adds spawned dead //set malygos unatackable untill all adds spawned dead
@@ -122,10 +139,12 @@ struct boss_malygosAI : public ScriptedAI
DoMeleeAttackIfReady(); DoMeleeAttackIfReady();
} }
void JustDied(Unit* /*killer*/) void JustDied(Unit* /*killer*/)
{ {
DoScriptText(SAY_DEATH, me); DoScriptText(SAY_DEATH, me);
} }
void KilledUnit(Unit * victim) void KilledUnit(Unit * victim)
{ {
if (victim == me) if (victim == me)
@@ -46,6 +46,11 @@ enum Yells
SAY_STOMP_3 = -1578011 SAY_STOMP_3 = -1578011
}; };
enum
{
ACHIEV_TIMED_START_EVENT = 18153,
};
struct boss_drakosAI : public ScriptedAI struct boss_drakosAI : public ScriptedAI
{ {
boss_drakosAI(Creature *c) : ScriptedAI(c), lSummons(me) boss_drakosAI(Creature *c) : ScriptedAI(c), lSummons(me)
@@ -81,6 +86,7 @@ struct boss_drakosAI : public ScriptedAI
if (pInstance) if (pInstance)
pInstance->SetData(DATA_DRAKOS_EVENT, IN_PROGRESS); pInstance->SetData(DATA_DRAKOS_EVENT, IN_PROGRESS);
} }
void JustSummoned(Creature* summon) void JustSummoned(Creature* summon)
{ {
lSummons.Summon(summon); lSummons.Summon(summon);
@@ -144,12 +150,17 @@ struct boss_drakosAI : public ScriptedAI
DoMeleeAttackIfReady(); DoMeleeAttackIfReady();
} }
void JustDied(Unit* /*killer*/) void JustDied(Unit* /*killer*/)
{ {
DoScriptText(SAY_DEATH, me); DoScriptText(SAY_DEATH, me);
if (pInstance) if (pInstance)
{
pInstance->SetData(DATA_DRAKOS_EVENT, DONE); pInstance->SetData(DATA_DRAKOS_EVENT, DONE);
// start achievement timer (kill Eregos within 20 min)
pInstance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT);
}
} }
void KilledUnit(Unit * /*victim*/) void KilledUnit(Unit * /*victim*/)
{ {
@@ -24,34 +24,32 @@ EndScriptData */
#include "ScriptedPch.h" #include "ScriptedPch.h"
#include "halls_of_lightning.h" #include "halls_of_lightning.h"
#define MAX_ENCOUNTER_TIME 2 * 60 * 1000
enum eEnums enum eEnums
{ {
ACHIEVEMENT_TIMELY_DEATH = 1867, ACHIEV_TIMELY_DEATH_START_EVENT = 20384,
SAY_AGGRO = -1602018, SAY_AGGRO = -1602018,
SAY_INTRO_1 = -1602019, SAY_INTRO_1 = -1602019,
SAY_INTRO_2 = -1602020, SAY_INTRO_2 = -1602020,
SAY_SLAY_1 = -1602021, SAY_SLAY_1 = -1602021,
SAY_SLAY_2 = -1602022, SAY_SLAY_2 = -1602022,
SAY_SLAY_3 = -1602023, SAY_SLAY_3 = -1602023,
SAY_DEATH = -1602024, SAY_DEATH = -1602024,
SAY_NOVA_1 = -1602025, SAY_NOVA_1 = -1602025,
SAY_NOVA_2 = -1602026, SAY_NOVA_2 = -1602026,
SAY_NOVA_3 = -1602027, SAY_NOVA_3 = -1602027,
SAY_75HEALTH = -1602028, SAY_75HEALTH = -1602028,
SAY_50HEALTH = -1602029, SAY_50HEALTH = -1602029,
SAY_25HEALTH = -1602030, SAY_25HEALTH = -1602030,
EMOTE_NOVA = -1602031, EMOTE_NOVA = -1602031,
SPELL_ARC_LIGHTNING = 52921, SPELL_ARC_LIGHTNING = 52921,
SPELL_LIGHTNING_NOVA_N = 52960, SPELL_LIGHTNING_NOVA_N = 52960,
SPELL_LIGHTNING_NOVA_H = 59835, SPELL_LIGHTNING_NOVA_H = 59835,
SPELL_PULSING_SHOCKWAVE_N = 52961, SPELL_PULSING_SHOCKWAVE_N = 52961,
SPELL_PULSING_SHOCKWAVE_H = 59836, SPELL_PULSING_SHOCKWAVE_H = 59836,
SPELL_PULSING_SHOCKWAVE_AURA = 59414 SPELL_PULSING_SHOCKWAVE_AURA = 59414
}; };
/*###### /*######
@@ -76,8 +74,6 @@ struct boss_lokenAI : public ScriptedAI
uint32 m_uiHealthAmountModifier; uint32 m_uiHealthAmountModifier;
uint32 EncounterTime;
void Reset() void Reset()
{ {
m_bIsAura = false; m_bIsAura = false;
@@ -90,38 +86,27 @@ struct boss_lokenAI : public ScriptedAI
m_uiHealthAmountModifier = 1; m_uiHealthAmountModifier = 1;
if (m_pInstance) if (m_pInstance)
{
m_pInstance->SetData(TYPE_LOKEN, NOT_STARTED); m_pInstance->SetData(TYPE_LOKEN, NOT_STARTED);
m_pInstance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMELY_DEATH_START_EVENT);
}
} }
void EnterCombat(Unit* /*pWho*/) void EnterCombat(Unit* /*pWho*/)
{ {
DoScriptText(SAY_AGGRO, me); DoScriptText(SAY_AGGRO, me);
EncounterTime = 0;
if (m_pInstance) if (m_pInstance)
{
m_pInstance->SetData(TYPE_LOKEN, IN_PROGRESS); m_pInstance->SetData(TYPE_LOKEN, IN_PROGRESS);
m_pInstance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMELY_DEATH_START_EVENT);
}
} }
void JustDied(Unit* /*pKiller*/) void JustDied(Unit* /*pKiller*/)
{ {
DoScriptText(SAY_DEATH, me); DoScriptText(SAY_DEATH, me);
if (IsHeroic() && EncounterTime <= MAX_ENCOUNTER_TIME)
{
AchievementEntry const *AchievTimelyDeath = GetAchievementStore()->LookupEntry(ACHIEVEMENT_TIMELY_DEATH);
if (AchievTimelyDeath)
{
Map* pMap = me->GetMap();
if (pMap && pMap->IsDungeon())
{
Map::PlayerList const &players = pMap->GetPlayers();
for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
itr->getSource()->CompletedAchievement(AchievTimelyDeath);
}
}
}
if (m_pInstance) if (m_pInstance)
m_pInstance->SetData(TYPE_LOKEN, DONE); m_pInstance->SetData(TYPE_LOKEN, DONE);
} }
@@ -137,8 +122,6 @@ struct boss_lokenAI : public ScriptedAI
if (!UpdateVictim()) if (!UpdateVictim())
return; return;
EncounterTime += uiDiff;
if (m_bIsAura) if (m_bIsAura)
{ {
// workaround for PULSING_SHOCKWAVE // workaround for PULSING_SHOCKWAVE
@@ -14,29 +14,29 @@ update creature_template set scriptname = 'boss_maiden_of_grief' where entry = '
enum Spells enum Spells
{ {
SPELL_PARTING_SORROW = 59723, SPELL_PARTING_SORROW = 59723,
SPELL_STORM_OF_GRIEF_N = 50752, SPELL_STORM_OF_GRIEF_N = 50752,
SPELL_STORM_OF_GRIEF_H = 59772, SPELL_STORM_OF_GRIEF_H = 59772,
SPELL_SHOCK_OF_SORROW_N = 50760, SPELL_SHOCK_OF_SORROW_N = 50760,
SPELL_SHOCK_OF_SORROW_H = 59726, SPELL_SHOCK_OF_SORROW_H = 59726,
SPELL_PILLAR_OF_WOE_N = 50761, SPELL_PILLAR_OF_WOE_N = 50761,
SPELL_PILLAR_OF_WOE_H = 59727 SPELL_PILLAR_OF_WOE_H = 59727
}; };
enum Yells enum Yells
{ {
SAY_AGGRO = -1599000, SAY_AGGRO = -1599000,
SAY_SLAY_1 = -1599001, SAY_SLAY_1 = -1599001,
SAY_SLAY_2 = -1599002, SAY_SLAY_2 = -1599002,
SAY_SLAY_3 = -1599003, SAY_SLAY_3 = -1599003,
SAY_SLAY_4 = -1599004, SAY_SLAY_4 = -1599004,
SAY_DEATH = -1599005, SAY_DEATH = -1599005,
SAY_STUN = -1599006 SAY_STUN = -1599006
}; };
enum Achievements enum Achievements
{ {
ACHIEVEMENT_GOOD_GRIEF = 1866 ACHIEV_GOOD_GRIEF_START_EVENT = 20383,
}; };
struct boss_maiden_of_griefAI : public ScriptedAI struct boss_maiden_of_griefAI : public ScriptedAI
@@ -52,7 +52,6 @@ struct boss_maiden_of_griefAI : public ScriptedAI
uint32 StormOfGriefTimer; uint32 StormOfGriefTimer;
uint32 ShockOfSorrowTimer; uint32 ShockOfSorrowTimer;
uint32 PillarOfWoeTimer; uint32 PillarOfWoeTimer;
uint32 AchievTimer;
void Reset() void Reset()
{ {
@@ -60,10 +59,12 @@ struct boss_maiden_of_griefAI : public ScriptedAI
StormOfGriefTimer = 10000; StormOfGriefTimer = 10000;
ShockOfSorrowTimer = 20000+rand()%5000; ShockOfSorrowTimer = 20000+rand()%5000;
PillarOfWoeTimer = 5000 + rand()%10000; PillarOfWoeTimer = 5000 + rand()%10000;
AchievTimer = 0;
if (pInstance) if (pInstance)
{
pInstance->SetData(DATA_MAIDEN_OF_GRIEF_EVENT, NOT_STARTED); pInstance->SetData(DATA_MAIDEN_OF_GRIEF_EVENT, NOT_STARTED);
pInstance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_GOOD_GRIEF_START_EVENT);
}
} }
void EnterCombat(Unit* /*who*/) void EnterCombat(Unit* /*who*/)
@@ -80,6 +81,7 @@ struct boss_maiden_of_griefAI : public ScriptedAI
} }
pInstance->SetData(DATA_MAIDEN_OF_GRIEF_EVENT, IN_PROGRESS); pInstance->SetData(DATA_MAIDEN_OF_GRIEF_EVENT, IN_PROGRESS);
pInstance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_GOOD_GRIEF_START_EVENT);
} }
} }
@@ -89,11 +91,6 @@ struct boss_maiden_of_griefAI : public ScriptedAI
if (!UpdateVictim()) if (!UpdateVictim())
return; return;
//Achievement counter
if (pInstance)
if (pInstance->GetData(DATA_MAIDEN_OF_GRIEF_EVENT) == IN_PROGRESS)
AchievTimer += diff;
if (IsHeroic()) if (IsHeroic())
{ {
if (PartingSorrowTimer <= diff) if (PartingSorrowTimer <= diff)
@@ -135,23 +132,15 @@ struct boss_maiden_of_griefAI : public ScriptedAI
DoMeleeAttackIfReady(); DoMeleeAttackIfReady();
} }
void JustDied(Unit* /*killer*/) void JustDied(Unit* /*killer*/)
{ {
DoScriptText(SAY_DEATH, me); DoScriptText(SAY_DEATH, me);
if (pInstance) if (pInstance)
pInstance->SetData(DATA_MAIDEN_OF_GRIEF_EVENT, DONE); pInstance->SetData(DATA_MAIDEN_OF_GRIEF_EVENT, DONE);
AchievementEntry const *AchievGoodGrief = GetAchievementStore()->LookupEntry(ACHIEVEMENT_GOOD_GRIEF);
Map* pMap = me->GetMap();
if (IsHeroic() && AchievTimer < 60000 && pMap && pMap->IsDungeon() && AchievGoodGrief)
{
Map::PlayerList const &players = pMap->GetPlayers();
for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
itr->getSource()->CompletedAchievement(AchievGoodGrief);
}
} }
void KilledUnit(Unit * victim) void KilledUnit(Unit * victim)
{ {
if (victim == me) if (victim == me)
@@ -51,6 +51,20 @@ enum Yells
SAY_STONEBARK_DEATH = -1603201, SAY_STONEBARK_DEATH = -1603201,
}; };
enum
{
// Con-speed-atory timed achievement.
// TODO Should be started when 1st trash is killed.
ACHIEV_CON_SPEED_ATORY_START_EVENT = 21597,
SPELL_ACHIEVEMENT_CHECK = 65074,
// Lumberjacked timed achievement.
// TODO should be started when 1st elder is killed.
// Spell should be casted when 3rd elder is killed.
ACHIEV_LUMBERJACKED = 21686,
SPELL_LUMBERJACKED_ACHIEVEMENT_CHECK = 65296,
};
struct boss_freyaAI : public BossAI struct boss_freyaAI : public BossAI
{ {
boss_freyaAI(Creature* pCreature) : BossAI(pCreature, TYPE_FREYA) boss_freyaAI(Creature* pCreature) : BossAI(pCreature, TYPE_FREYA)
@@ -71,6 +85,10 @@ struct boss_freyaAI : public BossAI
{ {
DoScriptText(SAY_DEATH, me); DoScriptText(SAY_DEATH, me);
_JustDied(); _JustDied();
// cast is not rewarding the achievement.
// DoCast(SPELL_ACHIEVEMENT_CHECK);
instance->DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, SPELL_ACHIEVEMENT_CHECK);
} }
void EnterCombat(Unit* /*pWho*/) void EnterCombat(Unit* /*pWho*/)
@@ -36,6 +36,11 @@ enum Yells
SAY_BERSERK = -1603228, SAY_BERSERK = -1603228,
}; };
enum
{
ACHIEV_TIMED_START_EVENT = 20951,
};
struct boss_ignis_AI : public BossAI struct boss_ignis_AI : public BossAI
{ {
boss_ignis_AI(Creature *pCreature) : BossAI(pCreature, TYPE_IGNIS) {} boss_ignis_AI(Creature *pCreature) : BossAI(pCreature, TYPE_IGNIS) {}
@@ -50,12 +55,18 @@ struct boss_ignis_AI : public BossAI
uiFlameJetsTimer = 32000; uiFlameJetsTimer = 32000;
uiScorchTimer = 100; uiScorchTimer = 100;
uiSlagPotTimer = 100; uiSlagPotTimer = 100;
if (instance)
instance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT);
} }
void EnterCombat(Unit* /*who*/) void EnterCombat(Unit* /*who*/)
{ {
DoScriptText(SAY_AGGRO,me); DoScriptText(SAY_AGGRO,me);
_EnterCombat(); _EnterCombat();
if (instance)
instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT);
} }
void KilledUnit(Unit* /*victim*/) void KilledUnit(Unit* /*victim*/)
@@ -50,6 +50,11 @@ enum Yells
SAY_BERSERK = -1603238, SAY_BERSERK = -1603238,
}; };
enum
{
ACHIEV_DISARMED_START_EVENT = 21687,
};
struct boss_kologarnAI : public BossAI struct boss_kologarnAI : public BossAI
{ {
boss_kologarnAI(Creature *pCreature) : BossAI(pCreature, TYPE_KOLOGARN), vehicle(pCreature->GetVehicleKit()), boss_kologarnAI(Creature *pCreature) : BossAI(pCreature, TYPE_KOLOGARN), vehicle(pCreature->GetVehicleKit()),
@@ -87,6 +92,10 @@ struct boss_kologarnAI : public BossAI
left = apply; left = apply;
else if (who->GetEntry() == 32934) else if (who->GetEntry() == 32934)
right = apply; right = apply;
if (!apply && instance)
instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_DISARMED_START_EVENT);
who->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); who->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED);
CAST_CRE(who)->SetReactState(REACT_PASSIVE); CAST_CRE(who)->SetReactState(REACT_PASSIVE);
} }
@@ -126,6 +126,11 @@ enum Yells
SAY_SUMMON = -1603308, SAY_SUMMON = -1603308,
}; };
enum
{
ACHIEV_TIMED_START_EVENT = 21027,
};
//#define GRAVITY_BOMB_DMG_MIN_10 11700 //#define GRAVITY_BOMB_DMG_MIN_10 11700
//#define GRAVITY_BOMB_DMG_MAX_10 12300 //#define GRAVITY_BOMB_DMG_MAX_10 12300
//#define GRAVITY_BOMB_DMG_MIN_25 14625 //#define GRAVITY_BOMB_DMG_MIN_25 14625
@@ -213,12 +218,18 @@ struct boss_xt002_AI : public BossAI
phase = 1; phase = 1;
heart_exposed = 0; heart_exposed = 0;
if (instance)
instance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT);
} }
void EnterCombat(Unit* /*who*/) void EnterCombat(Unit* /*who*/)
{ {
DoScriptText(SAY_AGGRO, me); DoScriptText(SAY_AGGRO, me);
_EnterCombat(); _EnterCombat();
if (instance)
instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT);
} }
void DoAction(const int32 action) void DoAction(const int32 action)
@@ -48,3 +48,8 @@ enum YoggSaron_Yells
WHISP_INSANITY_2 = -1603340, WHISP_INSANITY_2 = -1603340,
SAY_DEATH = -1603341, SAY_DEATH = -1603341,
}; };
enum
{
ACHIEV_TIMED_START_EVENT = 21001,
};
@@ -67,6 +67,11 @@ enum CombatPhase
SKADI SKADI
}; };
enum
{
ACHIEV_TIMED_START_EVENT = 17726,
};
struct boss_skadiAI : public ScriptedAI struct boss_skadiAI : public ScriptedAI
{ {
boss_skadiAI(Creature *c) : ScriptedAI(c) boss_skadiAI(Creature *c) : ScriptedAI(c)
@@ -101,7 +106,10 @@ struct boss_skadiAI : public ScriptedAI
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
if (pInstance) if (pInstance)
{
pInstance->SetData(DATA_SKADI_THE_RUTHLESS_EVENT, NOT_STARTED); pInstance->SetData(DATA_SKADI_THE_RUTHLESS_EVENT, NOT_STARTED);
pInstance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT);
}
} }
void EnterCombat(Unit* /*who*/) void EnterCombat(Unit* /*who*/)
@@ -116,7 +124,10 @@ struct boss_skadiAI : public ScriptedAI
Phase = FLYING; Phase = FLYING;
if (pInstance) if (pInstance)
{
pInstance->SetData(DATA_SKADI_THE_RUTHLESS_EVENT, IN_PROGRESS); pInstance->SetData(DATA_SKADI_THE_RUTHLESS_EVENT, IN_PROGRESS);
pInstance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT);
}
} }
void UpdateAI(const uint32 diff) void UpdateAI(const uint32 diff)