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);
        }
示例#2
0
        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 = (float)set.LocationX,
                LocationZ = (float)set.LocationZ,
                LocationY = (float)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);
        }