diff --git a/sql/updates/world/2011_06_23_01_world_achievement_criteria_data.sql b/sql/updates/world/2011_06_23_01_world_achievement_criteria_data.sql new file mode 100644 index 0000000000..dab87f3b11 --- /dev/null +++ b/sql/updates/world/2011_06_23_01_world_achievement_criteria_data.sql @@ -0,0 +1,6 @@ +DELETE FROM `disables` WHERE `entry`=7318 AND `sourceType`=4; + +DELETE FROM `achievement_criteria_data` WHERE `criteria_id`=7318 AND `type`=11; +INSERT INTO `achievement_criteria_data` (`criteria_id`,`type`,`value1`,`value2`,`ScriptName`) +VALUES +(7318,11,0,0,'achievement_king_dred'); diff --git a/src/server/scripts/Northrend/DraktharonKeep/boss_dred.cpp b/src/server/scripts/Northrend/DraktharonKeep/boss_dred.cpp index 55d93f6997..36b5a13390 100644 --- a/src/server/scripts/Northrend/DraktharonKeep/boss_dred.cpp +++ b/src/server/scripts/Northrend/DraktharonKeep/boss_dred.cpp @@ -22,7 +22,7 @@ #include "ScriptPCH.h" #include "drak_tharon_keep.h" -enum eSpells +enum Spells { SPELL_BELLOWING_ROAR = 22686, // fears the group, can be resisted/dispelled SPELL_GRIEVOUS_BITE = 48920, @@ -35,240 +35,267 @@ enum eSpells SPELL_REND = 13738 }; -enum eArchivements -{ - ACHIEV_BETTER_OFF_DRED = 2039 -}; - enum Creatures { NPC_RAPTOR_1 = 26641, NPC_RAPTOR_2 = 26628 }; +#define ACTION_RAPTOR_KILLED 1 +#define DATA_KING_DRED 2 + class boss_dred : public CreatureScript { -public: - boss_dred() : CreatureScript("boss_dred") { } + public: + boss_dred() : CreatureScript("boss_dred") { } - struct boss_dredAI : public ScriptedAI - { - boss_dredAI(Creature *c) : ScriptedAI(c) + struct boss_dredAI : public ScriptedAI { - pInstance = c->GetInstanceScript(); - } - - uint32 uiBellowingRoarTimer; - uint32 uiGrievousBiteTimer; - uint32 uiManglingSlashTimer; - uint32 uiFearsomeRoarTimer; - uint32 uiPiercingSlashTimer; - uint32 uiRaptorCallTimer; - - InstanceScript* pInstance; - - void Reset() - { - if (pInstance) + boss_dredAI(Creature* creature) : ScriptedAI(creature) { - pInstance->SetData(DATA_DRED_EVENT, NOT_STARTED); - pInstance->SetData(DATA_KING_DRED_ACHIEV, 0); + instance = me->GetInstanceScript(); } - uiBellowingRoarTimer = 33*IN_MILLISECONDS; - uiGrievousBiteTimer = 20*IN_MILLISECONDS; - uiManglingSlashTimer = 18500; - uiFearsomeRoarTimer = urand(10*IN_MILLISECONDS, 20*IN_MILLISECONDS); - uiPiercingSlashTimer = 17*IN_MILLISECONDS; - uiRaptorCallTimer = urand(20*IN_MILLISECONDS, 25*IN_MILLISECONDS); - } + uint32 uiBellowingRoarTimer; + uint32 uiGrievousBiteTimer; + uint32 uiManglingSlashTimer; + uint32 uiFearsomeRoarTimer; + uint32 uiPiercingSlashTimer; + uint32 uiRaptorCallTimer; + uint8 raptorsKilled; - void EnterCombat(Unit* /*who*/) - { - if (pInstance) - pInstance->SetData(DATA_DRED_EVENT, IN_PROGRESS); - } + InstanceScript* instance; - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - if (uiBellowingRoarTimer < diff) + void Reset() { - DoCastAOE(SPELL_BELLOWING_ROAR, false); - uiBellowingRoarTimer = 40*IN_MILLISECONDS; - } else uiBellowingRoarTimer -=diff; + if (instance) + instance->SetData(DATA_DRED_EVENT, NOT_STARTED); - if (uiGrievousBiteTimer < diff) - { - DoCastVictim(SPELL_GRIEVOUS_BITE , false); - uiGrievousBiteTimer = 20*IN_MILLISECONDS; - } else uiGrievousBiteTimer -=diff; - - if (uiManglingSlashTimer < diff) - { - DoCastVictim(SPELL_MANGLING_SLASH, false); - uiManglingSlashTimer = 20*IN_MILLISECONDS; - } else uiManglingSlashTimer -=diff; - - if (uiFearsomeRoarTimer < diff) - { - DoCastAOE(SPELL_FEARSOME_ROAR, false); - uiFearsomeRoarTimer = urand(16*IN_MILLISECONDS, 18*IN_MILLISECONDS); - } else uiFearsomeRoarTimer -=diff; - - if (uiPiercingSlashTimer < diff) - { - DoCastVictim(SPELL_PIERCING_SLASH, false); - uiPiercingSlashTimer = 20*IN_MILLISECONDS; - } else uiPiercingSlashTimer -=diff; - - if (uiRaptorCallTimer < diff) - { - DoCastVictim(SPELL_RAPTOR_CALL, false); - - float x, y, z; - - me->GetClosePoint(x, y, z, me->GetObjectSize()/3, 10.0f); - me->SummonCreature(RAND(NPC_RAPTOR_1, NPC_RAPTOR_2), x, y, z, 0, TEMPSUMMON_DEAD_DESPAWN, 1*IN_MILLISECONDS); - - uiRaptorCallTimer = urand(20*IN_MILLISECONDS, 25*IN_MILLISECONDS); - } else uiRaptorCallTimer -=diff; - - DoMeleeAttackIfReady(); - } - - void JustDied(Unit* /*killer*/) - { - if (pInstance) - { - pInstance->SetData(DATA_DRED_EVENT, DONE); - - if (IsHeroic() && pInstance->GetData(DATA_KING_DRED_ACHIEV) == 6) - pInstance->DoCompleteAchievement(ACHIEV_BETTER_OFF_DRED); + uiBellowingRoarTimer = 33000; + uiGrievousBiteTimer = 20000; + uiManglingSlashTimer = 18500; + uiFearsomeRoarTimer = urand(10000, 20000); + uiPiercingSlashTimer = 17000; + uiRaptorCallTimer = urand(20000, 25000); } - } - }; - CreatureAI *GetAI(Creature *creature) const - { - return new boss_dredAI(creature); - } + void EnterCombat(Unit* /*who*/) + { + if (instance) + instance->SetData(DATA_DRED_EVENT, IN_PROGRESS); + } + + void UpdateAI(uint32 const diff) + { + if (!UpdateVictim()) + return; + + if (uiBellowingRoarTimer <= diff) + { + DoCastAOE(SPELL_BELLOWING_ROAR, false); + uiBellowingRoarTimer = 40000; + } + else + uiBellowingRoarTimer -=diff; + + if (uiGrievousBiteTimer <= diff) + { + DoCastVictim(SPELL_GRIEVOUS_BITE , false); + uiGrievousBiteTimer = 20000; + } + else + uiGrievousBiteTimer -= diff; + + if (uiManglingSlashTimer <= diff) + { + DoCastVictim(SPELL_MANGLING_SLASH, false); + uiManglingSlashTimer = 20000; + } + else + uiManglingSlashTimer -= diff; + + if (uiFearsomeRoarTimer <= diff) + { + DoCastAOE(SPELL_FEARSOME_ROAR, false); + uiFearsomeRoarTimer = urand(16000, 18000); + } + else + uiFearsomeRoarTimer -= diff; + + if (uiPiercingSlashTimer <= diff) + { + DoCastVictim(SPELL_PIERCING_SLASH, false); + uiPiercingSlashTimer = 20000; + } + else + uiPiercingSlashTimer -= diff; + + if (uiRaptorCallTimer <= diff) + { + DoCastVictim(SPELL_RAPTOR_CALL, false); + + float x, y, z; + + me->GetClosePoint(x, y, z, me->GetObjectSize() / 3, 10.0f); + me->SummonCreature(RAND(NPC_RAPTOR_1, NPC_RAPTOR_2), x, y, z, 0, TEMPSUMMON_DEAD_DESPAWN, 1000); + + uiRaptorCallTimer = urand(20000, 25000); + } + else + uiRaptorCallTimer -= diff; + + DoMeleeAttackIfReady(); + } + + void DoAction(int32 const action) + { + if (action == ACTION_RAPTOR_KILLED) + ++raptorsKilled; + } + + uint32 GetData(uint32 type) + { + if (type == DATA_KING_DRED) + return raptorsKilled; + + return 0; + } + + void JustDied(Unit* /*who*/) + { + if (instance) + instance->SetData(DATA_DRED_EVENT, DONE); + } + }; + + CreatureAI* GetAI(Creature* creature) const + { + return new boss_dredAI(creature); + } }; class npc_drakkari_gutripper : public CreatureScript { -public: - npc_drakkari_gutripper() : CreatureScript("npc_drakkari_gutripper") { } + public: + npc_drakkari_gutripper() : CreatureScript("npc_drakkari_gutripper") { } - struct npc_drakkari_gutripperAI : public ScriptedAI - { - npc_drakkari_gutripperAI(Creature *c) : ScriptedAI(c) + struct npc_drakkari_gutripperAI : public ScriptedAI { - pInstance = c->GetInstanceScript(); - } - - InstanceScript* pInstance; - - uint32 GutRipTimer; - - void Reset() - { - GutRipTimer = urand(10000, 15000); - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - if (GutRipTimer < diff) + npc_drakkari_gutripperAI(Creature* creature) : ScriptedAI(creature) { - DoCastVictim(SPELL_GUT_RIP, false); - GutRipTimer = urand(10000, 15000); - }else GutRipTimer -=diff; - - DoMeleeAttackIfReady(); - } - - void JustDied(Unit* /*killer*/) - { - if (pInstance) - { - if (IsHeroic() && pInstance->GetData(DATA_DRED_EVENT) == IN_PROGRESS && pInstance->GetData(DATA_KING_DRED_ACHIEV) < 6) - { - pInstance->SetData(DATA_KING_DRED_ACHIEV, pInstance->GetData(DATA_KING_DRED_ACHIEV) + 1); - } + instance = me->GetInstanceScript(); } - } - }; - CreatureAI *GetAI(Creature *creature) const - { - return new npc_drakkari_gutripperAI(creature); - } + InstanceScript* instance; + + uint32 GutRipTimer; + + void Reset() + { + GutRipTimer = urand(10000, 15000); + } + + void UpdateAI(uint32 const diff) + { + if (!UpdateVictim()) + return; + + if (GutRipTimer <= diff) + { + DoCastVictim(SPELL_GUT_RIP, false); + GutRipTimer = urand(10000, 15000); + } + else + GutRipTimer -= diff; + + DoMeleeAttackIfReady(); + } + + void JustDied(Unit* /*who*/) + { + if (Creature* Dred = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_DRED))) + Dred->AI()->DoAction(ACTION_RAPTOR_KILLED); + } + }; + + CreatureAI* GetAI(Creature* creature) const + { + return new npc_drakkari_gutripperAI(creature); + } }; class npc_drakkari_scytheclaw : public CreatureScript { -public: - npc_drakkari_scytheclaw() : CreatureScript("npc_drakkari_scytheclaw") { } + public: + npc_drakkari_scytheclaw() : CreatureScript("npc_drakkari_scytheclaw") { } - struct npc_drakkari_scytheclawAI : public ScriptedAI - { - npc_drakkari_scytheclawAI(Creature *c) : ScriptedAI(c) + struct npc_drakkari_scytheclawAI : public ScriptedAI { - pInstance = c->GetInstanceScript(); - } - - InstanceScript* pInstance; - - uint32 uiRendTimer; - - void Reset() - { - uiRendTimer = urand(10*IN_MILLISECONDS, 15*IN_MILLISECONDS); - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - if (uiRendTimer < diff) + npc_drakkari_scytheclawAI(Creature* creature) : ScriptedAI(creature) { - DoCastVictim(SPELL_REND, false); - uiRendTimer = urand(10*IN_MILLISECONDS, 15*IN_MILLISECONDS); - }else uiRendTimer -=diff; - - DoMeleeAttackIfReady(); - } - - void JustDied(Unit* /*killer*/) - { - if (pInstance) - { - if (IsHeroic() && pInstance->GetData(DATA_DRED_EVENT) == IN_PROGRESS && pInstance->GetData(DATA_KING_DRED_ACHIEV) < 6) - { - pInstance->SetData(DATA_KING_DRED_ACHIEV, pInstance->GetData(DATA_KING_DRED_ACHIEV) + 1); - } + instance = me->GetInstanceScript(); } - } - }; - CreatureAI *GetAI(Creature *creature) const - { - return new npc_drakkari_scytheclawAI(creature); - } + InstanceScript* instance; + + uint32 uiRendTimer; + + void Reset() + { + uiRendTimer = urand(10000, 15000); + } + + void UpdateAI(uint32 const diff) + { + if (!UpdateVictim()) + return; + + if (uiRendTimer <= diff) + { + DoCastVictim(SPELL_REND, false); + uiRendTimer = urand(10000, 15000); + } + else + uiRendTimer -= diff; + + DoMeleeAttackIfReady(); + } + + void JustDied(Unit* /*who*/) + { + if (Creature* Dred = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_DRED))) + Dred->AI()->DoAction(ACTION_RAPTOR_KILLED); + } + }; + + CreatureAI* GetAI(Creature* creature) const + { + return new npc_drakkari_scytheclawAI(creature); + } +}; + +class achievement_king_dred : public AchievementCriteriaScript +{ + public: + achievement_king_dred() : AchievementCriteriaScript("achievement_king_dred") + { + } + + bool OnCheck(Player* /*player*/, Unit* target) + { + sLog->outString("OnCheck()"); + if (Creature* Dred = target->ToCreature()) + if (Dred->AI()->GetData(DATA_KING_DRED) >= 6) + return true; + + return false; + } }; void AddSC_boss_dred() { + new boss_dred; new npc_drakkari_gutripper; new npc_drakkari_scytheclaw; - new boss_dred; + new achievement_king_dred(); }