Scripts/Elwynn: scripted horse riding sequence for quest 'Further Concerns'

This commit is contained in:
Ovahlord
2020-01-28 11:13:15 +01:00
parent dfaa49c87b
commit 045ae21e49
2 changed files with 136 additions and 1 deletions

View File

@@ -0,0 +1,21 @@
DELETE FROM `gossip_menu_option` WHERE `MenuId`= 11611;
INSERT INTO `gossip_menu_option` (`MenuId`, `OptionIndex`, `OptionIcon`, `OptionText`, `OptionBroadcastTextId`, `OptionType`, `OptionNpcflag`, `VerifiedBuild`) VALUES
(11611, 0, 0, 'I wish to ride the Stormwind charger, sir.', 42173, 1, 1, 25881);
DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`= 15 AND `SourceGroup`= 11611;
INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `ConditionTarget`, `ConditionTypeOrReference`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`) VALUES
(15, 11611, 0, 0, 28, 35, 0, 0);
-- Creature Marshal Dughan 240 SAI
SET @ENTRY := 240;
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, 1, 62, 0, 100, 0, 11611, 0, 0, 0, 11, 78854, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, "On gossip action 0 from menu 11611 selected - Self: Cast spell Force Stormwind Charger (78854) on Action invoker // "),
(@ENTRY, 0, 1, 0, 61, 0, 100, 0, 0, 0, 0, 0, 72, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, " Linked - Action invoker: Close gossip // ");
UPDATE `creature_template` SET `speed_run`= 2, `VehicleId`= 882, `ScriptName`= 'npc_elwynn_stormwind_charger' WHERE `entry`= 42260;
DELETE FROM `npc_spellclick_spells` WHERE `npc_entry`= 42260;
INSERT INTO `npc_spellclick_spells` (`npc_entry`, `spell_id`, `cast_flags`, `user_type`) VALUES
(42260, 46598, 1, 0);

View File

@@ -23,7 +23,6 @@
#include "Player.h"
#include "ScriptedCreature.h"
#include "SpellScript.h"
enum Northshire
{
NPC_BLACKROCK_BATTLE_WORG = 49871,
@@ -475,10 +474,125 @@ public:
}
};
enum FurtherConcerns
{
// Events
EVENT_PLAY_MOUNT_ANIMATION = 1,
EVENT_START_RIDING = 2,
EVENT_EJECT_PASSENGER = 3,
// Move Points
POINT_BRIGDE = 1,
// Sound Ids
SOUND_ID_MOUNTSPECIAL = 4066,
// Spells
SPELL_EJECT_PASSENGER_1 = 77946
};
static constexpr uint8 StormwindChargerPathSize = 39;
Position const StormwindChargerPath[StormwindChargerPathSize] =
{
{ -9465.488f, 64.75174f, 55.9232f },
{ -9489.841f, 64.25694f, 55.95109f },
{ -9503.804f, 35.873264f, 56.39156f },
{ -9523.1455f, -2.920139f, 55.85599f },
{ -9541.677f, -38.56597f, 56.474117f },
{ -9547.922f, -69.87327f, 57.372242f },
{ -9549.37f, -110.31077f, 57.489456f },
{ -9555.764f, -137.2448f, 57.400364f },
{ -9575.194f, -159.01389f, 57.548084f },
{ -9586.826f, -197.10591f, 57.53395f },
{ -9603.833f, -239.58333f, 57.28743f },
{ -9615.153f, -277.39062f, 57.83489f },
{ -9619.554f, -310.06946f, 57.385513f },
{ -9620.591f, -344.71353f, 57.166138f },
{ -9620.62f, -373.00348f, 57.503777f },
{ -9618.868f, -401.0625f, 57.791756f },
{ -9611.052f, -427.99478f, 57.386707f },
{ -9597.004f, -456.90973f, 57.62922f },
{ -9589.788f, -484.03995f, 57.71283f },
{ -9596.089f, -506.9896f, 57.407463f },
{ -9610.698f, -531.625f, 54.788067f },
{ -9617.52f, -558.88196f, 54.451187f },
{ -9622.382f, -607.8733f, 52.419804f },
{ -9626.333f, -636.25696f, 51.19875f },
{ -9638.899f, -656.44617f, 49.511f },
{ -9644.645f, -673.96875f, 48.639606f },
{ -9655.107f, -718.59375f, 44.738724f },
{ -9655.63f, -745.4809f, 44.562298f },
{ -9652.263f, -776.8698f, 44.270496f },
{ -9647.052f, -797.9809f, 43.50934f },
{ -9631.623f, -816.98267f, 43.828598f },
{ -9609.665f, -840.8333f, 43.67657f },
{ -9589.141f, -863.5243f, 43.705048f },
{ -9582.302f, -898.25f, 43.62359f },
{ -9587.446f, -930.15454f, 43.31383f },
{ -9609.941f, -959.48956f, 43.61531f },
{ -9619.147f, -980.625f, 43.67072f },
{ -9621.516f, -1009.3889f, 41.507584f },
{ -9618.427f, -1032.1129f, 39.71602f }
};
struct npc_elwynn_stormwind_charger : public ScriptedAI
{
npc_elwynn_stormwind_charger(Creature* creature) : ScriptedAI(creature) { }
void PassengerBoarded(Unit* passenger, int8 /*seatId*/, bool apply) override
{
if (!passenger->IsPlayer())
return;
me->PlayDirectSound(SOUND_ID_MOUNTSPECIAL, passenger->ToPlayer());
if (apply)
{
me->SetControlled(true, UNIT_STATE_ROOT);
_events.ScheduleEvent(EVENT_PLAY_MOUNT_ANIMATION, 200ms);
}
}
void UpdateAI(uint32 diff) override
{
_events.Update(diff);
while (uint32 eventId = _events.ExecuteEvent())
{
switch (eventId)
{
case EVENT_PLAY_MOUNT_ANIMATION:
me->HandleEmoteCommand(EMOTE_ONESHOT_MOUNT_SPECIAL);
_events.ScheduleEvent(EVENT_START_RIDING, 1s + 200ms);
break;
case EVENT_START_RIDING:
me->GetMotionMaster()->MoveSmoothPath(POINT_BRIGDE, StormwindChargerPath, StormwindChargerPathSize);
break;
case EVENT_EJECT_PASSENGER:
me->HandleEmoteCommand(EMOTE_ONESHOT_MOUNT_SPECIAL);
DoCastSelf(SPELL_EJECT_PASSENGER_1);
break;
default:
break;
}
}
}
void MovementInform(uint32 motionType, uint32 pointId) override
{
if (motionType == EFFECT_MOTION_TYPE && pointId == POINT_BRIGDE)
_events.ScheduleEvent(EVENT_EJECT_PASSENGER, 2s);
}
private:
EventMap _events;
};
void AddSC_elwynn_forest()
{
new npc_stormwind_infantry();
new npc_blackrock_battle_worg();
new npc_injured_stormwind_infantry_dummy();
new npc_hogger();
RegisterCreatureAI(npc_elwynn_stormwind_charger);
}