* 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:
azazel committed 2010-08-08 22:54:58 +06:00
1 parent 8a69e50d6a
commit 590199d8e1
482 files changed
+84476 -82697

No files matched your search

+175 -170
View File
@@ -48,138 +48,146 @@ enum eEnums
NPC_DEFIAS_RAIDER = 6180,
EQUIP_ID_RIFLE = 2511
};
struct npc_daphne_stilwellAI : public npc_escortAI
␍class npc_daphne_stilwell : public CreatureScript
{
npc_daphne_stilwellAI(Creature* pCreature) : npc_escortAI(pCreature) {}
public:
npc_daphne_stilwell() : CreatureScript("npc_daphne_stilwell") { }
uint32 uiWPHolder;
uint32 uiShootTimer;
void Reset()
bool OnQuestAccept(Player* pPlayer, Creature* pCreature, const Quest* pQuest)
{
if (HasEscortState(STATE_ESCORT_ESCORTING))
if (pQuest->GetQuestId() == QUEST_TOME_VALOR)
{
switch(uiWPHolder)
DoScriptText(SAY_DS_START, pCreature);
if (npc_escortAI* pEscortAI = CAST_AI(npc_daphne_stilwell::npc_daphne_stilwellAI, pCreature->AI()))
pEscortAI->Start(true, true, pPlayer->GetGUID());
}
return true;
}
CreatureAI* GetAI(Creature* pCreature) const
{
return new npc_daphne_stilwellAI(pCreature);
}
struct npc_daphne_stilwellAI : public npc_escortAI
{
npc_daphne_stilwellAI(Creature* pCreature) : npc_escortAI(pCreature) {}
uint32 uiWPHolder;
uint32 uiShootTimer;
void Reset()
{
if (HasEscortState(STATE_ESCORT_ESCORTING))
{
case 7: DoScriptText(SAY_DS_DOWN_1, me); break;
case 8: DoScriptText(SAY_DS_DOWN_2, me); break;
case 9: DoScriptText(SAY_DS_DOWN_3, me); break;
switch(uiWPHolder)
{
case 7: DoScriptText(SAY_DS_DOWN_1, me); break;
case 8: DoScriptText(SAY_DS_DOWN_2, me); break;
case 9: DoScriptText(SAY_DS_DOWN_3, me); break;
}
}
else
uiWPHolder = 0;
uiShootTimer = 0;
}
void WaypointReached(uint32 uiPoint)
{
Player* pPlayer = GetPlayerForEscort();
if (!pPlayer)
return;
uiWPHolder = uiPoint;
switch(uiPoint)
{
case 4:
SetEquipmentSlots(false, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE, EQUIP_ID_RIFLE);
me->SetSheath(SHEATH_STATE_RANGED);
me->HandleEmoteCommand(EMOTE_STATE_USESTANDING_NOSHEATHE);
break;
case 7:
me->SummonCreature(NPC_DEFIAS_RAIDER, -11450.836, 1569.755, 54.267, 4.230, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
me->SummonCreature(NPC_DEFIAS_RAIDER, -11449.697, 1569.124, 54.421, 4.206, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
me->SummonCreature(NPC_DEFIAS_RAIDER, -11448.237, 1568.307, 54.620, 4.206, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
break;
case 8:
me->SetSheath(SHEATH_STATE_RANGED);
me->SummonCreature(NPC_DEFIAS_RAIDER, -11450.836, 1569.755, 54.267, 4.230, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
me->SummonCreature(NPC_DEFIAS_RAIDER, -11449.697, 1569.124, 54.421, 4.206, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
me->SummonCreature(NPC_DEFIAS_RAIDER, -11448.237, 1568.307, 54.620, 4.206, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
me->SummonCreature(NPC_DEFIAS_RAIDER, -11448.037, 1570.213, 54.961, 4.283, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
break;
case 9:
me->SetSheath(SHEATH_STATE_RANGED);
me->SummonCreature(NPC_DEFIAS_RAIDER, -11450.836, 1569.755, 54.267, 4.230, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
me->SummonCreature(NPC_DEFIAS_RAIDER, -11449.697, 1569.124, 54.421, 4.206, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
me->SummonCreature(NPC_DEFIAS_RAIDER, -11448.237, 1568.307, 54.620, 4.206, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
me->SummonCreature(NPC_DEFIAS_RAIDER, -11448.037, 1570.213, 54.961, 4.283, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
me->SummonCreature(NPC_DEFIAS_RAIDER, -11449.018, 1570.738, 54.828, 4.220, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
break;
case 10:
SetRun(false);
break;
case 11:
DoScriptText(SAY_DS_PROLOGUE, me);
break;
case 13:
SetEquipmentSlots(true);
me->SetSheath(SHEATH_STATE_UNARMED);
me->HandleEmoteCommand(EMOTE_STATE_USESTANDING_NOSHEATHE);
break;
case 17:
pPlayer->GroupEventHappens(QUEST_TOME_VALOR, me);
break;
}
}
else
uiWPHolder = 0;
uiShootTimer = 0;
}
void WaypointReached(uint32 uiPoint)
{
Player* pPlayer = GetPlayerForEscort();
if (!pPlayer)
return;
uiWPHolder = uiPoint;
switch(uiPoint)
void AttackStart(Unit* pWho)
{
case 4:
SetEquipmentSlots(false, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE, EQUIP_ID_RIFLE);
me->SetSheath(SHEATH_STATE_RANGED);
me->HandleEmoteCommand(EMOTE_STATE_USESTANDING_NOSHEATHE);
break;
case 7:
me->SummonCreature(NPC_DEFIAS_RAIDER, -11450.836, 1569.755, 54.267, 4.230, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
me->SummonCreature(NPC_DEFIAS_RAIDER, -11449.697, 1569.124, 54.421, 4.206, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
me->SummonCreature(NPC_DEFIAS_RAIDER, -11448.237, 1568.307, 54.620, 4.206, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
break;
case 8:
me->SetSheath(SHEATH_STATE_RANGED);
me->SummonCreature(NPC_DEFIAS_RAIDER, -11450.836, 1569.755, 54.267, 4.230, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
me->SummonCreature(NPC_DEFIAS_RAIDER, -11449.697, 1569.124, 54.421, 4.206, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
me->SummonCreature(NPC_DEFIAS_RAIDER, -11448.237, 1568.307, 54.620, 4.206, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
me->SummonCreature(NPC_DEFIAS_RAIDER, -11448.037, 1570.213, 54.961, 4.283, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
break;
case 9:
me->SetSheath(SHEATH_STATE_RANGED);
me->SummonCreature(NPC_DEFIAS_RAIDER, -11450.836, 1569.755, 54.267, 4.230, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
me->SummonCreature(NPC_DEFIAS_RAIDER, -11449.697, 1569.124, 54.421, 4.206, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
me->SummonCreature(NPC_DEFIAS_RAIDER, -11448.237, 1568.307, 54.620, 4.206, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
me->SummonCreature(NPC_DEFIAS_RAIDER, -11448.037, 1570.213, 54.961, 4.283, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
me->SummonCreature(NPC_DEFIAS_RAIDER, -11449.018, 1570.738, 54.828, 4.220, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
break;
case 10:
SetRun(false);
break;
case 11:
DoScriptText(SAY_DS_PROLOGUE, me);
break;
case 13:
SetEquipmentSlots(true);
me->SetSheath(SHEATH_STATE_UNARMED);
me->HandleEmoteCommand(EMOTE_STATE_USESTANDING_NOSHEATHE);
break;
case 17:
pPlayer->GroupEventHappens(QUEST_TOME_VALOR, me);
break;
if (!pWho)
return;
if (me->Attack(pWho, false))
{
me->AddThreat(pWho, 0.0f);
me->SetInCombatWith(pWho);
pWho->SetInCombatWith(me);
me->GetMotionMaster()->MoveChase(pWho, 30.0f);
}
}
}
void AttackStart(Unit* pWho)
{
if (!pWho)
return;
if (me->Attack(pWho, false))
void JustSummoned(Creature* pSummoned)
{
me->AddThreat(pWho, 0.0f);
me->SetInCombatWith(pWho);
pWho->SetInCombatWith(me);
me->GetMotionMaster()->MoveChase(pWho, 30.0f);
pSummoned->AI()->AttackStart(me);
}
}
void JustSummoned(Creature* pSummoned)
{
pSummoned->AI()->AttackStart(me);
}
void Update(const uint32 diff)
{
npc_escortAI::UpdateAI(diff);
if (!UpdateVictim())
return;
if (uiShootTimer <= diff)
void Update(const uint32 diff)
{
uiShootTimer = 1500;
npc_escortAI::UpdateAI(diff);
if (!UpdateVictim())
return;
if (uiShootTimer <= diff)
{
uiShootTimer = 1500;
if (!me->IsWithinDist(me->getVictim(), ATTACK_DISTANCE))
DoCast(me->getVictim(), SPELL_SHOOT);
} else uiShootTimer -= diff;
}
};
if (!me->IsWithinDist(me->getVictim(), ATTACK_DISTANCE))
DoCast(me->getVictim(), SPELL_SHOOT);
} else uiShootTimer -= diff;
}
};
bool QuestAccept_npc_daphne_stilwell(Player* pPlayer, Creature* pCreature, const Quest* pQuest)
{
if (pQuest->GetQuestId() == QUEST_TOME_VALOR)
{
DoScriptText(SAY_DS_START, pCreature);
if (npc_escortAI* pEscortAI = CAST_AI(npc_daphne_stilwellAI, pCreature->AI()))
pEscortAI->Start(true, true, pPlayer->GetGUID());
}
return true;
}
CreatureAI* GetAI_npc_daphne_stilwell(Creature* pCreature)
{
return new npc_daphne_stilwellAI(pCreature);
}
/*######
## npc_defias_traitor
@@ -192,74 +200,71 @@ CreatureAI* GetAI_npc_daphne_stilwell(Creature* pCreature)
#define SAY_AGGRO_2 -1000105
#define QUEST_DEFIAS_BROTHERHOOD 155
struct npc_defias_traitorAI : public npc_escortAI
␍class npc_defias_traitor : public CreatureScript
{
npc_defias_traitorAI(Creature *c) : npc_escortAI(c) { Reset(); }
public:
npc_defias_traitor() : CreatureScript("npc_defias_traitor") { }
void WaypointReached(uint32 i)
bool OnQuestAccept(Player* pPlayer, Creature* pCreature, Quest const* quest)
{
Player* pPlayer = GetPlayerForEscort();
if (!pPlayer)
return;
switch (i)
if (quest->GetQuestId() == QUEST_DEFIAS_BROTHERHOOD)
{
case 35:
SetRun(false);
break;
case 36:
DoScriptText(SAY_PROGRESS, me, pPlayer);
break;
case 44:
DoScriptText(SAY_END, me, pPlayer);
{
if (pPlayer)
pPlayer->GroupEventHappens(QUEST_DEFIAS_BROTHERHOOD,me);
}
break;
if (npc_escortAI* pEscortAI = CAST_AI(npc_defias_traitor::npc_defias_traitorAI, pCreature->AI()))
pEscortAI->Start(true, true, pPlayer->GetGUID());
DoScriptText(SAY_START, pCreature, pPlayer);
}
}
void EnterCombat(Unit* who)
{
DoScriptText(RAND(SAY_AGGRO_1,SAY_AGGRO_2), me, who);
return true;
}
void Reset() {}
CreatureAI* GetAI(Creature* pCreature) const
{
return new npc_defias_traitorAI(pCreature);
}
struct npc_defias_traitorAI : public npc_escortAI
{
npc_defias_traitorAI(Creature *c) : npc_escortAI(c) { Reset(); }
void WaypointReached(uint32 i)
{
Player* pPlayer = GetPlayerForEscort();
if (!pPlayer)
return;
switch (i)
{
case 35:
SetRun(false);
break;
case 36:
DoScriptText(SAY_PROGRESS, me, pPlayer);
break;
case 44:
DoScriptText(SAY_END, me, pPlayer);
{
if (pPlayer)
pPlayer->GroupEventHappens(QUEST_DEFIAS_BROTHERHOOD,me);
}
break;
}
}
void EnterCombat(Unit* who)
{
DoScriptText(RAND(SAY_AGGRO_1,SAY_AGGRO_2), me, who);
}
void Reset() {}
};
};
bool QuestAccept_npc_defias_traitor(Player* pPlayer, Creature* pCreature, Quest const* quest)
{
if (quest->GetQuestId() == QUEST_DEFIAS_BROTHERHOOD)
{
if (npc_escortAI* pEscortAI = CAST_AI(npc_defias_traitorAI, pCreature->AI()))
pEscortAI->Start(true, true, pPlayer->GetGUID());
DoScriptText(SAY_START, pCreature, pPlayer);
}
return true;
}
CreatureAI* GetAI_npc_defias_traitor(Creature* pCreature)
{
return new npc_defias_traitorAI(pCreature);
}
void AddSC_westfall()
{
Script *newscript;
newscript = new Script;
newscript->Name = "npc_daphne_stilwell";
newscript->GetAI = &GetAI_npc_daphne_stilwell;
newscript->pQuestAccept = &QuestAccept_npc_daphne_stilwell;
newscript->RegisterSelf();
newscript = new Script;
newscript->Name = "npc_defias_traitor";
newscript->GetAI = &GetAI_npc_defias_traitor;
newscript->pQuestAccept = &QuestAccept_npc_defias_traitor;
newscript->RegisterSelf();
new npc_daphne_stilwell();
new npc_defias_traitor();
}