Violet Hold: Instance mechanics fixes, by PivoNRoll
Closes issue #2733 Implements door hiting by trash, trash waypoints and more --HG-- branch : trunk
This commit is contained in:
@@ -34,12 +34,12 @@ enum GameObjects
|
||||
|
||||
const Position PortalLocation[] =
|
||||
{
|
||||
{1936.07, 803.198, 53.3749, 3.12414},
|
||||
{1877.51, 850.104, 44.6599, 4.7822 },
|
||||
{1890.64, 753.471, 48.7224, 1.71042},
|
||||
{1908.31, 809.657, 38.7037, 3.08701},
|
||||
{1918.37, 853.437, 47.1624, 4.12294},
|
||||
{1927.61, 758.436, 51.4533, 2.20891}
|
||||
{1877.51, 850.104, 44.6599, 4.7822 }, // WP 1
|
||||
{1918.37, 853.437, 47.1624, 4.12294}, // WP 2
|
||||
{1936.07, 803.198, 53.3749, 3.12414}, // WP 3
|
||||
{1927.61, 758.436, 51.4533, 2.20891}, // WP 4
|
||||
{1890.64, 753.471, 48.7224, 1.71042}, // WP 5
|
||||
{1908.31, 809.657, 38.7037, 3.08701} // WP 6
|
||||
};
|
||||
|
||||
struct instance_violet_hold : public ScriptedInstance
|
||||
@@ -65,6 +65,7 @@ struct instance_violet_hold : public ScriptedInstance
|
||||
uint64 uiXevozzCell;
|
||||
uint64 uiZuramatCell;
|
||||
uint64 uiMainDoor;
|
||||
uint64 uiTeleportationPortal;
|
||||
|
||||
uint64 uiActivationCrystal[3];
|
||||
|
||||
@@ -75,6 +76,10 @@ 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;
|
||||
@@ -82,6 +87,9 @@ struct instance_violet_hold : public ScriptedInstance
|
||||
|
||||
bool bActive;
|
||||
bool bWiped;
|
||||
bool bIsDoorSpellCasted;
|
||||
|
||||
std::list<uint8> NpcAtDoorCastingList;
|
||||
|
||||
std::string str_data;
|
||||
|
||||
@@ -105,8 +113,13 @@ struct instance_violet_hold : public ScriptedInstance
|
||||
uiXevozzCell = 0;
|
||||
uiZuramatCell = 0;
|
||||
uiMainDoor = 0;
|
||||
uiTeleportationPortal = 0;
|
||||
|
||||
uiRemoveNpc = 0;
|
||||
|
||||
uiMainDoorState = GO_STATE_ACTIVE;
|
||||
uiDoorIntegrity = 100;
|
||||
|
||||
uiWaveCount = 0;
|
||||
uiLocation = urand(0,5);
|
||||
uiFirstBoss = 0;
|
||||
@@ -115,9 +128,10 @@ struct instance_violet_hold : public ScriptedInstance
|
||||
uiCountActivationCrystals = 0;
|
||||
|
||||
uiActivationTimer = 5000;
|
||||
uiDoorSpellTimer = 2000;
|
||||
|
||||
bActive = false;
|
||||
bWiped = false;
|
||||
bIsDoorSpellCasted = false;
|
||||
|
||||
memset(&m_auiEncounter, 0, sizeof(m_auiEncounter));
|
||||
}
|
||||
@@ -242,6 +256,38 @@ struct instance_violet_hold : public ScriptedInstance
|
||||
case DATA_REMOVE_NPC:
|
||||
uiRemoveNpc = data;
|
||||
break;
|
||||
case DATA_PORTAL_LOCATION:
|
||||
uiLocation = (uint8)data;
|
||||
break;
|
||||
case DATA_DOOR_INTEGRITY:
|
||||
uiDoorIntegrity = data;
|
||||
DoUpdateWorldState(WORLD_STATE_VH_PRISON_STATE, uiDoorIntegrity);
|
||||
break;
|
||||
case DATA_NPC_PRESENCE_AT_DOOR_ADD:
|
||||
NpcAtDoorCastingList.push_back(data);
|
||||
break;
|
||||
case DATA_NPC_PRESENCE_AT_DOOR_REMOVE:
|
||||
if(!NpcAtDoorCastingList.empty())
|
||||
NpcAtDoorCastingList.pop_back();
|
||||
break;
|
||||
case DATA_MAIN_DOOR:
|
||||
if(GameObject* pMainDoor = instance->GetGameObject(uiMainDoor))
|
||||
{
|
||||
switch(data)
|
||||
{
|
||||
case GO_STATE_ACTIVE:
|
||||
pMainDoor->SetGoState(GO_STATE_ACTIVE);
|
||||
break;
|
||||
case GO_STATE_READY:
|
||||
pMainDoor->SetGoState(GO_STATE_READY);
|
||||
break;
|
||||
case GO_STATE_ACTIVE_ALTERNATIVE:
|
||||
pMainDoor->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
uiMainDoorState = data;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -254,6 +300,39 @@ struct instance_violet_hold : public ScriptedInstance
|
||||
case DATA_CYANIGOSA_EVENT: return m_auiEncounter[2];
|
||||
case DATA_WAVE_COUNT: return uiWaveCount;
|
||||
case DATA_REMOVE_NPC: return uiRemoveNpc;
|
||||
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;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint64 GetData64(uint32 identifier)
|
||||
{
|
||||
switch(identifier)
|
||||
{
|
||||
case DATA_MORAGG: return uiMoragg;
|
||||
case DATA_EREKEM: return uiErekem;
|
||||
case DATA_EREKEM_GUARD_1: return uiErekemGuard[0];
|
||||
case DATA_EREKEM_GUARD_2: return uiErekemGuard[1];
|
||||
case DATA_ICHORON: return uiIchoron;
|
||||
case DATA_LAVANTHOR: return uiLavanthor;
|
||||
case DATA_XEVOZZ: return uiXevozz;
|
||||
case DATA_ZURAMAT: return uiZuramat;
|
||||
case DATA_CYANIGOSA: return uiCyanigosa;
|
||||
case DATA_MORAGG_CELL: return uiMoraggCell;
|
||||
case DATA_EREKEM_CELL: return uiErekemCell;
|
||||
case DATA_EREKEM_RIGHT_GUARD_CELL: return uiErekemRightGuardCell;
|
||||
case DATA_EREKEM_LEFT_GUARD_CELL: return uiErekemLeftGuardCell;
|
||||
case DATA_ICHORON_CELL: return uiIchoronCell;
|
||||
case DATA_LAVANTHOR_CELL: return uiLavanthorCell;
|
||||
case DATA_XEVOZZ_CELL: return uiXevozzCell;
|
||||
case DATA_ZURAMAT_CELL: return uiZuramatCell;
|
||||
case DATA_MAIN_DOOR: return uiMainDoor;
|
||||
case DATA_SINCLARI: return uiSinclari;
|
||||
case DATA_TELEPORTATION_PORTAL: return uiTeleportationPortal;
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -261,9 +340,10 @@ struct instance_violet_hold : public ScriptedInstance
|
||||
|
||||
void SpawnPortal()
|
||||
{
|
||||
SetData(DATA_PORTAL_LOCATION, (GetData(DATA_PORTAL_LOCATION) + urand(1,5))%6);
|
||||
if (Creature *pSinclari = instance->GetCreature(uiSinclari))
|
||||
if (Creature *pPortal = pSinclari->SummonCreature(CREATURE_TELEPORTATION_PORTAL,PortalLocation[uiLocation],TEMPSUMMON_CORPSE_DESPAWN))
|
||||
uiLocation = (uiLocation+urand(1,5))%6;
|
||||
if(Creature *portal = pSinclari->SummonCreature(CREATURE_TELEPORTATION_PORTAL,PortalLocation[GetData(DATA_PORTAL_LOCATION)],TEMPSUMMON_CORPSE_DESPAWN))
|
||||
uiTeleportationPortal = portal->GetGUID();
|
||||
}
|
||||
|
||||
void StartBossEncounter(uint8 uiBoss, bool bForceRespawn = true)
|
||||
@@ -275,8 +355,6 @@ struct instance_violet_hold : public ScriptedInstance
|
||||
case BOSS_MORAGG:
|
||||
HandleGameObject(uiMoraggCell,bForceRespawn);
|
||||
pBoss = instance->GetCreature(uiMoragg);
|
||||
if (pBoss)
|
||||
pBoss->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_NON_ATTACKABLE);
|
||||
break;
|
||||
case BOSS_EREKEM:
|
||||
HandleGameObject(uiErekemCell, bForceRespawn);
|
||||
@@ -284,8 +362,6 @@ struct instance_violet_hold : public ScriptedInstance
|
||||
HandleGameObject(uiErekemLeftGuardCell, bForceRespawn);
|
||||
|
||||
pBoss = instance->GetCreature(uiErekem);
|
||||
if (pBoss)
|
||||
pBoss->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_NON_ATTACKABLE);
|
||||
|
||||
if (Creature* pGuard1 = instance->GetCreature(uiErekemGuard[0]))
|
||||
{
|
||||
@@ -306,40 +382,38 @@ struct instance_violet_hold : public ScriptedInstance
|
||||
case BOSS_ICHORON:
|
||||
HandleGameObject(uiIchoronCell,bForceRespawn);
|
||||
pBoss = instance->GetCreature(uiIchoron);
|
||||
if (pBoss)
|
||||
pBoss->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_NON_ATTACKABLE);
|
||||
break;
|
||||
case BOSS_LAVANTHOR:
|
||||
HandleGameObject(uiLavanthorCell,bForceRespawn);
|
||||
pBoss = instance->GetCreature(uiLavanthor);
|
||||
if (pBoss)
|
||||
pBoss->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_NON_ATTACKABLE);
|
||||
break;
|
||||
case BOSS_XEVOZZ:
|
||||
HandleGameObject(uiXevozzCell,bForceRespawn);
|
||||
pBoss = instance->GetCreature(uiXevozz);
|
||||
if (pBoss)
|
||||
pBoss->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_NON_ATTACKABLE);
|
||||
break;
|
||||
case BOSS_ZURAMAT:
|
||||
HandleGameObject(uiZuramatCell,bForceRespawn);
|
||||
pBoss = instance->GetCreature(uiZuramat);
|
||||
if (pBoss)
|
||||
pBoss->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_NON_ATTACKABLE);
|
||||
break;
|
||||
}
|
||||
|
||||
if (!bForceRespawn && pBoss)
|
||||
// generic boss state changes
|
||||
if (pBoss)
|
||||
{
|
||||
if (pBoss->isDead())
|
||||
pBoss->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_NON_ATTACKABLE);
|
||||
pBoss->SetReactState(REACT_AGGRESSIVE);
|
||||
|
||||
if (!bForceRespawn)
|
||||
{
|
||||
// respawn but avoid to be looted again
|
||||
pBoss->Respawn();
|
||||
pBoss->RemoveLootMode(1);
|
||||
if (pBoss->isDead())
|
||||
{
|
||||
// respawn but avoid to be looted again
|
||||
pBoss->Respawn();
|
||||
pBoss->RemoveLootMode(1);
|
||||
}
|
||||
pBoss->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_NON_ATTACKABLE);
|
||||
uiWaveCount = 0;
|
||||
}
|
||||
pBoss->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_NON_ATTACKABLE);
|
||||
SetData(DATA_WAVE_COUNT,0);
|
||||
uiWaveCount = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -347,7 +421,6 @@ struct instance_violet_hold : public ScriptedInstance
|
||||
{
|
||||
DoUpdateWorldState(WORLD_STATE_VH, 1);
|
||||
DoUpdateWorldState(WORLD_STATE_VH_WAVE_COUNT, uiWaveCount);
|
||||
DoUpdateWorldState(WORLD_STATE_VH_PRISON_STATE, 100); // TODO
|
||||
|
||||
switch(uiWaveCount)
|
||||
{
|
||||
@@ -375,43 +448,14 @@ struct instance_violet_hold : public ScriptedInstance
|
||||
{
|
||||
if (GameObject* pMainDoor = instance->GetGameObject(uiMainDoor))
|
||||
pMainDoor->SetGoState(GO_STATE_READY);
|
||||
DoUpdateWorldState(WORLD_STATE_VH_PRISON_STATE, 100);
|
||||
}
|
||||
default:
|
||||
if (!bWiped)
|
||||
SpawnPortal();
|
||||
bWiped = false;
|
||||
SpawnPortal();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
uint64 GetData64(uint32 identifier)
|
||||
{
|
||||
switch(identifier)
|
||||
{
|
||||
case DATA_MORAGG: return uiMoragg;
|
||||
case DATA_EREKEM: return uiErekem;
|
||||
case DATA_EREKEM_GUARD_1: return uiErekemGuard[0];
|
||||
case DATA_EREKEM_GUARD_2: return uiErekemGuard[1];
|
||||
case DATA_ICHORON: return uiIchoron;
|
||||
case DATA_LAVANTHOR: return uiLavanthor;
|
||||
case DATA_XEVOZZ: return uiXevozz;
|
||||
case DATA_ZURAMAT: return uiZuramat;
|
||||
case DATA_CYANIGOSA: return uiCyanigosa;
|
||||
case DATA_MORAGG_CELL: return uiMoraggCell;
|
||||
case DATA_EREKEM_CELL: return uiErekemCell;
|
||||
case DATA_EREKEM_RIGHT_GUARD_CELL: return uiErekemRightGuardCell;
|
||||
case DATA_EREKEM_LEFT_GUARD_CELL: return uiErekemLeftGuardCell;
|
||||
case DATA_ICHORON_CELL: return uiIchoronCell;
|
||||
case DATA_LAVANTHOR_CELL: return uiLavanthorCell;
|
||||
case DATA_XEVOZZ_CELL: return uiXevozzCell;
|
||||
case DATA_ZURAMAT_CELL: return uiZuramatCell;
|
||||
case DATA_MAIN_DOOR: return uiMainDoor;
|
||||
case DATA_SINCLARI: return uiSinclari;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::string GetSaveData()
|
||||
{
|
||||
OUT_SAVE_INST_DATA;
|
||||
@@ -483,7 +527,8 @@ struct instance_violet_hold : public ScriptedInstance
|
||||
if (!instance->HavePlayers())
|
||||
return;
|
||||
|
||||
if (bActive)
|
||||
// portals should spawn if other portal is dead and doors are closed
|
||||
if (bActive && GetData(DATA_MAIN_DOOR) == GO_STATE_READY)
|
||||
{
|
||||
if (uiActivationTimer < diff)
|
||||
{
|
||||
@@ -493,23 +538,55 @@ struct instance_violet_hold : public ScriptedInstance
|
||||
} else uiActivationTimer -= diff;
|
||||
}
|
||||
|
||||
if (GameObject* pMainDoor = instance->GetGameObject(uiMainDoor))
|
||||
if (pMainDoor->GetGoState() != GO_STATE_ACTIVE && CheckWipe())
|
||||
{
|
||||
SetData(DATA_REMOVE_NPC, 1);
|
||||
StartBossEncounter(uiFirstBoss, false);
|
||||
StartBossEncounter(uiSecondBoss, false);
|
||||
bWiped = true;
|
||||
if (Creature* pSinclari = instance->GetCreature(uiSinclari))
|
||||
{
|
||||
pSinclari->DisappearAndDie();
|
||||
pSinclari->Respawn(true);
|
||||
}
|
||||
// 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())
|
||||
{
|
||||
SetData(DATA_REMOVE_NPC, 1);
|
||||
StartBossEncounter(uiFirstBoss, false);
|
||||
StartBossEncounter(uiSecondBoss, false);
|
||||
|
||||
if (GameObject* pMainDoor = instance->GetGameObject(uiMainDoor))
|
||||
pMainDoor->SetGoState(GO_STATE_ACTIVE);
|
||||
SetData(DATA_WAVE_COUNT, 0);
|
||||
SetData(DATA_MAIN_DOOR,GO_STATE_ACTIVE);
|
||||
SetData(DATA_WAVE_COUNT, 0);
|
||||
|
||||
if (Creature* pSinclari = instance->GetCreature(uiSinclari))
|
||||
{
|
||||
pSinclari->SetVisibility(VISIBILITY_ON);
|
||||
|
||||
std::list<Creature*> GuardList;
|
||||
pSinclari->GetCreatureListWithEntryInGrid(GuardList, NPC_VIOLET_HOLD_GUARD, 40.0f);
|
||||
if (!GuardList.empty())
|
||||
{
|
||||
for (std::list<Creature*>::const_iterator itr = GuardList.begin(); itr != GuardList.end(); ++itr)
|
||||
{
|
||||
if (Creature* pGuard = *itr)
|
||||
{
|
||||
pGuard->SetVisibility(VISIBILITY_ON);
|
||||
pGuard->SetReactState(REACT_AGGRESSIVE);
|
||||
pGuard->GetMotionMaster()->MovePoint(1,pGuard->GetHomePosition());
|
||||
}
|
||||
}
|
||||
}
|
||||
pSinclari->GetMotionMaster()->MovePoint(1,pSinclari->GetHomePosition());
|
||||
pSinclari->RemoveFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NOT_SELECTABLE);
|
||||
}
|
||||
}
|
||||
|
||||
// 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 door integrity is > 0 then decrase it's integrity state
|
||||
if(GetData(DATA_DOOR_INTEGRITY))
|
||||
{
|
||||
if(uiDoorSpellTimer < diff)
|
||||
{
|
||||
SetData(DATA_DOOR_INTEGRITY,GetData(DATA_DOOR_INTEGRITY)-1);
|
||||
uiDoorSpellTimer =2000;
|
||||
} else uiDoorSpellTimer -= diff;
|
||||
}
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -14,7 +14,8 @@ enum Creatures
|
||||
CREATURE_EREKEM_GUARD = 29395,
|
||||
CREATURE_MORAGG = 29316,
|
||||
CREATURE_CYANIGOSA = 31134,
|
||||
CREATURE_SINCLARI = 30658
|
||||
CREATURE_SINCLARI = 30658,
|
||||
NPC_VIOLET_HOLD_GUARD = 30659
|
||||
};
|
||||
|
||||
enum Data
|
||||
@@ -23,7 +24,12 @@ enum Data
|
||||
DATA_2ND_BOSS_EVENT,
|
||||
DATA_CYANIGOSA_EVENT,
|
||||
DATA_WAVE_COUNT,
|
||||
DATA_REMOVE_NPC
|
||||
DATA_REMOVE_NPC,
|
||||
DATA_PORTAL_LOCATION,
|
||||
DATA_DOOR_INTEGRITY,
|
||||
DATA_NPC_PRESENCE_AT_DOOR,
|
||||
DATA_NPC_PRESENCE_AT_DOOR_ADD,
|
||||
DATA_NPC_PRESENCE_AT_DOOR_REMOVE
|
||||
};
|
||||
|
||||
enum Data64
|
||||
@@ -46,7 +52,8 @@ enum Data64
|
||||
DATA_XEVOZZ_CELL,
|
||||
DATA_ZURAMAT_CELL,
|
||||
DATA_MAIN_DOOR,
|
||||
DATA_SINCLARI
|
||||
DATA_SINCLARI,
|
||||
DATA_TELEPORTATION_PORTAL
|
||||
};
|
||||
|
||||
enum Bosses
|
||||
|
||||
Reference in New Issue
Block a user