Skip to content

Commit

Permalink
Improve quest 7631
Browse files Browse the repository at this point in the history
Part of cmangos/mangos-classic#200

Signed-off-by: Xfurry <xfurry@cmangos.net>
  • Loading branch information
Phatcat authored and xfurry committed Nov 6, 2016
1 parent d363e4d commit a0e24ef
Show file tree
Hide file tree
Showing 5 changed files with 144 additions and 7 deletions.
4 changes: 4 additions & 0 deletions sql/scriptdev2/scriptdev2.sql
Expand Up @@ -578,6 +578,10 @@ UPDATE creature_template SET ScriptName='npc_rigger_gizelton' WHERE entry=11626;

/* DIRE MAUL */
UPDATE instance_template SET ScriptName='instance_dire_maul' WHERE map=429;
DELETE FROM scripted_event_id WHERE id IN (8420,8428);
INSERT INTO scripted_event_id VALUES
(8420,'event_spells_warlock_dreadsteed'),
(8428,'event_spells_warlock_dreadsteed');

/* DRAGONBLIGHT */
UPDATE creature_template SET ScriptName='npc_destructive_ward' WHERE entry=27430;
Expand Down
Expand Up @@ -225,7 +225,7 @@ class instance_blackrock_depths : public ScriptedInstance
void OnCreatureCreate(Creature* pCreature) override;
void OnCreatureEnterCombat(Creature* pCreature) override;
void OnCreatureDeath(Creature* pCreature) override;
void OnCreatureEvade(Creature* pCreature);
void OnCreatureEvade(Creature* pCreature) override;
void OnObjectCreate(GameObject* pGo) override;

void SetData(uint32 uiType, uint32 uiData) override;
Expand Down
75 changes: 73 additions & 2 deletions src/scriptdev2/scripts/kalimdor/dire_maul/dire_maul.cpp
Expand Up @@ -16,13 +16,84 @@

/* ScriptData
SDName: dire_maul
SD%Complete: 0
SDComment: Placeholder
SD%Complete: 100%
SDComment: Quest support: 7631.
SDCategory: Dire Maul
EndScriptData */

/* ContentData
event_spell_release_jeevee
EndContentData */

#include "precompiled.h"
#include "dire_maul.h"

/*######
## event_spells_warlock_dreadsteed
######*/

enum
{
NPC_JEEVEES = 14500,

EVENT_ID_SUMMON_JEEVEES = 8420,
EVENT_ID_SUMMON_DREADSTEED = 8428,
};

bool ProcessEventId_event_spells_warlock_dreadsteed(uint32 uiEventId, Object* pSource, Object* /*pTarget*/, bool bIsStart)
{
if (bIsStart && pSource->GetTypeId() == TYPEID_PLAYER)
{
if (instance_dire_maul* pInstance = (instance_dire_maul*)((Player*)pSource)->GetInstanceData())
{
// summon J'eevees and start event
if (uiEventId == EVENT_ID_SUMMON_JEEVEES)
{
if (pInstance->GetData(TYPE_DREADSTEED) == NOT_STARTED)
{
// start event: summon the dummy infernal controller and set in progress
// The dummy infernal is used to check for event == FAIL and stop the script on the DB side
((Player*)pSource)->SummonCreature(NPC_WARLOCK_DUMMY_INFERNAL, -37.9392f, 812.805f, -29.4525f, 4.81711f, TEMPSUMMON_DEAD_DESPAWN, 0);

// start from point 13. Others are for Scholomance event
if (Creature* pImp = ((Player*)pSource)->SummonCreature(NPC_JEEVEES, -37.9392f, 812.805f, -29.4525f, 4.81711f, TEMPSUMMON_DEAD_DESPAWN, 0))
{
pImp->GetMotionMaster()->MoveWaypoint();
pImp->GetMotionMaster()->SetNextWaypoint(13);
}

pInstance->SetData(TYPE_DREADSTEED, IN_PROGRESS);

// allow the rest to be handled by dbscript
return false;
}
}
// summon Dreadsteed
else if (uiEventId == EVENT_ID_SUMMON_DREADSTEED)
{
if (pInstance->GetData(TYPE_DREADSTEED) == SPECIAL)
{
// despawn the circle
if (GameObject* pCircle = pInstance->GetSingleGameObjectFromStorage(GO_WARLOCK_RITUAL_CIRCLE))
pCircle->SetLootState(GO_JUST_DEACTIVATED);

pInstance->SetData(TYPE_DREADSTEED, DONE);

// rest is done by DBscript
return false;
}
}
}
}
return true;
}

