Code:
Exception message Input string was not in a correct format. End of exception message Stack trace System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) System.Number.ParseUInt32(String value, NumberStyles options, NumberFormatInfo numfmt) System.UInt16.Parse(String s, NumberStyles style, NumberFormatInfo info) System.Convert.ToUInt16(String value) Conquer_Online_Server.Game.Map.LoadPortals() in C:\***\****\***\****\Game\Map.cs:line 515 Conquer_Online_Server.Game.Map..ctor(UInt16 id, UInt16 baseid, String path, Boolean dynamic) in C:\***\***\****\****\Game\Map.cs:line 495 Conquer_Online_Server.Client.GameState.get_Map() in C:\***\***\***\****\Client\GameState.cs:line 967
Code:
public Map(ushort id, ushort baseid, string path, bool dynamic) { if (!ServerBase.Kernel.Maps.ContainsKey(id)) ServerBase.Kernel.Maps.Add(id, this); Npcs = new Dictionary<uint, INpc>(); Entities = new SafeDictionary<uint, Entity>(10000); Companions = new SafeDictionary<uint, Entity>(1000); ID = id; BaseID = baseid; Path = path; Floor = new Floor(0, 0, id); #region Loading floor. if (id != baseid && baseid == 700 && ArenaBaseFloor != null) { Floor = new Game.Floor(ArenaBaseFloor.Bounds.Width, ArenaBaseFloor.Bounds.Height, ID); for (ushort y = 0; y < ArenaBaseFloor.Bounds.Height; y = (ushort)(y + 1)) { for (ushort x = 0; x < ArenaBaseFloor.Bounds.Width; x = (ushort)(x + 1)) { Floor[x, y, MapObjectType.Player, null] = ArenaBaseFloor[x, y, MapObjectType.Player, null]; } } } else { if (File.Exists(ServerBase.Constants.DMapsPath + "\\maps\\" + baseid.ToString() + ".map")) { byte[] buff = File.ReadAllBytes(ServerBase.Constants.DMapsPath + "\\maps\\" + baseid.ToString() + ".map"); MemoryStream FS = new MemoryStream(buff); BinaryReader BR = new BinaryReader(FS); int Width = BR.ReadInt32(); int Height = BR.ReadInt32(); Floor = new Game.Floor(Width, Height, ID); for (ushort y = 0; y < Height; y = (ushort)(y + 1)) { for (ushort x = 0; x < Width; x = (ushort)(x + 1)) { Floor[x, y, MapObjectType.InvalidCast, null] = !(BR.ReadByte() == 1 ? true : false); } } BR.Close(); FS.Close(); } else { if (File.Exists(ServerBase.Constants.DMapsPath + Path)) { FileStream FS = new FileStream(ServerBase.Constants.DMapsPath + Path, FileMode.Open); BinaryReader BR = new BinaryReader(FS); BR.ReadBytes(268); int Width = BR.ReadInt32(); int Height = BR.ReadInt32(); Floor = new Game.Floor(Width, Height, ID); for (ushort y = 0; y < Height; y = (ushort)(y + 1)) { for (ushort x = 0; x < Width; x = (ushort)(x + 1)) { Floor[x, y, MapObjectType.InvalidCast, null] = !Convert.ToBoolean(BR.ReadUInt16()); BR.BaseStream.Seek(4L, SeekOrigin.Current); } BR.BaseStream.Seek(4L, SeekOrigin.Current); } uint amount = BR.ReadUInt32(); BR.BaseStream.Seek(amount * 12, SeekOrigin.Current); int num = BR.ReadInt32(); List<SceneFile> list = new List<SceneFile>(); for (int i = 0; i < num; i++) { switch (BR.ReadInt32()) { case 10: BR.BaseStream.Seek(0x48L, SeekOrigin.Current); break; case 15: BR.BaseStream.Seek(0x114L, SeekOrigin.Current); break; case 1: list.Add(this.CreateSceneFile(BR)); break; case 4: BR.BaseStream.Seek(0x1a0L, SeekOrigin.Current); break; } } Scenes = list.ToArray(); for (int i = 0; i < Scenes.Length; i++) { foreach (ScenePart part in Scenes[i].Parts) { for (int j = 0; j < part.Size.Width; j++) { for (int k = 0; k < part.Size.Height; k++) { Point point = new Point(); point.X = ((Scenes[i].Location.X + part.StartPosition.X) + j) - part.Size.Width; point.Y = ((Scenes[i].Location.Y + part.StartPosition.Y) + k) - part.Size.Height; Floor[(ushort)point.X, (ushort)point.Y, MapObjectType.InvalidCast, null] = part.NoAccess[j, k]; } } } } BR.Close(); FS.Close(); SaveMap(); } } } #endregion LoadNpcs(); LoadZones(); LoadMonsters(); LoadPortals(); //FloorItemTimerCallBack = new TimerCallback(_timerFloorItemCallBack); //_timerFloorItem = new Timer(FloorItemTimerCallBack, this, 10000, 2000); }