public static bool CreateCharacter(int UserID, string charName, byte classCode, byte heightCode, byte faceCode, byte hairCode, out Character character) { character = null; var slot = FindFreeCharacterSlot(UserID); if (slot == -1) { return(false); } CharacterSetDBEntity charSet = new CharacterSetDBEntity(classCode); character = DatabaseHelper.CreateCharacter(slot, UserID, charName, heightCode, faceCode, hairCode, charSet); return(true); }
//public static Character getCharacterEntity(CharacterDBEntity d) //{ // var c = new Character(); // c.Id = d.charID; // c.Account = new Account(d.userID); // c.ClassCode = d.classCode; // c.HeightCode = d.heightCode; // c.FaceCode = d.faceCode; // c.HairCode = d.hairCode; // c.Level = d.level; // c.Strength = d.strength; // c.Dexterity = d.dexterity; // c.Vitality = d.vitality; // c.Intelligence = d.intelligence; // c.Spirit = d.spirit; // c.SkillStat1 = d.skillStat1; // c.SkillStat2 = d.skillStat2; // c.UserPoint = d.UserPoint; // c.Experience = d.experience; // c.Hp = d.Hp; // c.MaxHp = d.MaxHp; // c.Mp = d.Mp; // c.MaxMp = d.MaxMp; // c.RemainStat = d.RemainStat; // c.RemainSkill = d.RemainSkill; // c.SelectedStyle = d.selectedStyle; // c.PkState = d.pkState; //} public static Character CreateCharacter(int slot, int userId, string charName, byte heightCode, byte faceCode, byte hairCode, CharacterSetDBEntity set) { Character c = new Character(); var inv = new Inventory(); c.Inventory = inv; c.Account = new Account(userId); c.Slot = slot; c.ClassCode = set.classCode; c.CharName = charName; c.HeightCode = heightCode; c.FaceCode = faceCode; c.HairCode = hairCode; c.Level = set.level; c.UserPoint = set.UserPoint; c.MaxHp = set.MaxHp; c.Hp = set.MaxHp; c.MaxMp = set.MaxMp; c.Mp = set.MaxMp; c.Inventory.Money = set.money; c.Experience = set.experience; c.PkState = 1; c.CharState = 1; c.StateTime = 1; c.CharacterPosition = new CharacterPosition { Region = set.region, LocationX = set.LocationX, LocationZ = set.LocationZ, LocationY = set.LocationY, Angle = 0 }; c.TitleID = null; c.TitleTime = 1; c.InvisibleOpt = 0; c.Inventory.InventoryLock = 0; c.Inventory = new Inventory { InventoryItem = set.inventoryItem, TmpInventoryItem = set.tmpInventoryItem, EquipItem = set.equipItem }; c.Skill = set.skill; c.Quick = set.quick; c.Style = set.style; c.Quest = set.quest; c.Mission = set.mission; c.RemainSkill = set.RemainSkill; c.RemainStat = set.RemainStat; c.SelectedStyle = set.selectedStyle; c.Strength = set.strength; c.Dexterity = set.dexterity; c.Vitality = set.vitality; c.Intelligence = set.intelligence; c.Spirit = set.spirit; c.SkillStat1 = set.skillStat1; c.SkillStat2 = set.skillStat2; c.PlayLimitedTime = 0; c.GuildNickName = null; c.CreationDate = DateTime.Now; c.ModifiedDate = DateTime.Now; c.LastLoginDate = DateTime.Now; c.DeleteCheck = 0; return(c); }