private TCCharacter BuildCharacter(DataRow row) { TCCharacter character = new TCCharacter(); character.Guid = Convert.ToInt32(row["guid"]); character.Account = Convert.ToInt32(row["account"]); character.Name = (string)row["name"]; character.Race = CharacterRaceHelper.GetCharacterRace(Convert.ToInt32(row["race"])); character.Class = CharacterClassHelper.GetCharacterClass(Convert.ToInt32(row["class"])); character.Level = Convert.ToInt32(row["level"]); character.Money = Convert.ToInt32(row["money"]); character.Online = Convert.ToBoolean(row["online"]); character.TotalTime = Convert.ToInt32(row["totaltime"]); character.TotalKills = Convert.ToInt32(row["totalKills"]); character.ArenaPoints = Convert.ToInt32(row["arenaPoints"]); character.TotalHonorsPoints = Convert.ToInt32(row["totalHonorPoints"]); return(character); }
private async void PlayerInformation_Load(object sender, EventArgs e) { StartLoading(); int guid = await TCManager.Instance.CharDatabase.GetCharacterGuid(_charName); TCCharacter character = await TCManager.Instance.CharDatabase.GetCharacter(guid); if (character == null) { MessageBoxEx.Show(this, "Character does not exist!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); StopLoading(); this.Close(); return; } int accountId = character.Account; Account account = await TCManager.Instance.AuthDatabase.GetAccount(accountId); if (account == null) { MessageBoxEx.Show(this, "Account does not exist!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); StopLoading(); this.Close(); return; } nameLabel.Text = character.Name; lastLoginLabel.Text = account.LastLogin.ToString(); lastIpLabel.Text = account.LastIp; emailLabel.Text = account.Email; raceLabel.Text = character.Race.GetCharacterRaceName(); classLabel.Text = character.Class.GetCharacterClassName(); int gold = character.Money / 10000; int silver = (character.Money % 10000) / 100; int copper = (character.Money % 10000) % 100; Console.WriteLine(character.Money); moneyLabel.Text = String.Format("{0} Gold {1} Silver {2} Copper", gold, silver, copper); totalKillsLabel.Text = character.TotalKills.ToString(); accountLabel.Text = account.Username; accountIdLabel.Text = account.Id.ToString(); GMLevel level = await TCManager.Instance.AuthDatabase.GetAccountAccess(account.Id); switch (level) { case GMLevel.Player: gmLevelLabel.Text = "Player"; break; case GMLevel.Moderator: gmLevelLabel.Text = "Moderator"; break; case GMLevel.GM: gmLevelLabel.Text = "Game Master"; break; case GMLevel.HeadGM: gmLevelLabel.Text = "Head Game Master"; break; case GMLevel.Admin: gmLevelLabel.Text = "Administrator"; break; } TimeSpan timePlayed = TimeSpan.FromSeconds(character.TotalTime); playedTimeLabel.Text = timePlayed.ToReadableString(); levelLabel.Text = character.Level.ToString(); arenaPointsLabel.Text = character.ArenaPoints.ToString(); honorPointsLabel.Text = character.TotalHonorsPoints.ToString(); StopLoading(); }
private async void ShowPlayerInfo() { if (string.IsNullOrEmpty(SelectedCharacter)) { _messageService.ShowError("No character selected!"); return; } TCCharacter c = await TCManager.Instance.CharDatabase.GetCharacter(SelectedCharacter); if (c != null) { Account acct = await TCManager.Instance.AuthDatabase.GetAccount(c.Account); if (acct != null) { GMLevel gmLvl = await TCManager.Instance.AuthDatabase.GetAccountAccess(c.Account); string gmLevelStr; switch (gmLvl) { case GMLevel.Moderator: gmLevelStr = "Moderator"; break; case GMLevel.GM: gmLevelStr = "GM"; break; case GMLevel.HeadGM: gmLevelStr = "Head GM"; break; case GMLevel.Admin: gmLevelStr = "Admin"; break; default: gmLevelStr = "Player"; break; } int gold = c.Money / 10000; int silver = (c.Money % 10000) / 100; int copper = (c.Money % 10000) % 100; string money = String.Format("{0} Gold {1} Silver {2} Copper", gold, silver, copper); PlayerInformationModel model = new PlayerInformationModel { CharacterName = c.Name, AccountId = c.Account.ToString(), AccountName = acct.Username, Class = c.Class.GetCharacterClassName(), Email = acct.Email, GMLevel = gmLevelStr, LastIp = acct.LastIp, LastLogin = acct.LastLogin.ToString(), Level = c.Level.ToString(), Money = money, PlayedTime = TimeSpan.FromSeconds(c.TotalTime).ToReadableString(), Race = c.Race.GetCharacterRaceName(), TotalKills = c.TotalKills.ToString(), }; _uiVisualizerService.ShowDialog(new PlayerInformationViewModel(model)); } } }