void AddSC_dire_maul()
{
Script* pNewScript;

pNewScript = new Script;
pNewScript->Name = "event_spells_warlock_dreadsteed";
pNewScript->pProcessEventId = &ProcessEventId_event_spells_warlock_dreadsteed;
pNewScript->RegisterSelf();
}
14 changes: 13 additions & 1 deletion src/scriptdev2/scripts/kalimdor/dire_maul/dire_maul.h
Expand Up @@ -7,7 +7,7 @@

enum
{
MAX_ENCOUNTER = 16,
MAX_ENCOUNTER = 17,
MAX_GENERATORS = 5,

// East
Expand All @@ -32,6 +32,9 @@ enum
TYPE_SLIPKIK = 14,
TYPE_KROMCRUSH = 15,

// Other
TYPE_DREADSTEED = 16,

// East
GO_CRUMBLE_WALL = 177220,
GO_CORRUPT_VINE = 179502,
Expand All @@ -49,6 +52,7 @@ enum
NPC_ARCANE_ABERRATION = 11480,
NPC_MANA_REMNANT = 11483,
NPC_HIGHBORNE_SUMMONER = 11466,
NPC_WARLOCK_DUMMY_INFERNAL = 14501,

GO_PRINCES_CHEST = 179545,
GO_PRINCES_CHEST_AURA = 179563,
Expand All @@ -60,6 +64,8 @@ enum
GO_FORCEFIELD = 179503,
GO_WARPWOOD_DOOR = 177221,
GO_WEST_LIBRARY_DOOR = 179550,
GO_DREADSTEED_PORTAL = 179681,
GO_WARLOCK_RITUAL_CIRCLE = 179668,

// North
NPC_GUARD_MOLDAR = 14326,
Expand Down Expand Up @@ -105,12 +111,15 @@ class instance_dire_maul : public ScriptedInstance

void OnCreatureEnterCombat(Creature* pCreature) override;
void OnCreatureDeath(Creature* pCreature) override;
void OnCreatureEvade(Creature* pCreature) override;

const char* Save() const override { return m_strInstData.c_str(); }
void Load(const char* chrIn) override;

bool CheckConditionCriteriaMeet(Player const* pPlayer, uint32 uiInstanceConditionId, WorldObject const* pConditionSource, uint32 conditionSourceType) const override;

void Update(uint32 uiDiff) override;

protected:
bool CheckAllGeneratorsDestroyed();
void ProcessForceFieldOpening();
Expand All @@ -129,8 +138,11 @@ class instance_dire_maul : public ScriptedInstance

GuidList m_luiHighborneSummonerGUIDs;
GuidList m_lGeneratorGuardGUIDs;
GuidList m_lDreadsteedPortalsGUIDs;
std::set<uint32> m_sSortedGeneratorGuards[MAX_GENERATORS];

uint32 m_uiDreadsteedEventTimer;

// North
bool m_bDoNorthBeforeWest;
};
Expand Down
56 changes: 53 additions & 3 deletions src/scriptdev2/scripts/kalimdor/dire_maul/instance_dire_maul.cpp
Expand Up @@ -26,7 +26,8 @@ EndScriptData */

instance_dire_maul::instance_dire_maul(Map* pMap) : ScriptedInstance(pMap),
m_bWallDestroyed(false),
m_bDoNorthBeforeWest(false)
m_bDoNorthBeforeWest(false),
m_uiDreadsteedEventTimer(0)
{
Initialize();
}
Expand Down Expand Up @@ -67,6 +68,7 @@ void instance_dire_maul::OnCreatureCreate(Creature* pCreature)
m_lGeneratorGuardGUIDs.push_back(pCreature->GetObjectGuid());
return;
case NPC_IMMOLTHAR:
case NPC_WARLOCK_DUMMY_INFERNAL:
break;
case NPC_HIGHBORNE_SUMMONER:
m_luiHighborneSummonerGUIDs.push_back(pCreature->GetObjectGuid());
Expand Down Expand Up @@ -145,6 +147,13 @@ void instance_dire_maul::OnObjectCreate(GameObject* pGo)
pGo->SetFlag(GAMEOBJECT_FLAGS, m_bDoNorthBeforeWest ? GO_FLAG_NO_INTERACT : GO_FLAG_LOCKED);
pGo->RemoveFlag(GAMEOBJECT_FLAGS, m_bDoNorthBeforeWest ? GO_FLAG_LOCKED : GO_FLAG_NO_INTERACT);
break;
case GO_DREADSTEED_PORTAL:
// exclude the central portal
if (pGo->GetPositionZ() > -29.0f)
m_lDreadsteedPortalsGUIDs.push_back(pGo->GetObjectGuid());
return;
case GO_WARLOCK_RITUAL_CIRCLE:
break;

