Skip to content

Commit

Permalink
Add proper spell usage and GO spawning to q.10310
Browse files Browse the repository at this point in the history
  • Loading branch information
killerwife committed May 29, 2017
1 parent 274222f commit 91e4fce
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 25 deletions.
76 changes: 53 additions & 23 deletions src/game/AI/ScriptDevAI/scripts/outland/netherstorm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1154,18 +1154,15 @@ enum
SAY_DRIJYA_7 = -1000975,
SAY_DRIJYA_COMPLETE = -1000976,

SPELL_SUMMON_SMOKE = 42456, // summon temp GO 185318
SPELL_SUMMON_FIRE = 42467, // summon temp GO 185319
SPELL_EXPLOSION_VISUAL = 30934, // Original spell 42458 (Doesn't exist in TBC)

NPC_EXPLODE_TRIGGER = 20296,
NPC_TERROR_IMP = 20399,
NPC_LEGION_TROOPER = 20402,
NPC_LEGION_DESTROYER = 20403,

// GO_SMOKE = 185318,
// GO_FIRE = 185317, // not sure if this one is used
// GO_BIG_FIRE = 185319,
GO_ROCKET_SMOKE = 183988,
GO_ROCKET_FIRE = 183987,

QUEST_ID_WARP_GATE = 10310,

Expand All @@ -1175,7 +1172,13 @@ enum

struct npc_drijyaAI : public npc_escortAI
{
npc_drijyaAI(Creature* pCreature) : npc_escortAI(pCreature) { Reset(); }
npc_drijyaAI(Creature* pCreature) : npc_escortAI(pCreature)
{
m_instance = (ScriptedInstance*) m_creature->GetInstanceData();
m_instance->GetGameObjectGuidVectorFromStorage(GO_ROCKET_SMOKE, m_uiSmokeGuids);
m_instance->GetGameObjectGuidVectorFromStorage(GO_ROCKET_FIRE, m_uiFireGuids);
Reset();
}

bool m_uiSayCount;
uint8 m_uiSpawnCount;
Expand All @@ -1186,6 +1189,11 @@ struct npc_drijyaAI : public npc_escortAI

ObjectGuid m_explodeTriggerGuid;

ScriptedInstance* m_instance;

GuidVector m_uiSmokeGuids;
GuidVector m_uiFireGuids;

void Reset() override
{
if (!HasEscortState(STATE_ESCORT_ESCORTING))
Expand All @@ -1199,11 +1207,7 @@ struct npc_drijyaAI : public npc_escortAI
}
}

void MoveInLineOfSight(Unit* pWho) override
{
if (pWho->GetTypeId() != TYPEID_PLAYER)
return;
}
void MoveInLineOfSight(Unit* pWho) override {}

void AttackedBy(Unit* pWho) override
{
Expand Down Expand Up @@ -1232,6 +1236,32 @@ struct npc_drijyaAI : public npc_escortAI
}
}

void RespawnGo(ObjectGuid &guid)
{
if (GameObject* go = m_creature->GetMap()->GetGameObject(guid))
{
go->SetLootState(GO_READY);
go->SetRespawnTime(300);
go->Refresh();
}
}

void RespawnGo(bool smoke, uint32 posStart, uint32 posEnd)
{
if (smoke)
{
auto iter = std::next(m_uiSmokeGuids.begin(), posStart);
for (uint32 i = posEnd - posStart + 1; iter != m_uiSmokeGuids.end() && i > 0; ++iter, i--)
RespawnGo((*iter));
}
else
{
auto iter = std::next(m_uiFireGuids.begin(), posStart);
for (uint32 i = posEnd - posStart + 1; iter != m_uiFireGuids.end() && i > 0; ++iter, i--)
RespawnGo((*iter));
}
}

