* 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:
@@ -101,294 +101,302 @@ float Spawns[6][2]=
|
||||
#define SPAWN_Z 90.5
|
||||
#define SPAWN_Y -1758
|
||||
#define SPAWN_O 4.738
|
||||
|
||||
struct npc_barnesAI : public npc_escortAI
|
||||
␍class npc_barnes : public CreatureScript
|
||||
{
|
||||
npc_barnesAI(Creature* c) : npc_escortAI(c)
|
||||
public:
|
||||
npc_barnes() : CreatureScript("npc_barnes") { }
|
||||
|
||||
struct npc_barnesAI : public npc_escortAI
|
||||
{
|
||||
RaidWiped = false;
|
||||
m_uiEventId = 0;
|
||||
pInstance = c->GetInstanceData();
|
||||
}
|
||||
|
||||
ScriptedInstance* pInstance;
|
||||
|
||||
uint64 m_uiSpotlightGUID;
|
||||
|
||||
uint32 TalkCount;
|
||||
uint32 TalkTimer;
|
||||
uint32 WipeTimer;
|
||||
uint32 m_uiEventId;
|
||||
|
||||
bool PerformanceReady;
|
||||
bool RaidWiped;
|
||||
|
||||
void Reset()
|
||||
{
|
||||
m_uiSpotlightGUID = 0;
|
||||
|
||||
TalkCount = 0;
|
||||
TalkTimer = 2000;
|
||||
WipeTimer = 5000;
|
||||
|
||||
PerformanceReady = false;
|
||||
|
||||
if (pInstance)
|
||||
m_uiEventId = pInstance->GetData(DATA_OPERA_PERFORMANCE);
|
||||
}
|
||||
|
||||
void StartEvent()
|
||||
{
|
||||
if (!pInstance)
|
||||
return;
|
||||
|
||||
pInstance->SetData(TYPE_OPERA, IN_PROGRESS);
|
||||
|
||||
//resets count for this event, in case earlier failed
|
||||
if (m_uiEventId == EVENT_OZ)
|
||||
pInstance->SetData(DATA_OPERA_OZ_DEATHCOUNT, IN_PROGRESS);
|
||||
|
||||
Start(false, false);
|
||||
}
|
||||
|
||||
void EnterCombat(Unit* /*who*/) {}
|
||||
|
||||
void WaypointReached(uint32 i)
|
||||
{
|
||||
if (!pInstance)
|
||||
return;
|
||||
|
||||
switch(i)
|
||||
npc_barnesAI(Creature* c) : npc_escortAI(c)
|
||||
{
|
||||
case 0:
|
||||
DoCast(me, SPELL_TUXEDO, false);
|
||||
pInstance->DoUseDoorOrButton(pInstance->GetData64(DATA_GO_STAGEDOORLEFT));
|
||||
break;
|
||||
case 4:
|
||||
TalkCount = 0;
|
||||
SetEscortPaused(true);
|
||||
|
||||
if (Creature* pSpotlight = me->SummonCreature(CREATURE_SPOTLIGHT,
|
||||
me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0.0f,
|
||||
TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000))
|
||||
{
|
||||
pSpotlight->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
|
||||
pSpotlight->CastSpell(pSpotlight, SPELL_SPOTLIGHT, false);
|
||||
m_uiSpotlightGUID = pSpotlight->GetGUID();
|
||||
}
|
||||
break;
|
||||
case 8:
|
||||
pInstance->DoUseDoorOrButton(pInstance->GetData64(DATA_GO_STAGEDOORLEFT));
|
||||
PerformanceReady = true;
|
||||
break;
|
||||
case 9:
|
||||
PrepareEncounter();
|
||||
pInstance->DoUseDoorOrButton(pInstance->GetData64(DATA_GO_CURTAINS));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void Talk(uint32 count)
|
||||
{
|
||||
int32 text = 0;
|
||||
|
||||
switch(m_uiEventId)
|
||||
{
|
||||
case EVENT_OZ:
|
||||
if (OzDialogue[count].textid)
|
||||
text = OzDialogue[count].textid;
|
||||
if (OzDialogue[count].timer)
|
||||
TalkTimer = OzDialogue[count].timer;
|
||||
break;
|
||||
|
||||
case EVENT_HOOD:
|
||||
if (HoodDialogue[count].textid)
|
||||
text = HoodDialogue[count].textid;
|
||||
if (HoodDialogue[count].timer)
|
||||
TalkTimer = HoodDialogue[count].timer;
|
||||
break;
|
||||
|
||||
case EVENT_RAJ:
|
||||
if (RAJDialogue[count].textid)
|
||||
text = RAJDialogue[count].textid;
|
||||
if (RAJDialogue[count].timer)
|
||||
TalkTimer = RAJDialogue[count].timer;
|
||||
break;
|
||||
RaidWiped = false;
|
||||
m_uiEventId = 0;
|
||||
pInstance = c->GetInstanceScript();
|
||||
}
|
||||
|
||||
if (text)
|
||||
DoScriptText(text, me);
|
||||
}
|
||||
InstanceScript* pInstance;
|
||||
|
||||
void PrepareEncounter()
|
||||
{
|
||||
sLog.outDebug("TSCR: Barnes Opera Event - Introduction complete - preparing encounter %d", m_uiEventId);
|
||||
uint8 index = 0;
|
||||
uint8 count = 0;
|
||||
uint64 m_uiSpotlightGUID;
|
||||
|
||||
switch(m_uiEventId)
|
||||
uint32 TalkCount;
|
||||
uint32 TalkTimer;
|
||||
uint32 WipeTimer;
|
||||
uint32 m_uiEventId;
|
||||
|
||||
bool PerformanceReady;
|
||||
bool RaidWiped;
|
||||
|
||||
void Reset()
|
||||
{
|
||||
case EVENT_OZ:
|
||||
index = 0;
|
||||
count = 4;
|
||||
break;
|
||||
case EVENT_HOOD:
|
||||
index = 4;
|
||||
count = index+1;
|
||||
break;
|
||||
case EVENT_RAJ:
|
||||
index = 5;
|
||||
count = index+1;
|
||||
break;
|
||||
m_uiSpotlightGUID = 0;
|
||||
|
||||
TalkCount = 0;
|
||||
TalkTimer = 2000;
|
||||
WipeTimer = 5000;
|
||||
|
||||
PerformanceReady = false;
|
||||
|
||||
if (pInstance)
|
||||
m_uiEventId = pInstance->GetData(DATA_OPERA_PERFORMANCE);
|
||||
}
|
||||
|
||||
for (; index < count; ++index)
|
||||
void StartEvent()
|
||||
{
|
||||
uint32 entry = ((uint32)Spawns[index][0]);
|
||||
float PosX = Spawns[index][1];
|
||||
if (!pInstance)
|
||||
return;
|
||||
|
||||
if (Creature* pCreature = me->SummonCreature(entry, PosX, SPAWN_Y, SPAWN_Z, SPAWN_O, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, HOUR*2*IN_MILLISECONDS))
|
||||
pInstance->SetData(TYPE_OPERA, IN_PROGRESS);
|
||||
|
||||
//resets count for this event, in case earlier failed
|
||||
if (m_uiEventId == EVENT_OZ)
|
||||
pInstance->SetData(DATA_OPERA_OZ_DEATHCOUNT, IN_PROGRESS);
|
||||
|
||||
Start(false, false);
|
||||
}
|
||||
|
||||
void EnterCombat(Unit* /*who*/) {}
|
||||
|
||||
void WaypointReached(uint32 i)
|
||||
{
|
||||
if (!pInstance)
|
||||
return;
|
||||
|
||||
switch(i)
|
||||
{
|
||||
// In case database has bad flags
|
||||
pCreature->SetUInt32Value(UNIT_FIELD_FLAGS, 0);
|
||||
pCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
|
||||
case 0:
|
||||
DoCast(me, SPELL_TUXEDO, false);
|
||||
pInstance->DoUseDoorOrButton(pInstance->GetData64(DATA_GO_STAGEDOORLEFT));
|
||||
break;
|
||||
case 4:
|
||||
TalkCount = 0;
|
||||
SetEscortPaused(true);
|
||||
|
||||
if (Creature* pSpotlight = me->SummonCreature(CREATURE_SPOTLIGHT,
|
||||
me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0.0f,
|
||||
TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000))
|
||||
{
|
||||
pSpotlight->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
|
||||
pSpotlight->CastSpell(pSpotlight, SPELL_SPOTLIGHT, false);
|
||||
m_uiSpotlightGUID = pSpotlight->GetGUID();
|
||||
}
|
||||
break;
|
||||
case 8:
|
||||
pInstance->DoUseDoorOrButton(pInstance->GetData64(DATA_GO_STAGEDOORLEFT));
|
||||
PerformanceReady = true;
|
||||
break;
|
||||
case 9:
|
||||
PrepareEncounter();
|
||||
pInstance->DoUseDoorOrButton(pInstance->GetData64(DATA_GO_CURTAINS));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
RaidWiped = false;
|
||||
}
|
||||
|
||||
void UpdateAI(const uint32 diff)
|
||||
{
|
||||
npc_escortAI::UpdateAI(diff);
|
||||
|
||||
if (HasEscortState(STATE_ESCORT_PAUSED))
|
||||
void Talk(uint32 count)
|
||||
{
|
||||
if (TalkTimer <= diff)
|
||||
int32 text = 0;
|
||||
|
||||
switch(m_uiEventId)
|
||||
{
|
||||
if (TalkCount > 3)
|
||||
{
|
||||
if (Creature* pSpotlight = Unit::GetCreature(*me, m_uiSpotlightGUID))
|
||||
pSpotlight->ForcedDespawn();
|
||||
case EVENT_OZ:
|
||||
if (OzDialogue[count].textid)
|
||||
text = OzDialogue[count].textid;
|
||||
if (OzDialogue[count].timer)
|
||||
TalkTimer = OzDialogue[count].timer;
|
||||
break;
|
||||
|
||||
SetEscortPaused(false);
|
||||
return;
|
||||
}
|
||||
case EVENT_HOOD:
|
||||
if (HoodDialogue[count].textid)
|
||||
text = HoodDialogue[count].textid;
|
||||
if (HoodDialogue[count].timer)
|
||||
TalkTimer = HoodDialogue[count].timer;
|
||||
break;
|
||||
|
||||
Talk(TalkCount);
|
||||
++TalkCount;
|
||||
} else TalkTimer -= diff;
|
||||
case EVENT_RAJ:
|
||||
if (RAJDialogue[count].textid)
|
||||
text = RAJDialogue[count].textid;
|
||||
if (RAJDialogue[count].timer)
|
||||
TalkTimer = RAJDialogue[count].timer;
|
||||
break;
|
||||
}
|
||||
|
||||
if (text)
|
||||
DoScriptText(text, me);
|
||||
}
|
||||
|
||||
if (PerformanceReady)
|
||||
void PrepareEncounter()
|
||||
{
|
||||
if (!RaidWiped)
|
||||
sLog.outDebug("TSCR: Barnes Opera Event - Introduction complete - preparing encounter %d", m_uiEventId);
|
||||
uint8 index = 0;
|
||||
uint8 count = 0;
|
||||
|
||||
switch(m_uiEventId)
|
||||
{
|
||||
if (WipeTimer <= diff)
|
||||
case EVENT_OZ:
|
||||
index = 0;
|
||||
count = 4;
|
||||
break;
|
||||
case EVENT_HOOD:
|
||||
index = 4;
|
||||
count = index+1;
|
||||
break;
|
||||
case EVENT_RAJ:
|
||||
index = 5;
|
||||
count = index+1;
|
||||
break;
|
||||
}
|
||||
|
||||
for (; index < count; ++index)
|
||||
{
|
||||
uint32 entry = ((uint32)Spawns[index][0]);
|
||||
float PosX = Spawns[index][1];
|
||||
|
||||
if (Creature* pCreature = me->SummonCreature(entry, PosX, SPAWN_Y, SPAWN_Z, SPAWN_O, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, HOUR*2*IN_MILLISECONDS))
|
||||
{
|
||||
Map* pMap = me->GetMap();
|
||||
if (!pMap->IsDungeon())
|
||||
return;
|
||||
// In case database has bad flags
|
||||
pCreature->SetUInt32Value(UNIT_FIELD_FLAGS, 0);
|
||||
pCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
|
||||
}
|
||||
}
|
||||
|
||||
Map::PlayerList const &PlayerList = pMap->GetPlayers();
|
||||
if (PlayerList.isEmpty())
|
||||
return;
|
||||
RaidWiped = false;
|
||||
}
|
||||
|
||||
RaidWiped = true;
|
||||
for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
|
||||
void UpdateAI(const uint32 diff)
|
||||
{
|
||||
npc_escortAI::UpdateAI(diff);
|
||||
|
||||
if (HasEscortState(STATE_ESCORT_PAUSED))
|
||||
{
|
||||
if (TalkTimer <= diff)
|
||||
{
|
||||
if (TalkCount > 3)
|
||||
{
|
||||
if (i->getSource()->isAlive() && !i->getSource()->isGameMaster())
|
||||
{
|
||||
RaidWiped = false;
|
||||
break;
|
||||
}
|
||||
if (Creature* pSpotlight = Unit::GetCreature(*me, m_uiSpotlightGUID))
|
||||
pSpotlight->ForcedDespawn();
|
||||
|
||||
SetEscortPaused(false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (RaidWiped)
|
||||
Talk(TalkCount);
|
||||
++TalkCount;
|
||||
} else TalkTimer -= diff;
|
||||
}
|
||||
|
||||
if (PerformanceReady)
|
||||
{
|
||||
if (!RaidWiped)
|
||||
{
|
||||
if (WipeTimer <= diff)
|
||||
{
|
||||
Map* pMap = me->GetMap();
|
||||
if (!pMap->IsDungeon())
|
||||
return;
|
||||
|
||||
Map::PlayerList const &PlayerList = pMap->GetPlayers();
|
||||
if (PlayerList.isEmpty())
|
||||
return;
|
||||
|
||||
RaidWiped = true;
|
||||
EnterEvadeMode();
|
||||
return;
|
||||
}
|
||||
for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
|
||||
{
|
||||
if (i->getSource()->isAlive() && !i->getSource()->isGameMaster())
|
||||
{
|
||||
RaidWiped = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (RaidWiped)
|
||||
{
|
||||
RaidWiped = true;
|
||||
EnterEvadeMode();
|
||||
return;
|
||||
}
|
||||
|
||||
WipeTimer = 15000;
|
||||
} else WipeTimer -= diff;
|
||||
}
|
||||
|
||||
WipeTimer = 15000;
|
||||
} else WipeTimer -= diff;
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction)
|
||||
{
|
||||
npc_barnesAI* pBarnesAI = CAST_AI(npc_barnes::npc_barnesAI, pCreature->AI());
|
||||
|
||||
switch(uiAction)
|
||||
{
|
||||
case GOSSIP_ACTION_INFO_DEF+1:
|
||||
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, OZ_GOSSIP2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2);
|
||||
pPlayer->SEND_GOSSIP_MENU(8971, pCreature->GetGUID());
|
||||
break;
|
||||
case GOSSIP_ACTION_INFO_DEF+2:
|
||||
pPlayer->CLOSE_GOSSIP_MENU();
|
||||
pBarnesAI->StartEvent();
|
||||
break;
|
||||
case GOSSIP_ACTION_INFO_DEF+3:
|
||||
pPlayer->CLOSE_GOSSIP_MENU();
|
||||
pBarnesAI->m_uiEventId = EVENT_OZ;
|
||||
sLog.outString("TSCR: player (GUID %i) manually set Opera event to EVENT_OZ",pPlayer->GetGUID());
|
||||
break;
|
||||
case GOSSIP_ACTION_INFO_DEF+4:
|
||||
pPlayer->CLOSE_GOSSIP_MENU();
|
||||
pBarnesAI->m_uiEventId = EVENT_HOOD;
|
||||
sLog.outString("TSCR: player (GUID %i) manually set Opera event to EVENT_HOOD",pPlayer->GetGUID());
|
||||
break;
|
||||
case GOSSIP_ACTION_INFO_DEF+5:
|
||||
pPlayer->CLOSE_GOSSIP_MENU();
|
||||
pBarnesAI->m_uiEventId = EVENT_RAJ;
|
||||
sLog.outString("TSCR: player (GUID %i) manually set Opera event to EVENT_RAJ",pPlayer->GetGUID());
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool OnGossipHello(Player* pPlayer, Creature* pCreature)
|
||||
{
|
||||
if (InstanceScript* pInstance = pCreature->GetInstanceScript())
|
||||
{
|
||||
// Check for death of Moroes and if opera event is not done already
|
||||
if (pInstance->GetData(TYPE_MOROES) == DONE && pInstance->GetData(TYPE_OPERA) != DONE)
|
||||
{
|
||||
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, OZ_GOSSIP1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
|
||||
|
||||
if (pPlayer->isGameMaster())
|
||||
{
|
||||
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, OZ_GM_GOSSIP1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3);
|
||||
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, OZ_GM_GOSSIP2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4);
|
||||
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, OZ_GM_GOSSIP3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5);
|
||||
}
|
||||
|
||||
if (npc_barnesAI* pBarnesAI = CAST_AI(npc_barnes::npc_barnesAI,pCreature->AI()))
|
||||
{
|
||||
if (!pBarnesAI->RaidWiped)
|
||||
pPlayer->SEND_GOSSIP_MENU(8970, pCreature->GetGUID());
|
||||
else
|
||||
pPlayer->SEND_GOSSIP_MENU(8975, pCreature->GetGUID());
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pPlayer->SEND_GOSSIP_MENU(8978, pCreature->GetGUID());
|
||||
return true;
|
||||
}
|
||||
|
||||
CreatureAI* GetAI(Creature* pCreature) const
|
||||
{
|
||||
return new npc_barnesAI(pCreature);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
CreatureAI* GetAI_npc_barnesAI(Creature* pCreature)
|
||||
{
|
||||
return new npc_barnesAI(pCreature);
|
||||
}
|
||||
|
||||
bool GossipHello_npc_barnes(Player* pPlayer, Creature* pCreature)
|
||||
{
|
||||
if (ScriptedInstance* pInstance = pCreature->GetInstanceData())
|
||||
{
|
||||
// Check for death of Moroes and if opera event is not done already
|
||||
if (pInstance->GetData(TYPE_MOROES) == DONE && pInstance->GetData(TYPE_OPERA) != DONE)
|
||||
{
|
||||
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, OZ_GOSSIP1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
|
||||
|
||||
if (pPlayer->isGameMaster())
|
||||
{
|
||||
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, OZ_GM_GOSSIP1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3);
|
||||
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, OZ_GM_GOSSIP2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4);
|
||||
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, OZ_GM_GOSSIP3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5);
|
||||
}
|
||||
|
||||
if (npc_barnesAI* pBarnesAI = CAST_AI(npc_barnesAI,pCreature->AI()))
|
||||
{
|
||||
if (!pBarnesAI->RaidWiped)
|
||||
pPlayer->SEND_GOSSIP_MENU(8970, pCreature->GetGUID());
|
||||
else
|
||||
pPlayer->SEND_GOSSIP_MENU(8975, pCreature->GetGUID());
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pPlayer->SEND_GOSSIP_MENU(8978, pCreature->GetGUID());
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GossipSelect_npc_barnes(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction)
|
||||
{
|
||||
npc_barnesAI* pBarnesAI = CAST_AI(npc_barnesAI, pCreature->AI());
|
||||
|
||||
switch(uiAction)
|
||||
{
|
||||
case GOSSIP_ACTION_INFO_DEF+1:
|
||||
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, OZ_GOSSIP2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2);
|
||||
pPlayer->SEND_GOSSIP_MENU(8971, pCreature->GetGUID());
|
||||
break;
|
||||
case GOSSIP_ACTION_INFO_DEF+2:
|
||||
pPlayer->CLOSE_GOSSIP_MENU();
|
||||
pBarnesAI->StartEvent();
|
||||
break;
|
||||
case GOSSIP_ACTION_INFO_DEF+3:
|
||||
pPlayer->CLOSE_GOSSIP_MENU();
|
||||
pBarnesAI->m_uiEventId = EVENT_OZ;
|
||||
sLog.outString("TSCR: player (GUID %i) manually set Opera event to EVENT_OZ",pPlayer->GetGUID());
|
||||
break;
|
||||
case GOSSIP_ACTION_INFO_DEF+4:
|
||||
pPlayer->CLOSE_GOSSIP_MENU();
|
||||
pBarnesAI->m_uiEventId = EVENT_HOOD;
|
||||
sLog.outString("TSCR: player (GUID %i) manually set Opera event to EVENT_HOOD",pPlayer->GetGUID());
|
||||
break;
|
||||
case GOSSIP_ACTION_INFO_DEF+5:
|
||||
pPlayer->CLOSE_GOSSIP_MENU();
|
||||
pBarnesAI->m_uiEventId = EVENT_RAJ;
|
||||
sLog.outString("TSCR: player (GUID %i) manually set Opera event to EVENT_RAJ",pPlayer->GetGUID());
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*###
|
||||
# npc_berthold
|
||||
@@ -400,28 +408,35 @@ enum eBerthold
|
||||
};
|
||||
|
||||
#define GOSSIP_ITEM_TELEPORT "Teleport me to the Guardian's Library"
|
||||
|
||||
bool GossipHello_npc_berthold(Player* pPlayer, Creature* pCreature)
|
||||
␍class npc_berthold : public CreatureScript
|
||||
{
|
||||
if (ScriptedInstance* pInstance = pCreature->GetInstanceData())
|
||||
public:
|
||||
npc_berthold() : CreatureScript("npc_berthold") { }
|
||||
|
||||
bool OnGossipSelect(Player* pPlayer, Creature* /*pCreature*/, uint32 /*uiSender*/, uint32 uiAction)
|
||||
{
|
||||
// Check if Shade of Aran event is done
|
||||
if (pInstance->GetData(TYPE_ARAN) == DONE)
|
||||
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_TELEPORT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
|
||||
if (uiAction == GOSSIP_ACTION_INFO_DEF + 1)
|
||||
pPlayer->CastSpell(pPlayer, SPELL_TELEPORT, true);
|
||||
|
||||
pPlayer->CLOSE_GOSSIP_MENU();
|
||||
return true;
|
||||
}
|
||||
|
||||
pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID());
|
||||
return true;
|
||||
}
|
||||
bool OnGossipHello(Player* pPlayer, Creature* pCreature)
|
||||
{
|
||||
if (InstanceScript* pInstance = pCreature->GetInstanceScript())
|
||||
{
|
||||
// Check if Shade of Aran event is done
|
||||
if (pInstance->GetData(TYPE_ARAN) == DONE)
|
||||
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_TELEPORT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
|
||||
}
|
||||
|
||||
bool GossipSelect_npc_berthold(Player* pPlayer, Creature* /*pCreature*/, uint32 /*uiSender*/, uint32 uiAction)
|
||||
{
|
||||
if (uiAction == GOSSIP_ACTION_INFO_DEF + 1)
|
||||
pPlayer->CastSpell(pPlayer, SPELL_TELEPORT, true);
|
||||
pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID());
|
||||
return true;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
pPlayer->CLOSE_GOSSIP_MENU();
|
||||
return true;
|
||||
}
|
||||
|
||||
/*###
|
||||
# npc_image_of_medivh
|
||||
@@ -445,204 +460,194 @@ bool GossipSelect_npc_berthold(Player* pPlayer, Creature* /*pCreature*/, uint32
|
||||
|
||||
static float MedivPos[4] = {-11161.49,-1902.24,91.48,1.94};
|
||||
static float ArcanagosPos[4] = {-11169.75,-1881.48,95.39,4.83};
|
||||
|
||||
struct npc_image_of_medivhAI : public ScriptedAI
|
||||
␍class npc_image_of_medivh : public CreatureScript
|
||||
{
|
||||
npc_image_of_medivhAI(Creature* c) : ScriptedAI(c)
|
||||
public:
|
||||
npc_image_of_medivh() : CreatureScript("npc_image_of_medivh") { }
|
||||
|
||||
CreatureAI* GetAI(Creature* pCreature) const
|
||||
{
|
||||
pInstance = c->GetInstanceData();
|
||||
return new npc_image_of_medivhAI(pCreature);
|
||||
}
|
||||
|
||||
ScriptedInstance *pInstance;
|
||||
|
||||
uint64 ArcanagosGUID;
|
||||
|
||||
uint32 YellTimer;
|
||||
uint32 Step;
|
||||
uint32 FireMedivhTimer;
|
||||
uint32 FireArcanagosTimer;
|
||||
|
||||
bool EventStarted;
|
||||
|
||||
void Reset()
|
||||
struct npc_image_of_medivhAI : public ScriptedAI
|
||||
{
|
||||
ArcanagosGUID = 0;
|
||||
|
||||
if (pInstance && pInstance->GetData64(DATA_IMAGE_OF_MEDIVH) == 0)
|
||||
npc_image_of_medivhAI(Creature* c) : ScriptedAI(c)
|
||||
{
|
||||
pInstance->SetData64(DATA_IMAGE_OF_MEDIVH, me->GetGUID());
|
||||
(*me).GetMotionMaster()->MovePoint(1,MedivPos[0],MedivPos[1],MedivPos[2]);
|
||||
Step = 0;
|
||||
}else
|
||||
{
|
||||
me->DealDamage(me,me->GetHealth(),NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
|
||||
me->RemoveCorpse();
|
||||
pInstance = c->GetInstanceScript();
|
||||
}
|
||||
}
|
||||
void EnterCombat(Unit* /*who*/) {}
|
||||
|
||||
void MovementInform(uint32 type, uint32 id)
|
||||
{
|
||||
if (type != POINT_MOTION_TYPE)
|
||||
return;
|
||||
if (id == 1)
|
||||
InstanceScript *pInstance;
|
||||
|
||||
uint64 ArcanagosGUID;
|
||||
|
||||
uint32 YellTimer;
|
||||
uint32 Step;
|
||||
uint32 FireMedivhTimer;
|
||||
uint32 FireArcanagosTimer;
|
||||
|
||||
bool EventStarted;
|
||||
|
||||
void Reset()
|
||||
{
|
||||
StartEvent();
|
||||
me->SetOrientation(MedivPos[3]);
|
||||
me->SetOrientation(MedivPos[3]);
|
||||
}
|
||||
}
|
||||
ArcanagosGUID = 0;
|
||||
|
||||
void StartEvent()
|
||||
{
|
||||
Step = 1;
|
||||
EventStarted = true;
|
||||
Creature* Arcanagos = me->SummonCreature(MOB_ARCANAGOS,ArcanagosPos[0],ArcanagosPos[1],ArcanagosPos[2],0,TEMPSUMMON_CORPSE_TIMED_DESPAWN,20000);
|
||||
if (!Arcanagos)
|
||||
return;
|
||||
ArcanagosGUID = Arcanagos->GetGUID();
|
||||
Arcanagos->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING);
|
||||
(*Arcanagos).GetMotionMaster()->MovePoint(0,ArcanagosPos[0],ArcanagosPos[1],ArcanagosPos[2]);
|
||||
Arcanagos->SetOrientation(ArcanagosPos[3]);
|
||||
me->SetOrientation(MedivPos[3]);
|
||||
YellTimer = 10000;
|
||||
}
|
||||
|
||||
uint32 NextStep(uint32 Step)
|
||||
{
|
||||
Unit* arca = Unit::GetUnit((*me),ArcanagosGUID);
|
||||
Map* pMap = me->GetMap();
|
||||
switch(Step)
|
||||
{
|
||||
case 0: return 9999999;
|
||||
case 1:
|
||||
me->MonsterYell(SAY_DIALOG_MEDIVH_1,LANG_UNIVERSAL,NULL);
|
||||
return 10000;
|
||||
case 2:
|
||||
if (arca)
|
||||
CAST_CRE(arca)->MonsterYell(SAY_DIALOG_ARCANAGOS_2,LANG_UNIVERSAL,NULL);
|
||||
return 20000;
|
||||
case 3:
|
||||
me->MonsterYell(SAY_DIALOG_MEDIVH_3,LANG_UNIVERSAL,NULL);
|
||||
return 10000;
|
||||
case 4:
|
||||
if (arca)
|
||||
CAST_CRE(arca)->MonsterYell(SAY_DIALOG_ARCANAGOS_4, LANG_UNIVERSAL, NULL);
|
||||
return 20000;
|
||||
case 5:
|
||||
me->MonsterYell(SAY_DIALOG_MEDIVH_5, LANG_UNIVERSAL, NULL);
|
||||
return 20000;
|
||||
case 6:
|
||||
if (arca)
|
||||
CAST_CRE(arca)->MonsterYell(SAY_DIALOG_ARCANAGOS_6, LANG_UNIVERSAL, NULL);
|
||||
return 10000;
|
||||
case 7:
|
||||
FireArcanagosTimer = 500;
|
||||
return 5000;
|
||||
case 8:
|
||||
FireMedivhTimer = 500;
|
||||
DoCast(me, SPELL_MANA_SHIELD);
|
||||
return 10000;
|
||||
case 9:
|
||||
me->MonsterTextEmote(EMOTE_DIALOG_MEDIVH_7, 0, false);
|
||||
return 10000;
|
||||
case 10:
|
||||
if (arca)
|
||||
DoCast(arca, SPELL_CONFLAGRATION_BLAST, false);
|
||||
return 1000;
|
||||
case 11:
|
||||
if (arca)
|
||||
CAST_CRE(arca)->MonsterYell(SAY_DIALOG_ARCANAGOS_8, LANG_UNIVERSAL, NULL);
|
||||
return 5000;
|
||||
case 12:
|
||||
arca->GetMotionMaster()->MovePoint(0, -11010.82,-1761.18, 156.47);
|
||||
arca->setActive(true);
|
||||
arca->InterruptNonMeleeSpells(true);
|
||||
arca->SetSpeed(MOVE_FLIGHT, 2.0f);
|
||||
return 10000;
|
||||
case 13:
|
||||
me->MonsterYell(SAY_DIALOG_MEDIVH_9, LANG_UNIVERSAL, NULL);
|
||||
return 10000;
|
||||
case 14:
|
||||
me->SetVisibility(VISIBILITY_OFF);
|
||||
me->ClearInCombat();
|
||||
|
||||
if (pMap->IsDungeon())
|
||||
if (pInstance && pInstance->GetData64(DATA_IMAGE_OF_MEDIVH) == 0)
|
||||
{
|
||||
InstanceMap::PlayerList const &PlayerList = pMap->GetPlayers();
|
||||
for (InstanceMap::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
|
||||
{
|
||||
if (i->getSource()->isAlive())
|
||||
{
|
||||
if (i->getSource()->GetQuestStatus(9645) == QUEST_STATUS_INCOMPLETE)
|
||||
i->getSource()->CompleteQuest(9645);
|
||||
}
|
||||
}
|
||||
pInstance->SetData64(DATA_IMAGE_OF_MEDIVH, me->GetGUID());
|
||||
(*me).GetMotionMaster()->MovePoint(1,MedivPos[0],MedivPos[1],MedivPos[2]);
|
||||
Step = 0;
|
||||
}else
|
||||
{
|
||||
me->DealDamage(me,me->GetHealth(),NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
|
||||
me->RemoveCorpse();
|
||||
}
|
||||
}
|
||||
void EnterCombat(Unit* /*who*/) {}
|
||||
|
||||
void MovementInform(uint32 type, uint32 id)
|
||||
{
|
||||
if (type != POINT_MOTION_TYPE)
|
||||
return;
|
||||
if (id == 1)
|
||||
{
|
||||
StartEvent();
|
||||
me->SetOrientation(MedivPos[3]);
|
||||
me->SetOrientation(MedivPos[3]);
|
||||
}
|
||||
return 50000;
|
||||
case 15:
|
||||
arca->DealDamage(arca,arca->GetHealth(),NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
|
||||
return 5000;
|
||||
default : return 9999999;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void UpdateAI(const uint32 diff)
|
||||
{
|
||||
|
||||
if (YellTimer <= diff)
|
||||
void StartEvent()
|
||||
{
|
||||
if (EventStarted)
|
||||
YellTimer = NextStep(Step++);
|
||||
} else YellTimer -= diff;
|
||||
Step = 1;
|
||||
EventStarted = true;
|
||||
Creature* Arcanagos = me->SummonCreature(MOB_ARCANAGOS,ArcanagosPos[0],ArcanagosPos[1],ArcanagosPos[2],0,TEMPSUMMON_CORPSE_TIMED_DESPAWN,20000);
|
||||
if (!Arcanagos)
|
||||
return;
|
||||
ArcanagosGUID = Arcanagos->GetGUID();
|
||||
Arcanagos->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING);
|
||||
(*Arcanagos).GetMotionMaster()->MovePoint(0,ArcanagosPos[0],ArcanagosPos[1],ArcanagosPos[2]);
|
||||
Arcanagos->SetOrientation(ArcanagosPos[3]);
|
||||
me->SetOrientation(MedivPos[3]);
|
||||
YellTimer = 10000;
|
||||
}
|
||||
|
||||
if (Step >= 7 && Step <= 12)
|
||||
uint32 NextStep(uint32 Step)
|
||||
{
|
||||
Unit* arca = Unit::GetUnit((*me),ArcanagosGUID);
|
||||
|
||||
if (FireArcanagosTimer <= diff)
|
||||
Map* pMap = me->GetMap();
|
||||
switch(Step)
|
||||
{
|
||||
case 0: return 9999999;
|
||||
case 1:
|
||||
me->MonsterYell(SAY_DIALOG_MEDIVH_1,LANG_UNIVERSAL,NULL);
|
||||
return 10000;
|
||||
case 2:
|
||||
if (arca)
|
||||
arca->CastSpell(me, SPELL_FIRE_BALL, false);
|
||||
FireArcanagosTimer = 6000;
|
||||
} else FireArcanagosTimer -= diff;
|
||||
CAST_CRE(arca)->MonsterYell(SAY_DIALOG_ARCANAGOS_2,LANG_UNIVERSAL,NULL);
|
||||
return 20000;
|
||||
case 3:
|
||||
me->MonsterYell(SAY_DIALOG_MEDIVH_3,LANG_UNIVERSAL,NULL);
|
||||
return 10000;
|
||||
case 4:
|
||||
if (arca)
|
||||
CAST_CRE(arca)->MonsterYell(SAY_DIALOG_ARCANAGOS_4, LANG_UNIVERSAL, NULL);
|
||||
return 20000;
|
||||
case 5:
|
||||
me->MonsterYell(SAY_DIALOG_MEDIVH_5, LANG_UNIVERSAL, NULL);
|
||||
return 20000;
|
||||
case 6:
|
||||
if (arca)
|
||||
CAST_CRE(arca)->MonsterYell(SAY_DIALOG_ARCANAGOS_6, LANG_UNIVERSAL, NULL);
|
||||
return 10000;
|
||||
case 7:
|
||||
FireArcanagosTimer = 500;
|
||||
return 5000;
|
||||
case 8:
|
||||
FireMedivhTimer = 500;
|
||||
DoCast(me, SPELL_MANA_SHIELD);
|
||||
return 10000;
|
||||
case 9:
|
||||
me->MonsterTextEmote(EMOTE_DIALOG_MEDIVH_7, 0, false);
|
||||
return 10000;
|
||||
case 10:
|
||||
if (arca)
|
||||
DoCast(arca, SPELL_CONFLAGRATION_BLAST, false);
|
||||
return 1000;
|
||||
case 11:
|
||||
if (arca)
|
||||
CAST_CRE(arca)->MonsterYell(SAY_DIALOG_ARCANAGOS_8, LANG_UNIVERSAL, NULL);
|
||||
return 5000;
|
||||
case 12:
|
||||
arca->GetMotionMaster()->MovePoint(0, -11010.82,-1761.18, 156.47);
|
||||
arca->setActive(true);
|
||||
arca->InterruptNonMeleeSpells(true);
|
||||
arca->SetSpeed(MOVE_FLIGHT, 2.0f);
|
||||
return 10000;
|
||||
case 13:
|
||||
me->MonsterYell(SAY_DIALOG_MEDIVH_9, LANG_UNIVERSAL, NULL);
|
||||
return 10000;
|
||||
case 14:
|
||||
me->SetVisibility(VISIBILITY_OFF);
|
||||
me->ClearInCombat();
|
||||
|
||||
if (pMap->IsDungeon())
|
||||
{
|
||||
InstanceMap::PlayerList const &PlayerList = pMap->GetPlayers();
|
||||
for (InstanceMap::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
|
||||
{
|
||||
if (i->getSource()->isAlive())
|
||||
{
|
||||
if (i->getSource()->GetQuestStatus(9645) == QUEST_STATUS_INCOMPLETE)
|
||||
i->getSource()->CompleteQuest(9645);
|
||||
}
|
||||
}
|
||||
}
|
||||
return 50000;
|
||||
case 15:
|
||||
arca->DealDamage(arca,arca->GetHealth(),NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
|
||||
return 5000;
|
||||
default : return 9999999;
|
||||
}
|
||||
|
||||
if (FireMedivhTimer <= diff)
|
||||
{
|
||||
if (arca)
|
||||
DoCast(arca, SPELL_FIRE_BALL);
|
||||
FireMedivhTimer = 5000;
|
||||
} else FireMedivhTimer -= diff;
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateAI(const uint32 diff)
|
||||
{
|
||||
|
||||
if (YellTimer <= diff)
|
||||
{
|
||||
if (EventStarted)
|
||||
YellTimer = NextStep(Step++);
|
||||
} else YellTimer -= diff;
|
||||
|
||||
if (Step >= 7 && Step <= 12)
|
||||
{
|
||||
Unit* arca = Unit::GetUnit((*me),ArcanagosGUID);
|
||||
|
||||
if (FireArcanagosTimer <= diff)
|
||||
{
|
||||
if (arca)
|
||||
arca->CastSpell(me, SPELL_FIRE_BALL, false);
|
||||
FireArcanagosTimer = 6000;
|
||||
} else FireArcanagosTimer -= diff;
|
||||
|
||||
if (FireMedivhTimer <= diff)
|
||||
{
|
||||
if (arca)
|
||||
DoCast(arca, SPELL_FIRE_BALL);
|
||||
FireMedivhTimer = 5000;
|
||||
} else FireMedivhTimer -= diff;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
CreatureAI* GetAI_npc_image_of_medivh(Creature* pCreature)
|
||||
{
|
||||
return new npc_image_of_medivhAI(pCreature);
|
||||
}
|
||||
|
||||
void AddSC_karazhan()
|
||||
{
|
||||
Script* newscript;
|
||||
|
||||
newscript = new Script;
|
||||
newscript->GetAI = &GetAI_npc_barnesAI;
|
||||
newscript->Name = "npc_barnes";
|
||||
newscript->pGossipHello = &GossipHello_npc_barnes;
|
||||
newscript->pGossipSelect = &GossipSelect_npc_barnes;
|
||||
newscript->RegisterSelf();
|
||||
|
||||
newscript = new Script;
|
||||
newscript->Name = "npc_berthold";
|
||||
newscript->pGossipHello = &GossipHello_npc_berthold;
|
||||
newscript->pGossipSelect = &GossipSelect_npc_berthold;
|
||||
newscript->RegisterSelf();
|
||||
|
||||
newscript = new Script;
|
||||
newscript->Name = "npc_image_of_medivh";
|
||||
newscript->GetAI = &GetAI_npc_image_of_medivh;
|
||||
newscript->RegisterSelf();
|
||||
new npc_barnes();
|
||||
new npc_berthold();
|
||||
new npc_image_of_medivh();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user