From e843f839f5c442dcc14cf0a23bd9e863899a5acf Mon Sep 17 00:00:00 2001 From: RaidMax Date: Fri, 2 Jun 2023 16:35:00 -0500 Subject: [PATCH] adjust last seen format in game interface --- GameFiles/GameInterface/_integration_base.gsc | 6 +++--- GameFiles/GameInterface/_integration_shared.gsc | 4 ++-- GameFiles/GameInterface/_integration_t5zm.gsc | 2 +- GameFiles/GameInterface/_integration_t6zm_helper.gsc | 4 ++-- Plugins/ScriptPlugins/GameInterface.js | 2 +- SharedLibraryCore/PartialEntities/EFClient.cs | 3 +++ 6 files changed, 12 insertions(+), 9 deletions(-) diff --git a/GameFiles/GameInterface/_integration_base.gsc b/GameFiles/GameInterface/_integration_base.gsc index 6ff020844..c170bf183 100644 --- a/GameFiles/GameInterface/_integration_base.gsc +++ b/GameFiles/GameInterface/_integration_base.gsc @@ -347,7 +347,7 @@ QueueEvent( request, eventType, notifyEntity ) timedOut = "unset"; } - if ( timedOut == "set") + if ( timedOut == "set" ) { LogDebug( "Timed out waiting for response..." ); @@ -527,8 +527,8 @@ OnExecuteCommand( event ) OnSetClientDataCompleted( event ) { - // IW4MAdmin let us know it persisted (success or fail) - LogDebug( "Set Client Data -> subtype = " + CoerceUndefined( event.subType ) + ", status = " + CoerceUndefined( event.data["status"] ) ); + data = ParseDataString( event.data ); + LogDebug( "Set Client Data -> subtype = " + CoerceUndefined( event.subType ) + ", status = " + CoerceUndefined( data["status"] ) ); } CoerceUndefined( object ) diff --git a/GameFiles/GameInterface/_integration_shared.gsc b/GameFiles/GameInterface/_integration_shared.gsc index be81e2daa..21d7b01f1 100644 --- a/GameFiles/GameInterface/_integration_shared.gsc +++ b/GameFiles/GameInterface/_integration_shared.gsc @@ -134,7 +134,7 @@ PlayerSpawnEvents() self IPrintLnBold( "Welcome, your level is ^5" + clientData.permissionLevel ); wait( 2.0 ); - self IPrintLnBold( "You were last seen ^5" + clientData.lastConnection ); + self IPrintLnBold( "You were last seen ^5" + clientData.lastConnection + " ago" ); } @@ -467,7 +467,7 @@ GetClosestPerformanceClientForTeam( sourceTeam, excluded ) else if ( candidateValue < closest ) { - scripts\_integration_base::LogDebug( candidateValue + " is the new best value "); + scripts\_integration_base::LogDebug( candidateValue + " is the new best value " ); choice = players[i]; closest = candidateValue; } diff --git a/GameFiles/GameInterface/_integration_t5zm.gsc b/GameFiles/GameInterface/_integration_t5zm.gsc index 0b2efd8cc..d56821f12 100644 --- a/GameFiles/GameInterface/_integration_t5zm.gsc +++ b/GameFiles/GameInterface/_integration_t5zm.gsc @@ -106,7 +106,7 @@ _GetPlayerFromClientNum( clientNum ) return undefined; } - players = GetPlayers("all"); + players = GetPlayers( "all" ); for ( i = 0; i < players.size; i++ ) { diff --git a/GameFiles/GameInterface/_integration_t6zm_helper.gsc b/GameFiles/GameInterface/_integration_t6zm_helper.gsc index 59f4389d3..befcf0a29 100644 --- a/GameFiles/GameInterface/_integration_t6zm_helper.gsc +++ b/GameFiles/GameInterface/_integration_t6zm_helper.gsc @@ -12,11 +12,11 @@ OnPlayerConnect() for ( ;; ) { level waittill( "connecting", player ); - player thread DisplaypopupsWaiter(); + player thread DisplayPopupsWaiter(); } } -DisplaypopupsWaiter() +DisplayPopupsWaiter() { self endon( "disconnect" ); self.ranknotifyqueue = []; diff --git a/Plugins/ScriptPlugins/GameInterface.js b/Plugins/ScriptPlugins/GameInterface.js index 5fd82d993..2c56c0002 100644 --- a/Plugins/ScriptPlugins/GameInterface.js +++ b/Plugins/ScriptPlugins/GameInterface.js @@ -208,7 +208,7 @@ const plugin = { data = { level: client.level, clientId: client.clientId, - lastConnection: client.lastConnection, + lastConnection: client.timeSinceLastConnectionString, tag: tagMeta?.value ?? '', performance: clientStats?.performance ?? 200.0 }; diff --git a/SharedLibraryCore/PartialEntities/EFClient.cs b/SharedLibraryCore/PartialEntities/EFClient.cs index bfa35930d..c5c764f43 100644 --- a/SharedLibraryCore/PartialEntities/EFClient.cs +++ b/SharedLibraryCore/PartialEntities/EFClient.cs @@ -117,6 +117,9 @@ namespace SharedLibraryCore.Database.Models [NotMapped] public TeamType Team { get; set; } [NotMapped] public string TeamName { get; set; } + [NotMapped] + public string TimeSinceLastConnectionString => (DateTime.UtcNow - LastConnection).HumanizeForCurrentCulture(); + [NotMapped] // this is kinda dirty, but I need localizable level names public ClientPermission ClientPermission => new ClientPermission