From 4e9b65f5731179e1bb2c20f9f9d50cacb9a12085 Mon Sep 17 00:00:00 2001 From: Ovah Date: Wed, 27 Dec 2017 12:43:15 +0000 Subject: [PATCH] Scripts/Gilneas: --- .../world/4.3.4/2017_12_27_01_world.sql | 77 ++++++++++ .../EasternKingdoms/Gilneas/chapter1.cpp | 143 ++++++++++++++++++ .../eastern_kingdoms_script_loader.cpp | 2 + src/server/scripts/Spells/spell_quest.cpp | 37 +++++ 4 files changed, 259 insertions(+) create mode 100644 sql/updates/world/4.3.4/2017_12_27_01_world.sql create mode 100644 src/server/scripts/EasternKingdoms/Gilneas/chapter1.cpp diff --git a/sql/updates/world/4.3.4/2017_12_27_01_world.sql b/sql/updates/world/4.3.4/2017_12_27_01_world.sql new file mode 100644 index 0000000000..fa1c7a8761 --- /dev/null +++ b/sql/updates/world/4.3.4/2017_12_27_01_world.sql @@ -0,0 +1,77 @@ +DELETE FROM `spell_area` WHERE `spell`= 59073 AND `area` IN (4756, 4755, 4757, 4714); +INSERT INTO `spell_area` (`spell`, `area`, `gender`, `quest_start`, `quest_start_status`, `autocast`, `quest_end`, `quest_end_status`) VALUES +(59073, 4756, 2, 14078, 64, 1, 14159, 1|2|8|32), +(59073, 4755, 2, 14099, 2|64, 1, 14159, 1|2|8|32), +(59073, 4757, 2, 14099, 2|64, 1, 14159, 1|2|8|32), +(59073, 4714, 2, 14099, 2|64, 1, 14159, 1|2|8|32); + +DELETE FROM `spell_area` WHERE `spell`= 49416 AND `area`= 4756; +INSERT INTO `spell_area` (`spell`, `area`, `gender`, `quest_start`, `quest_start_status`, `autocast`, `quest_end`, `quest_end_status`) VALUES +(49416, 4756, 2, 14078, 64, 1, 14099, 1|8|32); + +-- Generic NPC phasing fixups +UPDATE `creature` SET `phaseId`= 0, `phaseGroup`= 371 WHERE `id` IN (39095, 34863); + +-- Generic trigger bunny (multiphase) +UPDATE `creature` SET `phaseId`= 0, `phaseGroup`= 372 WHERE `id` IN (35374, 35830, 35010, 35011) AND `map`= 654 AND `areaId`= 4756; + +-- Conditions +DELETE FROM `conditions` WHERE `SourceEntry` IN (68087, 68070, 80281) AND `SourceTypeOrReferenceId`= 13; +INSERT INTO conditions (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ScriptName`, `Comment`) VALUES +(13, 1, 68087, 0, 0, 31, 0, 3, 35374, 0, 0, 0, '', 'Just Citizen'), +(13, 1, 80281, 0, 0, 31, 0, 3, 35374, 0, 0, 0, '', 'Summon Citizen and Worgen'), +(13, 3, 68070, 0, 0, 31, 0, 3, 35374, 0, 0, 0, '', 'Summon Citizen and Worgen'); + +DELETE FROM `spell_script_names` WHERE `ScriptName` IN ( +'spell_q14098_knocking_67869'); + +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(67869, 'spell_q14098_knocking_67869'); + +DELETE FROM `smart_scripts` WHERE `entryorguid`= 34981; +UPDATE `creature_template` SET `AIName`= '', `ScriptName`= 'npc_frightened_citizen' WHERE `entry` IN (34981, 35836); + +-- Rampaging Worgen fixups +UPDATE `creature_template` SET `flags_extra` = `flags_extra` | 2 WHERE `entry`= 34884; + +-- Merchant Square Quest Chain +DELETE FROM `quest_template_addon` WHERE `ID` IN (14093, 14098, 14099, 14094); +INSERT INTO `quest_template_addon` (`ID`, `PrevQuestID`, `NextQuestID`, `ExclusiveGroup`) VALUES +(14093, 14091, 0, -14093), +(14098, 14091, 0, -14093), +(14094, 14091, 0, -14093), +(14099, 14093, 0, 0); -- Royal Orders + +-- Remove questgiver entry from rampaging worgens +DELETE FROM `creature_queststarter` WHERE `id`= 34884; + +DELETE FROM `creature_text` WHERE `CreatureID` IN (34981, 35836, 34913); +INSERT INTO `creature_text` (`CreatureID`, `groupid`, `id`, `text`, `type`, `language`, `probability`, `emote`, `duration`, `sound`, `BroadcastTextId`, `comment`) VALUES +-- Frightened Citizen +(34981, 0, 0, 'What in the world? Let''s get out of here!', 12, 0, 100, 1, 0, 0, 35235, 'Frightened Citizen to Player'), +(34981, 0, 1, 'Let''s go!', 12, 0, 100, 1, 0, 0, 35236, 'Frightened Citizen to Player'), +(34981, 0, 2, 'No time to waste!', 12, 0, 100, 1, 0, 0, 35237, 'Frightened Citizen to Player'), +(34981, 0, 3, 'Worgen! Worgen everywhere!', 12, 0, 100, 1, 0, 0, 35238, 'Frightened Citizen to Player'), +(34981, 0, 4, 'Flee! They''re everywhere!', 12, 0, 100, 1, 0, 0, 35240, 'Frightened Citizen to Player'), +(34981, 0, 5, 'This place isn''t safe. Let''s leave!', 12, 0, 100, 1, 0, 0, 35239, 'Frightened Citizen to Player'), +(34981, 0, 6, 'Protect me, please!', 12, 0, 100, 1, 0, 0, 35234, 'Frightened Citizen to Player'), +(35836, 0, 0, 'It''s coming right for me!!', 12, 0, 100, 1, 0, 0, 36037, 'Frightened Citizen to Player'), +(35836, 0, 1, 'Help me, please!', 12, 0, 100, 1, 0, 0, 36038, 'Frightened Citizen to Player'), +(35836, 0, 2, 'There''s one after me!', 12, 0, 100, 1, 0, 0, 36039, 'Frightened Citizen to Player'), +(35836, 0, 3, 'Help!', 12, 0, 100, 1, 0, 0, 36040, 'Frightened Citizen to Player'), +(35836, 0, 4, 'I don''t want to die!', 12, 0, 100, 1, 0, 0, 36041, 'Frightened Citizen to Player'), +-- Liam Greyman Phase 170 +(34913, 0, 0, 'Stand your ground, men!', 14, 0, 100, 0, 0, 19617, 35166, 'Prince Liam Greymane'), +(34913, 0, 1, 'Defeat these foul beasts!', 14, 0, 100, 0, 0, 19618, 35167, 'Prince Liam Greymane'), +(34913, 0, 2, 'Protect the civilians!', 14, 0, 100, 0, 0, 19619, 35168, 'Prince Liam Greymane'), +(34913, 0, 3, 'Push them back!', 14, 0, 100, 0, 0, 19620, 35169, 'Prince Liam Greymane'), +(34913, 0, 4, 'Take heart, men! We must protect our city!', 14, 0, 100, 0, 0, 19621, 35170, 'Prince Liam Greymane'); + +-- Creature Prince Liam Greymane 34913 SAI +SET @ENTRY := 34913; +UPDATE `creature_template` SET `AIName`="SmartAI" WHERE `entry`= @ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY AND `source_type`=0; +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(@ENTRY, 0, 0, 0, 4, 0, 100, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "On aggro - None: Talk 0 // "); + +UPDATE `gameobject_template_addon` SET `flags`= 4 WHERE `entry`= 195306; diff --git a/src/server/scripts/EasternKingdoms/Gilneas/chapter1.cpp b/src/server/scripts/EasternKingdoms/Gilneas/chapter1.cpp new file mode 100644 index 0000000000..64dff86ab6 --- /dev/null +++ b/src/server/scripts/EasternKingdoms/Gilneas/chapter1.cpp @@ -0,0 +1,143 @@ +/* +* Copyright (C) 2008-2017 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 "ScriptedCreature.h" +#include "ScriptedGossip.h" +#include "Vehicle.h" +#include "ObjectMgr.h" +#include "ScriptedEscortAI.h" +#include "CombatAI.h" +#include "PassiveAI.h" +#include "Player.h" +#include "SpellInfo.h" +#include "CreatureTextMgr.h" +#include "MoveSplineInit.h" +#include "GameObjectAI.h" + +/*###### +##Quest 14098 - Evacuate the Merchant Place +######*/ + +enum FrightenedCitizen +{ + SAY_FRIGHTENED_CITIZEN_RESCUE = 0, + + NPC_EVACUATION_STALKER_FIRST = 35830, + NPC_EVACUATION_STALKER_NEAR = 35010, + NPC_EVACUATION_STALKER_FAR = 35011, + NPC_RAMPAGING_WORGEN = 35660, + + CREDIT_35830 = 35830, + + POINT_STALKER_FIRST = 1, + POINT_STALKER_NEAR = 2, + POINT_STALKER_FAR = 3, + + EVENT_TALK_FRIGHTENED = 1, + EVENT_MOVE_TO_NEAR_STALKER = 2, + EVENT_MOVE_TO_FAR_STALKER = 3, + EVENT_DESPAWN = 4 +}; + +class npc_frightened_citizen : public CreatureScript +{ +public: + npc_frightened_citizen() : CreatureScript("npc_frightened_citizen") { } + + struct npc_frightened_citizenAI : public PassiveAI + { + npc_frightened_citizenAI(Creature* creature) : PassiveAI(creature) { } + + void IsSummonedBy(Unit* /*summoner*/) override + { + if (Creature* stalkerNear = me->FindNearestCreature(NPC_EVACUATION_STALKER_FIRST, 25.0f)) + me->GetMotionMaster()->MovePoint(POINT_STALKER_FIRST, stalkerNear->GetPosition(), true); + } + + void MovementInform(uint32 type, uint32 id) override + { + if (type != POINT_MOTION_TYPE) + return; + + switch (id) + { + case POINT_STALKER_FIRST: + _events.ScheduleEvent(EVENT_TALK_FRIGHTENED, Seconds(1)); + break; + case POINT_STALKER_NEAR: + _events.ScheduleEvent(EVENT_MOVE_TO_FAR_STALKER, Milliseconds(1)); + break; + case POINT_STALKER_FAR: + _events.ScheduleEvent(EVENT_DESPAWN, Milliseconds(1)); + break; + default: + break; + } + } + + void UpdateAI(uint32 diff) override + { + _events.Update(diff); + + while (uint32 eventId = _events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_TALK_FRIGHTENED: + if (Unit* summoner = me->ToTempSummon()->GetSummoner()) + { + if (Player* player = summoner->ToPlayer()) + { + player->KilledMonsterCredit(CREDIT_35830); + Talk(SAY_FRIGHTENED_CITIZEN_RESCUE, summoner); + } + } + _events.ScheduleEvent(EVENT_MOVE_TO_NEAR_STALKER, Seconds(2)); + break; + case EVENT_MOVE_TO_NEAR_STALKER: + if (Creature* stalker = me->FindNearestCreature(NPC_EVACUATION_STALKER_FAR, 50.0f)) + me->GetMotionMaster()->MovePoint(POINT_STALKER_FAR, stalker->GetPosition(), true); + else if (Creature* stalker = me->FindNearestCreature(NPC_EVACUATION_STALKER_NEAR, 100.0f)) + me->GetMotionMaster()->MovePoint(POINT_STALKER_NEAR, stalker->GetPosition(), true); + break; + case EVENT_MOVE_TO_FAR_STALKER: + if (Creature* stalker = me->FindNearestCreature(NPC_EVACUATION_STALKER_FAR, 500.0f)) + me->GetMotionMaster()->MovePoint(POINT_STALKER_FAR, stalker->GetPosition(), true); + break; + case EVENT_DESPAWN: + me->DespawnOrUnsummon(); + break; + default: + break; + } + } + } + private: + EventMap _events; + }; + + CreatureAI* GetAI(Creature* creature) const override + { + return new npc_frightened_citizenAI(creature); + } +}; + +void AddSC_gilneas_c1() +{ + new npc_frightened_citizen(); +} diff --git a/src/server/scripts/EasternKingdoms/eastern_kingdoms_script_loader.cpp b/src/server/scripts/EasternKingdoms/eastern_kingdoms_script_loader.cpp index bdef2ad9f5..509c75ccb9 100644 --- a/src/server/scripts/EasternKingdoms/eastern_kingdoms_script_loader.cpp +++ b/src/server/scripts/EasternKingdoms/eastern_kingdoms_script_loader.cpp @@ -70,6 +70,7 @@ void AddSC_instance_blackwing_lair(); void AddSC_deadmines(); //Deadmines void AddSC_instance_deadmines(); void AddSC_boss_mr_smite(); +void AddSC_gilneas_c1(); //Gilneas void AddSC_gnomeregan(); //Gnomeregan void AddSC_instance_gnomeregan(); void AddSC_boss_attumen(); //Karazhan @@ -260,6 +261,7 @@ void AddEasternKingdomsScripts() AddSC_deadmines(); //Deadmines AddSC_boss_mr_smite(); AddSC_instance_deadmines(); + AddSC_gilneas_c1(); //Gilneas AddSC_gnomeregan(); //Gnomeregan AddSC_instance_gnomeregan(); AddSC_boss_attumen(); //Karazhan diff --git a/src/server/scripts/Spells/spell_quest.cpp b/src/server/scripts/Spells/spell_quest.cpp index 3cef4f9182..7188a69e4f 100644 --- a/src/server/scripts/Spells/spell_quest.cpp +++ b/src/server/scripts/Spells/spell_quest.cpp @@ -2752,6 +2752,42 @@ public: } }; +class spell_q14098_knocking_67869 : public SpellScriptLoader +{ +public: + spell_q14098_knocking_67869() : SpellScriptLoader("spell_q14098_knocking_67869") { } + + class spell_q14098_knocking_67869_SpellScript : public SpellScript + { + PrepareSpellScript(spell_q14098_knocking_67869_SpellScript); + + bool Validate(SpellInfo const* spellInfo) override + { + return ValidateSpellInfo( + { + uint32(spellInfo->Effects[EFFECT_1].BasePoints), + uint32(spellInfo->Effects[EFFECT_2].BasePoints) + }); + } + + void HandleEffect(SpellEffIndex /*effIndex*/) + { + if (SpellInfo const* spellInfo = GetSpellInfo()) + GetCaster()->CastSpell(GetCaster(), spellInfo->Effects[RAND(0, 1) == 0 ? EFFECT_1 : EFFECT_2].BasePoints, true); + } + + void Register() override + { + OnEffectHit += SpellEffectFn(spell_q14098_knocking_67869_SpellScript::HandleEffect, EFFECT_2, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; + + SpellScript* GetSpellScript() const override + { + return new spell_q14098_knocking_67869_SpellScript(); + } +}; + void AddSC_quest_spell_scripts() { new spell_q55_sacred_cleansing(); @@ -2820,4 +2856,5 @@ void AddSC_quest_spell_scripts() new spell_q11306_mixing_vrykul_blood(); new spell_q11306_failed_mix_43376(); new spell_q11306_failed_mix_43378(); + new spell_q14098_knocking_67869(); }