Пример #1
0
 // Methods
 public static Map FromId(int id)
 {
     lock (MapsManager.CheckLock)
     {
         if (MapsManager.MapId_Map.ContainsKey(id))
         {
             return MapsManager.MapId_Map[id];
         }
         string str = ((id % 10).ToString() + "/" + id.ToString() + ".dlm");
         if (MapsManager.D2pFileManager.MapExists(str))
         {
             MemoryStream stream = new MemoryStream(MapsManager.D2pFileManager.method_1(str)) { Position = 2 };
             DeflateStream stream2 = new DeflateStream(stream, CompressionMode.Decompress);
             byte[] buffer = new byte[50001];
             MemoryStream destination = new MemoryStream(buffer);
             stream2.CopyTo(destination);
             destination.Position = 0;
             BigEndianReader reader = new BigEndianReader(destination);
             Map map2 = new Map();
             map2.Init(reader);
             MapsManager.MapId_Map.Add(id, map2);
             if ((MapsManager.MapId_Map.Count > 1000))
             {
                 MapsManager.MapId_Map.Remove(MapsManager.MapId_Map.Keys.First());
             }
             return map2;
         }
         MapsManager.MapId_Map.Add(id, null);
         if ((MapsManager.MapId_Map.Count > 1000))
         {
             MapsManager.MapId_Map.Remove(MapsManager.MapId_Map.Keys.First());
         }
         return null;
     }
 }
Пример #2
0
 internal SimpleCellInfo(Map MapData, MapPoint OriginPoint, SimpleCellInfo class13_1, MapPoint mapPoint_2)
 {
     this.int_0 = 0;
     this.int_1 = 0;
     this.v_OriginPoint = OriginPoint;
     this.class13_0 = class13_1;
     this.int_1 = (mapPoint_2.DistanceToCell(OriginPoint) * 5);
     this.int_0 = (class13_1.int_0 + 10);
     if (((class13_1.class13_0 != null)))
     {
         int num2 = class13_1.class13_0.v_OriginPoint.OrientationTo(class13_1.v_OriginPoint);
         int num3 = class13_1.v_OriginPoint.OrientationTo(OriginPoint);
         int num = Math.Abs(Convert.ToInt32((num2 - num3)));
         if ((num != 0))
         {
             this.int_0 = (this.int_0 + 5);
             if (((num != 1) && (num != 7)))
             {
                 this.int_0 = (this.int_0 + 50);
             }
         }
         if ((MapData.Cells[OriginPoint.CellId].Speed == 2))
         {
             this.int_0 = (this.int_0 - 8);
         }
     }
 }