Official 5165 FAQ/Question thread

02/21/2010 22:16 killersub#1051
So I got this problem a few days back...everytime a new account is born he/she gets the King/queen rank and is automatically leveled to 137 and has like 20k+ att points...I dunno wat I did but it diddn't do this before ...any help I NEED IT!
02/21/2010 22:33 Arcо#1052
Quote:
Originally Posted by killersub View Post
So I got this problem a few days back...everytime a new account is born he/she gets the King/queen rank and is automatically leveled to 137 and has like 20k+ att points...I dunno wat I did but it diddn't do this before ...any help I NEED IT!
What have you done to the create character void in database,cs?
02/21/2010 22:38 Hero0o#1053
Quote:
Originally Posted by xSynthesis View Post

First thing is you should use your current ip address.

[Only registered and activated users can see links. Click Here To Register...]

and use "9958" as a port. Not 9985.
i did all things and now it take 10 min and at last gives me faild to connect to server
EDIT:it say server is off when i use my ip in server.dat and when i use 127.0.0.1 it take like 10 min and i get faild to connect to server any advice for that?
02/21/2010 22:50 killersub#1054
Quote:
Originally Posted by .Arco View Post
What have you done to the create character void in database,cs?
what do you mean? Idk what I touched I jus wanna kno how to fix it...just tell me if you need me to post my character.cs file
02/21/2010 22:52 Arcо#1055
Quote:
Originally Posted by killersub View Post
what do you mean? Idk what I touched I jus wanna kno how to fix it...just tell me if you need me to post my character.cs file
It's not character.cs its your CreateCharacter void thats messed up, its setting defaults to be crazy high.

Post your entire CreateCharacter void.
02/21/2010 23:01 killersub#1056
Quote:
Originally Posted by .Arco View Post
It's not character.cs its your CreateCharacter void thats messed up, its setting defaults to be crazy high.

Post your entire CreateCharacter void.
lol the most noobish question but where do i find that at XD

EDIT: I found it here it is:

Code:
public static string CreateCharacter(string Account, string Name, ushort Body, byte Job)
        {
            try
            {
                if (File.Exists(@"C:\OldCODB\Users\" + Account + ".usr") && !File.Exists(@"C:\OldCODB\Users\Characters\" + Name + ".chr"))
                {
                    try
                    {
                        FileStream FS = new FileStream(@"C:\OldCODB\Users\Characters\" + Name + ".chr", FileMode.CreateNew);
                        BinaryWriter BW = new BinaryWriter(FS);
                        BW.Write(Account);
                        BW.Write((uint)Program.Rnd.Next(1000001, 19999999));

                        if (Body == 1003 || Body == 1004)
                            BW.Write((ushort)1);//Avatar
                        else
                            BW.Write((ushort)201);//Avatar

                        BW.Write(Body);
                        BW.Write((ushort)(410 + (Program.Rnd.Next(5) * 100)));//Hair
                        BW.Write((ushort)1010);//Map
                        BW.Write((ushort)61);//X
                        BW.Write((ushort)109);//Y
                        BW.Write((ushort)0);//Previous Map
                        BW.Write(Job);
                        BW.Write((byte)0);//Previous Job, 1st RB
                        BW.Write((byte)1);//Level
                        BW.Write((ulong)0);//Experience

                        ushort Str = 0, Agi = 0, Vit = 0, Spi = 0;
                        GetInitialStats(Job, ref Str, ref Agi, ref Vit, ref Spi);

                        BW.Write(Str);
                        BW.Write(Agi);
                        BW.Write(Vit);
                        BW.Write(Spi);
                        BW.Write((ushort)0);//Stat Points
                        ushort HP = (ushort)(Vit * 24 + Str * 3 + Agi * 3 + Spi * 3);
                        BW.Write(HP);
                        BW.Write((ushort)(Spi * 5));//MP
                        BW.Write((ulong)0);//Donation
                        BW.Write((uint)100);//Silvers
                        BW.Write((uint)0);//CPs
                        BW.Write((uint)0);//Warehouse Silvers
                        BW.Write((ulong)0);//Virtue Points
                        BW.Write((ushort)0);//PK Points
                        BW.Write((ushort)0);//Guild
                        BW.Write((uint)0);//Guild Donation
                        BW.Write((byte)0);//Guild Rank
                        Game.Equipment Eq = new NewestCOServer.Game.Equipment();
                        Eq.Open();
                        Eq.WriteThis(BW);
                        BW.Write((byte)5);//Inventory Count
                        #region Beginner Items
                        if (Job == 100)
                        {
                            Game.Item I = new NewestCOServer.Game.Item();
                            I.ID = 421301;
                            I.MaxDur = ((DatabaseItem)DatabaseItems[(uint)421301]).Durability;
                            I.CurDur = I.MaxDur;
                            I.UID = (uint)Program.Rnd.Next(10000000);
                            I.WriteThis(BW);
                        }
                        else if (Job == 50)
                        {
                            Game.Item I = new NewestCOServer.Game.Item();
                            I.ID = 601301;
                            I.MaxDur = ((DatabaseItem)DatabaseItems[(uint)601301]).Durability;
                            I.CurDur = I.MaxDur;
                            I.UID = (uint)Program.Rnd.Next(10000000);
                            I.WriteThis(BW);
                        }
                        else
                        {
                            Game.Item I = new NewestCOServer.Game.Item();
                            I.ID = 410301;
                            I.MaxDur = ((DatabaseItem)DatabaseItems[(uint)410301]).Durability;
                            I.CurDur = I.MaxDur;
                            I.UID = (uint)Program.Rnd.Next(10000000);
                            I.WriteThis(BW);
                        }
                        Game.Item Armor = new NewestCOServer.Game.Item();
                        Armor.ID = 132004;
                        Armor.Color = (Game.Item.ArmorColor)(Program.Rnd.Next(3, 9));
                        Armor.MaxDur = ((DatabaseItem)DatabaseItems[(uint)132004]).Durability;
                        Armor.CurDur = Armor.MaxDur;
                        Armor.UID = (uint)Program.Rnd.Next(10000000);
                        Armor.WriteThis(BW);
                        Game.Item Stancher = new NewestCOServer.Game.Item();
                        Stancher.ID = 1000000;
                        Stancher.UID = (uint)Program.Rnd.Next(10000000);
                        Stancher.WriteThis(BW);
                        Stancher.UID = (uint)Program.Rnd.Next(10000000);
                        Stancher.WriteThis(BW);
                        Stancher.UID = (uint)Program.Rnd.Next(10000000);
                        Stancher.WriteThis(BW);
                        #endregion
                        for (int n = 0; n < 5; n++)
                        {
                            BW.Write((byte)0);//WH[n] Count
                            //Warehouse[n]
                        }
                        BW.Write((byte)0);//WH[5] Count
                        //Warehouse[5]

                        BW.Write((byte)0);//Prof Count

                        if (Job != 100)
                            BW.Write((byte)0);//SkillCount
                        else
                        {
                            BW.Write((byte)2);//SkillCount
                            Game.Skill S = new Game.Skill() { ID = 1000 };
                            S.WriteThis(BW);
                            S = new Game.Skill() { ID = 1005 };
                            S.WriteThis(BW);
                        }

                        BW.Write((byte)0);//Friend Count
                        BW.Write((byte)0);//Enemy Count


                        BW.Write(false);
                        BW.Write((int)0);
                        BW.Write((int)0);
                        BW.Write((long)0);
                        BW.Write((int)0);
                        BW.Write((byte)0);
                        BW.Write((byte)0);
                        BW.Write((byte)1);//Merchant
                        BW.Write(0);//  
                        BW.Write(DateTime.Now.Ticks);
                        BW.Write((ushort)0);
                        BW.Write(false);
                        BW.Write((byte)0);//lottery uses today
                        BW.Write((byte)0);
                        BW.Write("0");//WH Pass
                        BW.Write("None");//Spouse Name
                        BW.Write((uint)0);//Quiz Pts                    
                        BW.Write((int)0);//TopEffect
                        BW.Flush();
                        FS.Flush();

                        BW.Close();
                        FS.Close();
                        FS = new FileStream(@"C:\OldCODB\Users\" + Account + ".usr", FileMode.Append);
                        BW = new BinaryWriter(FS);
                        BW.Write((byte)Name.Length);
                        BW.Write(Encoding.ASCII.GetBytes(Name));
                        BW.Flush();
                        FS.Flush();
                        BW.Close();
                        FS.Close();
                        Game.Character C = LoadCharacter(Name, ref Account);
                        if (C != null)
                        {
                            C.UniversityPoints = 0;
                            SaveCharacter(C, Account);
                        }
                    }
                    catch { return "Error! Try again."; }
                    return "ANSWER_OK";
                }
                return "Error: Character already exists!";

            }
            catch (Exception Exc) { Console.WriteLine(Exc); return "Failed to create the character."; }
        }
02/21/2010 23:07 Arcо#1057
Quote:
Originally Posted by killersub View Post
lol the most noobish question but where do i find that at XD

EDIT: I found it here it is:

Code:
public static string CreateCharacter(string Account, string Name, ushort Body, byte Job)
        {
            try
            {
                if (File.Exists(@"C:\OldCODB\Users\" + Account + ".usr") && !File.Exists(@"C:\OldCODB\Users\Characters\" + Name + ".chr"))
                {
                    try
                    {
                        FileStream FS = new FileStream(@"C:\OldCODB\Users\Characters\" + Name + ".chr", FileMode.CreateNew);
                        BinaryWriter BW = new BinaryWriter(FS);
                        BW.Write(Account);
                        BW.Write((uint)Program.Rnd.Next(1000001, 19999999));

                        if (Body == 1003 || Body == 1004)
                            BW.Write((ushort)1);//Avatar
                        else
                            BW.Write((ushort)201);//Avatar

                        BW.Write(Body);
                        BW.Write((ushort)(410 + (Program.Rnd.Next(5) * 100)));//Hair
                        BW.Write((ushort)1010);//Map
                        BW.Write((ushort)61);//X
                        BW.Write((ushort)109);//Y
                        BW.Write((ushort)0);//Previous Map
                        BW.Write(Job);
                        BW.Write((byte)0);//Previous Job, 1st RB
                        BW.Write((byte)1);//Level
                        BW.Write((ulong)0);//Experience

                        ushort Str = 0, Agi = 0, Vit = 0, Spi = 0;
                        GetInitialStats(Job, ref Str, ref Agi, ref Vit, ref Spi);

                        BW.Write(Str);
                        BW.Write(Agi);
                        BW.Write(Vit);
                        BW.Write(Spi);
                        BW.Write((ushort)0);//Stat Points
                        ushort HP = (ushort)(Vit * 24 + Str * 3 + Agi * 3 + Spi * 3);
                        BW.Write(HP);
                        BW.Write((ushort)(Spi * 5));//MP
                        BW.Write((ulong)0);//Donation
                        BW.Write((uint)100);//Silvers
                        BW.Write((uint)0);//CPs
                        BW.Write((uint)0);//Warehouse Silvers
                        BW.Write((ulong)0);//Virtue Points
                        BW.Write((ushort)0);//PK Points
                        BW.Write((ushort)0);//Guild
                        BW.Write((uint)0);//Guild Donation
                        BW.Write((byte)0);//Guild Rank
                        Game.Equipment Eq = new NewestCOServer.Game.Equipment();
                        Eq.Open();
                        Eq.WriteThis(BW);
                        BW.Write((byte)5);//Inventory Count
                        #region Beginner Items
                        if (Job == 100)
                        {
                            Game.Item I = new NewestCOServer.Game.Item();
                            I.ID = 421301;
                            I.MaxDur = ((DatabaseItem)DatabaseItems[(uint)421301]).Durability;
                            I.CurDur = I.MaxDur;
                            I.UID = (uint)Program.Rnd.Next(10000000);
                            I.WriteThis(BW);
                        }
                        else if (Job == 50)
                        {
                            Game.Item I = new NewestCOServer.Game.Item();
                            I.ID = 601301;
                            I.MaxDur = ((DatabaseItem)DatabaseItems[(uint)601301]).Durability;
                            I.CurDur = I.MaxDur;
                            I.UID = (uint)Program.Rnd.Next(10000000);
                            I.WriteThis(BW);
                        }
                        else
                        {
                            Game.Item I = new NewestCOServer.Game.Item();
                            I.ID = 410301;
                            I.MaxDur = ((DatabaseItem)DatabaseItems[(uint)410301]).Durability;
                            I.CurDur = I.MaxDur;
                            I.UID = (uint)Program.Rnd.Next(10000000);
                            I.WriteThis(BW);
                        }
                        Game.Item Armor = new NewestCOServer.Game.Item();
                        Armor.ID = 132004;
                        Armor.Color = (Game.Item.ArmorColor)(Program.Rnd.Next(3, 9));
                        Armor.MaxDur = ((DatabaseItem)DatabaseItems[(uint)132004]).Durability;
                        Armor.CurDur = Armor.MaxDur;
                        Armor.UID = (uint)Program.Rnd.Next(10000000);
                        Armor.WriteThis(BW);
                        Game.Item Stancher = new NewestCOServer.Game.Item();
                        Stancher.ID = 1000000;
                        Stancher.UID = (uint)Program.Rnd.Next(10000000);
                        Stancher.WriteThis(BW);
                        Stancher.UID = (uint)Program.Rnd.Next(10000000);
                        Stancher.WriteThis(BW);
                        Stancher.UID = (uint)Program.Rnd.Next(10000000);
                        Stancher.WriteThis(BW);
                        #endregion
                        for (int n = 0; n < 5; n++)
                        {
                            BW.Write((byte)0);//WH[n] Count
                            //Warehouse[n]
                        }
                        BW.Write((byte)0);//WH[5] Count
                        //Warehouse[5]

                        BW.Write((byte)0);//Prof Count

                        if (Job != 100)
                            BW.Write((byte)0);//SkillCount
                        else
                        {
                            BW.Write((byte)2);//SkillCount
                            Game.Skill S = new Game.Skill() { ID = 1000 };
                            S.WriteThis(BW);
                            S = new Game.Skill() { ID = 1005 };
                            S.WriteThis(BW);
                        }

                        BW.Write((byte)0);//Friend Count
                        BW.Write((byte)0);//Enemy Count


                        BW.Write(false);
                        BW.Write((int)0);
                        BW.Write((int)0);
                        BW.Write((long)0);
                        BW.Write((int)0);
                        BW.Write((byte)0);
                        BW.Write((byte)0);
                        BW.Write((byte)1);//Merchant
                        BW.Write(0);//  
                        BW.Write(DateTime.Now.Ticks);
                        BW.Write((ushort)0);
                        BW.Write(false);
                        BW.Write((byte)0);//lottery uses today
                        BW.Write((byte)0);
                        BW.Write("0");//WH Pass
                        BW.Write("None");//Spouse Name
                        BW.Write((uint)0);//Quiz Pts                    
                        BW.Write((int)0);//TopEffect
                        BW.Flush();
                        FS.Flush();

                        BW.Close();
                        FS.Close();
                        FS = new FileStream(@"C:\OldCODB\Users\" + Account + ".usr", FileMode.Append);
                        BW = new BinaryWriter(FS);
                        BW.Write((byte)Name.Length);
                        BW.Write(Encoding.ASCII.GetBytes(Name));
                        BW.Flush();
                        FS.Flush();
                        BW.Close();
                        FS.Close();
                        Game.Character C = LoadCharacter(Name, ref Account);
                        if (C != null)
                        {
                            C.UniversityPoints = 0;
                            SaveCharacter(C, Account);
                        }
                    }
                    catch { return "Error! Try again."; }
                    return "ANSWER_OK";
                }
                return "Error: Character already exists!";

            }
            catch (Exception Exc) { Console.WriteLine(Exc); return "Failed to create the character."; }
        }

What all have you added to this?
02/21/2010 23:07 sneaky06#1058
need help i can't log in server when ichange port to 9958 it says failed to connect and when i use the other one it just exit need help plz
02/21/2010 23:12 Hero0o#1059
Quote:
Originally Posted by sneaky06 View Post
need help i can't log in server when ichange port to 9958 it says failed to connect and when i use the other one it just exit need help plz
i need the same help
02/21/2010 23:20 killersub#1060
Quote:
Originally Posted by .Arco View Post
What all have you added to this?
nothing at all why?
It worked fine before but now idk why
02/21/2010 23:22 Arcо#1061
Quote:
Originally Posted by killersub View Post
nothing at all why?
It worked fine before but now idk why
Are you sure you didnt follow some guide that told you to add something there?
02/21/2010 23:24 killersub#1062
Quote:
Originally Posted by .Arco View Post
Are you sure you didnt follow some guide that told you to add something there?
positive...this was like that since I got the source...anyways Im going to try backing it up with another 5165 createcharacter that is the same but probably can fix the error ill tell u the results

EDIT: nope still the same error...idk why I dont think it's there then...any help?
02/21/2010 23:57 Hero0o#1063
why u throw away my posts i need help too :( i have made all things right and when i try to log in it say faild to connect to server using my external ip "9958" port
02/22/2010 00:10 Arcо#1064
Quote:
Originally Posted by Hero0o View Post
why u throw away my posts i need help too :( i have made all things right and when i try to log in it say faild to connect to server using my external ip "9958" port
Port forward all these ports:
9958
5816
5817(?)
80
8080

Then try it.
02/22/2010 00:19 Hero0o#1065
Quote:
Originally Posted by .Arco View Post
Port forward all these ports:
9958
5816
5817(?)
80
8080

Then try it.
same problem "faild" :(