void WaypointReached(uint32 uiPointId) override
{
switch (uiPointId)
Expand Down Expand Up @@ -1259,7 +1289,8 @@ struct npc_drijyaAI : public npc_escortAI
case 8:
if (Player* pPlayer = GetPlayerForEscort())
m_creature->SetFacingToObject(pPlayer);

// first pillar smoke
RespawnGo(true, 0, 0);
DoScriptText(SAY_DRIJYA_4, m_creature);
m_creature->HandleEmote(EMOTE_ONESHOT_NONE);
break;
Expand All @@ -1274,7 +1305,8 @@ struct npc_drijyaAI : public npc_escortAI
case 13:
if (Player* pPlayer = GetPlayerForEscort())
m_creature->SetFacingToObject(pPlayer);

// second pillar smoke
RespawnGo(true, 1, 1);
DoScriptText(SAY_DRIJYA_5, m_creature);
m_creature->HandleEmote(EMOTE_ONESHOT_NONE);
break;
Expand All @@ -1287,20 +1319,17 @@ struct npc_drijyaAI : public npc_escortAI
break;
case 18:
m_creature->HandleEmote(EMOTE_ONESHOT_NONE);
if (Creature* pTrigger = m_creature->GetMap()->GetCreature(m_explodeTriggerGuid))
{
pTrigger->CastSpell(pTrigger, SPELL_SUMMON_SMOKE, TRIGGERED_OLD_TRIGGERED);
m_creature->SetFacingToObject(pTrigger);
}
// manifold smoke
RespawnGo(true, 2, 4);
DoScriptText(SAY_DRIJYA_6, m_creature);
m_creature->HandleEmote(EMOTE_ONESHOT_ROAR);
break;
case 19:
// warp gate explosion, smoke and fire
if (Creature* pTrigger = m_creature->GetMap()->GetCreature(m_explodeTriggerGuid))
{
pTrigger->CastSpell(pTrigger, SPELL_EXPLOSION_VISUAL, TRIGGERED_OLD_TRIGGERED);
pTrigger->CastSpell(pTrigger, SPELL_SUMMON_FIRE, TRIGGERED_OLD_TRIGGERED);
}
pTrigger->CastSpell(pTrigger, SPELL_EXPLOSION_VISUAL, TRIGGERED_NONE);
RespawnGo(false, 0, 4);
RespawnGo(true, 5, 10);
break;
case 20:
DoScriptText(SAY_DRIJYA_7, m_creature);
Expand All @@ -1314,6 +1343,7 @@ struct npc_drijyaAI : public npc_escortAI
DoScriptText(SAY_DRIJYA_COMPLETE, m_creature, pPlayer);
pPlayer->GroupEventHappens(QUEST_ID_WARP_GATE, m_creature);
}
m_creature->ClearTemporaryFaction();
break;
}
}
Expand All @@ -1322,7 +1352,7 @@ struct npc_drijyaAI : public npc_escortAI
{
if (eventType == AI_EVENT_START_ESCORT && pInvoker->GetTypeId() == TYPEID_PLAYER)
{
m_creature->SetFactionTemporary(FACTION_ESCORT_N_NEUTRAL_PASSIVE, TEMPFACTION_RESTORE_RESPAWN);
m_creature->SetFactionTemporary(FACTION_ESCORT_N_NEUTRAL_PASSIVE, TEMPFACTION_RESTORE_RESPAWN | TEMPFACTION_TOGGLE_OOC_NOT_ATTACK | TEMPFACTION_TOGGLE_PASSIVE);
Start(false, (Player*)pInvoker, GetQuestTemplateStore(uiMiscValue), true);
}
}
Expand Down
14 changes: 13 additions & 1 deletion src/game/AI/ScriptDevAI/scripts/world/world_map_scripts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,19 @@ struct world_map_outland : public ScriptedMap
}
}

void SetData(uint32 /*uiType*/, uint32 /*uiData*/) {}
void OnObjectCreate(GameObject* go) override
{
switch (go->GetEntry())
{
case GO_ROCKET_FIRE:
case GO_ROCKET_SMOKE:
m_mGoEntryGuidCollection[go->GetEntry()].push_back(go->GetObjectGuid());
std::sort(m_mGoEntryGuidCollection[go->GetEntry()].begin(), m_mGoEntryGuidCollection[go->GetEntry()].end());
break;
}
}

void SetData(uint32 /*uiType*/, uint32 /*uiData*/) override {}
};

InstanceData* GetInstanceData_world_map_outland(Map* pMap)
Expand Down
6 changes: 5 additions & 1 deletion src/game/AI/ScriptDevAI/scripts/world/world_map_scripts.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ enum
NPC_UNLEASHED_HELLION = 25002,

// Quest 10998
NPC_VIMGOL_VISUAL_BUNNY = 23040,
NPC_VIMGOL_VISUAL_BUNNY = 23040,

// Quest 10310
GO_ROCKET_FIRE = 183987,
GO_ROCKET_SMOKE = 183988,
};

enum SpawnIndexes
Expand Down

0 comments on commit 91e4fce

Please sign in to comment.