aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sql/updates/world/2015_03_17_02_world.sql35
-rw-r--r--src/server/scripts/EasternKingdoms/zone_undercity.cpp242
2 files changed, 170 insertions, 107 deletions
diff --git a/sql/updates/world/2015_03_17_02_world.sql b/sql/updates/world/2015_03_17_02_world.sql
new file mode 100644
index 00000000000..79d0b382d12
--- /dev/null
+++ b/sql/updates/world/2015_03_17_02_world.sql
@@ -0,0 +1,35 @@
+DELETE FROM `creature_text` WHERE `entry` = 16287 AND `groupid`= 0;
+DELETE FROM `creature_text` WHERE `entry` = 10181 AND `groupid` = 2;
+INSERT INTO `creature_text` (`entry`, `groupid`, `id`, `text`, `type`, `language`, `probability`, `emote`, `duration`, `sound`, `BroadcastTextId`, `TextRange`, `comment`) VALUES
+(16287, 0, 0, 'That could have gone better. $n, come here, please. I have something I need you to take care of for me.', 15, 0, 100, 0, 0, 0, 12157, 0, 'Ambassador Sunsorrow SAY_SUNSORROW_WHISPER'),
+(10181, 2, 0, '%s looks down at the discarded necklace. In her sadness, the lady incants a glamour, which beckons forth Highborne spirits. The chamber resonates with their ancient song about the Sin''dorei...', 16, 0, 100, 0, 0, 0, 19197, 0, 'Lady Sylvanas Windrunner EMOTE_LAMENT');
+
+DELETE FROM `gossip_menu_option` WHERE `menu_id` = 7178 AND `id`= 0;
+INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `OptionBroadcastTextID`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `box_coded`, `box_money`, `box_text`, `BoxBroadcastTextId`) VALUES
+(7178, 0, 0, 'What is it that you have for me, ambassador?', 19205, 1, 1, 7178, 0, 0, 0, '', 0);
+
+UPDATE `creature_template` SET `AIName` = 'SmartAI' WHERE `entry` = 16287;
+DELETE FROM `smart_scripts` WHERE `entryorguid` = 16287 AND `source_type` = 0 AND `id` IN (0, 1, 2);
+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
+(16287,0,0,1,62,0,100,0,7178,0,0,0,11,37084,1,0,0,0,0,7,0,0,0,0,0,0,0,'Ambassador Sunsorrow - On Gossip Option 0 Selected - Create Item \'Lament of the Highborne\''),
+(16287,0,1,0,61,0,100,0,0,0,0,0,98,7178,10378,0,0,0,0,7,0,0,0,0,0,0,0,'Ambassador Sunsorrow - On Gossip Option 0 Selected - SEND_GOSSIP_MENU TEXT'),
+(16287,0,2,0,64,0,100,0,0,0,0,0,98,7178,8458,0,0,0,0,7,0,0,0,0,0,0,0,'Ambassador Sunsorrow - On Gossip Hello - SEND_GOSSIP_MENU TEXT');
+
+DELETE FROM `npc_text` WHERE `id` IN (10378, 8458);
+INSERT INTO `npc_text` (`id`, `text0_0`, `text0_1`, `prob0`, `em0_1`, `BroadcastTextID0`) VALUES
+(8458, "Greetings, $r. I am Ambassador Sunsorrow of the sin'dorei, or blood elves as we are commonly known. I have high hopes that this new bond between us and the Horde will be mutually beneficial.", "Greetings, $r. I am Ambassador Sunsorrow of the sin'dorei, or blood elves as we are commonly known. I have high hopes that this new bond between us and the Horde will be mutually beneficial.", 1, 2, 12161),
+(10378, "Just a small songbook that I thought you might like to have. It contains the lyrics to a song known as the Lament of the Highborne; the one that Lady Sylvanas glamoured from the air.", "", 1, 1, 19206);
+
+DELETE FROM `gossip_menu` WHERE `entry`=7178 AND `text_id` IN (10378, 8458, 8740);
+INSERT INTO `gossip_menu` (`entry`, `text_id`) VALUES
+(7178,10378),
+(7178,8740),
+(7178,8458);
+
+DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId` = 15 AND `SourceGroup` = 7178 AND `SourceEntry` = 0 AND `SourceId` = 0;
+INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES
+(15, 7178, 0, 0, 0, 8, 0, 9180, 0, 0, 0, 0, 0, '', 'Ambassador Sunsorrow show gossip only if quest Journey to Undercity is rewarded'),
+(15, 7178, 0, 0, 0, 16, 0, 512, 0, 0, 0, 0, 0, '', 'Ambassador Sunsorrow show gossip only if player is Blood Elf'),
+(15, 7178, 0, 0, 0, 2, 0, 30632, 1, 0, 1, 0, 0, '', 'Ambassador Sunsorrow show gossip only if player doesn\'t have item Lament of Highborn');
+
+UPDATE `creature_text` SET `type` = 12 WHERE `entry` = 10181 AND `groupid` = 1;
diff --git a/src/server/scripts/EasternKingdoms/zone_undercity.cpp b/src/server/scripts/EasternKingdoms/zone_undercity.cpp
index 9ce694fb76c..ca281bab60a 100644
--- a/src/server/scripts/EasternKingdoms/zone_undercity.cpp
+++ b/src/server/scripts/EasternKingdoms/zone_undercity.cpp
@@ -40,25 +40,44 @@ EndContentData */
enum Sylvanas
{
- QUEST_JOURNEY_TO_UNDERCITY = 9180,
- EMOTE_LAMENT_END = 0,
- SAY_LAMENT_END = 1,
+ QUEST_JOURNEY_TO_UNDERCITY = 9180,
- SOUND_CREDIT = 10896,
- ENTRY_HIGHBORNE_LAMENTER = 21628,
- ENTRY_HIGHBORNE_BUNNY = 21641,
+ EMOTE_LAMENT_END = 0,
+ SAY_LAMENT_END = 1,
+ EMOTE_LAMENT = 2,
- SPELL_HIGHBORNE_AURA = 37090,
- SPELL_SYLVANAS_CAST = 36568,
- SPELL_RIBBON_OF_SOULS = 34432, // the real one to use might be 37099
+ // Ambassador Sunsorrow
+ SAY_SUNSORROW_WHISPER = 0,
+
+ SOUND_CREDIT = 10896,
+
+ NPC_HIGHBORNE_LAMENTER = 21628,
+ NPC_HIGHBORNE_BUNNY = 21641,
+ NPC_AMBASSADOR_SUNSORROW = 16287,
+
+ SPELL_HIGHBORNE_AURA = 37090,
+ SPELL_SYLVANAS_CAST = 36568,
+ //SPELL_RIBBON_OF_SOULS = 34432, the real one to use might be 37099
+ SPELL_RIBBON_OF_SOULS = 37099,
// Combat spells
- SPELL_BLACK_ARROW = 59712,
- SPELL_FADE = 20672,
- SPELL_FADE_BLINK = 29211,
- SPELL_MULTI_SHOT = 59713,
- SPELL_SHOT = 59710,
- SPELL_SUMMON_SKELETON = 59711
+ SPELL_BLACK_ARROW = 59712,
+ SPELL_FADE = 20672,
+ SPELL_FADE_BLINK = 29211,
+ SPELL_MULTI_SHOT = 59713,
+ SPELL_SHOT = 59710,
+ SPELL_SUMMON_SKELETON = 59711,
+
+ // Events
+ EVENT_FADE = 1,
+ EVENT_SUMMON_SKELETON = 2,
+ EVENT_BLACK_ARROW = 3,
+ EVENT_SHOOT = 4,
+ EVENT_MULTI_SHOT = 5,
+ EVENT_LAMENT_OF_THE_HIGHBORN = 6,
+ EVENT_SUNSORROW_WHISPER = 7,
+
+ GUID_EVENT_INVOKER = 1,
};
float HighborneLoc[4][3]=
@@ -77,26 +96,14 @@ class npc_lady_sylvanas_windrunner : public CreatureScript
public:
npc_lady_sylvanas_windrunner() : CreatureScript("npc_lady_sylvanas_windrunner") { }
- bool OnQuestReward(Player* /*player*/, Creature* creature, const Quest *_Quest, uint32 /*slot*/) override
+ bool OnQuestReward(Player* player, Creature* creature, const Quest *_Quest, uint32 /*slot*/) override
{
if (_Quest->GetQuestId() == QUEST_JOURNEY_TO_UNDERCITY)
- {
- ENSURE_AI(npc_lady_sylvanas_windrunner::npc_lady_sylvanas_windrunnerAI, creature->AI())->LamentEvent = true;
- ENSURE_AI(npc_lady_sylvanas_windrunner::npc_lady_sylvanas_windrunnerAI, creature->AI())->DoPlaySoundToSet(creature, SOUND_CREDIT);
- creature->CastSpell(creature, SPELL_SYLVANAS_CAST, false);
-
- for (uint8 i = 0; i < 4; ++i)
- creature->SummonCreature(ENTRY_HIGHBORNE_LAMENTER, HighborneLoc[i][0], HighborneLoc[i][1], HIGHBORNE_LOC_Y, HighborneLoc[i][2], TEMPSUMMON_TIMED_DESPAWN, 160000);
- }
+ creature->AI()->SetGUID(player->GetGUID(), GUID_EVENT_INVOKER);
return true;
}
- CreatureAI* GetAI(Creature* creature) const override
- {
- return new npc_lady_sylvanas_windrunnerAI(creature);
- }
-
struct npc_lady_sylvanas_windrunnerAI : public ScriptedAI
{
npc_lady_sylvanas_windrunnerAI(Creature* creature) : ScriptedAI(creature)
@@ -106,41 +113,51 @@ public:
void Initialize()
{
- LamentEventTimer = 5000;
LamentEvent = false;
targetGUID.Clear();
-
- FadeTimer = 30000;
- SummonSkeletonTimer = 20000;
- BlackArrowTimer = 15000;
- ShotTimer = 8000;
- MultiShotTimer = 10000;
+ playerGUID.Clear();
}
- uint32 LamentEventTimer;
- bool LamentEvent;
- ObjectGuid targetGUID;
-
- uint32 FadeTimer;
- uint32 SummonSkeletonTimer;
- uint32 BlackArrowTimer;
- uint32 ShotTimer;
- uint32 MultiShotTimer;
-
void Reset() override
{
Initialize();
+ _events.Reset();
}
- void EnterCombat(Unit* /*who*/) override { }
+ void EnterCombat(Unit* /*who*/) override
+ {
+ _events.ScheduleEvent(EVENT_FADE, 30000);
+ _events.ScheduleEvent(EVENT_SUMMON_SKELETON, 20000);
+ _events.ScheduleEvent(EVENT_BLACK_ARROW, 15000);
+ _events.ScheduleEvent(EVENT_SHOOT, 8000);
+ _events.ScheduleEvent(EVENT_MULTI_SHOT, 10000);
+ }
+
+ void SetGUID(ObjectGuid guid, int32 type) override
+ {
+ if (type == GUID_EVENT_INVOKER)
+ {
+ Talk(EMOTE_LAMENT);
+ DoPlaySoundToSet(me, SOUND_CREDIT);
+ DoCast(me, SPELL_SYLVANAS_CAST, false);
+ playerGUID = guid;
+ LamentEvent = true;
+
+ for (uint8 i = 0; i < 4; ++i)
+ me->SummonCreature(NPC_HIGHBORNE_LAMENTER, HighborneLoc[i][0], HighborneLoc[i][1], HIGHBORNE_LOC_Y, HighborneLoc[i][2], TEMPSUMMON_TIMED_DESPAWN, 160000);
+
+ _events.ScheduleEvent(EVENT_LAMENT_OF_THE_HIGHBORN, 2000);
+ _events.ScheduleEvent(EVENT_SUNSORROW_WHISPER, 10000);
+ }
+ }
void JustSummoned(Creature* summoned) override
{
- if (summoned->GetEntry() == ENTRY_HIGHBORNE_BUNNY)
+ if (summoned->GetEntry() == NPC_HIGHBORNE_BUNNY)
{
if (Creature* target = ObjectAccessor::GetCreature(*summoned, targetGUID))
{
- target->MonsterMoveWithSpeed(target->GetPositionX(), target->GetPositionY(), me->GetPositionZ()+15.0f, 0);
+ target->GetMotionMaster()->MoveJump(target->GetPositionX(), target->GetPositionY(), me->GetPositionZ() + 15.0f, 0);
target->SetPosition(target->GetPositionX(), target->GetPositionY(), me->GetPositionZ()+15.0f, 0.0f);
summoned->CastSpell(target, SPELL_RIBBON_OF_SOULS, false);
}
@@ -152,75 +169,86 @@ public:
void UpdateAI(uint32 diff) override
{
- if (LamentEvent)
- {
- if (LamentEventTimer <= diff)
- {
- DoSummon(ENTRY_HIGHBORNE_BUNNY, me, 10.0f, 3000, TEMPSUMMON_TIMED_DESPAWN);
-
- LamentEventTimer = 2000;
- if (!me->HasAura(SPELL_SYLVANAS_CAST))
- {
- Talk(SAY_LAMENT_END);
- Talk(EMOTE_LAMENT_END);
- LamentEvent = false;
- }
- } else LamentEventTimer -= diff;
- }
-
- if (!UpdateVictim())
+ if (!UpdateVictim() && !LamentEvent)
return;
- // Combat spells
-
- if (FadeTimer <= diff)
- {
- DoCast(me, SPELL_FADE);
- // add a blink to simulate a stealthed movement and reappearing elsewhere
- DoCast(me, SPELL_FADE_BLINK);
- FadeTimer = 30000 + rand32() % 5000;
- // if the victim is out of melee range she cast multi shot
- if (Unit* victim = me->GetVictim())
- if (me->GetDistance(victim) > 10.0f)
- DoCast(victim, SPELL_MULTI_SHOT);
- } else FadeTimer -= diff;
-
- if (SummonSkeletonTimer <= diff)
- {
- DoCast(me, SPELL_SUMMON_SKELETON);
- SummonSkeletonTimer = 20000 + rand32() % 10000;
- } else SummonSkeletonTimer -= diff;
-
- if (BlackArrowTimer <= diff)
- {
- if (Unit* victim = me->GetVictim())
- {
- DoCast(victim, SPELL_BLACK_ARROW);
- BlackArrowTimer = 15000 + rand32() % 5000;
- }
- } else BlackArrowTimer -= diff;
+ _events.Update(diff);
- if (ShotTimer <= diff)
- {
- if (Unit* victim = me->GetVictim())
- {
- DoCast(victim, SPELL_SHOT);
- ShotTimer = 8000 + rand32() % 2000;
- }
- } else ShotTimer -= diff;
+ if (me->HasUnitState(UNIT_STATE_CASTING))
+ return;
- if (MultiShotTimer <= diff)
+ while (uint32 eventId = _events.ExecuteEvent())
{
- if (Unit* victim = me->GetVictim())
+ switch (eventId)
{
- DoCast(victim, SPELL_MULTI_SHOT);
- MultiShotTimer = 10000 + rand32() % 3000;
+ case EVENT_FADE:
+ DoCast(me, SPELL_FADE);
+ // add a blink to simulate a stealthed movement and reappearing elsewhere
+ DoCast(me, SPELL_FADE_BLINK);
+ // if the victim is out of melee range she cast multi shot
+ if (Unit* victim = me->GetVictim())
+ if (me->GetDistance(victim) > 10.0f)
+ DoCast(victim, SPELL_MULTI_SHOT);
+ _events.ScheduleEvent(EVENT_FADE, urand(30000, 35000));
+ break;
+ case EVENT_SUMMON_SKELETON:
+ DoCast(me, SPELL_SUMMON_SKELETON);
+ _events.ScheduleEvent(EVENT_SUMMON_SKELETON, urand(20000, 30000));
+ break;
+ case EVENT_BLACK_ARROW:
+ if (Unit* victim = me->GetVictim())
+ DoCast(victim, SPELL_BLACK_ARROW);
+ _events.ScheduleEvent(EVENT_BLACK_ARROW, urand(15000, 20000));
+ break;
+ case EVENT_SHOOT:
+ if (Unit* victim = me->GetVictim())
+ DoCast(victim, SPELL_SHOT);
+ _events.ScheduleEvent(EVENT_SHOOT, urand(8000, 10000));
+ break;
+ case EVENT_MULTI_SHOT:
+ if (Unit* victim = me->GetVictim())
+ DoCast(victim, SPELL_MULTI_SHOT);
+ _events.ScheduleEvent(EVENT_MULTI_SHOT, urand(10000, 13000));
+ break;
+ case EVENT_LAMENT_OF_THE_HIGHBORN:
+ if (!me->HasAura(SPELL_SYLVANAS_CAST))
+ {
+ Talk(SAY_LAMENT_END);
+ Talk(EMOTE_LAMENT_END);
+ LamentEvent = false;
+ me->HandleEmoteCommand(EMOTE_ONESHOT_KNEEL);
+ Reset();
+ }
+ else
+ {
+ DoSummon(NPC_HIGHBORNE_BUNNY, me, 10.0f, 3000, TEMPSUMMON_TIMED_DESPAWN);
+ _events.ScheduleEvent(EVENT_LAMENT_OF_THE_HIGHBORN, 2000);
+ }
+ break;
+ case EVENT_SUNSORROW_WHISPER:
+ if (Creature* ambassador = me->FindNearestCreature(NPC_AMBASSADOR_SUNSORROW, 20.0f))
+ if (Player* player = ObjectAccessor::GetPlayer(*me, playerGUID))
+ ambassador->AI()->Talk(SAY_SUNSORROW_WHISPER, player);
+ break;
+ default:
+ break;
}
- } else MultiShotTimer -= diff;
+ }
DoMeleeAttackIfReady();
}
+
+ private:
+ EventMap _events;
+ bool LamentEvent;
+ ObjectGuid targetGUID;
+ ObjectGuid playerGUID;
};
+
+ CreatureAI* GetAI(Creature* creature) const override
+ {
+ return new npc_lady_sylvanas_windrunnerAI(creature);
+ }
};
/*######