Core: SOme code cleanup, more to follow.
This commit is contained in:
+22
-22
@@ -168,11 +168,11 @@ namespace Game.Maps
|
||||
{
|
||||
for (uint y = area.low_bound.Y_coord; y <= area.high_bound.Y_coord; ++y)
|
||||
{
|
||||
CellCoord cellCoord = new CellCoord(x, y);
|
||||
CellCoord cellCoord = new(x, y);
|
||||
//lets skip standing cell since we already visited it
|
||||
if (cellCoord != standing_cell)
|
||||
{
|
||||
Cell r_zone = new Cell(cellCoord);
|
||||
Cell r_zone = new(cellCoord);
|
||||
r_zone.data.nocreate = data.nocreate;
|
||||
map.Visit(r_zone, visitor);
|
||||
}
|
||||
@@ -193,8 +193,8 @@ namespace Game.Maps
|
||||
{
|
||||
for (uint y = begin_cell.Y_coord; y <= end_cell.Y_coord; ++y)
|
||||
{
|
||||
CellCoord cellCoord = new CellCoord(x, y);
|
||||
Cell r_zone = new Cell(cellCoord);
|
||||
CellCoord cellCoord = new(x, y);
|
||||
Cell r_zone = new(cellCoord);
|
||||
r_zone.data.nocreate = data.nocreate;
|
||||
map.Visit(r_zone, visitor);
|
||||
}
|
||||
@@ -217,14 +217,14 @@ namespace Game.Maps
|
||||
{
|
||||
//we visit cells symmetrically from both sides, heading from center to sides and from up to bottom
|
||||
//e.g. filling 2 trapezoids after filling central cell strip...
|
||||
CellCoord cellCoord_left = new CellCoord(x_start - step, y);
|
||||
Cell r_zone_left = new Cell(cellCoord_left);
|
||||
CellCoord cellCoord_left = new(x_start - step, y);
|
||||
Cell r_zone_left = new(cellCoord_left);
|
||||
r_zone_left.data.nocreate = data.nocreate;
|
||||
map.Visit(r_zone_left, visitor);
|
||||
|
||||
//right trapezoid cell visit
|
||||
CellCoord cellCoord_right = new CellCoord(x_end + step, y);
|
||||
Cell r_zone_right = new Cell(cellCoord_right);
|
||||
CellCoord cellCoord_right = new(x_end + step, y);
|
||||
Cell r_zone_right = new(cellCoord_right);
|
||||
r_zone_right.data.nocreate = data.nocreate;
|
||||
map.Visit(r_zone_right, visitor);
|
||||
}
|
||||
@@ -234,70 +234,70 @@ namespace Game.Maps
|
||||
public static void VisitGridObjects(WorldObject center_obj, Notifier visitor, float radius, bool dont_load = true)
|
||||
{
|
||||
CellCoord p = GridDefines.ComputeCellCoord(center_obj.GetPositionX(), center_obj.GetPositionY());
|
||||
Cell cell = new Cell(p);
|
||||
Cell cell = new(p);
|
||||
if (dont_load)
|
||||
cell.SetNoCreate();
|
||||
|
||||
Visitor gnotifier = new Visitor(visitor, GridMapTypeMask.AllGrid);
|
||||
Visitor gnotifier = new(visitor, GridMapTypeMask.AllGrid);
|
||||
cell.Visit(p, gnotifier, center_obj.GetMap(), center_obj, radius);
|
||||
}
|
||||
|
||||
public static void VisitWorldObjects(WorldObject center_obj, Notifier visitor, float radius, bool dont_load = true)
|
||||
{
|
||||
CellCoord p = GridDefines.ComputeCellCoord(center_obj.GetPositionX(), center_obj.GetPositionY());
|
||||
Cell cell = new Cell(p);
|
||||
Cell cell = new(p);
|
||||
if (dont_load)
|
||||
cell.SetNoCreate();
|
||||
|
||||
Visitor gnotifier = new Visitor(visitor, GridMapTypeMask.AllWorld);
|
||||
Visitor gnotifier = new(visitor, GridMapTypeMask.AllWorld);
|
||||
cell.Visit(p, gnotifier, center_obj.GetMap(), center_obj, radius);
|
||||
}
|
||||
|
||||
public static void VisitAllObjects(WorldObject center_obj, Notifier visitor, float radius, bool dont_load = true)
|
||||
{
|
||||
CellCoord p = GridDefines.ComputeCellCoord(center_obj.GetPositionX(), center_obj.GetPositionY());
|
||||
Cell cell = new Cell(p);
|
||||
Cell cell = new(p);
|
||||
if (dont_load)
|
||||
cell.SetNoCreate();
|
||||
|
||||
Visitor wnotifier = new Visitor(visitor, GridMapTypeMask.AllWorld);
|
||||
Visitor wnotifier = new(visitor, GridMapTypeMask.AllWorld);
|
||||
cell.Visit(p, wnotifier, center_obj.GetMap(), center_obj, radius);
|
||||
Visitor gnotifier = new Visitor(visitor, GridMapTypeMask.AllGrid);
|
||||
Visitor gnotifier = new(visitor, GridMapTypeMask.AllGrid);
|
||||
cell.Visit(p, gnotifier, center_obj.GetMap(), center_obj, radius);
|
||||
}
|
||||
|
||||
public static void VisitGridObjects(float x, float y, Map map, Notifier visitor, float radius, bool dont_load = true)
|
||||
{
|
||||
CellCoord p = GridDefines.ComputeCellCoord(x, y);
|
||||
Cell cell = new Cell(p);
|
||||
Cell cell = new(p);
|
||||
if (dont_load)
|
||||
cell.SetNoCreate();
|
||||
|
||||
Visitor gnotifier = new Visitor(visitor, GridMapTypeMask.AllGrid);
|
||||
Visitor gnotifier = new(visitor, GridMapTypeMask.AllGrid);
|
||||
cell.Visit(p, gnotifier, map, x, y, radius);
|
||||
}
|
||||
|
||||
public static void VisitWorldObjects(float x, float y, Map map, Notifier visitor, float radius, bool dont_load = true)
|
||||
{
|
||||
CellCoord p = GridDefines.ComputeCellCoord(x, y);
|
||||
Cell cell = new Cell(p);
|
||||
Cell cell = new(p);
|
||||
if (dont_load)
|
||||
cell.SetNoCreate();
|
||||
|
||||
Visitor gnotifier = new Visitor(visitor, GridMapTypeMask.AllWorld);
|
||||
Visitor gnotifier = new(visitor, GridMapTypeMask.AllWorld);
|
||||
cell.Visit(p, gnotifier, map, x, y, radius);
|
||||
}
|
||||
|
||||
public static void VisitAllObjects(float x, float y, Map map, Notifier visitor, float radius, bool dont_load = true)
|
||||
{
|
||||
CellCoord p = GridDefines.ComputeCellCoord(x, y);
|
||||
Cell cell = new Cell(p);
|
||||
Cell cell = new(p);
|
||||
if (dont_load)
|
||||
cell.SetNoCreate();
|
||||
|
||||
Visitor wnotifier = new Visitor(visitor, GridMapTypeMask.AllWorld);
|
||||
Visitor wnotifier = new(visitor, GridMapTypeMask.AllWorld);
|
||||
cell.Visit(p, wnotifier, map, x, y, radius);
|
||||
Visitor gnotifier = new Visitor(visitor, GridMapTypeMask.AllGrid);
|
||||
Visitor gnotifier = new(visitor, GridMapTypeMask.AllGrid);
|
||||
cell.Visit(p, gnotifier, map, x, y, radius);
|
||||
}
|
||||
|
||||
|
||||
@@ -208,7 +208,7 @@ namespace Game.Maps
|
||||
{
|
||||
if (GetWorldObjectCountInNGrid<Player>() == 0 && !map.ActiveObjectsNearGrid(this))
|
||||
{
|
||||
ObjectGridStoper worker = new ObjectGridStoper();
|
||||
ObjectGridStoper worker = new();
|
||||
var visitor = new Visitor(worker, GridMapTypeMask.AllGrid);
|
||||
VisitAllGrids(visitor);
|
||||
SetGridState(GridState.Idle);
|
||||
@@ -442,14 +442,14 @@ namespace Game.Maps
|
||||
return 0;
|
||||
}
|
||||
|
||||
public List<Player> players = new List<Player>();
|
||||
public List<Creature> creatures = new List<Creature>();
|
||||
public List<Corpse> corpses = new List<Corpse>();
|
||||
public List<DynamicObject> dynamicObjects = new List<DynamicObject>();
|
||||
public List<AreaTrigger> areaTriggers = new List<AreaTrigger>();
|
||||
public List<Conversation> conversations = new List<Conversation>();
|
||||
public List<GameObject> gameObjects = new List<GameObject>();
|
||||
public List<WorldObject> worldObjects = new List<WorldObject>();
|
||||
public List<Player> players = new();
|
||||
public List<Creature> creatures = new();
|
||||
public List<Corpse> corpses = new();
|
||||
public List<DynamicObject> dynamicObjects = new();
|
||||
public List<AreaTrigger> areaTriggers = new();
|
||||
public List<Conversation> conversations = new();
|
||||
public List<GameObject> gameObjects = new();
|
||||
public List<WorldObject> worldObjects = new();
|
||||
}
|
||||
|
||||
public enum GridState
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace Game.Maps
|
||||
if (!File.Exists(filename))
|
||||
return LoadResult.FileNotFound;
|
||||
|
||||
using (BinaryReader reader = new BinaryReader(new FileStream(filename, FileMode.Open, FileAccess.Read)))
|
||||
using (BinaryReader reader = new(new FileStream(filename, FileMode.Open, FileAccess.Read)))
|
||||
{
|
||||
MapFileHeader header = reader.Read<MapFileHeader>();
|
||||
if (header.mapMagic != MapConst.MapMagic || (header.versionMagic != MapConst.MapVersionMagic && header.versionMagic != MapConst.MapVersionMagic2)) // Hack for some different extractors using v2.0 header
|
||||
@@ -464,7 +464,7 @@ namespace Game.Maps
|
||||
quarterIndex = gx > gy ? 1u : 0;
|
||||
|
||||
|
||||
Ray ray = new Ray(new Vector3(gx, gy, 0.0f), Vector3.ZAxis);
|
||||
Ray ray = new(new Vector3(gx, gy, 0.0f), Vector3.ZAxis);
|
||||
return ray.intersection(_minHeightPlanes[quarterIndex]).Z;
|
||||
}
|
||||
|
||||
|
||||
@@ -340,7 +340,7 @@ namespace Game.Maps
|
||||
if (!creature.IsNeedNotify(NotifyFlags.VisibilityChanged))
|
||||
continue;
|
||||
|
||||
CreatureRelocationNotifier relocate = new CreatureRelocationNotifier(creature);
|
||||
CreatureRelocationNotifier relocate = new(creature);
|
||||
|
||||
var c2world_relocation = new Visitor(relocate, GridMapTypeMask.AllWorld);
|
||||
var c2grid_relocation = new Visitor(relocate, GridMapTypeMask.AllGrid);
|
||||
@@ -848,7 +848,7 @@ namespace Game.Maps
|
||||
|
||||
Dictionary<Player, UpdateData> updateData;
|
||||
WorldObject worldObject;
|
||||
List<ObjectGuid> plr_list = new List<ObjectGuid>();
|
||||
List<ObjectGuid> plr_list = new();
|
||||
}
|
||||
|
||||
public class PlayerDistWorker : Notifier
|
||||
@@ -953,7 +953,7 @@ namespace Game.Maps
|
||||
{
|
||||
Locale loc_idx = p.GetSession().GetSessionDbLocaleIndex();
|
||||
int cache_idx = (int)loc_idx + 1;
|
||||
List<ServerPacket> data_list = new List<ServerPacket>();
|
||||
List<ServerPacket> data_list = new();
|
||||
|
||||
// create if not cached yet
|
||||
if (i_data_cache.Count < cache_idx + 1 || i_data_cache[cache_idx].Empty())
|
||||
@@ -970,7 +970,7 @@ namespace Game.Maps
|
||||
}
|
||||
|
||||
MessageBuilder i_builder;
|
||||
MultiMap<int, ServerPacket> i_data_cache = new MultiMap<int, ServerPacket>();
|
||||
MultiMap<int, ServerPacket> i_data_cache = new();
|
||||
// 0 = default, i => i-1 locale index
|
||||
}
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ namespace Game.Maps
|
||||
|
||||
Log.outDebug(LogFilter.Maps, "InstanceSaveManager.AddInstanceSave: mapid = {0}, instanceid = {1}", mapId, instanceId);
|
||||
|
||||
InstanceSave save = new InstanceSave(mapId, instanceId, difficulty, entranceId, resetTime, canReset);
|
||||
InstanceSave save = new(mapId, instanceId, difficulty, entranceId, resetTime, canReset);
|
||||
if (!load)
|
||||
save.SaveToDB();
|
||||
|
||||
@@ -94,7 +94,7 @@ namespace Game.Maps
|
||||
|
||||
public void DeleteInstanceFromDB(uint instanceid)
|
||||
{
|
||||
SQLTransaction trans = new SQLTransaction();
|
||||
SQLTransaction trans = new();
|
||||
|
||||
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_INSTANCE_BY_INSTANCE);
|
||||
stmt.AddValue(0, instanceid);
|
||||
@@ -187,10 +187,10 @@ namespace Game.Maps
|
||||
// get the current reset times for normal instances (these may need to be updated)
|
||||
// these are only kept in memory for InstanceSaves that are loaded later
|
||||
// resettime = 0 in the DB for raid/heroic instances so those are skipped
|
||||
Dictionary<uint, Tuple<uint, long>> instResetTime = new Dictionary<uint, Tuple<uint, long>>();
|
||||
Dictionary<uint, Tuple<uint, long>> instResetTime = new();
|
||||
|
||||
// index instance ids by map/difficulty pairs for fast reset warning send
|
||||
MultiMap<uint, uint> mapDiffResetInstances = new MultiMap<uint, uint>();
|
||||
MultiMap<uint, uint> mapDiffResetInstances = new();
|
||||
|
||||
SQLResult result = DB.Characters.Query("SELECT id, map, difficulty, resettime FROM instance ORDER BY id ASC");
|
||||
if (!result.IsEmpty())
|
||||
@@ -420,7 +420,7 @@ namespace Game.Maps
|
||||
|
||||
bool shouldDelete = true;
|
||||
var pList = pair.Value.m_playerList;
|
||||
List<Player> temp = new List<Player>(); // list of expired binds that should be unbound
|
||||
List<Player> temp = new(); // list of expired binds that should be unbound
|
||||
foreach (var player in pList)
|
||||
{
|
||||
InstanceBind bind = player.GetBoundInstance(pair.Value.GetMapId(), pair.Value.GetDifficultyID());
|
||||
@@ -499,7 +499,7 @@ namespace Game.Maps
|
||||
return;
|
||||
|
||||
// delete them from the DB, even if not loaded
|
||||
SQLTransaction trans = new SQLTransaction();
|
||||
SQLTransaction trans = new();
|
||||
|
||||
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_EXPIRED_CHAR_INSTANCE_BY_MAP_DIFF);
|
||||
stmt.AddValue(0, mapid);
|
||||
@@ -634,10 +634,10 @@ namespace Game.Maps
|
||||
// used during global instance resets
|
||||
public bool lock_instLists;
|
||||
// fast lookup by instance id
|
||||
Dictionary<uint, InstanceSave> m_instanceSaveById = new Dictionary<uint, InstanceSave>();
|
||||
Dictionary<uint, InstanceSave> m_instanceSaveById = new();
|
||||
// fast lookup for reset times (always use existed functions for access/set)
|
||||
Dictionary<ulong, long> m_resetTimeByMapDifficulty = new Dictionary<ulong, long>();
|
||||
MultiMap<long, InstResetEvent> m_resetTimeQueue = new MultiMap<long, InstResetEvent>();
|
||||
Dictionary<ulong, long> m_resetTimeByMapDifficulty = new();
|
||||
MultiMap<long, InstResetEvent> m_resetTimeQueue = new();
|
||||
}
|
||||
|
||||
public class InstanceSave
|
||||
@@ -766,8 +766,8 @@ namespace Game.Maps
|
||||
m_toDelete = toDelete;
|
||||
}
|
||||
|
||||
public List<Player> m_playerList = new List<Player>();
|
||||
public List<Group> m_groupList = new List<Group>();
|
||||
public List<Player> m_playerList = new();
|
||||
public List<Group> m_groupList = new();
|
||||
long m_resetTime;
|
||||
uint m_instanceid;
|
||||
uint m_mapid;
|
||||
|
||||
@@ -221,7 +221,7 @@ namespace Game.Maps
|
||||
if (_instanceSpawnGroups.Empty())
|
||||
return;
|
||||
|
||||
Dictionary<uint, states> newStates = new Dictionary<uint, states>();
|
||||
Dictionary<uint, states> newStates = new();
|
||||
foreach (var info in _instanceSpawnGroups)
|
||||
{
|
||||
if (!newStates.ContainsKey(info.SpawnGroupId))
|
||||
@@ -473,7 +473,7 @@ namespace Game.Maps
|
||||
{
|
||||
OUT_SAVE_INST_DATA();
|
||||
|
||||
StringBuilder saveStream = new StringBuilder();
|
||||
StringBuilder saveStream = new();
|
||||
|
||||
WriteSaveDataHeaders(saveStream);
|
||||
WriteSaveDataBossStates(saveStream);
|
||||
@@ -682,7 +682,7 @@ namespace Game.Maps
|
||||
if (unit == null)
|
||||
return;
|
||||
|
||||
InstanceEncounterEngageUnit encounterEngageMessage = new InstanceEncounterEngageUnit();
|
||||
InstanceEncounterEngageUnit encounterEngageMessage = new();
|
||||
encounterEngageMessage.Unit = unit.GetGUID();
|
||||
encounterEngageMessage.TargetFramePriority = priority;
|
||||
instance.SendToPlayers(encounterEngageMessage);
|
||||
@@ -691,7 +691,7 @@ namespace Game.Maps
|
||||
if (!unit)
|
||||
return;
|
||||
|
||||
InstanceEncounterDisengageUnit encounterDisengageMessage = new InstanceEncounterDisengageUnit();
|
||||
InstanceEncounterDisengageUnit encounterDisengageMessage = new();
|
||||
encounterDisengageMessage.Unit = unit.GetGUID();
|
||||
instance.SendToPlayers(encounterDisengageMessage);
|
||||
break;
|
||||
@@ -699,7 +699,7 @@ namespace Game.Maps
|
||||
if (!unit)
|
||||
return;
|
||||
|
||||
InstanceEncounterChangePriority encounterChangePriorityMessage = new InstanceEncounterChangePriority();
|
||||
InstanceEncounterChangePriority encounterChangePriorityMessage = new();
|
||||
encounterChangePriorityMessage.Unit = unit.GetGUID();
|
||||
encounterChangePriorityMessage.TargetFramePriority = priority;
|
||||
instance.SendToPlayers(encounterChangePriorityMessage);
|
||||
@@ -711,7 +711,7 @@ namespace Game.Maps
|
||||
|
||||
void SendEncounterStart(uint inCombatResCount = 0, uint maxInCombatResCount = 0, uint inCombatResChargeRecovery = 0, uint nextCombatResChargeTime = 0)
|
||||
{
|
||||
InstanceEncounterStart encounterStartMessage = new InstanceEncounterStart();
|
||||
InstanceEncounterStart encounterStartMessage = new();
|
||||
encounterStartMessage.InCombatResCount = inCombatResCount;
|
||||
encounterStartMessage.MaxInCombatResCount = maxInCombatResCount;
|
||||
encounterStartMessage.CombatResChargeRecovery = inCombatResChargeRecovery;
|
||||
@@ -727,7 +727,7 @@ namespace Game.Maps
|
||||
|
||||
public void SendBossKillCredit(uint encounterId)
|
||||
{
|
||||
BossKill bossKillCreditMessage = new BossKill();
|
||||
BossKill bossKillCreditMessage = new();
|
||||
bossKillCreditMessage.DungeonEncounterID = encounterId;
|
||||
|
||||
instance.SendToPlayers(bossKillCreditMessage);
|
||||
@@ -905,16 +905,16 @@ namespace Game.Maps
|
||||
public virtual void WriteSaveDataMore(StringBuilder data) { }
|
||||
|
||||
public InstanceMap instance;
|
||||
List<char> headers = new List<char>();
|
||||
Dictionary<uint, BossInfo> bosses = new Dictionary<uint, BossInfo>();
|
||||
MultiMap<uint, DoorInfo> doors = new MultiMap<uint, DoorInfo>();
|
||||
Dictionary<uint, MinionInfo> minions = new Dictionary<uint, MinionInfo>();
|
||||
Dictionary<uint, uint> _creatureInfo = new Dictionary<uint, uint>();
|
||||
Dictionary<uint, uint> _gameObjectInfo = new Dictionary<uint, uint>();
|
||||
Dictionary<uint, ObjectGuid> _objectGuids = new Dictionary<uint, ObjectGuid>();
|
||||
List<char> headers = new();
|
||||
Dictionary<uint, BossInfo> bosses = new();
|
||||
MultiMap<uint, DoorInfo> doors = new();
|
||||
Dictionary<uint, MinionInfo> minions = new();
|
||||
Dictionary<uint, uint> _creatureInfo = new();
|
||||
Dictionary<uint, uint> _gameObjectInfo = new();
|
||||
Dictionary<uint, ObjectGuid> _objectGuids = new();
|
||||
uint completedEncounters;
|
||||
List<InstanceSpawnGroupInfo> _instanceSpawnGroups = new List<InstanceSpawnGroupInfo>();
|
||||
List<uint> _activatedAreaTriggers = new List<uint>();
|
||||
List<InstanceSpawnGroupInfo> _instanceSpawnGroups = new();
|
||||
List<uint> _activatedAreaTriggers = new();
|
||||
uint _entranceId;
|
||||
uint _temporaryEntranceId;
|
||||
uint _combatResurrectionTimer;
|
||||
@@ -984,8 +984,8 @@ namespace Game.Maps
|
||||
|
||||
public EncounterState state;
|
||||
public List<ObjectGuid>[] door = new List<ObjectGuid>[(int)DoorType.Max];
|
||||
public List<ObjectGuid> minion = new List<ObjectGuid>();
|
||||
public List<AreaBoundary> boundary = new List<AreaBoundary>();
|
||||
public List<ObjectGuid> minion = new();
|
||||
public List<AreaBoundary> boundary = new();
|
||||
}
|
||||
class DoorInfo
|
||||
{
|
||||
|
||||
@@ -194,7 +194,7 @@ namespace Game.Maps
|
||||
|
||||
Log.outDebug(LogFilter.Maps, "MapInstanced.CreateInstance: {0} map instance {1} for {2} created with difficulty {3}", save != null ? "" : "new ", InstanceId, GetId(), difficulty);
|
||||
|
||||
InstanceMap map = new InstanceMap(GetId(), GetGridExpiry(), InstanceId, difficulty, this);
|
||||
InstanceMap map = new(GetId(), GetGridExpiry(), InstanceId, difficulty, this);
|
||||
Cypher.Assert(map.IsDungeon());
|
||||
|
||||
map.LoadRespawnTimes();
|
||||
@@ -220,7 +220,7 @@ namespace Game.Maps
|
||||
{
|
||||
Log.outDebug(LogFilter.Maps, "MapInstanced.CreateBattleground: map bg {0} for {1} created.", InstanceId, GetId());
|
||||
|
||||
BattlegroundMap map = new BattlegroundMap(GetId(), (uint)GetGridExpiry(), InstanceId, this, Difficulty.None);
|
||||
BattlegroundMap map = new(GetId(), (uint)GetGridExpiry(), InstanceId, this, Difficulty.None);
|
||||
Cypher.Assert(map.IsBattlegroundOrArena());
|
||||
map.SetBG(bg);
|
||||
bg.SetBgMap(map);
|
||||
@@ -234,7 +234,7 @@ namespace Game.Maps
|
||||
{
|
||||
lock (_mapLock)
|
||||
{
|
||||
GarrisonMap map = new GarrisonMap(GetId(), GetGridExpiry(), instanceId, this, owner.GetGUID());
|
||||
GarrisonMap map = new(GetId(), GetGridExpiry(), instanceId, this, owner.GetGUID());
|
||||
Cypher.Assert(map.IsGarrison());
|
||||
|
||||
m_InstancedMaps[instanceId] = map;
|
||||
@@ -279,7 +279,7 @@ namespace Game.Maps
|
||||
|
||||
public Dictionary<uint, Map> GetInstancedMaps() { return m_InstancedMaps; }
|
||||
|
||||
Dictionary<uint, Map> m_InstancedMaps = new Dictionary<uint, Map>();
|
||||
Dictionary<uint, Map> m_InstancedMaps = new();
|
||||
}
|
||||
|
||||
public class InstanceTemplate
|
||||
|
||||
@@ -57,9 +57,9 @@ namespace Game
|
||||
return false;
|
||||
}
|
||||
|
||||
using (BinaryReader reader = new BinaryReader(new FileStream(filename, FileMode.Open, FileAccess.Read), Encoding.UTF8))
|
||||
using (BinaryReader reader = new(new FileStream(filename, FileMode.Open, FileAccess.Read), Encoding.UTF8))
|
||||
{
|
||||
Detour.dtNavMeshParams Params = new Detour.dtNavMeshParams();
|
||||
Detour.dtNavMeshParams Params = new();
|
||||
Params.orig[0] = reader.ReadSingle();
|
||||
Params.orig[1] = reader.ReadSingle();
|
||||
Params.orig[2] = reader.ReadSingle();
|
||||
@@ -69,7 +69,7 @@ namespace Game
|
||||
Params.maxTiles = reader.ReadInt32();
|
||||
Params.maxPolys = reader.ReadInt32();
|
||||
|
||||
Detour.dtNavMesh mesh = new Detour.dtNavMesh();
|
||||
Detour.dtNavMesh mesh = new();
|
||||
if (Detour.dtStatusFailed(mesh.init(Params)))
|
||||
{
|
||||
Log.outError(LogFilter.Maps, "MMAP:loadMapData: Failed to initialize dtNavMesh for mmap {0:D4} from file {1}", mapId, filename);
|
||||
@@ -133,7 +133,7 @@ namespace Game
|
||||
return false;
|
||||
}
|
||||
|
||||
using (BinaryReader reader = new BinaryReader(new FileStream(fileName, FileMode.Open, FileAccess.Read)))
|
||||
using (BinaryReader reader = new(new FileStream(fileName, FileMode.Open, FileAccess.Read)))
|
||||
{
|
||||
MmapTileHeader fileHeader = reader.Read<MmapTileHeader>();
|
||||
if (fileHeader.mmapMagic != MapConst.mmapMagic)
|
||||
@@ -149,7 +149,7 @@ namespace Game
|
||||
}
|
||||
|
||||
var bytes = reader.ReadBytes((int)fileHeader.size);
|
||||
Detour.dtRawTileData data = new Detour.dtRawTileData();
|
||||
Detour.dtRawTileData data = new();
|
||||
data.FromBytes(bytes, 0);
|
||||
|
||||
ulong tileRef = 0;
|
||||
@@ -191,7 +191,7 @@ namespace Game
|
||||
return true;
|
||||
|
||||
// allocate mesh query
|
||||
Detour.dtNavMeshQuery query = new Detour.dtNavMeshQuery();
|
||||
Detour.dtNavMeshQuery query = new();
|
||||
if (Detour.dtStatusFailed(query.init(mmap.navMesh, 1024)))
|
||||
{
|
||||
Log.outError(LogFilter.Maps, "MMAP.GetNavMeshQuery: Failed to initialize dtNavMeshQuery for mapId {0:D4} instanceId {1}", mapId, instanceId);
|
||||
@@ -330,11 +330,11 @@ namespace Game
|
||||
public uint GetLoadedTilesCount() { return loadedTiles; }
|
||||
public int GetLoadedMapsCount() { return loadedMMaps.Count; }
|
||||
|
||||
Dictionary<uint, MMapData> loadedMMaps = new Dictionary<uint, MMapData>();
|
||||
Dictionary<uint, MMapData> loadedMMaps = new();
|
||||
uint loadedTiles;
|
||||
|
||||
MultiMap<uint, uint> childMapData = new MultiMap<uint, uint>();
|
||||
Dictionary<uint, uint> parentMapData = new Dictionary<uint, uint>();
|
||||
MultiMap<uint, uint> childMapData = new();
|
||||
Dictionary<uint, uint> parentMapData = new();
|
||||
}
|
||||
|
||||
public class MMapData
|
||||
@@ -344,10 +344,10 @@ namespace Game
|
||||
navMesh = mesh;
|
||||
}
|
||||
|
||||
public Dictionary<uint, Detour.dtNavMeshQuery> navMeshQueries = new Dictionary<uint, Detour.dtNavMeshQuery>(); // instanceId to query
|
||||
public Dictionary<uint, Detour.dtNavMeshQuery> navMeshQueries = new(); // instanceId to query
|
||||
|
||||
public Detour.dtNavMesh navMesh;
|
||||
public Dictionary<uint, ulong> loadedTileRefs = new Dictionary<uint, ulong>(); // maps [map grid coords] to [dtTile]
|
||||
public Dictionary<uint, ulong> loadedTileRefs = new(); // maps [map grid coords] to [dtTile]
|
||||
}
|
||||
|
||||
public struct MmapTileHeader
|
||||
|
||||
+71
-71
@@ -248,7 +248,7 @@ namespace Game.Maps
|
||||
Log.outInfo(LogFilter.Maps, "Loading map {0}", fileName);
|
||||
|
||||
// loading data
|
||||
GridMap gridMap = new GridMap();
|
||||
GridMap gridMap = new();
|
||||
LoadResult gridMapLoadResult = gridMap.LoadData(fileName);
|
||||
if (gridMapLoadResult == LoadResult.Success)
|
||||
map.GridMaps[gx][gy] = gridMap;
|
||||
@@ -500,7 +500,7 @@ namespace Game.Maps
|
||||
|
||||
public virtual void LoadGridObjects(Grid grid, Cell cell)
|
||||
{
|
||||
ObjectGridLoader loader = new ObjectGridLoader(grid, this, cell);
|
||||
ObjectGridLoader loader = new(grid, this, cell);
|
||||
loader.LoadN();
|
||||
}
|
||||
|
||||
@@ -509,7 +509,7 @@ namespace Game.Maps
|
||||
// First make sure this grid is loaded
|
||||
float gX = (((float)x - 0.5f - MapConst.CenterGridId) * MapConst.SizeofGrids) + (MapConst.CenterGridOffset * 2);
|
||||
float gY = (((float)y - 0.5f - MapConst.CenterGridId) * MapConst.SizeofGrids) + (MapConst.CenterGridOffset * 2);
|
||||
Cell cell = new Cell(gX, gY);
|
||||
Cell cell = new(gX, gY);
|
||||
EnsureGridLoaded(cell);
|
||||
|
||||
// Mark as don't unload
|
||||
@@ -762,7 +762,7 @@ namespace Game.Maps
|
||||
// Handle updates for creatures in combat with player and are more than 60 yards away
|
||||
if (player.IsInCombat())
|
||||
{
|
||||
List<Creature> updateList = new List<Creature>();
|
||||
List<Creature> updateList = new();
|
||||
HostileReference refe = player.GetHostileRefManager().GetFirst();
|
||||
|
||||
while (refe != null)
|
||||
@@ -976,7 +976,7 @@ namespace Game.Maps
|
||||
var players = GetPlayers();
|
||||
if (!players.Empty())
|
||||
{
|
||||
UpdateData data = new UpdateData(GetId());
|
||||
UpdateData data = new(GetId());
|
||||
obj.BuildOutOfRangeUpdateBlock(data);
|
||||
UpdateObject packet;
|
||||
data.BuildPacket(out packet);
|
||||
@@ -1104,12 +1104,12 @@ namespace Game.Maps
|
||||
|
||||
public void DynamicObjectRelocation(DynamicObject dynObj, float x, float y, float z, float orientation)
|
||||
{
|
||||
Cell integrity_check = new Cell(dynObj.GetPositionX(), dynObj.GetPositionY());
|
||||
Cell integrity_check = new(dynObj.GetPositionX(), dynObj.GetPositionY());
|
||||
Cell old_cell = dynObj.GetCurrentCell();
|
||||
|
||||
Cypher.Assert(integrity_check == old_cell);
|
||||
|
||||
Cell new_cell = new Cell(x, y);
|
||||
Cell new_cell = new(x, y);
|
||||
|
||||
if (GetGrid(new_cell.GetGridX(), new_cell.GetGridY()) == null)
|
||||
return;
|
||||
@@ -1140,11 +1140,11 @@ namespace Game.Maps
|
||||
|
||||
public void AreaTriggerRelocation(AreaTrigger at, float x, float y, float z, float orientation)
|
||||
{
|
||||
Cell integrity_check = new Cell(at.GetPositionX(), at.GetPositionY());
|
||||
Cell integrity_check = new(at.GetPositionX(), at.GetPositionY());
|
||||
Cell old_cell = at.GetCurrentCell();
|
||||
|
||||
Cypher.Assert(integrity_check == old_cell);
|
||||
Cell new_cell = new Cell(x, y);
|
||||
Cell new_cell = new(x, y);
|
||||
|
||||
if (GetGrid(new_cell.GetGridX(), new_cell.GetGridY()) == null)
|
||||
return;
|
||||
@@ -1699,7 +1699,7 @@ namespace Game.Maps
|
||||
MoveAllAreaTriggersInMoveList();
|
||||
|
||||
// move creatures to respawn grids if this is diff.grid or to remove list
|
||||
ObjectGridEvacuator worker = new ObjectGridEvacuator();
|
||||
ObjectGridEvacuator worker = new();
|
||||
var visitor = new Visitor(worker, GridMapTypeMask.AllGrid);
|
||||
grid.VisitAllGrids(visitor);
|
||||
|
||||
@@ -1710,7 +1710,7 @@ namespace Game.Maps
|
||||
}
|
||||
|
||||
{
|
||||
ObjectGridCleaner worker = new ObjectGridCleaner();
|
||||
ObjectGridCleaner worker = new();
|
||||
var visitor = new Visitor(worker, GridMapTypeMask.AllGrid);
|
||||
grid.VisitAllGrids(visitor);
|
||||
}
|
||||
@@ -1718,7 +1718,7 @@ namespace Game.Maps
|
||||
RemoveAllObjectsInRemoveList();
|
||||
|
||||
{
|
||||
ObjectGridUnloader worker = new ObjectGridUnloader();
|
||||
ObjectGridUnloader worker = new();
|
||||
var visitor = new Visitor(worker, GridMapTypeMask.AllGrid);
|
||||
grid.VisitAllGrids(visitor);
|
||||
}
|
||||
@@ -2286,7 +2286,7 @@ namespace Game.Maps
|
||||
// look up liquid data from grid map
|
||||
if (gmap != null && (data.LiquidStatus == ZLiquidStatus.AboveWater || data.LiquidStatus == ZLiquidStatus.NoWater))
|
||||
{
|
||||
LiquidData gridMapLiquid = new LiquidData();
|
||||
LiquidData gridMapLiquid = new();
|
||||
ZLiquidStatus gridMapStatus = gmap.GetLiquidStatus(x, y, z, reqLiquidType, gridMapLiquid);
|
||||
if (gridMapStatus != ZLiquidStatus.NoWater && (gridMapLiquid.level > vmapData.floorZ))
|
||||
{
|
||||
@@ -2422,7 +2422,7 @@ namespace Game.Maps
|
||||
public void SendUpdateTransportVisibility(Player player)
|
||||
{
|
||||
// Hack to send out transports
|
||||
UpdateData transData = new UpdateData(player.GetMapId());
|
||||
UpdateData transData = new(player.GetMapId());
|
||||
foreach (var transport in _transports)
|
||||
{
|
||||
var hasTransport = player.m_visibleTransports.Contains(transport.GetGUID());
|
||||
@@ -2458,7 +2458,7 @@ namespace Game.Maps
|
||||
|
||||
void SendObjectUpdates()
|
||||
{
|
||||
Dictionary<Player, UpdateData> update_players = new Dictionary<Player, UpdateData>();
|
||||
Dictionary<Player, UpdateData> update_players = new();
|
||||
|
||||
while (!_updateObjects.Empty())
|
||||
{
|
||||
@@ -2581,14 +2581,14 @@ namespace Game.Maps
|
||||
{
|
||||
case SpawnObjectType.Creature:
|
||||
{
|
||||
Creature obj = new Creature();
|
||||
Creature obj = new();
|
||||
if (!obj.LoadFromDB(spawnId, this, true, true))
|
||||
obj.Dispose();
|
||||
break;
|
||||
}
|
||||
case SpawnObjectType.GameObject:
|
||||
{
|
||||
GameObject obj = new GameObject();
|
||||
GameObject obj = new();
|
||||
if (!obj.LoadFromDB(spawnId, this, true))
|
||||
obj.Dispose();
|
||||
break;
|
||||
@@ -2649,7 +2649,7 @@ namespace Game.Maps
|
||||
}
|
||||
|
||||
// if we get to this point, we should insert the respawninfo (there either was no prior entry, or it was deleted already)
|
||||
RespawnInfo ri = new RespawnInfo(info);
|
||||
RespawnInfo ri = new(info);
|
||||
_respawnTimes.Add(ri);
|
||||
bySpawnIdMap.Add(ri.spawnId, ri);
|
||||
}
|
||||
@@ -2740,7 +2740,7 @@ namespace Game.Maps
|
||||
|
||||
public void RemoveRespawnTime(SpawnObjectTypeMask types = SpawnObjectTypeMask.All, uint zoneId = 0, bool doRespawn = false, SQLTransaction dbTrans = null)
|
||||
{
|
||||
List<RespawnInfo> v = new List<RespawnInfo>();
|
||||
List<RespawnInfo> v = new();
|
||||
GetRespawnInfo(v, types, zoneId);
|
||||
if (!v.Empty())
|
||||
RemoveRespawnTime(v, doRespawn, dbTrans);
|
||||
@@ -2874,7 +2874,7 @@ namespace Game.Maps
|
||||
{
|
||||
case SpawnObjectType.Creature:
|
||||
{
|
||||
Creature creature = new Creature();
|
||||
Creature creature = new();
|
||||
if (!creature.LoadFromDB(data.spawnId, this, true, force))
|
||||
creature.Dispose();
|
||||
else if (spawnedObjects != null)
|
||||
@@ -2883,7 +2883,7 @@ namespace Game.Maps
|
||||
}
|
||||
case SpawnObjectType.GameObject:
|
||||
{
|
||||
GameObject gameobject = new GameObject();
|
||||
GameObject gameobject = new();
|
||||
if (!gameobject.LoadFromDB(data.spawnId, this, true))
|
||||
gameobject.Dispose();
|
||||
else if (spawnedObjects != null)
|
||||
@@ -2908,7 +2908,7 @@ namespace Game.Maps
|
||||
return false;
|
||||
}
|
||||
|
||||
List<WorldObject> toUnload = new List<WorldObject>(); // unload after iterating, otherwise iterator invalidation
|
||||
List<WorldObject> toUnload = new(); // unload after iterating, otherwise iterator invalidation
|
||||
foreach (var data in Global.ObjectMgr.GetSpawnDataForGroup(groupId))
|
||||
{
|
||||
if (deleteRespawnTimes)
|
||||
@@ -3216,7 +3216,7 @@ namespace Game.Maps
|
||||
return;
|
||||
}
|
||||
|
||||
RespawnInfo ri = new RespawnInfo();
|
||||
RespawnInfo ri = new();
|
||||
ri.type = type;
|
||||
ri.spawnId = spawnId;
|
||||
ri.entry = entry;
|
||||
@@ -3328,8 +3328,8 @@ namespace Game.Maps
|
||||
if (result.IsEmpty())
|
||||
return;
|
||||
|
||||
MultiMap<ulong, uint> phases = new MultiMap<ulong, uint>();
|
||||
MultiMap<ulong, ChrCustomizationChoice> customizations = new MultiMap<ulong, ChrCustomizationChoice>();
|
||||
MultiMap<ulong, uint> phases = new();
|
||||
MultiMap<ulong, ChrCustomizationChoice> customizations = new();
|
||||
|
||||
stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CORPSE_PHASES);
|
||||
stmt.AddValue(0, GetId());
|
||||
@@ -3363,7 +3363,7 @@ namespace Game.Maps
|
||||
{
|
||||
ulong guid = customizationResult.Read<ulong>(0);
|
||||
|
||||
ChrCustomizationChoice choice = new ChrCustomizationChoice();
|
||||
ChrCustomizationChoice choice = new();
|
||||
choice.ChrCustomizationOptionID = customizationResult.Read<uint>(1);
|
||||
choice.ChrCustomizationChoiceID = customizationResult.Read<uint>(2);
|
||||
customizations.Add(guid, choice);
|
||||
@@ -3381,7 +3381,7 @@ namespace Game.Maps
|
||||
continue;
|
||||
}
|
||||
|
||||
Corpse corpse = new Corpse(type);
|
||||
Corpse corpse = new(type);
|
||||
if (!corpse.LoadCorpseFromDB(GenerateLowGuid(HighGuid.Corpse), result.GetFields()))
|
||||
continue;
|
||||
|
||||
@@ -3443,7 +3443,7 @@ namespace Game.Maps
|
||||
RemoveCorpse(corpse);
|
||||
|
||||
// remove corpse from DB
|
||||
SQLTransaction trans = new SQLTransaction();
|
||||
SQLTransaction trans = new();
|
||||
corpse.DeleteFromDB(trans);
|
||||
DB.Characters.CommitTransaction(trans);
|
||||
|
||||
@@ -3494,7 +3494,7 @@ namespace Game.Maps
|
||||
{
|
||||
long now = Time.UnixTime;
|
||||
|
||||
List<ObjectGuid> corpses = new List<ObjectGuid>();
|
||||
List<ObjectGuid> corpses = new();
|
||||
|
||||
foreach (var p in _corpsesByPlayer)
|
||||
if (p.Value.IsExpired(now))
|
||||
@@ -3503,7 +3503,7 @@ namespace Game.Maps
|
||||
foreach (ObjectGuid ownerGuid in corpses)
|
||||
ConvertCorpseToBones(ownerGuid);
|
||||
|
||||
List<Corpse> expiredBones = new List<Corpse>();
|
||||
List<Corpse> expiredBones = new();
|
||||
foreach (Corpse bones in _corpseBones)
|
||||
if (bones.IsExpired(now))
|
||||
expiredBones.Add(bones);
|
||||
@@ -3530,7 +3530,7 @@ namespace Game.Maps
|
||||
uint overrideLightId = zoneInfo.OverrideLightId;
|
||||
if (overrideLightId != 0)
|
||||
{
|
||||
OverrideLight overrideLight = new OverrideLight();
|
||||
OverrideLight overrideLight = new();
|
||||
overrideLight.AreaLightID = _defaultLight;
|
||||
overrideLight.OverrideLightID = overrideLightId;
|
||||
overrideLight.TransitionMilliseconds = zoneInfo.LightFadeInTime;
|
||||
@@ -3555,7 +3555,7 @@ namespace Game.Maps
|
||||
WeatherState weatherId = zoneDynamicInfo.WeatherId;
|
||||
if (weatherId != 0)
|
||||
{
|
||||
WeatherPkt weather = new WeatherPkt(weatherId, zoneDynamicInfo.WeatherGrade);
|
||||
WeatherPkt weather = new(weatherId, zoneDynamicInfo.WeatherGrade);
|
||||
player.SendPacket(weather);
|
||||
}
|
||||
else if (zoneDynamicInfo.DefaultWeather != null)
|
||||
@@ -3576,7 +3576,7 @@ namespace Game.Maps
|
||||
var players = GetPlayers();
|
||||
if (!players.Empty())
|
||||
{
|
||||
PlayMusic playMusic = new PlayMusic(musicId);
|
||||
PlayMusic playMusic = new(musicId);
|
||||
|
||||
foreach (var player in players)
|
||||
if (player.GetZoneId() == zoneId && !player.HasAuraType(AuraType.ForceWeather))
|
||||
@@ -3616,7 +3616,7 @@ namespace Game.Maps
|
||||
var players = GetPlayers();
|
||||
if (!players.Empty())
|
||||
{
|
||||
WeatherPkt weather = new WeatherPkt(weatherId, weatherGrade);
|
||||
WeatherPkt weather = new(weatherId, weatherGrade);
|
||||
|
||||
foreach (var player in players)
|
||||
{
|
||||
@@ -3638,7 +3638,7 @@ namespace Game.Maps
|
||||
|
||||
if (!players.Empty())
|
||||
{
|
||||
OverrideLight overrideLight = new OverrideLight();
|
||||
OverrideLight overrideLight = new();
|
||||
overrideLight.AreaLightID = _defaultLight;
|
||||
overrideLight.OverrideLightID = lightId;
|
||||
overrideLight.TransitionMilliseconds = fadeInTime;
|
||||
@@ -4138,7 +4138,7 @@ namespace Game.Maps
|
||||
summon.InitSummon();
|
||||
|
||||
// call MoveInLineOfSight for nearby creatures
|
||||
AIRelocationNotifier notifier = new AIRelocationNotifier(summon);
|
||||
AIRelocationNotifier notifier = new(summon);
|
||||
Cell.VisitAllObjects(summon, notifier, GetVisibilityRange());
|
||||
|
||||
return summon;
|
||||
@@ -5040,70 +5040,70 @@ namespace Game.Maps
|
||||
#endregion
|
||||
|
||||
#region Fields
|
||||
internal object _mapLock = new object();
|
||||
object _gridLock = new object();
|
||||
internal object _mapLock = new();
|
||||
object _gridLock = new();
|
||||
|
||||
bool _creatureToMoveLock;
|
||||
List<Creature> creaturesToMove = new List<Creature>();
|
||||
List<Creature> creaturesToMove = new();
|
||||
|
||||
bool _gameObjectsToMoveLock;
|
||||
List<GameObject> _gameObjectsToMove = new List<GameObject>();
|
||||
List<GameObject> _gameObjectsToMove = new();
|
||||
|
||||
bool _dynamicObjectsToMoveLock;
|
||||
List<DynamicObject> _dynamicObjectsToMove = new List<DynamicObject>();
|
||||
List<DynamicObject> _dynamicObjectsToMove = new();
|
||||
|
||||
bool _areaTriggersToMoveLock;
|
||||
List<AreaTrigger> _areaTriggersToMove = new List<AreaTrigger>();
|
||||
List<AreaTrigger> _areaTriggersToMove = new();
|
||||
|
||||
GridMap[][] GridMaps = new GridMap[MapConst.MaxGrids][];
|
||||
ushort[][] GridMapReference = new ushort[MapConst.MaxGrids][];
|
||||
DynamicMapTree _dynamicTree = new DynamicMapTree();
|
||||
DynamicMapTree _dynamicTree = new();
|
||||
|
||||
SortedSet<RespawnInfo> _respawnTimes = new SortedSet<RespawnInfo>(new CompareRespawnInfo());
|
||||
Dictionary<ulong, RespawnInfo> _creatureRespawnTimesBySpawnId = new Dictionary<ulong, RespawnInfo>();
|
||||
Dictionary<ulong, RespawnInfo> _gameObjectRespawnTimesBySpawnId = new Dictionary<ulong, RespawnInfo>();
|
||||
List<uint> _toggledSpawnGroupIds = new List<uint>();
|
||||
SortedSet<RespawnInfo> _respawnTimes = new(new CompareRespawnInfo());
|
||||
Dictionary<ulong, RespawnInfo> _creatureRespawnTimesBySpawnId = new();
|
||||
Dictionary<ulong, RespawnInfo> _gameObjectRespawnTimesBySpawnId = new();
|
||||
List<uint> _toggledSpawnGroupIds = new();
|
||||
uint _respawnCheckTimer;
|
||||
Dictionary<uint, uint> _zonePlayerCountMap = new Dictionary<uint, uint>();
|
||||
Dictionary<uint, uint> _zonePlayerCountMap = new();
|
||||
|
||||
List<Transport> _transports = new List<Transport>();
|
||||
List<Transport> _transports = new();
|
||||
Grid[][] i_grids = new Grid[MapConst.MaxGrids][];
|
||||
MapRecord i_mapRecord;
|
||||
List<WorldObject> i_objectsToRemove = new List<WorldObject>();
|
||||
Dictionary<WorldObject, bool> i_objectsToSwitch = new Dictionary<WorldObject, bool>();
|
||||
List<WorldObject> i_objectsToRemove = new();
|
||||
Dictionary<WorldObject, bool> i_objectsToSwitch = new();
|
||||
Difficulty i_spawnMode;
|
||||
List<WorldObject> i_worldObjects = new List<WorldObject>();
|
||||
protected List<WorldObject> m_activeNonPlayers = new List<WorldObject>();
|
||||
protected List<Player> m_activePlayers = new List<Player>();
|
||||
List<WorldObject> i_worldObjects = new();
|
||||
protected List<WorldObject> m_activeNonPlayers = new();
|
||||
protected List<Player> m_activePlayers = new();
|
||||
Map m_parentMap; // points to MapInstanced or self (always same map id)
|
||||
Map m_parentTerrainMap; // points to m_parentMap of MapEntry::ParentMapID
|
||||
List<Map> m_childTerrainMaps = new List<Map>(); // contains m_parentMap of maps that have MapEntry::ParentMapID == GetId()
|
||||
SortedMultiMap<long, ScriptAction> m_scriptSchedule = new SortedMultiMap<long, ScriptAction>();
|
||||
List<Map> m_childTerrainMaps = new(); // contains m_parentMap of maps that have MapEntry::ParentMapID == GetId()
|
||||
SortedMultiMap<long, ScriptAction> m_scriptSchedule = new();
|
||||
|
||||
BitSet i_gridFileExists = new BitSet(MapConst.MaxGrids * MapConst.MaxGrids); // cache what grids are available for this map (not including parent/child maps)
|
||||
BitSet marked_cells = new BitSet(MapConst.TotalCellsPerMap * MapConst.TotalCellsPerMap);
|
||||
public Dictionary<ulong, CreatureGroup> CreatureGroupHolder = new Dictionary<ulong, CreatureGroup>();
|
||||
BitSet i_gridFileExists = new(MapConst.MaxGrids * MapConst.MaxGrids); // cache what grids are available for this map (not including parent/child maps)
|
||||
BitSet marked_cells = new(MapConst.TotalCellsPerMap * MapConst.TotalCellsPerMap);
|
||||
public Dictionary<ulong, CreatureGroup> CreatureGroupHolder = new();
|
||||
internal uint i_InstanceId;
|
||||
long i_gridExpiry;
|
||||
List<WorldObject> i_objects = new List<WorldObject>();
|
||||
List<WorldObject> i_objects = new();
|
||||
bool i_scriptLock;
|
||||
|
||||
public int m_VisibilityNotifyPeriod;
|
||||
public float m_VisibleDistance;
|
||||
internal uint m_unloadTimer;
|
||||
|
||||
Dictionary<uint, ZoneDynamicInfo> _zoneDynamicInfo = new Dictionary<uint, ZoneDynamicInfo>();
|
||||
Dictionary<uint, ZoneDynamicInfo> _zoneDynamicInfo = new();
|
||||
IntervalTimer _weatherUpdateTimer;
|
||||
uint _defaultLight;
|
||||
Dictionary<HighGuid, ObjectGuidGenerator> _guidGenerators = new Dictionary<HighGuid, ObjectGuidGenerator>();
|
||||
Dictionary<ObjectGuid, WorldObject> _objectsStore = new Dictionary<ObjectGuid, WorldObject>();
|
||||
MultiMap<ulong, Creature> _creatureBySpawnIdStore = new MultiMap<ulong, Creature>();
|
||||
MultiMap<ulong, GameObject> _gameobjectBySpawnIdStore = new MultiMap<ulong, GameObject>();
|
||||
MultiMap<uint, Corpse> _corpsesByCell = new MultiMap<uint, Corpse>();
|
||||
Dictionary<ObjectGuid, Corpse> _corpsesByPlayer = new Dictionary<ObjectGuid, Corpse>();
|
||||
List<Corpse> _corpseBones = new List<Corpse>();
|
||||
Dictionary<HighGuid, ObjectGuidGenerator> _guidGenerators = new();
|
||||
Dictionary<ObjectGuid, WorldObject> _objectsStore = new();
|
||||
MultiMap<ulong, Creature> _creatureBySpawnIdStore = new();
|
||||
MultiMap<ulong, GameObject> _gameobjectBySpawnIdStore = new();
|
||||
MultiMap<uint, Corpse> _corpsesByCell = new();
|
||||
Dictionary<ObjectGuid, Corpse> _corpsesByPlayer = new();
|
||||
List<Corpse> _corpseBones = new();
|
||||
|
||||
List<WorldObject> _updateObjects = new List<WorldObject>();
|
||||
List<WorldObject> _updateObjects = new();
|
||||
#endregion
|
||||
}
|
||||
|
||||
@@ -5257,7 +5257,7 @@ namespace Game.Maps
|
||||
// players also become permanently bound when they enter
|
||||
if (groupBind.perm)
|
||||
{
|
||||
PendingRaidLock pendingRaidLock = new PendingRaidLock();
|
||||
PendingRaidLock pendingRaidLock = new();
|
||||
pendingRaidLock.TimeUntilLock = 60000;
|
||||
pendingRaidLock.CompletedMask = i_data != null ? i_data.GetCompletedEncounterMask() : 0;
|
||||
pendingRaidLock.Extending = false;
|
||||
@@ -5469,7 +5469,7 @@ namespace Game.Maps
|
||||
else
|
||||
{
|
||||
player.BindToInstance(save, true);
|
||||
InstanceSaveCreated data = new InstanceSaveCreated();
|
||||
InstanceSaveCreated data = new();
|
||||
data.Gm = player.IsGameMaster();
|
||||
player.SendPacket(data);
|
||||
|
||||
|
||||
@@ -484,9 +484,9 @@ namespace Game.Entities
|
||||
public void DecreaseScheduledScriptCount(uint count) { _scheduledScripts -= count; }
|
||||
public bool IsScriptScheduled() { return _scheduledScripts > 0; }
|
||||
|
||||
Dictionary<uint, Map> i_maps = new Dictionary<uint, Map>();
|
||||
IntervalTimer i_timer = new IntervalTimer();
|
||||
object _mapsLock= new object();
|
||||
Dictionary<uint, Map> i_maps = new();
|
||||
IntervalTimer i_timer = new();
|
||||
object _mapsLock= new();
|
||||
uint i_gridCleanUpDelay;
|
||||
BitSet _freeInstanceIds;
|
||||
uint _nextInstanceId;
|
||||
|
||||
@@ -22,12 +22,12 @@ namespace Game.Maps
|
||||
{
|
||||
public class MapUpdater
|
||||
{
|
||||
ProducerConsumerQueue<MapUpdateRequest> _queue = new ProducerConsumerQueue<MapUpdateRequest>();
|
||||
ProducerConsumerQueue<MapUpdateRequest> _queue = new();
|
||||
|
||||
Thread[] _workerThreads;
|
||||
volatile bool _cancelationToken;
|
||||
|
||||
object _lock = new object();
|
||||
object _lock = new();
|
||||
int _pendingRequests;
|
||||
|
||||
public MapUpdater(int numThreads)
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace Game.Maps
|
||||
var visitor = new Visitor(this, GridMapTypeMask.AllGrid);
|
||||
i_grid.VisitGrid(x, y, visitor);
|
||||
|
||||
ObjectWorldLoader worker = new ObjectWorldLoader(this);
|
||||
ObjectWorldLoader worker = new(this);
|
||||
visitor = new Visitor(worker, GridMapTypeMask.AllWorld);
|
||||
i_grid.VisitGrid(x, y, visitor);
|
||||
}
|
||||
@@ -90,7 +90,7 @@ namespace Game.Maps
|
||||
{
|
||||
foreach (var guid in guid_set)
|
||||
{
|
||||
T obj = new T();
|
||||
T obj = new();
|
||||
// Don't spawn at all if there's a respawn time
|
||||
if ((obj.IsTypeId(TypeId.Unit) && map.GetCreatureRespawnTime(guid) == 0) || (obj.IsTypeId(TypeId.GameObject) && map.GetGORespawnTime(guid) == 0) || obj.IsTypeId(TypeId.AreaTrigger))
|
||||
{
|
||||
|
||||
@@ -70,7 +70,7 @@ namespace Game.Maps
|
||||
continue;
|
||||
|
||||
// paths are generated per template, saves us from generating it again in case of instanced transports
|
||||
TransportTemplate transport = new TransportTemplate();
|
||||
TransportTemplate transport = new();
|
||||
transport.entry = entry;
|
||||
GeneratePath(goInfo, transport);
|
||||
|
||||
@@ -101,8 +101,8 @@ namespace Game.Maps
|
||||
uint pathId = goInfo.MoTransport.taxiPathID;
|
||||
var path = CliDB.TaxiPathNodesByPath[pathId];
|
||||
List<KeyFrame> keyFrames = transport.keyFrames;
|
||||
List<Vector3> splinePath = new List<Vector3>();
|
||||
List<Vector3> allPoints = new List<Vector3>();
|
||||
List<Vector3> splinePath = new();
|
||||
List<Vector3> allPoints = new();
|
||||
bool mapChange = false;
|
||||
|
||||
for (uint i = 0; i < path.Length; ++i)
|
||||
@@ -113,8 +113,8 @@ namespace Game.Maps
|
||||
allPoints.Add(allPoints.Last().lerp(allPoints[allPoints.Count - 2], -0.2f));
|
||||
allPoints.Add(allPoints.Last().lerp(allPoints[allPoints.Count - 2], -1.0f));
|
||||
|
||||
SplineRawInitializer initer = new SplineRawInitializer(allPoints);
|
||||
Spline orientationSpline = new Spline();
|
||||
SplineRawInitializer initer = new(allPoints);
|
||||
Spline orientationSpline = new();
|
||||
orientationSpline.InitSplineCustom(initer);
|
||||
orientationSpline.InitLengths();
|
||||
|
||||
@@ -130,7 +130,7 @@ namespace Game.Maps
|
||||
}
|
||||
else
|
||||
{
|
||||
KeyFrame k = new KeyFrame(node_i);
|
||||
KeyFrame k = new(node_i);
|
||||
Vector3 h;
|
||||
orientationSpline.Evaluate_Derivative((int)(i + 1), 0.0f, out h);
|
||||
k.InitialOrientation = Position.NormalizeOrientation((float)Math.Atan2(h.Y, h.X) + MathFunctions.PI);
|
||||
@@ -202,7 +202,7 @@ namespace Game.Maps
|
||||
if (keyFrames[i - 1].Teleport || i + 1 == keyFrames.Count)
|
||||
{
|
||||
int extra = !keyFrames[i - 1].Teleport ? 1 : 0;
|
||||
Spline spline = new Spline();
|
||||
Spline spline = new();
|
||||
Span<Vector3> span = splinePath.ToArray();
|
||||
spline.InitSpline(span.Slice(start), i - start + extra, Spline.EvaluationMode.Catmullrom);
|
||||
spline.InitLengths();
|
||||
@@ -339,7 +339,7 @@ namespace Game.Maps
|
||||
|
||||
public void AddPathNodeToTransport(uint transportEntry, uint timeSeg, TransportAnimationRecord node)
|
||||
{
|
||||
TransportAnimation animNode = new TransportAnimation();
|
||||
TransportAnimation animNode = new();
|
||||
if (animNode.TotalTime < timeSeg)
|
||||
animNode.TotalTime = timeSeg;
|
||||
|
||||
@@ -373,7 +373,7 @@ namespace Game.Maps
|
||||
}
|
||||
|
||||
// create transport...
|
||||
Transport trans = new Transport();
|
||||
Transport trans = new();
|
||||
|
||||
// ...at first waypoint
|
||||
TaxiPathNodeRecord startNode = tInfo.keyFrames.First().Node;
|
||||
@@ -512,9 +512,9 @@ namespace Game.Maps
|
||||
_transportAnimations[transportEntry].Rotations[timeSeg] = node;
|
||||
}
|
||||
|
||||
Dictionary<uint, TransportTemplate> _transportTemplates = new Dictionary<uint, TransportTemplate>();
|
||||
MultiMap<uint, uint> _instanceTransports = new MultiMap<uint, uint>();
|
||||
Dictionary<uint, TransportAnimation> _transportAnimations = new Dictionary<uint, TransportAnimation>();
|
||||
Dictionary<uint, TransportTemplate> _transportTemplates = new();
|
||||
MultiMap<uint, uint> _instanceTransports = new();
|
||||
Dictionary<uint, TransportAnimation> _transportAnimations = new();
|
||||
}
|
||||
|
||||
public class SplineRawInitializer
|
||||
@@ -588,10 +588,10 @@ namespace Game.Maps
|
||||
accelDist = 0.0f;
|
||||
}
|
||||
|
||||
public List<uint> mapsUsed = new List<uint>();
|
||||
public List<uint> mapsUsed = new();
|
||||
public bool inInstance;
|
||||
public uint pathTime;
|
||||
public List<KeyFrame> keyFrames = new List<KeyFrame>();
|
||||
public List<KeyFrame> keyFrames = new();
|
||||
public float accelTime;
|
||||
public float accelDist;
|
||||
public uint entry;
|
||||
@@ -616,8 +616,8 @@ namespace Game.Maps
|
||||
return Rotations.LookupByKey(time);
|
||||
}
|
||||
|
||||
public Dictionary<uint, TransportAnimationRecord> Path = new Dictionary<uint, TransportAnimationRecord>();
|
||||
public Dictionary<uint, TransportRotationRecord> Rotations = new Dictionary<uint, TransportRotationRecord>();
|
||||
public Dictionary<uint, TransportAnimationRecord> Path = new();
|
||||
public Dictionary<uint, TransportRotationRecord> Rotations = new();
|
||||
public uint TotalTime;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,6 +46,6 @@ namespace Game.Maps
|
||||
|
||||
public virtual void ProcessEvent(WorldObject obj, uint eventId) { }
|
||||
|
||||
protected EventMap _events = new EventMap();
|
||||
protected EventMap _events = new();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user