* 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:
@@ -53,227 +53,229 @@ const Position SpawnLocation[] =
|
||||
{-145.905,2180.520,128.448,4.183},
|
||||
{-140.794,2178.037,128.448,4.090},
|
||||
{-138.640,2170.159,136.577,2.737}
|
||||
};
|
||||
struct instance_shadowfang_keep : public ScriptedInstance
|
||||
};␍class instance_shadowfang_keep : public InstanceMapScript
|
||||
{
|
||||
instance_shadowfang_keep(Map* pMap) : ScriptedInstance(pMap) {Initialize();};
|
||||
public:
|
||||
instance_shadowfang_keep() : InstanceMapScript("instance_shadowfang_keep") { }
|
||||
|
||||
uint32 m_auiEncounter[MAX_ENCOUNTER];
|
||||
std::string str_data;
|
||||
|
||||
uint64 uiAshGUID;
|
||||
uint64 uiAdaGUID;
|
||||
uint64 uiArchmageArugalGUID;
|
||||
|
||||
uint64 DoorCourtyardGUID;
|
||||
uint64 DoorSorcererGUID;
|
||||
uint64 DoorArugalGUID;
|
||||
|
||||
uint8 uiPhase;
|
||||
uint16 uiTimer;
|
||||
|
||||
void Initialize()
|
||||
InstanceScript* GetInstanceData_InstanceMapScript(Map* pMap)
|
||||
{
|
||||
memset(&m_auiEncounter, 0, sizeof(m_auiEncounter));
|
||||
|
||||
uiAshGUID = 0;
|
||||
uiAdaGUID = 0;
|
||||
uiArchmageArugalGUID = 0;
|
||||
|
||||
DoorCourtyardGUID = 0;
|
||||
DoorSorcererGUID = 0;
|
||||
DoorArugalGUID = 0;
|
||||
|
||||
uiPhase = 0;
|
||||
uiTimer = 0;
|
||||
return new instance_shadowfang_keep_InstanceMapScript(pMap);
|
||||
}
|
||||
|
||||
void OnCreatureCreate(Creature* pCreature, bool /*add*/)
|
||||
struct instance_shadowfang_keep_InstanceMapScript : public InstanceScript
|
||||
{
|
||||
switch(pCreature->GetEntry())
|
||||
{
|
||||
case NPC_ASH: uiAshGUID = pCreature->GetGUID(); break;
|
||||
case NPC_ADA: uiAdaGUID = pCreature->GetGUID(); break;
|
||||
case NPC_ARCHMAGE_ARUGAL: uiArchmageArugalGUID = pCreature->GetGUID(); break;
|
||||
}
|
||||
}
|
||||
instance_shadowfang_keep_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {Initialize();};
|
||||
|
||||
void OnGameObjectCreate(GameObject* pGo, bool /*add*/)
|
||||
{
|
||||
switch(pGo->GetEntry())
|
||||
{
|
||||
case GO_COURTYARD_DOOR:
|
||||
DoorCourtyardGUID = pGo->GetGUID();
|
||||
if (m_auiEncounter[0] == DONE)
|
||||
HandleGameObject(NULL, true, pGo);
|
||||
break;
|
||||
case GO_SORCERER_DOOR:
|
||||
DoorSorcererGUID = pGo->GetGUID();
|
||||
if (m_auiEncounter[2] == DONE)
|
||||
HandleGameObject(NULL, true, pGo);
|
||||
break;
|
||||
case GO_ARUGAL_DOOR:
|
||||
DoorArugalGUID = pGo->GetGUID();
|
||||
if (m_auiEncounter[3] == DONE)
|
||||
HandleGameObject(NULL, true, pGo);
|
||||
break;
|
||||
}
|
||||
}
|
||||
uint32 m_auiEncounter[MAX_ENCOUNTER];
|
||||
std::string str_data;
|
||||
|
||||
void DoSpeech()
|
||||
{
|
||||
Creature* pAda = instance->GetCreature(uiAdaGUID);
|
||||
Creature* pAsh = instance->GetCreature(uiAshGUID);
|
||||
uint64 uiAshGUID;
|
||||
uint64 uiAdaGUID;
|
||||
uint64 uiArchmageArugalGUID;
|
||||
|
||||
if (pAda && pAda->isAlive() && pAsh && pAsh->isAlive())
|
||||
{
|
||||
DoScriptText(SAY_BOSS_DIE_AD,pAda);
|
||||
DoScriptText(SAY_BOSS_DIE_AS,pAsh);
|
||||
}
|
||||
}
|
||||
uint64 DoorCourtyardGUID;
|
||||
uint64 DoorSorcererGUID;
|
||||
uint64 DoorArugalGUID;
|
||||
|
||||
void SetData(uint32 type, uint32 data)
|
||||
{
|
||||
switch(type)
|
||||
uint8 uiPhase;
|
||||
uint16 uiTimer;
|
||||
|
||||
void Initialize()
|
||||
{
|
||||
case TYPE_FREE_NPC:
|
||||
if (data == DONE)
|
||||
DoUseDoorOrButton(DoorCourtyardGUID);
|
||||
m_auiEncounter[0] = data;
|
||||
break;
|
||||
case TYPE_RETHILGORE:
|
||||
if (data == DONE)
|
||||
DoSpeech();
|
||||
m_auiEncounter[1] = data;
|
||||
break;
|
||||
case TYPE_FENRUS:
|
||||
switch(data)
|
||||
{
|
||||
case DONE:
|
||||
uiTimer = 1000;
|
||||
uiPhase = 1;
|
||||
break;
|
||||
case 7:
|
||||
DoUseDoorOrButton(DoorSorcererGUID);
|
||||
break;
|
||||
}
|
||||
m_auiEncounter[2] = data;
|
||||
break;
|
||||
case TYPE_NANDOS:
|
||||
if (data == DONE)
|
||||
DoUseDoorOrButton(DoorArugalGUID);
|
||||
m_auiEncounter[3] = data;
|
||||
break;
|
||||
memset(&m_auiEncounter, 0, sizeof(m_auiEncounter));
|
||||
|
||||
uiAshGUID = 0;
|
||||
uiAdaGUID = 0;
|
||||
uiArchmageArugalGUID = 0;
|
||||
|
||||
DoorCourtyardGUID = 0;
|
||||
DoorSorcererGUID = 0;
|
||||
DoorArugalGUID = 0;
|
||||
|
||||
uiPhase = 0;
|
||||
uiTimer = 0;
|
||||
}
|
||||
|
||||
if (data == DONE)
|
||||
void OnCreatureCreate(Creature* pCreature, bool /*add*/)
|
||||
{
|
||||
OUT_SAVE_INST_DATA;
|
||||
|
||||
std::ostringstream saveStream;
|
||||
saveStream << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2] << " " << m_auiEncounter[3];
|
||||
|
||||
str_data = saveStream.str();
|
||||
|
||||
SaveToDB();
|
||||
OUT_SAVE_INST_DATA_COMPLETE;
|
||||
}
|
||||
}
|
||||
|
||||
uint32 GetData(uint32 type)
|
||||
{
|
||||
switch(type)
|
||||
{
|
||||
case TYPE_FREE_NPC:
|
||||
return m_auiEncounter[0];
|
||||
case TYPE_RETHILGORE:
|
||||
return m_auiEncounter[1];
|
||||
case TYPE_FENRUS:
|
||||
return m_auiEncounter[2];
|
||||
case TYPE_NANDOS:
|
||||
return m_auiEncounter[3];
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::string GetSaveData()
|
||||
{
|
||||
return str_data;
|
||||
}
|
||||
|
||||
void Load(const char* in)
|
||||
{
|
||||
if (!in)
|
||||
{
|
||||
OUT_LOAD_INST_DATA_FAIL;
|
||||
return;
|
||||
}
|
||||
|
||||
OUT_LOAD_INST_DATA(in);
|
||||
|
||||
std::istringstream loadStream(in);
|
||||
loadStream >> m_auiEncounter[0] >> m_auiEncounter[1] >> m_auiEncounter[2] >> m_auiEncounter[3];
|
||||
|
||||
for (uint8 i = 0; i < MAX_ENCOUNTER; ++i)
|
||||
{
|
||||
if (m_auiEncounter[i] == IN_PROGRESS)
|
||||
m_auiEncounter[i] = NOT_STARTED;
|
||||
}
|
||||
|
||||
OUT_LOAD_INST_DATA_COMPLETE;
|
||||
}
|
||||
|
||||
void Update(uint32 uiDiff)
|
||||
{
|
||||
if (GetData(TYPE_FENRUS) != DONE)
|
||||
return;
|
||||
|
||||
Creature* pArchmage = instance->GetCreature(uiArchmageArugalGUID);
|
||||
Creature* pSummon = NULL;
|
||||
|
||||
if (!pArchmage || !pArchmage->isAlive())
|
||||
return;
|
||||
|
||||
if (uiPhase)
|
||||
{
|
||||
if (uiTimer <= uiDiff)
|
||||
switch(pCreature->GetEntry())
|
||||
{
|
||||
switch(uiPhase)
|
||||
{
|
||||
case 1:
|
||||
pSummon = pArchmage->SummonCreature(pArchmage->GetEntry(),SpawnLocation[4],TEMPSUMMON_TIMED_DESPAWN,10000);
|
||||
pSummon->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE);
|
||||
pSummon->SetReactState(REACT_DEFENSIVE);
|
||||
pSummon->CastSpell(pSummon,SPELL_ASHCROMBE_TELEPORT,true);
|
||||
DoScriptText(SAY_ARCHMAGE,pSummon);
|
||||
uiTimer = 2000;
|
||||
uiPhase = 2;
|
||||
break;
|
||||
case 2:
|
||||
pArchmage->SummonCreature(NPC_ARUGAL_VOIDWALKER,SpawnLocation[0],TEMPSUMMON_CORPSE_TIMED_DESPAWN,60000);
|
||||
pArchmage->SummonCreature(NPC_ARUGAL_VOIDWALKER,SpawnLocation[1],TEMPSUMMON_CORPSE_TIMED_DESPAWN,60000);
|
||||
pArchmage->SummonCreature(NPC_ARUGAL_VOIDWALKER,SpawnLocation[2],TEMPSUMMON_CORPSE_TIMED_DESPAWN,60000);
|
||||
pArchmage->SummonCreature(NPC_ARUGAL_VOIDWALKER,SpawnLocation[3],TEMPSUMMON_CORPSE_TIMED_DESPAWN,60000);
|
||||
uiPhase = 0;
|
||||
break;
|
||||
|
||||
}
|
||||
} else uiTimer -= uiDiff;
|
||||
case NPC_ASH: uiAshGUID = pCreature->GetGUID(); break;
|
||||
case NPC_ADA: uiAdaGUID = pCreature->GetGUID(); break;
|
||||
case NPC_ARCHMAGE_ARUGAL: uiArchmageArugalGUID = pCreature->GetGUID(); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void OnGameObjectCreate(GameObject* pGo, bool /*add*/)
|
||||
{
|
||||
switch(pGo->GetEntry())
|
||||
{
|
||||
case GO_COURTYARD_DOOR:
|
||||
DoorCourtyardGUID = pGo->GetGUID();
|
||||
if (m_auiEncounter[0] == DONE)
|
||||
HandleGameObject(NULL, true, pGo);
|
||||
break;
|
||||
case GO_SORCERER_DOOR:
|
||||
DoorSorcererGUID = pGo->GetGUID();
|
||||
if (m_auiEncounter[2] == DONE)
|
||||
HandleGameObject(NULL, true, pGo);
|
||||
break;
|
||||
case GO_ARUGAL_DOOR:
|
||||
DoorArugalGUID = pGo->GetGUID();
|
||||
if (m_auiEncounter[3] == DONE)
|
||||
HandleGameObject(NULL, true, pGo);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void DoSpeech()
|
||||
{
|
||||
Creature* pAda = instance->GetCreature(uiAdaGUID);
|
||||
Creature* pAsh = instance->GetCreature(uiAshGUID);
|
||||
|
||||
if (pAda && pAda->isAlive() && pAsh && pAsh->isAlive())
|
||||
{
|
||||
DoScriptText(SAY_BOSS_DIE_AD,pAda);
|
||||
DoScriptText(SAY_BOSS_DIE_AS,pAsh);
|
||||
}
|
||||
}
|
||||
|
||||
void SetData(uint32 type, uint32 data)
|
||||
{
|
||||
switch(type)
|
||||
{
|
||||
case TYPE_FREE_NPC:
|
||||
if (data == DONE)
|
||||
DoUseDoorOrButton(DoorCourtyardGUID);
|
||||
m_auiEncounter[0] = data;
|
||||
break;
|
||||
case TYPE_RETHILGORE:
|
||||
if (data == DONE)
|
||||
DoSpeech();
|
||||
m_auiEncounter[1] = data;
|
||||
break;
|
||||
case TYPE_FENRUS:
|
||||
switch(data)
|
||||
{
|
||||
case DONE:
|
||||
uiTimer = 1000;
|
||||
uiPhase = 1;
|
||||
break;
|
||||
case 7:
|
||||
DoUseDoorOrButton(DoorSorcererGUID);
|
||||
break;
|
||||
}
|
||||
m_auiEncounter[2] = data;
|
||||
break;
|
||||
case TYPE_NANDOS:
|
||||
if (data == DONE)
|
||||
DoUseDoorOrButton(DoorArugalGUID);
|
||||
m_auiEncounter[3] = data;
|
||||
break;
|
||||
}
|
||||
|
||||
if (data == DONE)
|
||||
{
|
||||
OUT_SAVE_INST_DATA;
|
||||
|
||||
std::ostringstream saveStream;
|
||||
saveStream << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2] << " " << m_auiEncounter[3];
|
||||
|
||||
str_data = saveStream.str();
|
||||
|
||||
SaveToDB();
|
||||
OUT_SAVE_INST_DATA_COMPLETE;
|
||||
}
|
||||
}
|
||||
|
||||
uint32 GetData(uint32 type)
|
||||
{
|
||||
switch(type)
|
||||
{
|
||||
case TYPE_FREE_NPC:
|
||||
return m_auiEncounter[0];
|
||||
case TYPE_RETHILGORE:
|
||||
return m_auiEncounter[1];
|
||||
case TYPE_FENRUS:
|
||||
return m_auiEncounter[2];
|
||||
case TYPE_NANDOS:
|
||||
return m_auiEncounter[3];
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::string GetSaveData()
|
||||
{
|
||||
return str_data;
|
||||
}
|
||||
|
||||
void Load(const char* in)
|
||||
{
|
||||
if (!in)
|
||||
{
|
||||
OUT_LOAD_INST_DATA_FAIL;
|
||||
return;
|
||||
}
|
||||
|
||||
OUT_LOAD_INST_DATA(in);
|
||||
|
||||
std::istringstream loadStream(in);
|
||||
loadStream >> m_auiEncounter[0] >> m_auiEncounter[1] >> m_auiEncounter[2] >> m_auiEncounter[3];
|
||||
|
||||
for (uint8 i = 0; i < MAX_ENCOUNTER; ++i)
|
||||
{
|
||||
if (m_auiEncounter[i] == IN_PROGRESS)
|
||||
m_auiEncounter[i] = NOT_STARTED;
|
||||
}
|
||||
|
||||
OUT_LOAD_INST_DATA_COMPLETE;
|
||||
}
|
||||
|
||||
void Update(uint32 uiDiff)
|
||||
{
|
||||
if (GetData(TYPE_FENRUS) != DONE)
|
||||
return;
|
||||
|
||||
Creature* pArchmage = instance->GetCreature(uiArchmageArugalGUID);
|
||||
Creature* pSummon = NULL;
|
||||
|
||||
if (!pArchmage || !pArchmage->isAlive())
|
||||
return;
|
||||
|
||||
if (uiPhase)
|
||||
{
|
||||
if (uiTimer <= uiDiff)
|
||||
{
|
||||
switch(uiPhase)
|
||||
{
|
||||
case 1:
|
||||
pSummon = pArchmage->SummonCreature(pArchmage->GetEntry(),SpawnLocation[4],TEMPSUMMON_TIMED_DESPAWN,10000);
|
||||
pSummon->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE);
|
||||
pSummon->SetReactState(REACT_DEFENSIVE);
|
||||
pSummon->CastSpell(pSummon,SPELL_ASHCROMBE_TELEPORT,true);
|
||||
DoScriptText(SAY_ARCHMAGE,pSummon);
|
||||
uiTimer = 2000;
|
||||
uiPhase = 2;
|
||||
break;
|
||||
case 2:
|
||||
pArchmage->SummonCreature(NPC_ARUGAL_VOIDWALKER,SpawnLocation[0],TEMPSUMMON_CORPSE_TIMED_DESPAWN,60000);
|
||||
pArchmage->SummonCreature(NPC_ARUGAL_VOIDWALKER,SpawnLocation[1],TEMPSUMMON_CORPSE_TIMED_DESPAWN,60000);
|
||||
pArchmage->SummonCreature(NPC_ARUGAL_VOIDWALKER,SpawnLocation[2],TEMPSUMMON_CORPSE_TIMED_DESPAWN,60000);
|
||||
pArchmage->SummonCreature(NPC_ARUGAL_VOIDWALKER,SpawnLocation[3],TEMPSUMMON_CORPSE_TIMED_DESPAWN,60000);
|
||||
uiPhase = 0;
|
||||
break;
|
||||
|
||||
}
|
||||
} else uiTimer -= uiDiff;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
InstanceData* GetInstanceData_instance_shadowfang_keep(Map* pMap)
|
||||
{
|
||||
return new instance_shadowfang_keep(pMap);
|
||||
}
|
||||
|
||||
void AddSC_instance_shadowfang_keep()
|
||||
{
|
||||
Script *newscript;
|
||||
newscript = new Script;
|
||||
newscript->Name = "instance_shadowfang_keep";
|
||||
newscript->GetInstanceData = &GetInstanceData_instance_shadowfang_keep;
|
||||
newscript->RegisterSelf();
|
||||
new instance_shadowfang_keep();
|
||||
}
|
||||
|
||||
|
||||
@@ -52,149 +52,153 @@ enum eEnums
|
||||
};
|
||||
|
||||
#define GOSSIP_ITEM_DOOR "Thanks, I'll follow you to the door."
|
||||
|
||||
struct npc_shadowfang_prisonerAI : public npc_escortAI
|
||||
␍class npc_shadowfang_prisoner : public CreatureScript
|
||||
{
|
||||
npc_shadowfang_prisonerAI(Creature *c) : npc_escortAI(c)
|
||||
public:
|
||||
npc_shadowfang_prisoner() : CreatureScript("npc_shadowfang_prisoner") { }
|
||||
|
||||
CreatureAI* GetAI(Creature* pCreature) const
|
||||
{
|
||||
pInstance = c->GetInstanceData();
|
||||
uiNpcEntry = c->GetEntry();
|
||||
return new npc_shadowfang_prisonerAI(pCreature);
|
||||
}
|
||||
|
||||
ScriptedInstance *pInstance;
|
||||
uint32 uiNpcEntry;
|
||||
|
||||
void WaypointReached(uint32 uiPoint)
|
||||
bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction)
|
||||
{
|
||||
switch(uiPoint)
|
||||
if (uiAction == GOSSIP_ACTION_INFO_DEF+1)
|
||||
{
|
||||
case 0:
|
||||
if (uiNpcEntry == NPC_ASH)
|
||||
DoScriptText(SAY_FREE_AS, me);
|
||||
else
|
||||
DoScriptText(SAY_FREE_AD, me);
|
||||
break;
|
||||
case 10:
|
||||
if (uiNpcEntry == NPC_ASH)
|
||||
DoScriptText(SAY_OPEN_DOOR_AS, me);
|
||||
else
|
||||
DoScriptText(SAY_OPEN_DOOR_AD, me);
|
||||
break;
|
||||
case 11:
|
||||
if (uiNpcEntry == NPC_ASH)
|
||||
DoCast(me, SPELL_UNLOCK);
|
||||
break;
|
||||
case 12:
|
||||
if (uiNpcEntry == NPC_ASH)
|
||||
DoScriptText(SAY_POST_DOOR_AS, me);
|
||||
else
|
||||
DoScriptText(SAY_POST1_DOOR_AD, me);
|
||||
pPlayer->CLOSE_GOSSIP_MENU();
|
||||
|
||||
if (pInstance)
|
||||
pInstance->SetData(TYPE_FREE_NPC, DONE);
|
||||
break;
|
||||
case 13:
|
||||
if (uiNpcEntry != NPC_ASH)
|
||||
DoScriptText(SAY_POST2_DOOR_AD, me);
|
||||
break;
|
||||
if (npc_escortAI* pEscortAI = CAST_AI(npc_shadowfang_prisoner::npc_shadowfang_prisonerAI, pCreature->AI()))
|
||||
pEscortAI->Start(false, false);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void Reset() {}
|
||||
void EnterCombat(Unit* /*who*/) {}
|
||||
};
|
||||
|
||||
CreatureAI* GetAI_npc_shadowfang_prisoner(Creature* pCreature)
|
||||
{
|
||||
return new npc_shadowfang_prisonerAI(pCreature);
|
||||
}
|
||||
|
||||
bool GossipHello_npc_shadowfang_prisoner(Player* pPlayer, Creature* pCreature)
|
||||
{
|
||||
ScriptedInstance* pInstance = pCreature->GetInstanceData();
|
||||
|
||||
if (pInstance && pInstance->GetData(TYPE_FREE_NPC) != DONE && pInstance->GetData(TYPE_RETHILGORE) == DONE)
|
||||
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_DOOR, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
|
||||
|
||||
pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GossipSelect_npc_shadowfang_prisoner(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction)
|
||||
{
|
||||
if (uiAction == GOSSIP_ACTION_INFO_DEF+1)
|
||||
bool OnGossipHello(Player* pPlayer, Creature* pCreature)
|
||||
{
|
||||
pPlayer->CLOSE_GOSSIP_MENU();
|
||||
InstanceScript* pInstance = pCreature->GetInstanceScript();
|
||||
|
||||
if (npc_escortAI* pEscortAI = CAST_AI(npc_shadowfang_prisonerAI, pCreature->AI()))
|
||||
pEscortAI->Start(false, false);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (pInstance && pInstance->GetData(TYPE_FREE_NPC) != DONE && pInstance->GetData(TYPE_RETHILGORE) == DONE)
|
||||
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_DOOR, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
|
||||
|
||||
struct npc_arugal_voidwalkerAI : public ScriptedAI
|
||||
{
|
||||
npc_arugal_voidwalkerAI(Creature* pCreature) : ScriptedAI(pCreature)
|
||||
{
|
||||
pInstance = pCreature->GetInstanceData();
|
||||
pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
ScriptedInstance* pInstance;
|
||||
|
||||
uint32 uiDarkOffering;
|
||||
|
||||
void Reset()
|
||||
struct npc_shadowfang_prisonerAI : public npc_escortAI
|
||||
{
|
||||
uiDarkOffering = urand(290,10);
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 const uiDiff)
|
||||
{
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
if (uiDarkOffering <= uiDiff)
|
||||
npc_shadowfang_prisonerAI(Creature *c) : npc_escortAI(c)
|
||||
{
|
||||
if (Creature* pFriend = me->FindNearestCreature(me->GetEntry(),25.0f,true))
|
||||
pInstance = c->GetInstanceScript();
|
||||
uiNpcEntry = c->GetEntry();
|
||||
}
|
||||
|
||||
InstanceScript *pInstance;
|
||||
uint32 uiNpcEntry;
|
||||
|
||||
void WaypointReached(uint32 uiPoint)
|
||||
{
|
||||
switch(uiPoint)
|
||||
{
|
||||
if (pFriend)
|
||||
DoCast(pFriend,SPELL_DARK_OFFERING);
|
||||
case 0:
|
||||
if (uiNpcEntry == NPC_ASH)
|
||||
DoScriptText(SAY_FREE_AS, me);
|
||||
else
|
||||
DoScriptText(SAY_FREE_AD, me);
|
||||
break;
|
||||
case 10:
|
||||
if (uiNpcEntry == NPC_ASH)
|
||||
DoScriptText(SAY_OPEN_DOOR_AS, me);
|
||||
else
|
||||
DoScriptText(SAY_OPEN_DOOR_AD, me);
|
||||
break;
|
||||
case 11:
|
||||
if (uiNpcEntry == NPC_ASH)
|
||||
DoCast(me, SPELL_UNLOCK);
|
||||
break;
|
||||
case 12:
|
||||
if (uiNpcEntry == NPC_ASH)
|
||||
DoScriptText(SAY_POST_DOOR_AS, me);
|
||||
else
|
||||
DoScriptText(SAY_POST1_DOOR_AD, me);
|
||||
|
||||
if (pInstance)
|
||||
pInstance->SetData(TYPE_FREE_NPC, DONE);
|
||||
break;
|
||||
case 13:
|
||||
if (uiNpcEntry != NPC_ASH)
|
||||
DoScriptText(SAY_POST2_DOOR_AD, me);
|
||||
break;
|
||||
}
|
||||
else
|
||||
DoCast(me,SPELL_DARK_OFFERING);
|
||||
uiDarkOffering = urand(4400,12500);
|
||||
} else uiDarkOffering -= uiDiff;
|
||||
}
|
||||
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
void Reset() {}
|
||||
void EnterCombat(Unit* /*who*/) {}
|
||||
};
|
||||
|
||||
void JustDied(Unit* /*pKiller*/)
|
||||
{
|
||||
if (pInstance)
|
||||
pInstance->SetData(TYPE_FENRUS, pInstance->GetData(TYPE_FENRUS) + 1);
|
||||
}
|
||||
};
|
||||
|
||||
CreatureAI* GetAI_npc_arugal_voidwalker(Creature* pCreature)
|
||||
|
||||
|
||||
␍class npc_arugal_voidwalker : public CreatureScript
|
||||
{
|
||||
return new npc_arugal_voidwalkerAI(pCreature);
|
||||
}
|
||||
public:
|
||||
npc_arugal_voidwalker() : CreatureScript("npc_arugal_voidwalker") { }
|
||||
|
||||
CreatureAI* GetAI(Creature* pCreature) const
|
||||
{
|
||||
return new npc_arugal_voidwalkerAI(pCreature);
|
||||
}
|
||||
|
||||
struct npc_arugal_voidwalkerAI : public ScriptedAI
|
||||
{
|
||||
npc_arugal_voidwalkerAI(Creature* pCreature) : ScriptedAI(pCreature)
|
||||
{
|
||||
pInstance = pCreature->GetInstanceScript();
|
||||
}
|
||||
|
||||
InstanceScript* pInstance;
|
||||
|
||||
uint32 uiDarkOffering;
|
||||
|
||||
void Reset()
|
||||
{
|
||||
uiDarkOffering = urand(290,10);
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 const uiDiff)
|
||||
{
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
if (uiDarkOffering <= uiDiff)
|
||||
{
|
||||
if (Creature* pFriend = me->FindNearestCreature(me->GetEntry(),25.0f,true))
|
||||
{
|
||||
if (pFriend)
|
||||
DoCast(pFriend,SPELL_DARK_OFFERING);
|
||||
}
|
||||
else
|
||||
DoCast(me,SPELL_DARK_OFFERING);
|
||||
uiDarkOffering = urand(4400,12500);
|
||||
} else uiDarkOffering -= uiDiff;
|
||||
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
|
||||
void JustDied(Unit* /*pKiller*/)
|
||||
{
|
||||
if (pInstance)
|
||||
pInstance->SetData(TYPE_FENRUS, pInstance->GetData(TYPE_FENRUS) + 1);
|
||||
}
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
|
||||
void AddSC_shadowfang_keep()
|
||||
{
|
||||
Script* newscript;
|
||||
|
||||
newscript = new Script;
|
||||
newscript->Name = "npc_shadowfang_prisoner";
|
||||
newscript->pGossipHello = &GossipHello_npc_shadowfang_prisoner;
|
||||
newscript->pGossipSelect = &GossipSelect_npc_shadowfang_prisoner;
|
||||
newscript->GetAI = &GetAI_npc_shadowfang_prisoner;
|
||||
newscript->RegisterSelf();
|
||||
|
||||
newscript = new Script;
|
||||
newscript->Name = "npc_arugal_voidwalker";
|
||||
newscript->GetAI = &GetAI_npc_arugal_voidwalker;
|
||||
newscript->RegisterSelf();
|
||||
new npc_shadowfang_prisoner();
|
||||
new npc_arugal_voidwalker();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user