From e5dc70118abdee9499e0620fbd8df5bd6d71b137 Mon Sep 17 00:00:00 2001 From: Nay Date: Tue, 27 Aug 2013 19:34:03 +0100 Subject: Server/Collision: Fix build on clang --- .../collision/BoundingIntervalHierarchyWrapper.h | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/server/collision/BoundingIntervalHierarchyWrapper.h b/src/server/collision/BoundingIntervalHierarchyWrapper.h index 305d57b0075..8696a759fa8 100644 --- a/src/server/collision/BoundingIntervalHierarchyWrapper.h +++ b/src/server/collision/BoundingIntervalHierarchyWrapper.h @@ -37,20 +37,22 @@ class BIHWrap MDLCallback(RayCallback& callback, const T* const* objects_array, uint32 objects_size ) : objects(objects_array), _callback(callback), objects_size(objects_size) {} - bool operator() (const G3D::Ray& ray, uint32 Idx, float& MaxDist, bool /*stopAtFirst*/) + /// Intersect ray + bool operator() (const G3D::Ray& ray, uint32 idx, float& maxDist, bool /*stopAtFirst*/) { - if (Idx >= objects_size) + if (idx >= objects_size) return false; - if (const T* obj = objects[Idx]) - return _callback(ray, *obj, MaxDist/*, stopAtFirst*/); + if (const T* obj = objects[idx]) + return _callback(ray, *obj, maxDist/*, stopAtFirst*/); return false; } - void operator() (const G3D::Vector3& p, uint32 Idx) + /// Intersect point + void operator() (const G3D::Vector3& p, uint32 idx) { - if (Idx >= objects_size) - return false; - if (const T* obj = objects[Idx]) + if (idx >= objects_size) + return; + if (const T* obj = objects[idx]) _callback(p, *obj); } }; -- cgit v1.2.3 From 1f34284828465076cfaf137ff34adc781d016a86 Mon Sep 17 00:00:00 2001 From: joschiwald Date: Tue, 27 Aug 2013 23:50:40 +0200 Subject: Scripts/UtgardeKeep: reworked InstanceScript and cleanup some boss script --- .../2013_08_27_01_world_instance_template.sql | 1 + src/server/game/Scripting/ScriptLoader.cpp | 91 ++-- src/server/scripts/Northrend/CMakeLists.txt | 6 +- .../UtgardeKeep/boss_ingvar_the_plunderer.cpp | 462 +++++++++---------- .../UtgardeKeep/UtgardeKeep/boss_keleseth.cpp | 381 ++++++++-------- .../UtgardeKeep/boss_skarvald_dalronn.cpp | 493 ++++++++++----------- .../UtgardeKeep/instance_utgarde_keep.cpp | 436 ++++++++---------- .../UtgardeKeep/UtgardeKeep/utgarde_keep.cpp | 287 +++++------- .../UtgardeKeep/UtgardeKeep/utgarde_keep.h | 80 +++- .../UtgardePinnacle/instance_pinnacle.cpp | 267 ----------- .../UtgardePinnacle/instance_utgarde_pinnacle.cpp | 267 +++++++++++ .../VaultOfArchavon/instance_vault_of_archavon.cpp | 14 +- 12 files changed, 1347 insertions(+), 1438 deletions(-) create mode 100644 sql/updates/world/2013_08_27_01_world_instance_template.sql delete mode 100644 src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/instance_pinnacle.cpp create mode 100644 src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/instance_utgarde_pinnacle.cpp (limited to 'src') diff --git a/sql/updates/world/2013_08_27_01_world_instance_template.sql b/sql/updates/world/2013_08_27_01_world_instance_template.sql new file mode 100644 index 00000000000..75000549464 --- /dev/null +++ b/sql/updates/world/2013_08_27_01_world_instance_template.sql @@ -0,0 +1 @@ +UPDATE `instance_template` SET `script`='instance_vault_of_archavon' WHERE `map`=624; diff --git a/src/server/game/Scripting/ScriptLoader.cpp b/src/server/game/Scripting/ScriptLoader.cpp index 513cfe74b6a..426d83ef837 100644 --- a/src/server/game/Scripting/ScriptLoader.cpp +++ b/src/server/game/Scripting/ScriptLoader.cpp @@ -372,23 +372,36 @@ void AddSC_thunder_bluff(); void AddSC_ungoro_crater(); void AddSC_winterspring(); -//northrend +// Northrend + void AddSC_boss_slad_ran(); void AddSC_boss_moorabi(); void AddSC_boss_drakkari_colossus(); void AddSC_boss_gal_darah(); void AddSC_boss_eck(); void AddSC_instance_gundrak(); -void AddSC_boss_krik_thir(); //Azjol-Nerub + +// Azjol-Nerub - Azjol-Nerub +void AddSC_boss_krik_thir(); void AddSC_boss_hadronox(); void AddSC_boss_anub_arak(); void AddSC_instance_azjol_nerub(); -void AddSC_instance_ahnkahet(); //Azjol-Nerub Ahn'kahet -void AddSC_boss_amanitar(); + +// Azjol-Nerub - Ahn'kahet +void AddSC_boss_elder_nadox(); void AddSC_boss_taldaram(); +void AddSC_boss_amanitar(); void AddSC_boss_jedoga_shadowseeker(); -void AddSC_boss_elder_nadox(); void AddSC_boss_volazj(); +void AddSC_instance_ahnkahet(); + +// Drak'Tharon Keep +void AddSC_boss_trollgore(); +void AddSC_boss_novos(); +void AddSC_boss_king_dred(); +void AddSC_boss_tharon_ja(); +void AddSC_instance_drak_tharon_keep(); + void AddSC_boss_argent_challenge(); //Trial of the Champion void AddSC_boss_black_knight(); void AddSC_boss_grand_champions(); @@ -457,26 +470,28 @@ void AddSC_boss_freya(); void AddSC_boss_yogg_saron(); void AddSC_boss_algalon_the_observer(); void AddSC_instance_ulduar(); -void AddSC_boss_keleseth(); //Utgarde Keep + +// Utgarde Keep - Utgarde Keep +void AddSC_boss_keleseth(); void AddSC_boss_skarvald_dalronn(); void AddSC_boss_ingvar_the_plunderer(); void AddSC_instance_utgarde_keep(); -void AddSC_boss_svala(); //Utgarde pinnacle +void AddSC_utgarde_keep(); + +// Utgarde Keep - Utgarde Pinnacle +void AddSC_boss_svala(); void AddSC_boss_palehoof(); void AddSC_boss_skadi(); void AddSC_boss_ymiron(); void AddSC_instance_utgarde_pinnacle(); -void AddSC_utgarde_keep(); -void AddSC_boss_archavon(); //Vault of Archavon + +// Vault of Archavon +void AddSC_boss_archavon(); void AddSC_boss_emalon(); void AddSC_boss_koralon(); void AddSC_boss_toravon(); -void AddSC_instance_archavon(); -void AddSC_boss_trollgore(); //Drak'Tharon Keep -void AddSC_boss_novos(); -void AddSC_boss_king_dred(); -void AddSC_boss_tharon_ja(); -void AddSC_instance_drak_tharon_keep(); +void AddSC_instance_vault_of_archavon(); + void AddSC_boss_cyanigosa(); //Violet Hold void AddSC_boss_erekem(); void AddSC_boss_ichoron(); @@ -1163,12 +1178,28 @@ void AddNorthrendScripts() AddSC_boss_gal_darah(); AddSC_boss_eck(); AddSC_instance_gundrak(); - AddSC_boss_amanitar(); - AddSC_boss_taldaram(); //Azjol-Nerub Ahn'kahet + + // Azjol-Nerub - Ahn'kahet AddSC_boss_elder_nadox(); + AddSC_boss_taldaram(); + AddSC_boss_amanitar(); AddSC_boss_jedoga_shadowseeker(); AddSC_boss_volazj(); AddSC_instance_ahnkahet(); + + // Azjol-Nerub - Azjol-Nerub + AddSC_boss_krik_thir(); + AddSC_boss_hadronox(); + AddSC_boss_anub_arak(); + AddSC_instance_azjol_nerub(); + + // Drak'Tharon Keep + AddSC_boss_trollgore(); + AddSC_boss_novos(); + AddSC_boss_king_dred(); + AddSC_boss_tharon_ja(); + AddSC_instance_drak_tharon_keep(); + AddSC_boss_argent_challenge(); //Trial of the Champion AddSC_boss_black_knight(); AddSC_boss_grand_champions(); @@ -1181,10 +1212,6 @@ void AddNorthrendScripts() AddSC_boss_twin_valkyr(); AddSC_boss_northrend_beasts(); AddSC_instance_trial_of_the_crusader(); - AddSC_boss_krik_thir(); //Azjol-Nerub Azjol-Nerub - AddSC_boss_hadronox(); - AddSC_boss_anub_arak(); - AddSC_instance_azjol_nerub(); AddSC_boss_anubrekhan(); //Naxxramas AddSC_boss_maexxna(); AddSC_boss_patchwerk(); @@ -1241,26 +1268,28 @@ void AddNorthrendScripts() AddSC_boss_yogg_saron(); AddSC_boss_algalon_the_observer(); AddSC_instance_ulduar(); - AddSC_boss_keleseth(); //Utgarde Keep + + // Utgarde Keep - Utgarde Keep + AddSC_boss_keleseth(); AddSC_boss_skarvald_dalronn(); AddSC_boss_ingvar_the_plunderer(); AddSC_instance_utgarde_keep(); - AddSC_boss_svala(); //Utgarde pinnacle + AddSC_utgarde_keep(); + + // Utgarde Keep - Utgarde Pinnacle + AddSC_boss_svala(); AddSC_boss_palehoof(); AddSC_boss_skadi(); AddSC_boss_ymiron(); AddSC_instance_utgarde_pinnacle(); - AddSC_utgarde_keep(); - AddSC_boss_archavon(); //Vault of Archavon + + // Vault of Archavon + AddSC_boss_archavon(); AddSC_boss_emalon(); AddSC_boss_koralon(); AddSC_boss_toravon(); - AddSC_instance_archavon(); - AddSC_boss_trollgore(); //Drak'Tharon Keep - AddSC_boss_novos(); - AddSC_boss_king_dred(); - AddSC_boss_tharon_ja(); - AddSC_instance_drak_tharon_keep(); + AddSC_instance_vault_of_archavon(); + AddSC_boss_cyanigosa(); //Violet Hold AddSC_boss_erekem(); AddSC_boss_ichoron(); diff --git a/src/server/scripts/Northrend/CMakeLists.txt b/src/server/scripts/Northrend/CMakeLists.txt index e04a4c43479..3c56361d096 100644 --- a/src/server/scripts/Northrend/CMakeLists.txt +++ b/src/server/scripts/Northrend/CMakeLists.txt @@ -125,11 +125,11 @@ set(scripts_STAT_SRCS Northrend/VaultOfArchavon/boss_emalon.cpp Northrend/VaultOfArchavon/boss_toravon.cpp Northrend/zone_sholazar_basin.cpp - Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp - Northrend/UtgardeKeep/UtgardePinnacle/instance_pinnacle.cpp - Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp + Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp + Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp + Northrend/UtgardeKeep/UtgardePinnacle/instance_utgarde_pinnacle.cpp Northrend/UtgardeKeep/UtgardePinnacle/utgarde_pinnacle.h Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp Northrend/UtgardeKeep/UtgardeKeep/boss_skarvald_dalronn.cpp diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp index 3dd84c62890..1ec33fcb301 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp @@ -57,7 +57,10 @@ enum Events EVENT_WOE_STRIKE, EVENT_SHADOW_AXE, EVENT_JUST_TRANSFORMED, - EVENT_SUMMON_BANSHEE + EVENT_SUMMON_BANSHEE, + + EVENT_RESURRECT_1, + EVENT_RESURRECT_2 }; enum Phases @@ -95,295 +98,277 @@ enum Spells class boss_ingvar_the_plunderer : public CreatureScript { -public: - boss_ingvar_the_plunderer() : CreatureScript("boss_ingvar_the_plunderer") { } - - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new boss_ingvar_the_plundererAI(creature); - } - - struct boss_ingvar_the_plundererAI : public ScriptedAI - { - boss_ingvar_the_plundererAI(Creature* creature) : ScriptedAI(creature) - { - instance = creature->GetInstanceScript(); - bIsUndead = false; - } - - InstanceScript* instance; + public: + boss_ingvar_the_plunderer() : CreatureScript("boss_ingvar_the_plunderer") { } - bool bIsUndead; - - void Reset() OVERRIDE + struct boss_ingvar_the_plundererAI : public BossAI { - if (bIsUndead) - me->UpdateEntry(NPC_INGVAR_HUMAN); + boss_ingvar_the_plundererAI(Creature* creature) : BossAI(creature, DATA_INGVAR) + { + _isUndead = false; + } - bIsUndead = false; + void Reset() OVERRIDE + { + if (_isUndead) + me->UpdateEntry(NPC_INGVAR_HUMAN); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); - me->SetStandState(UNIT_STAND_STATE_STAND); + _isUndead = false; - events.Reset(); - events.SetPhase(PHASE_HUMAN); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + me->SetStandState(UNIT_STAND_STATE_STAND); - events.ScheduleEvent(EVENT_CLEAVE, urand(6, 12)*IN_MILLISECONDS, 0, PHASE_HUMAN); - events.ScheduleEvent(EVENT_STAGGERING_ROAR, urand(18, 21)*IN_MILLISECONDS, 0, PHASE_HUMAN); - events.ScheduleEvent(EVENT_ENRAGE, urand(7, 14)*IN_MILLISECONDS, 0, PHASE_HUMAN); - events.ScheduleEvent(EVENT_SMASH, urand(12, 17)*IN_MILLISECONDS, 0, PHASE_HUMAN); + _Reset(); + events.SetPhase(PHASE_HUMAN); - if (instance) - instance->SetData(DATA_INGVAR_EVENT, NOT_STARTED); - } - - void DamageTaken(Unit* /*done_by*/, uint32 &damage) OVERRIDE - { - if (damage >= me->GetHealth() && !bIsUndead) - { - //DoCast(me, SPELL_INGVAR_FEIGN_DEATH, true); // Dont work ??? - // visuel hack - me->SetHealth(0); - me->InterruptNonMeleeSpells(true); - me->RemoveAllAuras(); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->GetMotionMaster()->MovementExpired(false); - me->GetMotionMaster()->MoveIdle(); - me->SetStandState(UNIT_STAND_STATE_DEAD); - // visuel hack end - - events.SetPhase(PHASE_EVENT); - events.ScheduleEvent(EVENT_SUMMON_BANSHEE, 3 * IN_MILLISECONDS, 0, PHASE_EVENT); - - Talk(YELL_DEAD_1); + events.ScheduleEvent(EVENT_CLEAVE, urand(6, 12)*IN_MILLISECONDS, 0, PHASE_HUMAN); + events.ScheduleEvent(EVENT_STAGGERING_ROAR, urand(18, 21)*IN_MILLISECONDS, 0, PHASE_HUMAN); + events.ScheduleEvent(EVENT_ENRAGE, urand(7, 14)*IN_MILLISECONDS, 0, PHASE_HUMAN); + events.ScheduleEvent(EVENT_SMASH, urand(12, 17)*IN_MILLISECONDS, 0, PHASE_HUMAN); } - if (events.IsInPhase(PHASE_EVENT)) - damage = 0; - } - - void StartZombiePhase() - { - bIsUndead = true; - me->UpdateEntry(NPC_INGVAR_UNDEAD); - events.ScheduleEvent(EVENT_JUST_TRANSFORMED, 2 * IN_MILLISECONDS, 0, PHASE_EVENT); + void DamageTaken(Unit* /*doneBy*/, uint32& damage) OVERRIDE + { + if (damage >= me->GetHealth() && !_isUndead) + { + //DoCast(me, SPELL_INGVAR_FEIGN_DEATH, true); // Dont work ??? + // visuel hack + me->SetHealth(0); + me->InterruptNonMeleeSpells(true); + me->RemoveAllAuras(); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->GetMotionMaster()->MovementExpired(false); + me->GetMotionMaster()->MoveIdle(); + me->SetStandState(UNIT_STAND_STATE_DEAD); + // visuel hack end + + events.SetPhase(PHASE_EVENT); + events.ScheduleEvent(EVENT_SUMMON_BANSHEE, 3 * IN_MILLISECONDS, 0, PHASE_EVENT); + + Talk(YELL_DEAD_1); + } - Talk(YELL_AGGRO_2); - } + if (events.IsInPhase(PHASE_EVENT)) + damage = 0; + } - void EnterCombat(Unit* /*who*/) OVERRIDE - { - if (!bIsUndead) - Talk(YELL_AGGRO_1); + void StartZombiePhase() + { + _isUndead = true; + me->UpdateEntry(NPC_INGVAR_UNDEAD); + events.ScheduleEvent(EVENT_JUST_TRANSFORMED, 2 * IN_MILLISECONDS, 0, PHASE_EVENT); - if (instance) - instance->SetData(DATA_INGVAR_EVENT, IN_PROGRESS); + Talk(YELL_AGGRO_2); + } - me->SetInCombatWithZone(); - } + void EnterCombat(Unit* /*who*/) OVERRIDE + { + _EnterCombat(); - void JustDied(Unit* /*killer*/) OVERRIDE - { - Talk(YELL_DEAD_2); + if (!_isUndead) + Talk(YELL_AGGRO_1); + } - if (instance) + void JustDied(Unit* /*killer*/) OVERRIDE { + _JustDied(); + Talk(YELL_DEAD_2); + // Ingvar has NPC_INGVAR_UNDEAD id in this moment, so we have to update encounter state for his original id instance->UpdateEncounterState(ENCOUNTER_CREDIT_KILL_CREATURE, NPC_INGVAR_HUMAN, me); - instance->SetData(DATA_INGVAR_EVENT, DONE); } - } - void ScheduleSecondPhase() - { - events.SetPhase(PHASE_UNDEAD); - events.ScheduleEvent(EVENT_DARK_SMASH, urand(14, 18)*IN_MILLISECONDS, 0, PHASE_UNDEAD); - events.ScheduleEvent(EVENT_DREADFUL_ROAR, urand(18, 22)*IN_MILLISECONDS, 0, PHASE_UNDEAD); - events.ScheduleEvent(EVENT_WOE_STRIKE, urand(10, 14)*IN_MILLISECONDS, 0, PHASE_UNDEAD); - events.ScheduleEvent(EVENT_SHADOW_AXE, 30*IN_MILLISECONDS, 0, PHASE_UNDEAD); - } + void ScheduleSecondPhase() + { + events.SetPhase(PHASE_UNDEAD); + events.ScheduleEvent(EVENT_DARK_SMASH, urand(14, 18)*IN_MILLISECONDS, 0, PHASE_UNDEAD); + events.ScheduleEvent(EVENT_DREADFUL_ROAR, urand(18, 22)*IN_MILLISECONDS, 0, PHASE_UNDEAD); + events.ScheduleEvent(EVENT_WOE_STRIKE, urand(10, 14)*IN_MILLISECONDS, 0, PHASE_UNDEAD); + events.ScheduleEvent(EVENT_SHADOW_AXE, 30*IN_MILLISECONDS, 0, PHASE_UNDEAD); + } - void KilledUnit(Unit* /*victim*/) OVERRIDE - { - Talk(bIsUndead ? YELL_KILL_1 : YELL_KILL_2); - } + void KilledUnit(Unit* /*victim*/) OVERRIDE + { + Talk(_isUndead ? YELL_KILL_1 : YELL_KILL_2); + } - void UpdateAI(uint32 diff) OVERRIDE - { - if (!UpdateVictim() && !events.IsInPhase(PHASE_EVENT)) - return; + void UpdateAI(uint32 diff) OVERRIDE + { + if (!UpdateVictim() && !events.IsInPhase(PHASE_EVENT)) + return; - events.Update(diff); + events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - while (uint32 eventId = events.ExecuteEvent()) - { - switch (eventId) + while (uint32 eventId = events.ExecuteEvent()) { - // PHASE ONE - case EVENT_CLEAVE: - DoCastVictim(SPELL_CLEAVE); - events.ScheduleEvent(EVENT_CLEAVE, urand(6, 12)*IN_MILLISECONDS, 0, PHASE_HUMAN); - break; - case EVENT_STAGGERING_ROAR: - DoCast(me, SPELL_STAGGERING_ROAR); - events.ScheduleEvent(EVENT_STAGGERING_ROAR, urand(18, 22)*IN_MILLISECONDS, 0, PHASE_HUMAN); - break; - case EVENT_ENRAGE: - DoCast(me, SPELL_ENRAGE); - events.ScheduleEvent(EVENT_ENRAGE, urand(7, 14)*IN_MILLISECONDS, 0, PHASE_HUMAN); - break; - case EVENT_SMASH: - DoCastAOE(SPELL_SMASH); - events.ScheduleEvent(EVENT_SMASH, urand(12, 16)*IN_MILLISECONDS, 0, PHASE_HUMAN); - break; - case EVENT_JUST_TRANSFORMED: - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->SetInCombatWithZone(); - me->GetMotionMaster()->MoveChase(me->GetVictim()); - ScheduleSecondPhase(); - return; - case EVENT_SUMMON_BANSHEE: - DoCast(me, SPELL_SUMMON_BANSHEE); - return; - // PHASE TWO - case EVENT_DARK_SMASH: - DoCastVictim(SPELL_DARK_SMASH); - events.ScheduleEvent(EVENT_DARK_SMASH, urand(12, 16)*IN_MILLISECONDS, 0, PHASE_UNDEAD); - break; - case EVENT_DREADFUL_ROAR: - DoCast(me, SPELL_DREADFUL_ROAR); - events.ScheduleEvent(EVENT_DREADFUL_ROAR, urand(18, 22)*IN_MILLISECONDS, 0, PHASE_UNDEAD); - break; - case EVENT_WOE_STRIKE: - DoCastVictim(SPELL_WOE_STRIKE); - events.ScheduleEvent(EVENT_WOE_STRIKE, urand(10, 14)*IN_MILLISECONDS, 0, PHASE_UNDEAD); - break; - case EVENT_SHADOW_AXE: - if (Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO, 1)) - { - DoCast(target, SPELL_SHADOW_AXE_SUMMON); - } - events.ScheduleEvent(EVENT_SHADOW_AXE, 30*IN_MILLISECONDS, 0, PHASE_UNDEAD); - break; + switch (eventId) + { + // PHASE ONE + case EVENT_CLEAVE: + DoCastVictim(SPELL_CLEAVE); + events.ScheduleEvent(EVENT_CLEAVE, urand(6, 12)*IN_MILLISECONDS, 0, PHASE_HUMAN); + break; + case EVENT_STAGGERING_ROAR: + DoCast(me, SPELL_STAGGERING_ROAR); + events.ScheduleEvent(EVENT_STAGGERING_ROAR, urand(18, 22)*IN_MILLISECONDS, 0, PHASE_HUMAN); + break; + case EVENT_ENRAGE: + DoCast(me, SPELL_ENRAGE); + events.ScheduleEvent(EVENT_ENRAGE, urand(7, 14)*IN_MILLISECONDS, 0, PHASE_HUMAN); + break; + case EVENT_SMASH: + DoCastAOE(SPELL_SMASH); + events.ScheduleEvent(EVENT_SMASH, urand(12, 16)*IN_MILLISECONDS, 0, PHASE_HUMAN); + break; + case EVENT_JUST_TRANSFORMED: + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->SetInCombatWithZone(); + me->GetMotionMaster()->MoveChase(me->GetVictim()); + ScheduleSecondPhase(); + return; + case EVENT_SUMMON_BANSHEE: + DoCast(me, SPELL_SUMMON_BANSHEE); + return; + // PHASE TWO + case EVENT_DARK_SMASH: + DoCastVictim(SPELL_DARK_SMASH); + events.ScheduleEvent(EVENT_DARK_SMASH, urand(12, 16)*IN_MILLISECONDS, 0, PHASE_UNDEAD); + break; + case EVENT_DREADFUL_ROAR: + DoCast(me, SPELL_DREADFUL_ROAR); + events.ScheduleEvent(EVENT_DREADFUL_ROAR, urand(18, 22)*IN_MILLISECONDS, 0, PHASE_UNDEAD); + break; + case EVENT_WOE_STRIKE: + DoCastVictim(SPELL_WOE_STRIKE); + events.ScheduleEvent(EVENT_WOE_STRIKE, urand(10, 14)*IN_MILLISECONDS, 0, PHASE_UNDEAD); + break; + case EVENT_SHADOW_AXE: + if (Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO, 1)) + DoCast(target, SPELL_SHADOW_AXE_SUMMON); + + events.ScheduleEvent(EVENT_SHADOW_AXE, 30*IN_MILLISECONDS, 0, PHASE_UNDEAD); + break; + } } + + DoMeleeAttackIfReady(); } - DoMeleeAttackIfReady(); - } - private: - EventMap events; - }; + private: + bool _isUndead; + }; + CreatureAI* GetAI(Creature* creature) const OVERRIDE + { + return GetUtgardeKeepAI(creature); + } }; - class npc_annhylde_the_caller : public CreatureScript { -public: - npc_annhylde_the_caller() : CreatureScript("npc_annhylde_the_caller") { } - - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new npc_annhylde_the_callerAI(creature); - } + public: + npc_annhylde_the_caller() : CreatureScript("npc_annhylde_the_caller") { } - struct npc_annhylde_the_callerAI : public ScriptedAI - { - npc_annhylde_the_callerAI(Creature* creature) : ScriptedAI(creature) + struct npc_annhylde_the_callerAI : public ScriptedAI { - instance = creature->GetInstanceScript(); - } + npc_annhylde_the_callerAI(Creature* creature) : ScriptedAI(creature) + { + _instance = creature->GetInstanceScript(); + } - float x, y, z; - InstanceScript* instance; - uint32 uiResurectTimer; - uint32 uiResurectPhase; + void Reset() OVERRIDE + { + _events.Reset(); - void Reset() OVERRIDE - { - //! HACK: Creature's can't have MOVEMENTFLAG_FLYING - me->SetHover(true); + //! HACK: Creature's can't have MOVEMENTFLAG_FLYING + me->SetHover(true); - me->GetPosition(x, y, z); - DoTeleportTo(x+1, y, z+30); + me->GetPosition(x, y, z); + DoTeleportTo(x+1, y, z+30); - Unit* ingvar = Unit::GetUnit(*me, instance ? instance->GetData64(DATA_INGVAR) : 0); - if (ingvar) - { - me->GetMotionMaster()->MovePoint(1, x, y, z+15); + if (Creature* ingvar = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_INGVAR))) + { + me->GetMotionMaster()->MovePoint(1, x, y, z+15); - // Talk(YELL_RESSURECT); + // Talk(YELL_RESSURECT); + } } - } - void MovementInform(uint32 type, uint32 id) OVERRIDE - { - if (type != POINT_MOTION_TYPE) - return; - Unit* ingvar = Unit::GetUnit(*me, instance ? instance->GetData64(DATA_INGVAR) : 0); - if (ingvar) + void MovementInform(uint32 type, uint32 id) OVERRIDE { - switch (id) + if (type != POINT_MOTION_TYPE) + return; + + if (Creature* ingvar = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_INGVAR))) { - case 1: - ingvar->RemoveAura(SPELL_SUMMON_BANSHEE); - ingvar->CastSpell(ingvar, SPELL_SCOURG_RESURRECTION_DUMMY, true); - DoCast(ingvar, SPELL_SCOURG_RESURRECTION_BEAM); - uiResurectTimer = 8000; - uiResurectPhase = 1; - break; - case 2: - me->SetVisible(false); - me->DealDamage(me, me->GetHealth()); - me->RemoveCorpse(); - break; + switch (id) + { + case 1: + ingvar->RemoveAura(SPELL_SUMMON_BANSHEE); + ingvar->CastSpell(ingvar, SPELL_SCOURG_RESURRECTION_DUMMY, true); + DoCast(ingvar, SPELL_SCOURG_RESURRECTION_BEAM); + _events.ScheduleEvent(EVENT_RESURRECT_1, 8000); + break; + case 2: + me->DespawnOrUnsummon(); + break; + default: + break; + } } } - } - void AttackStart(Unit* /*who*/) OVERRIDE {} - void MoveInLineOfSight(Unit* /*who*/) OVERRIDE {} + void AttackStart(Unit* /*who*/) OVERRIDE { } + void MoveInLineOfSight(Unit* /*who*/) OVERRIDE { } + void EnterCombat(Unit* /*who*/) OVERRIDE { } - void EnterCombat(Unit* /*who*/) OVERRIDE {} - void UpdateAI(uint32 diff) OVERRIDE - { - if (uiResurectTimer) + void UpdateAI(uint32 diff) OVERRIDE { - if (uiResurectTimer <= diff) + _events.Update(diff); + + while (uint32 eventId = _events.ExecuteEvent()) { - if (uiResurectPhase == 1) - { - Unit* ingvar = Unit::GetUnit(*me, instance ? instance->GetData64(DATA_INGVAR) : 0); - if (ingvar) - { - ingvar->SetStandState(UNIT_STAND_STATE_STAND); - ingvar->CastSpell(ingvar, SPELL_SCOURG_RESURRECTION_HEAL, false); - } - uiResurectTimer = 3000; - uiResurectPhase = 2; - } - else if (uiResurectPhase == 2) + switch (eventId) { - if (Creature* ingvar = Unit::GetCreature(*me, instance ? instance->GetData64(DATA_INGVAR) : 0)) - { - ingvar->RemoveAurasDueToSpell(SPELL_SCOURG_RESURRECTION_DUMMY); - - if (ingvar->GetVictim()) - if (boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI* ai = CAST_AI(boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI, ingvar->AI())) - ai->StartZombiePhase(); - - me->GetMotionMaster()->MovePoint(2, x+1, y, z+30); - ++uiResurectPhase; - uiResurectTimer = 0; - } + case EVENT_RESURRECT_1: + if (Creature* ingvar = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_INGVAR))) + { + ingvar->SetStandState(UNIT_STAND_STATE_STAND); + ingvar->CastSpell(ingvar, SPELL_SCOURG_RESURRECTION_HEAL, false); + } + _events.ScheduleEvent(EVENT_RESURRECT_2, 3000); + break; + case EVENT_RESURRECT_2: + if (Creature* ingvar = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_INGVAR))) + { + ingvar->RemoveAurasDueToSpell(SPELL_SCOURG_RESURRECTION_DUMMY); + + if (ingvar->GetVictim()) + if (boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI* ai = CAST_AI(boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI, ingvar->AI())) + ai->StartZombiePhase(); + + me->GetMotionMaster()->MovePoint(2, x+1, y, z+30); + } + break; + default: + break; } - } else uiResurectTimer -= diff; + } } + + private: + InstanceScript* _instance; + EventMap _events; + float x, y, z; + }; + + CreatureAI* GetAI(Creature* creature) const OVERRIDE + { + return GetUtgardeKeepAI(creature); } - }; }; enum ShadowAxe @@ -428,12 +413,7 @@ public: { DoCast(me, SPELL_SHADOW_AXE_DAMAGE); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); - if (TempSummon* summon = me->ToTempSummon()) - { - summon->UnSummon(10000); - } - else - me->DisappearAndDie(); + me->DespawnOrUnsummon(10000); } } }; diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp index 6c7bf6afbe0..b46a41af678 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp @@ -75,268 +75,247 @@ float AttackLoc[3]= {197.636f, 194.046f, 40.8164f}; class npc_frost_tomb : public CreatureScript { -public: - npc_frost_tomb() : CreatureScript("npc_frost_tomb") {} - - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new npc_frost_tombAI(creature); - } + public: + npc_frost_tomb() : CreatureScript("npc_frost_tomb") { } - struct npc_frost_tombAI : public ScriptedAI - { - npc_frost_tombAI(Creature* creature) : ScriptedAI(creature) + struct npc_frost_tombAI : public ScriptedAI { - if (me->IsSummon()) - if (Unit* summon = me->ToTempSummon()->GetSummoner()) - DoCast(summon, SPELL_FROST_TOMB, true); + npc_frost_tombAI(Creature* creature) : ScriptedAI(creature) + { + _instance = creature->GetInstanceScript(); + } - instance = creature->GetInstanceScript(); - } + void IsSummonedBy(Unit* summoner) OVERRIDE + { + DoCast(summoner, SPELL_FROST_TOMB, true); + } + + void UpdateAI(uint32 /*diff*/) OVERRIDE { } + + void JustDied(Unit* /*killer*/) OVERRIDE + { + if (Creature* keleseth = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_PRINCE_KELESETH))) + keleseth->AI()->SetData(DATA_ON_THE_ROCKS, false); + } - void UpdateAI(uint32 /*diff*/) OVERRIDE {} + private: + InstanceScript* _instance; + }; - void JustDied(Unit* /*killer*/) OVERRIDE + CreatureAI* GetAI(Creature* creature) const OVERRIDE { - if (instance) - if (Unit* boss = me->GetUnit(*me, instance->GetData64(DATA_PRINCEKELESETH))) - if (boss->ToCreature() && boss->ToCreature()->AI()) - boss->ToCreature()->AI()->SetData(DATA_ON_THE_ROCKS, false); + return GetUtgardeKeepAI(creature); } - - private: - InstanceScript* instance; - }; }; class boss_keleseth : public CreatureScript { -public: - boss_keleseth() : CreatureScript("boss_keleseth") {} - - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new boss_kelesethAI(creature); - } - - struct boss_kelesethAI : public BossAI - { - boss_kelesethAI(Creature* creature) : BossAI(creature, DATA_PRINCEKELESETH_EVENT){} + public: + boss_keleseth() : CreatureScript("boss_keleseth") { } - void Reset() OVERRIDE + struct boss_kelesethAI : public BossAI { - if (instance) - instance->SetData(DATA_PRINCEKELESETH_EVENT, NOT_STARTED); - - events.Reset(); - events.ScheduleEvent(EVENT_SHADOWBOLT, urand(2, 3)*IN_MILLISECONDS); - events.ScheduleEvent(EVENT_FROST_TOMB, urand(14, 19)*IN_MILLISECONDS); - events.ScheduleEvent(EVENT_SUMMON_SKELETONS, 6*IN_MILLISECONDS); + boss_kelesethAI(Creature* creature) : BossAI(creature, DATA_PRINCE_KELESETH) { } - summons.DespawnAll(); + void Reset() OVERRIDE + { + _Reset(); + events.ScheduleEvent(EVENT_SHADOWBOLT, urand(2, 3)*IN_MILLISECONDS); + events.ScheduleEvent(EVENT_FROST_TOMB, urand(14, 19)*IN_MILLISECONDS); + events.ScheduleEvent(EVENT_SUMMON_SKELETONS, 6*IN_MILLISECONDS); - onTheRocks = true; - } + onTheRocks = true; + } - void EnterCombat(Unit* who) OVERRIDE - { - me->SetInCombatWithZone(); - if (instance) - instance->SetData(DATA_PRINCEKELESETH_EVENT, IN_PROGRESS); - Talk(SAY_START_COMBAT); + void EnterCombat(Unit* who) OVERRIDE + { + _EnterCombat(); + Talk(SAY_START_COMBAT); - if (!who) - return; + if (!who) + return; - std::list runemages; - me->GetCreatureListWithEntryInGrid(runemages, NPC_RUNEMAGE, 60.0f); - if (!runemages.empty()) - { - for (std::list::iterator itr = runemages.begin(); itr != runemages.end(); ++itr) + std::list guards; + me->GetCreatureListWithEntryInGrid(guards, NPC_RUNEMAGE, 60.0f); + me->GetCreatureListWithEntryInGrid(guards, NPC_STRATEGIST, 60.0f); + if (!guards.empty()) { - if ((*itr)->IsAlive() && (*itr)->IsWithinLOSInMap(me)) - (*itr)->AI()->AttackStart(who); + for (std::list::iterator itr = guards.begin(); itr != guards.end(); ++itr) + { + if ((*itr)->IsAlive() && (*itr)->IsWithinLOSInMap(me)) + (*itr)->AI()->AttackStart(who); + } } } - std::list strategists; - me->GetCreatureListWithEntryInGrid(strategists, NPC_STRATEGIST, 60.0f); - if (!strategists.empty()) + void JustDied(Unit* /*killer*/) OVERRIDE { - for (std::list::iterator itr = strategists.begin(); itr != strategists.end(); ++itr) - { - if ((*itr)->IsAlive() && (*itr)->IsWithinLOSInMap(me)) - (*itr)->AI()->AttackStart(who); - } + _JustDied(); + Talk(SAY_DEATH); } - } - - void JustDied(Unit* /*killer*/) OVERRIDE - { - if (instance) - instance->SetData(DATA_PRINCEKELESETH_EVENT, DONE); - summons.DespawnAll(); - Talk(SAY_DEATH); - } - void SetData(uint32 data, uint32 value) OVERRIDE - { - if (data == DATA_ON_THE_ROCKS) - onTheRocks = value; - } + void SetData(uint32 data, uint32 value) OVERRIDE + { + if (data == DATA_ON_THE_ROCKS) + onTheRocks = value; + } - uint32 GetData(uint32 data) const OVERRIDE - { - if (data == DATA_ON_THE_ROCKS) - return onTheRocks; + uint32 GetData(uint32 data) const OVERRIDE + { + if (data == DATA_ON_THE_ROCKS) + return onTheRocks; - return 0; - } + return 0; + } - void UpdateAI(uint32 diff) OVERRIDE - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) OVERRIDE + { + if (!UpdateVictim()) + return; - events.Update(diff); + events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - while (uint32 eventId = events.ExecuteEvent()) - { - switch (eventId) + while (uint32 eventId = events.ExecuteEvent()) { - case EVENT_SUMMON_SKELETONS: - Talk(SAY_SUMMON_SKELETONS); - SummonSkeletons(); - break; - case EVENT_SHADOWBOLT: - DoCastVictim(SPELL_SHADOWBOLT); - events.ScheduleEvent(EVENT_SHADOWBOLT, urand(2, 3)*IN_MILLISECONDS); - break; - case EVENT_FROST_TOMB: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true, -SPELL_FROST_TOMB)) + switch (eventId) { - Talk(SAY_FROST_TOMB); - Talk(SAY_FROST_TOMB_EMOTE, target->GetGUID()); + case EVENT_SUMMON_SKELETONS: + Talk(SAY_SUMMON_SKELETONS); + SummonSkeletons(); + break; + case EVENT_SHADOWBOLT: + DoCastVictim(SPELL_SHADOWBOLT); + events.ScheduleEvent(EVENT_SHADOWBOLT, urand(2, 3) * IN_MILLISECONDS); + break; + case EVENT_FROST_TOMB: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true, -SPELL_FROST_TOMB)) + { + Talk(SAY_FROST_TOMB); + Talk(SAY_FROST_TOMB_EMOTE, target->GetGUID()); - DoCast(target, SPELL_FROST_TOMB_STUN, true); - // checked from sniffs - the player casts the spell - target->CastSpell(target, SPELL_FROST_TOMB_SUMMON, true); + DoCast(target, SPELL_FROST_TOMB_STUN, true); + // checked from sniffs - the player casts the spell + target->CastSpell(target, SPELL_FROST_TOMB_SUMMON, true); + } + events.ScheduleEvent(EVENT_FROST_TOMB, urand(14, 19) * IN_MILLISECONDS); + break; + default: + break; } - events.ScheduleEvent(EVENT_FROST_TOMB, urand(14, 19)*IN_MILLISECONDS); - break; } + + DoMeleeAttackIfReady(); } - DoMeleeAttackIfReady(); - } + void SummonSkeletons() + { + // I could not found any spell casted for this + for (uint8 i = 0; i < 4; ++i) + me->SummonCreature(NPC_SKELETON, SkeletonSpawnPoint[0][0], SkeletonSpawnPoint[0][1], SKELETONSPAWN_Z, 0); + } + + private: + bool onTheRocks; + }; - void SummonSkeletons() + CreatureAI* GetAI(Creature* creature) const OVERRIDE { - // I could not found any spell casted for this - for (uint8 i = 0; i < 4; ++i) - me->SummonCreature(NPC_SKELETON, SkeletonSpawnPoint[0][0], SkeletonSpawnPoint[0][1], SKELETONSPAWN_Z, 0); + return GetUtgardeKeepAI(creature); } - private: - bool onTheRocks; - }; }; class npc_vrykul_skeleton : public CreatureScript { -public: - npc_vrykul_skeleton() : CreatureScript("npc_vrykul_skeleton") {} - - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new npc_vrykul_skeletonAI(creature); - } - - struct npc_vrykul_skeletonAI : public ScriptedAI - { - npc_vrykul_skeletonAI(Creature* creature) : ScriptedAI(creature) {} + public: + npc_vrykul_skeleton() : CreatureScript("npc_vrykul_skeleton") { } - void Reset() OVERRIDE + struct npc_vrykul_skeletonAI : public ScriptedAI { - events.Reset(); - events.ScheduleEvent(EVENT_DECREPIFY, urand(4, 6)*IN_MILLISECONDS); - - } + npc_vrykul_skeletonAI(Creature* creature) : ScriptedAI(creature) { } - void DamageTaken(Unit* /*done_by*/, uint32 &damage) OVERRIDE - { - if (damage >= me->GetHealth()) + void Reset() OVERRIDE { - damage = 0; + events.Reset(); + events.ScheduleEvent(EVENT_DECREPIFY, urand(4, 6) * IN_MILLISECONDS); + } - // There are some issues with pets - // they will still attack. I would say it is a PetAI bug - if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)) + void DamageTaken(Unit* /*doneBy*/, uint32& damage) OVERRIDE + { + if (damage >= me->GetHealth()) { - // from sniffs - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetFlag(UNIT_FIELD_BYTES_1, UNIT_STAND_STATE_DEAD); + damage = 0; - events.Reset(); - events.ScheduleEvent(EVENT_RESURRECT, urand(18, 22)*IN_MILLISECONDS); + // There are some issues with pets + // they will still attack. I would say it is a PetAI bug + if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)) + { + // from sniffs + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetFlag(UNIT_FIELD_BYTES_1, UNIT_STAND_STATE_DEAD); + + events.Reset(); + events.ScheduleEvent(EVENT_RESURRECT, urand(18, 22) * IN_MILLISECONDS); - me->GetMotionMaster()->MovementExpired(false); - me->GetMotionMaster()->MoveIdle(); + me->GetMotionMaster()->MovementExpired(false); + me->GetMotionMaster()->MoveIdle(); + } } } - } - void UpdateAI(uint32 diff) OVERRIDE - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) OVERRIDE + { + if (!UpdateVictim()) + return; - events.Update(diff); + events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - while (uint32 eventId = events.ExecuteEvent()) - { - switch (eventId) + while (uint32 eventId = events.ExecuteEvent()) { - case EVENT_DECREPIFY: - DoCast(SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true, -SPELL_DECREPIFY), SPELL_DECREPIFY); - events.ScheduleEvent(EVENT_DECREPIFY, urand(1, 5)*IN_MILLISECONDS); - break; - case EVENT_RESURRECT: - events.ScheduleEvent(EVENT_FULL_HEAL, 1*IN_MILLISECONDS); - events.ScheduleEvent(EVENT_SHADOW_FISSURE, 1*IN_MILLISECONDS); - break; - case EVENT_FULL_HEAL: - DoCast(me, SPELL_FULL_HEAL, true); - break; - case EVENT_SHADOW_FISSURE: - DoCast(me, SPELL_SHADOW_FISSURE, true); - if (TempSummon* temp = me->ToTempSummon()) - { - if (Unit* summoner = temp->GetSummoner()) - { - DoCast(summoner, SPELL_BONE_ARMOR); - } - } - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->RemoveFlag(UNIT_FIELD_BYTES_1, UNIT_STAND_STATE_DEAD); - me->GetMotionMaster()->MoveChase(me->GetVictim()); - events.ScheduleEvent(EVENT_DECREPIFY, urand(4, 6)*IN_MILLISECONDS); - break; + switch (eventId) + { + case EVENT_DECREPIFY: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true, -SPELL_DECREPIFY)) + DoCast(target, SPELL_DECREPIFY); + events.ScheduleEvent(EVENT_DECREPIFY, urand(1, 5)*IN_MILLISECONDS); + break; + case EVENT_RESURRECT: + events.ScheduleEvent(EVENT_FULL_HEAL, 1 * IN_MILLISECONDS); + events.ScheduleEvent(EVENT_SHADOW_FISSURE, 1 * IN_MILLISECONDS); + break; + case EVENT_FULL_HEAL: + DoCast(me, SPELL_FULL_HEAL, true); + break; + case EVENT_SHADOW_FISSURE: + DoCast(me, SPELL_SHADOW_FISSURE, true); + DoCastAOE(SPELL_BONE_ARMOR, true); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->RemoveFlag(UNIT_FIELD_BYTES_1, UNIT_STAND_STATE_DEAD); + me->GetMotionMaster()->MoveChase(me->GetVictim()); + events.ScheduleEvent(EVENT_DECREPIFY, urand(4, 6) * IN_MILLISECONDS); + break; + default: + break; + } } + + if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)) + DoMeleeAttackIfReady(); } - if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)) - DoMeleeAttackIfReady(); - } + private: + EventMap events; + }; - private: - EventMap events; - }; + CreatureAI* GetAI(Creature* creature) const OVERRIDE + { + return GetUtgardeKeepAI(creature); + } }; class spell_frost_tomb : public SpellScriptLoader @@ -347,12 +326,14 @@ class spell_frost_tomb : public SpellScriptLoader class spell_frost_tomb_AuraScript : public AuraScript { PrepareAuraScript(spell_frost_tomb_AuraScript); + void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_DEATH) if (Unit* caster = GetCaster()) - if (caster->ToCreature() && caster->IsAlive()) - caster->ToCreature()->DespawnOrUnsummon(1000); + if (caster->IsAlive()) + if (Creature* creature = caster->ToCreature()) + creature->DespawnOrUnsummon(1000); } void Register() OVERRIDE diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_skarvald_dalronn.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_skarvald_dalronn.cpp index bbb3d666b32..ffdd8fe232f 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_skarvald_dalronn.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_skarvald_dalronn.cpp @@ -58,14 +58,6 @@ enum Spells SPELL_SUMMON_DALRONN_GHOST = 48612, }; -enum Creatures -{ - NPC_SKARVALD_THE_CONSTRUCTOR = 24200, - NPC_SKARVALD_GHOST = 27390, - NPC_DALRONN_THE_CONTROLLER = 24201, - NPC_DALRONN_GHOST = 27389 -}; - class SkarvaldChargePredicate { public: @@ -82,355 +74,334 @@ class SkarvaldChargePredicate class boss_skarvald_the_constructor : public CreatureScript { -public: - boss_skarvald_the_constructor() : CreatureScript("boss_skarvald_the_constructor") { } - - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new boss_skarvald_the_constructorAI(creature); - } + public: + boss_skarvald_the_constructor() : CreatureScript("boss_skarvald_the_constructor") { } - struct boss_skarvald_the_constructorAI : public ScriptedAI - { - boss_skarvald_the_constructorAI(Creature* creature) : ScriptedAI(creature) + struct boss_skarvald_the_constructorAI : public BossAI { - instance = creature->GetInstanceScript(); - } + boss_skarvald_the_constructorAI(Creature* creature) : BossAI(creature, DATA_SKARVALD_DALRONN) { } - InstanceScript* instance; + bool ghost; + uint32 Charge_Timer; + uint32 StoneStrike_Timer; + uint32 Response_Timer; + uint32 Check_Timer; + bool Dalronn_isDead; + bool Enraged; - bool ghost; - uint32 Charge_Timer; - uint32 StoneStrike_Timer; - uint32 Response_Timer; - uint32 Check_Timer; - bool Dalronn_isDead; - bool Enraged; - - void Reset() OVERRIDE - { - Charge_Timer = 5000; - StoneStrike_Timer = 10000; - Dalronn_isDead = false; - Response_Timer = 0; - Check_Timer = 5000; - Enraged = false; - - ghost = (me->GetEntry() == NPC_SKARVALD_GHOST); - if (!ghost && instance) + void Reset() OVERRIDE { - Unit* dalronn = Unit::GetUnit(*me, instance->GetData64(DATA_DALRONN)); - if (dalronn && dalronn->isDead()) - dalronn->ToCreature()->Respawn(); - - instance->SetData(DATA_SKARVALD_DALRONN_EVENT, NOT_STARTED); + Charge_Timer = 5000; + StoneStrike_Timer = 10000; + Dalronn_isDead = false; + Response_Timer = 0; + Check_Timer = 5000; + Enraged = false; + + ghost = me->GetEntry() == NPC_SKARVALD_GHOST; + if (!ghost) + _Reset(); } - } - void EnterCombat(Unit* who) OVERRIDE - { - if (!ghost && instance) + void EnterCombat(Unit* /*who*/) OVERRIDE { - Talk(YELL_SKARVALD_AGGRO); - - Unit* dalronn = Unit::GetUnit(*me, instance->GetData64(DATA_DALRONN)); - if (dalronn && dalronn->IsAlive() && !dalronn->GetVictim()) - dalronn->getThreatManager().addThreat(who, 0.0f); + if (!ghost) + { + _EnterCombat(); + Talk(YELL_SKARVALD_AGGRO); + } + } - instance->SetData(DATA_SKARVALD_DALRONN_EVENT, IN_PROGRESS); + void DamageTaken(Unit* /*attacker*/, uint32& damage) OVERRIDE + { + if (!Enraged && !ghost && me->HealthBelowPctDamaged(15, damage)) + { + Enraged = true; + DoCast(me, SPELL_ENRAGE); + } } - } - void DamageTaken(Unit* /*attacker*/, uint32& damage) OVERRIDE - { - if (!Enraged && !ghost && me->HealthBelowPctDamaged(15, damage)) + void DoAction(int32 /*actionId*/) { - Enraged = true; - DoCast(me, SPELL_ENRAGE); + summons.DespawnAll(); } - } - void JustDied(Unit* killer) OVERRIDE - { - if (!ghost && instance) + void JustDied(Unit* killer) OVERRIDE { - Unit* dalronn = Unit::GetUnit(*me, instance->GetData64(DATA_DALRONN)); - if (dalronn) + if (!ghost) { - if (dalronn->isDead()) + if (Creature* dalronn = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_DALRONN))) { - Talk(YELL_SKARVALD_DAL_DIED); + if (dalronn->IsAlive()) + { + Talk(YELL_SKARVALD_SKA_DIEDFIRST); - instance->SetData(DATA_SKARVALD_DALRONN_EVENT, DONE); - } - else - { - Talk(YELL_SKARVALD_SKA_DIEDFIRST); + me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); - me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); - //DoCast(me, SPELL_SUMMON_SKARVALD_GHOST, true); - Creature* temp = me->SummonCreature(NPC_SKARVALD_GHOST, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_CORPSE_DESPAWN, 5000); - if (temp) + //DoCast(me, SPELL_SUMMON_SKARVALD_GHOST, true); + if (Creature* temp = me->SummonCreature(NPC_SKARVALD_GHOST, *me, TEMPSUMMON_CORPSE_DESPAWN, 5000)) + { + temp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + temp->AI()->AttackStart(killer); + } + } + else { - temp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - temp->AI()->AttackStart(killer); + dalronn->AI()->DoAction(0); + _JustDied(); + Talk(YELL_SKARVALD_DAL_DIED); } } } } - } - void KilledUnit(Unit* /*victim*/) OVERRIDE - { - if (!ghost) + void KilledUnit(Unit* who) OVERRIDE { - Talk(YELL_SKARVALD_KILL); + if (!ghost && who->GetTypeId() == TYPEID_PLAYER) + Talk(YELL_SKARVALD_KILL); } - } - void UpdateAI(uint32 diff) OVERRIDE - { - if (ghost) + void UpdateAI(uint32 diff) OVERRIDE { - if (instance && instance->GetData(DATA_SKARVALD_DALRONN_EVENT) != IN_PROGRESS) - me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - } - - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; - if (!ghost) - { - if (Check_Timer) + if (!ghost) { - if (Check_Timer <= diff) + if (Check_Timer) { - Check_Timer = 5000; - Unit* dalronn = Unit::GetUnit(*me, instance ? instance->GetData64(DATA_DALRONN) : 0); - if (dalronn && dalronn->isDead()) + if (Check_Timer <= diff) { - Dalronn_isDead = true; - Response_Timer = 2000; - Check_Timer = 0; + Check_Timer = 5000; + Creature* dalronn = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_DALRONN)); + if (dalronn && dalronn->isDead()) + { + Dalronn_isDead = true; + Response_Timer = 2000; + Check_Timer = 0; + } } - } else Check_Timer -= diff; - } - if (Response_Timer && Dalronn_isDead) - { - if (Response_Timer <= diff) + else + Check_Timer -= diff; + } + if (Response_Timer && Dalronn_isDead) { - Talk(YELL_SKARVALD_DAL_DIEDFIRST); + if (Response_Timer <= diff) + { + Talk(YELL_SKARVALD_DAL_DIEDFIRST); - Response_Timer = 0; - } else Response_Timer -= diff; + Response_Timer = 0; + } + else + Response_Timer -= diff; + } } - } - if (Charge_Timer <= diff) - { - DoCast(SelectTarget(SELECT_TARGET_RANDOM, 0, SkarvaldChargePredicate(me)), SPELL_CHARGE); - Charge_Timer = 5000+rand()%5000; - } else Charge_Timer -= diff; + if (Charge_Timer <= diff) + { + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, SkarvaldChargePredicate(me))) + DoCast(target, SPELL_CHARGE); + Charge_Timer = 5000+rand()%5000; + } + else + Charge_Timer -= diff; - if (StoneStrike_Timer <= diff) - { - DoCastVictim(SPELL_STONE_STRIKE); - StoneStrike_Timer = 5000+rand()%5000; - } else StoneStrike_Timer -= diff; + if (StoneStrike_Timer <= diff) + { + DoCastVictim(SPELL_STONE_STRIKE); + StoneStrike_Timer = 5000+rand()%5000; + } + else + StoneStrike_Timer -= diff; - if (!me->HasUnitState(UNIT_STATE_CASTING)) - DoMeleeAttackIfReady(); - } - }; + if (!me->HasUnitState(UNIT_STATE_CASTING)) + DoMeleeAttackIfReady(); + } + }; + CreatureAI* GetAI(Creature* creature) const OVERRIDE + { + return GetUtgardeKeepAI(creature); + } }; class boss_dalronn_the_controller : public CreatureScript { -public: - boss_dalronn_the_controller() : CreatureScript("boss_dalronn_the_controller") { } - - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new boss_dalronn_the_controllerAI(creature); - } + public: + boss_dalronn_the_controller() : CreatureScript("boss_dalronn_the_controller") { } - struct boss_dalronn_the_controllerAI : public ScriptedAI - { - boss_dalronn_the_controllerAI(Creature* creature) : ScriptedAI(creature) + struct boss_dalronn_the_controllerAI : public BossAI { - instance = creature->GetInstanceScript(); - } + boss_dalronn_the_controllerAI(Creature* creature) : BossAI(creature, DATA_SKARVALD_DALRONN) { } - InstanceScript* instance; + bool ghost; + uint32 ShadowBolt_Timer; + uint32 Debilitate_Timer; + uint32 Summon_Timer; - bool ghost; - uint32 ShadowBolt_Timer; - uint32 Debilitate_Timer; - uint32 Summon_Timer; + uint32 Response_Timer; + uint32 Check_Timer; + uint32 AggroYell_Timer; + bool Skarvald_isDead; - uint32 Response_Timer; - uint32 Check_Timer; - uint32 AggroYell_Timer; - bool Skarvald_isDead; - - void Reset() OVERRIDE - { - ShadowBolt_Timer = 1000; - Debilitate_Timer = 5000; - Summon_Timer = 10000; - Check_Timer = 5000; - Skarvald_isDead = false; - Response_Timer = 0; - AggroYell_Timer = 0; - - ghost = me->GetEntry() == NPC_DALRONN_GHOST; - if (!ghost && instance) + void Reset() OVERRIDE { - Unit* skarvald = Unit::GetUnit(*me, instance->GetData64(DATA_SKARVALD)); - if (skarvald && skarvald->isDead()) - skarvald->ToCreature()->Respawn(); - - instance->SetData(DATA_SKARVALD_DALRONN_EVENT, NOT_STARTED); + ShadowBolt_Timer = 1000; + Debilitate_Timer = 5000; + Summon_Timer = 10000; + Check_Timer = 5000; + Skarvald_isDead = false; + Response_Timer = 0; + AggroYell_Timer = 0; + + ghost = me->GetEntry() == NPC_DALRONN_GHOST; + if (!ghost) + _Reset(); } - } - void EnterCombat(Unit* who) OVERRIDE - { - if (!ghost && instance) + void EnterCombat(Unit* /*who*/) OVERRIDE { - Unit* skarvald = Unit::GetUnit(*me, instance->GetData64(DATA_SKARVALD)); - if (skarvald && skarvald->IsAlive() && !skarvald->GetVictim()) - skarvald->getThreatManager().addThreat(who, 0.0f); - - AggroYell_Timer = 5000; + if (!ghost) + { + _EnterCombat(); + AggroYell_Timer = 5000; + } + } - if (instance) - instance->SetData(DATA_SKARVALD_DALRONN_EVENT, IN_PROGRESS); + void DoAction(int32 /*actionId*/) + { + summons.DespawnAll(); } - } - void JustDied(Unit* killer) OVERRIDE - { - if (!ghost && instance) + void JustDied(Unit* killer) OVERRIDE { - Unit* skarvald = Unit::GetUnit(*me, instance->GetData64(DATA_SKARVALD)); - if (skarvald) + if (!ghost) { - if (skarvald->isDead()) + if (Creature* skarvald = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SKARVALD))) { - Talk(YELL_DALRONN_SKA_DIED); + if (skarvald->IsAlive()) + { + Talk(YELL_DALRONN_DAL_DIEDFIRST); - if (instance) - instance->SetData(DATA_SKARVALD_DALRONN_EVENT, DONE); - } - else - { - Talk(YELL_DALRONN_DAL_DIEDFIRST); + me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); - me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); - //DoCast(me, SPELL_SUMMON_DALRONN_GHOST, true); - Creature* temp = me->SummonCreature(NPC_DALRONN_GHOST, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_CORPSE_DESPAWN, 5000); - if (temp) + //DoCast(me, SPELL_SUMMON_DALRONN_GHOST, true); + if (Creature* temp = me->SummonCreature(NPC_DALRONN_GHOST, *me, TEMPSUMMON_CORPSE_DESPAWN, 5000)) + { + temp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + temp->AI()->AttackStart(killer); + } + } + else { - temp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - temp->AI()->AttackStart(killer); + skarvald->AI()->DoAction(0); + _JustDied(); + Talk(YELL_DALRONN_SKA_DIED); } } } } - } - void KilledUnit(Unit* /*victim*/) OVERRIDE - { - if (!ghost) + void KilledUnit(Unit* who) OVERRIDE { - Talk(YELL_DALRONN_KILL); + if (!ghost && who->GetTypeId() == TYPEID_PLAYER) + Talk(YELL_DALRONN_KILL); } - } - void UpdateAI(uint32 diff) OVERRIDE - { - if (ghost) + void UpdateAI(uint32 diff) OVERRIDE { - if (instance && instance->GetData(DATA_SKARVALD_DALRONN_EVENT) != IN_PROGRESS) - me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - } + if (!UpdateVictim()) + return; - if (!UpdateVictim()) - return; - - if (AggroYell_Timer) - { - if (AggroYell_Timer <= diff) + if (AggroYell_Timer) { - Talk(YELL_DALRONN_AGGRO); + if (AggroYell_Timer <= diff) + { + Talk(YELL_DALRONN_AGGRO); - AggroYell_Timer = 0; - } else AggroYell_Timer -= diff; - } + AggroYell_Timer = 0; + } + else + AggroYell_Timer -= diff; + } - if (!ghost) - { - if (Check_Timer) + if (!ghost) { - if (Check_Timer <= diff) + if (Check_Timer) { - Check_Timer = 5000; - Unit* skarvald = Unit::GetUnit(*me, instance ? instance->GetData64(DATA_SKARVALD) : 0); - if (skarvald && skarvald->isDead()) + if (Check_Timer <= diff) { - Skarvald_isDead = true; - Response_Timer = 2000; - Check_Timer = 0; + Check_Timer = 5000; + Creature* skarvald = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_SKARVALD)); + if (skarvald && skarvald->isDead()) + { + Skarvald_isDead = true; + Response_Timer = 2000; + Check_Timer = 0; + } } - } else Check_Timer -= diff; - } + else + Check_Timer -= diff; + } - if (Response_Timer && Skarvald_isDead) - { - if (Response_Timer <= diff) + if (Response_Timer && Skarvald_isDead) { - Talk(YELL_DALRONN_SKA_DIEDFIRST); - Response_Timer = 0; - } else Response_Timer -= diff; + if (Response_Timer <= diff) + { + Talk(YELL_DALRONN_SKA_DIEDFIRST); + Response_Timer = 0; + } + else + Response_Timer -= diff; + } } - } - if (ShadowBolt_Timer <= diff) - { - if (!me->IsNonMeleeSpellCasted(false)) + if (ShadowBolt_Timer <= diff) { - DoCast(SelectTarget(SELECT_TARGET_RANDOM, 0), SPELL_SHADOW_BOLT); - ShadowBolt_Timer = 2100;//give a 100ms pause to try cast other spells + if (!me->IsNonMeleeSpellCasted(false)) + { + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true)) + DoCast(target, SPELL_SHADOW_BOLT); + ShadowBolt_Timer = 2100;//give a 100ms pause to try cast other spells + } } - } else ShadowBolt_Timer -= diff; + else + ShadowBolt_Timer -= diff; - if (Debilitate_Timer <= diff) - { - if (!me->IsNonMeleeSpellCasted(false)) + if (Debilitate_Timer <= diff) { - DoCast(SelectTarget(SELECT_TARGET_RANDOM, 0), SPELL_DEBILITATE); - Debilitate_Timer = 5000+rand()%5000; + if (!me->IsNonMeleeSpellCasted(false)) + { + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true)) + DoCast(target, SPELL_DEBILITATE); + Debilitate_Timer = 5000+rand()%5000; + } } - } else Debilitate_Timer -= diff; + else + Debilitate_Timer -= diff; - if (IsHeroic()) - { - if (Summon_Timer <= diff) + if (IsHeroic()) { - if (!me->IsNonMeleeSpellCasted(false)) + if (Summon_Timer <= diff) { - DoCast(me, H_SPELL_SUMMON_SKELETONS); - Summon_Timer = (rand()%10000) + 20000; + if (!me->IsNonMeleeSpellCasted(false)) + { + DoCast(me, H_SPELL_SUMMON_SKELETONS); + Summon_Timer = (rand()%10000) + 20000; + } } - } else Summon_Timer -= diff; + else + Summon_Timer -= diff; + } + + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); + CreatureAI* GetAI(Creature* creature) const OVERRIDE + { + return GetUtgardeKeepAI(creature); } - }; - }; void AddSC_boss_skarvald_dalronn() diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/instance_utgarde_keep.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/instance_utgarde_keep.cpp index 92857ce06db..7bc25aad773 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/instance_utgarde_keep.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/instance_utgarde_keep.cpp @@ -15,300 +15,244 @@ * with this program. If not, see . */ -/* ScriptData -SDName: Instance_Utgarde_Keep -SD%Complete: 90 -SDComment: Instance Data Scripts and functions to acquire mobs and set encounter status for use in various Utgarde Keep Scripts -SDCategory: Utgarde Keep -EndScriptData */ - #include "ScriptMgr.h" #include "InstanceScript.h" #include "utgarde_keep.h" -#include "Player.h" - -#define MAX_ENCOUNTER 3 - -#define ENTRY_BELLOW_1 186688 -#define ENTRY_BELLOW_2 186689 -#define ENTRY_BELLOW_3 186690 - -#define ENTRY_FORGEFIRE_1 186692 -#define ENTRY_FORGEFIRE_2 186693 -#define ENTRY_FORGEFIRE_3 186691 - -#define ENTRY_GLOWING_ANVIL_1 186609 -#define ENTRY_GLOWING_ANVIL_2 186610 -#define ENTRY_GLOWING_ANVIL_3 186611 -#define ENTRY_GIANT_PORTCULLIS_1 186756 -#define ENTRY_GIANT_PORTCULLIS_2 186694 +DoorData const doorData[] = +{ + { GO_GIANT_PORTCULLIS_1, DATA_INGVAR, DOOR_TYPE_PASSAGE, BOUNDARY_NONE }, + { GO_GIANT_PORTCULLIS_2, DATA_INGVAR, DOOR_TYPE_PASSAGE, BOUNDARY_NONE }, + { 0, 0, DOOR_TYPE_ROOM, BOUNDARY_NONE } // END +}; -/* Utgarde Keep encounters: -0 - Prince Keleseth -1 - Skarvald Dalronn -2 - Ingvar the Plunderer -*/ +MinionData const minionData[] = +{ + { NPC_SKARVALD, DATA_SKARVALD_DALRONN }, + { NPC_DALRONN, DATA_SKARVALD_DALRONN } +}; class instance_utgarde_keep : public InstanceMapScript { -public: - instance_utgarde_keep() : InstanceMapScript("instance_utgarde_keep", 574) { } - - InstanceScript* GetInstanceScript(InstanceMap* map) const OVERRIDE - { - return new instance_utgarde_keep_InstanceMapScript(map); - } + public: + instance_utgarde_keep() : InstanceMapScript(UKScriptName, 574) { } - struct instance_utgarde_keep_InstanceMapScript : public InstanceScript - { - instance_utgarde_keep_InstanceMapScript(Map* map) : InstanceScript(map) {} - - uint64 Keleseth; - uint64 Skarvald; - uint64 Dalronn; - uint64 Ingvar; - - uint64 forge_bellow[3]; - uint64 forge_fire[3]; - uint64 forge_anvil[3]; - uint64 portcullis[2]; - - uint32 m_auiEncounter[MAX_ENCOUNTER]; - uint32 forge_event[3]; - std::string str_data; - - void Initialize() OVERRIDE - { - memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - - Keleseth = 0; - Skarvald = 0; - Dalronn = 0; - Ingvar = 0; - - for (uint8 i = 0; i < 3; ++i) + struct instance_utgarde_keep_InstanceMapScript : public InstanceScript + { + instance_utgarde_keep_InstanceMapScript(Map* map) : InstanceScript(map) { - forge_bellow[i] = 0; - forge_fire[i] = 0; - forge_anvil[i] = 0; - forge_event[i] = NOT_STARTED; + SetBossNumber(EncounterCount); + LoadDoorData(doorData); + LoadMinionData(minionData); + + PrinceKelesethGUID = 0; + SkarvaldGUID = 0; + DalronnGUID = 0; + IngvarGUID = 0; } - portcullis[0] = 0; - portcullis[1] = 0; - } - - bool IsEncounterInProgress() const OVERRIDE - { - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) - return true; - - return false; - } - - Player* GetPlayerInMap() - { - Map::PlayerList const& players = instance->GetPlayers(); - - if (!players.isEmpty()) + void OnCreatureCreate(Creature* creature) OVERRIDE { - for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + switch (creature->GetEntry()) { - if (Player* player = itr->GetSource()) - return player; + case NPC_PRINCE_KELESETH: + PrinceKelesethGUID = creature->GetGUID(); + break; + case NPC_SKARVALD: + SkarvaldGUID = creature->GetGUID(); + AddMinion(creature, true); + break; + case NPC_DALRONN: + DalronnGUID = creature->GetGUID(); + AddMinion(creature, true); + break; + case NPC_INGVAR: + IngvarGUID = creature->GetGUID(); + break; + default: + break; } } - TC_LOG_DEBUG(LOG_FILTER_TSCR, "Instance Utgarde Keep: GetPlayerInMap, but PlayerList is empty!"); - return NULL; - } - - void OnCreatureCreate(Creature* creature) OVERRIDE - { - switch (creature->GetEntry()) + void OnCreatureRemove(Creature* creature) OVERRIDE { - case 23953: Keleseth = creature->GetGUID(); break; - case 24201: Dalronn = creature->GetGUID(); break; - case 24200: Skarvald = creature->GetGUID(); break; - case 23954: Ingvar = creature->GetGUID(); break; + switch (creature->GetEntry()) + { + case NPC_SKARVALD: + case NPC_DALRONN: + AddMinion(creature, false); + break; + default: + break; + } } - } - void OnGameObjectCreate(GameObject* go) OVERRIDE - { - switch (go->GetEntry()) + void OnGameObjectCreate(GameObject* go) OVERRIDE { - //door and object id - case ENTRY_BELLOW_1: forge_bellow[0] = go->GetGUID(); - if (forge_event[0] != NOT_STARTED)HandleGameObject(0, true, go);break; - case ENTRY_BELLOW_2: forge_bellow[1] = go->GetGUID(); - if (forge_event[1] != NOT_STARTED)HandleGameObject(0, true, go);break; - case ENTRY_BELLOW_3: forge_bellow[2] = go->GetGUID(); - if (forge_event[2] != NOT_STARTED)HandleGameObject(0, true, go);break; - case ENTRY_FORGEFIRE_1: forge_fire[0] = go->GetGUID(); - if (forge_event[0] != NOT_STARTED)HandleGameObject(0, true, go);break; - case ENTRY_FORGEFIRE_2: forge_fire[1] = go->GetGUID(); - if (forge_event[1] != NOT_STARTED)HandleGameObject(0, true, go);break; - case ENTRY_FORGEFIRE_3: forge_fire[2] = go->GetGUID(); - if (forge_event[2] != NOT_STARTED)HandleGameObject(0, true, go);break; - case ENTRY_GLOWING_ANVIL_1: forge_anvil[0] = go->GetGUID(); - if (forge_event[0] != NOT_STARTED)HandleGameObject(0, true, go);break; - case ENTRY_GLOWING_ANVIL_2: forge_anvil[1] = go->GetGUID(); - if (forge_event[1] != NOT_STARTED)HandleGameObject(0, true, go);break; - case ENTRY_GLOWING_ANVIL_3: forge_anvil[2] = go->GetGUID(); - if (forge_event[2] != NOT_STARTED)HandleGameObject(0, true, go);break; - case ENTRY_GIANT_PORTCULLIS_1: portcullis[0] = go->GetGUID(); - if (m_auiEncounter[2] == DONE)HandleGameObject(0, true, go);break; - case ENTRY_GIANT_PORTCULLIS_2: portcullis[1] = go->GetGUID(); - if (m_auiEncounter[2] == DONE)HandleGameObject(0, true, go);break; + switch (go->GetEntry()) + { + case GO_BELLOW_1: + Forges[0].BellowGUID = go->GetGUID(); + HandleGameObject(0, Forges[0].Event != NOT_STARTED, go); + break; + case GO_BELLOW_2: + Forges[1].BellowGUID = go->GetGUID(); + HandleGameObject(0, Forges[1].Event != NOT_STARTED, go); + break; + case GO_BELLOW_3: + Forges[2].BellowGUID = go->GetGUID(); + HandleGameObject(0, Forges[2].Event != NOT_STARTED, go); + break; + case GO_FORGEFIRE_1: + Forges[0].FireGUID = go->GetGUID(); + HandleGameObject(0, Forges[0].Event != NOT_STARTED, go); + break; + case GO_FORGEFIRE_2: + Forges[1].FireGUID = go->GetGUID(); + HandleGameObject(0, Forges[1].Event != NOT_STARTED, go); + break; + case GO_FORGEFIRE_3: + Forges[2].FireGUID = go->GetGUID(); + HandleGameObject(0, Forges[2].Event != NOT_STARTED, go); + break; + case GO_GLOWING_ANVIL_1: + Forges[0].AnvilGUID = go->GetGUID(); + HandleGameObject(0, Forges[0].Event != NOT_STARTED, go); + break; + case GO_GLOWING_ANVIL_2: + Forges[1].AnvilGUID = go->GetGUID(); + HandleGameObject(0, Forges[1].Event != NOT_STARTED, go); + break; + case GO_GLOWING_ANVIL_3: + Forges[2].AnvilGUID = go->GetGUID(); + HandleGameObject(0, Forges[2].Event != NOT_STARTED, go); + break; + case GO_GIANT_PORTCULLIS_1: + case GO_GIANT_PORTCULLIS_2: + AddDoor(go, true); + break; + default: + break; + } } - } - uint64 GetData64(uint32 identifier) const OVERRIDE - { - switch (identifier) + void OnGameObjectRemove(GameObject* go) OVERRIDE { - case DATA_PRINCEKELESETH: return Keleseth; - case DATA_DALRONN: return Dalronn; - case DATA_SKARVALD: return Skarvald; - case DATA_INGVAR: return Ingvar; + switch (go->GetEntry()) + { + case GO_GIANT_PORTCULLIS_1: + case GO_GIANT_PORTCULLIS_2: + AddDoor(go, false); + break; + default: + break; + } } - return 0; - } - - void SetData(uint32 type, uint32 data) OVERRIDE - { - switch (type) + uint64 GetData64(uint32 type) const OVERRIDE { - case DATA_PRINCEKELESETH_EVENT: - m_auiEncounter[0] = data; - break; - case DATA_SKARVALD_DALRONN_EVENT: - m_auiEncounter[1] = data; - break; - case DATA_INGVAR_EVENT: - if (data == DONE) - { - HandleGameObject(portcullis[0], true); - HandleGameObject(portcullis[1], true); - } - m_auiEncounter[2] = data; - break; - case EVENT_FORGE_1: - if (data == NOT_STARTED) - { - HandleGameObject(forge_bellow[0], false); - HandleGameObject(forge_fire[0], false); - HandleGameObject(forge_anvil[0], false); - }else - { - HandleGameObject(forge_bellow[0], true); - HandleGameObject(forge_fire[0], true); - HandleGameObject(forge_anvil[0], true); - } - forge_event[0] = data; - break; - case EVENT_FORGE_2: - if (data == NOT_STARTED) + switch (type) { - HandleGameObject(forge_bellow[1], false); - HandleGameObject(forge_fire[1], false); - HandleGameObject(forge_anvil[1], false); - }else - { - HandleGameObject(forge_bellow[1], true); - HandleGameObject(forge_fire[1], true); - HandleGameObject(forge_anvil[1], true); + case DATA_PRINCE_KELESETH: + return PrinceKelesethGUID; + case DATA_SKARVALD: + return SkarvaldGUID; + case DATA_DALRONN: + return DalronnGUID; + case DATA_INGVAR: + return IngvarGUID; + default: + break; } - forge_event[1] = data; - break; - case EVENT_FORGE_3: - if (data == NOT_STARTED) - { - HandleGameObject(forge_bellow[2], false); - HandleGameObject(forge_fire[2], false); - HandleGameObject(forge_anvil[2], false); - }else - { - HandleGameObject(forge_bellow[2], true); - HandleGameObject(forge_fire[2], true); - HandleGameObject(forge_anvil[2], true); - } - forge_event[2] = data; - break; - } - if (data == DONE) - { - SaveToDB(); + return 0; } - } - uint32 GetData(uint32 type) const OVERRIDE - { - switch (type) + void SetData(uint32 type, uint32 data) OVERRIDE { - case DATA_PRINCEKELESETH_EVENT: return m_auiEncounter[0]; - case DATA_SKARVALD_DALRONN_EVENT: return m_auiEncounter[1]; - case DATA_INGVAR_EVENT: return m_auiEncounter[2]; + switch (type) + { + case DATA_FORGE_1: + case DATA_FORGE_2: + case DATA_FORGE_3: + { + uint8 i = type - DATA_FORGE_1; + HandleGameObject(Forges[i].AnvilGUID, data != NOT_STARTED); + HandleGameObject(Forges[i].BellowGUID, data != NOT_STARTED); + HandleGameObject(Forges[i].FireGUID, data != NOT_STARTED); + Forges[i].Event = data; + + if (data == DONE) + SaveToDB(); + break; + } + default: + break; + } } - return 0; - } - - std::string GetSaveData() OVERRIDE - { - OUT_SAVE_INST_DATA; - - std::ostringstream saveStream; - saveStream << "U K " << m_auiEncounter[0] << ' ' << m_auiEncounter[1] << ' ' - << m_auiEncounter[2] << ' ' << forge_event[0] << ' ' << forge_event[1] << ' ' << forge_event[2]; + std::string GetSaveData() OVERRIDE + { + OUT_SAVE_INST_DATA; - str_data = saveStream.str(); + std::ostringstream saveStream; + saveStream << "U K " << GetBossSaveData(); + + for (uint8 i = 0; i < 3; ++i) + saveStream << Forges[i].Event << ' '; - OUT_SAVE_INST_DATA_COMPLETE; - return str_data; - } + OUT_SAVE_INST_DATA_COMPLETE; + return saveStream.str(); + } - void Load(const char* in) OVERRIDE - { - if (!in) + void Load(char const* str) OVERRIDE { - OUT_LOAD_INST_DATA_FAIL; - return; - } + if (!str) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } - OUT_LOAD_INST_DATA(in); + OUT_LOAD_INST_DATA(str); - char dataHead1, dataHead2; - uint16 data0, data1, data2, data3, data4, data5; + char dataHead1, dataHead2; - std::istringstream loadStream(in); - loadStream >> dataHead1 >> dataHead2 >> data0 >> data1 >> data2 >> data3 >> data4 >> data5; + std::istringstream loadStream(str); + loadStream >> dataHead1 >> dataHead2; - if (dataHead1 == 'U' && dataHead2 == 'K') - { - m_auiEncounter[0] = data0; - m_auiEncounter[1] = data1; - m_auiEncounter[2] = data2; + if (dataHead1 == 'U' && dataHead2 == 'K') + { + for (uint32 i = 0; i < EncounterCount; ++i) + { + uint32 tmpState; + loadStream >> tmpState; + if (tmpState == IN_PROGRESS || tmpState > SPECIAL) + tmpState = NOT_STARTED; + SetBossState(i, EncounterState(tmpState)); + } + + for (uint8 i = 0; i < 3; ++i) + loadStream >> Forges[i].Event; + } + else + OUT_LOAD_INST_DATA_FAIL; - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) - m_auiEncounter[i] = NOT_STARTED; + OUT_LOAD_INST_DATA_COMPLETE; + } - forge_event[0] = data3; - forge_event[1] = data4; - forge_event[2] = data5; + protected: + ForgeInfo Forges[3]; - } else OUT_LOAD_INST_DATA_FAIL; + uint64 PrinceKelesethGUID; + uint64 SkarvaldGUID; + uint64 DalronnGUID; + uint64 IngvarGUID; + }; - OUT_LOAD_INST_DATA_COMPLETE; + InstanceScript* GetInstanceScript(InstanceMap* map) const OVERRIDE + { + return new instance_utgarde_keep_InstanceMapScript(map); } - }; - }; void AddSC_instance_utgarde_keep() diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.cpp index fa28695ff62..84d6ee1734b 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.cpp @@ -21,142 +21,97 @@ #include "SpellScript.h" #include "SpellAuraEffects.h" -uint32 entry_search[3] = +uint32 ForgeSearch[3] = { - 186609, - 186610, - 186611 + GO_GLOWING_ANVIL_1, + GO_GLOWING_ANVIL_2, + GO_GLOWING_ANVIL_3 }; class npc_dragonflayer_forge_master : public CreatureScript { -public: - npc_dragonflayer_forge_master() : CreatureScript("npc_dragonflayer_forge_master") { } - - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new npc_dragonflayer_forge_masterAI(creature); - } + public: + npc_dragonflayer_forge_master() : CreatureScript("npc_dragonflayer_forge_master") { } - struct npc_dragonflayer_forge_masterAI : public ScriptedAI - { - npc_dragonflayer_forge_masterAI(Creature* creature) : ScriptedAI(creature) + struct npc_dragonflayer_forge_masterAI : public ScriptedAI { - instance = creature->GetInstanceScript(); - fm_Type = 0; - } + npc_dragonflayer_forge_masterAI(Creature* creature) : ScriptedAI(creature) + { + _instance = creature->GetInstanceScript(); + _forgeId = 0; + } - InstanceScript* instance; - uint8 fm_Type; + void Reset() OVERRIDE + { + if (!_forgeId) + _forgeId = GetForgeMasterType(); - void Reset() OVERRIDE - { - if (fm_Type == 0) - fm_Type = GetForgeMasterType(); + if (!me->IsAlive()) + return; - CheckForge(); - } + if (_forgeId) + _instance->SetData(DATA_FORGE_1 + _forgeId - 1, NOT_STARTED); + } - void CheckForge() - { - if (instance) + void JustDied(Unit* /*killer*/) OVERRIDE { - switch (fm_Type) - { - case 1: - instance->SetData(EVENT_FORGE_1, me->IsAlive() ? NOT_STARTED : DONE); - break; - - case 2: - instance->SetData(EVENT_FORGE_2, me->IsAlive() ? NOT_STARTED : DONE); - break; + if (!_forgeId) + _forgeId = GetForgeMasterType(); - case 3: - instance->SetData(EVENT_FORGE_3, me->IsAlive() ? NOT_STARTED : DONE); - break; - } + if (_forgeId) + _instance->SetData(DATA_FORGE_1 + _forgeId - 1, DONE); } - } - - void JustDied(Unit* /*killer*/) OVERRIDE - { - if (fm_Type == 0) - fm_Type = GetForgeMasterType(); - if (instance) + void EnterCombat(Unit* /*who*/) OVERRIDE { - switch (fm_Type) - { - case 1: - instance->SetData(EVENT_FORGE_1, DONE); - break; + if (!_forgeId) + _forgeId = GetForgeMasterType(); - case 2: - instance->SetData(EVENT_FORGE_2, DONE); - break; + if (_forgeId) + _instance->SetData(DATA_FORGE_1 + _forgeId - 1, IN_PROGRESS); - case 3: - instance->SetData(EVENT_FORGE_3, DONE); - break; - } + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); } - } - - void EnterCombat(Unit* /*who*/) OVERRIDE - { - if (fm_Type == 0) - fm_Type = GetForgeMasterType(); - if (instance) + void UpdateAI(uint32 /*diff*/) OVERRIDE { - switch (fm_Type) - { - case 1: - instance->SetData(EVENT_FORGE_1, IN_PROGRESS); - break; + if (!_forgeId) + _forgeId = GetForgeMasterType(); - case 2: - instance->SetData(EVENT_FORGE_2, IN_PROGRESS); - break; + if (!UpdateVictim()) + return; - case 3: - instance->SetData(EVENT_FORGE_3, IN_PROGRESS); - break; - } + DoMeleeAttackIfReady(); } - me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); - } - uint8 GetForgeMasterType() - { - float diff = 30.0f; - uint8 near_f = 0; - - for (uint8 i = 0; i < 3; ++i) + private: + uint8 GetForgeMasterType() { - if (GameObject* go = me->FindNearestGameObject(entry_search[i], 30)) + float diff = 30.0f; + uint8 id = 0; + + for (uint8 i = 0; i < 3; ++i) { - if (me->IsWithinDist(go, diff, false)) + if (GameObject* go = me->FindNearestGameObject(ForgeSearch[i], 30)) { - near_f = i + 1; - diff = me->GetDistance2d(go); + if (me->IsWithinDist(go, diff, false)) + { + id = i + 1; + diff = me->GetDistance2d(go); + } } } + return id > 0 && id < 4 ? id : 0; } - return near_f > 0 && near_f < 4 ? near_f : 0; - } - void UpdateAI(uint32 /* diff */) OVERRIDE - { - if (fm_Type == 0) - fm_Type = GetForgeMasterType(); - - if (!UpdateVictim()) - return; + InstanceScript* _instance; + uint8 _forgeId; + }; - DoMeleeAttackIfReady(); + CreatureAI* GetAI(Creature* creature) const OVERRIDE + { + return GetUtgardeKeepAI(creature); } - }; }; enum TickingTimeBomb @@ -183,9 +138,7 @@ class spell_ticking_time_bomb : public SpellScriptLoader void HandleOnEffectRemove(AuraEffect const* /* aurEff */, AuraEffectHandleModes /* mode */) { if (GetCaster() == GetTarget()) - { GetTarget()->CastSpell(GetTarget(), SPELL_TICKING_TIME_BOMB_EXPLODE, true); - } } void Register() OVERRIDE @@ -204,6 +157,7 @@ enum Fixate { SPELL_FIXATE_TRIGGER = 40415 }; + class spell_fixate : public SpellScriptLoader { public: @@ -222,8 +176,7 @@ class spell_fixate : public SpellScriptLoader void HandleScriptEffect(SpellEffIndex /*effIndex*/) { - // The unit has to cast the taunt on hisself, but we need the original caster for SPELL_AURA_MOD_TAUNT - GetCaster()->CastSpell(GetCaster(), SPELL_FIXATE_TRIGGER, true, 0, 0, GetHitUnit()->GetGUID()); + GetHitUnit()->CastSpell(GetCaster(), SPELL_FIXATE_TRIGGER, true); } void Register() OVERRIDE @@ -260,86 +213,86 @@ const Position protodrakeCheckPos = {206.24f, -190.28f, 200.11f, 0.f}; class npc_enslaved_proto_drake : public CreatureScript { -public: - npc_enslaved_proto_drake() : CreatureScript("npc_enslaved_proto_drake") { } + public: + npc_enslaved_proto_drake() : CreatureScript("npc_enslaved_proto_drake") { } - struct npc_enslaved_proto_drakeAI : public ScriptedAI - { - npc_enslaved_proto_drakeAI(Creature* creature) : ScriptedAI(creature) + struct npc_enslaved_proto_drakeAI : public ScriptedAI { - _setData = false; - } + npc_enslaved_proto_drakeAI(Creature* creature) : ScriptedAI(creature) + { + _setData = false; + } - void Reset() OVERRIDE - { - _events.Reset(); - _events.ScheduleEvent(EVENT_REND, urand(2000, 3000)); - _events.ScheduleEvent(EVENT_FLAME_BREATH, urand(5500, 7000)); - _events.ScheduleEvent(EVENT_KNOCKAWAY, urand(3500, 6000)); - } + void Reset() OVERRIDE + { + _events.Reset(); + _events.ScheduleEvent(EVENT_REND, urand(2000, 3000)); + _events.ScheduleEvent(EVENT_FLAME_BREATH, urand(5500, 7000)); + _events.ScheduleEvent(EVENT_KNOCKAWAY, urand(3500, 6000)); + } - void MovementInform(uint32 type, uint32 id) OVERRIDE - { - if (type == WAYPOINT_MOTION_TYPE && id == POINT_LAST) + void MovementInform(uint32 type, uint32 id) OVERRIDE { - me->RemoveByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_ALWAYS_STAND | UNIT_BYTE1_FLAG_HOVER); + if (type == WAYPOINT_MOTION_TYPE && id == POINT_LAST) + { + me->RemoveByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_ALWAYS_STAND | UNIT_BYTE1_FLAG_HOVER); + } } - } - void SetData(uint32 type, uint32 data) OVERRIDE - { - if (type == TYPE_PROTODRAKE_AT && data == DATA_PROTODRAKE_MOVE && !_setData && me->GetDistance(protodrakeCheckPos) < 5.0f) + void SetData(uint32 type, uint32 data) OVERRIDE { - _setData = true; - me->SetByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_ALWAYS_STAND | UNIT_BYTE1_FLAG_HOVER); - me->GetMotionMaster()->MovePath(PATH_PROTODRAKE, false); + if (type == TYPE_PROTODRAKE_AT && data == DATA_PROTODRAKE_MOVE && !_setData && me->GetDistance(protodrakeCheckPos) < 5.0f) + { + _setData = true; + me->SetByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_ALWAYS_STAND | UNIT_BYTE1_FLAG_HOVER); + me->GetMotionMaster()->MovePath(PATH_PROTODRAKE, false); + } } - } - void UpdateAI(uint32 diff) OVERRIDE - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 diff) OVERRIDE + { + if (!UpdateVictim()) + return; - _events.Update(diff); + _events.Update(diff); - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; - while (uint32 eventid = _events.ExecuteEvent()) - { - switch (eventid) + while (uint32 eventid = _events.ExecuteEvent()) { - case EVENT_REND: - DoCast(SPELL_REND); - _events.ScheduleEvent(EVENT_REND, urand(15000, 20000)); - break; - case EVENT_FLAME_BREATH: - DoCast(SPELL_FLAME_BREATH); - _events.ScheduleEvent(EVENT_FLAME_BREATH, urand(11000, 12000)); - break; - case EVENT_KNOCKAWAY: - DoCast(SPELL_KNOCK_AWAY); - _events.ScheduleEvent(EVENT_KNOCKAWAY, urand(7000, 8500)); - break; - default: - break; + switch (eventid) + { + case EVENT_REND: + DoCast(SPELL_REND); + _events.ScheduleEvent(EVENT_REND, urand(15000, 20000)); + break; + case EVENT_FLAME_BREATH: + DoCast(SPELL_FLAME_BREATH); + _events.ScheduleEvent(EVENT_FLAME_BREATH, urand(11000, 12000)); + break; + case EVENT_KNOCKAWAY: + DoCast(SPELL_KNOCK_AWAY); + _events.ScheduleEvent(EVENT_KNOCKAWAY, urand(7000, 8500)); + break; + default: + break; + } } - } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } - private: - bool _setData; - EventMap _events; + private: + bool _setData; + EventMap _events; - }; + }; - CreatureAI* GetAI(Creature* creature) const OVERRIDE - { - return new npc_enslaved_proto_drakeAI(creature); - } + CreatureAI* GetAI(Creature* creature) const OVERRIDE + { + return new npc_enslaved_proto_drakeAI(creature); + } }; void AddSC_utgarde_keep() diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.h b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.h index b0d9d702db5..ee422400e72 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.h +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.h @@ -15,23 +15,73 @@ * with this program. If not, see . */ -#ifndef DEF_UTGARDE_KEEP_H -#define DEF_UTGARDE_KEEP_H +#ifndef UTGARDE_KEEP_H_ +#define UTGARDE_KEEP_H_ + +#define UKScriptName "instance_utgarde_keep" + +uint32 const EncounterCount = 3; enum DataTypes { - DATA_PRINCEKELESETH = 1, - DATA_SKARVALD = 3, - DATA_DALRONN = 4, - DATA_INGVAR = 6, - - DATA_PRINCEKELESETH_EVENT = 2, - DATA_SKARVALD_DALRONN_EVENT = 5, - DATA_INGVAR_EVENT = 7, - - EVENT_FORGE_1 = 8, - EVENT_FORGE_2 = 9, - EVENT_FORGE_3 = 10 + // Encounter States/Boss GUIDs + DATA_PRINCE_KELESETH = 0, + DATA_SKARVALD_DALRONN = 1, + DATA_INGVAR = 2, + + // Additional Data + DATA_SKARVALD = 3, + DATA_DALRONN = 4, + + DATA_FORGE_1 = 5, + DATA_FORGE_2 = 6, + DATA_FORGE_3 = 7 }; -#endif +enum CreatureIds +{ + NPC_PRINCE_KELESETH = 23953, + NPC_SKARVALD = 24200, + NPC_DALRONN = 24201, + NPC_INGVAR = 23954, + + NPC_DALRONN_GHOST = 27389, + NPC_SKARVALD_GHOST = 27390 +}; + +enum GameObjectIds +{ + GO_BELLOW_1 = 186688, + GO_BELLOW_2 = 186689, + GO_BELLOW_3 = 186690, + + GO_FORGEFIRE_1 = 186692, + GO_FORGEFIRE_2 = 186693, + GO_FORGEFIRE_3 = 186691, + + GO_GLOWING_ANVIL_1 = 186609, + GO_GLOWING_ANVIL_2 = 186610, + GO_GLOWING_ANVIL_3 = 186611, + + GO_GIANT_PORTCULLIS_1 = 186756, + GO_GIANT_PORTCULLIS_2 = 186694 +}; + +struct ForgeInfo +{ + ForgeInfo() : AnvilGUID(0), BellowGUID(0), FireGUID(0), Event(NOT_STARTED) { }; + + uint64 AnvilGUID; + uint64 BellowGUID; + uint64 FireGUID; + + uint32 Event; +}; + +template +AI* GetUtgardeKeepAI(Creature* creature) +{ + return GetInstanceAI(creature, UKScriptName); +} + +#endif // UTGARDE_KEEP_H_ diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/instance_pinnacle.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/instance_pinnacle.cpp deleted file mode 100644 index 0277c21cb83..00000000000 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/instance_pinnacle.cpp +++ /dev/null @@ -1,267 +0,0 @@ -/* - * Copyright (C) 2008-2013 TrinityCore - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -#include "ScriptMgr.h" -#include "InstanceScript.h" -#include "utgarde_pinnacle.h" - -#define MAX_ENCOUNTER 4 - -/* Utgarde Pinnacle encounters: -0 - Svala Sorrowgrave -1 - Gortok Palehoof -2 - Skadi the Ruthless -3 - King Ymiron -*/ - -enum GameObjects -{ - ENTRY_SKADI_THE_RUTHLESS_DOOR = 192173, - ENTRY_KING_YMIRON_DOOR = 192174, - ENTRY_GORK_PALEHOOF_SPHERE = 188593 -}; - -class instance_utgarde_pinnacle : public InstanceMapScript -{ -public: - instance_utgarde_pinnacle() : InstanceMapScript("instance_utgarde_pinnacle", 575) { } - - InstanceScript* GetInstanceScript(InstanceMap* map) const OVERRIDE - { - return new instance_pinnacle(map); - } - - struct instance_pinnacle : public InstanceScript - { - instance_pinnacle(Map* map) : InstanceScript(map) {} - - uint64 uiSvalaSorrowgrave; - uint64 uiGortokPalehoof; - uint64 uiSkadiTheRuthless; - uint64 uiKingYmiron; - - uint64 uiSkadiTheRuthlessDoor; - uint64 uiKingYmironDoor; - uint64 uiGortokPalehoofSphere; - - uint64 uiFrenziedWorgen; - uint64 uiRavenousFurbolg; - uint64 uiFerociousRhino; - uint64 uiMassiveJormungar; - uint64 uiPalehoofOrb; - - uint64 uiSvala; - uint64 uiSacrificedPlayer; - - uint32 m_auiEncounter[MAX_ENCOUNTER]; - - std::string str_data; - - void Initialize() OVERRIDE - { - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - m_auiEncounter[i] = NOT_STARTED; - - uiSvalaSorrowgrave = 0; - uiGortokPalehoof = 0; - uiSkadiTheRuthless = 0; - uiKingYmiron = 0; - - uiSkadiTheRuthlessDoor = 0; - uiKingYmironDoor = 0; - uiGortokPalehoofSphere = 0; - - uiFrenziedWorgen = 0; - uiRavenousFurbolg = 0; - uiFerociousRhino = 0; - uiMassiveJormungar = 0; - uiPalehoofOrb = 0; - - uiSvala = 0; - uiSacrificedPlayer = 0; - } - - bool IsEncounterInProgress() const OVERRIDE - { - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) - return true; - - return false; - } - - void OnCreatureCreate(Creature* creature) OVERRIDE - { - switch (creature->GetEntry()) - { - case BOSS_SVALA_SORROWGRAVE: uiSvalaSorrowgrave = creature->GetGUID(); break; - case BOSS_GORTOK_PALEHOOF: uiGortokPalehoof = creature->GetGUID(); break; - case BOSS_SKADI_RUTHLESS: uiSkadiTheRuthless = creature->GetGUID(); break; - case BOSS_KING_YMIRON: uiKingYmiron = creature->GetGUID(); break; - case NPC_FRENZIED_WORGEN: uiFrenziedWorgen = creature->GetGUID(); break; - case NPC_RAVENOUS_FURBOLG: uiRavenousFurbolg = creature->GetGUID(); break; - case NPC_MASSIVE_JORMUNGAR: uiMassiveJormungar = creature->GetGUID(); break; - case NPC_FEROCIOUS_RHINO: uiFerociousRhino = creature->GetGUID(); break; - case NPC_SVALA: uiSvala = creature->GetGUID(); break; - case NPC_PALEHOOF_ORB: uiPalehoofOrb = creature->GetGUID(); break; - } - } - - void OnGameObjectCreate(GameObject* go) OVERRIDE - { - switch (go->GetEntry()) - { - case ENTRY_SKADI_THE_RUTHLESS_DOOR: - uiSkadiTheRuthlessDoor = go->GetGUID(); - if (m_auiEncounter[2] == DONE) HandleGameObject(0, true, go); - break; - case ENTRY_KING_YMIRON_DOOR: - uiKingYmironDoor = go->GetGUID(); - if (m_auiEncounter[3] == DONE) HandleGameObject(0, true, go); - break; - case ENTRY_GORK_PALEHOOF_SPHERE: - uiGortokPalehoofSphere = go->GetGUID(); - if (m_auiEncounter[1] == DONE) - { - HandleGameObject(0, true, go); - go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); - } - break; - } - } - - void SetData(uint32 type, uint32 data) OVERRIDE - { - switch (type) - { - case DATA_SVALA_SORROWGRAVE_EVENT: - m_auiEncounter[0] = data; - break; - case DATA_GORTOK_PALEHOOF_EVENT: - m_auiEncounter[1] = data; - break; - case DATA_SKADI_THE_RUTHLESS_EVENT: - if (data == DONE) - HandleGameObject(uiSkadiTheRuthlessDoor, true); - m_auiEncounter[2] = data; - break; - case DATA_KING_YMIRON_EVENT: - if (data == DONE) - HandleGameObject(uiKingYmironDoor, true); - m_auiEncounter[3] = data; - break; - } - - if (data == DONE) - SaveToDB(); - } - - void SetData64(uint32 type, uint64 data) OVERRIDE - { - switch (type) - { - case DATA_SACRIFICED_PLAYER: - uiSacrificedPlayer = data; - break; - } - } - - uint32 GetData(uint32 type) const OVERRIDE - { - switch (type) - { - case DATA_SVALA_SORROWGRAVE_EVENT: return m_auiEncounter[0]; - case DATA_GORTOK_PALEHOOF_EVENT: return m_auiEncounter[1]; - case DATA_SKADI_THE_RUTHLESS_EVENT: return m_auiEncounter[2]; - case DATA_KING_YMIRON_EVENT: return m_auiEncounter[3]; - } - return 0; - } - - uint64 GetData64(uint32 identifier) const OVERRIDE - { - switch (identifier) - { - case DATA_SVALA_SORROWGRAVE: return uiSvalaSorrowgrave; - case DATA_GORTOK_PALEHOOF: return uiGortokPalehoof; - case DATA_SKADI_THE_RUTHLESS: return uiSkadiTheRuthless; - case DATA_KING_YMIRON: return uiKingYmiron; - case DATA_NPC_FRENZIED_WORGEN: return uiFrenziedWorgen; - case DATA_NPC_RAVENOUS_FURBOLG: return uiRavenousFurbolg; - case DATA_NPC_MASSIVE_JORMUNGAR: return uiMassiveJormungar; - case DATA_NPC_FEROCIOUS_RHINO: return uiFerociousRhino; - case DATA_NPC_ORB: return uiPalehoofOrb; - case DATA_SVALA: return uiSvala; - case DATA_GORTOK_PALEHOOF_SPHERE: return uiGortokPalehoofSphere; - case DATA_SACRIFICED_PLAYER: return uiSacrificedPlayer; - } - - return 0; - } - - std::string GetSaveData() OVERRIDE - { - OUT_SAVE_INST_DATA; - - std::ostringstream saveStream; - saveStream << "U P " << m_auiEncounter[0] << ' ' << m_auiEncounter[1] << ' ' - << m_auiEncounter[2] << ' ' << m_auiEncounter[3]; - - str_data = saveStream.str(); - - OUT_SAVE_INST_DATA_COMPLETE; - return str_data; - } - - void Load(const char* in) OVERRIDE - { - if (!in) - { - OUT_LOAD_INST_DATA_FAIL; - return; - } - - OUT_LOAD_INST_DATA(in); - - char dataHead1, dataHead2; - uint16 data0, data1, data2, data3; - - std::istringstream loadStream(in); - loadStream >> dataHead1 >> dataHead2 >> data0 >> data1 >> data2 >> data3; - - if (dataHead1 == 'U' && dataHead2 == 'P') - { - m_auiEncounter[0] = data0; - m_auiEncounter[1] = data1; - m_auiEncounter[2] = data2; - m_auiEncounter[3] = data3; - - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) - m_auiEncounter[i] = NOT_STARTED; - - } else OUT_LOAD_INST_DATA_FAIL; - - OUT_LOAD_INST_DATA_COMPLETE; - } - }; -}; - -void AddSC_instance_utgarde_pinnacle() -{ - new instance_utgarde_pinnacle(); -} diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/instance_utgarde_pinnacle.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/instance_utgarde_pinnacle.cpp new file mode 100644 index 00000000000..0277c21cb83 --- /dev/null +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/instance_utgarde_pinnacle.cpp @@ -0,0 +1,267 @@ +/* + * Copyright (C) 2008-2013 TrinityCore + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#include "ScriptMgr.h" +#include "InstanceScript.h" +#include "utgarde_pinnacle.h" + +#define MAX_ENCOUNTER 4 + +/* Utgarde Pinnacle encounters: +0 - Svala Sorrowgrave +1 - Gortok Palehoof +2 - Skadi the Ruthless +3 - King Ymiron +*/ + +enum GameObjects +{ + ENTRY_SKADI_THE_RUTHLESS_DOOR = 192173, + ENTRY_KING_YMIRON_DOOR = 192174, + ENTRY_GORK_PALEHOOF_SPHERE = 188593 +}; + +class instance_utgarde_pinnacle : public InstanceMapScript +{ +public: + instance_utgarde_pinnacle() : InstanceMapScript("instance_utgarde_pinnacle", 575) { } + + InstanceScript* GetInstanceScript(InstanceMap* map) const OVERRIDE + { + return new instance_pinnacle(map); + } + + struct instance_pinnacle : public InstanceScript + { + instance_pinnacle(Map* map) : InstanceScript(map) {} + + uint64 uiSvalaSorrowgrave; + uint64 uiGortokPalehoof; + uint64 uiSkadiTheRuthless; + uint64 uiKingYmiron; + + uint64 uiSkadiTheRuthlessDoor; + uint64 uiKingYmironDoor; + uint64 uiGortokPalehoofSphere; + + uint64 uiFrenziedWorgen; + uint64 uiRavenousFurbolg; + uint64 uiFerociousRhino; + uint64 uiMassiveJormungar; + uint64 uiPalehoofOrb; + + uint64 uiSvala; + uint64 uiSacrificedPlayer; + + uint32 m_auiEncounter[MAX_ENCOUNTER]; + + std::string str_data; + + void Initialize() OVERRIDE + { + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + m_auiEncounter[i] = NOT_STARTED; + + uiSvalaSorrowgrave = 0; + uiGortokPalehoof = 0; + uiSkadiTheRuthless = 0; + uiKingYmiron = 0; + + uiSkadiTheRuthlessDoor = 0; + uiKingYmironDoor = 0; + uiGortokPalehoofSphere = 0; + + uiFrenziedWorgen = 0; + uiRavenousFurbolg = 0; + uiFerociousRhino = 0; + uiMassiveJormungar = 0; + uiPalehoofOrb = 0; + + uiSvala = 0; + uiSacrificedPlayer = 0; + } + + bool IsEncounterInProgress() const OVERRIDE + { + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + if (m_auiEncounter[i] == IN_PROGRESS) + return true; + + return false; + } + + void OnCreatureCreate(Creature* creature) OVERRIDE + { + switch (creature->GetEntry()) + { + case BOSS_SVALA_SORROWGRAVE: uiSvalaSorrowgrave = creature->GetGUID(); break; + case BOSS_GORTOK_PALEHOOF: uiGortokPalehoof = creature->GetGUID(); break; + case BOSS_SKADI_RUTHLESS: uiSkadiTheRuthless = creature->GetGUID(); break; + case BOSS_KING_YMIRON: uiKingYmiron = creature->GetGUID(); break; + case NPC_FRENZIED_WORGEN: uiFrenziedWorgen = creature->GetGUID(); break; + case NPC_RAVENOUS_FURBOLG: uiRavenousFurbolg = creature->GetGUID(); break; + case NPC_MASSIVE_JORMUNGAR: uiMassiveJormungar = creature->GetGUID(); break; + case NPC_FEROCIOUS_RHINO: uiFerociousRhino = creature->GetGUID(); break; + case NPC_SVALA: uiSvala = creature->GetGUID(); break; + case NPC_PALEHOOF_ORB: uiPalehoofOrb = creature->GetGUID(); break; + } + } + + void OnGameObjectCreate(GameObject* go) OVERRIDE + { + switch (go->GetEntry()) + { + case ENTRY_SKADI_THE_RUTHLESS_DOOR: + uiSkadiTheRuthlessDoor = go->GetGUID(); + if (m_auiEncounter[2] == DONE) HandleGameObject(0, true, go); + break; + case ENTRY_KING_YMIRON_DOOR: + uiKingYmironDoor = go->GetGUID(); + if (m_auiEncounter[3] == DONE) HandleGameObject(0, true, go); + break; + case ENTRY_GORK_PALEHOOF_SPHERE: + uiGortokPalehoofSphere = go->GetGUID(); + if (m_auiEncounter[1] == DONE) + { + HandleGameObject(0, true, go); + go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); + } + break; + } + } + + void SetData(uint32 type, uint32 data) OVERRIDE + { + switch (type) + { + case DATA_SVALA_SORROWGRAVE_EVENT: + m_auiEncounter[0] = data; + break; + case DATA_GORTOK_PALEHOOF_EVENT: + m_auiEncounter[1] = data; + break; + case DATA_SKADI_THE_RUTHLESS_EVENT: + if (data == DONE) + HandleGameObject(uiSkadiTheRuthlessDoor, true); + m_auiEncounter[2] = data; + break; + case DATA_KING_YMIRON_EVENT: + if (data == DONE) + HandleGameObject(uiKingYmironDoor, true); + m_auiEncounter[3] = data; + break; + } + + if (data == DONE) + SaveToDB(); + } + + void SetData64(uint32 type, uint64 data) OVERRIDE + { + switch (type) + { + case DATA_SACRIFICED_PLAYER: + uiSacrificedPlayer = data; + break; + } + } + + uint32 GetData(uint32 type) const OVERRIDE + { + switch (type) + { + case DATA_SVALA_SORROWGRAVE_EVENT: return m_auiEncounter[0]; + case DATA_GORTOK_PALEHOOF_EVENT: return m_auiEncounter[1]; + case DATA_SKADI_THE_RUTHLESS_EVENT: return m_auiEncounter[2]; + case DATA_KING_YMIRON_EVENT: return m_auiEncounter[3]; + } + return 0; + } + + uint64 GetData64(uint32 identifier) const OVERRIDE + { + switch (identifier) + { + case DATA_SVALA_SORROWGRAVE: return uiSvalaSorrowgrave; + case DATA_GORTOK_PALEHOOF: return uiGortokPalehoof; + case DATA_SKADI_THE_RUTHLESS: return uiSkadiTheRuthless; + case DATA_KING_YMIRON: return uiKingYmiron; + case DATA_NPC_FRENZIED_WORGEN: return uiFrenziedWorgen; + case DATA_NPC_RAVENOUS_FURBOLG: return uiRavenousFurbolg; + case DATA_NPC_MASSIVE_JORMUNGAR: return uiMassiveJormungar; + case DATA_NPC_FEROCIOUS_RHINO: return uiFerociousRhino; + case DATA_NPC_ORB: return uiPalehoofOrb; + case DATA_SVALA: return uiSvala; + case DATA_GORTOK_PALEHOOF_SPHERE: return uiGortokPalehoofSphere; + case DATA_SACRIFICED_PLAYER: return uiSacrificedPlayer; + } + + return 0; + } + + std::string GetSaveData() OVERRIDE + { + OUT_SAVE_INST_DATA; + + std::ostringstream saveStream; + saveStream << "U P " << m_auiEncounter[0] << ' ' << m_auiEncounter[1] << ' ' + << m_auiEncounter[2] << ' ' << m_auiEncounter[3]; + + str_data = saveStream.str(); + + OUT_SAVE_INST_DATA_COMPLETE; + return str_data; + } + + void Load(const char* in) OVERRIDE + { + if (!in) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } + + OUT_LOAD_INST_DATA(in); + + char dataHead1, dataHead2; + uint16 data0, data1, data2, data3; + + std::istringstream loadStream(in); + loadStream >> dataHead1 >> dataHead2 >> data0 >> data1 >> data2 >> data3; + + if (dataHead1 == 'U' && dataHead2 == 'P') + { + m_auiEncounter[0] = data0; + m_auiEncounter[1] = data1; + m_auiEncounter[2] = data2; + m_auiEncounter[3] = data3; + + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + if (m_auiEncounter[i] == IN_PROGRESS) + m_auiEncounter[i] = NOT_STARTED; + + } else OUT_LOAD_INST_DATA_FAIL; + + OUT_LOAD_INST_DATA_COMPLETE; + } + }; +}; + +void AddSC_instance_utgarde_pinnacle() +{ + new instance_utgarde_pinnacle(); +} diff --git a/src/server/scripts/Northrend/VaultOfArchavon/instance_vault_of_archavon.cpp b/src/server/scripts/Northrend/VaultOfArchavon/instance_vault_of_archavon.cpp index 77fc0877056..c6e3894a722 100644 --- a/src/server/scripts/Northrend/VaultOfArchavon/instance_vault_of_archavon.cpp +++ b/src/server/scripts/Northrend/VaultOfArchavon/instance_vault_of_archavon.cpp @@ -26,14 +26,14 @@ 4 - Toravon the Ice Watcher event */ -class instance_archavon : public InstanceMapScript +class instance_vault_of_archavon : public InstanceMapScript { public: - instance_archavon() : InstanceMapScript("instance_archavon", 624) { } + instance_vault_of_archavon() : InstanceMapScript("instance_vault_of_archavon", 624) { } - struct instance_archavon_InstanceMapScript : public InstanceScript + struct instance_vault_of_archavon_InstanceMapScript : public InstanceScript { - instance_archavon_InstanceMapScript(Map* map) : InstanceScript(map) + instance_vault_of_archavon_InstanceMapScript(Map* map) : InstanceScript(map) { SetBossNumber(EncounterCount); @@ -135,11 +135,11 @@ class instance_archavon : public InstanceMapScript InstanceScript* GetInstanceScript(InstanceMap* map) const OVERRIDE { - return new instance_archavon_InstanceMapScript(map); + return new instance_vault_of_archavon_InstanceMapScript(map); } }; -void AddSC_instance_archavon() +void AddSC_instance_vault_of_archavon() { - new instance_archavon(); + new instance_vault_of_archavon(); } -- cgit v1.2.3 From 78786c7b541a13fc73dfbaefc06b9d5bc05c7450 Mon Sep 17 00:00:00 2001 From: Nay Date: Tue, 27 Aug 2013 21:30:33 +0100 Subject: Core&Scripts: Fix clang compiler warnings --- src/server/game/Entities/Player/Player.cpp | 12 ++++++------ src/server/game/Entities/Unit/Unit.cpp | 4 +--- src/server/game/Entities/Unit/Unit.h | 13 ++++--------- src/server/game/Grids/Notifiers/GridNotifiers.h | 6 ++---- src/server/game/Grids/ObjectGridLoader.cpp | 3 +-- src/server/game/Guilds/Guild.cpp | 4 ++-- src/server/game/Guilds/Guild.h | 3 +-- src/server/game/Spells/Auras/SpellAuraEffects.cpp | 1 - src/server/game/Spells/Spell.cpp | 4 ++++ src/server/scripts/Kalimdor/zone_winterspring.cpp | 4 +--- .../Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp | 2 -- .../TrialOfTheCrusader/boss_anubarak_trial.cpp | 3 --- .../TrialOfTheCrusader/boss_northrend_beasts.cpp | 1 - .../scripts/Outland/BlackTemple/boss_shade_of_akama.cpp | 1 - .../HellfireRamparts/boss_vazruden_the_herald.cpp | 1 - 15 files changed, 22 insertions(+), 40 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index d570ecb1117..405080beefa 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -972,7 +972,7 @@ bool Player::Create(uint32 guidlow, CharacterCreateInfo* createInfo) if (!IsValidGender(createInfo->Gender)) { - TC_LOG_ERROR(LOG_FILTER_PLAYER, "Player::Create: Possible hacking-attempt: Account %u tried creating a character named '%s' with an invalid gender (%hu) - refusing to do so", + TC_LOG_ERROR(LOG_FILTER_PLAYER, "Player::Create: Possible hacking-attempt: Account %u tried creating a character named '%s' with an invalid gender (%u) - refusing to do so", GetSession()->GetAccountId(), m_name.c_str(), createInfo->Gender); return false; } @@ -1918,7 +1918,7 @@ bool Player::BuildEnumData(PreparedQueryResult result, WorldPacket* data) } else if (!IsValidGender(gender)) { - TC_LOG_ERROR(LOG_FILTER_PLAYER_LOADING, "Player (%u) has incorrect gender (%hu), don't build enum.", guid, gender); + TC_LOG_ERROR(LOG_FILTER_PLAYER_LOADING, "Player (%u) has incorrect gender (%u), don't build enum.", guid, gender); return false; } @@ -17018,10 +17018,10 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) // overwrite possible wrong/corrupted guid SetUInt64Value(OBJECT_FIELD_GUID, MAKE_NEW_GUID(guid, 0, HIGHGUID_PLAYER)); - uint8 Gender = fields[5].GetUInt8(); - if (!IsValidGender(Gender)) + uint8 gender = fields[5].GetUInt8(); + if (!IsValidGender(gender)) { - TC_LOG_ERROR(LOG_FILTER_PLAYER, "Player (GUID: %u) has wrong gender (%hu), can't be loaded.", guid, Gender); + TC_LOG_ERROR(LOG_FILTER_PLAYER, "Player (GUID: %u) has wrong gender (%u), can't be loaded.", guid, gender); return false; } @@ -17029,7 +17029,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) uint32 bytes0 = 0; bytes0 |= fields[3].GetUInt8(); // race bytes0 |= fields[4].GetUInt8() << 8; // class - bytes0 |= Gender << 16; // gender + bytes0 |= gender << 16; // gender SetUInt32Value(UNIT_FIELD_BYTES_0, bytes0); SetUInt32Value(UNIT_FIELD_LEVEL, fields[6].GetUInt8()); diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 39d9d4991fc..ef684fc2526 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -3045,8 +3045,6 @@ void Unit::SetCurrentCastedSpell(Spell* pSpell) void Unit::InterruptSpell(CurrentSpellTypes spellType, bool withDelayed, bool withInstant) { - ASSERT(spellType < CURRENT_MAX_SPELL); - //TC_LOG_DEBUG(LOG_FILTER_UNITS, "Interrupt spell for unit %u.", GetEntry()); Spell* spell = m_currentSpells[spellType]; if (spell @@ -13991,7 +13989,7 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* target, uint32 procFlag, u Unit* actionTarget = !isVictim ? target : this; DamageInfo damageInfo = DamageInfo(actor, actionTarget, damage, procSpell, procSpell ? SpellSchoolMask(procSpell->SchoolMask) : SPELL_SCHOOL_MASK_NORMAL, SPELL_DIRECT_DAMAGE); - HealInfo healInfo = HealInfo(actor, actionTarget, damage, procSpell, procSpell ? SpellSchoolMask(procSpell->SchoolMask) : SPELL_SCHOOL_MASK_NORMAL); + HealInfo healInfo = HealInfo(damage); ProcEventInfo eventInfo = ProcEventInfo(actor, actionTarget, target, procFlag, 0, 0, procExtra, NULL, &damageInfo, &healInfo); ProcTriggeredList procTriggered; diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index c90357a9eb8..119a1dd1966 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -470,11 +470,10 @@ enum BaseModGroup enum BaseModType { FLAT_MOD, - PCT_MOD + PCT_MOD, + MOD_END }; -#define MOD_END (PCT_MOD+1) - enum DeathState { ALIVE = 0, @@ -871,15 +870,11 @@ public: class HealInfo { private: - Unit* const m_healer; - Unit* const m_target; uint32 m_heal; uint32 m_absorb; - SpellInfo const* const m_spellInfo; - SpellSchoolMask const m_schoolMask; public: - explicit HealInfo(Unit* _healer, Unit* _target, uint32 _heal, SpellInfo const* _spellInfo, SpellSchoolMask _schoolMask) - : m_healer(_healer), m_target(_target), m_heal(_heal), m_spellInfo(_spellInfo), m_schoolMask(_schoolMask) + explicit HealInfo(uint32 heal) + : m_heal(heal) { m_absorb = 0; } diff --git a/src/server/game/Grids/Notifiers/GridNotifiers.h b/src/server/game/Grids/Notifiers/GridNotifiers.h index c2492f160c0..637e0792a74 100644 --- a/src/server/game/Grids/Notifiers/GridNotifiers.h +++ b/src/server/game/Grids/Notifiers/GridNotifiers.h @@ -726,13 +726,12 @@ namespace Trinity class GameObjectWithDbGUIDCheck { public: - GameObjectWithDbGUIDCheck(WorldObject const& obj, uint32 db_guid) : i_obj(obj), i_db_guid(db_guid) {} + GameObjectWithDbGUIDCheck(WorldObject const& /*obj*/, uint32 db_guid) : i_db_guid(db_guid) {} bool operator()(GameObject const* go) const { return go->GetDBTableGUIDLow() == i_db_guid; } private: - WorldObject const& i_obj; uint32 i_db_guid; }; @@ -860,13 +859,12 @@ namespace Trinity class CreatureWithDbGUIDCheck { public: - CreatureWithDbGUIDCheck(WorldObject const* obj, uint32 lowguid) : i_obj(obj), i_lowguid(lowguid) {} + CreatureWithDbGUIDCheck(WorldObject const* /*obj*/, uint32 lowguid) : i_lowguid(lowguid) {} bool operator()(Creature* u) { return u->GetDBTableGUIDLow() == i_lowguid; } private: - WorldObject const* i_obj; uint32 i_lowguid; }; diff --git a/src/server/game/Grids/ObjectGridLoader.cpp b/src/server/game/Grids/ObjectGridLoader.cpp index 879dd48c759..58a5bbbff06 100644 --- a/src/server/game/Grids/ObjectGridLoader.cpp +++ b/src/server/game/Grids/ObjectGridLoader.cpp @@ -49,7 +49,7 @@ class ObjectWorldLoader { public: explicit ObjectWorldLoader(ObjectGridLoader& gloader) - : i_cell(gloader.i_cell), i_grid(gloader.i_grid), i_map(gloader.i_map), i_corpses (0) + : i_cell(gloader.i_cell), i_map(gloader.i_map), i_corpses (0) {} void Visit(CorpseMapType &m); @@ -58,7 +58,6 @@ class ObjectWorldLoader private: Cell i_cell; - NGridType &i_grid; Map* i_map; public: uint32 i_corpses; diff --git a/src/server/game/Guilds/Guild.cpp b/src/server/game/Guilds/Guild.cpp index d31b4b74b2e..3c6f002a7fc 100644 --- a/src/server/game/Guilds/Guild.cpp +++ b/src/server/game/Guilds/Guild.cpp @@ -2381,9 +2381,9 @@ void Guild::SetBankTabText(uint8 tabId, std::string const& text) // Private methods void Guild::_CreateLogHolders() { - m_eventLog = new LogHolder(m_id, sWorld->getIntConfig(CONFIG_GUILD_EVENT_LOG_COUNT)); + m_eventLog = new LogHolder(sWorld->getIntConfig(CONFIG_GUILD_EVENT_LOG_COUNT)); for (uint8 tabId = 0; tabId <= GUILD_BANK_MAX_TABS; ++tabId) - m_bankEventLog[tabId] = new LogHolder(m_id, sWorld->getIntConfig(CONFIG_GUILD_BANK_EVENT_LOG_COUNT)); + m_bankEventLog[tabId] = new LogHolder(sWorld->getIntConfig(CONFIG_GUILD_BANK_EVENT_LOG_COUNT)); } void Guild::_CreateNewBankTab() diff --git a/src/server/game/Guilds/Guild.h b/src/server/game/Guilds/Guild.h index ac2ae2c967b..017221b13bd 100644 --- a/src/server/game/Guilds/Guild.h +++ b/src/server/game/Guilds/Guild.h @@ -444,7 +444,7 @@ private: class LogHolder { public: - LogHolder(uint32 guildId, uint32 maxRecords) : m_guildId(guildId), m_maxRecords(maxRecords), m_nextGUID(uint32(GUILD_EVENT_LOG_GUID_UNDEFINED)) { } + LogHolder(uint32 maxRecords) : m_maxRecords(maxRecords), m_nextGUID(uint32(GUILD_EVENT_LOG_GUID_UNDEFINED)) { } ~LogHolder(); uint8 GetSize() const { return uint8(m_log.size()); } @@ -460,7 +460,6 @@ private: private: GuildLog m_log; - uint32 m_guildId; uint32 m_maxRecords; uint32 m_nextGUID; }; diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index 01de61f2b0f..cd227c7d8b7 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -586,7 +586,6 @@ void AuraEffect::CalculateSpellMod() { m_spellmod = new SpellModifier(GetBase()); m_spellmod->op = SpellModOp(GetMiscValue()); - ASSERT(m_spellmod->op < MAX_SPELLMOD); m_spellmod->type = SpellModType(uint32(GetAuraType())); // SpellModType value == spell aura types m_spellmod->spellId = GetId(); diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index b502717178e..f1c60cb4e90 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -2849,11 +2849,15 @@ void Spell::DoTriggersOnSpellHit(Unit* unit, uint8 effMask) // trigger linked auras remove/apply /// @todo remove/cleanup this, as this table is not documented and people are doing stupid things with it if (std::vector const* spellTriggered = sSpellMgr->GetSpellLinked(m_spellInfo->Id + SPELL_LINK_HIT)) + { for (std::vector::const_iterator i = spellTriggered->begin(); i != spellTriggered->end(); ++i) + { if (*i < 0) unit->RemoveAurasDueToSpell(-(*i)); else unit->CastSpell(unit, *i, true, 0, 0, m_caster->GetGUID()); + } + } } void Spell::DoAllEffectOnTarget(GOTargetInfo* target) diff --git a/src/server/scripts/Kalimdor/zone_winterspring.cpp b/src/server/scripts/Kalimdor/zone_winterspring.cpp index e517afe6b46..92d15322f4c 100644 --- a/src/server/scripts/Kalimdor/zone_winterspring.cpp +++ b/src/server/scripts/Kalimdor/zone_winterspring.cpp @@ -158,8 +158,7 @@ public: DialogueHelper(DialogueEntry const* dialogueArray) : _dialogueArray(dialogueArray), _currentEntry(NULL), - _actionTimer(0), - _isFirstSide(true) + _actionTimer(0) {} // The array MUST be terminated by {0, 0, 0, 0, 0} @@ -237,7 +236,6 @@ private: DialogueEntry const* _currentEntry; uint32 _actionTimer; - bool _isFirstSide; }; const DialogueEntry introDialogue[] = diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp index 0d2a424b4c7..11ee7b0e409 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp @@ -882,8 +882,6 @@ class npc_halion_controller : public CreatureScript InstanceScript* _instance; SummonList _summons; - bool _corporealityCheck; - uint32 _twilightDamageTaken; uint32 _materialDamageTaken; uint8 _materialCorporealityValue; diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp index f346c796976..53b11de921a 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp @@ -419,8 +419,6 @@ class boss_anubarak_trial : public CreatureScript uint64 _sphereGUID[6]; bool _intro; bool _reachedPhase3; - uint32 _frostSphereTimer; - uint32 _berserkTimer; }; CreatureAI* GetAI(Creature* creature) const OVERRIDE @@ -579,7 +577,6 @@ class npc_nerubian_burrower : public CreatureScript private: uint32 _submergeTimer; - Phases _phase; EventMap _events; InstanceScript* _instance; }; 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 d90ed543376..18cc45657f0 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp @@ -1135,7 +1135,6 @@ class boss_icehowl : public CreatureScript bool _movementFinish; bool _trampleCasted; uint8 _stage; - Unit* _target; }; CreatureAI* GetAI(Creature* creature) const OVERRIDE diff --git a/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp b/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp index a1a965ed015..92647cfb69f 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp @@ -845,7 +845,6 @@ public: InstanceScript* instance; EventMap events; uint64 summonerGuid; - float distanceToShade; bool startedBanishing; bool switchToCombat; }; diff --git a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp index 0f5cea6c4c6..a4007a5a7b1 100644 --- a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp @@ -186,7 +186,6 @@ class boss_nazan : public CreatureScript uint32 Turn_Timer; bool flight; uint64 VazrudenGUID; - SpellInfo* liquid_fire; }; CreatureAI* GetAI(Creature* creature) const OVERRIDE -- cgit v1.2.3 From 2bd4a479a67bd5cbc99a5a1411293b258743c19f Mon Sep 17 00:00:00 2001 From: Aokromes Date: Wed, 28 Aug 2013 14:51:31 +0100 Subject: Core/Quests: Add repeatable quest rate to world.reputation_reward_rate --- .../world/2013_08_27_02_world_reputation_reward_rate.sql | 1 + src/server/game/Entities/Player/Player.cpp | 6 ++++++ src/server/game/Entities/Player/Player.h | 1 + src/server/game/Globals/ObjectMgr.cpp | 15 +++++++++++---- src/server/game/Globals/ObjectMgr.h | 1 + 5 files changed, 20 insertions(+), 4 deletions(-) create mode 100644 sql/updates/world/2013_08_27_02_world_reputation_reward_rate.sql (limited to 'src') diff --git a/sql/updates/world/2013_08_27_02_world_reputation_reward_rate.sql b/sql/updates/world/2013_08_27_02_world_reputation_reward_rate.sql new file mode 100644 index 00000000000..57776c61e82 --- /dev/null +++ b/sql/updates/world/2013_08_27_02_world_reputation_reward_rate.sql @@ -0,0 +1 @@ +ALTER TABLE `reputation_reward_rate` ADD `quest_repeteable_rate` FLOAT NOT NULL DEFAULT '1' AFTER `quest_weekly_rate`; diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 405080beefa..10dfe946a86 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -6953,6 +6953,7 @@ int32 Player::CalculateReputationGain(ReputationSource source, uint32 creatureOr case REPUTATION_SOURCE_DAILY_QUEST: case REPUTATION_SOURCE_WEEKLY_QUEST: case REPUTATION_SOURCE_MONTHLY_QUEST: + case REPUTATION_SOURCE_REPEATABLE_QUEST: rate = sWorld->getRate(RATE_REPUTATION_LOWLEVEL_QUEST); break; case REPUTATION_SOURCE_SPELL: @@ -6988,6 +6989,9 @@ int32 Player::CalculateReputationGain(ReputationSource source, uint32 creatureOr case REPUTATION_SOURCE_MONTHLY_QUEST: repRate = repData->questMonthlyRate; break; + case REPUTATION_SOURCE_REPEATABLE_QUEST: + repRate = repData->questRepeatableRate; + break; case REPUTATION_SOURCE_SPELL: repRate = repData->spellRate; break; @@ -7091,6 +7095,8 @@ void Player::RewardReputation(Quest const* quest) rep = CalculateReputationGain(REPUTATION_SOURCE_WEEKLY_QUEST, GetQuestLevel(quest), rep, quest->RewardFactionId[i], noQuestBonus); else if (quest->IsMonthly()) rep = CalculateReputationGain(REPUTATION_SOURCE_MONTHLY_QUEST, GetQuestLevel(quest), rep, quest->RewardFactionId[i], noQuestBonus); + else if (quest->IsRepeatable()) + rep = CalculateReputationGain(REPUTATION_SOURCE_REPEATABLE_QUEST, GetQuestLevel(quest), rep, quest->RewardFactionId[i], noQuestBonus); else rep = CalculateReputationGain(REPUTATION_SOURCE_QUEST, GetQuestLevel(quest), rep, quest->RewardFactionId[i], noQuestBonus); diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index 6cc8c0c3929..9a17033de67 100644 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -169,6 +169,7 @@ enum ReputationSource REPUTATION_SOURCE_DAILY_QUEST, REPUTATION_SOURCE_WEEKLY_QUEST, REPUTATION_SOURCE_MONTHLY_QUEST, + REPUTATION_SOURCE_REPEATABLE_QUEST, REPUTATION_SOURCE_SPELL }; diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 4d6eab411d4..b902872ed4e 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -6699,8 +6699,8 @@ void ObjectMgr::LoadReputationRewardRate() _repRewardRateStore.clear(); // for reload case - uint32 count = 0; // 0 1 2 3 4 5 6 - QueryResult result = WorldDatabase.Query("SELECT faction, quest_rate, quest_daily_rate, quest_weekly_rate, quest_monthly_rate, creature_rate, spell_rate FROM reputation_reward_rate"); + uint32 count = 0; // 0 1 2 3 4 5 6 7 + QueryResult result = WorldDatabase.Query("SELECT faction, quest_rate, quest_daily_rate, quest_weekly_rate, quest_monthly_rate, quest_repeatable_rate, creature_rate, spell_rate FROM reputation_reward_rate"); if (!result) { TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, ">> Loaded `reputation_reward_rate`, table is empty!"); @@ -6719,8 +6719,9 @@ void ObjectMgr::LoadReputationRewardRate() repRate.questDailyRate = fields[2].GetFloat(); repRate.questWeeklyRate = fields[3].GetFloat(); repRate.questMonthlyRate = fields[4].GetFloat(); - repRate.creatureRate = fields[5].GetFloat(); - repRate.spellRate = fields[6].GetFloat(); + repRate.questRepeatableRate = fields[5].GetFloat(); + repRate.creatureRate = fields[6].GetFloat(); + repRate.spellRate = fields[7].GetFloat(); FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionId); if (!factionEntry) @@ -6753,6 +6754,12 @@ void ObjectMgr::LoadReputationRewardRate() continue; } + if (repRate.questRepeatableRate < 0.0f) + { + TC_LOG_ERROR(LOG_FILTER_SQL, "Table reputation_reward_rate has quest_repeatable_rate with invalid rate %f, skipping data for faction %u", repRate.questRepeatableRate, factionId); + continue; + } + if (repRate.creatureRate < 0.0f) { TC_LOG_ERROR(LOG_FILTER_SQL, "Table reputation_reward_rate has creature_rate with invalid rate %f, skipping data for faction %u", repRate.creatureRate, factionId); diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h index aad699fe9c1..3fb9369b07d 100644 --- a/src/server/game/Globals/ObjectMgr.h +++ b/src/server/game/Globals/ObjectMgr.h @@ -485,6 +485,7 @@ struct RepRewardRate float questDailyRate; float questWeeklyRate; float questMonthlyRate; + float questRepeatableRate; float creatureRate; // no reputation are given at all for this faction/rate type. float spellRate; }; -- cgit v1.2.3 From f5f0e6439c20d9d4a6e49cf4e470e798c0933c5a Mon Sep 17 00:00:00 2001 From: joschiwald Date: Wed, 28 Aug 2013 17:11:14 +0200 Subject: Scripts/UtgardeKeep/Ingvar: remove hacks and fix warning --- sql/updates/world/2013_08_28_00_world_misc.sql | 17 +++ src/server/game/Spells/Auras/SpellAuraEffects.cpp | 35 +++--- .../UtgardeKeep/boss_ingvar_the_plunderer.cpp | 120 ++++++++++----------- .../UtgardeKeep/UtgardeKeep/utgarde_keep.h | 8 +- 4 files changed, 94 insertions(+), 86 deletions(-) create mode 100644 sql/updates/world/2013_08_28_00_world_misc.sql (limited to 'src') diff --git a/sql/updates/world/2013_08_28_00_world_misc.sql b/sql/updates/world/2013_08_28_00_world_misc.sql new file mode 100644 index 00000000000..bd414f4d623 --- /dev/null +++ b/sql/updates/world/2013_08_28_00_world_misc.sql @@ -0,0 +1,17 @@ +DELETE FROM `creature_text` WHERE `entry` IN (24068, 23954, 23980); +INSERT INTO `creature_text` (`entry`, `groupid`, `id`, `text`, `type`, `language`, `probability`, `emote`, `duration`, `sound`, `comment`) VALUES +(24068, 0, 0, 'Ingvar! Your pathetic failure will serve as a warning to all... you are damned! Arise and carry out the master''s will!', 14, 0, 100, 0, 0, 13754, 'Annhylde the Caller to Ingvar the Plunderer'), + +(23954, 0, 0, 'I''ll paint my face with your blood!', 14, 0, 100, 0, 0, 13207, 'Ingvar the Plunderer - SAY_AGGRO_1'), +(23954, 1, 0, 'Mjul orm agn gjor!', 14, 0, 100, 0, 0, 13212, 'Ingvar the Plunderer - SAY_SLAY_1'), +(23954, 2, 0, 'My life for the... death god!', 14, 0, 100, 0, 0, 13213, 'Ingvar the Plunderer - SAY_DEATH_1'), + +(23954, 3, 0, 'I return! A second chance to carve your skull!', 14, 0, 100, 0, 0, 13209, 'Ingvar the Plunderer - SAY_AGGRO_2'), +(23954, 4, 0, 'I am a warrior born!', 14, 0, 100, 0, 0, 13214, 'Ingvar the Plunderer - SAY_SLAY_2'), +(23954, 5, 0, 'No! I can do... better! I can...', 14, 0, 100, 0, 0, 13211, 'Ingvar the Plunderer - SAY_DEATH_2'); + +UPDATE `creature_template` SET `lootid`=`entry` WHERE entry IN (23954, 31673); +UPDATE `creature_template` SET `lootid`=0 WHERE entry IN (23980, 31674); + +UPDATE `creature_loot_template` SET `entry`=23954 WHERE `entry`=23980; +UPDATE `creature_loot_template` SET `entry`=31673 WHERE `entry`=31674; diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index cd227c7d8b7..08e66124e4a 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -2109,15 +2109,12 @@ void AuraEffect::HandleFeignDeath(AuraApplication const* aurApp, uint8 mode, boo Unit* target = aurApp->GetTarget(); - if (target->GetTypeId() != TYPEID_PLAYER) - return; - if (apply) { /* WorldPacket data(SMSG_FEIGN_DEATH_RESISTED, 9); - data<GetGUID(); - data<GetGUID(); + data << uint8(0); target->SendMessageToSet(&data, true); */ @@ -2151,31 +2148,31 @@ void AuraEffect::HandleFeignDeath(AuraApplication const* aurApp, uint8 mode, boo // stop handling the effect if it was removed by linked event if (aurApp->GetRemoveMode()) return; - // blizz like 2.0.x - target->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_29); - // blizz like 2.0.x - target->SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FEIGN_DEATH); - // blizz like 2.0.x - target->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); + target->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_29); // blizz like 2.0.x + target->SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FEIGN_DEATH); // blizz like 2.0.x + target->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); // blizz like 2.0.x target->AddUnitState(UNIT_STATE_DIED); + + if (Creature* creature = target->ToCreature()) + creature->SetReactState(REACT_PASSIVE); } else { /* WorldPacket data(SMSG_FEIGN_DEATH_RESISTED, 9); - data<GetGUID(); - data<GetGUID(); + data << uint8(1); target->SendMessageToSet(&data, true); */ - // blizz like 2.0.x - target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_29); - // blizz like 2.0.x - target->RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FEIGN_DEATH); - // blizz like 2.0.x - target->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); + target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_29); // blizz like 2.0.x + target->RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FEIGN_DEATH); // blizz like 2.0.x + target->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); // blizz like 2.0.x target->ClearUnitState(UNIT_STATE_DIED); + + if (Creature* creature = target->ToCreature()) + creature->InitializeReactState(); } } diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp index 1ec33fcb301..e6e9fffd5ac 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp @@ -28,21 +28,18 @@ EndScriptData */ enum Yells { - YELL_AGGRO_1 = 0, - YELL_KILL_1 = 1, - YELL_DEAD_1 = 2, - - YELL_AGGRO_2 = 0, - YELL_KILL_2 = 1, - YELL_DEAD_2 = 2 -}; - -enum Creatures -{ - NPC_INGVAR_HUMAN = 23954, - NPC_ANNHYLDE_THE_CALLER = 24068, - NPC_INGVAR_UNDEAD = 23980, - NPC_THROW_TARGET = 23996, + // Ingvar (Human) + SAY_AGGRO_1 = 0, + SAY_SLAY_1 = 1, + SAY_DEATH_1 = 2, + + // Ingvar (Undead) + SAY_AGGRO_2 = 3, + SAY_SLAY_2 = 4, + SAY_DEATH_2 = 5, + + // Annhylde The Caller + YELL_RESURRECT = 0 }; enum Events @@ -96,6 +93,11 @@ enum Spells SPELL_INGVAR_TRANSFORM = 42796 }; +enum Misc +{ + ACTION_START_PHASE_2 +}; + class boss_ingvar_the_plunderer : public CreatureScript { public: @@ -110,13 +112,9 @@ class boss_ingvar_the_plunderer : public CreatureScript void Reset() OVERRIDE { - if (_isUndead) - me->UpdateEntry(NPC_INGVAR_HUMAN); - _isUndead = false; me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); - me->SetStandState(UNIT_STAND_STATE_STAND); _Reset(); events.SetPhase(PHASE_HUMAN); @@ -129,36 +127,37 @@ class boss_ingvar_the_plunderer : public CreatureScript void DamageTaken(Unit* /*doneBy*/, uint32& damage) OVERRIDE { - if (damage >= me->GetHealth() && !_isUndead) + if (damage >= me->GetHealth() && events.IsInPhase(PHASE_HUMAN)) { - //DoCast(me, SPELL_INGVAR_FEIGN_DEATH, true); // Dont work ??? - // visuel hack - me->SetHealth(0); - me->InterruptNonMeleeSpells(true); me->RemoveAllAuras(); + DoCast(me, SPELL_INGVAR_FEIGN_DEATH, true); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->GetMotionMaster()->MovementExpired(false); - me->GetMotionMaster()->MoveIdle(); - me->SetStandState(UNIT_STAND_STATE_DEAD); - // visuel hack end events.SetPhase(PHASE_EVENT); events.ScheduleEvent(EVENT_SUMMON_BANSHEE, 3 * IN_MILLISECONDS, 0, PHASE_EVENT); - Talk(YELL_DEAD_1); + Talk(SAY_DEATH_1); } if (events.IsInPhase(PHASE_EVENT)) damage = 0; } + void DoAction(int32 actionId) + { + if (actionId == ACTION_START_PHASE_2) + StartZombiePhase(); + } + void StartZombiePhase() { _isUndead = true; - me->UpdateEntry(NPC_INGVAR_UNDEAD); + me->RemoveAura(SPELL_INGVAR_FEIGN_DEATH); + DoCast(me, SPELL_INGVAR_TRANSFORM, true); /// @todo: should be death persistent events.ScheduleEvent(EVENT_JUST_TRANSFORMED, 2 * IN_MILLISECONDS, 0, PHASE_EVENT); - Talk(YELL_AGGRO_2); + Talk(SAY_AGGRO_2); } void EnterCombat(Unit* /*who*/) OVERRIDE @@ -166,16 +165,13 @@ class boss_ingvar_the_plunderer : public CreatureScript _EnterCombat(); if (!_isUndead) - Talk(YELL_AGGRO_1); + Talk(SAY_AGGRO_1); } void JustDied(Unit* /*killer*/) OVERRIDE { _JustDied(); - Talk(YELL_DEAD_2); - - // Ingvar has NPC_INGVAR_UNDEAD id in this moment, so we have to update encounter state for his original id - instance->UpdateEncounterState(ENCOUNTER_CREDIT_KILL_CREATURE, NPC_INGVAR_HUMAN, me); + Talk(SAY_DEATH_2); } void ScheduleSecondPhase() @@ -189,7 +185,7 @@ class boss_ingvar_the_plunderer : public CreatureScript void KilledUnit(Unit* /*victim*/) OVERRIDE { - Talk(_isUndead ? YELL_KILL_1 : YELL_KILL_2); + Talk(_isUndead ? SAY_SLAY_1 : SAY_SLAY_2); } void UpdateAI(uint32 diff) OVERRIDE @@ -225,8 +221,7 @@ class boss_ingvar_the_plunderer : public CreatureScript break; case EVENT_JUST_TRANSFORMED: me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->SetInCombatWithZone(); - me->GetMotionMaster()->MoveChase(me->GetVictim()); + DoZoneInCombat(); ScheduleSecondPhase(); return; case EVENT_SUMMON_BANSHEE: @@ -254,7 +249,8 @@ class boss_ingvar_the_plunderer : public CreatureScript } } - DoMeleeAttackIfReady(); + if (!events.IsInPhase(PHASE_EVENT)) + DoMeleeAttackIfReady(); } private: @@ -288,13 +284,7 @@ class npc_annhylde_the_caller : public CreatureScript me->GetPosition(x, y, z); DoTeleportTo(x+1, y, z+30); - - if (Creature* ingvar = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_INGVAR))) - { - me->GetMotionMaster()->MovePoint(1, x, y, z+15); - - // Talk(YELL_RESSURECT); - } + me->GetMotionMaster()->MovePoint(1, x, y, z+15); } void MovementInform(uint32 type, uint32 id) OVERRIDE @@ -302,22 +292,23 @@ class npc_annhylde_the_caller : public CreatureScript if (type != POINT_MOTION_TYPE) return; - if (Creature* ingvar = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_INGVAR))) + switch (id) { - switch (id) - { - case 1: + case 1: + Talk(YELL_RESURRECT); + if (Creature* ingvar = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_INGVAR))) + { ingvar->RemoveAura(SPELL_SUMMON_BANSHEE); ingvar->CastSpell(ingvar, SPELL_SCOURG_RESURRECTION_DUMMY, true); DoCast(ingvar, SPELL_SCOURG_RESURRECTION_BEAM); - _events.ScheduleEvent(EVENT_RESURRECT_1, 8000); - break; - case 2: - me->DespawnOrUnsummon(); - break; - default: - break; - } + } + _events.ScheduleEvent(EVENT_RESURRECT_1, 8000); + break; + case 2: + me->DespawnOrUnsummon(); + break; + default: + break; } } @@ -336,7 +327,7 @@ class npc_annhylde_the_caller : public CreatureScript case EVENT_RESURRECT_1: if (Creature* ingvar = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_INGVAR))) { - ingvar->SetStandState(UNIT_STAND_STATE_STAND); + ingvar->RemoveAura(SPELL_INGVAR_FEIGN_DEATH); ingvar->CastSpell(ingvar, SPELL_SCOURG_RESURRECTION_HEAL, false); } _events.ScheduleEvent(EVENT_RESURRECT_2, 3000); @@ -345,13 +336,10 @@ class npc_annhylde_the_caller : public CreatureScript if (Creature* ingvar = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_INGVAR))) { ingvar->RemoveAurasDueToSpell(SPELL_SCOURG_RESURRECTION_DUMMY); - - if (ingvar->GetVictim()) - if (boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI* ai = CAST_AI(boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI, ingvar->AI())) - ai->StartZombiePhase(); - - me->GetMotionMaster()->MovePoint(2, x+1, y, z+30); + ingvar->AI()->DoAction(ACTION_START_PHASE_2); } + + me->GetMotionMaster()->MovePoint(2, x+1, y, z+30); break; default: break; diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.h b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.h index ee422400e72..873c5d634fa 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.h +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.h @@ -45,8 +45,14 @@ enum CreatureIds NPC_DALRONN = 24201, NPC_INGVAR = 23954, + // Skarvald - Dalronn NPC_DALRONN_GHOST = 27389, - NPC_SKARVALD_GHOST = 27390 + NPC_SKARVALD_GHOST = 27390, + + // Ingvar the Plunderer + NPC_INGVAR_UNDEAD = 23980, + NPC_THROW_TARGET = 23996, + NPC_ANNHYLDE_THE_CALLER = 24068 }; enum GameObjectIds -- cgit v1.2.3 From a9174617622a85599e8e2878f3036b35781192dd Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Wed, 28 Aug 2013 19:04:35 +0200 Subject: DB/Misc: Fix startup errors --- sql/updates/world/2013_08_28_05_world_misc.sql | 14 ++++++++++++++ src/server/game/Instances/InstanceSaveMgr.h | 8 ++++---- .../UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp | 2 +- .../UtgardeKeep/UtgardeKeep/instance_utgarde_keep.cpp | 2 +- 4 files changed, 20 insertions(+), 6 deletions(-) create mode 100644 sql/updates/world/2013_08_28_05_world_misc.sql (limited to 'src') diff --git a/sql/updates/world/2013_08_28_05_world_misc.sql b/sql/updates/world/2013_08_28_05_world_misc.sql new file mode 100644 index 00000000000..066a2dbfc73 --- /dev/null +++ b/sql/updates/world/2013_08_28_05_world_misc.sql @@ -0,0 +1,14 @@ +DELETE from `waypoints` where `entry`=31279; +INSERT INTO `waypoints` (`entry`, `pointid`, `position_x`, `position_y`, `position_z`, `point_comment`) VALUES +(31279, 1, 6716.76, 3436.7, 682.197, 'Q I''m Not Dead Yet!'), +(31279, 2, 6724.09, 3433.56, 682.197, 'Q I''m Not Dead Yet!'), +(31279, 3, 6734.95, 3435.7, 681.87, 'Q I''m Not Dead Yet!'), +(31279, 4, 6766.36, 3464.42, 673.201, 'Q I''m Not Dead Yet!'), +(31279, 5, 6782.48, 3478.07, 674.097, 'Q I''m Not Dead Yet!'), +(31279, 6, 6789.64, 3484.14, 676.423, 'Q I''m Not Dead Yet!'), +(31279, 7, 6815.31, 3483.01, 685.829, 'Q I''m Not Dead Yet!'), +(31279, 8, 6875.41, 3479.14, 694.799, 'Q I''m Not Dead Yet!'), +(31279, 9, 6946.3, 3477.29, 708.832, 'Q I''m Not Dead Yet!'), +(31279, 10, 6980.65, 3468.12, 710.813, 'Q I''m Not Dead Yet!'), +(31279, 11, 7008.43, 3458.64, 696.751, 'Q I''m Not Dead Yet!'), +(31279, 12, 7042.92, 3438.07, 695.543, 'Q I''m Not Dead Yet!'); diff --git a/src/server/game/Instances/InstanceSaveMgr.h b/src/server/game/Instances/InstanceSaveMgr.h index ef55005d0d6..e3717a934c3 100644 --- a/src/server/game/Instances/InstanceSaveMgr.h +++ b/src/server/game/Instances/InstanceSaveMgr.h @@ -82,14 +82,14 @@ class InstanceSave does not include the members of the group unless they have permanent saves */ void AddPlayer(Player* player) { TRINITY_GUARD(ACE_Thread_Mutex, _lock); m_playerList.push_back(player); } bool RemovePlayer(Player* player) - { + { _lock.acquire(); m_playerList.remove(player); bool isStillValid = UnloadIfEmpty(); _lock.release(); //delete here if needed, after releasing the lock - if(m_toDelete) + if (m_toDelete) delete this; return isStillValid; @@ -97,10 +97,10 @@ class InstanceSave /* all groups bound to the instance */ void AddGroup(Group* group) { m_groupList.push_back(group); } bool RemoveGroup(Group* group) - { + { m_groupList.remove(group); bool isStillValid = UnloadIfEmpty(); - if(m_toDelete) + if (m_toDelete) delete this; return isStillValid; } diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp index e6e9fffd5ac..30174996a42 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp @@ -291,7 +291,7 @@ class npc_annhylde_the_caller : public CreatureScript { if (type != POINT_MOTION_TYPE) return; - + switch (id) { case 1: diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/instance_utgarde_keep.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/instance_utgarde_keep.cpp index 7bc25aad773..c4e7416f855 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/instance_utgarde_keep.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/instance_utgarde_keep.cpp @@ -197,7 +197,7 @@ class instance_utgarde_keep : public InstanceMapScript std::ostringstream saveStream; saveStream << "U K " << GetBossSaveData(); - + for (uint8 i = 0; i < 3; ++i) saveStream << Forges[i].Event << ' '; -- cgit v1.2.3