mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-25 03:12:09 +01:00
Violet Hold: Restructuration: Add an EventPhase var instead of using door's
status to handle main event. Needed for next commits and cleansing --HG-- branch : trunk
This commit is contained in:
@@ -134,6 +134,7 @@ struct instance_violet_hold : public ScriptedInstance
|
||||
|
||||
uint32 uiActivationTimer;
|
||||
uint32 uiCyanigosaEventTimer;
|
||||
uint32 uiDoorSpellTimer;
|
||||
|
||||
std::set<uint64> trashMobs; // to kill with crystal
|
||||
|
||||
@@ -142,15 +143,14 @@ struct instance_violet_hold : public ScriptedInstance
|
||||
uint8 uiFirstBoss;
|
||||
uint8 uiSecondBoss;
|
||||
uint8 uiRemoveNpc;
|
||||
uint32 uiDoorSpellTimer;
|
||||
|
||||
uint8 uiMainDoorState;
|
||||
|
||||
uint8 uiDoorIntegrity;
|
||||
|
||||
uint8 m_auiEncounter[MAX_ENCOUNTER];
|
||||
uint8 uiCountErekemGuards;
|
||||
uint8 uiCountActivationCrystals;
|
||||
uint8 uiCyanigosaEventPhase;
|
||||
uint8 uiMainEventPhase; // SPECIAL: pre event animations, IN_PROGRESS: event itself
|
||||
|
||||
bool bActive;
|
||||
bool bWiped;
|
||||
@@ -188,7 +188,6 @@ struct instance_violet_hold : public ScriptedInstance
|
||||
|
||||
uiRemoveNpc = 0;
|
||||
|
||||
uiMainDoorState = GO_STATE_ACTIVE;
|
||||
uiDoorIntegrity = 100;
|
||||
|
||||
uiWaveCount = 0;
|
||||
@@ -320,6 +319,7 @@ struct instance_violet_hold : public ScriptedInstance
|
||||
if (data == DONE)
|
||||
{
|
||||
SaveToDB();
|
||||
uiMainEventPhase = DONE;
|
||||
if (GameObject* pMainDoor = instance->GetGameObject(uiMainDoor))
|
||||
pMainDoor->SetGoState(GO_STATE_ACTIVE);
|
||||
if (!bCrystalActivated && uiDoorIntegrity == 100)
|
||||
@@ -348,7 +348,7 @@ struct instance_violet_hold : public ScriptedInstance
|
||||
NpcAtDoorCastingList.pop_back();
|
||||
break;
|
||||
case DATA_MAIN_DOOR:
|
||||
if(GameObject* pMainDoor = instance->GetGameObject(uiMainDoor))
|
||||
if (GameObject* pMainDoor = instance->GetGameObject(uiMainDoor))
|
||||
{
|
||||
switch(data)
|
||||
{
|
||||
@@ -363,7 +363,6 @@ struct instance_violet_hold : public ScriptedInstance
|
||||
break;
|
||||
}
|
||||
}
|
||||
uiMainDoorState = data;
|
||||
break;
|
||||
case DATA_START_BOSS_ENCOUNTER:
|
||||
switch(uiWaveCount)
|
||||
@@ -379,6 +378,17 @@ struct instance_violet_hold : public ScriptedInstance
|
||||
case DATA_ACTIVATE_CRYSTAL:
|
||||
ActivateCrystal();
|
||||
break;
|
||||
case DATA_MAIN_EVENT_PHASE:
|
||||
uiMainEventPhase = data;
|
||||
if (data == IN_PROGRESS) // Start event
|
||||
{
|
||||
if (GameObject* pMainDoor = instance->GetGameObject(uiMainDoor))
|
||||
pMainDoor->SetGoState(GO_STATE_READY);
|
||||
uiWaveCount = 1;
|
||||
bActive = true;
|
||||
uiRemoveNpc = 0; // might not have been reset after a wipe on a boss.
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -407,9 +417,9 @@ struct instance_violet_hold : public ScriptedInstance
|
||||
case DATA_PORTAL_LOCATION: return uiLocation;
|
||||
case DATA_DOOR_INTEGRITY: return uiDoorIntegrity;
|
||||
case DATA_NPC_PRESENCE_AT_DOOR: return NpcAtDoorCastingList.size();
|
||||
case DATA_MAIN_DOOR: return uiMainDoorState;
|
||||
case DATA_FIRST_BOSS: return uiFirstBoss;
|
||||
case DATA_SECOND_BOSS: return uiSecondBoss;
|
||||
case DATA_MAIN_EVENT_PHASE: return uiMainEventPhase;
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -662,7 +672,7 @@ struct instance_violet_hold : public ScriptedInstance
|
||||
return;
|
||||
|
||||
// portals should spawn if other portal is dead and doors are closed
|
||||
if (bActive && GetData(DATA_MAIN_DOOR) == GO_STATE_READY)
|
||||
if (bActive && uiMainEventPhase == IN_PROGRESS)
|
||||
{
|
||||
if (uiActivationTimer < diff)
|
||||
{
|
||||
@@ -672,8 +682,8 @@ struct instance_violet_hold : public ScriptedInstance
|
||||
} else uiActivationTimer -= diff;
|
||||
}
|
||||
|
||||
// if doors are closed (means event is in progres) and players have wiped then reset instance
|
||||
if (GetData(DATA_MAIN_DOOR) != GO_STATE_ACTIVE && CheckWipe())
|
||||
// if main event is in progress and players have wiped then reset instance
|
||||
if ( uiMainEventPhase == IN_PROGRESS && CheckWipe())
|
||||
{
|
||||
SetData(DATA_REMOVE_NPC, 1);
|
||||
StartBossEncounter(uiFirstBoss, false);
|
||||
@@ -681,6 +691,7 @@ struct instance_violet_hold : public ScriptedInstance
|
||||
|
||||
SetData(DATA_MAIN_DOOR,GO_STATE_ACTIVE);
|
||||
SetData(DATA_WAVE_COUNT, 0);
|
||||
uiMainEventPhase = NOT_STARTED;
|
||||
|
||||
if (Creature* pSinclari = instance->GetCreature(uiSinclari))
|
||||
{
|
||||
@@ -741,7 +752,7 @@ struct instance_violet_hold : public ScriptedInstance
|
||||
}
|
||||
|
||||
// if there are NPCs in front of the prison door, which are casting the door seal spell and doors are active
|
||||
if(GetData(DATA_NPC_PRESENCE_AT_DOOR) && (GetData(DATA_MAIN_DOOR) == GO_STATE_READY))
|
||||
if (GetData(DATA_NPC_PRESENCE_AT_DOOR) && uiMainEventPhase == IN_PROGRESS)
|
||||
{
|
||||
// if door integrity is > 0 then decrase it's integrity state
|
||||
if(GetData(DATA_DOOR_INTEGRITY))
|
||||
@@ -754,7 +765,10 @@ struct instance_violet_hold : public ScriptedInstance
|
||||
}
|
||||
// else set door state to active (means door will open and group have failed to sustain mob invasion on the door)
|
||||
else
|
||||
{
|
||||
SetData(DATA_MAIN_DOOR,GO_STATE_ACTIVE);
|
||||
uiMainEventPhase = FAIL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -340,11 +340,7 @@ struct npc_sinclariAI : public ScriptedAI
|
||||
break;
|
||||
case 5:
|
||||
if (pInstance)
|
||||
{
|
||||
pInstance->SetData(DATA_MAIN_DOOR,GO_STATE_READY);
|
||||
pInstance->SetData(DATA_WAVE_COUNT,1);
|
||||
pInstance->SetData(DATA_REMOVE_NPC,0); // might not have been reset after a wipe on a boss.
|
||||
}
|
||||
pInstance->SetData(DATA_MAIN_EVENT_PHASE,IN_PROGRESS);
|
||||
me->SetVisibility(VISIBILITY_OFF);
|
||||
me->SetReactState(REACT_PASSIVE);
|
||||
uiTimer = 0;
|
||||
@@ -420,7 +416,7 @@ struct mob_azure_saboteurAI : public npc_escortAI
|
||||
|
||||
void UpdateAI(const uint32 diff)
|
||||
{
|
||||
if(pInstance->GetData(DATA_MAIN_DOOR) != GO_STATE_READY)
|
||||
if (pInstance && pInstance->GetData(DATA_MAIN_EVENT_PHASE != IN_PROGRESS))
|
||||
me->CastStop();
|
||||
|
||||
npc_escortAI::UpdateAI(diff);
|
||||
@@ -483,14 +479,17 @@ CreatureAI* GetAI_mob_azure_saboteur(Creature* pCreature)
|
||||
|
||||
bool GossipHello_npc_sinclari(Player* pPlayer, Creature* pCreature)
|
||||
{
|
||||
ScriptedInstance* pInstance = pCreature->GetInstanceData();
|
||||
if (pInstance && pInstance->GetData(DATA_CYANIGOSA_EVENT) != DONE && pInstance->GetData(DATA_WAVE_COUNT) == 0 && pPlayer)
|
||||
if (ScriptedInstance* pInstance = pCreature->GetInstanceData())
|
||||
{
|
||||
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT,GOSSIP_ITEM_1,GOSSIP_SENDER_MAIN,GOSSIP_ACTION_INFO_DEF+2);
|
||||
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT,GOSSIP_START_EVENT,GOSSIP_SENDER_MAIN,GOSSIP_ACTION_INFO_DEF+1);
|
||||
pPlayer->SEND_GOSSIP_MENU(13853, pCreature->GetGUID());
|
||||
} else
|
||||
pPlayer->SEND_GOSSIP_MENU(13910, pCreature->GetGUID());
|
||||
uint8 uiInstancePhase = pInstance->GetData(DATA_MAIN_EVENT_PHASE);
|
||||
if (uiInstancePhase == NOT_STARTED || uiInstancePhase == FAIL) // Allow to start event if not started or wiped
|
||||
{
|
||||
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT,GOSSIP_ITEM_1,GOSSIP_SENDER_MAIN,GOSSIP_ACTION_INFO_DEF+2);
|
||||
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT,GOSSIP_START_EVENT,GOSSIP_SENDER_MAIN,GOSSIP_ACTION_INFO_DEF+1);
|
||||
pPlayer->SEND_GOSSIP_MENU(13853, pCreature->GetGUID());
|
||||
} else
|
||||
pPlayer->SEND_GOSSIP_MENU(13910, pCreature->GetGUID());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -502,6 +501,8 @@ bool GossipSelect_npc_sinclari(Player* pPlayer, Creature* pCreature, uint32 /*ui
|
||||
if (pPlayer)
|
||||
pPlayer->CLOSE_GOSSIP_MENU();
|
||||
CAST_AI(npc_sinclariAI, (pCreature->AI()))->uiPhase = 1;
|
||||
if (ScriptedInstance *pInstance = pCreature->GetInstanceData())
|
||||
pInstance->SetData(DATA_MAIN_EVENT_PHASE,SPECIAL);
|
||||
break;
|
||||
case GOSSIP_ACTION_INFO_DEF+2:
|
||||
pPlayer->SEND_GOSSIP_MENU(13854, pCreature->GetGUID());
|
||||
@@ -688,7 +689,7 @@ struct violet_hold_trashAI : public npc_escortAI
|
||||
|
||||
void UpdateAI(const uint32)
|
||||
{
|
||||
if (pInstance->GetData(DATA_MAIN_DOOR) != GO_STATE_READY)
|
||||
if (pInstance && pInstance->GetData(DATA_MAIN_EVENT_PHASE != IN_PROGRESS))
|
||||
me->CastStop();
|
||||
|
||||
if (!bHasGotMovingPoints)
|
||||
|
||||
@@ -52,7 +52,8 @@ enum Data
|
||||
DATA_START_BOSS_ENCOUNTER,
|
||||
DATA_FIRST_BOSS,
|
||||
DATA_SECOND_BOSS,
|
||||
DATA_ACTIVATE_CRYSTAL
|
||||
DATA_ACTIVATE_CRYSTAL,
|
||||
DATA_MAIN_EVENT_PHASE
|
||||
};
|
||||
|
||||
enum Data64
|
||||
|
||||
Reference in New Issue
Block a user