/// <summary> /// Enqueue <see cref="GridEntity"/> to be added to a map. /// </summary> public static void AddToMap(GridEntity entity, ushort worldId, Vector3 vector3) { WorldEntry entry = GameTableManager.World.GetEntry(worldId); if (entry == null) { throw new ArgumentException(); } if (maps.TryGetValue(worldId, out BaseMap map)) { map.EnqueueAdd(entity, vector3); } else { var newMap = new BaseMap(entry); newMap.EnqueueAdd(entity, vector3); maps.Add(worldId, newMap); } }
/// <summary> /// Create and store base <see cref="IMap"/> of <see cref="MapInfo"/>. /// </summary> private IMap CreateBaseMap(MapInfo info) { if (maps.TryGetValue((ushort)info.Entry.Id, out IMap map)) { return(map); } switch (info.Entry.Type) { case 5: map = new InstancedMap <ResidenceMap>(); break; default: map = new BaseMap(); break; } map.Initialise(info, null); maps.Add((ushort)info.Entry.Id, map); return(map); }