dynamic server name

This commit is contained in:
GenZmeY 2022-03-22 00:16:34 +03:00
parent 24a7fcbe3e
commit 6af4c8d51f
7 changed files with 23 additions and 29 deletions

View File

@ -1,6 +1,6 @@
class KFGameInfoHelper extends Object; class KFGameInfoHelper extends Object;
public static function UpdateGameSettings(KFGameInfo_Survival KFGI, bool bUsesStats, string GameModeClass) public static function UpdateGameSettings(KFGameInfo_Survival KFGI, bool bUsesStats, string GameModeClass, MskGsMut Mut)
{ {
local name SessionName; local name SessionName;
local KFOnlineGameSettings KFGameSettings; local KFOnlineGameSettings KFGameSettings;
@ -51,7 +51,19 @@ public static function UpdateGameSettings(KFGameInfo_Survival KFGI, bool bUsesSt
{ {
KFGameSettings.NumWaves = KFGI.WaveMax - 1; KFGameSettings.NumWaves = KFGI.WaveMax - 1;
} }
if (Mut == NONE || Mut.MskGsMemberList.Length == 0)
{
KFGameSettings.OwningPlayerName = class'GameReplicationInfo'.default.ServerName; KFGameSettings.OwningPlayerName = class'GameReplicationInfo'.default.ServerName;
}
else if (Mut.MskGsMemberList.Length > 10)
{
KFGameSettings.OwningPlayerName = class'GameReplicationInfo'.default.ServerName @ "(+50% XP)";
}
else
{
KFGameSettings.OwningPlayerName = class'GameReplicationInfo'.default.ServerName @ "(+" $ Mut.MskGsMemberList.Length * 5 $ "% XP)";
}
KFGameSettings.NumPublicConnections = KFGI.MaxPlayersAllowed; KFGameSettings.NumPublicConnections = KFGI.MaxPlayersAllowed;
KFGameSettings.bRequiresPassword = KFGI.RequiresPassword(); KFGameSettings.bRequiresPassword = KFGI.RequiresPassword();

View File

@ -4,11 +4,7 @@ Class MskGsMut extends KFMutator
const CurrentVersion = 3; const CurrentVersion = 3;
var config int ConfigVersion; var config int ConfigVersion;
var config bool bEnableMapStats; var config bool bEnableMapStats; var config string SortStats; var config bool bOfficialNextMapOnly; var config bool bRandomizeNextMap; var config int WeapLifespan;
var config string SortStats;
var config bool bOfficialNextMapOnly;
var config bool bRandomizeNextMap;
var config int WeapLifespan;
var config int DoshLifespan; var config int DoshLifespan;
var config array<string> KickProtectedList; var config array<string> KickProtectedList;
@ -22,23 +18,7 @@ var array<MskGsRepInfo> RepClients;
var array<Controller> MskGsMemberList; var array<Controller> MskGsMemberList;
var array<UniqueNetId> AdminUIDList; var array<UniqueNetId> AdminUIDList;
function InitMutator(string Options, out string ErrorMessage) function InitMutator(string Options, out string ErrorMessage) { local int MaxPlayers, MaxPlayersAllowed; super.InitMutator(Options, ErrorMessage); if (MyKFGI == none) { `log("[MskGsMut] Error: can't init, MyKFGI is none"); return; } MaxPlayers = Clamp(MyKFGI.GetIntOption(Options, "MaxPlayers", MaxPlayers), 6, 128); MaxPlayersAllowed = MaxPlayers; MyKFGI.MaxPlayers = MaxPlayers; MyKFGI.MaxPlayersAllowed = MaxPlayersAllowed; }
{
local int MaxPlayers, MaxPlayersAllowed;
super.InitMutator(Options, ErrorMessage);
if (MyKFGI == none)
{
`log("[MskGsMut] Error: can't init, MyKFGI is none");
return;
}
MaxPlayers = Clamp(MyKFGI.GetIntOption(Options, "MaxPlayers", MaxPlayers), 6, 128);
MaxPlayersAllowed = MaxPlayers;
MyKFGI.MaxPlayers = MaxPlayers;
MyKFGI.MaxPlayersAllowed = MaxPlayersAllowed;
}
function InitConfig() function InitConfig()
{ {
@ -292,6 +272,7 @@ function AddMskGsMember(Controller C)
WorldInfo.Game.Broadcast(C, "XP bonus: +"$string(MskGsMemberList.Length * 5)$"%"); WorldInfo.Game.Broadcast(C, "XP bonus: +"$string(MskGsMemberList.Length * 5)$"%");
} }
} }
MyKFGI.UpdateGameSettings();
} }
function NotifyLogin(Controller C) function NotifyLogin(Controller C)
@ -350,6 +331,7 @@ function NotifyLogout(Controller C)
WorldInfo.Game.Broadcast(C, "No XP bonus now."); WorldInfo.Game.Broadcast(C, "No XP bonus now.");
} }
} }
MyKFGI.UpdateGameSettings();
for (i = RepClients.Length - 1; i >= 0; i--) for (i = RepClients.Length - 1; i >= 0; i--)
{ {

View File

@ -11,7 +11,7 @@ simulated function ExileServerUsingKickBan()
function UpdateGameSettings() function UpdateGameSettings()
{ {
KFGIH.static.UpdateGameSettings(Self, !IsUnrankedGame(), "KFGameContent.KFGameInfo_Endless"); KFGIH.static.UpdateGameSettings(Self, !IsUnrankedGame(), "KFGameContent.KFGameInfo_Endless", Mut);
} }
protected function DistributeMoneyAndXP(class<KFPawn_Monster> MonsterClass, const out array<DamageInfo> DamageHistory, Controller Killer) protected function DistributeMoneyAndXP(class<KFPawn_Monster> MonsterClass, const out array<DamageInfo> DamageHistory, Controller Killer)

View File

@ -12,7 +12,7 @@ simulated function ExileServerUsingKickBan()
function UpdateGameSettings() function UpdateGameSettings()
{ {
KFGIH.static.UpdateGameSettings(Self, !IsUnrankedGame(), "KFGameContent.KFGameInfo_Objective"); KFGIH.static.UpdateGameSettings(Self, !IsUnrankedGame(), "KFGameContent.KFGameInfo_Objective", Mut);
} }
protected function DistributeMoneyAndXP(class<KFPawn_Monster> MonsterClass, const out array<DamageInfo> DamageHistory, Controller Killer) protected function DistributeMoneyAndXP(class<KFPawn_Monster> MonsterClass, const out array<DamageInfo> DamageHistory, Controller Killer)

View File

@ -11,7 +11,7 @@ simulated function ExileServerUsingKickBan()
function UpdateGameSettings() function UpdateGameSettings()
{ {
KFGIH.static.UpdateGameSettings(Self, !IsUnrankedGame(), "KFGameContent.KFGameInfo_Survival"); KFGIH.static.UpdateGameSettings(Self, !IsUnrankedGame(), "KFGameContent.KFGameInfo_Survival", Mut);
} }
protected function DistributeMoneyAndXP(class<KFPawn_Monster> MonsterClass, const out array<DamageInfo> DamageHistory, Controller Killer) protected function DistributeMoneyAndXP(class<KFPawn_Monster> MonsterClass, const out array<DamageInfo> DamageHistory, Controller Killer)

View File

@ -12,7 +12,7 @@ simulated function ExileServerUsingKickBan()
function UpdateGameSettings() function UpdateGameSettings()
{ {
KFGIH.static.UpdateGameSettings(Self, !IsUnrankedGame(), "KFGameContent.KFGameInfo_VersusSurvival"); KFGIH.static.UpdateGameSettings(Self, !IsUnrankedGame(), "KFGameContent.KFGameInfo_VersusSurvival", Mut);
} }
protected function DistributeMoneyAndXP(class<KFPawn_Monster> MonsterClass, const out array<DamageInfo> DamageHistory, Controller Killer) protected function DistributeMoneyAndXP(class<KFPawn_Monster> MonsterClass, const out array<DamageInfo> DamageHistory, Controller Killer)

View File

@ -12,7 +12,7 @@ simulated function ExileServerUsingKickBan()
function UpdateGameSettings() function UpdateGameSettings()
{ {
KFGIH.static.UpdateGameSettings(Self, !IsUnrankedGame(), "KFGameContent.KFGameInfo_WeeklySurvival"); KFGIH.static.UpdateGameSettings(Self, !IsUnrankedGame(), "KFGameContent.KFGameInfo_WeeklySurvival", Mut);
} }
protected function DistributeMoneyAndXP(class<KFPawn_Monster> MonsterClass, const out array<DamageInfo> DamageHistory, Controller Killer) protected function DistributeMoneyAndXP(class<KFPawn_Monster> MonsterClass, const out array<DamageInfo> DamageHistory, Controller Killer)