Skip to content
This repository has been archived by the owner on Feb 29, 2024. It is now read-only.

Commit

Permalink
Scripts: scripted master shang xi tornado vehicle.
Browse files Browse the repository at this point in the history
  • Loading branch information
AriDEV3 committed Nov 27, 2023
1 parent 0ef2432 commit 286e1af
Show file tree
Hide file tree
Showing 2 changed files with 112 additions and 0 deletions.
5 changes: 5 additions & 0 deletions sql/updates/world/2023_11_27_world_00.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
DELETE FROM `creature_template_addon` WHERE `entry`=55685;
INSERT INTO `creature_template_addon` (`entry`, `path_id`, `mount`, `bytes1`, `bytes2`, `emote`, `auras`) VALUES
(55685, 0, 0, 0, 1, 0, '99385');

UPDATE `creature_template` SET `ScriptName`='npc_uplift_draft' WHERE `entry`=55685;
107 changes: 107 additions & 0 deletions src/server/scripts/Pandaria/zone_wandering_island.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,71 @@ class npc_shu_pool_of_reflection : public CreatureScript
}
};

const Position tornadoPos1 = { 922.9829f, 3602.6472f, 198.44557f };
const Position tornadoPos2 = { 958.7378f, 3610.3413f, 209.64407f };
const Position tornadoPos3 = { 934.45074f, 3609.4578f, 240.62868f };
const Position tornadoEndPos = { 920.4496f, 3604.7705f, 253.17314f };
class npc_uplift_draft : public CreatureScript
{
public:
npc_uplift_draft() : CreatureScript("npc_uplift_draft") { }

struct npc_uplift_draftAI : public CreatureAI
{
EventMap events;
enum upliftDraftEvents
{
EVENT_MOVE_POS1 = 1,
EVENT_MOVE_POS2,
EVENT_MOVE_POS3,
EVENT_MOVE_END_POS
};
npc_uplift_draftAI(Creature* creature) : CreatureAI(creature)
{
events.ScheduleEvent(EVENT_MOVE_POS1, 1000);
}

void UpdateAI(uint32 diff) OVERRIDE
{
events.Update(diff);

while (uint32 eventId = events.ExecuteEvent())
{
switch (eventId)
{
case EVENT_MOVE_POS1:
{
me->GetMotionMaster()->MovePoint(0, tornadoPos1);
events.ScheduleEvent(EVENT_MOVE_POS2, 1000);
break;
}
case EVENT_MOVE_POS2:
{
me->GetMotionMaster()->MovePoint(1, tornadoPos2);
events.ScheduleEvent(EVENT_MOVE_POS3, 5000);
break;
}
case EVENT_MOVE_POS3:
{
me->GetMotionMaster()->MovePoint(2, tornadoPos3);
events.ScheduleEvent(EVENT_MOVE_END_POS, 5000);
break;
}
case EVENT_MOVE_END_POS:
{
me->GetMotionMaster()->MovePoint(4, tornadoEndPos);
break;
}
}
}
}
};
CreatureAI* GetAI(Creature* creature) const OVERRIDE
{
return new npc_uplift_draftAI(creature);
}
};

#define MASTER_SHANG_XI_TEXT_1 "You have conquered every challenge I put before you, $n. You have found Huo and brought him safely to the temple."
#define MASTER_SHANG_XI_TEXT_2 "There is a much larger problem we face now, my students. Shen-zin Su is in pain. If we do not act the very land on which we stand could die, and all of us with it."
#define MASTER_SHANG_XI_TEXT_3 "We need to speak to Shen-zin Su and discover how to heal it. And to do that, we need the four elemental spirits returned. Huo was the first."
Expand All @@ -365,6 +430,7 @@ class npc_shu_pool_of_reflection : public CreatureScript
#define MASTER_SHANG_XI_TEXT_8 "Wugou and Shu are welcome here. We will care for them well."
#define MASTER_SHANG_XI_TEXT_9 "The only remaining spirit is Dafeng, who hides somewhere across the Dawning Span to the west."


const Position jiTempleMovePoint_1 = { 966.1493f, 3607.0894f, 196.51373f };
const Position jiTempleMovePoint_2 = { 958.9819f, 3594.94f, 196.6083f };
const Position jiTempleMovePoint_3 = { 950.7555f, 3588.809f, 196.8154f };
Expand Down Expand Up @@ -394,6 +460,44 @@ class npc_master_shang_xi_temple : public CreatureScript
public:
npc_master_shang_xi_temple() : CreatureScript("npc_master_shang_xi_temple") { }

bool OnQuestAccept(Player* player, Creature* /*creature*/, Quest const* quest) OVERRIDE
{
if (quest->GetQuestId() == 29776) // Morning Breeze Village
{
if (Creature* vehicle = player->SummonCreature(55685, player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetOrientation(), TempSummonType::TEMPSUMMON_TIMED_DESPAWN, 20000))
{
player->EnterVehicle(vehicle);
}
}
return true;
}

bool OnGossipHello(Player* player, Creature* creature) override
{
if (creature->IsQuestGiver())
player->PrepareQuestMenu(creature->GetGUID());

if (player->GetQuestStatus(29776) != QUEST_STATUS_NONE)
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "I would like to go back on the top of the temple", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);

player->PlayerTalkClass->SendGossipMenu(1, creature->GetGUID());
return true;
}

bool OnGossipSelect(Player* player, Creature* /*creature*/, uint32 /*sender*/, uint32 action) override
{
if (action == GOSSIP_ACTION_INFO_DEF + 1)
{
if (Creature* vehicle = player->SummonCreature(55685, player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetOrientation(), TempSummonType::TEMPSUMMON_TIMED_DESPAWN, 20000))
{
player->EnterVehicle(vehicle);
}
}

player->PlayerTalkClass->SendCloseGossip();
return true;
}

CreatureAI* GetAI(Creature* creature) const OVERRIDE
{
return new npc_master_shang_xi_templeAI(creature);
Expand All @@ -407,6 +511,8 @@ class npc_master_shang_xi_temple : public CreatureScript

npc_master_shang_xi_templeAI(Creature* creature) : CreatureAI(creature) { }



void Reset() OVERRIDE
{
started = false;
Expand Down Expand Up @@ -955,6 +1061,7 @@ class npc_aysa_cloudsinger : public CreatureScript

void AddSC_wandering_island()
{
new npc_uplift_draft();
new npc_shu_dailo();
new npc_shu_pool_of_reflection();
new npc_master_shang_xi_temple();
Expand Down

0 comments on commit 286e1af

Please sign in to comment.