public static void Create_MyChar_Req(InPacket lea, Client gc) { string name = lea.ReadString(20); int gender = lea.ReadByte(); int value1 = lea.ReadByte(); int value2 = lea.ReadByte(); int value3 = lea.ReadByte(); int eyes = lea.ReadInt(); int hair = lea.ReadInt(); int weapon = lea.ReadInt(); int outfit = lea.ReadInt(); int seal = 8510011; Character chr = new Character(); chr.AccountID = gc.Account.ID; chr.WorldID = gc.WorldID; chr.Name = name; chr.Title = "江湖人"; chr.Level = 1; chr.Class = 0; chr.ClassLevel = 0xFF; chr.Guild = 0xFF; chr.Gender = (byte)gender; chr.Eyes = eyes; chr.Hair = hair; chr.MapX = 0; chr.MapY = 0; chr.Str = 3; chr.Dex = 3; chr.Vit = 3; chr.Int = 3; chr.Hp = 75; chr.MaxHp = 75; chr.Mp = 25; chr.MaxMp = 25; chr.Fury = 0; chr.MaxFury = 1200; chr.Exp = 0; chr.Money = 0; chr.Attack = 9; chr.MaxAttack = 11; chr.Magic = 4; chr.MaxMagic = 4; chr.Defense = 12; chr.JumpHeight = 3; int pos = 1; foreach (Character cc in gc.Account.Characters) { if (cc.Position != pos) { break; } pos++; } chr.Position = (byte)(pos); chr.Items.Add(new Item(weapon, (byte)(InventoryType.ItemType.Equip), (byte)InventoryType.EquipType.Weapon)); chr.Items.Add(new Item(outfit, (byte)(InventoryType.ItemType.Equip), (byte)InventoryType.EquipType.Outfit)); chr.Items.Add(new Item(seal, (byte)(InventoryType.ItemType.Equip), (byte)InventoryType.EquipType.Seal)); chr.Items.Add(new Item(8810011, (byte)InventoryType.ItemType.Spend3, 0, 10)); chr.Items.Add(new Item(8820011, (byte)InventoryType.ItemType.Spend3, 1, 10)); chr.Storages.Add(new Storage(0)); chr.Skills.Add(new Skill(1, 1, 0, 0)); chr.Skills.Add(new Skill(2, 1, 0, 1)); chr.Skills.Add(new Skill(3, 1, 0, 2)); chr.Skills.Add(new Skill(4, 1, 0, 3)); chr.Keymap.Add("Z", new Shortcut(1, 0, 0)); chr.Keymap.Add("X", new Shortcut(4, 0, 3)); chr.Keymap.Add("C", new Shortcut(3, 0, 2)); chr.UseSlot.Add((byte)InventoryType.ItemType.Spend3, 0xFF); chr.UseSlot.Add((byte)InventoryType.ItemType.Pet5, 0xFF); if ((gc.Account.Characters.Count + 1) <= 4) { chr.Save(); gc.Account.Characters.Insert(pos - 1, chr); pos = (chr.Position << 8) + 1; } else if (Database.Exists("Characters", "name = '{0}'", name)) { pos = -1; } else if ((gc.Account.Characters.Count + 1) > 4) { pos = -2; } else { pos = 0; } CharPacket.Create_MyChar_Ack(gc, pos); }
public static void Create_MyChar_Req(InPacket lea, Client gc) { string name = lea.ReadString(20); int gender = lea.ReadByte(); int value1 = lea.ReadByte(); int value2 = lea.ReadByte(); int value3 = lea.ReadByte(); int eyes = lea.ReadInt(); int hair = lea.ReadInt(); int weapon = lea.ReadInt(); int outfit = lea.ReadInt(); int job = lea.ReadByte(); int seal = 8510011; /* * Private * [05 01 ] [0A 00 38 00] [47 01 01 00] 00 00 Header * 4E 69 6E 6A 61 35 35 35 35 CharacterName * 00 00 00 00 00 00 00 00 00 00 00 Empty * 01 E7 19 00 // Unknow * DD A1 8B 00 // Eye = * D1 18 8A 00 // hair = * 3C 87 7A 00 // weapon 8030012 * 01 00 7D 00 // Outfit 8192001 * 02 00 00 00 * */ Log.Inform(">> Create Character"); Log.Debug(">> Character Name: {0} Gender : {1} Value1 : {2} Value2 : {3} Value3 : {4}", name, gender, value1, value2, value3); Log.Debug(">> Character ITEM : Eye : {0} Hair: {1} Weapon: {2} Outfit: {3} Job: {4}", eyes, hair, weapon, outfit, job); var account_id = gc.Account.ID; if (gender != 1 && gender != 2) { account_id = 0; gc.Dispose(); } // Hack Check int DefaultCharacterLevel = 1; if (job >= 6 && job < 12) { DefaultCharacterLevel = 60; } if (job < 1 || job > 11) { job = 0; account_id = 0; gc.Dispose(); } Character chr = new Character(); chr.AccountID = account_id; chr.WorldID = gc.WorldID; chr.Name = name; chr.Title = "Kanghoin"; chr.Level = (byte)DefaultCharacterLevel; chr.Class = 0; chr.ClassLevel = 0xFF; chr.Guild = 0xFF; chr.Gender = (byte)gender; chr.Job = job; chr.Eyes = eyes; chr.Hair = hair; chr.MapX = 0; chr.MapY = 0; chr.Str = 3; chr.Dex = 3; chr.Vit = 3; chr.Int = 3; chr.Hp = 75; chr.MaxHp = 75; chr.Mp = 25; chr.MaxMp = 25; chr.Fury = 0; chr.MaxFury = 1200; chr.Exp = 0; chr.Money = 0; chr.Attack = 9; chr.MaxAttack = 11; chr.Magic = 4; chr.MaxMagic = 4; chr.Defense = 12; chr.JumpHeight = 3; int pos = 1; foreach (Character cc in gc.Account.Characters) { if (cc.Position != pos) { break; } pos++; } chr.Position = (byte)(pos); chr.Items.Add( new Item(weapon, (byte)(InventoryType.ItemType.Equip), (byte)InventoryType.EquipType.Weapon)); chr.Items.Add( new Item(outfit, (byte)(InventoryType.ItemType.Equip), (byte)InventoryType.EquipType.Outfit)); chr.Items.Add(new Item(seal, (byte)(InventoryType.ItemType.Equip), (byte)InventoryType.EquipType.Seal)); chr.Items.Add(new Item(8810011, (byte)InventoryType.ItemType.Spend3, 0, 10)); chr.Items.Add(new Item(8820011, (byte)InventoryType.ItemType.Spend3, 1, 10)); chr.Storages.Add(new Storage(0)); chr.Skills.Add(new Skill(1, 1, 0, 0)); chr.Skills.Add(new Skill(2, 1, 0, 1)); chr.Skills.Add(new Skill(3, 1, 0, 2)); chr.Skills.Add(new Skill(4, 1, 0, 3)); chr.Keymap.Add("Z", new Shortcut(1, 0, 0)); chr.Keymap.Add("X", new Shortcut(4, 0, 3)); chr.Keymap.Add("C", new Shortcut(3, 0, 2)); chr.UseSlot.Add((byte)InventoryType.ItemType.Spend3, 0xFF); chr.UseSlot.Add((byte)InventoryType.ItemType.Pet5, 0xFF); Log.Debug("[Create_MyChar_Req] total char = '{0}'", gc.Account.Characters.Count); if ((gc.Account.Characters.Count + 1) <= 4) { Log.Debug("[Create_MyChar_Req] trying to save '{0}' to DB", name); chr.Save(); gc.Account.Characters.Insert(pos - 1, chr); pos = (chr.Position << 8) + 1; Log.Debug("[Create_MyChar_Req] save status is: '{0}'", pos); } else if (Database.Exists("Characters", "name = '{0}'", name)) { Log.Debug("[Create_MyChar_Req] user exist: '{0}'", name); pos = -1; } else if ((gc.Account.Characters.Count + 1) > 4) { Log.Debug("[Create_MyChar_Req] user maxed: {0} - total 4/4: '{0}'", name); pos = -2; } else { Log.Debug("[Create_MyChar_Req] unknown error during save: '{0}'", name); pos = 0; } Log.Debug("Send Create_MyChar_Ack: '{0}'", name); CharPacket.Create_MyChar_Ack(gc, pos); }