public Player(ClientProcessor psr) : base((short)psr.Character.ObjectType, psr.Random) { this.psr = psr; statsMgr = new StatsManager(this); switch(psr.Account.Rank) { case 0: Name = psr.Account.Name; break; case 1: Name = "[P] " + psr.Account.Name; break; case 2: Name = "[Helper] " + psr.Account.Name; break; case 3: Name = "[GM] " + psr.Account.Name; break; case 4: Name = "[Dev] " + psr.Account.Name; break; case 5: Name = "[HDev] " + psr.Account.Name; break; case 6: Name = "[CM] " + psr.Account.Name; break; case 7: Name = "[Founder] " + psr.Account.Name; break; } nName = psr.Account.Name; AccountId = psr.Account.AccountId; Level = psr.Character.Level; Experience = psr.Character.Exp; ExperienceGoal = GetExpGoal(psr.Character.Level); if (psr.Account.Rank > 2) Stars = 75; else if (psr.Account.Rank > 1) Stars = 60; else Stars = GetStars(); //Temporary (until pub server) Texture1 = psr.Character.Tex1; Texture2 = psr.Character.Tex2; Credits = psr.Account.Credits; NameChosen = psr.Account.NameChosen; CurrentFame = psr.Account.Stats.Fame; Fame = psr.Character.CurrentFame; var state = psr.Account.Stats.ClassStates.SingleOrDefault(_ => _.ObjectType == ObjectType); if (state != null) FameGoal = GetFameGoal(state.BestFame); else FameGoal = GetFameGoal(0); Glowing = false; Guild = psr.Account.Guild.Name; GuildRank = psr.Account.Guild.Rank; if (psr.Character.HitPoints <= 0) { HP = psr.Character.MaxHitPoints; psr.Character.HitPoints = psr.Character.MaxHitPoints; } else HP = psr.Character.HitPoints; MP = psr.Character.MagicPoints; ConditionEffects = 0; OxygenBar = 100; Decision = 0; combs = new Combinations(); price = new Prices(); Locked = psr.Account.Locked != null ? psr.Account.Locked : new List<int>(); Ignored = psr.Account.Ignored != null ? psr.Account.Ignored : new List<int>(); using (Database dbx = new Database()) { Locked = dbx.getLockeds(this.AccountId); Ignored = dbx.getIgnoreds(this.AccountId); } Inventory = psr.Character.Equipment.Select(_ => _ == -1 ? null : (XmlDatas.ItemDescs.ContainsKey(_) ? XmlDatas.ItemDescs[_] : null)).ToArray(); SlotTypes = Utils.FromCommaSepString32(XmlDatas.TypeToElement[ObjectType].Element("SlotTypes").Value); Stats = new int[] { psr.Character.MaxHitPoints, psr.Character.MaxMagicPoints, psr.Character.Attack, psr.Character.Defense, psr.Character.Speed, psr.Character.HpRegen, psr.Character.MpRegen, psr.Character.Dexterity, }; Pet = null; }
public Player(Client client) : base((short)client.Character.ObjectType, client.Random) { this.client = client; statsMgr = new StatsManager(this); nName = client.Account.Name; AccountId = client.Account.AccountId; Level = client.Character.Level; Experience = client.Character.Exp; ExperienceGoal = GetExpGoal(client.Character.Level); Stars = GetStars(); //Temporary (until pub server) Texture1 = client.Character.Tex1; Texture2 = client.Character.Tex2; Credits = client.Account.Credits; NameChosen = client.Account.NameChosen; CurrentFame = client.Account.Stats.Fame; Fame = client.Character.CurrentFame; var state = client.Account.Stats.ClassStates.SingleOrDefault(_ => _.ObjectType == ObjectType); if (state != null) FameGoal = GetFameGoal(state.BestFame); else FameGoal = GetFameGoal(0); Glowing = false; Guild = client.Account.Guild.Name; GuildRank = client.Account.Guild.Rank; if (client.Character.HitPoints <= 0) { HP = client.Character.MaxHitPoints; client.Character.HitPoints = client.Character.MaxHitPoints; } else HP = client.Character.HitPoints; MP = client.Character.MagicPoints; ConditionEffects = 0; OxygenBar = 100; Decision = 0; combs = new Combinations(); price = new Prices(); Locked = client.Account.Locked != null ? client.Account.Locked : new List<int>(); Ignored = client.Account.Ignored != null ? client.Account.Ignored : new List<int>(); using (var db = new Database()) { Locked = db.getLockeds(this.AccountId); Ignored = db.getIgnoreds(this.AccountId); } Inventory = client.Character.Equipment.Select(_ => _ == -1 ? null : (XmlDatas.ItemDescs.ContainsKey(_) ? XmlDatas.ItemDescs[_] : null)).ToArray(); SlotTypes = Utils.FromCommaSepString32(XmlDatas.TypeToElement[ObjectType].Element("SlotTypes").Value); Stats = new int[] { client.Character.MaxHitPoints, client.Character.MaxMagicPoints, client.Character.Attack, client.Character.Defense, client.Character.Speed, client.Character.HpRegen, client.Character.MpRegen, client.Character.Dexterity, }; Pet = null; }