Skip to content

Commit

Permalink
Script Aurius' Reckoning event in Stratholme
Browse files Browse the repository at this point in the history
* Aurius now leaves the Alonsius Chapell to help players defeating
Baron Rivendare if they previously gave him the Medallion of Faith
* He now change his gossip depending on the event progress
* The quest "Aurius' Reckoning" is no longer auto-completed

(based on commit cmangos/mangos-classic@0519a1d)

Signed-off-by: Cala <calaftp@free.fr>

(based on commit cmangos/mangos-tbc@5027a24)

Signed-off-by: Cala <calaftp@free.fr>

(based on cmangos/mangos-wotlk@47b3c24)

Signed-off-by: Xfurry <xfurry@cmangos.net>
  • Loading branch information
cala authored and xfurry committed May 21, 2016
1 parent 1dbaf45 commit a2dda4f
Show file tree
Hide file tree
Showing 4 changed files with 175 additions and 9 deletions.
7 changes: 5 additions & 2 deletions sql/scriptdev2/scriptdev2.sql
Expand Up @@ -1221,6 +1221,7 @@ UPDATE creature_template SET ScriptName='boss_maleki_the_pallid' WHERE entry=104
UPDATE creature_template SET ScriptName='boss_cannon_master_willey' WHERE entry=10997;
UPDATE creature_template SET ScriptName='boss_baroness_anastari' WHERE entry=10436;
UPDATE creature_template SET ScriptName='boss_silver_hand_bosses' WHERE entry IN (17910,17911,17912,17913,17914);
UPDATE creature_template SET ScriptName='npc_aurius' WHERE entry=10917;
UPDATE creature_template SET ScriptName='mobs_spectral_ghostly_citizen' WHERE entry IN (10384,10385);
UPDATE creature_template SET ScriptName='mob_restless_soul' WHERE entry=11122;
UPDATE gameobject_template SET ScriptName='go_gauntlet_gate' WHERE entry=175357;
Expand Down Expand Up @@ -3379,8 +3380,10 @@ INSERT INTO script_texts (entry,content_default,sound,type,language,emote,commen
(-1329017,'You fools think you can defeat me so easily? Face the true might of the Nathrezim!',0,1,0,0,'dathrohan SAY_TRANSFORM'),
(-1329018,'Damn you mortals! All my plans of revenge, all my hate... all burned to ash...',0,0,0,0,'dathrohan SAY_DEATH'),
(-1329019,'Don\'t worry about me! Slay this dreadful beast and cleanse this world of his foul taint!',0,6,0,0,'ysida YSIDA_SAY_RUN_5_MIN'),
(-1329020,'My death means nothing.... light... will... prevail!',0,6,0,0,'ysida YSIDA_SAY_RUN_FAIL');
(-1329020,'My death means nothing.... light... will... prevail!',0,6,0,0,'ysida YSIDA_SAY_RUN_FAIL'),

(-1329021,'Rivendare! I come for you!',0,1,0,0,'aurius YELL_AURIUS_AGGRO'),
(-1329022,'Argh!',0,0,0,0,'aurius SAY_AURIUS_DEATH');

-- -1 349 000 MARAUDON

Expand Down Expand Up @@ -10630,4 +10633,4 @@ INSERT INTO script_waypoint VALUES
(19671, 43, -67.624, -56.025, -0.844, 0, 'quest complete'),
(19671, 44, -64.493, -15.776, -0.943, 0, '');

-- EOF
-- EOF
Expand Up @@ -32,7 +32,8 @@ instance_stratholme::instance_stratholme(Map* pMap) : ScriptedInstance(pMap),
m_uiYellCounter(0),
m_uiMindlessCount(0),
m_uiPostboxesUsed(0),
m_uiSilverHandKilled(0)
m_uiSilverHandKilled(0),
m_uiAuriusSummonTimer(0)
{
Initialize();
}
Expand Down Expand Up @@ -68,6 +69,7 @@ void instance_stratholme::OnCreatureCreate(Creature* pCreature)
case NPC_YSIDA_TRIGGER:
case NPC_BARTHILAS:
case NPC_PALADIN_QUEST_CREDIT:
case NPC_AURIUS:
m_mNpcEntryGuidStore[pCreature->GetEntry()] = pCreature->GetObjectGuid();
break;

Expand Down Expand Up @@ -289,6 +291,10 @@ void instance_stratholme::SetData(uint32 uiType, uint32 uiData)
// Close Slaughterhouse door if needed
if (m_auiEncounter[uiType] == FAIL)
DoUseDoorOrButton(GO_PORT_GAUNTLET);

// If Aurius was given the medaillon wait 5s before summoning him
if (m_auiEncounter[TYPE_AURIUS] == SPECIAL)
m_uiAuriusSummonTimer = 5000;
}
if (uiData == DONE)
{
Expand Down Expand Up @@ -324,6 +330,10 @@ void instance_stratholme::SetData(uint32 uiType, uint32 uiData)
}
}