// North
case GO_NORTH_LIBRARY_DOOR:
Expand Down Expand Up @@ -224,6 +233,32 @@ void instance_dire_maul::SetData(uint32 uiType, uint32 uiData)
case TYPE_PRINCE:
m_auiEncounter[uiType] = uiData;
break;
case TYPE_DREADSTEED:
// start timer
if (uiData == IN_PROGRESS)
m_uiDreadsteedEventTimer = 390000;
else if (uiData == SPECIAL)
{
// set animation for next stage
if (GameObject* pCircle = GetSingleGameObjectFromStorage(GO_WARLOCK_RITUAL_CIRCLE))
pCircle->SetGoState(GO_STATE_ACTIVE);

// despawn the controller; Inform the attackers to teleport
if (Creature* pDummy = GetSingleCreatureFromStorage(NPC_WARLOCK_DUMMY_INFERNAL))
{
pDummy->AI()->SendAIEventAround(AI_EVENT_CUSTOM_EVENTAI_A, pDummy, 4000, 100.0f);
pDummy->ForcedDespawn(5000);
}

// despawn side portals
for (GuidList::const_iterator itr = m_lDreadsteedPortalsGUIDs.begin(); itr != m_lDreadsteedPortalsGUIDs.end(); ++itr)
{
if (GameObject* pGo = instance->GetGameObject(*itr))
pGo->SetLootState(GO_JUST_DEACTIVATED);
}
}
m_auiEncounter[uiType] = uiData;
break;
case TYPE_PYLON_1:
case TYPE_PYLON_2:
case TYPE_PYLON_3:
Expand Down Expand Up @@ -293,7 +328,7 @@ void instance_dire_maul::SetData(uint32 uiType, uint32 uiData)
<< m_auiEncounter[6] << " " << m_auiEncounter[7] << " " << m_auiEncounter[8] << " "
<< m_auiEncounter[9] << " " << m_auiEncounter[10] << " " << m_auiEncounter[11] << " "
<< m_auiEncounter[12] << " " << m_auiEncounter[13] << " " << m_auiEncounter[14] << " "
<< m_auiEncounter[15];
<< m_auiEncounter[15] << " " << m_auiEncounter[16];

m_strInstData = saveStream.str();

Expand Down Expand Up @@ -391,7 +426,7 @@ void instance_dire_maul::Load(const char* chrIn)
m_auiEncounter[6] >> m_auiEncounter[7] >> m_auiEncounter[8] >>
m_auiEncounter[9] >> m_auiEncounter[10] >> m_auiEncounter[11] >>
m_auiEncounter[12] >> m_auiEncounter[13] >> m_auiEncounter[14] >>
m_auiEncounter[15];
m_auiEncounter[15] >> m_auiEncounter[16];

if (m_auiEncounter[TYPE_ALZZIN] >= DONE)
m_bWallDestroyed = true;
Expand Down Expand Up @@ -517,6 +552,21 @@ void instance_dire_maul::PylonGuardJustDied(Creature* pCreature)
}
}

void instance_dire_maul::Update(uint32 uiDiff)
{
if (m_uiDreadsteedEventTimer)
{
if (m_uiDreadsteedEventTimer <= uiDiff)
{
// set encounter to special to allow the next event to proceed
SetData(TYPE_DREADSTEED, SPECIAL);
m_uiDreadsteedEventTimer = 0;
}
else
m_uiDreadsteedEventTimer -= uiDiff;
}
}

InstanceData* GetInstanceData_instance_dire_maul(Map* pMap)
{
return new instance_dire_maul(pMap);
Expand Down

1 comment on commit a0e24ef

@xfurry
Copy link
Member

@xfurry xfurry commented on a0e24ef Nov 6, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm...
I thought I set the author as @MantisLord
Not sure what happened with github here.

Please sign in to comment.