Core/InstanceScript: Refactored door types to reflect its behavior
Port From (https://github.com/TrinityCore/TrinityCore/commit/0e2f04172864e3cff2b5559ac89ded23ade5f92e)
This commit is contained in:
@@ -151,11 +151,12 @@ namespace Framework.Constants
|
|||||||
ToBeDecided = 5
|
ToBeDecided = 5
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum DoorType
|
public enum EncounterDoorBehavior
|
||||||
{
|
{
|
||||||
Room = 0, // Door can open if encounter is not in progress
|
OpenWhenNotInProgress = 0, // open if encounter is not in progress
|
||||||
Passage = 1, // Door can open if encounter is done
|
OpenWhenDone = 1, // open if encounter is done
|
||||||
SpawnHole = 2, // Door can open if encounter is in progress, typically used for spawning places
|
OpenWhenInProgress = 2, // open if encounter is in progress, typically used for spawning places
|
||||||
|
OpenWhenNotDone = 3, // open if encounter is not done
|
||||||
Max
|
Max
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ namespace Game.Maps
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (door.bossId < bosses.Count)
|
if (door.bossId < bosses.Count)
|
||||||
doors.Add(door.entry, new DoorInfo(bosses[door.bossId], door.type));
|
doors.Add(door.entry, new DoorInfo(bosses[door.bossId], door.Behavior));
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.outDebug(LogFilter.Scripts, "InstanceScript.LoadDoorData: {0} doors loaded.", doors.Count);
|
Log.outDebug(LogFilter.Scripts, "InstanceScript.LoadDoorData: {0} doors loaded.", doors.Count);
|
||||||
@@ -154,16 +154,19 @@ namespace Game.Maps
|
|||||||
if (!open)
|
if (!open)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
switch (info.type)
|
switch (info.Behavior)
|
||||||
{
|
{
|
||||||
case DoorType.Room:
|
case EncounterDoorBehavior.OpenWhenNotInProgress:
|
||||||
open = (info.bossInfo.state != EncounterState.InProgress);
|
open = info.bossInfo.state != EncounterState.InProgress;
|
||||||
break;
|
break;
|
||||||
case DoorType.Passage:
|
case EncounterDoorBehavior.OpenWhenDone:
|
||||||
open = (info.bossInfo.state == EncounterState.Done);
|
open = info.bossInfo.state == EncounterState.Done;
|
||||||
break;
|
break;
|
||||||
case DoorType.SpawnHole:
|
case EncounterDoorBehavior.OpenWhenInProgress:
|
||||||
open = (info.bossInfo.state == EncounterState.InProgress);
|
open = info.bossInfo.state == EncounterState.InProgress;
|
||||||
|
break;
|
||||||
|
case EncounterDoorBehavior.OpenWhenNotDone:
|
||||||
|
open = info.bossInfo.state != EncounterState.Done;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@@ -277,9 +280,9 @@ namespace Game.Maps
|
|||||||
foreach (var data in range)
|
foreach (var data in range)
|
||||||
{
|
{
|
||||||
if (add)
|
if (add)
|
||||||
data.bossInfo.door[(int)data.type].Add(door.GetGUID());
|
data.bossInfo.door[(int)data.Behavior].Add(door.GetGUID());
|
||||||
else
|
else
|
||||||
data.bossInfo.door[(int)data.type].Remove(door.GetGUID());
|
data.bossInfo.door[(int)data.Behavior].Remove(door.GetGUID());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (add)
|
if (add)
|
||||||
@@ -400,11 +403,11 @@ namespace Game.Maps
|
|||||||
instance.UpdateInstanceLock(new UpdateBossStateSaveDataEvent(dungeonEncounter, id, state));
|
instance.UpdateInstanceLock(new UpdateBossStateSaveDataEvent(dungeonEncounter, id, state));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (uint type = 0; type < (int)DoorType.Max; ++type)
|
foreach (var doorSet in bossInfo.door)
|
||||||
{
|
{
|
||||||
foreach (var guid in bossInfo.door[type])
|
foreach (ObjectGuid doorGUID in doorSet)
|
||||||
{
|
{
|
||||||
GameObject door = instance.GetGameObject(guid);
|
GameObject door = instance.GetGameObject(doorGUID);
|
||||||
if (door != null)
|
if (door != null)
|
||||||
UpdateDoorState(door);
|
UpdateDoorState(door);
|
||||||
}
|
}
|
||||||
@@ -705,7 +708,7 @@ namespace Game.Maps
|
|||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual bool CheckAchievementCriteriaMeet(uint criteria_id, Player source, Unit target = null, uint miscvalue1 = 0)
|
public virtual bool CheckAchievementCriteriaMeet(uint criteria_id, Player source, Unit target = null, uint miscvalue1 = 0)
|
||||||
{
|
{
|
||||||
Log.outError(LogFilter.Server, "Achievement system call CheckAchievementCriteriaMeet but instance script for map {0} not have implementation for achievement criteria {1}",
|
Log.outError(LogFilter.Server, "Achievement system call CheckAchievementCriteriaMeet but instance script for map {0} not have implementation for achievement criteria {1}",
|
||||||
@@ -732,7 +735,7 @@ namespace Game.Maps
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetEntranceLocation(uint worldSafeLocationId)
|
public void SetEntranceLocation(uint worldSafeLocationId)
|
||||||
{
|
{
|
||||||
_entranceId = worldSafeLocationId;
|
_entranceId = worldSafeLocationId;
|
||||||
@@ -971,16 +974,16 @@ namespace Game.Maps
|
|||||||
|
|
||||||
public class DoorData
|
public class DoorData
|
||||||
{
|
{
|
||||||
public DoorData(uint _entry, uint _bossid, DoorType _type)
|
public DoorData(uint _entry, uint _bossid, EncounterDoorBehavior behavior)
|
||||||
{
|
{
|
||||||
entry = _entry;
|
entry = _entry;
|
||||||
bossId = _bossid;
|
bossId = _bossid;
|
||||||
type = _type;
|
Behavior = behavior;
|
||||||
}
|
}
|
||||||
|
|
||||||
public uint entry;
|
public uint entry;
|
||||||
public uint bossId;
|
public uint bossId;
|
||||||
public DoorType type;
|
public EncounterDoorBehavior Behavior;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class BossBoundaryEntry
|
public class BossBoundaryEntry
|
||||||
@@ -1022,7 +1025,7 @@ namespace Game.Maps
|
|||||||
public class BossInfo
|
public class BossInfo
|
||||||
{
|
{
|
||||||
public EncounterState state;
|
public EncounterState state;
|
||||||
public List<ObjectGuid>[] door = new List<ObjectGuid>[(int)DoorType.Max];
|
public List<ObjectGuid>[] door = new List<ObjectGuid>[(int)EncounterDoorBehavior.Max];
|
||||||
public List<ObjectGuid> minion = new();
|
public List<ObjectGuid> minion = new();
|
||||||
public List<AreaBoundary> boundary = new();
|
public List<AreaBoundary> boundary = new();
|
||||||
public DungeonEncounterRecord[] DungeonEncounters = new DungeonEncounterRecord[MapConst.MaxDungeonEncountersPerBoss];
|
public DungeonEncounterRecord[] DungeonEncounters = new DungeonEncounterRecord[MapConst.MaxDungeonEncountersPerBoss];
|
||||||
@@ -1030,7 +1033,7 @@ namespace Game.Maps
|
|||||||
public BossInfo()
|
public BossInfo()
|
||||||
{
|
{
|
||||||
state = EncounterState.ToBeDecided;
|
state = EncounterState.ToBeDecided;
|
||||||
for (var i = 0; i < (int)DoorType.Max; ++i)
|
for (var i = 0; i < (int)EncounterDoorBehavior.Max; ++i)
|
||||||
door[i] = new List<ObjectGuid>();
|
door[i] = new List<ObjectGuid>();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1041,14 +1044,14 @@ namespace Game.Maps
|
|||||||
}
|
}
|
||||||
class DoorInfo
|
class DoorInfo
|
||||||
{
|
{
|
||||||
public DoorInfo(BossInfo _bossInfo, DoorType _type)
|
public DoorInfo(BossInfo _bossInfo, EncounterDoorBehavior behavior)
|
||||||
{
|
{
|
||||||
bossInfo = _bossInfo;
|
bossInfo = _bossInfo;
|
||||||
type = _type;
|
Behavior = behavior;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BossInfo bossInfo;
|
public BossInfo bossInfo;
|
||||||
public DoorType type;
|
public EncounterDoorBehavior Behavior;
|
||||||
}
|
}
|
||||||
class MinionInfo
|
class MinionInfo
|
||||||
{
|
{
|
||||||
@@ -1097,7 +1100,7 @@ namespace Game.Maps
|
|||||||
_instance = instance;
|
_instance = instance;
|
||||||
_name = name;
|
_name = name;
|
||||||
_value = value;
|
_value = value;
|
||||||
|
|
||||||
_instance.RegisterPersistentScriptValue(this);
|
_instance.RegisterPersistentScriptValue(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
using Game.Entities;
|
using Game.Entities;
|
||||||
using Game.Maps;
|
using Game.Maps;
|
||||||
using Game.Scripting;
|
using Game.Scripting;
|
||||||
|
using Framework.Constants;
|
||||||
|
|
||||||
namespace Scripts.Argus.AntorusTheBurningThrone
|
namespace Scripts.Argus.AntorusTheBurningThrone
|
||||||
{
|
{
|
||||||
@@ -57,8 +58,8 @@ namespace Scripts.Argus.AntorusTheBurningThrone
|
|||||||
|
|
||||||
public static DoorData[] doorData =
|
public static DoorData[] doorData =
|
||||||
{
|
{
|
||||||
new(GameObjectIds.Collision, DataTypes.GarothiWorldbreaker, Framework.Constants.DoorType.Passage),
|
new(GameObjectIds.Collision, DataTypes.GarothiWorldbreaker, EncounterDoorBehavior.OpenWhenDone),
|
||||||
new(GameObjectIds.Rock, DataTypes.GarothiWorldbreaker, Framework.Constants.DoorType.Passage)
|
new(GameObjectIds.Rock, DataTypes.GarothiWorldbreaker, EncounterDoorBehavior.OpenWhenDone)
|
||||||
};
|
};
|
||||||
|
|
||||||
public static DungeonEncounterData[] encounters =
|
public static DungeonEncounterData[] encounters =
|
||||||
|
|||||||
+1
-1
@@ -87,7 +87,7 @@ namespace Scripts.DragonIsles.AberrusTheShadowedCrucible
|
|||||||
|
|
||||||
static DoorData[] doorData =
|
static DoorData[] doorData =
|
||||||
{
|
{
|
||||||
new (GameObjectIds.KazzaraDoor, DataTypes.KazzaraTheHellforged, DoorType.Room)
|
new (GameObjectIds.KazzaraDoor, DataTypes.KazzaraTheHellforged, EncounterDoorBehavior.OpenWhenNotInProgress)
|
||||||
};
|
};
|
||||||
|
|
||||||
static ObjectData[] objData =
|
static ObjectData[] objData =
|
||||||
|
|||||||
@@ -55,8 +55,8 @@ namespace Scripts.DragonIsles.AzureVault
|
|||||||
|
|
||||||
static DoorData[] doorData =
|
static DoorData[] doorData =
|
||||||
{
|
{
|
||||||
new(GameObjectIds.ArcaneVaultsDoorLeymorEntrance, DataTypes.Leymor, DoorType.Room),
|
new(GameObjectIds.ArcaneVaultsDoorLeymorEntrance, DataTypes.Leymor, EncounterDoorBehavior.OpenWhenNotInProgress),
|
||||||
new(GameObjectIds.ArcaneVaultsDoorLeymorExit, DataTypes.Leymor, DoorType.Passage),
|
new(GameObjectIds.ArcaneVaultsDoorLeymorExit, DataTypes.Leymor, EncounterDoorBehavior.OpenWhenDone),
|
||||||
};
|
};
|
||||||
|
|
||||||
static DungeonEncounterData[] encounters =
|
static DungeonEncounterData[] encounters =
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ namespace Scripts.DragonIsles.RubyLifePools
|
|||||||
|
|
||||||
static DoorData[] doorData =
|
static DoorData[] doorData =
|
||||||
{
|
{
|
||||||
new(GameObjectIds.FireWall, DataTypes.KokiaBlazehoof, DoorType.Passage)
|
new(GameObjectIds.FireWall, DataTypes.KokiaBlazehoof, EncounterDoorBehavior.OpenWhenDone)
|
||||||
};
|
};
|
||||||
|
|
||||||
static DungeonEncounterData[] encounters =
|
static DungeonEncounterData[] encounters =
|
||||||
|
|||||||
@@ -41,9 +41,9 @@ namespace Scripts.EasternKingdoms.BaradinHold
|
|||||||
{
|
{
|
||||||
static DoorData[] doorData =
|
static DoorData[] doorData =
|
||||||
{
|
{
|
||||||
new DoorData(GameObjectIds.ArgalothDoor, DataTypes.Argaloth, DoorType.Room),
|
new DoorData(GameObjectIds.ArgalothDoor, DataTypes.Argaloth, EncounterDoorBehavior.OpenWhenNotInProgress),
|
||||||
new DoorData(GameObjectIds.OccutharDoor, DataTypes.Occuthar, DoorType.Room),
|
new DoorData(GameObjectIds.OccutharDoor, DataTypes.Occuthar, EncounterDoorBehavior.OpenWhenNotInProgress),
|
||||||
new DoorData(GameObjectIds.AlizabalDoor, DataTypes.Alizabal, DoorType.Room),
|
new DoorData(GameObjectIds.AlizabalDoor, DataTypes.Alizabal, EncounterDoorBehavior.OpenWhenNotInProgress),
|
||||||
};
|
};
|
||||||
|
|
||||||
static DungeonEncounterData[] encounters =
|
static DungeonEncounterData[] encounters =
|
||||||
|
|||||||
+6
-6
@@ -116,12 +116,12 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackrockSpire
|
|||||||
|
|
||||||
public static DoorData[] doorData =
|
public static DoorData[] doorData =
|
||||||
{
|
{
|
||||||
new DoorData(GameObjectsIds.Doors, DataTypes.PyrogaurdEmberseer, DoorType.Passage),
|
new DoorData(GameObjectsIds.Doors, DataTypes.PyrogaurdEmberseer, EncounterDoorBehavior.OpenWhenNotInProgress),
|
||||||
new DoorData(GameObjectsIds.EmberseerOut, DataTypes.PyrogaurdEmberseer, DoorType.Passage),
|
new DoorData(GameObjectsIds.EmberseerOut, DataTypes.PyrogaurdEmberseer, EncounterDoorBehavior.OpenWhenDone),
|
||||||
new DoorData(GameObjectsIds.DrakkisathDoor1, DataTypes.GeneralDrakkisath, DoorType.Passage),
|
new DoorData(GameObjectsIds.DrakkisathDoor1, DataTypes.GeneralDrakkisath, EncounterDoorBehavior.OpenWhenDone),
|
||||||
new DoorData(GameObjectsIds.DrakkisathDoor2, DataTypes.GeneralDrakkisath, DoorType.Passage),
|
new DoorData(GameObjectsIds.DrakkisathDoor2, DataTypes.GeneralDrakkisath, EncounterDoorBehavior.OpenWhenDone),
|
||||||
new DoorData(GameObjectsIds.PortcullisActive, DataTypes.WarchiefRendBlackhand, DoorType.Passage),
|
new DoorData(GameObjectsIds.PortcullisActive, DataTypes.WarchiefRendBlackhand, EncounterDoorBehavior.OpenWhenDone),
|
||||||
new DoorData(GameObjectsIds.PortcullisTobossrooms, DataTypes.WarchiefRendBlackhand, DoorType.Passage),
|
new DoorData(GameObjectsIds.PortcullisTobossrooms, DataTypes.WarchiefRendBlackhand, EncounterDoorBehavior.OpenWhenDone),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+8
-8
@@ -78,14 +78,14 @@ namespace Scripts.EasternKingdoms.BlackrockMountain.BlackwingLair
|
|||||||
|
|
||||||
public static DoorData[] doorData =
|
public static DoorData[] doorData =
|
||||||
{
|
{
|
||||||
new DoorData(BWLGameObjectIds.PortcullisRazorgore, DataTypes.RazorgoreTheUntamed, DoorType.Passage),
|
new DoorData(BWLGameObjectIds.PortcullisRazorgore, DataTypes.RazorgoreTheUntamed, EncounterDoorBehavior.OpenWhenDone),
|
||||||
new DoorData(BWLGameObjectIds.PortcullisVaelastrasz, DataTypes.VaelastrazTheCorrupt, DoorType.Passage),
|
new DoorData(BWLGameObjectIds.PortcullisVaelastrasz, DataTypes.VaelastrazTheCorrupt, EncounterDoorBehavior.OpenWhenDone),
|
||||||
new DoorData(BWLGameObjectIds.PortcullisBroodlord, DataTypes.BroodlordLashlayer, DoorType.Passage),
|
new DoorData(BWLGameObjectIds.PortcullisBroodlord, DataTypes.BroodlordLashlayer, EncounterDoorBehavior.OpenWhenDone),
|
||||||
new DoorData(BWLGameObjectIds.PortcullisThreedragons, DataTypes.Firemaw, DoorType.Passage),
|
new DoorData(BWLGameObjectIds.PortcullisThreedragons, DataTypes.Firemaw, EncounterDoorBehavior.OpenWhenDone),
|
||||||
new DoorData(BWLGameObjectIds.PortcullisThreedragons, DataTypes.Ebonroc, DoorType.Passage),
|
new DoorData(BWLGameObjectIds.PortcullisThreedragons, DataTypes.Ebonroc, EncounterDoorBehavior.OpenWhenDone),
|
||||||
new DoorData(BWLGameObjectIds.PortcullisThreedragons, DataTypes.Flamegor, DoorType.Passage),
|
new DoorData(BWLGameObjectIds.PortcullisThreedragons, DataTypes.Flamegor, EncounterDoorBehavior.OpenWhenDone),
|
||||||
new DoorData(BWLGameObjectIds.PortcullisChromaggus, DataTypes.Chromaggus, DoorType.Passage),
|
new DoorData(BWLGameObjectIds.PortcullisChromaggus, DataTypes.Chromaggus, EncounterDoorBehavior.OpenWhenDone),
|
||||||
new DoorData(BWLGameObjectIds.PortcullisNefarian, DataTypes.Nefarian, DoorType.Room),
|
new DoorData(BWLGameObjectIds.PortcullisNefarian, DataTypes.Nefarian, EncounterDoorBehavior.OpenWhenNotInProgress),
|
||||||
};
|
};
|
||||||
|
|
||||||
public static ObjectData[] creatureData =
|
public static ObjectData[] creatureData =
|
||||||
|
|||||||
@@ -91,11 +91,11 @@ namespace Scripts.EasternKingdoms.MagistersTerrace
|
|||||||
|
|
||||||
public static DoorData[] doorData =
|
public static DoorData[] doorData =
|
||||||
{
|
{
|
||||||
new DoorData(GameObjectIds.SunwellRaidGate2, DataTypes.SelinFireheart, DoorType.Passage),
|
new DoorData(GameObjectIds.SunwellRaidGate2, DataTypes.SelinFireheart, EncounterDoorBehavior.OpenWhenDone),
|
||||||
new DoorData(GameObjectIds.AssemblyChamberDoor, DataTypes.SelinFireheart, DoorType.Room),
|
new DoorData(GameObjectIds.AssemblyChamberDoor, DataTypes.SelinFireheart, EncounterDoorBehavior.OpenWhenNotInProgress),
|
||||||
new DoorData(GameObjectIds.SunwellRaidGate5, DataTypes.Vexallus, DoorType.Passage),
|
new DoorData(GameObjectIds.SunwellRaidGate5, DataTypes.Vexallus, EncounterDoorBehavior.OpenWhenDone),
|
||||||
new DoorData(GameObjectIds.SunwellRaidGate4, DataTypes.PriestessDelrissa, DoorType.Passage),
|
new DoorData(GameObjectIds.SunwellRaidGate4, DataTypes.PriestessDelrissa, EncounterDoorBehavior.OpenWhenDone),
|
||||||
new DoorData(GameObjectIds.AsylumDoor, DataTypes.KaelthasSunstrider, DoorType.Room),
|
new DoorData(GameObjectIds.AsylumDoor, DataTypes.KaelthasSunstrider, EncounterDoorBehavior.OpenWhenNotInProgress),
|
||||||
};
|
};
|
||||||
|
|
||||||
public static Position KalecgosSpawnPos = new Position(164.3747f, -397.1197f, 2.151798f, 1.66219f);
|
public static Position KalecgosSpawnPos = new Position(164.3747f, -397.1197f, 2.151798f, 1.66219f);
|
||||||
|
|||||||
Reference in New Issue
Block a user