internal Character(CharacterManager characterManager, PlayerCharacterDto dto) { CharacterManager = characterManager; Weapons = new WeaponManager(this, dto); Skills = new SkillManager(this, dto); Costumes = new CostumeManager(this, dto); var defaultItems = GameServer.Instance.ResourceCache.GetDefaultItems(); ExistsInDatabase = true; Id = dto.Id; Slot = dto.Slot; Gender = (CharacterGender)dto.Gender; Hair = defaultItems.Get(Gender, CostumeSlot.Hair, dto.BasicHair); Face = defaultItems.Get(Gender, CostumeSlot.Face, dto.BasicFace); Shirt = defaultItems.Get(Gender, CostumeSlot.Shirt, dto.BasicShirt); Pants = defaultItems.Get(Gender, CostumeSlot.Pants, dto.BasicPants); Gloves = defaultItems.Get(Gender, CostumeSlot.Gloves, 0); Shoes = defaultItems.Get(Gender, CostumeSlot.Shoes, 0); }
public Player(GameSession session, Account account, PlayerDto dto) { Session = session; Account = account; _tutorialState = dto.TutorialState; _level = dto.Level; _totalExperience = (uint)dto.TotalExperience; _pen = (uint)dto.PEN; _ap = (uint)dto.AP; _coins1 = (uint)dto.Coins1; _coins2 = (uint)dto.Coins2; Settings = new PlayerSettingManager(this, dto); DenyManager = new DenyManager(this, dto); Mailbox = new Mailbox(this, dto); LicenseManager = new LicenseManager(this, dto); Inventory = new Inventory(this, dto); CharacterManager = new CharacterManager(this, dto); RoomInfo = new PlayerRoomInfo(); }
internal Character(CharacterManager characterManager, byte slot, CharacterGender gender, byte hair, byte face, byte shirt, byte pants) { CharacterManager = characterManager; Weapons = new WeaponManager(this); Skills = new SkillManager(this); Costumes = new CostumeManager(this); Id = CharacterIdGenerator.GetNextId(); Slot = slot; Gender = gender; var defaultItems = GameServer.Instance.ResourceCache.GetDefaultItems(); Hair = defaultItems.Get(Gender, CostumeSlot.Hair, hair); Face = defaultItems.Get(Gender, CostumeSlot.Face, face); Shirt = defaultItems.Get(Gender, CostumeSlot.Shirt, shirt); Pants = defaultItems.Get(Gender, CostumeSlot.Pants, pants); Gloves = defaultItems.Get(Gender, CostumeSlot.Gloves, 0); Shoes = defaultItems.Get(Gender, CostumeSlot.Shoes, 0); }
/// <summary> /// Saves all pending changes to the database /// </summary> public void Save() { using (var db = GameDatabase.Open()) { if (NeedsToSave) { db.Update(new PlayerDto { Id = (int)Account.Id, TutorialState = TutorialState, Level = Level, TotalExperience = (int)TotalExperience, PEN = (int)PEN, AP = (int)AP, Coins1 = (int)Coins1, Coins2 = (int)Coins2, CurrentCharacterSlot = CharacterManager.CurrentSlot }); NeedsToSave = false; } Settings.Save(db); Inventory.Save(db); CharacterManager.Save(db); LicenseManager.Save(db); DenyManager.Save(db); Mailbox.Save(db); DeathMatch.Save(db); TouchDown.Save(db); Chasser.Save(db); BattleRoyal.Save(db); CaptainMode.Save(db); Mission.Save(db); } }