Skip to content

Commit

Permalink
Implement script for quest 11592
Browse files Browse the repository at this point in the history
Thanks to @Grz3s for providing the details

Signed-off-by: Xfurry <xfurry.cmangos@outlook.com>
  • Loading branch information
xfurry committed Jan 2, 2018
1 parent 7ebc9fa commit 758ff50
Show file tree
Hide file tree
Showing 2 changed files with 215 additions and 2 deletions.
36 changes: 35 additions & 1 deletion sql/scriptdev2/scriptdev2.sql
Expand Up @@ -418,6 +418,7 @@ UPDATE creature_template SET ScriptName='npc_jenny' WHERE entry=25969;
UPDATE creature_template SET ScriptName='npc_seaforium_depth_charge' WHERE entry=25401;
UPDATE creature_template SET ScriptName='npc_mootoo_the_younger' WHERE entry=25504;
UPDATE creature_template SET ScriptName='npc_storm_totem' WHERE entry=26048;
UPDATE creature_template SET ScriptName='npc_proudhoof' WHERE entry=25335;

/* BURNING STEPPES */
UPDATE creature_template SET ScriptName='npc_ragged_john' WHERE entry=9563;
Expand Down Expand Up @@ -2980,7 +2981,15 @@ INSERT INTO script_texts (entry,content_default,sound,type,language,emote,commen
(-1001246,'Look out, $N! Enemies ahead!',0,0,0,0,'kayra SAY_AMBUSH2'),
(-1001247,'We\'re almost to the refuge! Let\'s go.',0,0,0,0,'kayra SAY_PROGRESS2'),
(-1001248,'I can see my fellow druids from here. Thank you, $n. I''m sure Ysiel will reward you for your actions!',0,0,0,0,'kayra SAY_END'),
(-1001249,'You won''t escape us, druid!',0,0,0,0,'Umbrafen Slavebinder SAY_AMBUSH2');
(-1001249,'You won''t escape us, druid!',0,0,0,0,'Umbrafen Slavebinder SAY_AMBUSH2'),

(-1001250,'WE STRIKE!',0,1,0,15,'proudhoof SAY_QUEST_START'),
(-1001251,'$N is going to join us on our assault. Let us bring peace to my ancestors!',0,0,0,396,'proudhoof SAY_QUEST_INTRO'),
(-1001252,'An ambush. Return them to their rest!',0,0,0,5,'proudhoof SAY_AMBUSH'),
(-1001253,'I will not stop until this place is once again at peace.',0,0,0,0,'proudhoof SAY_AGGRO'),
(-1001254,'Regain your strength. The place where Steeljaw was felled is just ahead.',0,0,0,396,'proudhoof SAY_AMBUSH_COMPLETE'),
(-1001255,'There\'s the dog\'s banner and there\'s his corpse. What\'s that? He\'s upon us!',0,0,0,25,'proudhoof SAY_FINAL_BATTLE'),
(-1001256,'You fought well. Now go north to your orc outpost and inform Overlord Bor\'gorok of our success!',0,0,0,113,'proudhoof SAY_QUEST_END');

-- -1 033 000 SHADOWFANG KEEP
INSERT INTO script_texts (entry,content_default,sound,type,language,emote,comment) VALUES
Expand Down Expand Up @@ -10784,4 +10793,29 @@ INSERT INTO script_waypoint VALUES
(25504, 24, 2807.49, 6748.29, 8.25933, 3000, 'MOOTOO_Y_SAY_9'),
(25504, 25, 2807.49, 6748.29, 8.25933, 5000, 'SAY_2_ELDER_MOOTOO');

DELETE FROM script_waypoint WHERE entry=25335;
INSERT INTO script_waypoint VALUES
(25335, 1, 4138.37,5785.34,60.9668, 14000, 'SAY_QUEST_INTRO'),
(25335, 2, 4138.37,5785.34,60.9668, 2000, 'SAY_QUEST_START'),
(25335, 3, 4121.40,5791.31,62.7287, 0, ''),
(25335, 4, 4101.44,5799.44,67.9234, 0, ''),
(25335, 5, 4083.93,5805.44,71.3223, 0, ''),
(25335, 6, 4068.87,5807.64,73.8006, 0, ''),
(25335, 7, 4052.77,5802.65,75.0299, 0, ''),
(25335, 8, 4038.37,5795.23,75.4015, 0, ''),
(25335, 9, 4025.04,5789.23,75.1928, 0, ''),
(25335, 10, 4006.38,5787.30,73.1468, 0, ''),
(25335, 11, 3984.42,5778.06,73.1662, 3000, 'SAY_AMBUSH'),
(25335, 12, 3984.42,5778.06,73.1662, 5000, 'summon mobs'),
(25335, 13, 3984.42,5778.06,73.1662, 10000, 'SAY_AMBUSH_COMPLETE'),
(25335, 14, 3952.68,5758.44,70.4093, 0, ''),
(25335, 15, 3939.55,5758.72,69.3329, 0, ''),
(25335, 16, 3919.01,5753.34,69.2061, 0, ''),
(25335, 17, 3894.65,5745.70,70.2652, 0, ''),
(25335, 18, 3888.48,5734.52,69.0002, 0, ''),
(25335, 19, 3883.36,5725.31,67.5505, 5000, 'SAY_FINAL_BATTLE'),
(25335, 20, 3883.36,5725.31,67.5505, 5000, 'summon boss'),
(25335, 21, 3883.36,5725.31,67.5505, 10000, 'quest complete'),
(25335, 22, 3883.36,5725.31,67.5505, 10000, 'SAY_QUEST_END');

-- EOF
181 changes: 180 additions & 1 deletion src/game/AI/ScriptDevAI/scripts/northrend/borean_tundra.cpp
Expand Up @@ -17,7 +17,7 @@
/* ScriptData
SDName: Borean_Tundra
SD%Complete: 100
SDComment: Quest support: 11570, 11590, 11608, 11664, 11673, 11728, 11865, 11881, 11889, 11895, 11897, 11919, 11940.
SDComment: Quest support: 11570, 11590, 11592, 11608, 11664, 11673, 11728, 11865, 11881, 11889, 11895, 11897, 11919, 11940.
SDCategory: Borean Tundra
EndScriptData */

Expand All @@ -33,6 +33,7 @@ npc_bonker_togglevolt
npc_jenny
npc_mootoo_the_younger
npc_storm_totem
npc_proudhoof
EndContentData */

#include "AI/ScriptDevAI/include/precompiled.h"
Expand Down Expand Up @@ -1339,6 +1340,178 @@ bool NpcSpellClick_npc_storm_totem(Player* pPlayer, Creature* pClickedCreature,
return true;
}

/*######
## npc_proudhoof
######*/

enum
{
SAY_QUEST_START = -1001250,
SAY_QUEST_INTRO = -1001251,
SAY_AMBUSH = -1001252,
SAY_AGGRO = -1001253,
SAY_AMBUSH_COMPLETE = -1001254,
SAY_FINAL_BATTLE = -1001255,
SAY_QUEST_END = -1001256,

SPELL_FORCEFUL_CLEAVE = 35473,

NPC_RISEN_LONGRUNNER = 25350,
NPC_GHOSTLY_SAGE = 25351,
NPC_COMMANDER_STEELJAW = 25359,
NPC_CARAVAN_GUARD = 25338,

QUEST_WE_STRIKE = 11592,

MAX_PROUDHOOF_SPAWNS = 6,
};

struct ProudhoofSpawns
{
uint32 uiEntry;
float fX, fY, fZ, fO;
};

static const ProudhoofSpawns aProudhoofSpawns[MAX_PROUDHOOF_SPAWNS] =
{
{ NPC_RISEN_LONGRUNNER, 3970.342f, 5769.431f, 72.759f, 0.549f },
{ NPC_RISEN_LONGRUNNER, 3987.955f, 5790.864f, 74.124f, 4.443f },
{ NPC_RISEN_LONGRUNNER, 3981.751f, 5767.377f, 71.785f, 1.508f },
{ NPC_GHOSTLY_SAGE, 3995.641f, 5773.730f, 71.079f, 2.772f },
{ NPC_GHOSTLY_SAGE, 3973.069f, 5783.232f, 74.131f, 5.856f },
{ NPC_COMMANDER_STEELJAW, 3880.034f, 5719.530f, 66.578f, 1.048f },
};

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

uint32 m_uiCleaveTimer;

void Reset() override
{
m_uiCleaveTimer = urand(2000, 5000);
}

void Aggro(Unit* /*pWho*/) override
{
// random chance of saying aggro
if (!urand(0, 10))
DoScriptText(SAY_AGGRO, m_creature);
}

void ReceiveAIEvent(AIEventType eventType, Creature* /*pSender*/, Unit* pInvoker, uint32 uiMiscValue) override
{
if (eventType == AI_EVENT_START_ESCORT && pInvoker->GetTypeId() == TYPEID_PLAYER)
{
// remove npc flags and set factions
m_creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP | UNIT_NPC_FLAG_QUESTGIVER);
m_creature->SetFactionTemporary(FACTION_ESCORT_H_NEUTRAL_ACTIVE, TEMPFACTION_RESTORE_RESPAWN);

// change faction to the guards as well
std::list<Creature*> lGuardsList;
GetCreatureListWithEntryInGrid(lGuardsList, m_creature, NPC_CARAVAN_GUARD, 20.0f);
for (std::list<Creature*>::const_iterator itr = lGuardsList.begin(); itr != lGuardsList.end(); ++itr)
{
if (!(*itr)->isAlive())
continue;

(*itr)->SetFactionTemporary(FACTION_ESCORT_H_NEUTRAL_ACTIVE, TEMPFACTION_RESTORE_RESPAWN);
}

// start escort
Start(true, (Player*)pInvoker, GetQuestTemplateStore(uiMiscValue));
}
}

