Register for your free account! | Forgot your password?

You last visited: Today at 17:08

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



StringToNumber

Discussion on StringToNumber within the CO2 Private Server forum part of the Conquer Online 2 category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Oct 2010
Posts: 47
Received Thanks: 2
Question StringToNumber

Could someone explain to me what this is telling me? I understand it's something with the Map.cs file however I haven't found any issue on it. A little confusing. I'll post the part of the Map.cs file where the error leads to.

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);
        }



bryce16 is offline  
Old 03/23/2012, 23:12   #2
 
elite*gold: 12
Join Date: Jul 2011
Posts: 7,414
Received Thanks: 3,624
There's something wrong with how it's loading portals.
"Conquer_Online_Server.Game.Map.LoadPortals() in C:\***\****\***\****\Game\Map.cs:line 515"

We can't help you without that void. I think Kiyono posted something about portals not to long ago. Try looking for that. It was one or two days ago I think.


Spirited is offline  
Old 03/23/2012, 23:20   #3
 
elite*gold: 0
Join Date: Oct 2010
Posts: 47
Received Thanks: 2
Quote:
Originally Posted by Fаng View Post
There's something wrong with how it's loading portals.
"Conquer_Online_Server.Game.Map.LoadPortals() in C:\***\****\***\****\Game\Map.cs:line 515"

We can't help you without that void. I think Kiyono posted something about portals not to long ago. Try looking for that. It was one or two days ago I think.
Alright thanks, If there's any more information required for this post let me know.
bryce16 is offline  
Old 03/23/2012, 23:30   #4
 
elite*gold: 12
Join Date: Jul 2011
Posts: 7,414
Received Thanks: 3,624
Quote:
Originally Posted by bryce16 View Post
Alright thanks, If there's any more information required for this post let me know.
Yeah, first - try looking for that post by Kiyono. Look at his posts from his profile. You'll be sure to find it. I'm not sure if it's meant for your source but I think it is. If you post the line that I mentioned with the void that it belongs to, maybe we could figure it out. I'm not really into public sources that much. Kiyono is though.


Spirited is offline  
Old 03/23/2012, 23:34   #5
 
elite*gold: 28
Join Date: Jun 2010
Posts: 2,215
Received Thanks: 864
Your portals.txt file is incorrect, download the source again and copy the file over into your current source's database, will work like a baws.
_DreadNought_ is offline  
Thanks
1 User
Old 03/24/2012, 00:09   #6
 
elite*gold: 0
Join Date: Oct 2010
Posts: 47
Received Thanks: 2
I should be active more, you guys are hella dedicated. Thanks.
I'm actually not really into public sources either, But hey, Gotta start off somewhere.

PS: Fang I din't get lucky. I din't find any threads of his regarding portals by Kiyono. Thanks anyway though.
bryce16 is offline  
Old 03/24/2012, 12:49   #7
 
elite*gold: 20
Join Date: Jun 2006
Posts: 3,293
Received Thanks: 919
Quote:
Originally Posted by Fаng View Post
We can't help you without that void. I think Kiyono posted something about portals not to long ago. Try looking for that. It was one or two days ago I think.
This is incorrect. I think it was lostsolder05 that posted something about it.


Kiyono is offline  
Reply



« [Help] with source 5530 | Hi I am confuse about this Weapon Master »



All times are GMT +2. The time now is 17:08.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.

BTC: 33E6kMtxYa7dApCFzrS3Jb7U3NrVvo8nsK
ETH: 0xc6ec801B7563A4376751F33b0573308aDa611E05

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2019 elitepvpers All Rights Reserved.