fix(Scripts/Creature): Add Ravenclaw Apparition event. (#15200)

This commit is contained in:
avarishd
2023-04-21 21:06:08 +03:00
committed by GitHub
parent 953b9aa8b7
commit 72f111dd65
2 changed files with 197 additions and 3 deletions

View File

@@ -0,0 +1,40 @@
-- Trigger SAI Areatrigger 173 if no Ravenclaw Apparition within 30 yards.
DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId` = 22 AND `SourceEntry` = 173 AND `SourceId` = 2;
INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES
(22, 1, 173, 2, 0, 29, 0, 2056, 30, 0, 1, 0, 0, '', 'Trigger Areatrigger 173 if no Ravenclaw Apparition within 30 yards');
-- Areatrigger - On Trigger - Summon Creature 'Ravenclaw Apparition' (The Dead Fields) for 5 minutes.
DELETE FROM `areatrigger_scripts` WHERE `entry` = 173;
INSERT INTO `areatrigger_scripts` (`entry`, `ScriptName`) VALUES (173, 'SmartTrigger');
DELETE FROM `smart_scripts` WHERE (`source_type` = 2 AND `entryorguid` = 173);
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`, `event_param5`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES
(173, 2, 0, 0, 46, 0, 100, 0, 0, 0, 0, 0, 0, 12, 2056, 3, 300000, 0, 0, 0, 8, 0, 0, 0, 0, 1077, 1539, 28.89, 0, 'Areatrigger - On Trigger - Summon Creature \'Ravenclaw Apparition\' (The Dead Fields)');
-- Move creature_text from Thule Ravencla to Ravenclaw Apparition
DELETE FROM `creature_text` WHERE `CreatureID` IN (1947, 2056);
INSERT INTO `creature_text` (`CreatureID`, `GroupID`, `ID`, `Text`, `Type`, `Language`, `Probability`, `Emote`, `Duration`, `Sound`, `BroadcastTextId`, `TextRange`, `comment`) VALUES
(2056, 0, 0, 'My minions...', 14, 0, 100, 0, 0, 0, 518, 0, 'Ravenclaw Apparition - Intro'),
(2056, 1, 0, 'The time for conquest approaches quickly.', 14, 0, 100, 0, 0, 0, 519, 0, 'Ravenclaw Apparition'),
(2056, 2, 0, 'Soon, your thirst for destruction will be quenched.', 14, 0, 100, 0, 0, 0, 520, 0, 'Ravenclaw Apparition'),
(2056, 3, 0, 'The rage burning within you will soon find fuel in our enemies.', 14, 0, 100, 0, 0, 0, 521, 0, 'Ravenclaw Apparition'),
(2056, 4, 0, 'I come with news of our conflict with the Rogue Undead.', 14, 0, 100, 0, 0, 0, 522, 0, 'Ravenclaw Apparition'),
(2056, 5, 0, 'The rebels of Lordaeron are small and weak, and know not the joy of serving our Lich King.', 14, 0, 100, 0, 0, 0, 523, 0, 'Ravenclaw Apparition'),
(2056, 6, 0, 'The Dark Lady\'s followers are blind to think they can stand against our might.', 14, 0, 100, 0, 0, 0, 525, 0, 'Ravenclaw Apparition'),
(2056, 7, 0, 'We grow strong, while our foes are surrounded by foes, and weakened by constant attacks.', 14, 0, 100, 0, 0, 0, 526, 0, 'Ravenclaw Apparition'),
(2056, 8, 0, 'Our Lord commands us to make ready for war!', 14, 0, 100, 0, 0, 0, 527, 0, 'Ravenclaw Apparition'),
(2056, 9, 0, 'Prepare yourselves, for we will soon launch an assault against they who called themselves "The Forsaken."', 14, 0, 100, 0, 0, 0, 528, 0, 'Ravenclaw Apparition'),
(2056, 10, 0, 'Make ready for battle, my creations.', 14, 0, 100, 0, 0, 0, 529, 0, 'Ravenclaw Apparition'),
(2056, 11, 0, 'We are the arm of His will. And we will crush His foes into grave dust!', 14, 0, 100, 0, 0, 0, 530, 0, 'Ravenclaw Apparition'),
(2056, 12, 0, 'These undead rabble, and their dead-elf queen, will fall!', 14, 0, 100, 0, 0, 0, 531, 0, 'Ravenclaw Apparition'),
(2056, 13, 0, 'We will drive our foes from Silverpine, then bring the tides of war to their very capital!', 14, 0, 100, 0, 0, 0, 532, 0, 'Ravenclaw Apparition'),
(2056, 14, 0, 'Death and Praise for the Lich King!', 14, 0, 100, 0, 0, 0, 533, 0, 'Ravenclaw Apparition - Outro');
-- Ravenclaw Apparition
UPDATE `creature_template` SET `AIName` = 'NullCreatureAI', `ScriptName` = 'npc_ravenclaw_apparition' WHERE `entry` = 2056;
-- Rot Hide Gladerunner & Rot Hide Mystic - Add cheer emote (They share creature_text), this is probably better than a hardcode.
DELETE FROM `creature_text` WHERE `CreatureID` IN (1772,1773) AND `GroupID`=1;
INSERT INTO `creature_text` (`CreatureID`, `GroupID`, `ID`, `Text`, `Type`, `Language`, `Probability`, `Emote`, `Duration`, `Sound`, `BroadcastTextId`, `TextRange`, `comment`) VALUES
(1772, 1, 0, '%s cheers!', 16, 0, 100, 4, 0, 0, 3928, 0, 'Rot Hide Gladerunner - Cheer (Apparition event)'),
(1773, 1, 0, '%s cheers!', 16, 0, 100, 4, 0, 0, 3928, 0, 'Rot Hide Mystic - Cheer (Apparition event)');

View File

@@ -27,6 +27,7 @@ npc_deathstalker_erland
pyrewood_ambush
EndContentData */
#include "PassiveAI.h"
#include "Player.h"
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
@@ -325,12 +326,165 @@ public:
};
};
/*######
## AddSC
######*/
/**
*
* @todo: Actual emote and BroadcastTextId need to be sniffed. Probably the entire event to begin with....
* There is a possibility that the unused texts are chosen by random for specific parts of the speech. (making it look like they are preset, when in fact, they are not)
*
*/
enum ApparitionMisc
{
// Crowd
NPC_GNOLL_RUNNER = 1772,
NPC_GNOLL_MYSTIC = 1773,
EMOTE_CHEER = 71,
EMOTE_GNOLL_CHEER = 1,
// Apparition
SAY_APPA_INTRO = 0,
SAY_APPA_OUTRO = 14,
// Variation 1
SAY_APPA_OPTION_1_1 = 1,
SAY_APPA_OPTION_1_2 = 5,
SAY_APPA_OPTION_1_3 = 10,
SAY_APPA_OPTION_1_4 = 13,
// Variation 2
SAY_APPA_OPTION_2_1 = 2,
SAY_APPA_OPTION_2_2 = 5,
SAY_APPA_OPTION_2_3 = 9,
SAY_APPA_OPTION_2_4 = 12,
};
enum ApparitionEvents
{
EVENT_APPA_INTRO = 1,
EVENT_APPA_SAY_1 = 2,
EVENT_APPA_SAY_2 = 3,
EVENT_APPA_SAY_3 = 4,
EVENT_APPA_SAY_4 = 5,
EVENT_APPA_OUTRO = 6,
EVENT_APPA_OUTRO_CROWD = 7,
EVENT_APPA_OUTRO_END = 8,
};
class npc_ravenclaw_apparition : public CreatureScript
{
public:
npc_ravenclaw_apparition() : CreatureScript("npc_ravenclaw_apparition") { }
CreatureAI* GetAI(Creature* creature) const override
{
return new npc_ravenclaw_apparitionAI(creature);
}
struct npc_ravenclaw_apparitionAI : public NullCreatureAI
{
npc_ravenclaw_apparitionAI(Creature* creature) : NullCreatureAI(creature), summons(me)
{
HasEnded = false;
TalkRNG = urand(0,1);
events.ScheduleEvent(EVENT_APPA_INTRO, 2000);
summons.DespawnAll();
}
EventMap events;
SummonList summons;
bool HasEnded;
bool TalkRNG;
void SummonCrowd()
{
for (uint8 i = 0; i < urand(3, 5); ++i)
{
float o = i * 10;
me->SummonCreature(urand(NPC_GNOLL_RUNNER,NPC_GNOLL_MYSTIC), me->GetPositionX() + urand(3,5) * cos(o) , me->GetPositionY() + urand(3,5) * sin(o), me->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 35000);
}
}
void EmoteCrowd()
{
for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr)
{
if (Creature* c = ObjectAccessor::GetCreature(*me, *itr))
{
if (urand(0,1))
{
c->HandleEmoteCommand(EMOTE_CHEER);
c->AI()->Talk(EMOTE_GNOLL_CHEER);
}
}
}
}
void JustSummoned(Creature* summon) override
{
summons.Summon(summon);
summon->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_PACIFIED);
summon->SetFacingToObject(me);
}
// Should never die, just in case.
void JustDied(Unit* /*killer*/) override
{
summons.DespawnAll();
events.Reset();
}
void UpdateAI(uint32 diff) override
{
if (HasEnded || !me->IsVisible())
return;
events.Update(diff);
switch (events.ExecuteEvent())
{
case EVENT_APPA_INTRO:
Talk(SAY_APPA_INTRO);
SummonCrowd();
events.ScheduleEvent(EVENT_APPA_SAY_1, 3000);
break;
case EVENT_APPA_SAY_1:
Talk(TalkRNG ? SAY_APPA_OPTION_1_1 : SAY_APPA_OPTION_2_1);
events.ScheduleEvent(EVENT_APPA_SAY_2, 5000);
break;
case EVENT_APPA_SAY_2:
Talk(TalkRNG ? SAY_APPA_OPTION_1_2 : SAY_APPA_OPTION_2_2);
events.ScheduleEvent(EVENT_APPA_SAY_3, 5000);
break;
case EVENT_APPA_SAY_3:
Talk(TalkRNG ? SAY_APPA_OPTION_1_3 : SAY_APPA_OPTION_2_3);
events.ScheduleEvent(EVENT_APPA_SAY_4, 5000);
break;
case EVENT_APPA_SAY_4:
Talk(TalkRNG ? SAY_APPA_OPTION_1_4 : SAY_APPA_OPTION_2_4);
events.ScheduleEvent(EVENT_APPA_OUTRO, 5000);
break;
case EVENT_APPA_OUTRO:
Talk(SAY_APPA_OUTRO);
events.ScheduleEvent(EVENT_APPA_OUTRO_CROWD, 3000);
break;
case EVENT_APPA_OUTRO_CROWD:
EmoteCrowd();
events.ScheduleEvent(EVENT_APPA_OUTRO_END, 5000);
break;
case EVENT_APPA_OUTRO_END: // Despawn for Apparition is handled via Areatrigger SAI (5m)
summons.DespawnAll();
me->SetVisible(false);
HasEnded = true;
events.Reset();
break;
}
}
};
};
void AddSC_silverpine_forest()
{
new npc_deathstalker_erland();
new pyrewood_ambush();
new npc_ravenclaw_apparition();
}