Compare commits
29 Commits
master
...
2021.12.23
Author | SHA1 | Date | |
---|---|---|---|
8baa85c7c0 | |||
ecfcd760d6 | |||
8af40a7772 | |||
697a1884cb | |||
4899ef86cc | |||
794e1ee87b | |||
b025115cf8 | |||
f7c3db3712 | |||
f32ac3f45e | |||
3716255740 | |||
d36e19a077 | |||
12cc5f1820 | |||
61a131be9d | |||
d93bfc11d0 | |||
21f290ca58 | |||
d3df9623aa | |||
1b9ca676dc | |||
58616e18fe | |||
0dcbafd0f2 | |||
f8723e6a8c | |||
3ebdbde33d | |||
769faaa31b | |||
2734a3f138 | |||
914b37b20a | |||
755c149495 | |||
bbcbc4c042 | |||
f3bead8eb5 | |||
7eb45f2bc9 | |||
5837885653 |
@ -492,17 +492,13 @@ namespace IW4MAdmin.Application
|
||||
|
||||
// this is because I want to store the command prefix in IW4MAdminSettings, but can't easily
|
||||
// inject it to all the places that need it
|
||||
cmdConfig.CommandPrefix = _appConfig?.CommandPrefix ?? "!";
|
||||
cmdConfig.BroadcastCommandPrefix = _appConfig?.BroadcastCommandPrefix ?? "@";
|
||||
cmdConfig.CommandPrefix = _appConfig.CommandPrefix;
|
||||
cmdConfig.BroadcastCommandPrefix = _appConfig.BroadcastCommandPrefix;
|
||||
|
||||
foreach (var cmd in commandsToAddToConfig)
|
||||
{
|
||||
if (cmdConfig.Commands.ContainsKey(cmd.CommandConfigNameForType()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
cmdConfig.Commands.Add(cmd.CommandConfigNameForType(),
|
||||
new CommandProperties
|
||||
new CommandProperties()
|
||||
{
|
||||
Name = cmd.Name,
|
||||
Alias = cmd.Alias,
|
||||
|
@ -159,12 +159,12 @@
|
||||
"Game": "IW5",
|
||||
"Gametypes": [
|
||||
{
|
||||
"Name": "dom",
|
||||
"Alias": "Domination"
|
||||
"Name": "tdm",
|
||||
"Alias": "Team Deathmatch"
|
||||
},
|
||||
{
|
||||
"Name": "conf",
|
||||
"Alias": "Kill Confirmed"
|
||||
"Name": "dom",
|
||||
"Alias": "Domination"
|
||||
},
|
||||
{
|
||||
"Name": "ctf",
|
||||
@ -175,29 +175,37 @@
|
||||
"Alias": "Demolition"
|
||||
},
|
||||
{
|
||||
"Name": "dm",
|
||||
"Alias": "Free For All"
|
||||
},
|
||||
{
|
||||
"Name": "grnd",
|
||||
"Name": "dz",
|
||||
"Alias": "Drop Zone"
|
||||
},
|
||||
{
|
||||
"Name": "gun",
|
||||
"Name": "ffa",
|
||||
"Alias": "Free For All"
|
||||
},
|
||||
{
|
||||
"Name": "gg",
|
||||
"Alias": "Gun Game"
|
||||
},
|
||||
{
|
||||
"Name": "hq",
|
||||
"Alias": "Headquarters"
|
||||
},
|
||||
{
|
||||
"Name": "koth",
|
||||
"Alias": "Headquarters"
|
||||
},
|
||||
{
|
||||
"Name": "infect",
|
||||
"Name": "inf",
|
||||
"Alias": "Infected"
|
||||
},
|
||||
{
|
||||
"Name": "jugg",
|
||||
"Name": "jug",
|
||||
"Alias": "Juggernaut"
|
||||
},
|
||||
{
|
||||
"Name": "kc",
|
||||
"Alias": "Kill Confirmed"
|
||||
},
|
||||
{
|
||||
"Name": "oic",
|
||||
"Alias": "One In The Chamber"
|
||||
@ -215,12 +223,8 @@
|
||||
"Alias": "Team Defender"
|
||||
},
|
||||
{
|
||||
"Name": "tjugg",
|
||||
"Name": "tj",
|
||||
"Alias": "Team Juggernaut"
|
||||
},
|
||||
{
|
||||
"Name": "war",
|
||||
"Alias": "Team Deathmatch"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -118,7 +118,7 @@ namespace Data.Context
|
||||
ent.HasIndex(a => a.Name);
|
||||
ent.Property(_alias => _alias.SearchableName).HasMaxLength(24);
|
||||
ent.HasIndex(_alias => _alias.SearchableName);
|
||||
ent.HasIndex(_alias => new {_alias.Name, _alias.IPAddress});
|
||||
ent.HasIndex(_alias => new {_alias.Name, _alias.IPAddress}).IsUnique();
|
||||
});
|
||||
|
||||
modelBuilder.Entity<EFMeta>(ent =>
|
||||
@ -145,4 +145,4 @@ namespace Data.Context
|
||||
base.OnModelCreating(modelBuilder);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -8,7 +8,7 @@
|
||||
<PackageId>RaidMax.IW4MAdmin.Data</PackageId>
|
||||
<Title>RaidMax.IW4MAdmin.Data</Title>
|
||||
<Authors />
|
||||
<PackageVersion>1.1.0</PackageVersion>
|
||||
<PackageVersion>1.0.9</PackageVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,32 +0,0 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace Data.Migrations.MySql
|
||||
{
|
||||
public partial class RemoveUniqueAliasIndexConstraint : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_EFAlias_Name_IPAddress",
|
||||
table: "EFAlias");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_EFAlias_Name_IPAddress",
|
||||
table: "EFAlias",
|
||||
columns: new[] { "Name", "IPAddress" });
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_EFAlias_Name_IPAddress",
|
||||
table: "EFAlias");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_EFAlias_Name_IPAddress",
|
||||
table: "EFAlias",
|
||||
columns: new[] { "Name", "IPAddress" },
|
||||
unique: true);
|
||||
}
|
||||
}
|
||||
}
|
@ -816,7 +816,8 @@ namespace Data.Migrations.MySql
|
||||
|
||||
b.HasIndex("SearchableName");
|
||||
|
||||
b.HasIndex("Name", "IPAddress");
|
||||
b.HasIndex("Name", "IPAddress")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("EFAlias");
|
||||
});
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,32 +0,0 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace Data.Migrations.Postgresql
|
||||
{
|
||||
public partial class RemoveUniqueAliasIndexConstraint : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_EFAlias_Name_IPAddress",
|
||||
table: "EFAlias");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_EFAlias_Name_IPAddress",
|
||||
table: "EFAlias",
|
||||
columns: new[] { "Name", "IPAddress" });
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_EFAlias_Name_IPAddress",
|
||||
table: "EFAlias");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_EFAlias_Name_IPAddress",
|
||||
table: "EFAlias",
|
||||
columns: new[] { "Name", "IPAddress" },
|
||||
unique: true);
|
||||
}
|
||||
}
|
||||
}
|
@ -836,7 +836,8 @@ namespace Data.Migrations.Postgresql
|
||||
|
||||
b.HasIndex("SearchableName");
|
||||
|
||||
b.HasIndex("Name", "IPAddress");
|
||||
b.HasIndex("Name", "IPAddress")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("EFAlias");
|
||||
});
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,15 +0,0 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace Data.Migrations.Sqlite
|
||||
{
|
||||
public partial class RemoveUniqueAliasIndexConstraint : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
@ -815,7 +815,8 @@ namespace Data.Migrations.Sqlite
|
||||
|
||||
b.HasIndex("SearchableName");
|
||||
|
||||
b.HasIndex("Name", "IPAddress");
|
||||
b.HasIndex("Name", "IPAddress")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("EFAlias");
|
||||
});
|
||||
|
@ -57,11 +57,10 @@ namespace Data.Models.Client.Stats
|
||||
public double MaxStrain { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
public float AverageHitOffset =>
|
||||
(float) Math.Round(
|
||||
HitLocations.Sum(c => c.HitOffsetAverage) /
|
||||
Math.Max(1, HitLocations.Count(c => c.HitOffsetAverage > 0)), 4);
|
||||
|
||||
public float AverageHitOffset
|
||||
{
|
||||
get => (float)Math.Round(HitLocations.Sum(c => c.HitOffsetAverage) / Math.Max(1, HitLocations.Where(c => c.HitOffsetAverage > 0).Count()), 4);
|
||||
}
|
||||
[NotMapped]
|
||||
public int SessionKills { get; set; }
|
||||
[NotMapped]
|
||||
@ -83,26 +82,26 @@ namespace Data.Models.Client.Stats
|
||||
KillStreak = 0;
|
||||
DeathStreak = 0;
|
||||
LastScore = 0;
|
||||
_sessionScores.Add(0);
|
||||
SessionScores.Add(0);
|
||||
Team = 0;
|
||||
}
|
||||
[NotMapped]
|
||||
public int SessionScore
|
||||
{
|
||||
set => _sessionScores[^1] = value;
|
||||
set => SessionScores[SessionScores.Count - 1] = value;
|
||||
|
||||
get
|
||||
{
|
||||
lock (_sessionScores)
|
||||
lock (SessionScores)
|
||||
{
|
||||
return new List<int>(_sessionScores).Sum();
|
||||
return new List<int>(SessionScores).Sum();
|
||||
}
|
||||
}
|
||||
}
|
||||
[NotMapped]
|
||||
public int RoundScore => _sessionScores[^1];
|
||||
public int RoundScore => SessionScores[SessionScores.Count - 1];
|
||||
[NotMapped]
|
||||
private readonly List<int> _sessionScores = new List<int> { 0 };
|
||||
private readonly List<int> SessionScores = new List<int>() { 0 };
|
||||
[NotMapped]
|
||||
public int Team { get; set; }
|
||||
[NotMapped]
|
||||
@ -110,21 +109,6 @@ namespace Data.Models.Client.Stats
|
||||
[NotMapped]
|
||||
public double SessionSPM { get; set; }
|
||||
[NotMapped]
|
||||
public SemaphoreSlim ProcessingHit { get; }
|
||||
|
||||
[NotMapped] public MatchData MatchData { get; } = new MatchData();
|
||||
}
|
||||
|
||||
public class MatchData
|
||||
{
|
||||
public int Kills { get; set; }
|
||||
public int Deaths { get; set; }
|
||||
public double Kdr => Deaths == 0 ? Kills : Math.Round(Kills / (double) Deaths, 2);
|
||||
|
||||
public void StartNewMatch()
|
||||
{
|
||||
Kills = 0;
|
||||
Deaths = 0;
|
||||
}
|
||||
public SemaphoreSlim ProcessingHit { get; private set; }
|
||||
}
|
||||
}
|
||||
|
@ -49,7 +49,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ScriptPlugins", "ScriptPlug
|
||||
Plugins\ScriptPlugins\ParserS1x.js = Plugins\ScriptPlugins\ParserS1x.js
|
||||
Plugins\ScriptPlugins\ParserCSGO.js = Plugins\ScriptPlugins\ParserCSGO.js
|
||||
Plugins\ScriptPlugins\ParserCSGOSM.js = Plugins\ScriptPlugins\ParserCSGOSM.js
|
||||
Plugins\ScriptPlugins\ParserPlutoniumT4COZM.js = Plugins\ScriptPlugins\ParserPlutoniumT4COZM.js
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AutomessageFeed", "Plugins\AutomessageFeed\AutomessageFeed.csproj", "{F5815359-CFC7-44B4-9A3B-C04BACAD5836}"
|
||||
|
@ -66,7 +66,6 @@ namespace Integrations.Source
|
||||
// ignored
|
||||
}
|
||||
|
||||
await Task.Delay(ConnectionTimeout);
|
||||
_rconClient = _rconClientFactory.CreateClient(_ipEndPoint);
|
||||
_authenticated = false;
|
||||
_needNewSocket = false;
|
||||
@ -184,4 +183,4 @@ namespace Integrations.Source
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -3,14 +3,14 @@
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
|
||||
<LangVersion>Latest</LangVersion>
|
||||
<LangVersion>7.1</LangVersion>
|
||||
<Configurations>Debug;Release;Prerelease</Configurations>
|
||||
<CopyLocalLockFileAssemblies>false</CopyLocalLockFileAssemblies>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.SyndicationFeed.ReaderWriter" Version="1.0.2" />
|
||||
<PackageReference Include="RaidMax.IW4MAdmin.SharedLibraryCore" Version="2022.1.20.1" PrivateAssets="All" />
|
||||
<PackageReference Include="RaidMax.IW4MAdmin.SharedLibraryCore" Version="2021.11.21.1" PrivateAssets="All" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
||||
|
@ -6,11 +6,11 @@
|
||||
<ApplicationIcon />
|
||||
<StartupObject />
|
||||
<Configurations>Debug;Release;Prerelease</Configurations>
|
||||
<LangVersion>Latest</LangVersion>
|
||||
<LangVersion>7.1</LangVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="RaidMax.IW4MAdmin.SharedLibraryCore" Version="2022.1.20.1" PrivateAssets="All" />
|
||||
<PackageReference Include="RaidMax.IW4MAdmin.SharedLibraryCore" Version="2021.11.21.1" PrivateAssets="All" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
||||
|
@ -9,7 +9,7 @@
|
||||
<AddRazorSupportForMvc>true</AddRazorSupportForMvc>
|
||||
<Version>0.1.0.0</Version>
|
||||
<Configurations>Debug;Release;Prerelease</Configurations>
|
||||
<LangVersion>Latest</LangVersion>
|
||||
<LangVersion>7.1</LangVersion>
|
||||
<ApplicationIcon />
|
||||
<OutputType>Library</OutputType>
|
||||
<StartupObject />
|
||||
@ -23,7 +23,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="RaidMax.IW4MAdmin.SharedLibraryCore" Version="2022.1.20.1" PrivateAssets="All" />
|
||||
<PackageReference Include="RaidMax.IW4MAdmin.SharedLibraryCore" Version="2021.11.21.1" PrivateAssets="All" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
||||
|
@ -17,7 +17,7 @@
|
||||
@foreach (SharedLibraryCore.Dtos.ServerInfo server in ViewBag.Servers)
|
||||
{
|
||||
<li class="nav-item">
|
||||
<a asp-controller="Radar" asp-action="Index" asp-route-serverId="@server.ID" class="nav-link @(server.ID == ViewBag.ActiveServerId ? "active": "")" aria-selected="@(server.ID == ViewBag.ActiveServerId ? "true": "false")"><color-code value="@server.Name"></color-code></a>
|
||||
<a asp-controller="Radar" asp-action="Index" asp-route-serverId="@server.ID" class="nav-link @(server.ID == ViewBag.ActiveServerId ? "active": "")" aria-selected="@(server.ID == ViewBag.ActiveServerId ? "true": "false")"><color-code value="@server.Name" allow="@ViewBag.EnableColorCodes"></color-code></a>
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
@ -467,4 +467,4 @@
|
||||
})
|
||||
|
||||
</script>
|
||||
}
|
||||
}
|
@ -11,7 +11,7 @@
|
||||
<Company>Forever None</Company>
|
||||
<Product>Login Plugin for IW4MAdmin</Product>
|
||||
<Configurations>Debug;Release;Prerelease</Configurations>
|
||||
<LangVersion>Latest</LangVersion>
|
||||
<LangVersion>7.1</LangVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
@ -19,7 +19,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="RaidMax.IW4MAdmin.SharedLibraryCore" Version="2022.1.20.1" PrivateAssets="All" />
|
||||
<PackageReference Include="RaidMax.IW4MAdmin.SharedLibraryCore" Version="2021.11.21.1" PrivateAssets="All" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
||||
|
@ -12,11 +12,11 @@
|
||||
<Description>Warns and kicks players for using profanity</Description>
|
||||
<Copyright>2018</Copyright>
|
||||
<Configurations>Debug;Release;Prerelease</Configurations>
|
||||
<LangVersion>Latest</LangVersion>
|
||||
<LangVersion>7.1</LangVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="RaidMax.IW4MAdmin.SharedLibraryCore" Version="2022.1.20.1" PrivateAssets="All" />
|
||||
<PackageReference Include="RaidMax.IW4MAdmin.SharedLibraryCore" Version="2021.11.21.1" PrivateAssets="All" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
||||
|
@ -3,8 +3,8 @@ var eventParser;
|
||||
|
||||
var plugin = {
|
||||
author: 'RaidMax, Chase',
|
||||
version: 0.4,
|
||||
name: 'Plutonium T4 MP Parser',
|
||||
version: 0.3,
|
||||
name: 'Plutonium T4 Parser',
|
||||
isParser: true,
|
||||
|
||||
onEventAsync: function (gameEvent, server) {
|
||||
@ -20,16 +20,15 @@ var plugin = {
|
||||
rconParser.Configuration.CommandPrefixes.RConResponse = '\xff\xff\xff\xffprint\n';
|
||||
rconParser.Configuration.GuidNumberStyle = 7; // Integer
|
||||
rconParser.Configuration.DefaultRConPort = 28960;
|
||||
rconParser.Configuration.OverrideDvarNameMapping.Add('fs_homepath', 'fs_localAppData');
|
||||
|
||||
|
||||
rconParser.Configuration.DefaultInstallationDirectoryHint = '{LocalAppData}/Plutonium/storage/t4';
|
||||
|
||||
rconParser.Version = 'Plutonium T4';
|
||||
rconParser.GameName = 5; // T4
|
||||
|
||||
eventParser.Configuration.GuidNumberStyle = 7; // Integer
|
||||
eventParser.Configuration.GameDirectory = 'main';
|
||||
|
||||
eventParser.Configuration.GameDirectory = 'raw';
|
||||
|
||||
eventParser.Version = 'Plutonium T4';
|
||||
},
|
||||
|
||||
|
@ -1,43 +0,0 @@
|
||||
var rconParser;
|
||||
var eventParser;
|
||||
|
||||
var plugin = {
|
||||
author: 'RaidMax',
|
||||
version: 0.1,
|
||||
name: 'Plutonium T4 CO-OP/Zombies Parser',
|
||||
isParser: true,
|
||||
|
||||
onEventAsync: function (gameEvent, server) {
|
||||
},
|
||||
|
||||
onLoadAsync: function (manager) {
|
||||
rconParser = manager.GenerateDynamicRConParser(this.name);
|
||||
eventParser = manager.GenerateDynamicEventParser(this.name);
|
||||
|
||||
rconParser.Configuration.CommandPrefixes.Kick = 'clientkick {0}';
|
||||
rconParser.Configuration.CommandPrefixes.Ban = 'clientkick {0}';
|
||||
rconParser.Configuration.CommandPrefixes.TempBan = 'clientkick {0}';
|
||||
rconParser.Configuration.CommandPrefixes.RConResponse = '\xff\xff\xff\xffprint\n';
|
||||
rconParser.Configuration.GuidNumberStyle = 7; // Integer
|
||||
rconParser.Configuration.DefaultRConPort = 28960;
|
||||
rconParser.Configuration.CommandPrefixes.RConGetInfo = undefined;
|
||||
|
||||
|
||||
rconParser.Configuration.DefaultInstallationDirectoryHint = '{LocalAppData}/Plutonium/storage/t4';
|
||||
rconParser.Configuration.OverrideDvarNameMapping.Add('fs_homepath', 'fs_localAppData');
|
||||
|
||||
rconParser.Version = 'Plutonium T4 Singleplayer';
|
||||
rconParser.GameName = 5; // T4
|
||||
|
||||
eventParser.Configuration.GuidNumberStyle = 7; // Integer
|
||||
eventParser.Configuration.GameDirectory = 'main';
|
||||
|
||||
eventParser.Version = 'Plutonium T4 Singleplayer';
|
||||
},
|
||||
|
||||
onUnloadAsync: function () {
|
||||
},
|
||||
|
||||
onTickAsync: function (server) {
|
||||
}
|
||||
};
|
@ -22,7 +22,7 @@ namespace Stats.Client
|
||||
|
||||
private readonly IDataValueCache<EFClientStatistics, Dictionary<long, Extensions.LogParams>>
|
||||
_distributionCache;
|
||||
|
||||
|
||||
private readonly IDataValueCache<EFClientStatistics, double>
|
||||
_maxZScoreCache;
|
||||
|
||||
@ -51,9 +51,9 @@ namespace Stats.Client
|
||||
var validPlayTime = _configurationHandler.Configuration()?.TopPlayersMinPlayTime ?? 3600 * 3;
|
||||
|
||||
var distributions = new Dictionary<long, Extensions.LogParams>();
|
||||
|
||||
|
||||
await LoadServers();
|
||||
|
||||
|
||||
foreach (var serverId in _serverIds)
|
||||
{
|
||||
var performance = await set
|
||||
@ -63,14 +63,14 @@ namespace Stats.Client
|
||||
.Where(s => s.Client.Level != EFClient.Permission.Banned)
|
||||
.Where(s => s.TimePlayed >= validPlayTime)
|
||||
.Where(s => s.UpdatedAt >= Extensions.FifteenDaysAgo())
|
||||
.Select(s => s.EloRating * 1 / 3.0 + s.Skill * 2 / 3.0).ToListAsync();
|
||||
.Select(s => s.EloRating * 1/3.0 + s.Skill * 2/3.0).ToListAsync();
|
||||
var distributionParams = performance.GenerateDistributionParameters();
|
||||
distributions.Add(serverId, distributionParams);
|
||||
}
|
||||
|
||||
return distributions;
|
||||
}), DistributionCacheKey, Utilities.IsDevelopment ? TimeSpan.FromMinutes(5) : TimeSpan.FromHours(1));
|
||||
|
||||
|
||||
_maxZScoreCache.SetCacheItem(async (set, token) =>
|
||||
{
|
||||
var validPlayTime = _configurationHandler.Configuration()?.TopPlayersMinPlayTime ?? 3600 * 3;
|
||||
@ -79,16 +79,13 @@ namespace Stats.Client
|
||||
.Where(AdvancedClientStatsResourceQueryHelper.GetRankingFunc(validPlayTime))
|
||||
.Where(s => s.Skill > 0)
|
||||
.Where(s => s.EloRating > 0)
|
||||
.GroupBy(stat => stat.ClientId)
|
||||
.Select(group =>
|
||||
group.Sum(stat => stat.ZScore * stat.TimePlayed) / group.Sum(stat => stat.TimePlayed))
|
||||
.MaxAsync(avgZScore => (double?) avgZScore, token);
|
||||
.MaxAsync(s => (double?)s.ZScore, token);
|
||||
return zScore ?? 0;
|
||||
}, MaxZScoreCacheKey, Utilities.IsDevelopment ? TimeSpan.FromMinutes(5) : TimeSpan.FromMinutes(30));
|
||||
|
||||
await _distributionCache.GetCacheItem(DistributionCacheKey);
|
||||
await _maxZScoreCache.GetCacheItem(MaxZScoreCacheKey);
|
||||
|
||||
await _maxZScoreCache.GetCacheItem(MaxZScoreCacheKey);
|
||||
|
||||
/*foreach (var serverId in _serverIds)
|
||||
{
|
||||
await using var ctx = _contextFactory.CreateContext(enableTracking: true);
|
||||
@ -141,7 +138,6 @@ namespace Stats.Client
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
var zScore = (Math.Log(value) - sdParams.Mean) / sdParams.Sigma;
|
||||
return zScore;
|
||||
}
|
||||
@ -149,7 +145,7 @@ namespace Stats.Client
|
||||
public async Task<double?> GetRatingForZScore(double? value)
|
||||
{
|
||||
var maxZScore = await _maxZScoreCache.GetCacheItem(MaxZScoreCacheKey);
|
||||
return maxZScore == 0 ? null : value.GetRatingForZScore(maxZScore);
|
||||
return maxZScore == 0 ? 0 : value.GetRatingForZScore(maxZScore);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -19,10 +19,7 @@ using Data.Models.Client;
|
||||
using Data.Models.Client.Stats;
|
||||
using Data.Models.Server;
|
||||
using Humanizer.Localisation;
|
||||
using Microsoft.Data.Sqlite;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using MySql.Data.MySqlClient;
|
||||
using Npgsql;
|
||||
using Stats.Client.Abstractions;
|
||||
using Stats.Config;
|
||||
using Stats.Helpers;
|
||||
@ -121,7 +118,7 @@ namespace IW4MAdmin.Plugins.Stats.Helpers
|
||||
{
|
||||
return (ranking) => ranking.ServerId == serverId
|
||||
&& ranking.Client.Level != Data.Models.Client.EFClient.Permission.Banned
|
||||
&& ranking.CreatedDateTime >= Extensions.FifteenDaysAgo()
|
||||
&& ranking.Client.LastConnection >= Extensions.FifteenDaysAgo()
|
||||
&& ranking.ZScore != null
|
||||
&& ranking.PerformanceMetric != null
|
||||
&& ranking.Newest
|
||||
@ -435,12 +432,6 @@ namespace IW4MAdmin.Plugins.Stats.Helpers
|
||||
return null;
|
||||
}
|
||||
|
||||
if (pl.ClientId <= 0)
|
||||
{
|
||||
_log.LogWarning("Stats for {Client} are not yet initialized", pl.ToString());
|
||||
return null;
|
||||
}
|
||||
|
||||
// get the client's stats from the database if it exists, otherwise create and attach a new one
|
||||
// if this fails we want to throw an exception
|
||||
|
||||
@ -520,15 +511,6 @@ namespace IW4MAdmin.Plugins.Stats.Helpers
|
||||
return clientStats;
|
||||
}
|
||||
|
||||
catch (DbUpdateException updateException) when (
|
||||
updateException.InnerException is PostgresException {SqlState: "23503"}
|
||||
|| updateException.InnerException is SqliteException {SqliteErrorCode: 787}
|
||||
|| updateException.InnerException is MySqlException {SqlState: "23503"})
|
||||
{
|
||||
_log.LogWarning("Trying to add {Client} to stats before they have been added to the database",
|
||||
pl.ToString());
|
||||
}
|
||||
|
||||
catch (Exception ex)
|
||||
{
|
||||
_log.LogError(ex, "Could not add client to stats {@client}", pl.ToString());
|
||||
@ -671,12 +653,6 @@ namespace IW4MAdmin.Plugins.Stats.Helpers
|
||||
var clientDetection = attacker.GetAdditionalProperty<Detection>(CLIENT_DETECTIONS_KEY);
|
||||
var clientStats = attacker.GetAdditionalProperty<EFClientStatistics>(CLIENT_STATS_KEY);
|
||||
|
||||
if (clientDetection == null || clientStats?.ClientId == null)
|
||||
{
|
||||
_log.LogWarning("Client stats state for {Client} is not yet initialized", attacker.ToString());
|
||||
return;
|
||||
}
|
||||
|
||||
waiter = clientStats.ProcessingHit;
|
||||
await waiter.WaitAsync(Utilities.DefaultCommandTimeout, Plugin.ServerManager.CancellationToken);
|
||||
|
||||
@ -895,7 +871,7 @@ namespace IW4MAdmin.Plugins.Stats.Helpers
|
||||
|
||||
public async Task AddStandardKill(EFClient attacker, EFClient victim)
|
||||
{
|
||||
var serverId = GetIdForServer(attacker.CurrentServer);
|
||||
long serverId = GetIdForServer(attacker.CurrentServer);
|
||||
|
||||
var attackerStats = attacker.GetAdditionalProperty<EFClientStatistics>(CLIENT_STATS_KEY);
|
||||
var victimStats = victim.GetAdditionalProperty<EFClientStatistics>(CLIENT_STATS_KEY);
|
||||
@ -903,18 +879,6 @@ namespace IW4MAdmin.Plugins.Stats.Helpers
|
||||
// update the total stats
|
||||
_servers[serverId].ServerStatistics.TotalKills += 1;
|
||||
|
||||
if (attackerStats == null)
|
||||
{
|
||||
_log.LogWarning("Stats for {Client} are not yet initialized", attacker.ToString());
|
||||
return;
|
||||
}
|
||||
|
||||
if (victimStats == null)
|
||||
{
|
||||
_log.LogWarning("Stats for {Client} are not yet initialized", victim.ToString());
|
||||
return;
|
||||
}
|
||||
|
||||
// this happens when the round has changed
|
||||
if (attackerStats.SessionScore == 0)
|
||||
{
|
||||
@ -973,7 +937,7 @@ namespace IW4MAdmin.Plugins.Stats.Helpers
|
||||
|
||||
// update their performance
|
||||
if ((DateTime.UtcNow - attackerStats.LastStatHistoryUpdate).TotalMinutes >=
|
||||
(Utilities.IsDevelopment ? 0.5 : _configHandler.Configuration().EnableAdvancedMetrics ? 5.0 : 2.5))
|
||||
(Utilities.IsDevelopment ? 0.5 : _configHandler.Configuration().EnableAdvancedMetrics ? 10.0 : 2.5))
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -1190,17 +1154,16 @@ namespace IW4MAdmin.Plugins.Stats.Helpers
|
||||
public async Task UpdateHistoricalRanking(int clientId, EFClientStatistics clientStats, long serverId)
|
||||
{
|
||||
await using var context = _contextFactory.CreateContext();
|
||||
var minPlayTime = _configHandler.Configuration().TopPlayersMinPlayTime;
|
||||
|
||||
var performances = await context.Set<EFClientStatistics>()
|
||||
.AsNoTracking()
|
||||
.Where(stat => stat.ClientId == clientId)
|
||||
.Where(stat => stat.ServerId != serverId) // ignore the one we're currently tracking
|
||||
.Where(stats => stats.UpdatedAt >= Extensions.FifteenDaysAgo())
|
||||
.Where(stats => stats.TimePlayed >= minPlayTime)
|
||||
.Where(stats => stats.TimePlayed >= _configHandler.Configuration().TopPlayersMinPlayTime)
|
||||
.ToListAsync();
|
||||
|
||||
if (clientStats.TimePlayed >= minPlayTime)
|
||||
if (clientStats.TimePlayed >= _configHandler.Configuration().TopPlayersMinPlayTime)
|
||||
{
|
||||
clientStats.ZScore = await _serverDistributionCalculator.GetZScoreForServer(serverId,
|
||||
clientStats.Performance);
|
||||
@ -1211,7 +1174,7 @@ namespace IW4MAdmin.Plugins.Stats.Helpers
|
||||
_configHandler.Configuration().TopPlayersMinPlayTime, clientStats.ZScore, serverId))
|
||||
.CountAsync();
|
||||
|
||||
var serverRankingSnapshot = new EFClientRankingHistory
|
||||
var serverRankingSnapshot = new EFClientRankingHistory()
|
||||
{
|
||||
ClientId = clientId,
|
||||
ServerId = serverId,
|
||||
@ -1228,35 +1191,27 @@ namespace IW4MAdmin.Plugins.Stats.Helpers
|
||||
performances.Add(clientStats);
|
||||
}
|
||||
|
||||
if (performances.Any(performance => performance.TimePlayed >= minPlayTime))
|
||||
if (performances.Any(performance => performance.TimePlayed >= _configHandler.Configuration().TopPlayersMinPlayTime))
|
||||
{
|
||||
var aggregateZScore = performances.WeightValueByPlaytime(nameof(EFClientStatistics.ZScore), minPlayTime);
|
||||
var aggregateZScore = performances.WeightValueByPlaytime(nameof(EFClientStatistics.ZScore), _configHandler.Configuration().TopPlayersMinPlayTime);
|
||||
|
||||
int? aggregateRanking = await context.Set<EFClientStatistics>()
|
||||
.Where(stat => stat.ClientId != clientId)
|
||||
.Where(AdvancedClientStatsResourceQueryHelper.GetRankingFunc(minPlayTime))
|
||||
.Where(AdvancedClientStatsResourceQueryHelper.GetRankingFunc(_configHandler.Configuration()
|
||||
.TopPlayersMinPlayTime))
|
||||
.GroupBy(stat => stat.ClientId)
|
||||
.Where(group =>
|
||||
group.Sum(stat => stat.ZScore * stat.TimePlayed) / group.Sum(stat => stat.TimePlayed) >
|
||||
aggregateZScore)
|
||||
.Select(c => c.Key)
|
||||
.CountAsync();
|
||||
|
||||
var newPerformanceMetric = await _serverDistributionCalculator.GetRatingForZScore(aggregateZScore);
|
||||
|
||||
if (newPerformanceMetric == null)
|
||||
{
|
||||
_log.LogWarning("Could not determine performance metric for {Client} {AggregateZScore}",
|
||||
clientStats.Client?.ToString(), aggregateZScore);
|
||||
return;
|
||||
}
|
||||
|
||||
var aggregateRankingSnapshot = new EFClientRankingHistory
|
||||
var aggregateRankingSnapshot = new EFClientRankingHistory()
|
||||
{
|
||||
ClientId = clientId,
|
||||
ZScore = aggregateZScore,
|
||||
Ranking = aggregateRanking,
|
||||
PerformanceMetric = newPerformanceMetric,
|
||||
PerformanceMetric = await _serverDistributionCalculator.GetRatingForZScore(aggregateZScore),
|
||||
Newest = true,
|
||||
};
|
||||
|
||||
@ -1310,14 +1265,12 @@ namespace IW4MAdmin.Plugins.Stats.Helpers
|
||||
if (!suicide)
|
||||
{
|
||||
attackerStats.Kills += 1;
|
||||
attackerStats.MatchData.Kills += 1;
|
||||
attackerStats.SessionKills += 1;
|
||||
attackerStats.KillStreak += 1;
|
||||
attackerStats.DeathStreak = 0;
|
||||
}
|
||||
|
||||
victimStats.Deaths += 1;
|
||||
victimStats.MatchData.Deaths += 1;
|
||||
victimStats.SessionDeaths += 1;
|
||||
victimStats.DeathStreak += 1;
|
||||
victimStats.KillStreak = 0;
|
||||
@ -1467,7 +1420,6 @@ namespace IW4MAdmin.Plugins.Stats.Helpers
|
||||
{
|
||||
session.stat?.StartNewSession();
|
||||
session.detection?.OnMapChange();
|
||||
session.stat?.MatchData?.StartNewMatch();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1577,4 +1529,4 @@ namespace IW4MAdmin.Plugins.Stats.Helpers
|
||||
return serverId.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
using IW4MAdmin.Plugins.Stats.Helpers;
|
||||
using IW4MAdmin.Plugins.Stats.Config;
|
||||
using IW4MAdmin.Plugins.Stats.Helpers;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using SharedLibraryCore;
|
||||
using SharedLibraryCore.Dtos.Meta.Responses;
|
||||
@ -14,7 +15,9 @@ using Data.Abstractions;
|
||||
using Data.Models.Client;
|
||||
using Data.Models.Client.Stats;
|
||||
using Data.Models.Server;
|
||||
using Humanizer;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using SharedLibraryCore.Commands;
|
||||
using IW4MAdmin.Plugins.Stats.Client.Abstractions;
|
||||
using Stats.Client.Abstractions;
|
||||
using Stats.Config;
|
||||
|
@ -12,12 +12,12 @@
|
||||
<Description>Client Statistics Plugin for IW4MAdmin</Description>
|
||||
<Copyright>2018</Copyright>
|
||||
<Configurations>Debug;Release;Prerelease</Configurations>
|
||||
<LangVersion>Latest</LangVersion>
|
||||
<LangVersion>8.0</LangVersion>
|
||||
<IsPackable>false</IsPackable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="RaidMax.IW4MAdmin.SharedLibraryCore" Version="2022.1.20.1" PrivateAssets="All" />
|
||||
<PackageReference Include="RaidMax.IW4MAdmin.SharedLibraryCore" Version="2021.11.21.1" PrivateAssets="All" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
||||
|
@ -20,7 +20,7 @@
|
||||
</Target>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="RaidMax.IW4MAdmin.SharedLibraryCore" Version="2022.1.20.1" PrivateAssets="All" />
|
||||
<PackageReference Include="RaidMax.IW4MAdmin.SharedLibraryCore" Version="2021.11.21.1" PrivateAssets="All" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
@ -62,7 +62,7 @@ namespace SharedLibraryCore
|
||||
/// <summary>
|
||||
/// Helper property to provide the syntax of the command
|
||||
/// </summary>
|
||||
public string Syntax => $"{_translationLookup["COMMAND_HELP_SYNTAX"]} {_config.CommandPrefix ?? "!"}{Alias} {string.Join(" ", Arguments.Select(a => $"<{(a.Required ? "" : _translationLookup["COMMAND_HELP_OPTIONAL"] + " ")}{a.Name}>"))}";
|
||||
public string Syntax => $"{_translationLookup["COMMAND_HELP_SYNTAX"]} {_config.CommandPrefix}{Alias} {string.Join(" ", Arguments.Select(a => $"<{(a.Required ? "" : _translationLookup["COMMAND_HELP_OPTIONAL"] + " ")}{a.Name}>"))}";
|
||||
|
||||
/// <summary>
|
||||
/// Alternate name for this command to be executed by
|
||||
|
@ -153,7 +153,7 @@ namespace SharedLibraryCore.Services
|
||||
{
|
||||
_logger.LogDebug("[{Method}] creating new Link and Alias for {Entity}", nameof(HandleNewCreate), entity.ToString());
|
||||
var link = new EFAliasLink();
|
||||
var alias = new EFAlias
|
||||
var alias = new EFAlias()
|
||||
{
|
||||
Name = entity.Name,
|
||||
SearchableName = entity.Name.StripColors().ToLower(),
|
||||
@ -167,18 +167,9 @@ namespace SharedLibraryCore.Services
|
||||
|
||||
else
|
||||
{
|
||||
_logger.LogDebug("[{Method}] associating new GUID {Guid} with new exact alias match with linkId {LinkId} for {Entity}",
|
||||
nameof(HandleNewCreate), entity.GuidString, existingAlias.LinkId, entity.ToString());
|
||||
|
||||
var alias = new EFAlias
|
||||
{
|
||||
Name = existingAlias.Name,
|
||||
SearchableName = entity.Name.StripColors().ToLower(),
|
||||
DateAdded = DateTime.UtcNow,
|
||||
IPAddress = entity.IPAddress,
|
||||
LinkId = existingAlias.LinkId
|
||||
};
|
||||
client.CurrentAlias = alias;
|
||||
_logger.LogDebug("[{Method}] associating new GUID {Guid} with existing alias id {aliasId} for {Entity}",
|
||||
nameof(HandleNewCreate), entity.GuidString, existingAlias.AliasId, entity.ToString());
|
||||
client.CurrentAliasId = existingAlias.AliasId;
|
||||
client.AliasLinkId = existingAlias.LinkId;
|
||||
}
|
||||
|
||||
@ -347,7 +338,7 @@ namespace SharedLibraryCore.Services
|
||||
return;
|
||||
}
|
||||
|
||||
if (existingExactAlias != null && entity.AliasLinkId == existingExactAlias.LinkId)
|
||||
if (existingExactAlias != null)
|
||||
{
|
||||
entity.CurrentAlias = existingExactAlias;
|
||||
entity.CurrentAliasId = existingExactAlias.AliasId;
|
||||
|
@ -1,68 +1,56 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Library</OutputType>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<PackageId>RaidMax.IW4MAdmin.SharedLibraryCore</PackageId>
|
||||
<Version>2022.01.20.1</Version>
|
||||
<Authors>RaidMax</Authors>
|
||||
<Company>Forever None</Company>
|
||||
<Configurations>Debug;Release;Prerelease</Configurations>
|
||||
<PublishWithAspNetCoreTargetManifest>false</PublishWithAspNetCoreTargetManifest>
|
||||
<LangVersion>8.0</LangVersion>
|
||||
<PackageTags>IW4MAdmin</PackageTags>
|
||||
<RepositoryUrl>https://github.com/RaidMax/IW4M-Admin/</RepositoryUrl>
|
||||
<PackageProjectUrl>https://www.raidmax.org/IW4MAdmin/</PackageProjectUrl>
|
||||
<Copyright>2022</Copyright>
|
||||
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
|
||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||
<IsPackable>true</IsPackable>
|
||||
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
||||
<Description>Shared Library for IW4MAdmin</Description>
|
||||
<PackageVersion>2022.01.20.1</PackageVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<OutputType>Library</OutputType>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<PackageId>RaidMax.IW4MAdmin.SharedLibraryCore</PackageId>
|
||||
<Version>2021.11.21.1</Version>
|
||||
<Authors>RaidMax</Authors>
|
||||
<Company>Forever None</Company>
|
||||
<Configurations>Debug;Release;Prerelease</Configurations>
|
||||
<PublishWithAspNetCoreTargetManifest>false</PublishWithAspNetCoreTargetManifest>
|
||||
<LangVersion>8.0</LangVersion>
|
||||
<PackageTags>IW4MAdmin</PackageTags>
|
||||
<RepositoryUrl>https://github.com/RaidMax/IW4M-Admin/</RepositoryUrl>
|
||||
<PackageProjectUrl>https://www.raidmax.org/IW4MAdmin/</PackageProjectUrl>
|
||||
<Copyright>2021</Copyright>
|
||||
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
|
||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||
<IsPackable>true</IsPackable>
|
||||
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
||||
<Description>Shared Library for IW4MAdmin</Description>
|
||||
<PackageVersion>2021.11.21.1</PackageVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Prerelease|AnyCPU'">
|
||||
<DebugType>full</DebugType>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="FluentValidation" Version="9.3.0"/>
|
||||
<PackageReference Include="Humanizer.Core" Version="2.8.26"/>
|
||||
<PackageReference Include="Humanizer.Core.ru" Version="2.8.26"/>
|
||||
<PackageReference Include="Humanizer.Core.de" Version="2.8.26"/>
|
||||
<PackageReference Include="Humanizer.Core.es" Version="2.8.26"/>
|
||||
<PackageReference Include="Humanizer.Core.pt" Version="2.8.26"/>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.Cookies" Version="2.2.0"/>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.10"/>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="3.1.10"/>
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="3.1.10"/>
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="3.1.10"/>
|
||||
<PackageReference Include="Microsoft.Extensions.Localization" Version="3.1.10"/>
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="3.1.10"/>
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="3.1.10"/>
|
||||
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="3.1.10"/>
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3"/>
|
||||
<PackageReference Include="Serilog.AspNetCore" Version="3.4.0"/>
|
||||
<PackageReference Include="SimpleCrypto.NetCore" Version="1.0.0"/>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Data\Data.csproj"/>
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
|
||||
<Exec Command="if not exist "$(ProjectDir)..\BUILD" (
if $(ConfigurationName) == Debug (
md "$(ProjectDir)..\BUILD"
)
)
if not exist "$(ProjectDir)..\BUILD\Plugins" (
if $(ConfigurationName) == Debug (
md "$(ProjectDir)..\BUILD\Plugins"
)
)"/>
|
||||
</Target>
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetsForTfmSpecificBuildOutput>$(TargetsForTfmSpecificBuildOutput);CopyProjectReferencesToPackage</TargetsForTfmSpecificBuildOutput>
|
||||
</PropertyGroup>
|
||||
<Target DependsOnTargets="BuildOnlySettings;ResolveReferences" Name="CopyProjectReferencesToPackage">
|
||||
<ItemGroup>
|
||||
<BuildOutputInPackage Include="@(ReferenceCopyLocalPaths->WithMetadataValue('ReferenceSourceTarget', 'ProjectReference'))"/>
|
||||
</ItemGroup>
|
||||
</Target>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Prerelease|AnyCPU'">
|
||||
<DebugType>full</DebugType>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="FluentValidation" Version="9.3.0" />
|
||||
<PackageReference Include="Humanizer.Core" Version="2.8.26" />
|
||||
<PackageReference Include="Humanizer.Core.ru" Version="2.8.26" />
|
||||
<PackageReference Include="Humanizer.Core.de" Version="2.8.26" />
|
||||
<PackageReference Include="Humanizer.Core.es" Version="2.8.26" />
|
||||
<PackageReference Include="Humanizer.Core.pt" Version="2.8.26" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.Cookies" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.10" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="3.1.10" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="3.1.10" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="3.1.10" />
|
||||
<PackageReference Include="Microsoft.Extensions.Localization" Version="3.1.10" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="3.1.10" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="3.1.10" />
|
||||
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="3.1.10" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||
<PackageReference Include="RaidMax.IW4MAdmin.Data" Version="1.0.9" />
|
||||
<PackageReference Include="Serilog.AspNetCore" Version="3.4.0" />
|
||||
<PackageReference Include="SimpleCrypto.NetCore" Version="1.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
|
||||
<Exec Command="if not exist "$(ProjectDir)..\BUILD" (
if $(ConfigurationName) == Debug (
md "$(ProjectDir)..\BUILD"
)
)
if not exist "$(ProjectDir)..\BUILD\Plugins" (
if $(ConfigurationName) == Debug (
md "$(ProjectDir)..\BUILD\Plugins"
)
)" />
|
||||
</Target>
|
||||
|
||||
</Project>
|
||||
|
@ -1,35 +1,28 @@
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using Microsoft.AspNetCore.Razor.TagHelpers;
|
||||
using SharedLibraryCore.Configuration;
|
||||
|
||||
namespace SharedLibraryCore
|
||||
{
|
||||
[HtmlTargetElement("color-code")]
|
||||
public class ColorCode : TagHelper
|
||||
{
|
||||
public ColorCode(ApplicationConfiguration appConfig)
|
||||
{
|
||||
_allow = appConfig?.EnableColorCodes ?? false;
|
||||
}
|
||||
|
||||
public string Value { get; set; }
|
||||
|
||||
private readonly bool _allow;
|
||||
public bool Allow { get; set; } = false;
|
||||
|
||||
public override void Process(TagHelperContext context, TagHelperOutput output)
|
||||
{
|
||||
output.TagName = "ColorCode";
|
||||
output.TagMode = TagMode.StartTagAndEndTag;
|
||||
|
||||
if (_allow)
|
||||
if (Allow)
|
||||
{
|
||||
var matches = Regex.Matches(Value, @"\^([0-9]|\:)([^\^]*)");
|
||||
foreach (Match match in matches)
|
||||
{
|
||||
var colorCode = match.Groups[1].ToString().Last();
|
||||
output.PreContent.AppendHtml(
|
||||
$"<span class='text-color-code-{(colorCode >= 48 && colorCode <= 57 ? colorCode.ToString() : ((int) colorCode).ToString())}'>");
|
||||
char colorCode = match.Groups[1].ToString().Last();
|
||||
output.PreContent.AppendHtml($"<span class='text-color-code-{(colorCode >= 48 && colorCode <= 57 ? colorCode.ToString() : ((int)colorCode).ToString())}'>");
|
||||
output.PreContent.Append(match.Groups[2].ToString());
|
||||
output.PreContent.AppendHtml("</span>");
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ namespace WebfrontCore.Controllers
|
||||
ViewBag.Title += " " + Localization["WEBFRONT_CLIENT_PROFILE_TITLE"];
|
||||
ViewBag.Description = $"Client information for {strippedName}";
|
||||
ViewBag.Keywords = $"IW4MAdmin, client, profile, {strippedName}";
|
||||
ViewBag.UseNewStats = _configurationHandler.Configuration()?.EnableAdvancedMetrics ?? true;
|
||||
ViewBag.UseNewStats = _configurationHandler.Configuration().EnableAdvancedMetrics;
|
||||
|
||||
return View("Profile/Index", clientDto);
|
||||
}
|
||||
|
@ -1,20 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SharedLibraryCore;
|
||||
using SharedLibraryCore.Dtos;
|
||||
using SharedLibraryCore.Interfaces;
|
||||
using System.Linq;
|
||||
using Data.Models.Client.Stats;
|
||||
using IW4MAdmin.Plugins.Stats.Helpers;
|
||||
using WebfrontCore.ViewModels;
|
||||
using SharedLibraryCore.Configuration;
|
||||
|
||||
namespace WebfrontCore.Controllers
|
||||
{
|
||||
public class ServerController : BaseController
|
||||
{
|
||||
public ServerController(IManager manager) : base(manager)
|
||||
private readonly DefaultSettings _defaultSettings;
|
||||
|
||||
public ServerController(IManager manager, DefaultSettings defaultSettings) : base(manager)
|
||||
{
|
||||
_defaultSettings = defaultSettings;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
@ -36,75 +36,21 @@ namespace WebfrontCore.Controllers
|
||||
Map = s.CurrentMap.Alias,
|
||||
ClientCount = s.Clients.Count(client => client != null),
|
||||
MaxClients = s.MaxClients,
|
||||
GameType = s.GametypeName,
|
||||
GameType = s.GametypeName,
|
||||
Players = s.GetClientsAsList()
|
||||
.Select(p => new PlayerInfo
|
||||
{
|
||||
Name = p.Name,
|
||||
ClientId = p.ClientId,
|
||||
Level = p.Level.ToLocalizedLevelName(),
|
||||
LevelInt = (int) p.Level,
|
||||
ZScore = p.GetAdditionalProperty<EFClientStatistics>(IW4MAdmin.Plugins.Stats.Helpers.StatManager
|
||||
.CLIENT_STATS_KEY)?.ZScore
|
||||
}).ToList(),
|
||||
.Select(p => new PlayerInfo
|
||||
{
|
||||
Name = p.Name,
|
||||
ClientId = p.ClientId,
|
||||
Level = p.Level.ToLocalizedLevelName(),
|
||||
LevelInt = (int)p.Level,
|
||||
ZScore = p.GetAdditionalProperty<EFClientStatistics>(IW4MAdmin.Plugins.Stats.Helpers.StatManager.CLIENT_STATS_KEY)?.ZScore
|
||||
}).ToList(),
|
||||
ChatHistory = s.ChatHistory.ToList(),
|
||||
PlayerHistory = s.ClientHistory.ToArray(),
|
||||
IsPasswordProtected = !string.IsNullOrEmpty(s.GamePassword)
|
||||
};
|
||||
return PartialView("_ClientActivity", serverInfo);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public ActionResult Scoreboard()
|
||||
{
|
||||
ViewBag.Title = Localization["WEBFRONT_TITLE_SCOREBOARD"];
|
||||
|
||||
return View(ProjectScoreboard(Manager.GetServers(), null, true));
|
||||
}
|
||||
|
||||
[HttpGet("[controller]/{id}/scoreboard")]
|
||||
public ActionResult Scoreboard(long id, [FromQuery]string order = null, [FromQuery] bool down = true)
|
||||
{
|
||||
var server = Manager.GetServers().FirstOrDefault(srv => srv.EndPoint == id);
|
||||
|
||||
if (server == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
return View("_Scoreboard", ProjectScoreboard(new[] {server}, order, down).First());
|
||||
}
|
||||
|
||||
private static IEnumerable<ScoreboardInfo> ProjectScoreboard(IEnumerable<Server> servers, string order,
|
||||
bool down)
|
||||
{
|
||||
return servers.Select(server => new ScoreboardInfo
|
||||
{
|
||||
OrderByKey = order,
|
||||
ShouldOrderDescending = down,
|
||||
MapName = server.CurrentMap.ToString(),
|
||||
ServerName = server.Hostname,
|
||||
ServerId = server.EndPoint,
|
||||
ClientInfo = server.GetClientsAsList().Select(client =>
|
||||
new
|
||||
{
|
||||
stats = client.GetAdditionalProperty<EFClientStatistics>(StatManager.CLIENT_STATS_KEY),
|
||||
client
|
||||
})
|
||||
.Select(clientData => new ClientScoreboardInfo
|
||||
{
|
||||
ClientName = clientData.client.Name,
|
||||
ClientId = clientData.client.ClientId,
|
||||
Score = Math.Max(clientData.client.Score, clientData.stats?.RoundScore ?? 0),
|
||||
Ping = clientData.client.Ping,
|
||||
Kills = clientData.stats?.MatchData?.Kills,
|
||||
Deaths = clientData.stats?.MatchData?.Deaths,
|
||||
ScorePerMinute = clientData.stats?.SessionSPM,
|
||||
Kdr = clientData.stats?.MatchData?.Kdr,
|
||||
ZScore = clientData.stats?.ZScore
|
||||
})
|
||||
.ToList()
|
||||
}).ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using IW4MAdmin.Plugins.Stats;
|
||||
using IW4MAdmin.Plugins.Stats.Config;
|
||||
using IW4MAdmin.Plugins.Stats.Helpers;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SharedLibraryCore.Interfaces;
|
||||
@ -32,11 +33,11 @@ namespace WebfrontCore.ViewComponents
|
||||
}
|
||||
|
||||
|
||||
ViewBag.UseNewStats = _configurationHandler.Configuration()?.EnableAdvancedMetrics ?? true;
|
||||
ViewBag.UseNewStats = _configurationHandler.Configuration().EnableAdvancedMetrics;
|
||||
return View("~/Views/Client/Statistics/Components/TopPlayers/_List.cshtml",
|
||||
ViewBag.UseNewStats
|
||||
_configurationHandler.Configuration().EnableAdvancedMetrics
|
||||
? await Plugin.Manager.GetNewTopStats(offset, count, serverId)
|
||||
: await Plugin.Manager.GetTopStats(offset, count, serverId));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace WebfrontCore.ViewModels
|
||||
{
|
||||
|
||||
public class ScoreboardInfo
|
||||
{
|
||||
public string ServerName { get; set; }
|
||||
public long ServerId { get; set; }
|
||||
public string MapName { get; set; }
|
||||
public string OrderByKey { get; set; }
|
||||
public bool ShouldOrderDescending { get; set; }
|
||||
public List<ClientScoreboardInfo> ClientInfo { get; set; }
|
||||
}
|
||||
|
||||
public class ClientScoreboardInfo
|
||||
{
|
||||
public string ClientName { get; set; }
|
||||
public long ClientId { get; set; }
|
||||
public int Score { get; set; }
|
||||
public int Ping { get; set; }
|
||||
public int? Kills { get; set; }
|
||||
public int? Deaths { get; set; }
|
||||
public double? ScorePerMinute { get; set; }
|
||||
public double? Kdr { get; set; }
|
||||
public double? ZScore { get; set; }
|
||||
}
|
||||
}
|
@ -18,7 +18,7 @@
|
||||
@if (!string.IsNullOrWhiteSpace(Model.CommunityInformation.Name))
|
||||
{
|
||||
<h2 class="mb-4 p-0 col-12 text-center text-md-left">
|
||||
<color-code value="@Model.CommunityInformation.Name"></color-code>
|
||||
<color-code value="@Model.CommunityInformation.Name" allow="@ViewBag.EnableColorCodes"></color-code>
|
||||
</h2>
|
||||
}
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
{
|
||||
<div class="p-4 bg-dark border border-primary mb-4 text-white-50 col-12">
|
||||
<h4 class="text-primary">@ViewBag.Localization["WEBFRONT_ABOUT_TITLE"]</h4>
|
||||
<color-code value="@Model.CommunityInformation.Description"></color-code>
|
||||
<color-code value="@Model.CommunityInformation.Description" allow="@ViewBag.EnableColorCodes"></color-code>
|
||||
<div class="mt-3">
|
||||
@foreach (var social in Model.CommunityInformation.SocialAccounts ?? new SocialAccountConfiguration[0])
|
||||
{
|
||||
@ -66,16 +66,16 @@
|
||||
var start = 1;
|
||||
<div class="col-12 bg-dark p-4 border border-primary mb-4 col-12">
|
||||
<div class="text-primary h4">
|
||||
<color-code value="@serverName"></color-code>
|
||||
<color-code value="@serverName" allow="@ViewBag.EnableColorCodes"></color-code>
|
||||
</div>
|
||||
@foreach (var rule in rules)
|
||||
{
|
||||
<div class="text-white-50">
|
||||
<span class="text-white">@start.</span>
|
||||
<color-code value="@rule"></color-code>
|
||||
<color-code value="@rule" allow="@ViewBag.EnableColorCodes"></color-code>
|
||||
</div>
|
||||
start++;
|
||||
}
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
@ -17,7 +17,7 @@
|
||||
<th scope="row" class="bg-primary">@loc["WEBFRONT_PENALTY_TEMPLATE_ADMIN"]</th>
|
||||
<td>
|
||||
<a asp-controller="Client" asp-action="ProfileAsync" asp-route-id="@info.OriginId" class="link-inverse">
|
||||
<color-code value="@info.OriginName"></color-code>
|
||||
<color-code value="@info.OriginName" allow="@ViewBag.EnableColorCodes"></color-code>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
@ -27,7 +27,7 @@
|
||||
@if (info.TargetId != null)
|
||||
{
|
||||
<a asp-controller="Client" asp-action="ProfileAsync" asp-route-id="@info.TargetId" class="link-inverse">
|
||||
<color-code value="@info.TargetName"></color-code>
|
||||
<color-code value="@info.TargetName" allow="@ViewBag.EnableColorCodes"></color-code>
|
||||
</a>
|
||||
}
|
||||
else
|
||||
@ -68,14 +68,14 @@
|
||||
</td>
|
||||
<td>
|
||||
<a asp-controller="Client" asp-action="ProfileAsync" asp-route-id="@info.OriginId" class="link-inverse">
|
||||
<color-code value="@info.OriginName"></color-code>
|
||||
<color-code value="@info.OriginName" allow="@ViewBag.EnableColorCodes"></color-code>
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
@if (info.TargetId != null)
|
||||
{
|
||||
<a asp-controller="Client" asp-action="ProfileAsync" asp-route-id="@info.TargetId" class="link-inverse">
|
||||
<color-code value="@info.TargetName"></color-code>
|
||||
<color-code value="@info.TargetName" allow="@ViewBag.EnableColorCodes"></color-code>
|
||||
</a>
|
||||
}
|
||||
else
|
||||
@ -96,4 +96,4 @@
|
||||
@info.When.ToString()
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
}
|
@ -17,7 +17,7 @@
|
||||
<div class="row pt-2 pb-2 bg-dark">
|
||||
<div class="col-5">
|
||||
<a asp-controller="Client" asp-action="ProfileAsync" asp-route-id="@client.ClientId">
|
||||
<color-code value="@client.Name"></color-code>
|
||||
<color-code value="@client.Name" allow="@ViewBag.EnableColorCodes"></color-code>
|
||||
</a>
|
||||
</div>
|
||||
@if (!ViewBag.Authorized && ViewBag.EnablePrivilegedUserPrivacy)
|
||||
@ -45,7 +45,7 @@
|
||||
<div class="col-7 bg-dark border-bottom">
|
||||
<div class="p-2">
|
||||
<a asp-controller="Client" asp-action="ProfileAsync" asp-route-id="@client.ClientId" class="link-inverse">
|
||||
<color-code value="@client.Name"></color-code>
|
||||
<color-code value="@client.Name" allow="@ViewBag.EnableColorCodes"></color-code>
|
||||
</a>
|
||||
</div>
|
||||
@if (!ViewBag.Authorized && ViewBag.EnablePrivilegedUserPrivacy)
|
||||
@ -59,4 +59,4 @@
|
||||
<div class="p-2 text-white-50">@client.LastConnectionText</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
@ -7,21 +7,21 @@
|
||||
<tr class="d-none d-lg-table-row">
|
||||
<td>
|
||||
<a asp-controller="Client" asp-action="ProfileAsync" asp-route-id="@message.ClientId" class="link-inverse">
|
||||
<color-code value="@message.ClientName"></color-code>
|
||||
<color-code value="@message.ClientName" allow="@ViewBag.EnableColorCodes"></color-code>
|
||||
</a>
|
||||
</td>
|
||||
<td class="text-light w-50 text-break">
|
||||
@if (message.IsHidden && !ViewBag.Authorized)
|
||||
{
|
||||
<color-code value="@SharedLibraryCore.Utilities.FormatExt(ViewBag.Localization["WEBFRONT_CLIENT_META_CHAT_HIDDEN"], message.HiddenMessage)"></color-code>
|
||||
<color-code value="@SharedLibraryCore.Utilities.FormatExt(ViewBag.Localization["WEBFRONT_CLIENT_META_CHAT_HIDDEN"], message.HiddenMessage)" allow="@ViewBag.EnableColorCodes"></color-code>
|
||||
}
|
||||
else
|
||||
{
|
||||
<color-code value="@message.Message"></color-code>
|
||||
<color-code value="@message.Message" allow="@ViewBag.EnableColorCodes"></color-code>
|
||||
}
|
||||
</td>
|
||||
<td class="text-light">
|
||||
<color-code value="@(message.ServerName ?? "--")"></color-code>
|
||||
<color-code value="@(message.ServerName ?? "--")" allow="@ViewBag.EnableColorCodes"></color-code>
|
||||
</td>
|
||||
<td class="text-right text-light">
|
||||
@message.When
|
||||
@ -33,7 +33,7 @@
|
||||
<th scope="row" class="bg-primary">@ViewBag.Localization["WEBFRONT_PENALTY_TEMPLATE_ADMIN"]</th>
|
||||
<td class="text-light">
|
||||
<a asp-controller="Client" asp-action="ProfileAsync" asp-route-id="@message.ClientId" class="link-inverse">
|
||||
<color-code value="@message.ClientName"></color-code>
|
||||
<color-code value="@message.ClientName" allow="@ViewBag.EnableColorCodes"></color-code>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
@ -43,11 +43,11 @@
|
||||
<td class="text-light">
|
||||
@if (message.IsHidden && !ViewBag.Authorized)
|
||||
{
|
||||
<color-code value="@SharedLibraryCore.Utilities.FormatExt(ViewBag.Localization["WEBFRONT_CLIENT_META_CHAT_HIDDEN"], message.HiddenMessage)"></color-code>
|
||||
<color-code value="@SharedLibraryCore.Utilities.FormatExt(ViewBag.Localization["WEBFRONT_CLIENT_META_CHAT_HIDDEN"], message.HiddenMessage)" allow="@ViewBag.EnableColorCodes"></color-code>
|
||||
}
|
||||
else
|
||||
{
|
||||
<color-code value="@message.Message"></color-code>
|
||||
<color-code value="@message.Message" allow="@ViewBag.EnableColorCodes"></color-code>
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
@ -55,7 +55,7 @@
|
||||
<tr class="d-table-row d-lg-none bg-dark">
|
||||
<th scope="row" class="bg-primary">@ViewBag.Localization["WEBFRONT_STATS_MESSAGE_SERVER_NAME"]</th>
|
||||
<td class="text-light">
|
||||
<color-code value="@(message.ServerName ?? "--")"></color-code>
|
||||
<color-code value="@(message.ServerName ?? "--")" allow="@ViewBag.EnableColorCodes"></color-code>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@ -65,4 +65,4 @@
|
||||
@message.When
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
}
|
@ -14,11 +14,11 @@
|
||||
@foreach (var client in Model[key])
|
||||
{
|
||||
<a asp-controller="Client" asp-action="ProfileAsync" asp-route-id="@client.ClientId">
|
||||
<color-code value="@client.Name"></color-code>
|
||||
<color-code value="@client.Name" allow="@ViewBag.EnableColorCodes"></color-code>
|
||||
</a>
|
||||
<br />
|
||||
}
|
||||
</div>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
</div>
|
@ -25,7 +25,7 @@
|
||||
<div class="w-50 d-block d-lg-inline-flex flex-column flex-fill text-center text-lg-left pb-3 pb-lg-0 pt-3 pt-lg-0 pl-3 pr-3 ml-auto mr-auto" style="overflow-wrap: anywhere">
|
||||
<div class="mt-n2 d-block d-lg-inline-flex @(ViewBag.Authorized ? "" : "flex-fill")">
|
||||
<div id="profile_name" class="client-name h1 mb-0">
|
||||
<color-code value="@Model.Name"></color-code>
|
||||
<color-code value="@Model.Name" allow="@ViewBag.EnableColorCodes"></color-code>
|
||||
</div>
|
||||
@if (ViewBag.Authorized)
|
||||
{
|
||||
@ -50,7 +50,7 @@
|
||||
@foreach (var alias in Model.Aliases)
|
||||
{
|
||||
<div>
|
||||
<color-code value="@alias"></color-code>
|
||||
<color-code value="@alias" allow="@ViewBag.EnableColorCodes"></color-code>
|
||||
</div>
|
||||
}
|
||||
|
||||
@ -196,4 +196,4 @@
|
||||
<script type="text/javascript" src="~/js/profile.js"></script>
|
||||
</environment>
|
||||
<script>initLoader('/Client/Meta/@Model.ClientId', '#profile_events', 30, 30, [{ 'name': 'metaFilterType', 'value': '@Model.MetaFilterType' }]);</script>
|
||||
}
|
||||
}
|
@ -18,7 +18,7 @@
|
||||
{
|
||||
<span class="text-highlight">
|
||||
<a class="link-inverse" href="@Model.OffenderClientId">
|
||||
<color-code value="@Model.OffenderName"></color-code>
|
||||
<color-code value="@Model.OffenderName" allow="@ViewBag.EnableColorCodes"></color-code>
|
||||
</a>
|
||||
</span>
|
||||
}
|
||||
@ -33,7 +33,7 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
<color-code value="@Model.Offense"></color-code>
|
||||
<color-code value="@Model.Offense" allow="@ViewBag.EnableColorCodes"></color-code>
|
||||
}
|
||||
|
||||
</span>
|
||||
|
@ -15,7 +15,7 @@
|
||||
break;
|
||||
case "server":
|
||||
<span class="text-white">
|
||||
<color-code value="@Model.ServerName"></color-code>
|
||||
<color-code value="@Model.ServerName" allow="@ViewBag.EnableColorCodes"></color-code>
|
||||
</span>
|
||||
break;
|
||||
}
|
||||
@ -25,4 +25,4 @@
|
||||
{
|
||||
<span class="text-muted">@token.MatchValue</span>
|
||||
}
|
||||
}
|
||||
}
|
@ -22,7 +22,7 @@
|
||||
{
|
||||
if (result.IsInterpolation)
|
||||
{
|
||||
<span class="profile-meta-value text-primary"><color-code value="@meta.Value"></color-code></span>
|
||||
<span class="profile-meta-value text-primary"><color-code value="@meta.Value" allow="@ViewBag.EnableColorCodes"></color-code></span>
|
||||
}
|
||||
|
||||
else
|
||||
@ -34,10 +34,10 @@
|
||||
|
||||
else
|
||||
{
|
||||
<span class="profile-meta-value text-primary"><color-code value="@meta.Value"></color-code></span>
|
||||
<span class="profile-meta-value text-primary"><color-code value="@meta.Value" allow="@ViewBag.EnableColorCodes"></color-code></span>
|
||||
<span class="profile-meta-title text-muted"> @meta.Key</span>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
}
|
@ -11,12 +11,12 @@
|
||||
|
||||
@if (Model.IsHidden && !ViewBag.Authorized)
|
||||
{
|
||||
<color-code value="@SharedLibraryCore.Utilities.FormatExt(ViewBag.Localization["WEBFRONT_CLIENT_META_CHAT_HIDDEN"], Model.HiddenMessage)"></color-code>
|
||||
<color-code value="@SharedLibraryCore.Utilities.FormatExt(ViewBag.Localization["WEBFRONT_CLIENT_META_CHAT_HIDDEN"], Model.HiddenMessage)" allow="@ViewBag.EnableColorCodes"></color-code>
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
<color-code value="@Model.Message"></color-code>
|
||||
<color-code value="@Model.Message" allow="@ViewBag.EnableColorCodes"></color-code>
|
||||
}
|
||||
</span>
|
||||
</span>
|
||||
</span>
|
@ -19,7 +19,7 @@
|
||||
{
|
||||
<span class="text-highlight">
|
||||
<a class="link-inverse" href="@Model.PunisherClientId">
|
||||
<color-code value="@Model.PunisherName"></color-code>
|
||||
<color-code value="@Model.PunisherName" allow="@ViewBag.EnableColorCodes"></color-code>
|
||||
</a>
|
||||
</span>
|
||||
}
|
||||
@ -34,7 +34,7 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
<color-code value="@Model.Offense"></color-code>
|
||||
<color-code value="@Model.Offense" allow="@ViewBag.EnableColorCodes"></color-code>
|
||||
}
|
||||
|
||||
</span>
|
||||
@ -65,7 +65,7 @@
|
||||
else
|
||||
{
|
||||
<a class="link-inverse" href="@Model.OffenderClientId">
|
||||
<color-code value="@Model.OffenderName"></color-code>
|
||||
<color-code value="@Model.OffenderName" allow="@ViewBag.EnableColorCodes"></color-code>
|
||||
</a>
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,7 @@
|
||||
break;
|
||||
case "alias":
|
||||
<span class="text-white">
|
||||
<color-code value="@Model.Name"></color-code>
|
||||
<color-code value="@Model.Name" allow="@ViewBag.EnableColorCodes"></color-code>
|
||||
[@Model.IPAddress]
|
||||
</span>
|
||||
break;
|
||||
|
@ -7,7 +7,7 @@
|
||||
{
|
||||
<li class="nav-item ">
|
||||
<a class="nav-link top-players-link" href="#server_@server.ID" role="tab" data-toggle="tab" aria-selected="false" data-serverid="@server.ID">
|
||||
<color-code value="@server.Name"></color-code>
|
||||
<color-code value="@server.Name" allow="@ViewBag.EnableColorCodes"></color-code>
|
||||
</a>
|
||||
</li>
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
<th scope="row" class="bg-primary">@loc["WEBFRONT_PENALTY_TEMPLATE_NAME"]</th>
|
||||
<td>
|
||||
<a asp-controller="Client" asp-action="ProfileAsync" asp-route-id="@Model.OffenderId" class="link-inverse">
|
||||
<color-code value="@Model.OffenderName"></color-code>
|
||||
<color-code value="@Model.OffenderName" allow="@ViewBag.EnableColorCodes"></color-code>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
@ -24,7 +24,7 @@
|
||||
<tr class="d-table-row d-lg-none bg-dark">
|
||||
<th scope="row" class="bg-primary">@loc["WEBFRONT_PENALTY_TEMPLATE_OFFENSE"]</th>
|
||||
<td class="text-light">
|
||||
<color-code value="@($"{Model.Offense}{(ViewBag.Authorized ? Model.AdditionalPenaltyInformation : "")}")"></color-code>
|
||||
<color-code value="@($"{Model.Offense}{(ViewBag.Authorized ? Model.AdditionalPenaltyInformation : "")}")" allow="@ViewBag.EnableColorCodes"></color-code>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@ -59,14 +59,14 @@
|
||||
<tr class="d-none d-lg-table-row">
|
||||
<td>
|
||||
<a asp-controller="Client" asp-action="ProfileAsync" asp-route-id="@Model.OffenderId" class="link-inverse">
|
||||
<color-code value="@Model.OffenderName"></color-code>
|
||||
<color-code value="@Model.OffenderName" allow="@ViewBag.EnableColorCodes"></color-code>
|
||||
</a>
|
||||
</td>
|
||||
<td class="penalties-color-@Model.PenaltyTypeText.ToLower()">
|
||||
@Model.PenaltyType
|
||||
</td>
|
||||
<td class="text-light w-50">
|
||||
<color-code value="@($"{Model.Offense}{(ViewBag.Authorized ? Model.AdditionalPenaltyInformation : "")}")"></color-code>
|
||||
<color-code value="@($"{Model.Offense}{(ViewBag.Authorized ? Model.AdditionalPenaltyInformation : "")}")" allow="@ViewBag.EnableColorCodes"></color-code>
|
||||
</td>
|
||||
<td>
|
||||
@Html.ActionLink(SharedLibraryCore.Utilities.StripColors(Model.PunisherName), "ProfileAsync",
|
||||
@ -88,4 +88,4 @@
|
||||
}
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
</tr>
|
@ -1,30 +0,0 @@
|
||||
@model IEnumerable<WebfrontCore.ViewModels.ScoreboardInfo>
|
||||
|
||||
<ul class="nav nav-tabs border-top border-bottom nav-fill row" role="tablist" id="scoreboard_servers">
|
||||
@{ var i = 0; }
|
||||
@foreach (var server in Model)
|
||||
{
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#server_@server.ServerId" role="tab" data-toggle="tab" id="server_@(server.ServerId)_nav" data-serverid="@server.ServerId">
|
||||
<color-code value="@server.ServerName"></color-code>
|
||||
</a>
|
||||
</li>
|
||||
i++;
|
||||
}
|
||||
</ul>
|
||||
<div class="tab-content border-bottom row">
|
||||
@{ i = 0; }
|
||||
@foreach (var server in Model)
|
||||
{
|
||||
<div role="tabpanel" class="scoreboard-container tab-pane striped flex-fill" id="server_@server.ServerId" data-server-id="@server.ServerId">
|
||||
@await Html.PartialAsync("_Scoreboard", server)
|
||||
</div>
|
||||
i++;
|
||||
}
|
||||
</div>
|
||||
|
||||
@section scripts {
|
||||
<environment include="Development">
|
||||
<script type="text/javascript" src="~/js/scoreboard.js" defer="defer"></script>
|
||||
</environment>
|
||||
}
|
@ -21,24 +21,24 @@
|
||||
{
|
||||
<span class="text-light">
|
||||
<span class="oi oi-account-login mr-2 text-success"> </span>
|
||||
<color-code value="@Model.ChatHistory[i].Name"></color-code>
|
||||
<color-code value="@Model.ChatHistory[i].Name" allow="@ViewBag.EnableColorCodes"></color-code>
|
||||
</span><br />
|
||||
}
|
||||
if (Model.ChatHistory[i].Message == "DISCONNECTED")
|
||||
{
|
||||
<span class="text-light">
|
||||
<span class="oi oi-account-logout mr-2 text-danger"> </span>
|
||||
<color-code value="@Model.ChatHistory[i].Name"></color-code>
|
||||
<color-code value="@Model.ChatHistory[i].Name" allow="@ViewBag.EnableColorCodes"></color-code>
|
||||
</span><br />
|
||||
}
|
||||
if (Model.ChatHistory[i].Message != "CONNECTED" && Model.ChatHistory[i].Message != "DISCONNECTED")
|
||||
{
|
||||
<span class="text-light">
|
||||
<color-code value="@Model.ChatHistory[i].Name"></color-code>
|
||||
<color-code value="@Model.ChatHistory[i].Name" allow="@ViewBag.EnableColorCodes"></color-code>
|
||||
</span>
|
||||
<span>
|
||||
—
|
||||
<color-code value="@message.CapClientName(48)"></color-code>
|
||||
<color-code value="@message.CapClientName(48)" allow="@ViewBag.EnableColorCodes"></color-code>
|
||||
</span><br />
|
||||
}
|
||||
}
|
||||
@ -63,7 +63,7 @@
|
||||
}
|
||||
|
||||
<a asp-controller="Client" asp-action="ProfileAsync" asp-route-id="@Model.Players[i].ClientId" class="@levelColorClass">
|
||||
<color-code value="@Model.Players[i].Name"></color-code>
|
||||
<color-code value="@Model.Players[i].Name" allow="@ViewBag.EnableColorCodes"></color-code>
|
||||
</a>
|
||||
|
||||
@if (ViewBag.Authorized)
|
||||
@ -88,7 +88,7 @@
|
||||
|
||||
<div>
|
||||
<a asp-controller="Client" asp-action="ProfileAsync" asp-route-id="@Model.Players[i].ClientId" class="@levelColorClass">
|
||||
<color-code value="@Model.Players[i].Name"></color-code>
|
||||
<color-code value="@Model.Players[i].Name" allow="@ViewBag.EnableColorCodes"></color-code>
|
||||
</a>
|
||||
@if (ViewBag.Authorized)
|
||||
{
|
||||
@ -122,26 +122,26 @@
|
||||
{
|
||||
<span class="text-light">
|
||||
<span class="oi oi-account-login mr-2 text-success"> </span>
|
||||
<color-code value="@Model.ChatHistory[i].Name"></color-code>
|
||||
<color-code value="@Model.ChatHistory[i].Name" allow="@ViewBag.EnableColorCodes"></color-code>
|
||||
</span><br />
|
||||
}
|
||||
if (Model.ChatHistory[i].Message == "DISCONNECTED")
|
||||
{
|
||||
<span class="text-light">
|
||||
<span class="oi oi-account-logout mr-2 text-danger"> </span>
|
||||
<color-code value="@Model.ChatHistory[i].Name"></color-code>
|
||||
<color-code value="@Model.ChatHistory[i].Name" allow="@ViewBag.EnableColorCodes"></color-code>
|
||||
</span><br />
|
||||
}
|
||||
if (Model.ChatHistory[i].Message != "CONNECTED" && Model.ChatHistory[i].Message != "DISCONNECTED")
|
||||
{
|
||||
<span class="text-light">
|
||||
<color-code value="@Model.ChatHistory[i].Name"></color-code>
|
||||
<color-code value="@Model.ChatHistory[i].Name" allow="@ViewBag.EnableColorCodes"></color-code>
|
||||
</span>
|
||||
<span>
|
||||
—
|
||||
<color-code value="@message.CapClientName(48)"></color-code>
|
||||
<color-code value="@message.CapClientName(48)" allow="@ViewBag.EnableColorCodes"></color-code>
|
||||
</span><br />
|
||||
}
|
||||
}
|
||||
}
|
||||
</div>
|
||||
</div>
|
@ -1,56 +0,0 @@
|
||||
@using WebfrontCore.ViewModels
|
||||
@using System.Globalization
|
||||
@model WebfrontCore.ViewModels.ScoreboardInfo
|
||||
@{
|
||||
Layout = null;
|
||||
|
||||
object OrderByFunc(ClientScoreboardInfo item)
|
||||
{
|
||||
var property = typeof(ClientScoreboardInfo).GetProperties().FirstOrDefault(prop =>
|
||||
prop.CanRead && prop.Name.Equals(Model.OrderByKey, StringComparison.InvariantCultureIgnoreCase));
|
||||
|
||||
return property != null ? property.GetValue(item) : item.Score;
|
||||
}
|
||||
|
||||
string GetColumnSortDisplay(string propertyName)
|
||||
{
|
||||
if (propertyName == (Model.OrderByKey ?? nameof(ClientScoreboardInfo.Score)))
|
||||
{
|
||||
return Model.ShouldOrderDescending ? "<span class=\"ml-2\">▼</span>" : "<span class=\"ml-2\">▲</span>";
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
<table class="table table-striped thead-light bg-dark mb-0 table-responsive-md table-sort"
|
||||
data-sort-column="@(Model.OrderByKey ?? nameof(ClientScoreboardInfo.Score))"
|
||||
data-sort-down="@Model.ShouldOrderDescending.ToString().ToLower()">
|
||||
<tr class="bg-dark border-bottom">
|
||||
<th class="table-sort-column" data-column-name="@nameof(ClientScoreboardInfo.ClientName)">@ViewBag.Localization["WEBFRONT_SCOREBOARD_TABLE_PLAYER"]@Html.Raw(GetColumnSortDisplay(nameof(ClientScoreboardInfo.ClientName)))</th>
|
||||
<th class="table-sort-column" data-column-name="@nameof(ClientScoreboardInfo.Score)">@ViewBag.Localization["WEBFRONT_ADV_STATS_SCORE"]@Html.Raw(GetColumnSortDisplay(nameof(ClientScoreboardInfo.Score)))</th>
|
||||
<th class="table-sort-column" data-column-name="@nameof(ClientScoreboardInfo.Kills)">@ViewBag.Localization["WEBFRONT_ADV_STATS_KILLS"]@Html.Raw(GetColumnSortDisplay(nameof(ClientScoreboardInfo.Kills)))</th>
|
||||
<th class="table-sort-column" data-column-name="@nameof(ClientScoreboardInfo.Deaths)">@ViewBag.Localization["WEBFRONT_SCOREBOARD_TABLE_DEATHS"]@Html.Raw(GetColumnSortDisplay(nameof(ClientScoreboardInfo.Deaths)))</th>
|
||||
<th class="table-sort-column" data-column-name="@nameof(ClientScoreboardInfo.Kdr)">@ViewBag.Localization["WEBFRONT_SCOREBOARD_TABLE_RATIO"]@Html.Raw(GetColumnSortDisplay(nameof(ClientScoreboardInfo.Kdr)))</th>
|
||||
<th class="table-sort-column" data-column-name="@nameof(ClientScoreboardInfo.ScorePerMinute)">@ViewBag.Localization["WEBFRONT_SCOREBOARD_TABLE_SPM"]@Html.Raw(GetColumnSortDisplay(nameof(ClientScoreboardInfo.ScorePerMinute)))</th>
|
||||
<th class="table-sort-column" data-column-name="@nameof(ClientScoreboardInfo.ZScore)">@ViewBag.Localization["WEBFRONT_ADV_STATS_ZSCORE"]@Html.Raw(GetColumnSortDisplay(nameof(ClientScoreboardInfo.ZScore)))</th>
|
||||
<th class="text-right table-sort-column" data-column-name="@nameof(ClientScoreboardInfo.Ping)">@ViewBag.Localization["WEBFRONT_SCOREBOARD_TABLE_PING"]@Html.Raw(GetColumnSortDisplay(nameof(ClientScoreboardInfo.Ping)))</th>
|
||||
</tr>
|
||||
@foreach (var client in Model.ShouldOrderDescending ? Model.ClientInfo.OrderByDescending(OrderByFunc) : Model.ClientInfo.OrderBy(OrderByFunc))
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
<a asp-controller="Client" asp-action="ProfileAsync" asp-route-id="@client.ClientId">
|
||||
<color-code value="@client.ClientName"></color-code>
|
||||
</a>
|
||||
</td>
|
||||
<td>@client.Score</td>
|
||||
<td>@(client.Kills ?? 0)</td>
|
||||
<td>@(client.Deaths ?? 0)</td>
|
||||
<td>@Math.Round(client.Kdr ?? 0, 2)</td>
|
||||
<td>@Math.Round(client.ScorePerMinute ?? 0)</td>
|
||||
<td>@(client.ZScore == null ? "--" : Math.Round(client.ZScore.Value, 2).ToString(CultureInfo.CurrentCulture))</td>
|
||||
<td class="text-right">@client.Ping</td>
|
||||
</tr>
|
||||
}
|
||||
</table>
|
@ -5,19 +5,15 @@
|
||||
|
||||
<div class="row server-header pt-1 pb-1 bg-primary " id="server_header_@Model.ID">
|
||||
<div class="col-md-4 text-center text-md-left d-inline-flex justify-content-center justify-content-md-start">
|
||||
<color-code value="@Model.Name"></color-code>
|
||||
<a href="@Model.ConnectProtocolUrl" class="ml-2 mr-2 align-self-center d-none d-md-flex server-join-button" title="@Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_HOME_JOIN_DESC"]">
|
||||
<color-code value="@Model.Name" allow="@ViewBag.EnableColorCodes"></color-code>
|
||||
<a href="@Model.ConnectProtocolUrl" class="ml-2 mr-2 align-self-center d-none d-md-flex server-join-button" title="@SharedLibraryCore.Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_HOME_JOIN_DESC"]">
|
||||
<span class="oi oi-play-circle mr-1 align-self-center"></span>
|
||||
<span class="server-header-ip-address" style="display:none;">@Model.IPAddress</span>
|
||||
</a>
|
||||
@if (ViewBag.Authorized)
|
||||
{
|
||||
<span class="oi oi-chat align-self-center profile-action d-none d-md-flex mr-2" data-action="chat" data-action-id="@Model.ID"></span>
|
||||
<span class="oi oi-chat align-self-center profile-action d-none d-md-flex" data-action="chat" data-action-id="@Model.ID"></span>
|
||||
}
|
||||
<a asp-controller="Server" asp-action="Scoreboard" asp-fragment="server_@Model.ID" title="@ViewBag.Localization["WEBFRONT_TITLE_SCOREBOARD"]"
|
||||
class="align-self-center d-none d-md-flex">
|
||||
<span class="oi oi-spreadsheet ml-1"></span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="text-center col-md-4 align-self-center">
|
||||
@ -43,14 +39,10 @@
|
||||
|
||||
@if (ViewBag.Authorized)
|
||||
{
|
||||
<div class="p-1 d-flex d-md-none justify-content-center col-12">
|
||||
<div class=" p-1 d-flex d-md-none justify-content-center col-12">
|
||||
<span class="oi oi-chat align-self-center profile-action d-flex d-md-none" data-action="chat" data-action-id="@Model.ID"></span>
|
||||
</div>
|
||||
}
|
||||
<a asp-controller="Server" asp-action="Scoreboard" title="@ViewBag.Localization["WEBFRONT_TITLE_SCOREBOARD"]"
|
||||
class="p-1 d-flex d-md-none justify-content-center col-12">
|
||||
<span class="oi oi-spreadsheet ml-1"></span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div id="server_clientactivity_@Model.ID" class="bg-dark row server-activity @(Model.ClientCount > 0 ? "pt-2 pb-2" : "")">
|
||||
|
@ -40,7 +40,7 @@
|
||||
<div class="p-2 mb-3 border-bottom" style="background-color: #222;">
|
||||
<div class="d-flex flex-row">
|
||||
<a asp-controller="Client" asp-action="ProfileAsync" asp-route-id="@client.ClientId" class="h4 mr-auto">
|
||||
<color-code value="@client.Name"></color-code>
|
||||
<color-code value="@client.Name" allow="@ViewBag.EnableColorCodes"></color-code>
|
||||
</a>
|
||||
<div class="client-location-flag align-self-center" data-ip="@client.IPAddress"></div>
|
||||
</div>
|
||||
@ -49,4 +49,4 @@
|
||||
<div class="align-self-center">@client.LastConnectionText</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
}
|
@ -45,6 +45,7 @@
|
||||
<None Include="wwwroot\css\global.min.css" CopyToPublishDirectory="PreserveNewest" />
|
||||
<None Include="wwwroot\js\global.min.js" CopyToPublishDirectory="PreserveNewest" />
|
||||
<None Include="wwwroot\images\**\*.*" CopyToPublishDirectory="PreserveNewest" />
|
||||
<Content Remove="wwwroot\images\icons\crosshair.png" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -27,7 +27,6 @@
|
||||
"wwwroot/js/search.js",
|
||||
"wwwroot/js/loader.js",
|
||||
"wwwroot/js/stats.js",
|
||||
"wwwroot/js/scoreboard.js",
|
||||
"wwwroot/js/configuration.js",
|
||||
"wwwroot/js/advanced_stats.js"
|
||||
],
|
||||
|
@ -197,7 +197,7 @@ form *, select, button.btn {
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
.oi, .table-sort-column {
|
||||
.oi {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
@ -454,4 +454,4 @@ div.card {
|
||||
padding-left: 1rem !important;
|
||||
padding-right: 1rem !important;
|
||||
line-height: 1.45rem !important;
|
||||
}
|
||||
}
|
@ -1,32 +0,0 @@
|
||||
function refreshScoreboard() {
|
||||
const serverPanel = $('.scoreboard-container.active');
|
||||
const serverId = $(serverPanel).data('server-id');
|
||||
|
||||
const scoreboardTable = $(serverPanel).children('.table-sort');
|
||||
|
||||
$.get(`../Server/${serverId}/Scoreboard?order=${scoreboardTable.data('sort-column')}&down=${scoreboardTable.data('sort-down')}`, (response) => {
|
||||
$(serverPanel).html(response);
|
||||
setupDataSorting();
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(() => {
|
||||
$(window.location.hash).tab('show');
|
||||
$(`${window.location.hash}_nav`).addClass('active');
|
||||
|
||||
setupDataSorting();
|
||||
})
|
||||
|
||||
function setupDataSorting() {
|
||||
const tableColumn = $('.table-sort-column');
|
||||
$(tableColumn).off('click');
|
||||
$(tableColumn).on('click', function() {
|
||||
const columnName = $(this).data('column-name');
|
||||
const table = $('.table-sort');
|
||||
$(table).data('sort-column', columnName);
|
||||
$(table).data('sort-down', $(table).data('sort-down') !== true);
|
||||
refreshScoreboard();
|
||||
})
|
||||
}
|
||||
|
||||
setInterval(refreshScoreboard, 5000);
|
Reference in New Issue
Block a user