// If Aurius was spawned to help fight the Baron, mark that event as DONE
if (m_auiEncounter[TYPE_AURIUS] == IN_PROGRESS)
SetData(TYPE_AURIUS, DONE);

// Open Slaughterhouse door again
DoUseDoorOrButton(GO_PORT_GAUNTLET);
}
Expand Down Expand Up @@ -392,6 +402,71 @@ void instance_stratholme::SetData(uint32 uiType, uint32 uiData)
}
// No need to save anything here, so return
return;
case TYPE_AURIUS:
m_auiEncounter[uiType] = uiData;
// Prevent further players to complete the quest in that instance
// or autocomplete the follow-up quest
// the flag will be set back if event is succeed
if (uiData == SPECIAL)
{
if (Creature* pAurius = GetSingleCreatureFromStorage(NPC_AURIUS))
pAurius->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER);
break;
}
// Baron killed and Aurius is alive: give him his NPC Flags back
// So players can complete the quest
// Fake his death
if (uiData == DONE)
{
if (Creature* pAurius = GetSingleCreatureFromStorage(NPC_AURIUS))
{
DoScriptText(SAY_AURIUS_DEATH, pAurius);
pAurius->StopMoving();
pAurius->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER);
pAurius->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
pAurius->InterruptNonMeleeSpells(true);
pAurius->SetHealth(1);
pAurius->GetMotionMaster()->MovementExpired();
pAurius->GetMotionMaster()->MoveIdle();
pAurius->RemoveAllAurasOnDeath();
pAurius->SetStandState(UNIT_STAND_STATE_DEAD);
}
break;
}
if (uiData == IN_PROGRESS)
{
// Despawn Aurius in the Chapel and spawn it in the Slaughter House to engage Baron
if (Creature* pAurius_original = GetSingleCreatureFromStorage(NPC_AURIUS))
pAurius_original->ForcedDespawn();
if (Creature* pBaron = GetSingleCreatureFromStorage(NPC_BARON))
{
float fX, fY, fZ, fPosX, fPosY, fPosZ;
fX = pBaron->GetPositionX();
fY = pBaron->GetPositionY();
fZ = pBaron->GetPositionZ();
pBaron->GetRandomPoint(fX, fY, fZ, 4.0f, fPosX, fPosY, fPosZ);
if (Creature* pAurius = pBaron->SummonCreature(NPC_AURIUS, fPosX, fPosY, fPosZ, 0, TEMPSUMMON_DEAD_DESPAWN, 0))
{
DoScriptText(YELL_AURIUS_AGGRO, pAurius);
pAurius->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER);
pAurius->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
pAurius->AI()->AttackStart(pBaron);
}
}
}
if (uiData == FAIL)
{
// Baron encounter failed and Aurius is spawned: kill him
if (Creature* pAurius = GetSingleCreatureFromStorage(NPC_AURIUS))
{
if (pAurius->isAlive())
{
DoScriptText(SAY_AURIUS_DEATH, pAurius);
pAurius->DealDamage(pAurius, pAurius->GetHealth(), nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NONE, nullptr, false);
}
}
break;
}
}

if (uiData == DONE)
Expand All @@ -400,7 +475,8 @@ void instance_stratholme::SetData(uint32 uiType, uint32 uiData)

std::ostringstream saveStream;
saveStream << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2] << " "
<< m_auiEncounter[3] << " " << m_auiEncounter[4] << " " << m_auiEncounter[5] << " " << m_auiEncounter[6];
<< m_auiEncounter[3] << " " << m_auiEncounter[4] << " " << m_auiEncounter[5] << " "
<< m_auiEncounter[6] << " " << m_auiEncounter[7];

