//private int pingSerial; public Player(Client client) : base(client.Manager, (ushort)client.Character.ObjectType, client.Random) { this.client = client; statsMgr = new StatsManager(this, client.Random.CurrentSeed); Name = client.Account.Name; AccountId = client.Account.AccountId; Name = client.Account.Name; Level = client.Character.Level; Experience = client.Character.Exp; ExperienceGoal = GetExpGoal(client.Character.Level); Stars = GetStars(); switch (client.Account.Rank) { case 1: Stars = 200; break; case 2: Stars = 210; break; case 3: Stars = 220; break; case 4: Stars = 230; break; case 5: Stars = 240; break; case 6: Stars = 500; break; case 7: Stars = 1337; break; } Texture1 = client.Character.Tex1; Texture2 = client.Character.Tex2; Effect = client.Character.Effect; XmlEffect = ""; Skin = client.Character.Skin; PermaSkin = client.Character.PermaSkin != 0; XpBoost = client.Character.XpBoost; Credits = client.Account.Credits; Keys = client.Account.Keys; NameChosen = client.Account.NameChosen; CurrentFame = client.Account.Stats.Fame; Fame = client.Character.CurrentFame; ClassStats state = client.Account.Stats.ClassStates.SingleOrDefault(_ => _.ObjectType == ObjectType); FameGoal = GetFameGoal(state != null ? state.BestFame : 0); Glowing = -1; switch (client.Account.Rank) { /* if (client.Client.ClientDatabase.IsUserInLegends(AccountId)) * Glowing = 0xFF0000; */ case 6: Glowing = 0xFFFFFF; break; case 7: Glowing = 0xFF0080; break; } Guild = GuildManager.Add(this, client.Account.Guild); HP = client.Character.HitPoints; MP = client.Character.MagicPoints; ConditionEffects = 0; OxygenBar = 100; Party = Party.GetParty(this); if (Party != null) { if (Party.Leader.AccountId == AccountId) { Party.Leader = this; } else { Party.Members.Add(this); } } if (HP <= 0) { HP = client.Character.MaxHitPoints; } Locked = client.Account.Locked ?? new List <int>(); Ignored = client.Account.Ignored ?? new List <int>(); try { Locked = Client.ClientDatabase.GetLockeds(AccountId); Ignored = Client.ClientDatabase.GetIgnoreds(AccountId); } catch { } Inventory = new Inventory(this, client.Character.Equipment .Select(_ => _ == 0xffff ? null : client.Manager.GameData.Items[_]) .ToArray(), client.Character.EquipData); Inventory.InventoryChanged += (sender, e) => CalculateBoost(); SlotTypes = Utils.FromCommaSepString32( Manager.GameData.ObjectTypeToElement[ObjectType].Element("SlotTypes").Value); Stats = new[] { client.Character.MaxHitPoints, client.Character.MaxMagicPoints, client.Character.Attack, client.Character.Defense, client.Character.Speed, client.Character.HpRegen, client.Character.MpRegen, client.Character.Dexterity, client.Character.Luck, client.Character.Crit }; /* if (client.Character.Backpacks >= 1) * { * Inventory.SetItems(Inventory.Concat(client.Character.Backpack1.Select(_ => _ == 0xffff ? null : client.Manager.GameData.Items[_])).ToArray()); * SlotTypes = SlotTypes.Concat(new int[8] { 0, 0, 0, 0, 0, 0, 0, 0 }).ToArray(); * } * if (client.Character.Backpacks == 2) * { * Inventory.SetItems(Inventory.Concat(client.Character.Backpack2.Select(_ => _ == 0xffff ? null : client.Manager.GameData.Items[_])).ToArray()); * SlotTypes = SlotTypes.Concat(new int[8] { 0, 0, 0, 0, 0, 0, 0, 0 }).ToArray(); * } */ Pet = null; for (int i = 0; i < SlotTypes.Length; i++) { if (SlotTypes[i] == 0) { SlotTypes[i] = 10; } } AddRecipes(); }
public Player(Client client) : base(client.Manager, (ushort)client.Character.ObjectType, client.Random) { this.client = client; statsMgr = new StatsManager(this); Name = client.Account.Name; AccountId = client.Account.AccountId; Name = client.Account.Name; Level = client.Character.Level; Experience = client.Character.Exp; ExperienceGoal = GetExpGoal(client.Character.Level); Stars = GetStars(); Texture1 = client.Character.Tex1; Texture2 = client.Character.Tex2; Effect = client.Character.Effect; XmlEffect = ""; Skin = client.Character.Skin; PermaSkin = client.Character.PermaSkin != 0; XpBoost = client.Character.XpBoost; Credits = client.Account.Credits; Souls = client.Account.Souls; NameChosen = client.Account.NameChosen; CurrentFame = client.Account.Stats.Fame; Fame = client.Character.CurrentFame; ClassStats state = client.Account.Stats.ClassStates.SingleOrDefault(_ => _.ObjectType == ObjectType); FameGoal = GetFameGoal(state != null ? state.BestFame : 0); Glowing = -1; Manager.Data.AddPendingAction(db => { if (db.IsUserInLegends(AccountId)) { Glowing = 0xFF0000; } if (client.Account.Admin) { Glowing = 0xFF00FF; } }); Guild = client.Account.Guild.Name; GuildRank = client.Account.Guild.Rank; HP = client.Character.HitPoints; MP = client.Character.MagicPoints; Floors = client.Character.Floors; ConditionEffects = 0; OxygenBar = 100; Party = Party.GetParty(this); if (Party != null) { if (Party.Leader.AccountId == AccountId) { Party.Leader = this; } else { Party.Members.Add(this); } } if (HP <= 0) { HP = client.Character.MaxHitPoints; } Locked = client.Account.Locked ?? new List <int>(); Ignored = client.Account.Ignored ?? new List <int>(); try { Manager.Data.AddPendingAction(db => { Locked = db.GetLockeds(AccountId); Ignored = db.GetIgnoreds(AccountId); }); } catch { } Inventory = new Inventory(this, client.Character.Equipment .Select(_ => _ == 0xffff ? null : client.Manager.GameData.Items[_]) .ToArray(), client.Character.EquipData); Inventory.InventoryChanged += (sender, e) => CalculateBoost(); SlotTypes = Utils.FromCommaSepString32( client.Manager.GameData.ObjectTypeToElement[ObjectType].Element("SlotTypes").Value); Stats = new[] { 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; for (int i = 0; i < SlotTypes.Length; i++) { if (SlotTypes[i] == 0) { SlotTypes[i] = 10; } } AddRecipes(); }
public Player(Client client) : base(client.Manager, (ushort)client.Character.ObjectType, client.Random) { this.client = client; statsMgr = new StatsManager(this, client.Random.CurrentSeed); Name = client.Account.Name; AccountId = client.Account.AccountId; Name = client.Account.Name; Level = client.Character.Level; Experience = client.Character.Exp; ExperienceGoal = GetExpGoal(client.Character.Level); Stars = GetStars(); Texture1 = client.Character.Tex1; Texture2 = client.Character.Tex2; Effect = client.Character.Effect; XmlEffect = ""; Skin = client.Character.Skin; PermaSkin = client.Character.PermaSkin != 0; XpBoost = client.Character.XpBoost; Credits = client.Account.Credits; Silver = client.Account.Silver; UnlockedMoods = client.Account.UnlockedMoods; NameChosen = client.Account.NameChosen; CurrentFame = client.Account.Stats.Fame; Fame = client.Character.CurrentFame; ClassStats state = client.Account.Stats.ClassStates.SingleOrDefault(_ => _.ObjectType == ObjectType); FameGoal = GetFameGoal(state?.BestFame ?? 0); CameraOffsetX = CameraOffsetY = 0; CameraX = CameraY = 0; CameraRot = 0; FixedCamera = FixedCameraRot = false; CameraUpdate = false; warpUses = 0; Locked = client.Account.Locked ?? new List <int>(); Ignored = client.Account.Ignored ?? new List <int>(); Glowing = -1; Manager.Data.AddDatabaseOperation(db => //We dont need to await here { if (db.IsUserInLegends(AccountId)) { Glowing = 0xFF0000; } if (client.Account.Admin) { Glowing = 0xFF00FF; } }); Guild = client.Account.Guild.Name; GuildRank = client.Account.Guild.Rank; HP = client.Character.HitPoints; MP = client.Character.MagicPoints; Floors = client.Character.Floors; ConditionEffects = 0; OxygenBar = 100; Party = Party.GetParty(this); if (Party != null) { if (Party.Leader.AccountId == AccountId) { Party.Leader = this; } else { Party.Members.Add(this); } } if (HP <= 0) { HP = client.Character.MaxHitPoints; } Inventory = new Inventory(this, client.Character.Equipment .Select(_ => _ == 0xffff ? null : client.Manager.GameData.Items[_]) .ToArray(), client.Character.EquipData); Inventory.InventoryChanged += (sender, e) => CalculateBoost(); SlotTypes = Utils.FromCommaSepString32( client.Manager.GameData.ObjectTypeToElement[ObjectType].Element("SlotTypes").Value); Stats = new[] { client.Character.MaxHitPoints, client.Character.MaxMagicPoints, client.Character.Attack, client.Character.Defense, client.Character.Speed, client.Character.Vitality, client.Character.Wisdom, client.Character.Dexterity, client.Character.Aptitude, client.Character.Resilience, client.Character.Penetration }; CalculateBoost(); Pet = null; for (int i = 0; i < SlotTypes.Length; i++) { if (SlotTypes[i] == 0) { SlotTypes[i] = 10; } } Ability = new Ability[3] { null, null, null }; CacheAbilities = Ability; CacheAP = 0; AbilityCooldown = new int[3] { 3, 3, 3 }; AbilityActiveDurations = new int[3] { 0, 0, 0 }; AbilityToggle = new bool[3] { false, false, false }; AbilityToggleVar = 0; Specialization = client.Character.Specialization; UpdateAbilities(); Mood = client.Character.Mood; MaxLevel = client.Character.MaxLevel; AddRecipes(); // "default_" is default and all the rest are normal. // red, orange, yellow, green, blue. if (/*criteria*/ false) { ChatBubbleColour = "purple"; } else { ChatBubbleColour = "default_"; } }