public PlayerInformationViewModel(PlayerInformationModel model) { PlayerInformation = model; }
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)); } } }