From d52ce57e590d9703b34386469a2c4e9a5ad215ab Mon Sep 17 00:00:00 2001 From: joschiwald Date: Fri, 19 Jul 2013 00:21:54 +0200 Subject: Scripts/ForgeOfSouls: move "Mirrored Soul" into SpellScripts --- .../ForgeOfSouls/boss_devourer_of_souls.cpp | 173 +++++++++++++++++---- 1 file changed, 145 insertions(+), 28 deletions(-) (limited to 'src') diff --git a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp index 173abfc2652..b1ecdc5904e 100644 --- a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp @@ -17,9 +17,11 @@ #include "ScriptMgr.h" #include "ScriptedCreature.h" -#include "forge_of_souls.h" #include "Player.h" #include "SpellInfo.h" +#include "SpellAuraEffects.h" +#include "SpellScript.h" +#include "forge_of_souls.h" /* * @todo @@ -48,7 +50,10 @@ enum Spells { SPELL_PHANTOM_BLAST = 68982, H_SPELL_PHANTOM_BLAST = 70322, - SPELL_MIRRORED_SOUL = 69051, + SPELL_MIRRORED_SOUL_PROC_AURA = 69023, + SPELL_MIRRORED_SOUL_DAMAGE = 69034, + SPELL_MIRRORED_SOUL_TARGET_SELECTOR = 69048, + SPELL_MIRRORED_SOUL_BUFF = 69051, SPELL_WELL_OF_SOULS = 68820, SPELL_UNLEASHED_SOULS = 68939, SPELL_WAILING_SOULS_STARTING = 68912, // Initial spell cast at begining of wailing souls phase @@ -145,7 +150,6 @@ class boss_devourer_of_souls : public CreatureScript summons.DespawnAll(); threeFaced = true; - mirroredSoulTarget = 0; instance->SetData(DATA_DEVOURER_EVENT, NOT_STARTED); } @@ -165,23 +169,6 @@ class boss_devourer_of_souls : public CreatureScript instance->SetData(DATA_DEVOURER_EVENT, IN_PROGRESS); } - void DamageTaken(Unit* /*pDoneBy*/, uint32 &uiDamage) OVERRIDE - { - if (mirroredSoulTarget && me->HasAura(SPELL_MIRRORED_SOUL)) - { - if (Player* player = Unit::GetPlayer(*me, mirroredSoulTarget)) - { - if (player->GetAura(SPELL_MIRRORED_SOUL)) - { - int32 mirrorDamage = (uiDamage* 45)/100; - me->CastCustomSpell(player, 69034, &mirrorDamage, 0, 0, true); - } - else - mirroredSoulTarget = 0; - } - } - } - void KilledUnit(Unit* victim) OVERRIDE { if (victim->GetTypeId() != TYPEID_PLAYER) @@ -270,12 +257,8 @@ class boss_devourer_of_souls : public CreatureScript events.ScheduleEvent(EVENT_PHANTOM_BLAST, 5000); break; case EVENT_MIRRORED_SOUL: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0, true)) - { - mirroredSoulTarget = target->GetGUID(); - DoCast(target, SPELL_MIRRORED_SOUL); - Talk(EMOTE_MIRRORED_SOUL); - } + DoCastAOE(SPELL_MIRRORED_SOUL_TARGET_SELECTOR); + Talk(EMOTE_MIRRORED_SOUL); events.ScheduleEvent(EVENT_MIRRORED_SOUL, urand(15000, 30000)); break; case EVENT_WELL_OF_SOULS: @@ -358,8 +341,6 @@ class boss_devourer_of_souls : public CreatureScript float beamAngle; float beamAngleDiff; int8 wailingSoulTick; - - uint64 mirroredSoulTarget; }; CreatureAI* GetAI(Creature* creature) const OVERRIDE @@ -368,6 +349,139 @@ class boss_devourer_of_souls : public CreatureScript } }; +// 69051 - Mirrored Soul +class spell_devourer_of_souls_mirrored_soul : public SpellScriptLoader +{ + public: + spell_devourer_of_souls_mirrored_soul() : SpellScriptLoader("spell_devourer_of_souls_mirrored_soul") { } + + class spell_devourer_of_souls_mirrored_soul_SpellScript : public SpellScript + { + PrepareSpellScript(spell_devourer_of_souls_mirrored_soul_SpellScript); + + bool Validate(SpellInfo const* /*spellInfo*/) OVERRIDE + { + if (!sSpellMgr->GetSpellInfo(SPELL_MIRRORED_SOUL_PROC_AURA)) + return false; + return true; + } + + void HandleScript(SpellEffIndex /*effIndex*/) + { + if (Unit* target = GetHitUnit()) + target->CastSpell(GetCaster(), SPELL_MIRRORED_SOUL_PROC_AURA, true); + } + + void Register() OVERRIDE + { + OnEffectHitTarget += SpellEffectFn(spell_devourer_of_souls_mirrored_soul_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; + + SpellScript* GetSpellScript() const OVERRIDE + { + return new spell_devourer_of_souls_mirrored_soul_SpellScript(); + } +}; + +// 69023 - Mirrored Soul (Proc) +class spell_devourer_of_souls_mirrored_soul_proc : public SpellScriptLoader +{ + public: + spell_devourer_of_souls_mirrored_soul_proc() : SpellScriptLoader("spell_devourer_of_souls_mirrored_soul_proc") { } + + class spell_devourer_of_souls_mirrored_soul_proc_AuraScript : public AuraScript + { + PrepareAuraScript(spell_devourer_of_souls_mirrored_soul_proc_AuraScript); + + bool Validate(SpellInfo const* /*spellInfo*/) OVERRIDE + { + if (!sSpellMgr->GetSpellInfo(SPELL_MIRRORED_SOUL_DAMAGE)) + return false; + return true; + } + + bool Load() OVERRIDE + { + _procTarget = NULL; + return true; + } + + bool CheckProc(ProcEventInfo& /*eventInfo*/) + { + _procTarget = GetCaster(); + return _procTarget && _procTarget->IsAlive(); + } + + void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo) + { + PreventDefaultAction(); + int32 damage = int32(CalculatePct(eventInfo.GetDamageInfo()->GetDamage(), 45)); + GetTarget()->CastCustomSpell(SPELL_MIRRORED_SOUL_DAMAGE, SPELLVALUE_BASE_POINT0, damage, _procTarget, true); + } + + void Register() OVERRIDE + { + DoCheckProc += AuraCheckProcFn(spell_devourer_of_souls_mirrored_soul_proc_AuraScript::CheckProc); + OnEffectProc += AuraEffectProcFn(spell_devourer_of_souls_mirrored_soul_proc_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL); + } + + private: + Unit* _procTarget; + }; + + AuraScript* GetAuraScript() const OVERRIDE + { + return new spell_devourer_of_souls_mirrored_soul_proc_AuraScript(); + } +}; + +// 69048 - Mirrored Soul (Target Selector) +class spell_devourer_of_souls_mirrored_soul_target_selector : public SpellScriptLoader +{ + public: + spell_devourer_of_souls_mirrored_soul_target_selector() : SpellScriptLoader("spell_devourer_of_souls_mirrored_soul_target_selector") { } + + class spell_devourer_of_souls_mirrored_soul_target_selector_SpellScript : public SpellScript + { + PrepareSpellScript(spell_devourer_of_souls_mirrored_soul_target_selector_SpellScript); + + bool Validate(SpellInfo const* /*spellInfo*/) OVERRIDE + { + if (!sSpellMgr->GetSpellInfo(SPELL_MIRRORED_SOUL_BUFF)) + return false; + return true; + } + + void FilterTargets(std::list& targets) + { + if (targets.empty()) + return; + + WorldObject* target = Trinity::Containers::SelectRandomContainerElement(targets); + targets.clear(); + targets.push_back(target); + } + + void HandleScript(SpellEffIndex /*effIndex*/) + { + if (Unit* target = GetHitUnit()) + GetCaster()->CastSpell(target, SPELL_MIRRORED_SOUL_BUFF, false); + } + + void Register() OVERRIDE + { + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_devourer_of_souls_mirrored_soul_target_selector_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY); + OnEffectHitTarget += SpellEffectFn(spell_devourer_of_souls_mirrored_soul_target_selector_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; + + SpellScript* GetSpellScript() const OVERRIDE + { + return new spell_devourer_of_souls_mirrored_soul_target_selector_SpellScript(); + } +}; + class achievement_three_faced : public AchievementCriteriaScript { public: @@ -391,5 +505,8 @@ class achievement_three_faced : public AchievementCriteriaScript void AddSC_boss_devourer_of_souls() { new boss_devourer_of_souls(); + new spell_devourer_of_souls_mirrored_soul(); + new spell_devourer_of_souls_mirrored_soul_proc(); + new spell_devourer_of_souls_mirrored_soul_target_selector(); new achievement_three_faced(); } -- cgit v1.2.3 From c536ba510d523842632061c0c41d7d381d6e5a15 Mon Sep 17 00:00:00 2001 From: Nay Date: Fri, 19 Jul 2013 00:03:27 +0100 Subject: Scripts/Icecrown: Fix quest The Flesh Giant Champion Closes #9040 Closes #10294 --- .../world/2013_07_18_the_flesh_giant_slayer.sql | 36 ++++ src/server/scripts/Northrend/zone_icecrown.cpp | 203 +++++++++++++++++++++ 2 files changed, 239 insertions(+) create mode 100644 sql/updates/world/2013_07_18_the_flesh_giant_slayer.sql (limited to 'src') diff --git a/sql/updates/world/2013_07_18_the_flesh_giant_slayer.sql b/sql/updates/world/2013_07_18_the_flesh_giant_slayer.sql new file mode 100644 index 00000000000..f391fa616f5 --- /dev/null +++ b/sql/updates/world/2013_07_18_the_flesh_giant_slayer.sql @@ -0,0 +1,36 @@ +-- TEXT INSERTS +DELETE FROM `creature_text` WHERE `entry`=31306, `groupid`=1, `id`=0; +INSERT INTO `creature_text` (`entry`, `groupid`, `id`, `text`, `type`, `language`, `probability`, `emote`, `duration`, `sound`, `comment`) VALUES +(31306, 1, 0, "Knights of the Ebon Blade, prepare for battle!", 12, 0, 100, 1, 0, 0, ''); + +DELETE FROM `creature_text` WHERE `entry`=31301, 31428; +INSERT INTO `creature_text` (`entry`, `groupid`, `id`, `text`, `type`, `language`, `probability`, `emote`, `duration`, `sound`, `comment`) VALUES +(31301, 1, 1, "You dare to think you have thwarted my will? That you have broken my plans?", 12, 0, 100, 0, 0, 0, "LK SAY 1"), +(31301, 2, 1, "You have accomplished nothing!", 12, 0, 100, 0, 0, 0, "LK SAY 2"), +(31301, 3, 1, "Your feeble resistance has only hastened your doom.", 12, 0, 100, 0, 0, 0, "LK SAY 3"), +(31301, 4, 1, "So spout your platitudes and flail until you are spent. In the end, you will be mine, and Morbidus will be the harbinger of your death!", 12, 0, 100, 0, 0, 0, "LK SAY 4"), +(31301, 5, 1, "Morbidus, show them what happens to those who defy the will of their king!", 12, 0, 100, 0, 0, 0, "LK SAY 5"), +(31428, 1, 0, "You will pay for what you've done! For the Argent Crusade!", 12, 0, 100, 0, 0, 0, "OLAKIN SAY 1"); + + +-- ScriptName Updates +UPDATE creature_template SET `ScriptName`='npc_margrave_dhakar' WHERE entry=31306; +UPDATE creature_template SET `ScriptName`='npc_morbidus' WHERE `entry`=30698; + +-- Template updates for creature 30698 (Morbidus) +UPDATE `creature_template` SET `faction_A`=2102,`faction_H`=2102,`exp`=2,`minlevel`=80,`maxlevel`=80,`unit_flags`=`unit_flags`|832,`speed_run`=0.99206,`VehicleId`=271 WHERE `entry`=30698; -- Morbidus +-- Model data 31176 (creature 30698 (Morbidus)) +UPDATE `creature_model_info` SET `bounding_radius`=0.465,`combat_reach`=7.5,`gender`=0 WHERE `modelid`=31176; -- Morbidus +-- Addon data for creature 30698 (Morbidus) +DELETE FROM `creature_template_addon` WHERE `entry`=30698; +INSERT INTO `creature_template_addon` (`entry`,`mount`,`bytes1`,`bytes2`,`emote`,`auras`) VALUES +(30698,0,0,1,0, NULL); -- Morbidus +-- Template updates for creature 31306 (Margrave Dhakar) +UPDATE `creature_template` SET `faction_A`=1770,`faction_H`=1770,`npcflag`=`npcflag`|1,`equipment_id`=30954 WHERE `entry`=31306; -- Margrave Dhakar +-- Model data 27558 (creature 31306 (Margrave Dhakar)) +UPDATE `creature_model_info` SET `bounding_radius`=0.3825,`combat_reach`=1.875,`gender`=0 WHERE `modelid`=27558; -- Margrave Dhakar +-- Addon data for creature 31306 (Margrave Dhakar) +DELETE FROM `creature_template_addon` WHERE `entry`=31306; +INSERT INTO `creature_template_addon` (`entry`,`mount`,`bytes1`,`bytes2`,`emote`,`auras`) VALUES +(31306,0,0,1,0, NULL); -- Margrave Dhakar +UPDATE `creature_template` SET `gossip_menu_id`=10060 WHERE `entry`=31306; -- Margrave Dhakar diff --git a/src/server/scripts/Northrend/zone_icecrown.cpp b/src/server/scripts/Northrend/zone_icecrown.cpp index ef58138c653..35a51fb9ea0 100644 --- a/src/server/scripts/Northrend/zone_icecrown.cpp +++ b/src/server/scripts/Northrend/zone_icecrown.cpp @@ -966,6 +966,206 @@ class npc_frostbrood_skytalon : public CreatureScript } }; +/* +Quest: The Flesh Giant Champion +*/ +enum FleshGiant +{ + QUEST_FLESH_GIANT_CHAMPION = 13235, + NPC_MORBIDUS = 30698, + NPC_LICH_KING = 31301, + + // Factions + FACTION_HOSTILE = 14, + FACTION_BASIC = 2102, + // Events + EVENT_INTRO = 1, + EVENT_LK_SAY_1 = 2, + EVENT_LK_SAY_2 = 3, + EVENT_LK_SAY_3 = 4, + EVENT_LK_SAY_4 = 5, + EVENT_LK_SAY_5 = 6, + + EVENT_OUTRO = 7, + EVENT_START = 8, + + SPELL_SIMPLE_TELEPORT = 64195, // Visual stuff + + // Dhakar + SAY_START = 1, + // Lich King + SAY_THING_1 = 1, + SAY_THING_2 = 2, + SAY_THING_3 = 3, + SAY_THING_4 = 4, + SAY_THING_5 = 5, + // Olakin + SAY_PAY = 1 +}; +class npc_margrave_dhakar : public CreatureScript +{ + public: + npc_margrave_dhakar() : CreatureScript("npc_margrave_dhakar") { } + + struct npc_margrave_dhakarAI : public ScriptedAI + { + npc_margrave_dhakarAI(Creature* creature) : ScriptedAI(creature) , summons(me) + { + Reset(); + } + + uint64 LKGuid; + SummonList summons; + void Reset() + { + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_NONE); + events.Reset(); + summons.DespawnAll(); + } + void sGossipSelect(Player* player, uint32 sender, uint32 action) + { + if (player->GetQuestStatus(QUEST_FLESH_GIANT_CHAMPION) == QUEST_STATUS_INCOMPLETE && !player->isInCombat()) + { + if (me->GetCreatureTemplate()->GossipMenuId == sender && !action) + { + events.ScheduleEvent(EVENT_INTRO, 1000); + me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + } + } + } + void UpdateAI(uint32 diff) + { + events.Update(diff); + + while (uint32 eventId = events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_INTRO: + Talk(SAY_START); + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY2H); + if (Creature *morbidus = me->FindNearestCreature(NPC_MORBIDUS, 50.0f, true)) + { + Creature *LK = me->SummonCreature(NPC_LICH_KING, morbidus->GetPositionX()+10, morbidus->GetPositionY(), morbidus->GetPositionZ()); + LKGuid = LK->GetGUID(); + LK->SetFacingTo(morbidus->GetOrientation()); + LK->CastSpell(LK, SPELL_SIMPLE_TELEPORT, true); + } + events.ScheduleEvent(EVENT_LK_SAY_1, 5000); + events.CancelEvent(EVENT_INTRO); + break; + case EVENT_LK_SAY_1: + if (Creature *LK = Unit::GetCreature(*me, LKGuid)) + { + LK->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_POINT); + LK->AI()->Talk(SAY_THING_1); + } + events.ScheduleEvent(EVENT_LK_SAY_2, 5000); + events.CancelEvent(EVENT_LK_SAY_1); + break; + case EVENT_LK_SAY_2: + if (Creature *LK = Unit::GetCreature(*me, LKGuid)) + { + LK->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_SHOUT); + LK->AI()->Talk(SAY_THING_2); + } + events.ScheduleEvent(EVENT_LK_SAY_3, 5000); + events.CancelEvent(EVENT_LK_SAY_2); + break; + + case EVENT_LK_SAY_3: + if (Creature *LK = Unit::GetCreature(*me, LKGuid)) + { + LK->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_POINT); + LK->AI()->Talk(SAY_THING_3); + } + events.ScheduleEvent(EVENT_LK_SAY_4, 5000); + events.CancelEvent(EVENT_LK_SAY_3); + break; + + case EVENT_LK_SAY_4: + if (Creature *LK = Unit::GetCreature(*me, LKGuid)) + { + LK->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_SHOUT); + LK->AI()->Talk(SAY_THING_4); + } + events.ScheduleEvent(EVENT_OUTRO, 12000); + events.CancelEvent(EVENT_LK_SAY_4); + break; + + case EVENT_LK_SAY_5: + if (Creature *LK = Unit::GetCreature(*me, LKGuid)) + { + LK->AI()->Talk(SAY_THING_5); + LK->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_POINT); + } + events.ScheduleEvent(EVENT_OUTRO, 8000); + events.CancelEvent(EVENT_LK_SAY_5); + break; + case EVENT_OUTRO: + if (Creature *olakin = me->FindNearestCreature(31428, 50.0f, true)) + { + olakin->AI()->Talk(SAY_PAY); + } + if (Creature *LK = Unit::GetCreature(*me, LKGuid)) + LK->DespawnOrUnsummon(0); + events.ScheduleEvent(EVENT_START, 5000); + events.CancelEvent(EVENT_OUTRO); + break; + + case EVENT_START: + if (Creature *morbidus = me->FindNearestCreature(NPC_MORBIDUS, 50.0f, true)) + { + morbidus->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_ATTACKABLE_1 | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_DISABLE_MOVE); + morbidus->setFaction(FACTION_HOSTILE); + } + events.CancelEvent(EVENT_START); + break; + } + } + DoMeleeAttackIfReady(); + } + + private: + EventMap events; + }; + + CreatureAI* GetAI(Creature* creature) const + { + return new npc_margrave_dhakarAI(creature); + } +}; +class npc_morbidus : public CreatureScript +{ + public: + npc_morbidus() : CreatureScript("npc_morbidus") { } + + struct npc_morbidusAI : public ScriptedAI + { + npc_morbidusAI(Creature* creature) : ScriptedAI(creature) { } + + void Reset() + { + if (Creature * dhakar = me->FindNearestCreature(31306, 50.0f, true)) + dhakar->AI()->Reset(); + // this will prevent the event to start without morbidus being alive + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->SetReactState(REACT_PASSIVE); + me->setFaction(FACTION_BASIC); + } + void UpdateAI(uint32 diff) + { + DoMeleeAttackIfReady(); + } + + }; + CreatureAI* GetAI(Creature* creature) const + { + return new npc_morbidusAI(creature); + } +}; + void AddSC_icecrown() { new npc_arete; @@ -976,4 +1176,7 @@ void AddSC_icecrown() new npc_tournament_training_dummy; new npc_blessed_banner(); new npc_frostbrood_skytalon(); + new npc_margrave_dhakar(); + new npc_morbidus(); + } -- cgit v1.2.3 From ff01602906fba5a9601136c9a8418a2c7a1385e4 Mon Sep 17 00:00:00 2001 From: Nay Date: Fri, 19 Jul 2013 00:42:59 +0100 Subject: Scripts/Icecrown: Fix code style and use "best practices" on previous commit (c536ba510) --- .../2013_07_18_02_world_the_flesh_giant_slayer.sql | 26 ++ .../world/2013_07_18_the_flesh_giant_slayer.sql | 36 --- src/server/scripts/Northrend/zone_icecrown.cpp | 341 ++++++++++----------- 3 files changed, 182 insertions(+), 221 deletions(-) create mode 100644 sql/updates/world/2013_07_18_02_world_the_flesh_giant_slayer.sql delete mode 100644 sql/updates/world/2013_07_18_the_flesh_giant_slayer.sql (limited to 'src') diff --git a/sql/updates/world/2013_07_18_02_world_the_flesh_giant_slayer.sql b/sql/updates/world/2013_07_18_02_world_the_flesh_giant_slayer.sql new file mode 100644 index 00000000000..e79a54598e7 --- /dev/null +++ b/sql/updates/world/2013_07_18_02_world_the_flesh_giant_slayer.sql @@ -0,0 +1,26 @@ +-- TEXT INSERTS +DELETE FROM `creature_text` WHERE `entry` IN (31301, 31428, 31306); +INSERT INTO `creature_text` (`entry`, `groupid`, `id`, `text`, `type`, `language`, `probability`, `emote`, `duration`, `sound`, `comment`) VALUES +(31301, 0, 0, "You dare to think you have thwarted my will? That you have broken my plans?", 12, 0, 100, 25, 0, 0, "LK SAY 1"), +(31301, 1, 0, "You have accomplished nothing!", 12, 0, 100, 22, 0, 0, "LK SAY 2"), +(31301, 2, 0, "Your feeble resistance has only hastened your doom.", 12, 0, 100, 25, 0, 0, "LK SAY 3"), +(31301, 3, 0, "So spout your platitudes and flail until you are spent. In the end, you will be mine, and Morbidus will be the harbinger of your death!", 12, 0, 100, 22, 0, 0, "LK SAY 4"), +(31301, 4, 0, "Morbidus, show them what happens to those who defy the will of their king!", 12, 0, 100, 25, 0, 0, "LK SAY 5"), +(31428, 0, 0, "You will pay for what you've done! For the Argent Crusade!", 12, 0, 100, 0, 0, 0, "OLAKIN SAY 1"), +(31306, 0, 0, "Knights of the Ebon Blade, prepare for battle!", 12, 0, 100, 1, 0, 0, 'DHAKAR SAY 1'); + +-- ScriptName Updates +UPDATE `creature_template` SET `ScriptName`='npc_margrave_dhakar' WHERE `entry`=31306; +UPDATE `creature_template` SET `ScriptName`='npc_morbidus' WHERE `entry`=30698; + +-- Template updates +UPDATE `creature_template` SET `faction_A`=2102, `faction_H`=2102, `exp`=2, `minlevel`=80, `maxlevel`=80, `unit_flags`=`unit_flags`|832, `speed_run`=0.99206, `VehicleId`=271 WHERE `entry`=30698; -- Morbidus +UPDATE `creature_template` SET `faction_A`=1770, `faction_H`=1770, `npcflag`=`npcflag`|1, `equipment_id`=30954, `gossip_menu_id`=10060 WHERE `entry`=31306; -- Margrave Dhakar + +UPDATE `creature_model_info` SET `bounding_radius`=0.465,`combat_reach`=7.5,`gender`=0 WHERE `modelid`=31176; -- Morbidus +UPDATE `creature_model_info` SET `bounding_radius`=0.3825,`combat_reach`=1.875,`gender`=0 WHERE `modelid`=27558; -- Margrave Dhakar + +DELETE FROM `creature_template_addon` WHERE `entry` IN (30698, 31306); +INSERT INTO `creature_template_addon` (`entry`,`mount`,`bytes1`,`bytes2`,`emote`,`auras`) VALUES +(30698,0,0,1,0, NULL), -- Morbidus +(31306,0,0,1,0, NULL); -- Margrave Dhakar diff --git a/sql/updates/world/2013_07_18_the_flesh_giant_slayer.sql b/sql/updates/world/2013_07_18_the_flesh_giant_slayer.sql deleted file mode 100644 index f391fa616f5..00000000000 --- a/sql/updates/world/2013_07_18_the_flesh_giant_slayer.sql +++ /dev/null @@ -1,36 +0,0 @@ --- TEXT INSERTS -DELETE FROM `creature_text` WHERE `entry`=31306, `groupid`=1, `id`=0; -INSERT INTO `creature_text` (`entry`, `groupid`, `id`, `text`, `type`, `language`, `probability`, `emote`, `duration`, `sound`, `comment`) VALUES -(31306, 1, 0, "Knights of the Ebon Blade, prepare for battle!", 12, 0, 100, 1, 0, 0, ''); - -DELETE FROM `creature_text` WHERE `entry`=31301, 31428; -INSERT INTO `creature_text` (`entry`, `groupid`, `id`, `text`, `type`, `language`, `probability`, `emote`, `duration`, `sound`, `comment`) VALUES -(31301, 1, 1, "You dare to think you have thwarted my will? That you have broken my plans?", 12, 0, 100, 0, 0, 0, "LK SAY 1"), -(31301, 2, 1, "You have accomplished nothing!", 12, 0, 100, 0, 0, 0, "LK SAY 2"), -(31301, 3, 1, "Your feeble resistance has only hastened your doom.", 12, 0, 100, 0, 0, 0, "LK SAY 3"), -(31301, 4, 1, "So spout your platitudes and flail until you are spent. In the end, you will be mine, and Morbidus will be the harbinger of your death!", 12, 0, 100, 0, 0, 0, "LK SAY 4"), -(31301, 5, 1, "Morbidus, show them what happens to those who defy the will of their king!", 12, 0, 100, 0, 0, 0, "LK SAY 5"), -(31428, 1, 0, "You will pay for what you've done! For the Argent Crusade!", 12, 0, 100, 0, 0, 0, "OLAKIN SAY 1"); - - --- ScriptName Updates -UPDATE creature_template SET `ScriptName`='npc_margrave_dhakar' WHERE entry=31306; -UPDATE creature_template SET `ScriptName`='npc_morbidus' WHERE `entry`=30698; - --- Template updates for creature 30698 (Morbidus) -UPDATE `creature_template` SET `faction_A`=2102,`faction_H`=2102,`exp`=2,`minlevel`=80,`maxlevel`=80,`unit_flags`=`unit_flags`|832,`speed_run`=0.99206,`VehicleId`=271 WHERE `entry`=30698; -- Morbidus --- Model data 31176 (creature 30698 (Morbidus)) -UPDATE `creature_model_info` SET `bounding_radius`=0.465,`combat_reach`=7.5,`gender`=0 WHERE `modelid`=31176; -- Morbidus --- Addon data for creature 30698 (Morbidus) -DELETE FROM `creature_template_addon` WHERE `entry`=30698; -INSERT INTO `creature_template_addon` (`entry`,`mount`,`bytes1`,`bytes2`,`emote`,`auras`) VALUES -(30698,0,0,1,0, NULL); -- Morbidus --- Template updates for creature 31306 (Margrave Dhakar) -UPDATE `creature_template` SET `faction_A`=1770,`faction_H`=1770,`npcflag`=`npcflag`|1,`equipment_id`=30954 WHERE `entry`=31306; -- Margrave Dhakar --- Model data 27558 (creature 31306 (Margrave Dhakar)) -UPDATE `creature_model_info` SET `bounding_radius`=0.3825,`combat_reach`=1.875,`gender`=0 WHERE `modelid`=27558; -- Margrave Dhakar --- Addon data for creature 31306 (Margrave Dhakar) -DELETE FROM `creature_template_addon` WHERE `entry`=31306; -INSERT INTO `creature_template_addon` (`entry`,`mount`,`bytes1`,`bytes2`,`emote`,`auras`) VALUES -(31306,0,0,1,0, NULL); -- Margrave Dhakar -UPDATE `creature_template` SET `gossip_menu_id`=10060 WHERE `entry`=31306; -- Margrave Dhakar diff --git a/src/server/scripts/Northrend/zone_icecrown.cpp b/src/server/scripts/Northrend/zone_icecrown.cpp index 35a51fb9ea0..3b550b0dab3 100644 --- a/src/server/scripts/Northrend/zone_icecrown.cpp +++ b/src/server/scripts/Northrend/zone_icecrown.cpp @@ -16,17 +16,6 @@ * with this program. If not, see . */ -/* ScriptData -SDName: Icecrown -SD%Complete: 100 -SDComment: Quest support: 12807 -SDCategory: Icecrown -EndScriptData */ - -/* ContentData -npc_arete -EndContentData */ - #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "ScriptedGossip.h" @@ -966,42 +955,41 @@ class npc_frostbrood_skytalon : public CreatureScript } }; -/* -Quest: The Flesh Giant Champion -*/ +/*###### +## The Flesh Giant Champion - Id: 13235 +######*/ enum FleshGiant { - QUEST_FLESH_GIANT_CHAMPION = 13235, - NPC_MORBIDUS = 30698, - NPC_LICH_KING = 31301, - - // Factions - FACTION_HOSTILE = 14, - FACTION_BASIC = 2102, - // Events - EVENT_INTRO = 1, - EVENT_LK_SAY_1 = 2, - EVENT_LK_SAY_2 = 3, - EVENT_LK_SAY_3 = 4, - EVENT_LK_SAY_4 = 5, - EVENT_LK_SAY_5 = 6, - - EVENT_OUTRO = 7, - EVENT_START = 8, - - SPELL_SIMPLE_TELEPORT = 64195, // Visual stuff - - // Dhakar - SAY_START = 1, - // Lich King - SAY_THING_1 = 1, - SAY_THING_2 = 2, - SAY_THING_3 = 3, - SAY_THING_4 = 4, - SAY_THING_5 = 5, - // Olakin - SAY_PAY = 1 + QUEST_FLESH_GIANT_CHAMPION = 13235, + + NPC_MORBIDUS = 30698, + NPC_LICH_KING = 31301, + NPC_OLAKIN = 31428, + NPC_DHAKAR = 31306, + + FACTION_HOSTILE = 14, + FACTION_BASIC = 2102, + + EVENT_INTRO = 1, + EVENT_LK_SAY_1 = 2, + EVENT_LK_SAY_2 = 3, + EVENT_LK_SAY_3 = 4, + EVENT_LK_SAY_4 = 5, + EVENT_LK_SAY_5 = 6, + EVENT_OUTRO = 7, + EVENT_START = 8, + + SPELL_SIMPLE_TELEPORT = 64195, + + SAY_DHAKAR_START = 0, + SAY_LK_1 = 0, + SAY_LK_2 = 1, + SAY_LK_3 = 2, + SAY_LK_4 = 3, + SAY_LK_5 = 4, + SAY_OLAKIN_PAY = 0 }; + class npc_margrave_dhakar : public CreatureScript { public: @@ -1009,133 +997,120 @@ class npc_margrave_dhakar : public CreatureScript struct npc_margrave_dhakarAI : public ScriptedAI { - npc_margrave_dhakarAI(Creature* creature) : ScriptedAI(creature) , summons(me) - { - Reset(); - } - - uint64 LKGuid; - SummonList summons; - void Reset() - { - me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_NONE); - events.Reset(); - summons.DespawnAll(); - } - void sGossipSelect(Player* player, uint32 sender, uint32 action) - { - if (player->GetQuestStatus(QUEST_FLESH_GIANT_CHAMPION) == QUEST_STATUS_INCOMPLETE && !player->isInCombat()) - { - if (me->GetCreatureTemplate()->GossipMenuId == sender && !action) - { - events.ScheduleEvent(EVENT_INTRO, 1000); - me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - } - } - } - void UpdateAI(uint32 diff) - { - events.Update(diff); + npc_margrave_dhakarAI(Creature* creature) : ScriptedAI(creature) , _summons(me), _lichKing(NULL) { } - while (uint32 eventId = events.ExecuteEvent()) + void Reset() OVERRIDE + { + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_NONE); + + _events.Reset(); + _summons.DespawnAll(); + } + + void sGossipSelect(Player* player, uint32 sender, uint32 action) OVERRIDE + { + if (player->GetQuestStatus(QUEST_FLESH_GIANT_CHAMPION) == QUEST_STATUS_INCOMPLETE && !player->IsInCombat()) + { + if (me->GetCreatureTemplate()->GossipMenuId == sender && !action) + { + _events.ScheduleEvent(EVENT_INTRO, 1000); + me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + } + } + } + + void UpdateAI(uint32 diff) OVERRIDE + { + _events.Update(diff); + + while (uint32 eventId = _events.ExecuteEvent()) { switch (eventId) { - case EVENT_INTRO: - Talk(SAY_START); - me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY2H); - if (Creature *morbidus = me->FindNearestCreature(NPC_MORBIDUS, 50.0f, true)) - { - Creature *LK = me->SummonCreature(NPC_LICH_KING, morbidus->GetPositionX()+10, morbidus->GetPositionY(), morbidus->GetPositionZ()); - LKGuid = LK->GetGUID(); - LK->SetFacingTo(morbidus->GetOrientation()); - LK->CastSpell(LK, SPELL_SIMPLE_TELEPORT, true); - } - events.ScheduleEvent(EVENT_LK_SAY_1, 5000); - events.CancelEvent(EVENT_INTRO); - break; - case EVENT_LK_SAY_1: - if (Creature *LK = Unit::GetCreature(*me, LKGuid)) - { - LK->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_POINT); - LK->AI()->Talk(SAY_THING_1); - } - events.ScheduleEvent(EVENT_LK_SAY_2, 5000); - events.CancelEvent(EVENT_LK_SAY_1); - break; - case EVENT_LK_SAY_2: - if (Creature *LK = Unit::GetCreature(*me, LKGuid)) - { - LK->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_SHOUT); - LK->AI()->Talk(SAY_THING_2); - } - events.ScheduleEvent(EVENT_LK_SAY_3, 5000); - events.CancelEvent(EVENT_LK_SAY_2); - break; - - case EVENT_LK_SAY_3: - if (Creature *LK = Unit::GetCreature(*me, LKGuid)) - { - LK->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_POINT); - LK->AI()->Talk(SAY_THING_3); - } - events.ScheduleEvent(EVENT_LK_SAY_4, 5000); - events.CancelEvent(EVENT_LK_SAY_3); - break; - - case EVENT_LK_SAY_4: - if (Creature *LK = Unit::GetCreature(*me, LKGuid)) - { - LK->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_SHOUT); - LK->AI()->Talk(SAY_THING_4); - } - events.ScheduleEvent(EVENT_OUTRO, 12000); - events.CancelEvent(EVENT_LK_SAY_4); - break; - - case EVENT_LK_SAY_5: - if (Creature *LK = Unit::GetCreature(*me, LKGuid)) - { - LK->AI()->Talk(SAY_THING_5); - LK->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_POINT); - } - events.ScheduleEvent(EVENT_OUTRO, 8000); - events.CancelEvent(EVENT_LK_SAY_5); - break; - case EVENT_OUTRO: - if (Creature *olakin = me->FindNearestCreature(31428, 50.0f, true)) - { - olakin->AI()->Talk(SAY_PAY); - } - if (Creature *LK = Unit::GetCreature(*me, LKGuid)) - LK->DespawnOrUnsummon(0); - events.ScheduleEvent(EVENT_START, 5000); - events.CancelEvent(EVENT_OUTRO); - break; - - case EVENT_START: - if (Creature *morbidus = me->FindNearestCreature(NPC_MORBIDUS, 50.0f, true)) - { - morbidus->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_ATTACKABLE_1 | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_DISABLE_MOVE); - morbidus->setFaction(FACTION_HOSTILE); - } - events.CancelEvent(EVENT_START); - break; - } - } - DoMeleeAttackIfReady(); - } - - private: - EventMap events; - }; - - CreatureAI* GetAI(Creature* creature) const - { - return new npc_margrave_dhakarAI(creature); - } + case EVENT_INTRO: + { + Talk(SAY_DHAKAR_START); + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY2H); + + if (Creature* morbidus = me->FindNearestCreature(NPC_MORBIDUS, 50.0f, true)) + { + _lichKing = me->SummonCreature(NPC_LICH_KING, morbidus->GetPositionX()+10, morbidus->GetPositionY(), morbidus->GetPositionZ()); + _lichKing->SetFacingTo(morbidus->GetOrientation()); + _lichKing->CastSpell(_lichKing, SPELL_SIMPLE_TELEPORT, true); + } + + _events.ScheduleEvent(EVENT_LK_SAY_1, 5000); + break; + } + case EVENT_LK_SAY_1: + { + _lichKing->AI()->Talk(SAY_LK_1); + _events.ScheduleEvent(EVENT_LK_SAY_2, 5000); + break; + } + case EVENT_LK_SAY_2: + { + _lichKing->AI()->Talk(SAY_LK_2); + _events.ScheduleEvent(EVENT_LK_SAY_3, 5000); + break; + } + case EVENT_LK_SAY_3: + { + _lichKing->AI()->Talk(SAY_LK_3); + _events.ScheduleEvent(EVENT_LK_SAY_4, 5000); + break; + } + case EVENT_LK_SAY_4: + { + _lichKing->AI()->Talk(SAY_LK_4); + _events.ScheduleEvent(EVENT_OUTRO, 12000); + break; + } + case EVENT_LK_SAY_5: + { + _lichKing->AI()->Talk(SAY_LK_5); + _events.ScheduleEvent(EVENT_OUTRO, 8000); + break; + } + case EVENT_OUTRO: + { + if (Creature* olakin = me->FindNearestCreature(NPC_OLAKIN, 50.0f, true)) + olakin->AI()->Talk(SAY_OLAKIN_PAY); + + _lichKing->DespawnOrUnsummon(0); + + _events.ScheduleEvent(EVENT_START, 5000); + break; + } + case EVENT_START: + { + if (Creature* morbidus = me->FindNearestCreature(NPC_MORBIDUS, 50.0f, true)) + { + morbidus->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_ATTACKABLE_1 | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_DISABLE_MOVE); + morbidus->setFaction(FACTION_HOSTILE); + } + + break; + } + } + } + + DoMeleeAttackIfReady(); + } + + private: + EventMap _events; + Creature* _lichKing; + SummonList _summons; + }; + + CreatureAI* GetAI(Creature* creature) const OVERRIDE + { + return new npc_margrave_dhakarAI(creature); + } }; + class npc_morbidus : public CreatureScript { public: @@ -1145,22 +1120,19 @@ class npc_morbidus : public CreatureScript { npc_morbidusAI(Creature* creature) : ScriptedAI(creature) { } - void Reset() - { - if (Creature * dhakar = me->FindNearestCreature(31306, 50.0f, true)) - dhakar->AI()->Reset(); - // this will prevent the event to start without morbidus being alive - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->SetReactState(REACT_PASSIVE); - me->setFaction(FACTION_BASIC); - } - void UpdateAI(uint32 diff) - { - DoMeleeAttackIfReady(); - } - - }; - CreatureAI* GetAI(Creature* creature) const + void Reset() OVERRIDE + { + if (Creature* dhakar = me->FindNearestCreature(NPC_DHAKAR, 50.0f, true)) + dhakar->AI()->Reset(); + + // this will prevent the event to start without morbidus being alive + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->SetReactState(REACT_PASSIVE); + me->setFaction(FACTION_BASIC); + } + }; + + CreatureAI* GetAI(Creature* creature) const OVERRIDE { return new npc_morbidusAI(creature); } @@ -1176,7 +1148,6 @@ void AddSC_icecrown() new npc_tournament_training_dummy; new npc_blessed_banner(); new npc_frostbrood_skytalon(); - new npc_margrave_dhakar(); - new npc_morbidus(); - + new npc_margrave_dhakar(); + new npc_morbidus(); } -- cgit v1.2.3 From 0691a4310f865fe9fdd317f64b5e856a9b6f8ea9 Mon Sep 17 00:00:00 2001 From: Nay Date: Fri, 19 Jul 2013 02:27:56 +0100 Subject: Scripts/Icecrown: Use guid instead of cached Creature* to avoid crashes in npc_margrave_dhakar --- src/server/game/Globals/ObjectMgr.cpp | 2 +- src/server/scripts/Northrend/zone_icecrown.cpp | 30 ++++++++++++++++---------- 2 files changed, 20 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index ae389dd69f2..7bf87a72e8c 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -2179,7 +2179,7 @@ void ObjectMgr::LoadItemTemplates() itemTemplate.Name1 = fields[4].GetString(); itemTemplate.DisplayInfoID = fields[5].GetUInt32(); itemTemplate.Quality = uint32(fields[6].GetUInt8()); - itemTemplate.Flags = uint32(fields[7].GetUInt32()); + itemTemplate.Flags = fields[7].GetUInt32(); itemTemplate.Flags2 = fields[8].GetUInt32(); itemTemplate.BuyCount = uint32(fields[9].GetUInt8()); itemTemplate.BuyPrice = int32(fields[10].GetInt64()); diff --git a/src/server/scripts/Northrend/zone_icecrown.cpp b/src/server/scripts/Northrend/zone_icecrown.cpp index 3b550b0dab3..e736710eced 100644 --- a/src/server/scripts/Northrend/zone_icecrown.cpp +++ b/src/server/scripts/Northrend/zone_icecrown.cpp @@ -997,7 +997,7 @@ class npc_margrave_dhakar : public CreatureScript struct npc_margrave_dhakarAI : public ScriptedAI { - npc_margrave_dhakarAI(Creature* creature) : ScriptedAI(creature) , _summons(me), _lichKing(NULL) { } + npc_margrave_dhakarAI(Creature* creature) : ScriptedAI(creature) , _summons(me), _lichKingGuid(0) { } void Reset() OVERRIDE { @@ -1035,9 +1035,11 @@ class npc_margrave_dhakar : public CreatureScript if (Creature* morbidus = me->FindNearestCreature(NPC_MORBIDUS, 50.0f, true)) { - _lichKing = me->SummonCreature(NPC_LICH_KING, morbidus->GetPositionX()+10, morbidus->GetPositionY(), morbidus->GetPositionZ()); - _lichKing->SetFacingTo(morbidus->GetOrientation()); - _lichKing->CastSpell(_lichKing, SPELL_SIMPLE_TELEPORT, true); + Creature* lichKing = me->SummonCreature(NPC_LICH_KING, morbidus->GetPositionX()+10, morbidus->GetPositionY(), morbidus->GetPositionZ()); + _lichKingGuid = lichKing->GetGUID(); + lichKing = me->SummonCreature(NPC_LICH_KING, morbidus->GetPositionX()+10, morbidus->GetPositionY(), morbidus->GetPositionZ()); + lichKing->SetFacingTo(morbidus->GetOrientation()); + lichKing->CastSpell(_lichKing, SPELL_SIMPLE_TELEPORT, true); } _events.ScheduleEvent(EVENT_LK_SAY_1, 5000); @@ -1045,31 +1047,36 @@ class npc_margrave_dhakar : public CreatureScript } case EVENT_LK_SAY_1: { - _lichKing->AI()->Talk(SAY_LK_1); + if (Creature* lichKing = Unit::GetCreature(*me, _lichKingGuid)) + lichKing->AI()->Talk(SAY_LK_1); _events.ScheduleEvent(EVENT_LK_SAY_2, 5000); break; } case EVENT_LK_SAY_2: { - _lichKing->AI()->Talk(SAY_LK_2); + if (Creature* lichKing = Unit::GetCreature(*me, _lichKingGuid)) + lichKing->AI()->Talk(SAY_LK_2); _events.ScheduleEvent(EVENT_LK_SAY_3, 5000); break; } case EVENT_LK_SAY_3: { - _lichKing->AI()->Talk(SAY_LK_3); + if (Creature* lichKing = Unit::GetCreature(*me, _lichKingGuid)) + lichKing->AI()->Talk(SAY_LK_3); _events.ScheduleEvent(EVENT_LK_SAY_4, 5000); break; } case EVENT_LK_SAY_4: { - _lichKing->AI()->Talk(SAY_LK_4); + if (Creature* lichKing = Unit::GetCreature(*me, _lichKingGuid)) + lichKing->AI()->Talk(SAY_LK_4); _events.ScheduleEvent(EVENT_OUTRO, 12000); break; } case EVENT_LK_SAY_5: { - _lichKing->AI()->Talk(SAY_LK_5); + if (Creature* lichKing = Unit::GetCreature(*me, _lichKingGuid)) + lichKing->AI()->Talk(SAY_LK_5); _events.ScheduleEvent(EVENT_OUTRO, 8000); break; } @@ -1078,7 +1085,8 @@ class npc_margrave_dhakar : public CreatureScript if (Creature* olakin = me->FindNearestCreature(NPC_OLAKIN, 50.0f, true)) olakin->AI()->Talk(SAY_OLAKIN_PAY); - _lichKing->DespawnOrUnsummon(0); + if (Creature* lichKing = Unit::GetCreature(*me, _lichKingGuid)) + lichKing->DespawnOrUnsummon(0); _events.ScheduleEvent(EVENT_START, 5000); break; @@ -1101,7 +1109,7 @@ class npc_margrave_dhakar : public CreatureScript private: EventMap _events; - Creature* _lichKing; + uint64 _lichKingGuid; SummonList _summons; }; -- cgit v1.2.3 From ebd9090d80df3494fe2b023110d402c5bb7a1460 Mon Sep 17 00:00:00 2001 From: Nay Date: Fri, 19 Jul 2013 03:25:52 +0100 Subject: DB/NPCs: Fix Margrave Dhakar equipment --- sql/updates/world/2013_07_18_02_world_the_flesh_giant_slayer.sql | 2 +- sql/updates/world/2013_07_18_03_world_equipment.sql | 4 ++++ src/server/scripts/Northrend/zone_icecrown.cpp | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 sql/updates/world/2013_07_18_03_world_equipment.sql (limited to 'src') diff --git a/sql/updates/world/2013_07_18_02_world_the_flesh_giant_slayer.sql b/sql/updates/world/2013_07_18_02_world_the_flesh_giant_slayer.sql index e79a54598e7..c8d7773c461 100644 --- a/sql/updates/world/2013_07_18_02_world_the_flesh_giant_slayer.sql +++ b/sql/updates/world/2013_07_18_02_world_the_flesh_giant_slayer.sql @@ -15,7 +15,7 @@ UPDATE `creature_template` SET `ScriptName`='npc_morbidus' WHERE `entry`=30698; -- Template updates UPDATE `creature_template` SET `faction_A`=2102, `faction_H`=2102, `exp`=2, `minlevel`=80, `maxlevel`=80, `unit_flags`=`unit_flags`|832, `speed_run`=0.99206, `VehicleId`=271 WHERE `entry`=30698; -- Morbidus -UPDATE `creature_template` SET `faction_A`=1770, `faction_H`=1770, `npcflag`=`npcflag`|1, `equipment_id`=30954, `gossip_menu_id`=10060 WHERE `entry`=31306; -- Margrave Dhakar +UPDATE `creature_template` SET `faction_A`=1770, `faction_H`=1770, `npcflag`=`npcflag`|1, `gossip_menu_id`=10060 WHERE `entry`=31306; -- Margrave Dhakar UPDATE `creature_model_info` SET `bounding_radius`=0.465,`combat_reach`=7.5,`gender`=0 WHERE `modelid`=31176; -- Morbidus UPDATE `creature_model_info` SET `bounding_radius`=0.3825,`combat_reach`=1.875,`gender`=0 WHERE `modelid`=27558; -- Margrave Dhakar diff --git a/sql/updates/world/2013_07_18_03_world_equipment.sql b/sql/updates/world/2013_07_18_03_world_equipment.sql new file mode 100644 index 00000000000..4097327637b --- /dev/null +++ b/sql/updates/world/2013_07_18_03_world_equipment.sql @@ -0,0 +1,4 @@ +-- equipment for Margrave Dhakar +DELETE FROM `creature_equip_template` WHERE `entry` = 31306; +INSERT INTO `creature_equip_template` (`entry`, `id`, `itemEntry1`, `itemEntry2`, `itemEntry3`) VALUES +(31306, 1, 41371, 0, 0); diff --git a/src/server/scripts/Northrend/zone_icecrown.cpp b/src/server/scripts/Northrend/zone_icecrown.cpp index e736710eced..a5d3ed7d0d5 100644 --- a/src/server/scripts/Northrend/zone_icecrown.cpp +++ b/src/server/scripts/Northrend/zone_icecrown.cpp @@ -1039,7 +1039,7 @@ class npc_margrave_dhakar : public CreatureScript _lichKingGuid = lichKing->GetGUID(); lichKing = me->SummonCreature(NPC_LICH_KING, morbidus->GetPositionX()+10, morbidus->GetPositionY(), morbidus->GetPositionZ()); lichKing->SetFacingTo(morbidus->GetOrientation()); - lichKing->CastSpell(_lichKing, SPELL_SIMPLE_TELEPORT, true); + lichKing->CastSpell(lichKing, SPELL_SIMPLE_TELEPORT, true); } _events.ScheduleEvent(EVENT_LK_SAY_1, 5000); -- cgit v1.2.3 From 0b9a8ccef5c4ae8971f097f464e4fbb31a38f279 Mon Sep 17 00:00:00 2001 From: Vlad Date: Fri, 19 Jul 2013 04:03:40 +0100 Subject: Core/Misc: Change creatures and gameobject phasemask from 16 to 32 bits Signed-off-by: Nay --- sql/base/characters_database.sql | 2 +- sql/updates/characters/2013_05_19_00_characters_corpse.sql | 1 + sql/updates/world/2013_05_19_00_world_misc.sql | 2 ++ src/server/game/Entities/Corpse/Corpse.cpp | 4 ++-- src/server/game/Entities/Creature/Creature.cpp | 2 +- src/server/game/Entities/Creature/Creature.h | 2 +- src/server/game/Entities/GameObject/GameObject.cpp | 2 +- src/server/game/Entities/GameObject/GameObject.h | 2 +- src/server/game/Globals/ObjectMgr.cpp | 4 ++-- src/server/scripts/Commands/cs_gobject.cpp | 6 +++--- .../scripts/Northrend/AzjolNerub/Ahnkahet/boss_herald_volazj.cpp | 2 +- 11 files changed, 16 insertions(+), 13 deletions(-) create mode 100644 sql/updates/characters/2013_05_19_00_characters_corpse.sql create mode 100644 sql/updates/world/2013_05_19_00_world_misc.sql (limited to 'src') diff --git a/sql/base/characters_database.sql b/sql/base/characters_database.sql index 46b6a1a2bdb..f414424cfd3 100644 --- a/sql/base/characters_database.sql +++ b/sql/base/characters_database.sql @@ -1339,7 +1339,7 @@ CREATE TABLE `corpse` ( `posZ` float NOT NULL DEFAULT '0', `orientation` float NOT NULL DEFAULT '0', `mapId` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT 'Map Identifier', - `phaseMask` smallint(5) unsigned NOT NULL DEFAULT '1', + `phaseMask` int(10) unsigned NOT NULL DEFAULT '1', `displayId` int(10) unsigned NOT NULL DEFAULT '0', `itemCache` text NOT NULL, `bytes1` int(10) unsigned NOT NULL DEFAULT '0', diff --git a/sql/updates/characters/2013_05_19_00_characters_corpse.sql b/sql/updates/characters/2013_05_19_00_characters_corpse.sql new file mode 100644 index 00000000000..da52c91e875 --- /dev/null +++ b/sql/updates/characters/2013_05_19_00_characters_corpse.sql @@ -0,0 +1 @@ +ALTER TABLE `corpse` CHANGE `phaseMask` `phaseMask` int(10) unsigned NOT NULL DEFAULT '1'; diff --git a/sql/updates/world/2013_05_19_00_world_misc.sql b/sql/updates/world/2013_05_19_00_world_misc.sql new file mode 100644 index 00000000000..b5f08a058e6 --- /dev/null +++ b/sql/updates/world/2013_05_19_00_world_misc.sql @@ -0,0 +1,2 @@ +ALTER TABLE `gameobject` CHANGE `phaseMask` `phaseMask` int(10) unsigned NOT NULL DEFAULT '1'; +ALTER TABLE `creature` CHANGE `phaseMask` `phaseMask` int(10) unsigned NOT NULL DEFAULT '1'; diff --git a/src/server/game/Entities/Corpse/Corpse.cpp b/src/server/game/Entities/Corpse/Corpse.cpp index c38082bb542..ccceec7185b 100644 --- a/src/server/game/Entities/Corpse/Corpse.cpp +++ b/src/server/game/Entities/Corpse/Corpse.cpp @@ -122,7 +122,7 @@ void Corpse::SaveToDB() stmt->setUInt32(index++, uint32(m_time)); // time stmt->setUInt8 (index++, GetType()); // corpseType stmt->setUInt32(index++, GetInstanceId()); // instanceId - stmt->setUInt16(index++, GetPhaseMask()); // phaseMask + stmt->setUInt32(index++, GetPhaseMask()); // phaseMask trans->Append(stmt); CharacterDatabase.CommitTransaction(trans); @@ -186,7 +186,7 @@ bool Corpse::LoadCorpseFromDB(uint32 guid, Field* fields) m_time = time_t(fields[12].GetUInt32()); uint32 instanceId = fields[14].GetUInt32(); - uint32 phaseMask = fields[15].GetUInt16(); + uint32 phaseMask = fields[15].GetUInt32(); // place SetLocationInstanceId(instanceId); diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index 3900f532d5c..b46ee4703db 100644 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -999,7 +999,7 @@ void Creature::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask) stmt->setUInt32(index++, GetEntry()); stmt->setUInt16(index++, uint16(mapid)); stmt->setUInt8(index++, spawnMask); - stmt->setUInt16(index++, uint16(GetPhaseMask())); + stmt->setUInt32(index++, GetPhaseMask()); stmt->setUInt32(index++, displayId); stmt->setInt32(index++, int32(GetCurrentEquipmentId())); stmt->setFloat(index++, GetPositionX()); diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h index 216e9246c0f..34084dd662b 100644 --- a/src/server/game/Entities/Creature/Creature.h +++ b/src/server/game/Entities/Creature/Creature.h @@ -249,7 +249,7 @@ struct CreatureData CreatureData() : dbData(true) {} uint32 id; // entry in creature_template uint16 mapid; - uint16 phaseMask; + uint32 phaseMask; uint32 displayid; int8 equipmentId; float posX; diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index f6fd332e6a4..0915d19cdfa 100644 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -712,7 +712,7 @@ void GameObject::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask) stmt->setUInt32(index++, GetEntry()); stmt->setUInt16(index++, uint16(mapid)); stmt->setUInt8(index++, spawnMask); - stmt->setUInt16(index++, uint16(GetPhaseMask())); + stmt->setUInt32(index++, GetPhaseMask()); stmt->setFloat(index++, GetPositionX()); stmt->setFloat(index++, GetPositionY()); stmt->setFloat(index++, GetPositionZ()); diff --git a/src/server/game/Entities/GameObject/GameObject.h b/src/server/game/Entities/GameObject/GameObject.h index cf916afd6dc..3bddac81ee9 100644 --- a/src/server/game/Entities/GameObject/GameObject.h +++ b/src/server/game/Entities/GameObject/GameObject.h @@ -582,7 +582,7 @@ struct GameObjectData explicit GameObjectData() : dbData(true) {} uint32 id; // entry in gamobject_template uint16 mapid; - uint16 phaseMask; + uint32 phaseMask; float posX; float posY; float posZ; diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 7bf87a72e8c..8a970963c37 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -1561,7 +1561,7 @@ void ObjectMgr::LoadCreatures() data.curmana = fields[13].GetUInt32(); data.movementType = fields[14].GetUInt8(); data.spawnMask = fields[15].GetUInt8(); - data.phaseMask = fields[16].GetUInt16(); + data.phaseMask = fields[16].GetUInt32(); int16 gameEvent = fields[17].GetInt8(); uint32 PoolId = fields[18].GetUInt32(); data.npcflag = fields[19].GetUInt32(); @@ -1913,7 +1913,7 @@ void ObjectMgr::LoadGameobjects() if (data.spawnMask & ~spawnMasks[data.mapid]) TC_LOG_ERROR(LOG_FILTER_SQL, "Table `gameobject` has gameobject (GUID: %u Entry: %u) that has wrong spawn mask %u including not supported difficulty modes for map (Id: %u), skip", guid, data.id, data.spawnMask, data.mapid); - data.phaseMask = fields[15].GetUInt16(); + data.phaseMask = fields[15].GetUInt32(); int16 gameEvent = fields[16].GetInt8(); uint32 PoolId = fields[17].GetUInt32(); diff --git a/src/server/scripts/Commands/cs_gobject.cpp b/src/server/scripts/Commands/cs_gobject.cpp index 18dee2ea324..8ae2e7b4dfb 100644 --- a/src/server/scripts/Commands/cs_gobject.cpp +++ b/src/server/scripts/Commands/cs_gobject.cpp @@ -279,8 +279,8 @@ public: bool found = false; float x, y, z, o; - uint32 guidLow, id; - uint16 mapId, phase; + uint32 guidLow, id, phase; + uint16 mapId; uint32 poolId; do @@ -293,7 +293,7 @@ public: z = fields[4].GetFloat(); o = fields[5].GetFloat(); mapId = fields[6].GetUInt16(); - phase = fields[7].GetUInt16(); + phase = fields[7].GetUInt32(); poolId = sPoolMgr->IsPartOfAPool(guidLow); if (!poolId || sPoolMgr->IsSpawnedObject(guidLow)) found = true; diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_herald_volazj.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_herald_volazj.cpp index 9a96e787f87..481df79c890 100644 --- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_herald_volazj.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_herald_volazj.cpp @@ -216,7 +216,7 @@ public: void SummonedCreatureDespawn(Creature* summon) OVERRIDE { - uint32 phase= summon->GetPhaseMask(); + uint32 phase = summon->GetPhaseMask(); uint32 nextPhase = 0; Summons.Despawn(summon); -- cgit v1.2.3 From 1ac4f0a9c1d6bfd3d0432a76de415feb5349a821 Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Fri, 19 Jul 2013 14:01:25 +0200 Subject: SQL: Rename in correct name --- sql/updates/characters/2013_05_19_00_characters_corpse.sql | 1 - sql/updates/characters/2013_07_19_00_characters_corpse.sql | 1 + sql/updates/world/2013_05_19_00_world_misc.sql | 2 -- sql/updates/world/2013_07_19_00_world_misc.sql | 2 ++ src/server/scripts/Spells/spell_generic.cpp | 2 +- 5 files changed, 4 insertions(+), 4 deletions(-) delete mode 100644 sql/updates/characters/2013_05_19_00_characters_corpse.sql create mode 100644 sql/updates/characters/2013_07_19_00_characters_corpse.sql delete mode 100644 sql/updates/world/2013_05_19_00_world_misc.sql create mode 100644 sql/updates/world/2013_07_19_00_world_misc.sql (limited to 'src') diff --git a/sql/updates/characters/2013_05_19_00_characters_corpse.sql b/sql/updates/characters/2013_05_19_00_characters_corpse.sql deleted file mode 100644 index da52c91e875..00000000000 --- a/sql/updates/characters/2013_05_19_00_characters_corpse.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE `corpse` CHANGE `phaseMask` `phaseMask` int(10) unsigned NOT NULL DEFAULT '1'; diff --git a/sql/updates/characters/2013_07_19_00_characters_corpse.sql b/sql/updates/characters/2013_07_19_00_characters_corpse.sql new file mode 100644 index 00000000000..da52c91e875 --- /dev/null +++ b/sql/updates/characters/2013_07_19_00_characters_corpse.sql @@ -0,0 +1 @@ +ALTER TABLE `corpse` CHANGE `phaseMask` `phaseMask` int(10) unsigned NOT NULL DEFAULT '1'; diff --git a/sql/updates/world/2013_05_19_00_world_misc.sql b/sql/updates/world/2013_05_19_00_world_misc.sql deleted file mode 100644 index b5f08a058e6..00000000000 --- a/sql/updates/world/2013_05_19_00_world_misc.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE `gameobject` CHANGE `phaseMask` `phaseMask` int(10) unsigned NOT NULL DEFAULT '1'; -ALTER TABLE `creature` CHANGE `phaseMask` `phaseMask` int(10) unsigned NOT NULL DEFAULT '1'; diff --git a/sql/updates/world/2013_07_19_00_world_misc.sql b/sql/updates/world/2013_07_19_00_world_misc.sql new file mode 100644 index 00000000000..b5f08a058e6 --- /dev/null +++ b/sql/updates/world/2013_07_19_00_world_misc.sql @@ -0,0 +1,2 @@ +ALTER TABLE `gameobject` CHANGE `phaseMask` `phaseMask` int(10) unsigned NOT NULL DEFAULT '1'; +ALTER TABLE `creature` CHANGE `phaseMask` `phaseMask` int(10) unsigned NOT NULL DEFAULT '1'; diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 2356d5d27f4..13a19ca5b23 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -3679,8 +3679,8 @@ void AddSC_generic_spell_scripts() new spell_gen_clone_weapon(); new spell_gen_clone_weapon_aura(); new spell_gen_count_pct_from_max_hp("spell_gen_default_count_pct_from_max_hp"); - new spell_gen_count_pct_from_max_hp("spell_gen_50pct_count_pct_from_max_hp", 50); new spell_gen_count_pct_from_max_hp("spell_gen_30pct_count_pct_from_max_hp", 30); + new spell_gen_count_pct_from_max_hp("spell_gen_50pct_count_pct_from_max_hp", 50); new spell_gen_create_lance(); new spell_gen_creature_permanent_feign_death(); new spell_gen_dalaran_disguise("spell_gen_sunreaver_disguise"); -- cgit v1.2.3