internal static byte[] GetMapMarkerZoneId(ushort zoneId, ushort subMapId = 0) { List <byte> bl = BitConverter.GetBytes(zoneId).Reverse <byte>().ToList <byte>(); IEnumerable <ushort> mapIds = GameResources.GetMapIds(zoneId); if (subMapId != 0 && mapIds.Contains(subMapId)) { bl.AddRange(BitConverter.GetBytes(subMapId).Reverse <byte>().ToList <byte>()); } else { bl.AddRange(BitConverter.GetBytes(mapIds.Min <ushort>()).Reverse <byte>().ToList <byte>()); } bl.RemoveAll((byte x) => x == 0); switch (bl.Count) { case 2: bl.Insert(0, 244); break; case 3: bl.Insert(0, 252); break; case 4: bl.Insert(0, 254); break; } return(bl.ToArray()); }
public static ushort GetSizeFactor(ushort zoneId, ushort mapId = 0) { if (mapId == 0) { mapId = GameResources.GetMapIds(zoneId).Min <ushort>(); } if (GameResources.CachedSizeFactors.ContainsKey(mapId)) { return(GameResources.CachedSizeFactors[mapId]); } ushort x; if (ushort.TryParse(Resources.Map.Split(GameResources.lineEnding, StringSplitOptions.RemoveEmptyEntries).Skip(3).ElementAt((int)mapId).Split(',', StringSplitOptions.None)[8], out x)) { GameResources.CachedSizeFactors.Add(mapId, x); return(x); } return(0); }