@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) { }

@ViewBag.Localization["WEBFRONT_PROFILE_TITLE"]

@ViewBag.Localization[$"GAME_{Model.Game}"]
@if (Model.Online) {
}
@if (string.IsNullOrEmpty(gravatarUrl)) {
@shortCode
}
@Model.IPAddress
@if (!string.IsNullOrWhiteSpace(Model.NoteMeta?.Note)) {
@foreach (var line in Model.NoteMeta.Note.Split("\n")) {
@line.TrimEnd('\r')
}
— @Model.NoteMeta.ModifiedDate.HumanizeForCurrentCulture()
}


@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 = ViewBag.Localization["WEBFRONT_PROFILE_CONTEXT_MENU_TITLE"] }; if (Model.Online) { menuItems.Items.Add(new SideContextMenuItem { Title = ViewBag.Localization["WEBFRONT_PROFILE_CONTEXT_MENU_ACTION_JOIN"], IsLink = true, IsButton = true, Reference = Model.ConnectProtocolUrl, Tooltip = (ViewBag.Localization["WEBFRONT_PROFILE_CONTEXT_MENU_TOOLTIP_JOIN"] as string).FormatExt(Model.CurrentServerName.StripColors()), Icon = "oi-play-circle" }); } if (Model.LevelInt != -1 && ViewBag.Authorized) { menuItems.Items.Add(new SideContextMenuItem { Title = ViewBag.Localization["WEBFRONT_PROFILE_CONTEXT_MENU_ACTION_LEVEL"], IsButton = true, Reference = "edit", Icon = "oi-cog", EntityId = Model.ClientId }); } if (ViewBag.Authorized) { menuItems.Items.Add(new SideContextMenuItem { Title = ViewBag.Localization["WEBFRONT_PROFILE_CONTEXT_MENU_TAG"], IsButton = true, Reference = "SetClientTag", Icon = "oi-tag", EntityId = Model.ClientId }); if ((ViewBag.PermissionsSet as IEnumerable).HasPermission(WebfrontEntity.ClientNote, WebfrontPermission.Write)) { menuItems.Items.Add(new SideContextMenuItem { Title = ViewBag.Localization["WEBFRONT_PROFILE_CONTEXT_MENU_NOTE"], IsButton = true, Reference = "AddClientNote", Icon = "oi-clipboard", EntityId = Model.ClientId }); } menuItems.Items.Add(new SideContextMenuItem { Title = ViewBag.Localization["WEBFRONT_PROFILE_CONTEXT_MENU_ACTION_MESSAGE"], IsButton = true, Reference = "OfflineMessage", Icon = "oi oi-envelope-closed", EntityId = Model.ClientId }); } menuItems.Items.Add(new SideContextMenuItem { Title = ViewBag.Localization["WEBFRONT_PROFILE_CONTEXT_MENU_ACTION_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 ? ViewBag.Localization["WEBFRONT_ACTION_UNFLAG_NAME"] : ViewBag.Localization["WEBFRONT_ACTION_FLAG_NAME"], 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 = ViewBag.Localization["WEBFRONT_ACTION_KICK_NAME"], 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 = ViewBag.Localization["WEBFRONT_ACTION_BAN_NAME"], 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 = ViewBag.Localization["WEBFRONT_ACTION_UNBAN_NAME"], IsButton = true, Reference = "unban", Icon = "oi-lock-locked", EntityId = Model.ClientId }); } }
@section targetid { } @section scripts { }