* Rename InstanceData to InstanceScript
* Rename *mgr to their new names in scripts project * Mass convert all the scripts (NEEDS THOROUGH TESTING, because it was done automatically) Please, report bugs on issue tracker. --HG-- branch : trunk rename : src/server/game/Instances/InstanceData.cpp => src/server/game/Instances/InstanceScript.cpp rename : src/server/game/Instances/InstanceData.h => src/server/game/Instances/InstanceScript.h
This commit is contained in:
@@ -51,96 +51,104 @@ enum eOOX
|
||||
FACTION_ESCORTEE_A = 774,
|
||||
FACTION_ESCORTEE_H = 775
|
||||
};
|
||||
|
||||
struct npc_00x09hlAI : public npc_escortAI
|
||||
␍class npc_00x09hl : public CreatureScript
|
||||
{
|
||||
npc_00x09hlAI(Creature* pCreature) : npc_escortAI(pCreature) { }
|
||||
public:
|
||||
npc_00x09hl() : CreatureScript("npc_00x09hl") { }
|
||||
|
||||
void Reset() { }
|
||||
|
||||
void WaypointReached(uint32 uiPointId)
|
||||
bool OnQuestAccept(Player* pPlayer, Creature* pCreature, const Quest* pQuest)
|
||||
{
|
||||
switch(uiPointId)
|
||||
if (pQuest->GetQuestId() == QUEST_RESQUE_OOX_09)
|
||||
{
|
||||
case 26:
|
||||
DoScriptText(SAY_OOX_AMBUSH, me);
|
||||
break;
|
||||
case 43:
|
||||
DoScriptText(SAY_OOX_AMBUSH, me);
|
||||
break;
|
||||
case 64:
|
||||
DoScriptText(SAY_OOX_END, me);
|
||||
if (Player* pPlayer = GetPlayerForEscort())
|
||||
pPlayer->GroupEventHappens(QUEST_RESQUE_OOX_09, me);
|
||||
break;
|
||||
pCreature->SetStandState(UNIT_STAND_STATE_STAND);
|
||||
|
||||
if (pPlayer->GetTeam() == ALLIANCE)
|
||||
pCreature->setFaction(FACTION_ESCORTEE_A);
|
||||
else if (pPlayer->GetTeam() == HORDE)
|
||||
pCreature->setFaction(FACTION_ESCORTEE_H);
|
||||
|
||||
DoScriptText(SAY_OOX_START, pCreature, pPlayer);
|
||||
|
||||
if (npc_00x09hlAI* pEscortAI = CAST_AI(npc_00x09hl::npc_00x09hlAI, pCreature->AI()))
|
||||
pEscortAI->Start(false, false, pPlayer->GetGUID(), pQuest);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void WaypointStart(uint32 uiPointId)
|
||||
CreatureAI* GetAI(Creature* pCreature) const
|
||||
{
|
||||
switch(uiPointId)
|
||||
return new npc_00x09hlAI(pCreature);
|
||||
}
|
||||
|
||||
struct npc_00x09hlAI : public npc_escortAI
|
||||
{
|
||||
npc_00x09hlAI(Creature* pCreature) : npc_escortAI(pCreature) { }
|
||||
|
||||
void Reset() { }
|
||||
|
||||
void WaypointReached(uint32 uiPointId)
|
||||
{
|
||||
case 27:
|
||||
for (uint8 i = 0; i < 3; ++i)
|
||||
{
|
||||
const Position src = {147.927444f, -3851.513428f, 130.893f, 0};
|
||||
Position dst;
|
||||
me->GetRandomPoint(src, 7.0f, dst);
|
||||
DoSummon(NPC_MARAUDING_OWL, dst, 25000, TEMPSUMMON_CORPSE_TIMED_DESPAWN);
|
||||
}
|
||||
break;
|
||||
case 44:
|
||||
for (uint8 i = 0; i < 3; ++i)
|
||||
{
|
||||
const Position src = {-141.151581f, -4291.213867f, 120.130f, 0};
|
||||
Position dst;
|
||||
me->GetRandomPoint(src, 7.0f, dst);
|
||||
me->SummonCreature(NPC_VILE_AMBUSHER, dst, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 25000);
|
||||
}
|
||||
break;
|
||||
switch(uiPointId)
|
||||
{
|
||||
case 26:
|
||||
DoScriptText(SAY_OOX_AMBUSH, me);
|
||||
break;
|
||||
case 43:
|
||||
DoScriptText(SAY_OOX_AMBUSH, me);
|
||||
break;
|
||||
case 64:
|
||||
DoScriptText(SAY_OOX_END, me);
|
||||
if (Player* pPlayer = GetPlayerForEscort())
|
||||
pPlayer->GroupEventHappens(QUEST_RESQUE_OOX_09, me);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EnterCombat(Unit* pWho)
|
||||
{
|
||||
if (pWho->GetEntry() == NPC_MARAUDING_OWL || pWho->GetEntry() == NPC_VILE_AMBUSHER)
|
||||
return;
|
||||
void WaypointStart(uint32 uiPointId)
|
||||
{
|
||||
switch(uiPointId)
|
||||
{
|
||||
case 27:
|
||||
for (uint8 i = 0; i < 3; ++i)
|
||||
{
|
||||
const Position src = {147.927444f, -3851.513428f, 130.893f, 0};
|
||||
Position dst;
|
||||
me->GetRandomPoint(src, 7.0f, dst);
|
||||
DoSummon(NPC_MARAUDING_OWL, dst, 25000, TEMPSUMMON_CORPSE_TIMED_DESPAWN);
|
||||
}
|
||||
break;
|
||||
case 44:
|
||||
for (uint8 i = 0; i < 3; ++i)
|
||||
{
|
||||
const Position src = {-141.151581f, -4291.213867f, 120.130f, 0};
|
||||
Position dst;
|
||||
me->GetRandomPoint(src, 7.0f, dst);
|
||||
me->SummonCreature(NPC_VILE_AMBUSHER, dst, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 25000);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (rand()%1)
|
||||
DoScriptText(SAY_OOX_AGGRO1, me);
|
||||
else
|
||||
DoScriptText(SAY_OOX_AGGRO2, me);
|
||||
}
|
||||
void EnterCombat(Unit* pWho)
|
||||
{
|
||||
if (pWho->GetEntry() == NPC_MARAUDING_OWL || pWho->GetEntry() == NPC_VILE_AMBUSHER)
|
||||
return;
|
||||
|
||||
if (rand()%1)
|
||||
DoScriptText(SAY_OOX_AGGRO1, me);
|
||||
else
|
||||
DoScriptText(SAY_OOX_AGGRO2, me);
|
||||
}
|
||||
|
||||
void JustSummoned(Creature* pSummoned)
|
||||
{
|
||||
pSummoned->GetMotionMaster()->MovePoint(0, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ());
|
||||
}
|
||||
};
|
||||
|
||||
void JustSummoned(Creature* pSummoned)
|
||||
{
|
||||
pSummoned->GetMotionMaster()->MovePoint(0, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ());
|
||||
}
|
||||
};
|
||||
|
||||
bool QuestAccept_npc_00x09hl(Player* pPlayer, Creature* pCreature, const Quest* pQuest)
|
||||
{
|
||||
if (pQuest->GetQuestId() == QUEST_RESQUE_OOX_09)
|
||||
{
|
||||
pCreature->SetStandState(UNIT_STAND_STATE_STAND);
|
||||
|
||||
if (pPlayer->GetTeam() == ALLIANCE)
|
||||
pCreature->setFaction(FACTION_ESCORTEE_A);
|
||||
else if (pPlayer->GetTeam() == HORDE)
|
||||
pCreature->setFaction(FACTION_ESCORTEE_H);
|
||||
|
||||
DoScriptText(SAY_OOX_START, pCreature, pPlayer);
|
||||
|
||||
if (npc_00x09hlAI* pEscortAI = CAST_AI(npc_00x09hlAI, pCreature->AI()))
|
||||
pEscortAI->Start(false, false, pPlayer->GetGUID(), pQuest);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
CreatureAI* GetAI_npc_00x09hl(Creature* pCreature)
|
||||
{
|
||||
return new npc_00x09hlAI(pCreature);
|
||||
}
|
||||
|
||||
/*######
|
||||
## npc_rinji
|
||||
@@ -178,175 +186,172 @@ Location m_afAmbushMoveTo[] =
|
||||
{166.630386, -2824.780273, 108.153},
|
||||
{70.886589, -2874.335449, 116.675}
|
||||
};
|
||||
|
||||
struct npc_rinjiAI : public npc_escortAI
|
||||
␍class npc_rinji : public CreatureScript
|
||||
{
|
||||
npc_rinjiAI(Creature* pCreature) : npc_escortAI(pCreature)
|
||||
public:
|
||||
npc_rinji() : CreatureScript("npc_rinji") { }
|
||||
|
||||
bool OnQuestAccept(Player* pPlayer, Creature* pCreature, const Quest* pQuest)
|
||||
{
|
||||
m_bIsByOutrunner = false;
|
||||
m_iSpawnId = 0;
|
||||
}
|
||||
|
||||
bool m_bIsByOutrunner;
|
||||
uint32 m_uiPostEventCount;
|
||||
uint32 m_uiPostEventTimer;
|
||||
int m_iSpawnId;
|
||||
|
||||
void Reset()
|
||||
{
|
||||
m_uiPostEventCount = 0;
|
||||
m_uiPostEventTimer = 3000;
|
||||
}
|
||||
|
||||
void JustRespawned()
|
||||
{
|
||||
m_bIsByOutrunner = false;
|
||||
m_iSpawnId = 0;
|
||||
|
||||
npc_escortAI::JustRespawned();
|
||||
}
|
||||
|
||||
void EnterCombat(Unit* pWho)
|
||||
{
|
||||
if (HasEscortState(STATE_ESCORT_ESCORTING))
|
||||
if (pQuest->GetQuestId() == QUEST_RINJI_TRAPPED)
|
||||
{
|
||||
if (pWho->GetEntry() == NPC_OUTRUNNER && !m_bIsByOutrunner)
|
||||
{
|
||||
DoScriptText(SAY_RIN_BY_OUTRUNNER, pWho);
|
||||
m_bIsByOutrunner = true;
|
||||
}
|
||||
if (GameObject* pGo = pCreature->FindNearestGameObject(GO_RINJI_CAGE, INTERACTION_DISTANCE))
|
||||
pGo->UseDoorOrButton();
|
||||
|
||||
if (rand()%4)
|
||||
return;
|
||||
|
||||
//only if attacked and escorter is not in combat?
|
||||
DoScriptText(RAND(SAY_RIN_HELP_1,SAY_RIN_HELP_2), me);
|
||||
if (npc_rinjiAI* pEscortAI = CAST_AI(npc_rinji::npc_rinjiAI, pCreature->AI()))
|
||||
pEscortAI->Start(false, false, pPlayer->GetGUID(), pQuest);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void DoSpawnAmbush(bool bFirst)
|
||||
CreatureAI* GetAI(Creature* pCreature) const
|
||||
{
|
||||
if (!bFirst)
|
||||
m_iSpawnId = 1;
|
||||
return new npc_rinjiAI(pCreature);
|
||||
}
|
||||
|
||||
me->SummonCreature(NPC_RANGER,
|
||||
m_afAmbushSpawn[m_iSpawnId].m_fX, m_afAmbushSpawn[m_iSpawnId].m_fY, m_afAmbushSpawn[m_iSpawnId].m_fZ, 0.0f,
|
||||
TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60000);
|
||||
|
||||
for (int i = 0; i < 2; ++i)
|
||||
struct npc_rinjiAI : public npc_escortAI
|
||||
{
|
||||
npc_rinjiAI(Creature* pCreature) : npc_escortAI(pCreature)
|
||||
{
|
||||
me->SummonCreature(NPC_OUTRUNNER,
|
||||
m_bIsByOutrunner = false;
|
||||
m_iSpawnId = 0;
|
||||
}
|
||||
|
||||
bool m_bIsByOutrunner;
|
||||
uint32 m_uiPostEventCount;
|
||||
uint32 m_uiPostEventTimer;
|
||||
int m_iSpawnId;
|
||||
|
||||
void Reset()
|
||||
{
|
||||
m_uiPostEventCount = 0;
|
||||
m_uiPostEventTimer = 3000;
|
||||
}
|
||||
|
||||
void JustRespawned()
|
||||
{
|
||||
m_bIsByOutrunner = false;
|
||||
m_iSpawnId = 0;
|
||||
|
||||
npc_escortAI::JustRespawned();
|
||||
}
|
||||
|
||||
void EnterCombat(Unit* pWho)
|
||||
{
|
||||
if (HasEscortState(STATE_ESCORT_ESCORTING))
|
||||
{
|
||||
if (pWho->GetEntry() == NPC_OUTRUNNER && !m_bIsByOutrunner)
|
||||
{
|
||||
DoScriptText(SAY_RIN_BY_OUTRUNNER, pWho);
|
||||
m_bIsByOutrunner = true;
|
||||
}
|
||||
|
||||
if (rand()%4)
|
||||
return;
|
||||
|
||||
//only if attacked and escorter is not in combat?
|
||||
DoScriptText(RAND(SAY_RIN_HELP_1,SAY_RIN_HELP_2), me);
|
||||
}
|
||||
}
|
||||
|
||||
void DoSpawnAmbush(bool bFirst)
|
||||
{
|
||||
if (!bFirst)
|
||||
m_iSpawnId = 1;
|
||||
|
||||
me->SummonCreature(NPC_RANGER,
|
||||
m_afAmbushSpawn[m_iSpawnId].m_fX, m_afAmbushSpawn[m_iSpawnId].m_fY, m_afAmbushSpawn[m_iSpawnId].m_fZ, 0.0f,
|
||||
TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60000);
|
||||
}
|
||||
}
|
||||
|
||||
void JustSummoned(Creature* pSummoned)
|
||||
{
|
||||
pSummoned->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING);
|
||||
pSummoned->GetMotionMaster()->MovePoint(0, m_afAmbushMoveTo[m_iSpawnId].m_fX, m_afAmbushMoveTo[m_iSpawnId].m_fY, m_afAmbushMoveTo[m_iSpawnId].m_fZ);
|
||||
}
|
||||
|
||||
void WaypointReached(uint32 uiPointId)
|
||||
{
|
||||
Player* pPlayer = GetPlayerForEscort();
|
||||
|
||||
if (!pPlayer)
|
||||
return;
|
||||
|
||||
switch(uiPointId)
|
||||
{
|
||||
case 1:
|
||||
DoScriptText(SAY_RIN_FREE, me, pPlayer);
|
||||
break;
|
||||
case 7:
|
||||
DoSpawnAmbush(true);
|
||||
break;
|
||||
case 13:
|
||||
DoSpawnAmbush(false);
|
||||
break;
|
||||
case 17:
|
||||
DoScriptText(SAY_RIN_COMPLETE, me, pPlayer);
|
||||
pPlayer->GroupEventHappens(QUEST_RINJI_TRAPPED, me);
|
||||
SetRun();
|
||||
m_uiPostEventCount = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateEscortAI(const uint32 uiDiff)
|
||||
{
|
||||
//Check if we have a current target
|
||||
if (!UpdateVictim())
|
||||
{
|
||||
if (HasEscortState(STATE_ESCORT_ESCORTING) && m_uiPostEventCount)
|
||||
for (int i = 0; i < 2; ++i)
|
||||
{
|
||||
if (m_uiPostEventTimer <= uiDiff)
|
||||
{
|
||||
m_uiPostEventTimer = 3000;
|
||||
me->SummonCreature(NPC_OUTRUNNER,
|
||||
m_afAmbushSpawn[m_iSpawnId].m_fX, m_afAmbushSpawn[m_iSpawnId].m_fY, m_afAmbushSpawn[m_iSpawnId].m_fZ, 0.0f,
|
||||
TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60000);
|
||||
}
|
||||
}
|
||||
|
||||
if (Unit* pPlayer = GetPlayerForEscort())
|
||||
void JustSummoned(Creature* pSummoned)
|
||||
{
|
||||
pSummoned->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING);
|
||||
pSummoned->GetMotionMaster()->MovePoint(0, m_afAmbushMoveTo[m_iSpawnId].m_fX, m_afAmbushMoveTo[m_iSpawnId].m_fY, m_afAmbushMoveTo[m_iSpawnId].m_fZ);
|
||||
}
|
||||
|
||||
void WaypointReached(uint32 uiPointId)
|
||||
{
|
||||
Player* pPlayer = GetPlayerForEscort();
|
||||
|
||||
if (!pPlayer)
|
||||
return;
|
||||
|
||||
switch(uiPointId)
|
||||
{
|
||||
case 1:
|
||||
DoScriptText(SAY_RIN_FREE, me, pPlayer);
|
||||
break;
|
||||
case 7:
|
||||
DoSpawnAmbush(true);
|
||||
break;
|
||||
case 13:
|
||||
DoSpawnAmbush(false);
|
||||
break;
|
||||
case 17:
|
||||
DoScriptText(SAY_RIN_COMPLETE, me, pPlayer);
|
||||
pPlayer->GroupEventHappens(QUEST_RINJI_TRAPPED, me);
|
||||
SetRun();
|
||||
m_uiPostEventCount = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateEscortAI(const uint32 uiDiff)
|
||||
{
|
||||
//Check if we have a current target
|
||||
if (!UpdateVictim())
|
||||
{
|
||||
if (HasEscortState(STATE_ESCORT_ESCORTING) && m_uiPostEventCount)
|
||||
{
|
||||
if (m_uiPostEventTimer <= uiDiff)
|
||||
{
|
||||
switch(m_uiPostEventCount)
|
||||
m_uiPostEventTimer = 3000;
|
||||
|
||||
if (Unit* pPlayer = GetPlayerForEscort())
|
||||
{
|
||||
case 1:
|
||||
DoScriptText(SAY_RIN_PROGRESS_1, me, pPlayer);
|
||||
++m_uiPostEventCount;
|
||||
break;
|
||||
case 2:
|
||||
DoScriptText(SAY_RIN_PROGRESS_2, me, pPlayer);
|
||||
m_uiPostEventCount = 0;
|
||||
break;
|
||||
switch(m_uiPostEventCount)
|
||||
{
|
||||
case 1:
|
||||
DoScriptText(SAY_RIN_PROGRESS_1, me, pPlayer);
|
||||
++m_uiPostEventCount;
|
||||
break;
|
||||
case 2:
|
||||
DoScriptText(SAY_RIN_PROGRESS_2, me, pPlayer);
|
||||
m_uiPostEventCount = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
me->ForcedDespawn();
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
me->ForcedDespawn();
|
||||
return;
|
||||
}
|
||||
m_uiPostEventTimer -= uiDiff;
|
||||
}
|
||||
else
|
||||
m_uiPostEventTimer -= uiDiff;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
return;
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
};
|
||||
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
};
|
||||
|
||||
bool QuestAccept_npc_rinji(Player* pPlayer, Creature* pCreature, const Quest* pQuest)
|
||||
{
|
||||
if (pQuest->GetQuestId() == QUEST_RINJI_TRAPPED)
|
||||
{
|
||||
if (GameObject* pGo = pCreature->FindNearestGameObject(GO_RINJI_CAGE, INTERACTION_DISTANCE))
|
||||
pGo->UseDoorOrButton();
|
||||
|
||||
if (npc_rinjiAI* pEscortAI = CAST_AI(npc_rinjiAI, pCreature->AI()))
|
||||
pEscortAI->Start(false, false, pPlayer->GetGUID(), pQuest);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
CreatureAI* GetAI_npc_rinji(Creature* pCreature)
|
||||
{
|
||||
return new npc_rinjiAI(pCreature);
|
||||
}
|
||||
|
||||
void AddSC_hinterlands()
|
||||
{
|
||||
Script* newscript;
|
||||
|
||||
newscript = new Script;
|
||||
newscript->Name = "npc_00x09hl";
|
||||
newscript->GetAI = &GetAI_npc_00x09hl;
|
||||
newscript->pQuestAccept = &QuestAccept_npc_00x09hl;
|
||||
newscript->RegisterSelf();
|
||||
|
||||
newscript = new Script;
|
||||
newscript->Name = "npc_rinji";
|
||||
newscript->GetAI = &GetAI_npc_rinji;
|
||||
newscript->pQuestAccept = &QuestAccept_npc_rinji;
|
||||
newscript->RegisterSelf();
|
||||
new npc_00x09hl();
|
||||
new npc_rinji();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user