m_strInstData = saveStream.str();

Expand All @@ -421,7 +497,7 @@ void instance_stratholme::Load(const char* chrIn)

std::istringstream loadStream(chrIn);
loadStream >> m_auiEncounter[0] >> m_auiEncounter[1] >> m_auiEncounter[2] >> m_auiEncounter[3]
>> m_auiEncounter[4] >> m_auiEncounter[5] >> m_auiEncounter[6];
>> m_auiEncounter[4] >> m_auiEncounter[5] >> m_auiEncounter[6] >> m_auiEncounter[7];

for (uint8 i = 0; i < MAX_ENCOUNTER; ++i)
{
Expand Down Expand Up @@ -464,6 +540,7 @@ uint32 instance_stratholme::GetData(uint32 uiType) const
case TYPE_PALLID:
case TYPE_RAMSTEIN:
case TYPE_BARON:
case TYPE_AURIUS:
case TYPE_BARTHILAS_RUN:
case TYPE_POSTMASTER:
case TYPE_TRUE_MASTERS:
Expand Down Expand Up @@ -614,6 +691,7 @@ void instance_stratholme::OnCreatureDeath(Creature* pCreature)
case NPC_NERUBENKAN: SetData(TYPE_NERUB, DONE); break;
case NPC_RAMSTEIN: SetData(TYPE_RAMSTEIN, DONE); break;
case NPC_BARON: SetData(TYPE_BARON, DONE); break;
case NPC_AURIUS: SetData(TYPE_AURIUS, FAIL); break;

case NPC_THUZADIN_ACOLYTE:
ThazudinAcolyteJustDied(pCreature);
Expand Down Expand Up @@ -711,6 +789,18 @@ void instance_stratholme::Update(uint32 uiDiff)
m_uiBarthilasRunTimer -= uiDiff;
}

// Timer to summon Aurius into the Slaughter House once Baron is engaged
if (m_uiAuriusSummonTimer)
{
if (m_uiAuriusSummonTimer <= uiDiff)
{
SetData(TYPE_AURIUS, IN_PROGRESS);
m_uiAuriusSummonTimer = 0;
}
else
m_uiAuriusSummonTimer -= uiDiff;
}

// Check changes for Baron ultimatum timer only if Baron is not already in combat
if (m_uiBaronRunTimer && GetData(TYPE_BARON) != IN_PROGRESS)
{
Expand Down
66 changes: 66 additions & 0 deletions src/scriptdev2/scripts/eastern_kingdoms/stratholme/stratholme.cpp
Expand Up @@ -27,6 +27,7 @@ go_gauntlet_gate
go_stratholme_postbox
mob_restless_soul
mobs_spectral_ghostly_citizen
npc_aurius
EndContentData */

#include "precompiled.h"
Expand Down Expand Up @@ -307,6 +308,65 @@ CreatureAI* GetAI_mobs_spectral_ghostly_citizen(Creature* pCreature)
return new mobs_spectral_ghostly_citizenAI(pCreature);
}

/*######
## npc_aurius
######*/

enum
{
GOSSIP_TEXT_AURIUS_1 = 3755,
GOSSIP_TEXT_AURIUS_2 = 3756,
GOSSIP_TEXT_AURIUS_3 = 3757,
};

bool QuestRewarded_npc_aurius(Player* pPlayer, Creature* pCreature, const Quest* pQuest)
{
ScriptedInstance* pInstance = (ScriptedInstance*)pCreature->GetInstanceData();

if (!pInstance)
return false;

if (pInstance->GetData(TYPE_BARON) == DONE || pInstance->GetData(TYPE_AURIUS) != NOT_STARTED)
return false;

if ((pQuest->GetQuestId() == QUEST_MEDALLION_FAITH))
pInstance->SetData(TYPE_AURIUS, SPECIAL);

return true;
}

