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)
abstract;
var public config bool bAuto;
var public config bool bCustom;
var public config bool bUsesStats;
var public config bool bAuto;
var public config bool bCustom;
var public config bool bUsesStats;
var public config String PasswdText;
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 int CheckGroupTimer;
var public config int MaxRetries;
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)
{
`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))
@ -112,13 +119,14 @@ private static function ApplyDefault(E_LogLevel LogLevel)
default.BoostGroup = 10;
default.BoostPlayer = 0;
default.HexColorOwner = "00FF00";
default.HexColorAdmin = "00FF00";
default.HexColorOwner = "0099FF";
default.HexColorAdmin = "FF0000";
default.HexColorGroup = "00FF00";
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)

View File

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

View File

@ -5,11 +5,11 @@ const CfgXPBoost = class'CfgXPBoost';
const CfgSrvRank = class'CfgSrvRank';
public static function UpdateGameSettings(
KFGameInfo_Survival KFGI,
String GameModeClass,
IMSKGS MSKGS,
bool bCustomGame,
bool bUsesStats)
KFGameInfo_Survival KFGI,
String GameModeClass,
IMSKGS MSKGS,
bool bCustomGame,
bool bUsesStats)
{
local name SessionName;
local KFOnlineGameSettings KFGameSettings;
@ -74,17 +74,21 @@ bool bUsesStats)
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;
}
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
{
KFGameSettings.OwningPlayerName = class'GameReplicationInfo'.default.ServerName $ " | +" $ MSKGS.GetXPBoost() $ "% XP";
KFGameSettings.OwningPlayerName = class'GameReplicationInfo'.default.ServerName @ "| +" $ MSKGS.GetXPBoost() $ "% XP";
}
KFGameSettings.NumPublicConnections = KFGI.MaxPlayersAllowed;

View File

@ -19,10 +19,13 @@ var private bool Admin;
var private repnotify E_LogLevel LogLevel;
var private repnotify UniqueNetId GroupID;
var private repnotify float CheckGroupTimer;
var private repnotify int MaxRetries;
var private int Retries;
var private bool ObtainLogLevel;
var private bool ObtainGroupID;
var private bool ObtainCheckGroupTimer;
var private bool ObtainMaxRetries;
var private KFPlayerController KFPC;
var private OnlineSubsystemSteamworks OSS;
@ -30,7 +33,7 @@ var private OnlineSubsystemSteamworks OSS;
replication
{
if (bNetInitial)
LogLevel, GroupID, CheckGroupTimer, ServerOwner;
LogLevel, GroupID, CheckGroupTimer, MaxRetries, ServerOwner;
}
public simulated event ReplicatedEvent(name VarName)
@ -45,12 +48,17 @@ public simulated event ReplicatedEvent(name VarName)
break;
case 'GroupID':
ObtainGroupID = true;
ObtainGroupID = true;
CheckGroupMembership();
break;
case 'CheckGroupTimer':
ObtainCheckGroupTimer = true;
ObtainCheckGroupTimer = true;
CheckGroupMembership();
break;
case 'MaxRetries':
ObtainMaxRetries = true;
CheckGroupMembership();
break;
@ -65,12 +73,14 @@ public function Init(
IMSKGS _MSKGS,
UniqueNetId _GroupID,
float _CheckGroupTimer,
float _MaxRetries,
bool _ServerOwner)
{
LogLevel = _LogLevel;
MSKGS = _MSKGS;
GroupID = _GroupID;
CheckGroupTimer = _CheckGroupTimer;
MaxRetries = _MaxRetries;
ServerOwner = _ServerOwner;
`Log_Trace();
@ -104,11 +114,19 @@ private simulated function CheckGroupMembership()
`Log_Trace();
if (WorldInfo.NetMode == NM_StandAlone
|| (ObtainLogLevel && ObtainGroupID && ObtainCheckGroupTimer && Role < ROLE_Authority))
|| (ObtainLogLevel && ObtainGroupID && ObtainCheckGroupTimer && ObtainMaxRetries && Role < ROLE_Authority))
{
if (GetKFPC() != None && KFPC.bIsEosPlayer)
{
`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;
}
@ -121,6 +139,7 @@ private simulated function CheckGroupMembership()
{
if (OSS.CheckPlayerGroup(GroupID))
{
`Log_Info("Obtain membership (retries:" @ Retries $ "), notify server");
ClearTimer(nameof(CheckGroupMembership));
GroupMember = true;
ServerApplyMembership();
@ -298,4 +317,7 @@ defaultproperties
ObtainLogLevel = false;
ObtainGroupID = 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
# Specify them with a space as a separator,
# The order doesn't matter
PackageUpload="MSKGS MSKGS-SRV"
PackageUpload="MSKGS"
### Test parameters ###