Core/Misc: Some refactoring
Port From (https://github.com/TrinityCore/TrinityCore/commit/94a79bac7a06aa0f931e9d651928de7eea0a8b5c)
This commit is contained in:
@@ -29,29 +29,58 @@ namespace Game.Maps
|
||||
public SpawnGroupFlags flags;
|
||||
}
|
||||
|
||||
public class SpawnData
|
||||
public class SpawnData : SpawnMetadata
|
||||
{
|
||||
public SpawnObjectType type;
|
||||
public ulong spawnId;
|
||||
public uint Id; // entry in respective _template table
|
||||
public WorldLocation spawnPoint;
|
||||
public PhaseUseFlagsValues phaseUseFlags;
|
||||
public uint phaseId;
|
||||
public uint phaseGroup;
|
||||
public Position SpawnPoint;
|
||||
public PhaseUseFlagsValues PhaseUseFlags;
|
||||
public uint PhaseId;
|
||||
public uint PhaseGroup;
|
||||
public int terrainSwapMap;
|
||||
public int spawntimesecs;
|
||||
public List<Difficulty> spawnDifficulties;
|
||||
public SpawnGroupTemplateData spawnGroupData;
|
||||
public uint ScriptId;
|
||||
public bool dbData;
|
||||
|
||||
public SpawnData(SpawnObjectType t)
|
||||
public SpawnData(SpawnObjectType t) : base(t)
|
||||
{
|
||||
type = t;
|
||||
spawnPoint = new WorldLocation();
|
||||
SpawnPoint = new Position();
|
||||
terrainSwapMap = -1;
|
||||
spawnDifficulties = new List<Difficulty>();
|
||||
dbData = true;
|
||||
}
|
||||
|
||||
public static SpawnObjectType TypeFor<T>()
|
||||
{
|
||||
switch (typeof(T).Name)
|
||||
{
|
||||
case nameof(Creature):
|
||||
return SpawnObjectType.Creature;
|
||||
case nameof(GameObject):
|
||||
return SpawnObjectType.GameObject;
|
||||
case nameof(AreaTrigger):
|
||||
return SpawnObjectType.AreaTrigger;
|
||||
default:
|
||||
return SpawnObjectType.NumSpawnTypes;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class SpawnMetadata
|
||||
{
|
||||
public SpawnObjectType type;
|
||||
public ulong SpawnId;
|
||||
public uint MapId = 0xFFFFFFFF;
|
||||
public bool dbData = true;
|
||||
public SpawnGroupTemplateData spawnGroupData = null;
|
||||
|
||||
public static bool TypeInMask(SpawnObjectType type, SpawnObjectTypeMask mask) { return ((1 << (int)type) & (int)mask) != 0; }
|
||||
public static bool TypeHasData(SpawnObjectType type) { return type < SpawnObjectType.NumSpawnTypesWithData; }
|
||||
public static bool TypeIsValid(SpawnObjectType type) { return type < SpawnObjectType.NumSpawnTypes; }
|
||||
|
||||
public SpawnMetadata(SpawnObjectType t)
|
||||
{
|
||||
type = t;
|
||||
}
|
||||
|
||||
public SpawnData ToSpawnData() { return TypeHasData(type) ? (SpawnData)this : null; }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user