@using SharedLibraryCore.Interfaces @using Data.Models @using Data.Models.Client @using WebfrontCore.Permissions @using WebfrontCore.ViewModels @model SharedLibraryCore.Dtos.PlayerInfo @{ var match = System.Text.RegularExpressions.Regex.Match(Model.Name.ToUpper(), "[A-Z]").Value; var shortCode = match == string.Empty ? "?" : match; var gravatarUrl = Model.Meta.FirstOrDefault(m => m.Key == "GravatarEmail")?.Value; var isFlagged = Model.LevelInt == (int)EFClient.Permission.Flagged; var isPermBanned = Model.LevelInt == (int)EFClient.Permission.Banned; var isTempBanned = Model.ActivePenalty?.Type == EFPenalty.PenaltyType.TempBan; var translationKey = $"WEBFRONT_PROFILE_{Model.ActivePenalty?.Type.ToString().ToUpper()}_INFO"; var ignoredMetaTypes = new[] { MetaType.Information, MetaType.Other, MetaType.QuickMessage }; string ClassForPenaltyType(EFPenalty.PenaltyType type) { return type switch { EFPenalty.PenaltyType.Ban => "alert-danger", EFPenalty.PenaltyType.Flag => "alert-secondary", EFPenalty.PenaltyType.TempBan => "alert-secondary", _ => "alert" }; } string ClassForProfileBackground() { return (ViewBag.PermissionsSet as IEnumerable).HasPermission(WebfrontEntity.ClientLevel, WebfrontPermission.Read) ? $"level-bgcolor-{Model.LevelInt}" : "level-bgcolor-0"; } }
@if (Model.ActivePenalty != null) { }

Player Profile

@if (Model.Online) {
}
@if (string.IsNullOrEmpty(gravatarUrl)) {
@shortCode
}
@Model.Level
@Model.IPAddress


@foreach (var type in Enum.GetValues(typeof(MetaType)).Cast().Where(meta => !ignoredMetaTypes.Contains(meta)).OrderByDescending(meta => meta == MetaType.All)) { var buttonClass = !Model.MetaFilterType.HasValue && type == MetaType.All || Model.MetaFilterType.HasValue && Model.MetaFilterType.Value.ToString() == type.ToString() ? "btn-primary text-light" : "text-muted"; }
@if (!ViewBag.Authorized && !ViewBag.EnablePrivilegedUserPrivacy || ViewBag.Authorized) {
@await Component.InvokeAsync("ProfileMetaList", new { clientId = Model.ClientId, count = 30, offset = 0, startAt = DateTime.UtcNow, metaType = Model.MetaFilterType })
}
@{ var menuItems = new SideContextMenuItems { MenuTitle = "Actions", }; if (Model.Online) { menuItems.Items.Add(new SideContextMenuItem { Title = "Join Game", IsLink = true, IsButton = true, Reference = Model.ConnectProtocolUrl, Tooltip = $"Playing on {Model.CurrentServerName.StripColors()}", Icon = "oi-play-circle" }); } if (Model.LevelInt != -1 && ViewBag.Authorized) { menuItems.Items.Add(new SideContextMenuItem { Title = "Change Level", IsButton = true, Reference = "edit", Icon = "oi-cog", EntityId = Model.ClientId }); } menuItems.Items.Add(new SideContextMenuItem { Title = "View Stats", IsButton = true, IsLink = true, Reference = Url.Action("Advanced", "ClientStatistics", new { id = Model.ClientId }), Icon = "oi-graph", }); if (!isPermBanned && ViewBag.Authorized) { menuItems.Items.Add(new SideContextMenuItem { Title = isFlagged ? "Unflag" : "Flag", IsButton = true, Reference = isFlagged ? "unflag" : "flag", Icon = "oi-flag", EntityId = Model.ClientId }); } if (Model.LevelInt < (int)ViewBag.User.Level && Model.Online) { menuItems.Items.Add(new SideContextMenuItem { Title = "Kick", IsButton = true, Reference = "kick", Icon = "oi-circle-x", EntityId = Model.ClientId }); } if ((Model.LevelInt < (int)ViewBag.User.Level && !Model.HasActivePenalty || isTempBanned) && ViewBag.Authorized) { menuItems.Items.Add(new SideContextMenuItem { Title = "Ban", IsButton = true, Reference = "ban", Icon = "oi-lock-unlocked", EntityId = Model.ClientId }); } if ((Model.LevelInt < (int)ViewBag.User.Level && Model.HasActivePenalty || isTempBanned) && ViewBag.Authorized) { menuItems.Items.Add(new SideContextMenuItem { Title = "Unban", IsButton = true, Reference = "unban", Icon = "oi-lock-locked", EntityId = Model.ClientId }); } }
@section targetid { } @section scripts { }