Skip to content

Commit

Permalink
[Quest] rework Missing in Action quest using new systems (#660)
Browse files Browse the repository at this point in the history
* [Quest] rework Missing in Action quest using new systems

* add changes requested in comments
  • Loading branch information
miraco authored and killerwife committed Mar 24, 2024
1 parent fcf7272 commit f431ada
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 128 deletions.
60 changes: 0 additions & 60 deletions sql/scriptdev2/scriptdev2.sql
Expand Up @@ -2536,12 +2536,6 @@ INSERT INTO script_texts (entry,content_default,sound,type,language,emote,broadc
('-1000559','I''d rather die fighting than live like a slave.','0','0','0','0','30795','exhausted vrykul SAY_RAND_ATTACK2'),
('-1000560','Enough! I will teach you some manners, wench!','0','0','0','0','30794','exhausted vrykul SAY_RAND_ATTACK3'),

('-1000561','My wounds are grave. Forgive my slow pace but my injuries won''t allow me to walk any faster.','0','0','0','0','25','SAY_CORPORAL_KEESHAN_1'),
('-1000562','Ah, fresh air, at last! I need a moment to rest.','0','0','0','0','26','SAY_CORPORAL_KEESHAN_2'),
('-1000563','The Blackrock infestation is thick in these parts. I will do my best to keep the pace. Let''s go!','0','0','0','0','27','SAY_CORPORAL_KEESHAN_3'),
('-1000564','Marshal Marris, sir. Corporal Keeshan of the 12th Sabre Regiment returned from battle and reporting for duty!','0','0','0','0','29','SAY_CORPORAL_KEESHAN_4'),
('-1000565','Brave adventurer, thank you for rescuing me! I am sure Marshal Marris will reward your kind deed.','0','0','0','0','30','SAY_CORPORAL_KEESHAN_5'),

('-1000566','Stand back! Stand clear! The infernal will need to be given a wide berth!','0','0','0','0','9634','SAY_NIBY_1'),
('-1000567','BOW DOWN TO THE ALMIGHTY! BOW DOWN BEFORE MY INFERNAL DESTRO... chicken?','0','0','0','0','9635','SAY_NIBY_2'),
('-1000568','%s rolls on the floor laughing.','0','2','0','0','9636','EMOTE_IMPSY_1'),
Expand Down Expand Up @@ -7248,60 +7242,6 @@ INSERT INTO gossip_texts (entry,content_default,comment) VALUES

TRUNCATE script_waypoint;
INSERT INTO script_waypoint (Entry, PathId, Point, PositionX, PositionY, PositionZ, Orientation, WaitTime, ScriptId, Comment) VALUES
(349,0,1,-8769.59,-2185.73,141.975,0,0,0,''),
(349,0,2,-8776.54,-2193.78,140.96,0,0,0,''),
(349,0,3,-8783.29,-2194.82,140.462,0,0,0,''),
(349,0,4,-8792.52,-2188.8,142.078,0,0,0,''),
(349,0,5,-8807.55,-2186.1,141.504,0,0,0,''),
(349,0,6,-8818,-2184.8,139.153,0,0,0,''),
(349,0,7,-8825.81,-2188.84,138.459,0,0,0,''),
(349,0,8,-8827.52,-2199.81,139.622,0,0,0,''),
(349,0,9,-8821.14,-2212.64,143.126,0,0,0,''),
(349,0,10,-8809.18,-2230.46,143.438,0,0,0,''),
(349,0,11,-8797.04,-2240.72,146.548,0,0,0,''),
(349,0,12,-8795.24,-2251.81,146.808,0,0,0,''),
(349,0,13,-8780.16,-2258.62,148.554,0,0,0,''),
(349,0,14,-8762.65,-2259.56,151.144,0,0,0,''),
(349,0,15,-8754.36,-2253.74,152.243,0,0,0,''),
(349,0,16,-8741.87,-2251,154.486,0,0,0,''),
(349,0,17,-8733.22,-2251.01,154.36,0,0,0,''),
(349,0,18,-8717.47,-2245.04,154.686,0,0,0,''),
(349,0,19,-8712.24,-2246.83,154.709,0,0,0,''),
(349,0,20,-8693.84,-2240.41,152.91,0,0,0,''),
(349,0,21,-8681.82,-2245.33,155.518,0,0,0,''),
(349,0,22,-8669.86,-2252.77,154.854,0,0,0,''),
(349,0,23,-8670.56,-2264.69,156.978,0,0,0,''),
(349,0,24,-8676.56,-2269.2,155.411,0,0,0,''),
(349,0,25,-8673.34,-2288.65,157.054,0,0,0,''),
(349,0,26,-8677.76,-2302.56,155.917,0,16000,0,'Corp. Keeshan - Short Break Outside'),
(349,0,27,-8682.46,-2321.69,155.917,0,0,0,''),
(349,0,28,-8690.4,-2331.78,155.971,0,0,0,''),
(349,0,29,-8715.1,-2353.95,156.188,0,0,0,''),
(349,0,30,-8748.04,-2370.7,157.988,0,0,0,''),
(349,0,31,-8780.9,-2421.37,156.109,0,0,0,''),
(349,0,32,-8792.01,-2453.38,142.746,0,0,0,''),
(349,0,33,-8804.78,-2472.43,134.192,0,0,0,''),
(349,0,34,-8841.35,-2503.63,132.276,0,0,0,''),
(349,0,35,-8867.57,-2529.89,134.739,0,0,0,''),
(349,0,36,-8870.67,-2542.08,131.044,0,0,0,''),
(349,0,37,-8922.05,-2585.31,132.446,0,0,0,''),
(349,0,38,-8949.08,-2596.87,132.537,0,0,0,''),
(349,0,39,-8993.46,-2604.04,130.756,0,0,0,''),
(349,0,40,-9006.71,-2598.47,127.966,0,0,0,''),
(349,0,41,-9038.96,-2572.71,124.748,0,0,0,''),
(349,0,42,-9046.92,-2560.64,124.447,0,0,0,''),
(349,0,43,-9066.69,-2546.63,123.11,0,0,0,''),
(349,0,44,-9077.54,-2541.67,121.17,0,0,0,''),
(349,0,45,-9125.32,-2490.06,116.057,0,0,0,''),
(349,0,46,-9145.06,-2442.24,108.232,0,0,0,''),
(349,0,47,-9158.2,-2425.36,105.5,0,0,0,''),
(349,0,48,-9151.92,-2393.67,100.856,0,0,0,''),
(349,0,49,-9165.19,-2376.03,94.8215,0,0,0,''),
(349,0,50,-9187.1,-2360.52,89.9231,0,0,0,''),
(349,0,51,-9235.44,-2305.24,77.9253,0,0,0,''),
(349,0,52,-9264.73,-2292.92,70.0089,0,0,0,''),
(349,0,53,-9277.47,-2296.19,68.0896,0,2500,0,'Corp. Keeshan - quest-finish'),
(349,0,54,-9277.47,-2296.19,68.0896,0,0,0,'Corp. Keeshan - Say Goodbye'),
(467,0,1,-10508.4,1068,55.21,0,0,0,''),
(467,0,2,-10518.3,1074.84,53.96,0,0,0,''),
(467,0,3,-10534.8,1081.92,49.88,0,0,0,''),
Expand Down
Expand Up @@ -28,114 +28,69 @@ npc_corporal_keeshan */
#include "AI/ScriptDevAI/base/escort_ai.h"

/*######
## npc_corporal_leehsan
## npc_corporal_keehsan
######*/

enum
{
QUEST_MISSING_IN_ACTION = 219,

SPELL_MOCKING_BLOW = 21008,
SPELL_SHIELD_BASH = 11972,

SAY_CORPORAL_KEESHAN_1 = -1000561,
SAY_CORPORAL_KEESHAN_2 = -1000562,
SAY_CORPORAL_KEESHAN_3 = -1000563,
SAY_CORPORAL_KEESHAN_4 = -1000564,
SAY_CORPORAL_KEESHAN_5 = -1000565,
KEESHAN_PATH_ID = 349,
SAY_CORPORAL_KEESHAN_1 = 25,
SAY_CORPORAL_KEESHAN_2 = 26,
SAY_CORPORAL_KEESHAN_3 = 27,
SAY_CORPORAL_KEESHAN_4 = 30,
};

struct npc_corporal_keeshan_escortAI : public npc_escortAI
{
npc_corporal_keeshan_escortAI(Creature* pCreature) : npc_escortAI(pCreature) { Reset(); }

uint32 m_uiMockingBlowTimer;
uint32 m_uiShieldBashTimer;

void Reset() override
{
m_uiMockingBlowTimer = 5000;
m_uiShieldBashTimer = 8000;
}

void ReceiveAIEvent(AIEventType eventType, Unit* /*pSender*/, Unit* pInvoker, uint32 uiMiscValue) override
{
if (eventType == AI_EVENT_START_ESCORT && pInvoker->GetTypeId() == TYPEID_PLAYER)
{
DoScriptText(SAY_CORPORAL_KEESHAN_1, m_creature);
DoBroadcastText(SAY_CORPORAL_KEESHAN_1, m_creature, pInvoker);
m_creature->SetFactionTemporary(FACTION_ESCORT_A_NEUTRAL_ACTIVE, TEMPFACTION_RESTORE_RESPAWN);
Start(false, (Player*)pInvoker, GetQuestTemplateStore(uiMiscValue));
}
}

void WaypointStart(uint32 uiWP) override
{
switch (uiWP)
{
case 27: // break outside
DoScriptText(SAY_CORPORAL_KEESHAN_3, m_creature);
m_creature->SetStandState(UNIT_STAND_STATE_STAND);
break;
case 54: // say goodbye
DoScriptText(SAY_CORPORAL_KEESHAN_5, m_creature);
break;
Start(false, (Player*)pInvoker, GetQuestTemplateStore(uiMiscValue), true, false, KEESHAN_PATH_ID);
}
}

void WaypointReached(uint32 uiWP) override
{
switch (uiWP)
{
case 26: // break outside
case 25:
m_creature->SetStandState(UNIT_STAND_STATE_SIT);
DoScriptText(SAY_CORPORAL_KEESHAN_2, m_creature);
if (Player* player = GetPlayerForEscort())
DoBroadcastText(SAY_CORPORAL_KEESHAN_2, m_creature, player);
break;
case 37:
SetRun(true); // run now until the destination
case 26:
m_creature->SetStandState(UNIT_STAND_STATE_STAND);
if (Player* player = GetPlayerForEscort())
DoBroadcastText(SAY_CORPORAL_KEESHAN_3, m_creature, player);
break;
case 53: // quest_complete
DoScriptText(SAY_CORPORAL_KEESHAN_4, m_creature);
if (Player* pPlayer = GetPlayerForEscort())
pPlayer->RewardPlayerAndGroupAtEventExplored(QUEST_MISSING_IN_ACTION, m_creature);
case 69: // quest_complete
if (Player* player = GetPlayerForEscort())
{
player->RewardPlayerAndGroupAtEventExplored(QUEST_MISSING_IN_ACTION, m_creature);
DoBroadcastText(SAY_CORPORAL_KEESHAN_4, m_creature, player);
}
break;
}
}

void UpdateEscortAI(const uint32 uiDiff) override
{
// Combat check
if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim())
return;

if (m_uiMockingBlowTimer < uiDiff)
{
DoCastSpellIfCan(m_creature->GetVictim(), SPELL_MOCKING_BLOW);
m_uiMockingBlowTimer = 5000;
}
else
m_uiMockingBlowTimer -= uiDiff;

if (m_uiShieldBashTimer < uiDiff)
{
DoCastSpellIfCan(m_creature->GetVictim(), SPELL_SHIELD_BASH);
m_uiShieldBashTimer = 8000;
}
else
m_uiShieldBashTimer -= uiDiff;

DoMeleeAttackIfReady();
}
};

UnitAI* GetAI_npc_corporal_keeshan(Creature* pCreature)
{
return new npc_corporal_keeshan_escortAI(pCreature);
}

bool QuestAccept_npc_corporal_keeshan(Player* pPlayer, Creature* pCreature, const Quest* pQuest)
bool QuestAccept_npc_corporal_keeshan(Player* player, Creature* pCreature, const Quest* pQuest)
{
if (pQuest->GetQuestId() == QUEST_MISSING_IN_ACTION)
pCreature->AI()->SendAIEvent(AI_EVENT_START_ESCORT, pPlayer, pCreature, pQuest->GetQuestId());
pCreature->AI()->SendAIEvent(AI_EVENT_START_ESCORT, player, pCreature, pQuest->GetQuestId());

return true;
}
Expand Down

0 comments on commit f431ada

Please sign in to comment.