bool GossipHello_npc_aurius(Player* pPlayer, Creature* pCreature)
{
ScriptedInstance* pInstance = (ScriptedInstance*)pCreature->GetInstanceData();

uint32 ui_GossipId;

if (pInstance)
{
if (pCreature->isQuestGiver())
pPlayer->PrepareQuestMenu(pCreature->GetObjectGuid());

DEBUG_LOG("AURIUS TYPE: %u",pInstance->GetData(TYPE_AURIUS));
switch (pInstance->GetData(TYPE_AURIUS))
{
case SPECIAL:
ui_GossipId = GOSSIP_TEXT_AURIUS_2;
break;
case DONE:
ui_GossipId = GOSSIP_TEXT_AURIUS_3;
break;
default:
ui_GossipId = GOSSIP_TEXT_AURIUS_1;
break;
}
pPlayer->SEND_GOSSIP_MENU(ui_GossipId, pCreature->GetObjectGuid());

return true;
}

return false;
}

void AddSC_stratholme()
{
Script* pNewScript;
Expand Down Expand Up @@ -335,4 +395,10 @@ void AddSC_stratholme()
pNewScript->Name = "mobs_spectral_ghostly_citizen";
pNewScript->GetAI = &GetAI_mobs_spectral_ghostly_citizen;
pNewScript->RegisterSelf();

pNewScript = new Script;
pNewScript->Name = "npc_aurius";
pNewScript->pGossipHello = &GossipHello_npc_aurius;
pNewScript->pQuestRewardedNPC = &QuestRewarded_npc_aurius;
pNewScript->RegisterSelf();
}
15 changes: 11 additions & 4 deletions src/scriptdev2/scripts/eastern_kingdoms/stratholme/stratholme.h
Expand Up @@ -7,7 +7,7 @@

enum
{
MAX_ENCOUNTER = 10,
MAX_ENCOUNTER = 11,
MAX_SILVERHAND = 5,
MAX_ZIGGURATS = 3,

Expand All @@ -18,9 +18,10 @@ enum
TYPE_RAMSTEIN = 4,
TYPE_BARON = 5,
TYPE_BARTHILAS_RUN = 6,
TYPE_BLACK_GUARDS = 7,
TYPE_POSTMASTER = 8,
TYPE_TRUE_MASTERS = 9,
TYPE_AURIUS = 7,
TYPE_BLACK_GUARDS = 8,
TYPE_POSTMASTER = 9,
TYPE_TRUE_MASTERS = 10,

NPC_TIMMY_THE_CRUEL = 10808,
NPC_BARTHILAS = 10435,
Expand All @@ -41,6 +42,7 @@ enum
NPC_CRIMSON_GALLANT = 10424,
NPC_CRIMSON_GUARDSMAN = 10418,
NPC_CRIMSON_CONJURER = 10419,
NPC_AURIUS = 10917,
NPC_UNDEAD_POSTMAN = 11142,
NPC_GREGOR_THE_JUSTICIAR = 17910, // related to quest "True Masters of the Light"
NPC_CATHELA_THE_SEEKER = 17911,
Expand All @@ -63,6 +65,7 @@ enum
GO_YSIDA_CAGE = 181071, // Cage to open after baron event is done

QUEST_DEAD_MAN_PLEA = 8945,
QUEST_MEDALLION_FAITH = 5122,
SPELL_BARON_ULTIMATUM = 27861, // Aura for player during the run (visual icon)
SPELL_BARON_SOUL_DRAIN = 27640, // Used by the Baron to kill Ysida
SPELL_YSIDA_FREED = 27773, // Argent Dawn extra-reputation reward on successful Baron run
Expand All @@ -83,6 +86,9 @@ enum
SAY_ANNOUNCE_RAMSTEIN = -1329013,
SAY_UNDEAD_DEFEAT = -1329014,
SAY_EPILOGUE = -1329015,

YELL_AURIUS_AGGRO = -1329021,
SAY_AURIUS_DEATH = -1329022,
};

struct EventLocation
Expand Down Expand Up @@ -151,6 +157,7 @@ class instance_stratholme : public ScriptedInstance
uint32 m_uiBarthilasRunTimer;
uint32 m_uiMindlessSummonTimer;
uint32 m_uiSlaugtherSquareTimer;
uint32 m_uiAuriusSummonTimer;

uint32 m_uiYellCounter;
uint32 m_uiMindlessCount;
Expand Down

0 comments on commit a2dda4f

Please sign in to comment.