This commit is contained in:
GenZmeY 2022-08-30 05:42:39 +03:00
parent 1f8df8d1eb
commit af27cfe6c7
8 changed files with 57 additions and 21 deletions

Binary file not shown.

Binary file not shown.

View File

@ -2,9 +2,10 @@ class CfgSrvRank extends Object
config(MSKGS) config(MSKGS)
abstract; abstract;
var public config bool bAuto; var public config bool bAuto;
var public config bool bCustom; var public config bool bCustom;
var public config bool bUsesStats; var public config bool bUsesStats;
var public config String PasswdText;
public static function InitConfig(int Version, int LatestVersion, E_LogLevel LogLevel) public static function InitConfig(int Version, int LatestVersion, E_LogLevel LogLevel)
{ {

View File

@ -16,6 +16,7 @@ var public config String HexColorPlayer;
var public config String HexColorLeave; var public config String HexColorLeave;
var public config int CheckGroupTimer; var public config int CheckGroupTimer;
var public config int MaxRetries;
public static function InitConfig(int Version, int LatestVersion, E_LogLevel LogLevel) public static function InitConfig(int Version, int LatestVersion, E_LogLevel LogLevel)
{ {
@ -72,7 +73,13 @@ public static function Load(E_LogLevel LogLevel)
if (default.CheckGroupTimer < 0) if (default.CheckGroupTimer < 0)
{ {
`Log_Error("CheckGroupTimer" @ "(" $ default.CheckGroupTimer $ ")" @ "must be equal or greater than 0"); `Log_Error("CheckGroupTimer" @ "(" $ default.CheckGroupTimer $ ")" @ "must be equal or greater than 0");
default.CheckGroupTimer = 0; default.CheckGroupTimer = 1;
}
if (default.MaxRetries < 0)
{
`Log_Error("MaxRetries" @ "(" $ default.MaxRetries $ ")" @ "must be equal or greater than 0");
default.MaxRetries = 60;
} }
if (!IsValidHexColor(default.HexColorOwner, LogLevel)) if (!IsValidHexColor(default.HexColorOwner, LogLevel))
@ -112,13 +119,14 @@ private static function ApplyDefault(E_LogLevel LogLevel)
default.BoostGroup = 10; default.BoostGroup = 10;
default.BoostPlayer = 0; default.BoostPlayer = 0;
default.HexColorOwner = "00FF00"; default.HexColorOwner = "0099FF";
default.HexColorAdmin = "00FF00"; default.HexColorAdmin = "FF0000";
default.HexColorGroup = "00FF00"; default.HexColorGroup = "00FF00";
default.HexColorPlayer = "FFFFFF"; default.HexColorPlayer = "FFFFFF";
default.HexColorLeave = "FF0000"; default.HexColorLeave = "FFFF00";
default.CheckGroupTimer = 0; default.CheckGroupTimer = 2;
default.MaxRetries = 60;
} }
private static function bool IsValidHexColor(String HexColor, E_LogLevel LogLevel) private static function bool IsValidHexColor(String HexColor, E_LogLevel LogLevel)

View File

@ -413,6 +413,7 @@ public function MSKGS_RepInfo CreateRepInfo(Controller C)
Self, Self,
GroupID, GroupID,
CfgXPBoost.default.CheckGroupTimer, CfgXPBoost.default.CheckGroupTimer,
CfgXPBoost.default.MaxRetries,
C.PlayerReplicationInfo.UniqueId == OwnerID); C.PlayerReplicationInfo.UniqueId == OwnerID);
RepInfos.AddItem(RepInfo); RepInfos.AddItem(RepInfo);

View File

@ -5,11 +5,11 @@ const CfgXPBoost = class'CfgXPBoost';
const CfgSrvRank = class'CfgSrvRank'; const CfgSrvRank = class'CfgSrvRank';
public static function UpdateGameSettings( public static function UpdateGameSettings(
KFGameInfo_Survival KFGI, KFGameInfo_Survival KFGI,
String GameModeClass, String GameModeClass,
IMSKGS MSKGS, IMSKGS MSKGS,
bool bCustomGame, bool bCustomGame,
bool bUsesStats) bool bUsesStats)
{ {
local name SessionName; local name SessionName;
local KFOnlineGameSettings KFGameSettings; local KFOnlineGameSettings KFGameSettings;
@ -74,17 +74,21 @@ bool bUsesStats)
KFGameSettings.NumWaves = KFGI.WaveMax - 1; KFGameSettings.NumWaves = KFGI.WaveMax - 1;
} }
if (MSKGS == None || !MSKGS.GetXPNotifications() || MSKGS.GetXPBoost() <= 0) if (KFGI.RequiresPassword() && CfgSrvRank.default.PasswdText != "")
{
KFGameSettings.OwningPlayerName = class'GameReplicationInfo'.default.ServerName @ "|" @ CfgSrvRank.default.PasswdText;
}
else if (MSKGS == None || !MSKGS.GetXPNotifications() || MSKGS.GetXPBoost() <= 0)
{ {
KFGameSettings.OwningPlayerName = class'GameReplicationInfo'.default.ServerName; KFGameSettings.OwningPlayerName = class'GameReplicationInfo'.default.ServerName;
} }
else if (MSKGS.GetXPBoost() >= CfgXPBoost.default.MaxBoost) else if (MSKGS.GetXPBoost() >= CfgXPBoost.default.MaxBoost)
{ {
KFGameSettings.OwningPlayerName = class'GameReplicationInfo'.default.ServerName $ " | +" $ CfgXPBoost.default.MaxBoost $ "% XP"; KFGameSettings.OwningPlayerName = class'GameReplicationInfo'.default.ServerName @ "| +" $ CfgXPBoost.default.MaxBoost $ "% XP";
} }
else else
{ {
KFGameSettings.OwningPlayerName = class'GameReplicationInfo'.default.ServerName $ " | +" $ MSKGS.GetXPBoost() $ "% XP"; KFGameSettings.OwningPlayerName = class'GameReplicationInfo'.default.ServerName @ "| +" $ MSKGS.GetXPBoost() $ "% XP";
} }
KFGameSettings.NumPublicConnections = KFGI.MaxPlayersAllowed; KFGameSettings.NumPublicConnections = KFGI.MaxPlayersAllowed;

View File

@ -19,10 +19,13 @@ var private bool Admin;
var private repnotify E_LogLevel LogLevel; var private repnotify E_LogLevel LogLevel;
var private repnotify UniqueNetId GroupID; var private repnotify UniqueNetId GroupID;
var private repnotify float CheckGroupTimer; var private repnotify float CheckGroupTimer;
var private repnotify int MaxRetries;
var private int Retries;
var private bool ObtainLogLevel; var private bool ObtainLogLevel;
var private bool ObtainGroupID; var private bool ObtainGroupID;
var private bool ObtainCheckGroupTimer; var private bool ObtainCheckGroupTimer;
var private bool ObtainMaxRetries;
var private KFPlayerController KFPC; var private KFPlayerController KFPC;
var private OnlineSubsystemSteamworks OSS; var private OnlineSubsystemSteamworks OSS;
@ -30,7 +33,7 @@ var private OnlineSubsystemSteamworks OSS;
replication replication
{ {
if (bNetInitial) if (bNetInitial)
LogLevel, GroupID, CheckGroupTimer, ServerOwner; LogLevel, GroupID, CheckGroupTimer, MaxRetries, ServerOwner;
} }
public simulated event ReplicatedEvent(name VarName) public simulated event ReplicatedEvent(name VarName)
@ -45,12 +48,17 @@ public simulated event ReplicatedEvent(name VarName)
break; break;
case 'GroupID': case 'GroupID':
ObtainGroupID = true; ObtainGroupID = true;
CheckGroupMembership(); CheckGroupMembership();
break; break;
case 'CheckGroupTimer': case 'CheckGroupTimer':
ObtainCheckGroupTimer = true; ObtainCheckGroupTimer = true;
CheckGroupMembership();
break;
case 'MaxRetries':
ObtainMaxRetries = true;
CheckGroupMembership(); CheckGroupMembership();
break; break;
@ -65,12 +73,14 @@ public function Init(
IMSKGS _MSKGS, IMSKGS _MSKGS,
UniqueNetId _GroupID, UniqueNetId _GroupID,
float _CheckGroupTimer, float _CheckGroupTimer,
float _MaxRetries,
bool _ServerOwner) bool _ServerOwner)
{ {
LogLevel = _LogLevel; LogLevel = _LogLevel;
MSKGS = _MSKGS; MSKGS = _MSKGS;
GroupID = _GroupID; GroupID = _GroupID;
CheckGroupTimer = _CheckGroupTimer; CheckGroupTimer = _CheckGroupTimer;
MaxRetries = _MaxRetries;
ServerOwner = _ServerOwner; ServerOwner = _ServerOwner;
`Log_Trace(); `Log_Trace();
@ -104,11 +114,19 @@ private simulated function CheckGroupMembership()
`Log_Trace(); `Log_Trace();
if (WorldInfo.NetMode == NM_StandAlone if (WorldInfo.NetMode == NM_StandAlone
|| (ObtainLogLevel && ObtainGroupID && ObtainCheckGroupTimer && Role < ROLE_Authority)) || (ObtainLogLevel && ObtainGroupID && ObtainCheckGroupTimer && ObtainMaxRetries && Role < ROLE_Authority))
{ {
if (GetKFPC() != None && KFPC.bIsEosPlayer) if (GetKFPC() != None && KFPC.bIsEosPlayer)
{ {
`Log_Debug("EGS Player, skip group check"); `Log_Debug("EGS Player, skip group check");
ClearTimer(nameof(CheckGroupMembership));
return;
}
if (Retries++ >= MaxRetries)
{
`Log_Info("Stop checking group membership due to MaxRetries");
ClearTimer(nameof(CheckGroupMembership));
return; return;
} }
@ -121,6 +139,7 @@ private simulated function CheckGroupMembership()
{ {
if (OSS.CheckPlayerGroup(GroupID)) if (OSS.CheckPlayerGroup(GroupID))
{ {
`Log_Info("Obtain membership (retries:" @ Retries $ "), notify server");
ClearTimer(nameof(CheckGroupMembership)); ClearTimer(nameof(CheckGroupMembership));
GroupMember = true; GroupMember = true;
ServerApplyMembership(); ServerApplyMembership();
@ -298,4 +317,7 @@ defaultproperties
ObtainLogLevel = false; ObtainLogLevel = false;
ObtainGroupID = false; ObtainGroupID = false;
ObtainCheckGroupTimer = false; ObtainCheckGroupTimer = false;
ObtainMaxRetries = false;
Retries = 0
} }

View File

@ -16,7 +16,7 @@ PackageBuildOrder="MSKGS MSKGS-SRV"
# Mutators that will be uploaded to the workshop # Mutators that will be uploaded to the workshop
# Specify them with a space as a separator, # Specify them with a space as a separator,
# The order doesn't matter # The order doesn't matter
PackageUpload="MSKGS MSKGS-SRV" PackageUpload="MSKGS"
### Test parameters ### ### Test parameters ###