void JustSummoned(Creature* pSummoned) override
{
pSummoned->AI()->AttackStart(m_creature);
}

void JustRespawned() override
{
// reset stand state if required
m_creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP | UNIT_NPC_FLAG_QUESTGIVER);
}

void WaypointReached(uint32 uiPointId) override
{
switch (uiPointId)
{
case 1:
if (Player* pPlayer = GetPlayerForEscort())
{
if (Creature* pGuard = GetClosestCreatureWithEntry(m_creature, NPC_CARAVAN_GUARD, 10.0f))
m_creature->SetFacingToObject(pGuard);

DoScriptText(SAY_QUEST_INTRO, m_creature, pPlayer);
}
break;
case 2:
DoScriptText(SAY_QUEST_START, m_creature);
break;
case 11:
DoScriptText(SAY_AMBUSH, m_creature);
break;
case 12:
for (uint8 i = 0; i < MAX_PROUDHOOF_SPAWNS - 1; ++i)
m_creature->SummonCreature(aProudhoofSpawns[i].uiEntry, aProudhoofSpawns[i].fX, aProudhoofSpawns[i].fY, aProudhoofSpawns[i].fZ, aProudhoofSpawns[i].fO, TEMPSPAWN_TIMED_OOC_OR_DEAD_DESPAWN, 30000);
break;
case 13:
DoScriptText(SAY_AMBUSH_COMPLETE, m_creature);
break;
case 19:
DoScriptText(SAY_FINAL_BATTLE, m_creature);
break;
case 20:
m_creature->SummonCreature(aProudhoofSpawns[5].uiEntry, aProudhoofSpawns[5].fX, aProudhoofSpawns[5].fY, aProudhoofSpawns[5].fZ, aProudhoofSpawns[5].fO, TEMPSPAWN_TIMED_OOC_OR_DEAD_DESPAWN, 30000);
break;
case 21:
if (Player* pPlayer = GetPlayerForEscort())
pPlayer->GroupEventHappens(QUEST_WE_STRIKE, m_creature);
break;
case 22:
DoScriptText(SAY_QUEST_END, m_creature);
if (Player* pPlayer = GetPlayerForEscort())
m_creature->SetFacingToObject(pPlayer);
break;
}
}

