* 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
2010-08-08 22:54:58 +06:00
parent 8a69e50d6a
commit 590199d8e1
482 changed files with 84476 additions and 82697 deletions
@@ -86,276 +86,279 @@ float Spawnsway[2][3] =
{1884.86,1228.62,9},
{1887.53,1263,41}
};
struct instance_zulfarrak : public ScriptedInstance
␍class instance_zulfarrak : public InstanceMapScript
{
instance_zulfarrak(Map* pMap) : ScriptedInstance(pMap) {Initialize();}
public:
instance_zulfarrak() : InstanceMapScript("instance_zulfarrak") { }
uint32 GahzRillaEncounter;
uint64 ZumrahGUID;
uint64 BlyGUID;
uint64 WeegliGUID;
uint64 OroGUID;
uint64 RavenGUID;
uint64 MurtaGUID;
uint64 EndDoorGUID;
uint32 PyramidPhase;
uint32 major_wave_Timer;
uint32 minor_wave_Timer;
uint32 addGroupSize;
uint32 waypoint;
void Initialize()
InstanceScript* GetInstanceData_InstanceMapScript(Map* pMap)
{
GahzRillaEncounter = NOT_STARTED;
return new instance_zulfarrak_InstanceMapScript(pMap);
}
void OnCreatureCreate(Creature* pCreature, bool /*add*/)
struct instance_zulfarrak_InstanceMapScript : public InstanceScript
{
switch (pCreature->GetEntry())
instance_zulfarrak_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {Initialize();}
uint32 GahzRillaEncounter;
uint64 ZumrahGUID;
uint64 BlyGUID;
uint64 WeegliGUID;
uint64 OroGUID;
uint64 RavenGUID;
uint64 MurtaGUID;
uint64 EndDoorGUID;
uint32 PyramidPhase;
uint32 major_wave_Timer;
uint32 minor_wave_Timer;
uint32 addGroupSize;
uint32 waypoint;
void Initialize()
{
case ENTRY_ZUMRAH:
ZumrahGUID = pCreature->GetGUID();
break;
case ENTRY_BLY:
BlyGUID = pCreature->GetGUID();
pCreature->SetReactState(REACT_PASSIVE); // starts out passive (in a cage)
break;
case ENTRY_RAVEN:
RavenGUID = pCreature->GetGUID();
pCreature->SetReactState(REACT_PASSIVE);// starts out passive (in a cage)
break;
case ENTRY_ORO:
OroGUID = pCreature->GetGUID();
pCreature->SetReactState(REACT_PASSIVE);// starts out passive (in a cage)
break;
case ENTRY_WEEGLI:
WeegliGUID = pCreature->GetGUID();
pCreature->SetReactState(REACT_PASSIVE);// starts out passive (in a cage)
break;
case ENTRY_MURTA:
MurtaGUID = pCreature->GetGUID();
pCreature->SetReactState(REACT_PASSIVE);// starts out passive (in a cage)
break;
case NPC_GAHZRILLA:
if (GahzRillaEncounter >= IN_PROGRESS)
pCreature->DisappearAndDie();
else
GahzRillaEncounter = IN_PROGRESS;
break;
GahzRillaEncounter = NOT_STARTED;
}
}
void OnGameObjectCreate(GameObject* pGo, bool /*apply*/)
{
switch(pGo->GetEntry())
void OnCreatureCreate(Creature* pCreature, bool /*add*/)
{
case GO_END_DOOR:
EndDoorGUID = pGo->GetGUID();
break;
switch (pCreature->GetEntry())
{
case ENTRY_ZUMRAH:
ZumrahGUID = pCreature->GetGUID();
break;
case ENTRY_BLY:
BlyGUID = pCreature->GetGUID();
pCreature->SetReactState(REACT_PASSIVE); // starts out passive (in a cage)
break;
case ENTRY_RAVEN:
RavenGUID = pCreature->GetGUID();
pCreature->SetReactState(REACT_PASSIVE);// starts out passive (in a cage)
break;
case ENTRY_ORO:
OroGUID = pCreature->GetGUID();
pCreature->SetReactState(REACT_PASSIVE);// starts out passive (in a cage)
break;
case ENTRY_WEEGLI:
WeegliGUID = pCreature->GetGUID();
pCreature->SetReactState(REACT_PASSIVE);// starts out passive (in a cage)
break;
case ENTRY_MURTA:
MurtaGUID = pCreature->GetGUID();
pCreature->SetReactState(REACT_PASSIVE);// starts out passive (in a cage)
break;
case NPC_GAHZRILLA:
if (GahzRillaEncounter >= IN_PROGRESS)
pCreature->DisappearAndDie();
else
GahzRillaEncounter = IN_PROGRESS;
break;
}
}
}
uint32 GetData(uint32 type)
{
switch(type)
void OnGameObjectCreate(GameObject* pGo, bool /*apply*/)
{
case EVENT_PYRAMID:
return PyramidPhase;
switch(pGo->GetEntry())
{
case GO_END_DOOR:
EndDoorGUID = pGo->GetGUID();
break;
}
}
return 0;
}
uint64 GetData64(uint32 data)
{
switch(data)
uint32 GetData(uint32 type)
{
case ENTRY_ZUMRAH:
return ZumrahGUID;
case ENTRY_BLY:
return BlyGUID;
case ENTRY_RAVEN:
return RavenGUID;
case ENTRY_ORO:
return OroGUID;
case ENTRY_WEEGLI:
return WeegliGUID;
case ENTRY_MURTA:
return MurtaGUID;
case GO_END_DOOR:
return EndDoorGUID;
switch(type)
{
case EVENT_PYRAMID:
return PyramidPhase;
}
return 0;
}
return 0;
}
void SetData(uint32 type, uint32 data)
{
switch(type)
uint64 GetData64(uint32 data)
{
case EVENT_PYRAMID:
PyramidPhase=data;
break;
};
}
switch(data)
{
case ENTRY_ZUMRAH:
return ZumrahGUID;
case ENTRY_BLY:
return BlyGUID;
case ENTRY_RAVEN:
return RavenGUID;
case ENTRY_ORO:
return OroGUID;
case ENTRY_WEEGLI:
return WeegliGUID;
case ENTRY_MURTA:
return MurtaGUID;
case GO_END_DOOR:
return EndDoorGUID;
}
return 0;
}
virtual void Update(uint32 diff)
{
switch (PyramidPhase)
void SetData(uint32 type, uint32 data)
{
case PYRAMID_NOT_STARTED:
case PYRAMID_KILLED_ALL_TROLLS:
break;
case PYRAMID_ARRIVED_AT_STAIR:
SpawnPyramidWave(1);
SetData(EVENT_PYRAMID,PYRAMID_WAVE_1);
major_wave_Timer=120000;
minor_wave_Timer=0;
addGroupSize=2;
break;
case PYRAMID_WAVE_1:
if (IsWaveAllDead())
{
SetData(EVENT_PYRAMID,PYRAMID_PRE_WAVE_2);
major_wave_Timer = 10000; //give players a few seconds before wave 2 starts to rebuff
}
else
if (minor_wave_Timer<diff)
switch(type)
{
case EVENT_PYRAMID:
PyramidPhase=data;
break;
};
}
virtual void Update(uint32 diff)
{
switch (PyramidPhase)
{
case PYRAMID_NOT_STARTED:
case PYRAMID_KILLED_ALL_TROLLS:
break;
case PYRAMID_ARRIVED_AT_STAIR:
SpawnPyramidWave(1);
SetData(EVENT_PYRAMID,PYRAMID_WAVE_1);
major_wave_Timer=120000;
minor_wave_Timer=0;
addGroupSize=2;
break;
case PYRAMID_WAVE_1:
if (IsWaveAllDead())
{
SendAddsUpStairs(addGroupSize++);
minor_wave_Timer=10000;
SetData(EVENT_PYRAMID,PYRAMID_PRE_WAVE_2);
major_wave_Timer = 10000; //give players a few seconds before wave 2 starts to rebuff
}
else
minor_wave_Timer -= diff;
break;
case PYRAMID_PRE_WAVE_2:
if (major_wave_Timer<diff)
{
// beginning 2nd wave!
SpawnPyramidWave(2);
SetData(EVENT_PYRAMID,PYRAMID_WAVE_2);
minor_wave_Timer = 0;
addGroupSize=2;
}
else
major_wave_Timer -= diff;
break;
case PYRAMID_WAVE_2:
if (IsWaveAllDead())
{
SpawnPyramidWave(3);
SetData(EVENT_PYRAMID,PYRAMID_PRE_WAVE_3);
major_wave_Timer = 5000; //give NPCs time to return to their home spots
}
else
if (minor_wave_Timer<diff)
if (minor_wave_Timer<diff)
{
SendAddsUpStairs(addGroupSize++);
minor_wave_Timer=10000;
}
else
minor_wave_Timer -= diff;
break;
case PYRAMID_PRE_WAVE_2:
if (major_wave_Timer<diff)
{
SendAddsUpStairs(addGroupSize++);
minor_wave_Timer=10000;
// beginning 2nd wave!
SpawnPyramidWave(2);
SetData(EVENT_PYRAMID,PYRAMID_WAVE_2);
minor_wave_Timer = 0;
addGroupSize=2;
}
else
major_wave_Timer -= diff;
break;
case PYRAMID_WAVE_2:
if (IsWaveAllDead())
{
SpawnPyramidWave(3);
SetData(EVENT_PYRAMID,PYRAMID_PRE_WAVE_3);
major_wave_Timer = 5000; //give NPCs time to return to their home spots
}
else
minor_wave_Timer -= diff;
break;
case PYRAMID_PRE_WAVE_3:
if (major_wave_Timer<diff)
{
// move NPCs to bottom of stair
MoveNPCIfAlive(ENTRY_BLY,1887.92,1228.179,9.98,4.78);
MoveNPCIfAlive(ENTRY_MURTA,1891.57,1228.68,9.69,4.78);
MoveNPCIfAlive(ENTRY_ORO,1897.23,1228.34,9.43,4.78);
MoveNPCIfAlive(ENTRY_RAVEN,1883.68,1227.95,9.543,4.78);
MoveNPCIfAlive(ENTRY_WEEGLI,1878.02,1227.65,9.485,4.78);
SetData(EVENT_PYRAMID,PYRAMID_WAVE_3);
}
else
major_wave_Timer -= diff;
break;
case PYRAMID_WAVE_3:
if (IsWaveAllDead()) // move NPCS to their final positions
{
SetData(EVENT_PYRAMID,PYRAMID_KILLED_ALL_TROLLS);
MoveNPCIfAlive(ENTRY_BLY,1883.82,1200.83,8.87,1.32);
MoveNPCIfAlive(ENTRY_MURTA,1891.83,1201.45,8.87,1.32);
MoveNPCIfAlive(ENTRY_ORO,1894.50,1204.40,8.87,1.32);
MoveNPCIfAlive(ENTRY_RAVEN,1874.11,1206.17,8.87,1.32);
MoveNPCIfAlive(ENTRY_WEEGLI,1877.52,1199.63,8.87,1.32);
}
break;
};
}
if (minor_wave_Timer<diff)
{
SendAddsUpStairs(addGroupSize++);
minor_wave_Timer=10000;
}
else
minor_wave_Timer -= diff;
break;
case PYRAMID_PRE_WAVE_3:
if (major_wave_Timer<diff)
{
// move NPCs to bottom of stair
MoveNPCIfAlive(ENTRY_BLY,1887.92,1228.179,9.98,4.78);
MoveNPCIfAlive(ENTRY_MURTA,1891.57,1228.68,9.69,4.78);
MoveNPCIfAlive(ENTRY_ORO,1897.23,1228.34,9.43,4.78);
MoveNPCIfAlive(ENTRY_RAVEN,1883.68,1227.95,9.543,4.78);
MoveNPCIfAlive(ENTRY_WEEGLI,1878.02,1227.65,9.485,4.78);
SetData(EVENT_PYRAMID,PYRAMID_WAVE_3);
}
else
major_wave_Timer -= diff;
break;
case PYRAMID_WAVE_3:
if (IsWaveAllDead()) // move NPCS to their final positions
{
SetData(EVENT_PYRAMID,PYRAMID_KILLED_ALL_TROLLS);
MoveNPCIfAlive(ENTRY_BLY,1883.82,1200.83,8.87,1.32);
MoveNPCIfAlive(ENTRY_MURTA,1891.83,1201.45,8.87,1.32);
MoveNPCIfAlive(ENTRY_ORO,1894.50,1204.40,8.87,1.32);
MoveNPCIfAlive(ENTRY_RAVEN,1874.11,1206.17,8.87,1.32);
MoveNPCIfAlive(ENTRY_WEEGLI,1877.52,1199.63,8.87,1.32);
}
break;
};
}
std::list<uint64> addsAtBase,movedadds;
std::list<uint64> addsAtBase,movedadds;
void MoveNPCIfAlive(uint32 entry,float x,float y,float z,float o)
{
if (Creature* npc = instance->GetCreature(GetData64(entry)))
{
if (npc->isAlive())
void MoveNPCIfAlive(uint32 entry,float x,float y,float z,float o)
{
if (Creature* npc = instance->GetCreature(GetData64(entry)))
{
npc->AddUnitMovementFlag(MOVEMENTFLAG_WALKING);
npc->GetMotionMaster()->MovePoint(1,x,y,z);
npc->SetHomePosition(x,y,z,o);
}
if (npc->isAlive())
{
npc->AddUnitMovementFlag(MOVEMENTFLAG_WALKING);
npc->GetMotionMaster()->MovePoint(1,x,y,z);
npc->SetHomePosition(x,y,z,o);
}
}
}
}
void SpawnPyramidWave(uint32 wave){
for (int i = 0; i < pyramidSpawnTotal; i++)
{
if (pyramidSpawns[i][0] == (float)wave)
void SpawnPyramidWave(uint32 wave){
for (int i = 0; i < pyramidSpawnTotal; i++)
{
Position pos = {pyramidSpawns[i][2], pyramidSpawns[i][3], 8.87, 0};
TempSummon* ts = instance->SummonCreature(pyramidSpawns[i][1],pos);
ts->GetMotionMaster()->MoveRandom(10);
addsAtBase.push_back(ts->GetGUID());
if (pyramidSpawns[i][0] == (float)wave)
{
Position pos = {pyramidSpawns[i][2], pyramidSpawns[i][3], 8.87, 0};
TempSummon* ts = instance->SummonCreature(pyramidSpawns[i][1],pos);
ts->GetMotionMaster()->MoveRandom(10);
addsAtBase.push_back(ts->GetGUID());
}
}
}
}
bool IsWaveAllDead(){
for(std::list<uint64>::iterator itr = addsAtBase.begin(); itr != addsAtBase.end(); ++itr)
{
if (Creature* add = instance->GetCreature((*itr)))
bool IsWaveAllDead(){
for(std::list<uint64>::iterator itr = addsAtBase.begin(); itr != addsAtBase.end(); ++itr)
{
if (add->isAlive())
return false;
if (Creature* add = instance->GetCreature((*itr)))
{
if (add->isAlive())
return false;
}
}
}
for(std::list<uint64>::iterator itr = movedadds.begin(); itr != movedadds.end(); ++itr)
{
if (Creature* add = instance->GetCreature(((*itr))))
for(std::list<uint64>::iterator itr = movedadds.begin(); itr != movedadds.end(); ++itr)
{
if (add->isAlive())
return false;
if (Creature* add = instance->GetCreature(((*itr))))
{
if (add->isAlive())
return false;
}
}
return true;
}
return true;
}
void SendAddsUpStairs(uint32 count)
{
//pop a add from list, send him up the stairs...
for (uint32 addCount = 0; addCount<count && !addsAtBase.empty(); addCount++)
void SendAddsUpStairs(uint32 count)
{
if (Creature* add = instance->GetCreature(*addsAtBase.begin()))
//pop a add from list, send him up the stairs...
for (uint32 addCount = 0; addCount<count && !addsAtBase.empty(); addCount++)
{
add->GetMotionMaster()->MovePath(PATH_ADDS,false);
movedadds.push_back(add->GetGUID());
if (Creature* add = instance->GetCreature(*addsAtBase.begin()))
{
add->GetMotionMaster()->MovePath(PATH_ADDS,false);
movedadds.push_back(add->GetGUID());
}
addsAtBase.erase(addsAtBase.begin());
}
addsAtBase.erase(addsAtBase.begin());
}
}
};
};
InstanceData* GetInstanceData_instance_zulfarrak(Map* pMap)
{
return new instance_zulfarrak(pMap);
}
void AddSC_instance_zulfarrak()
{
Script *newscript;
newscript = new Script;
newscript->Name = "instance_zulfarrak";
newscript->GetInstanceData = &GetInstanceData_instance_zulfarrak;
newscript->RegisterSelf();
new instance_zulfarrak();
}
@@ -55,143 +55,152 @@ enum blySpells
};
#define GOSSIP_BLY "[PH] In that case, I will take my reward!"
struct npc_sergeant_blyAI : public ScriptedAI
␍class npc_sergeant_bly : public CreatureScript
{
npc_sergeant_blyAI(Creature* pCreature) : ScriptedAI(pCreature)
public:
npc_sergeant_bly() : CreatureScript("npc_sergeant_bly") { }
bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction)
{
pInstance = pCreature->GetInstanceData();
postGossipStep = 0;
}
ScriptedInstance* pInstance;
uint32 postGossipStep;
uint32 Text_Timer;
uint32 ShieldBash_Timer;
uint32 Revenge_Timer; //this is wrong, spell should never be used unless me->getVictim() dodge, parry or block attack. Trinity support required.
uint64 PlayerGUID;
void Reset()
{
ShieldBash_Timer = 5000;
Revenge_Timer = 8000;
me->setFaction(FACTION_FRIENDLY);
}
void UpdateAI(const uint32 diff)
{
if (postGossipStep>0 && postGossipStep<4)
if (uiAction == GOSSIP_ACTION_INFO_DEF+1)
{
if (Text_Timer<diff)
{
switch (postGossipStep)
{
case 1:
//weegli doesn't fight - he goes & blows up the door
if (Creature* pWeegli = pInstance->instance->GetCreature(pInstance->GetData64(ENTRY_WEEGLI)))
pWeegli->AI()->DoAction();
DoScriptText(SAY_1,me);
Text_Timer = 5000;
break;
case 2:
DoScriptText(SAY_2,me);
Text_Timer = 5000;
break;
case 3:
me->setFaction(FACTION_HOSTILE);
if (Player* pTarget = Player::GetPlayer(*me, PlayerGUID))
AttackStart(pTarget);
if (pInstance)
{
switchFactionIfAlive(pInstance, ENTRY_RAVEN);
switchFactionIfAlive(pInstance, ENTRY_ORO);
switchFactionIfAlive(pInstance, ENTRY_MURTA);
}
}
postGossipStep++;
}
else Text_Timer -= diff;
pPlayer->CLOSE_GOSSIP_MENU();
CAST_AI(npc_sergeant_bly::npc_sergeant_blyAI,pCreature->AI())->PlayerGUID = pPlayer->GetGUID();
pCreature->AI()->DoAction();
}
if (!UpdateVictim())
return;
if (ShieldBash_Timer <= diff)
{
DoCast(me->getVictim(), SPELL_SHIELD_BASH);
ShieldBash_Timer = 15000;
}
else
ShieldBash_Timer -= diff;
if (Revenge_Timer <= diff)
{
DoCast(me->getVictim(), SPELL_REVENGE);
Revenge_Timer = 10000;
}
else
Revenge_Timer -= diff;
DoMeleeAttackIfReady();
}
void DoAction(const int32 param)
{
postGossipStep=1;
Text_Timer = 0;
}
void switchFactionIfAlive(ScriptedInstance* pInstance,uint32 entry)
{
if (Creature* crew = pInstance->instance->GetCreature(pInstance->GetData64(entry)))
if (crew->isAlive())
crew->setFaction(FACTION_HOSTILE);
}
};
CreatureAI* GetAI_npc_sergeant_bly(Creature* pCreature)
{
return new npc_sergeant_blyAI (pCreature);
}
bool GossipHello_npc_sergeant_bly(Player* pPlayer, Creature* pCreature)
{
if (ScriptedInstance* pInstance = pCreature->GetInstanceData())
{
if (pInstance->GetData(EVENT_PYRAMID) == PYRAMID_KILLED_ALL_TROLLS)
{
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_BLY, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
pPlayer->SEND_GOSSIP_MENU(1517, pCreature->GetGUID());
}
else
if (pInstance->GetData(EVENT_PYRAMID) == PYRAMID_NOT_STARTED)
pPlayer->SEND_GOSSIP_MENU(1515, pCreature->GetGUID());
else
pPlayer->SEND_GOSSIP_MENU(1516, pCreature->GetGUID());
return true;
}
return false;
}
bool GossipSelect_npc_sergeant_bly(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();
CAST_AI(npc_sergeant_blyAI,pCreature->AI())->PlayerGUID = pPlayer->GetGUID();
pCreature->AI()->DoAction();
if (InstanceScript* pInstance = pCreature->GetInstanceScript())
{
if (pInstance->GetData(EVENT_PYRAMID) == PYRAMID_KILLED_ALL_TROLLS)
{
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_BLY, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
pPlayer->SEND_GOSSIP_MENU(1517, pCreature->GetGUID());
}
else
if (pInstance->GetData(EVENT_PYRAMID) == PYRAMID_NOT_STARTED)
pPlayer->SEND_GOSSIP_MENU(1515, pCreature->GetGUID());
else
pPlayer->SEND_GOSSIP_MENU(1516, pCreature->GetGUID());
return true;
}
return false;
}
return true;
}
CreatureAI* GetAI(Creature* pCreature) const
{
return new npc_sergeant_blyAI (pCreature);
}
struct npc_sergeant_blyAI : public ScriptedAI
{
npc_sergeant_blyAI(Creature* pCreature) : ScriptedAI(pCreature)
{
pInstance = pCreature->GetInstanceScript();
postGossipStep = 0;
}
InstanceScript* pInstance;
uint32 postGossipStep;
uint32 Text_Timer;
uint32 ShieldBash_Timer;
uint32 Revenge_Timer; //this is wrong, spell should never be used unless me->getVictim() dodge, parry or block attack. Trinity support required.
uint64 PlayerGUID;
void Reset()
{
ShieldBash_Timer = 5000;
Revenge_Timer = 8000;
me->setFaction(FACTION_FRIENDLY);
}
void UpdateAI(const uint32 diff)
{
if (postGossipStep>0 && postGossipStep<4)
{
if (Text_Timer<diff)
{
switch (postGossipStep)
{
case 1:
//weegli doesn't fight - he goes & blows up the door
if (Creature* pWeegli = pInstance->instance->GetCreature(pInstance->GetData64(ENTRY_WEEGLI)))
pWeegli->AI()->DoAction();
DoScriptText(SAY_1,me);
Text_Timer = 5000;
break;
case 2:
DoScriptText(SAY_2,me);
Text_Timer = 5000;
break;
case 3:
me->setFaction(FACTION_HOSTILE);
if (Player* pTarget = Player::GetPlayer(*me, PlayerGUID))
AttackStart(pTarget);
if (pInstance)
{
switchFactionIfAlive(pInstance, ENTRY_RAVEN);
switchFactionIfAlive(pInstance, ENTRY_ORO);
switchFactionIfAlive(pInstance, ENTRY_MURTA);
}
}
postGossipStep++;
}
else Text_Timer -= diff;
}
if (!UpdateVictim())
return;
if (ShieldBash_Timer <= diff)
{
DoCast(me->getVictim(), SPELL_SHIELD_BASH);
ShieldBash_Timer = 15000;
}
else
ShieldBash_Timer -= diff;
if (Revenge_Timer <= diff)
{
DoCast(me->getVictim(), SPELL_REVENGE);
Revenge_Timer = 10000;
}
else
Revenge_Timer -= diff;
DoMeleeAttackIfReady();
}
void DoAction(const int32 param)
{
postGossipStep=1;
Text_Timer = 0;
}
void switchFactionIfAlive(InstanceScript* pInstance,uint32 entry)
{
if (Creature* crew = pInstance->instance->GetCreature(pInstance->GetData64(entry)))
if (crew->isAlive())
crew->setFaction(FACTION_HOSTILE);
}
};
};
/*######
+## go_troll_cage
+######*/
void initBlyCrewMember(ScriptedInstance* pInstance, uint32 entry,float x,float y, float z)
void initBlyCrewMember(InstanceScript* pInstance, uint32 entry,float x,float y, float z)
{
if (Creature* crew = pInstance->instance->GetCreature(pInstance->GetData64(entry)))
{
@@ -202,21 +211,27 @@ void initBlyCrewMember(ScriptedInstance* pInstance, uint32 entry,float x,float y
crew->setFaction(FACTION_FREED);
}
}
bool GOHello_go_troll_cage(Player* pPlayer, GameObject* pGo)
␍class go_troll_cage : public GameObjectScript
{
if (ScriptedInstance* pInstance = pGo->GetInstanceData())
public:
go_troll_cage() : GameObjectScript("go_troll_cage") { }
bool OnGossipHello(Player* pPlayer, GameObject* pGo)
{
pInstance->SetData(EVENT_PYRAMID, PYRAMID_CAGES_OPEN);
//set bly & co to aggressive & start moving to top of stairs
initBlyCrewMember(pInstance,ENTRY_BLY,1884.99,1263,41.52);
initBlyCrewMember(pInstance,ENTRY_RAVEN,1882.5,1263,41.52);
initBlyCrewMember(pInstance,ENTRY_ORO,1886.47,1270.68,41.68);
initBlyCrewMember(pInstance,ENTRY_WEEGLI,1890,1263,41.52);
initBlyCrewMember(pInstance,ENTRY_MURTA,1891.19,1272.03,41.60);
if (InstanceScript* pInstance = pGo->GetInstanceScript())
{
pInstance->SetData(EVENT_PYRAMID, PYRAMID_CAGES_OPEN);
//set bly & co to aggressive & start moving to top of stairs
initBlyCrewMember(pInstance,ENTRY_BLY,1884.99,1263,41.52);
initBlyCrewMember(pInstance,ENTRY_RAVEN,1882.5,1263,41.52);
initBlyCrewMember(pInstance,ENTRY_ORO,1886.47,1270.68,41.68);
initBlyCrewMember(pInstance,ENTRY_WEEGLI,1890,1263,41.52);
initBlyCrewMember(pInstance,ENTRY_MURTA,1891.19,1272.03,41.60);
}
return false;
}
return false;
}
};
/*######
## npc_weegli_blastfuse
@@ -237,137 +252,146 @@ enum weegliSays
};
#define GOSSIP_WEEGLI "[PH] Please blow up the door."
struct npc_weegli_blastfuseAI : public ScriptedAI
␍class npc_weegli_blastfuse : public CreatureScript
{
npc_weegli_blastfuseAI(Creature* pCreature) : ScriptedAI(pCreature)
public:
npc_weegli_blastfuse() : CreatureScript("npc_weegli_blastfuse") { }
bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction)
{
pInstance = pCreature->GetInstanceData();
destroyingDoor=false;
Bomb_Timer = 10000;
LandMine_Timer = 30000;
}
uint32 Bomb_Timer;
uint32 LandMine_Timer;
bool destroyingDoor;
ScriptedInstance* pInstance;
void Reset()
{
/*if (pInstance)
pInstance->SetData(0, NOT_STARTED);*/
}
void AttackStart(Unit *victim)
{
AttackStartCaster(victim,10);//keep back & toss bombs/shoot
}
void JustDied(Unit * /*victim*/)
{
/*if (pInstance)
pInstance->SetData(0, DONE);*/
}
void UpdateAI(const uint32 diff)
{
if (!UpdateVictim())
return;
if (Bomb_Timer < diff)
if (uiAction == GOSSIP_ACTION_INFO_DEF+1)
{
DoCast(me->getVictim(),SPELL_BOMB);
Bomb_Timer = 10000;
}
else
Bomb_Timer -= diff;
if (me->isAttackReady() && !me->IsWithinMeleeRange(me->getVictim()))
{
DoCast(me->getVictim(),SPELL_SHOOT);
me->SetSheath(SHEATH_STATE_RANGED);
}
else
{
me->SetSheath(SHEATH_STATE_MELEE);
DoMeleeAttackIfReady();
}
}
void MovementInform(uint32 type, uint32 id)
{
if (pInstance)
{
if (pInstance->GetData(EVENT_PYRAMID) == PYRAMID_CAGES_OPEN)
{
pInstance->SetData(EVENT_PYRAMID,PYRAMID_ARRIVED_AT_STAIR);
DoScriptText(SAY_WEEGLI_OHNO,me);
me->SetHomePosition(1882.69,1272.28,41.87,0);
}
else
if (destroyingDoor)
{
pInstance->DoUseDoorOrButton(pInstance->GetData64(GO_END_DOOR));
//TODO: leave the area...
me->ForcedDespawn();
};
}
}
void DoAction(const int32 param)
{
DestroyDoor();
}
void DestroyDoor()
{
if (me->isAlive())
{
me->setFaction(FACTION_FRIENDLY);
me->GetMotionMaster()->MovePoint(0, 1858.57,1146.35,14.745);
me->SetHomePosition(1858.57,1146.35,14.745,3.85); // in case he gets interrupted
DoScriptText(SAY_WEEGLI_OK_I_GO,me);
destroyingDoor=true;
}
}
};
CreatureAI* GetAI_npc_weegli_blastfuse(Creature* pCreature)
{
return new npc_weegli_blastfuseAI (pCreature);
}
bool GossipHello_npc_weegli_blastfuse(Player* pPlayer, Creature* pCreature)
{
if (ScriptedInstance* pInstance = pCreature->GetInstanceData())
{
switch (pInstance->GetData(EVENT_PYRAMID))
{
case PYRAMID_KILLED_ALL_TROLLS:
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_WEEGLI, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
pPlayer->SEND_GOSSIP_MENU(1514, pCreature->GetGUID()); //if event can proceed to end
break;
case PYRAMID_NOT_STARTED:
pPlayer->SEND_GOSSIP_MENU(1511, pCreature->GetGUID()); //if event not started
break;
default:
pPlayer->SEND_GOSSIP_MENU(1513, pCreature->GetGUID()); //if event are in progress
pPlayer->CLOSE_GOSSIP_MENU();
//here we make him run to door, set the charge and run away off to nowhere
pCreature->AI()->DoAction();
}
return true;
}
return false;
}
bool GossipSelect_npc_weegli_blastfuse(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();
//here we make him run to door, set the charge and run away off to nowhere
pCreature->AI()->DoAction();
if (InstanceScript* pInstance = pCreature->GetInstanceScript())
{
switch (pInstance->GetData(EVENT_PYRAMID))
{
case PYRAMID_KILLED_ALL_TROLLS:
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_WEEGLI, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
pPlayer->SEND_GOSSIP_MENU(1514, pCreature->GetGUID()); //if event can proceed to end
break;
case PYRAMID_NOT_STARTED:
pPlayer->SEND_GOSSIP_MENU(1511, pCreature->GetGUID()); //if event not started
break;
default:
pPlayer->SEND_GOSSIP_MENU(1513, pCreature->GetGUID()); //if event are in progress
}
return true;
}
return false;
}
return true;
}
CreatureAI* GetAI(Creature* pCreature) const
{
return new npc_weegli_blastfuseAI (pCreature);
}
struct npc_weegli_blastfuseAI : public ScriptedAI
{
npc_weegli_blastfuseAI(Creature* pCreature) : ScriptedAI(pCreature)
{
pInstance = pCreature->GetInstanceScript();
destroyingDoor=false;
Bomb_Timer = 10000;
LandMine_Timer = 30000;
}
uint32 Bomb_Timer;
uint32 LandMine_Timer;
bool destroyingDoor;
InstanceScript* pInstance;
void Reset()
{
/*if (pInstance)
pInstance->SetData(0, NOT_STARTED);*/
}
void AttackStart(Unit *victim)
{
AttackStartCaster(victim,10);//keep back & toss bombs/shoot
}
void JustDied(Unit * /*victim*/)
{
/*if (pInstance)
pInstance->SetData(0, DONE);*/
}
void UpdateAI(const uint32 diff)
{
if (!UpdateVictim())
return;
if (Bomb_Timer < diff)
{
DoCast(me->getVictim(),SPELL_BOMB);
Bomb_Timer = 10000;
}
else
Bomb_Timer -= diff;
if (me->isAttackReady() && !me->IsWithinMeleeRange(me->getVictim()))
{
DoCast(me->getVictim(),SPELL_SHOOT);
me->SetSheath(SHEATH_STATE_RANGED);
}
else
{
me->SetSheath(SHEATH_STATE_MELEE);
DoMeleeAttackIfReady();
}
}
void MovementInform(uint32 type, uint32 id)
{
if (pInstance)
{
if (pInstance->GetData(EVENT_PYRAMID) == PYRAMID_CAGES_OPEN)
{
pInstance->SetData(EVENT_PYRAMID,PYRAMID_ARRIVED_AT_STAIR);
DoScriptText(SAY_WEEGLI_OHNO,me);
me->SetHomePosition(1882.69,1272.28,41.87,0);
}
else
if (destroyingDoor)
{
pInstance->DoUseDoorOrButton(pInstance->GetData64(GO_END_DOOR));
//TODO: leave the area...
me->ForcedDespawn();
};
}
}
void DoAction(const int32 param)
{
DestroyDoor();
}
void DestroyDoor()
{
if (me->isAlive())
{
me->setFaction(FACTION_FRIENDLY);
me->GetMotionMaster()->MovePoint(0, 1858.57,1146.35,14.745);
me->SetHomePosition(1858.57,1146.35,14.745,3.85); // in case he gets interrupted
DoScriptText(SAY_WEEGLI_OK_I_GO,me);
destroyingDoor=true;
}
}
};
};
/*######
## go_shallow_grave
@@ -380,22 +404,28 @@ enum
ZOMBIE_CHANCE = 65,
DEAD_HERO_CHANCE = 10
};
bool GOHello_go_shallow_grave(Player* pPlayer, GameObject* pGo)
␍class go_shallow_grave : public GameObjectScript
{
// randomly summon a zombie or dead hero the first time a grave is used
if (pGo->GetUseCount() == 0)
public:
go_shallow_grave() : GameObjectScript("go_shallow_grave") { }
bool OnGossipHello(Player* pPlayer, GameObject* pGo)
{
uint32 randomchance = urand(0,100);
if (randomchance < ZOMBIE_CHANCE)
pGo->SummonCreature(ZOMBIE, pGo->GetPositionX(), pGo->GetPositionY(), pGo->GetPositionZ(), 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000);
else
if ((randomchance-ZOMBIE_CHANCE) < DEAD_HERO_CHANCE)
pGo->SummonCreature(DEAD_HERO, pGo->GetPositionX(), pGo->GetPositionY(), pGo->GetPositionZ(), 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000);
// randomly summon a zombie or dead hero the first time a grave is used
if (pGo->GetUseCount() == 0)
{
uint32 randomchance = urand(0,100);
if (randomchance < ZOMBIE_CHANCE)
pGo->SummonCreature(ZOMBIE, pGo->GetPositionX(), pGo->GetPositionY(), pGo->GetPositionZ(), 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000);
else
if ((randomchance-ZOMBIE_CHANCE) < DEAD_HERO_CHANCE)
pGo->SummonCreature(DEAD_HERO, pGo->GetPositionX(), pGo->GetPositionY(), pGo->GetPositionZ(), 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000);
}
pGo->AddUse();
return false;
}
pGo->AddUse();
return false;
}
};
/*######
## at_zumrah
@@ -406,49 +436,29 @@ enum zumrahConsts
ZUMRAH_ID = 7271,
ZUMRAH_HOSTILE_FACTION = 37
};
bool AreaTrigger_at_zumrah(Player* pPlayer,const AreaTriggerEntry *at)
␍class at_zumrah : public AreaTriggerScript
{
Creature* pZumrah = pPlayer->FindNearestCreature(ZUMRAH_ID, 30.0f);
public:
at_zumrah() : AreaTriggerScript("at_zumrah") { }
if (!pZumrah)
return false;
bool OnTrigger(Player* pPlayer,const AreaTriggerEntry *at)
{
Creature* pZumrah = pPlayer->FindNearestCreature(ZUMRAH_ID, 30.0f);
pZumrah->setFaction(ZUMRAH_HOSTILE_FACTION);
return true;
}
if (!pZumrah)
return false;
pZumrah->setFaction(ZUMRAH_HOSTILE_FACTION);
return true;
}
};
void AddSC_zulfarrak()
{
Script *newscript;
newscript = new Script;
newscript->Name="npc_sergeant_bly";
newscript->GetAI = &GetAI_npc_sergeant_bly;
newscript->pGossipHello = &GossipHello_npc_sergeant_bly;
newscript->pGossipSelect = &GossipSelect_npc_sergeant_bly;
newscript->RegisterSelf();
newscript = new Script;
newscript->Name="npc_weegli_blastfuse";
newscript->GetAI = &GetAI_npc_weegli_blastfuse;
newscript->pGossipHello = &GossipHello_npc_weegli_blastfuse;
newscript->pGossipSelect = &GossipSelect_npc_weegli_blastfuse;
newscript->RegisterSelf();
newscript = new Script;
newscript->Name="go_shallow_grave";
newscript->pGOHello = &GOHello_go_shallow_grave;
newscript->RegisterSelf();
newscript = new Script;
newscript->Name = "at_zumrah";
newscript->pAreaTrigger = &AreaTrigger_at_zumrah;
newscript->RegisterSelf();
newscript = new Script;
newscript->Name = "go_troll_cage";
newscript->pGOHello = &GOHello_go_troll_cage;
newscript->RegisterSelf();
new npc_sergeant_bly();
new npc_weegli_blastfuse();
new go_shallow_grave();
new at_zumrah();
new go_troll_cage();
}