void UpdateEscortAI(const uint32 uiDiff) override
{
if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
return;

if (m_uiCleaveTimer < uiDiff)
{
if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_FORCEFUL_CLEAVE) == CAST_OK)
m_uiCleaveTimer = urand(4000, 8000);
}
else
m_uiCleaveTimer -= uiDiff;

DoMeleeAttackIfReady();
}
};

CreatureAI* GetAI_npc_proudhoofAI(Creature* pCreature)
{
return new npc_proudhoofAI(pCreature);
}

bool QuestAccept_npc_proudhoof(Player* pPlayer, Creature* pCreature, const Quest* pQuest)
{
if (pQuest->GetQuestId() == QUEST_WE_STRIKE)
{
pCreature->AI()->SendAIEvent(AI_EVENT_START_ESCORT, pPlayer, pCreature, pQuest->GetQuestId());
return true;
}

return false;
}

void AddSC_borean_tundra()
{
Script* pNewScript;
Expand Down Expand Up @@ -1415,4 +1588,10 @@ void AddSC_borean_tundra()
pNewScript->Name = "npc_storm_totem";
pNewScript->pNpcSpellClick = &NpcSpellClick_npc_storm_totem;
pNewScript->RegisterSelf();

pNewScript = new Script;
pNewScript->Name = "npc_proudhoof";
pNewScript->GetAI = &GetAI_npc_proudhoofAI;
pNewScript->pQuestAcceptNPC = &QuestAccept_npc_proudhoof;
pNewScript->RegisterSelf();
}

0 comments on commit 758ff50

Please sign in to comment.