This commit is contained in:
GenZmeY 2022-08-17 02:07:11 +03:00
parent c406220e99
commit 1ffd0119fa
568 changed files with 1021 additions and 939 deletions

View File

@ -1,19 +1,10 @@
class CfgXPBoost extends Object class CfgCredits extends Object
config(MSKGS) config(MSKGS)
abstract; abstract;
var private config String OwnerId; var private config String OwnerId;
var private config String GroupID; var private config String GroupID;
var public config int MaxBoost;
var public config int BoostOwner;
var public config int BoostAdmin;
var public config int BoostGroup;
var public config int BoostPlayer;
var public config int CheckGroupTimer;
public static function InitConfig(int Version, int LatestVersion, E_LogLevel LogLevel) public static function InitConfig(int Version, int LatestVersion, E_LogLevel LogLevel)
{ {
`Log_TraceStatic(); `Log_TraceStatic();
@ -35,42 +26,6 @@ public static function InitConfig(int Version, int LatestVersion, E_LogLevel Log
public static function Load(E_LogLevel LogLevel) public static function Load(E_LogLevel LogLevel)
{ {
`Log_TraceStatic(); `Log_TraceStatic();
if (default.MaxBoost < 0)
{
`Log_Error("MaxBoost" @ "(" $ default.MaxBoost $ ")" @ "must be equal or greater than 0");
default.MaxBoost = 30;
}
if (default.BoostOwner < 0)
{
`Log_Error("BoostOwner" @ "(" $ default.BoostOwner $ ")" @ "must be equal or greater than 0");
default.BoostOwner = 30;
}
if (default.BoostAdmin < 0)
{
`Log_Error("BoostAdmin" @ "(" $ default.BoostAdmin $ ")" @ "must be equal or greater than 0");
default.BoostAdmin = 20;
}
if (default.BoostGroup < 0)
{
`Log_Error("BoostGroup" @ "(" $ default.BoostGroup $ ")" @ "must be equal or greater than 0");
default.BoostGroup = 10;
}
if (default.BoostPlayer < 0)
{
`Log_Error("BoostPlayer" @ "(" $ default.BoostPlayer $ ")" @ "must be equal or greater than 0");
default.BoostPlayer = 0;
}
if (default.CheckGroupTimer < 0)
{
`Log_Error("CheckGroupTimer" @ "(" $ default.CheckGroupTimer $ ")" @ "must be equal or greater than 0");
default.CheckGroupTimer = 10;
}
} }
public static function UniqueNetId LoadOwnerId(OnlineSubsystem OS, E_LogLevel LogLevel) public static function UniqueNetId LoadOwnerId(OnlineSubsystem OS, E_LogLevel LogLevel)
@ -111,15 +66,6 @@ protected static function ApplyDefault(E_LogLevel LogLevel)
default.OwnerId = "76561198001617867"; default.OwnerId = "76561198001617867";
default.GroupID = "0x017000000223386E"; default.GroupID = "0x017000000223386E";
default.MaxBoost = 100;
default.BoostOwner = 30;
default.BoostAdmin = 20;
default.BoostGroup = 10;
default.BoostPlayer = 0;
default.CheckGroupTimer = 10;
} }
private static function bool IsUID(String ID, E_LogLevel LogLevel) private static function bool IsUID(String ID, E_LogLevel LogLevel)

View File

@ -0,0 +1,57 @@
class CfgSpawnManager extends Object
config(MSKGS)
abstract;
var public config Array<int> PerPlayerMaxMonsters;
public static function InitConfig(int Version, int LatestVersion, E_LogLevel LogLevel)
{
`Log_TraceStatic();
switch (Version)
{
case `NO_CONFIG:
ApplyDefault(LogLevel);
default: break;
}
if (LatestVersion != Version)
{
StaticSaveConfig();
}
}
public static function Load(E_LogLevel LogLevel)
{
local int MM, PL;
`Log_TraceStatic();
foreach default.PerPlayerMaxMonsters(MM, PL)
{
if (MM <= 0)
{
`Log_Error("PerPlayerMaxMonsters[" $ PL $ "] =" @ MM @ "must be greater than 0");
default.PerPlayerMaxMonsters[PL] = 32;
}
}
}
protected static function ApplyDefault(E_LogLevel LogLevel)
{
`Log_TraceStatic();
default.PerPlayerMaxMonsters.Length = 0;
default.PerPlayerMaxMonsters.AddItem(12);
default.PerPlayerMaxMonsters.AddItem(18);
default.PerPlayerMaxMonsters.AddItem(24);
default.PerPlayerMaxMonsters.AddItem(30);
default.PerPlayerMaxMonsters.AddItem(34);
default.PerPlayerMaxMonsters.AddItem(36);
}
defaultproperties
{
}

View File

@ -0,0 +1,164 @@
class CfgXPBoost extends Object
config(MSKGS)
abstract;
var public config int MaxBoost;
var public config int BoostOwner;
var public config int BoostAdmin;
var public config int BoostGroup;
var public config int BoostPlayer;
var public config String HexColorOwner;
var public config String HexColorAdmin;
var public config String HexColorGroup;
var public config String HexColorPlayer;
var public config String HexColorLeave;
var public config int CheckGroupTimer;
public static function InitConfig(int Version, int LatestVersion, E_LogLevel LogLevel)
{
`Log_TraceStatic();
switch (Version)
{
case `NO_CONFIG:
ApplyDefault(LogLevel);
default: break;
}
if (LatestVersion != Version)
{
StaticSaveConfig();
}
}
public static function Load(E_LogLevel LogLevel)
{
`Log_TraceStatic();
if (default.MaxBoost < 0)
{
`Log_Error("MaxBoost" @ "(" $ default.MaxBoost $ ")" @ "must be equal or greater than 0");
default.MaxBoost = 30;
}
if (default.BoostOwner < 0)
{
`Log_Error("BoostOwner" @ "(" $ default.BoostOwner $ ")" @ "must be equal or greater than 0");
default.BoostOwner = 30;
}
if (default.BoostAdmin < 0)
{
`Log_Error("BoostAdmin" @ "(" $ default.BoostAdmin $ ")" @ "must be equal or greater than 0");
default.BoostAdmin = 20;
}
if (default.BoostGroup < 0)
{
`Log_Error("BoostGroup" @ "(" $ default.BoostGroup $ ")" @ "must be equal or greater than 0");
default.BoostGroup = 10;
}
if (default.BoostPlayer < 0)
{
`Log_Error("BoostPlayer" @ "(" $ default.BoostPlayer $ ")" @ "must be equal or greater than 0");
default.BoostPlayer = 0;
}
if (default.CheckGroupTimer < 0)
{
`Log_Error("CheckGroupTimer" @ "(" $ default.CheckGroupTimer $ ")" @ "must be equal or greater than 0");
default.CheckGroupTimer = 10;
}
if (!IsValidHexColor(default.HexColorOwner, LogLevel))
{
`Log_Error("HexColorOwner" @ "(" $ default.HexColorOwner $ ")" @ "is not valid hex color");
}
if (!IsValidHexColor(default.HexColorAdmin, LogLevel))
{
`Log_Error("HexColorAdmin" @ "(" $ default.HexColorAdmin $ ")" @ "is not valid hex color");
}
if (!IsValidHexColor(default.HexColorGroup, LogLevel))
{
`Log_Error("HexColorGroup" @ "(" $ default.HexColorGroup $ ")" @ "is not valid hex color");
}
if (!IsValidHexColor(default.HexColorPlayer, LogLevel))
{
`Log_Error("HexColorPlayer" @ "(" $ default.HexColorPlayer $ ")" @ "is not valid hex color");
}
if (!IsValidHexColor(default.HexColorLeave, LogLevel))
{
`Log_Error("HexColorLeave" @ "(" $ default.HexColorLeave $ ")" @ "is not valid hex color");
}
}
private static function ApplyDefault(E_LogLevel LogLevel)
{
`Log_TraceStatic();
default.MaxBoost = 100;
default.BoostOwner = 30;
default.BoostAdmin = 20;
default.BoostGroup = 10;
default.BoostPlayer = 0;
default.HexColorOwner = "00FF00";
default.HexColorAdmin = "00FF00";
default.HexColorGroup = "00FF00";
default.HexColorPlayer = "FFFFFF";
default.HexColorLeave = "FF0000";
default.CheckGroupTimer = 10;
}
private static function bool IsValidHexColor(String HexColor, E_LogLevel LogLevel)
{
local byte Index;
`Log_TraceStatic();
if (len(HexColor) != 6) return false;
HexColor = Locs(HexColor);
for (Index = 0; Index < 6; ++Index)
{
switch (Mid(HexColor, Index, 1))
{
case "0": break;
case "1": break;
case "2": break;
case "3": break;
case "4": break;
case "5": break;
case "6": break;
case "7": break;
case "8": break;
case "9": break;
case "a": break;
case "b": break;
case "c": break;
case "d": break;
case "e": break;
case "f": break;
default: return false;
}
}
return true;
}
defaultproperties
{
}

View File

@ -0,0 +1,4 @@
[Flags]
AllowDownload=False
ClientOptional=False
ServerSideOnly=True

View File

@ -1,15 +1,34 @@
class MSKGS extends Info class MSKGS extends Info
implements(IMSKGS)
config(MSKGS); config(MSKGS);
const LatestVersion = 1; const LatestVersion = 1;
const CfgCredits = class'CfgCredits';
const CfgLifespan = class'CfgLifespan'; const CfgLifespan = class'CfgLifespan';
const CfgSpawnManager = class'CfgSpawnManager'; const CfgSpawnManager = class'CfgSpawnManager';
const CfgXPBoost = class'CfgXPBoost'; const CfgXPBoost = class'CfgXPBoost';
const CfgSrvRank = class'CfgSrvRank'; const CfgSrvRank = class'CfgSrvRank';
var public int XPBoost; const MSKGS_GameInfo = class'MSKGS_GameInfo';
var public bool XPNotifications;
struct ZedMap
{
var const class<KFPawn_Monster> Zed;
var const class<KFPawn_Monster> Proxy;
};
struct BoostMap
{
var const int BoostValue;
var const Array<ZedMap> Zeds;
};
var private Array<BoostMap> XPBoosts;
var private Array<ZedMap> ZedProxies;
var private int XPBoost;
var private bool XPNotifications;
var private config int Version; var private config int Version;
var private config E_LogLevel LogLevel; var private config E_LogLevel LogLevel;
@ -67,6 +86,7 @@ private function PreInit()
SaveConfig(); SaveConfig();
} }
CfgCredits.static.InitConfig(Version, LatestVersion, LogLevel);
CfgLifespan.static.InitConfig(Version, LatestVersion, LogLevel); CfgLifespan.static.InitConfig(Version, LatestVersion, LogLevel);
CfgSpawnManager.static.InitConfig(Version, LatestVersion, LogLevel); CfgSpawnManager.static.InitConfig(Version, LatestVersion, LogLevel);
CfgXPBoost.static.InitConfig(Version, LatestVersion, LogLevel); CfgXPBoost.static.InitConfig(Version, LatestVersion, LogLevel);
@ -106,6 +126,7 @@ private function PreInit()
} }
`Log_Base("LogLevel:" @ LogLevel); `Log_Base("LogLevel:" @ LogLevel);
CfgCredits.static.Load(LogLevel);
CfgLifespan.static.Load(LogLevel); CfgLifespan.static.Load(LogLevel);
CfgSpawnManager.static.Load(LogLevel); CfgSpawnManager.static.Load(LogLevel);
CfgXPBoost.static.Load(LogLevel); CfgXPBoost.static.Load(LogLevel);
@ -119,8 +140,8 @@ private function PreInit()
return; return;
} }
OwnerID = CfgXPBoost.static.LoadOwnerID(OS, LogLevel); OwnerID = CfgCredits.static.LoadOwnerID(OS, LogLevel);
GroupID = CfgXPBoost.static.LoadGroupID(OS, LogLevel); GroupID = CfgCredits.static.LoadGroupID(OS, LogLevel);
} }
private function PostInit() private function PostInit()
@ -159,40 +180,53 @@ private function PostInit()
{ {
XPNotifications = true; XPNotifications = true;
MSKGS_GM_Endless(KFGI).MSKGS = Self; MSKGS_GM_Endless(KFGI).MSKGS = Self;
MSKGS_GM_Endless(KFGI).GI = new MSKGS_GameInfo;
MSKGS_GM_Endless(KFGI).LogLevel = LogLevel; MSKGS_GM_Endless(KFGI).LogLevel = LogLevel;
} }
else if (MSKGS_GM_Objective(KFGI) != None) else if (MSKGS_GM_Objective(KFGI) != None)
{ {
XPNotifications = (KFGI.GameDifficulty != 3); XPNotifications = (KFGI.GameDifficulty != 3);
MSKGS_GM_Objective(KFGI).MSKGS = Self; MSKGS_GM_Objective(KFGI).MSKGS = Self;
MSKGS_GM_Objective(KFGI).GI = new MSKGS_GameInfo;
MSKGS_GM_Objective(KFGI).LogLevel = LogLevel; MSKGS_GM_Objective(KFGI).LogLevel = LogLevel;
} }
else if (MSKGS_GM_Survival(KFGI) != None) else if (MSKGS_GM_Survival(KFGI) != None)
{ {
XPNotifications = (KFGI.GameDifficulty != 3); XPNotifications = (KFGI.GameDifficulty != 3);
MSKGS_GM_Survival(KFGI).MSKGS = Self; MSKGS_GM_Survival(KFGI).MSKGS = Self;
MSKGS_GM_Survival(KFGI).GI = new MSKGS_GameInfo;
MSKGS_GM_Survival(KFGI).LogLevel = LogLevel; MSKGS_GM_Survival(KFGI).LogLevel = LogLevel;
} }
else if (MSKGS_GM_VersusSurvival(KFGI) != None) else if (MSKGS_GM_VersusSurvival(KFGI) != None)
{ {
XPNotifications = false; XPNotifications = false;
MSKGS_GM_VersusSurvival(KFGI).MSKGS = Self; MSKGS_GM_VersusSurvival(KFGI).MSKGS = Self;
MSKGS_GM_VersusSurvival(KFGI).GI = new MSKGS_GameInfo;
MSKGS_GM_VersusSurvival(KFGI).LogLevel = LogLevel; MSKGS_GM_VersusSurvival(KFGI).LogLevel = LogLevel;
} }
else if (MSKGS_GM_WeeklySurvival(KFGI) != None) else if (MSKGS_GM_WeeklySurvival(KFGI) != None)
{ {
XPNotifications = true; XPNotifications = true;
MSKGS_GM_WeeklySurvival(KFGI).MSKGS = Self; MSKGS_GM_WeeklySurvival(KFGI).MSKGS = Self;
MSKGS_GM_WeeklySurvival(KFGI).GI = new MSKGS_GameInfo;
MSKGS_GM_WeeklySurvival(KFGI).LogLevel = LogLevel; MSKGS_GM_WeeklySurvival(KFGI).LogLevel = LogLevel;
} }
`Log_Info("GameInfo initialized:" @ KFGI);
KFGI.UpdateGameSettings();
ModifySpawnManager(); ModifySpawnManager();
`Log_Info("Initialized");
} }
private function ModifySpawnManager() private function ModifySpawnManager()
{ {
local byte Difficulty, Players; local byte Difficulty, Players;
`Log_Trace();
if (KFGI.SpawnManager == None) if (KFGI.SpawnManager == None)
{ {
SetTimer(1.f, false, nameof(ModifySpawnManager)); SetTimer(1.f, false, nameof(ModifySpawnManager));
@ -203,13 +237,48 @@ private function ModifySpawnManager()
{ {
for (Players = 0; Players < KFGI.SpawnManager.PerDifficultyMaxMonsters[Difficulty].MaxMonsters.Length; Players++) for (Players = 0; Players < KFGI.SpawnManager.PerDifficultyMaxMonsters[Difficulty].MaxMonsters.Length; Players++)
{ {
KFGI.SpawnManager.PerDifficultyMaxMonsters[Difficulty].MaxMonsters[Players] = CfgSpawnManager.default.MaxMonsters[Players]; KFGI.SpawnManager.PerDifficultyMaxMonsters[Difficulty].MaxMonsters[Players] = CfgSpawnManager.default.PerPlayerMaxMonsters[Players];
} }
} }
`Log_Info("SpawnManager modified");
}
public function class<KFPawn_Monster> PickProxyZed(class<KFPawn_Monster> MonsterClass)
{
local int Index;
Index = ZedProxies.Find('Zed', MonsterClass);
if (Index == INDEX_NONE)
{
`Log_Error("Can't find proxy for zed:" @ String(MonsterClass));
return MonsterClass;
}
`Log_Debug("Proxy Zed:" @ ZedProxies[Index].Proxy);
return ZedProxies[Index].Proxy;
}
public function int GetXPBoost()
{
return XPBoost;
}
public function bool GetXPNotifications()
{
return XPNotifications;
}
public function E_LogLevel GetLogLevel()
{
return LogLevel;
} }
public function ModifyLifespan(Actor A) public function ModifyLifespan(Actor A)
{ {
`Log_Trace();
if (KFDroppedPickup_Cash(A) != None) if (KFDroppedPickup_Cash(A) != None)
{ {
if (CfgLifespan.default.Dosh != 0) if (CfgLifespan.default.Dosh != 0)
@ -228,6 +297,8 @@ public function ModifyLifespan(Actor A)
public function SetMaxPlayers(int MaxPlayers) public function SetMaxPlayers(int MaxPlayers)
{ {
`Log_Trace();
if (MaxPlayers != INDEX_NONE) if (MaxPlayers != INDEX_NONE)
{ {
KFGI.MaxPlayers = MaxPlayers; KFGI.MaxPlayers = MaxPlayers;
@ -241,7 +312,7 @@ public function NotifyLogin(Controller C)
if (!CreateRepInfo(C)) if (!CreateRepInfo(C))
{ {
`Log_Error("Can't create RepInfo for:" @ C); `Log_Error("Can't create RepInfo for:" @ C @ (C == None ? "" : String(C.PlayerReplicationInfo)));
} }
} }
@ -249,6 +320,11 @@ public function NotifyLogout(Controller C)
{ {
`Log_Trace(); `Log_Trace();
if (PlayerXPBoost(FindRepInfo(C)) > 0)
{
DecreaseXPBoost(C);
}
if (!DestroyRepInfo(C)) if (!DestroyRepInfo(C))
{ {
`Log_Error("Can't destroy RepInfo of:" @ C); `Log_Error("Can't destroy RepInfo of:" @ C);
@ -261,16 +337,18 @@ public function bool CreateRepInfo(Controller C)
`Log_Trace(); `Log_Trace();
if (C == None) return false; if (C == None || C.PlayerReplicationInfo == None) return false;
RepInfo = Spawn(class'MSKGS_RepInfo', C); RepInfo = Spawn(class'MSKGS_RepInfo', C);
if (RepInfo == None) return false; if (RepInfo == None) return false;
RepInfo.LogLevel = LogLevel; RepInfo.Init(
RepInfo.MSKGS = Self; LogLevel,
RepInfo.GroupID = GroupID; Self,
RepInfo.ServerOwner = false; GroupID,
CfgXPBoost.default.CheckGroupTimer,
C.PlayerReplicationInfo.UniqueId == OwnerID);
RepInfos.AddItem(RepInfo); RepInfos.AddItem(RepInfo);
@ -285,14 +363,12 @@ public function bool DestroyRepInfo(Controller C)
if (C == None) return false; if (C == None) return false;
foreach RepInfos(RepInfo) RepInfo = FindRepInfo(C);
if (RepInfo != None)
{ {
if (RepInfo.Owner == C) RepInfo.SafeDestroy();
{ RepInfos.RemoveItem(RepInfo);
RepInfo.SafeDestroy(); return true;
RepInfos.RemoveItem(RepInfo);
return true;
}
} }
return false; return false;
@ -300,118 +376,196 @@ public function bool DestroyRepInfo(Controller C)
public function IncreaseXPBoost(KFPlayerController Booster) public function IncreaseXPBoost(KFPlayerController Booster)
{ {
local MSKGS_RepInfo RepInfo; local MSKGS_RepInfo BoosterRepInfo;
local String HexColor;
local int PlayerBoost;
local String PlayerBoostStr;
local String TotalBoostStr;
local String BoosterName;
`Log_Trace();
UpdateXPBoost(); UpdateXPBoost();
foreach RepInfos(RepInfo)
{
if (RepInfo.Owner == Booster)
{
// TODO: Recive localized message
// You give boost to this server
}
else
{
// TODO: Recive localized message
// Booster give boost to this server
}
}
KFGI.UpdateGameSettings(); KFGI.UpdateGameSettings();
BoosterRepInfo = FindRepInfo(Booster);
TotalBoostStr = String(XPBoost);
BoosterName = Booster.PlayerReplicationInfo.PlayerName;
HexColor = PlayerHexColor(BoosterRepInfo);
PlayerBoost = PlayerXPBoost(BoosterRepInfo);
PlayerBoostStr = String(PlayerBoost);
if (XPBoost >= CfgXPBoost.default.MaxBoost)
{
BroadcastChatLocalized(
MSKGS_PlayerGiveBoostToServerMax,
HexColor,
None,
BoosterName,
PlayerBoostStr,
String(CfgXPBoost.default.MaxBoost));
}
else if (PlayerBoost == XPBoost)
{
BroadcastChatLocalized(
MSKGS_PlayerGiveBoostToServerFirst,
HexColor,
None,
BoosterName,
TotalBoostStr);
}
else
{
BroadcastChatLocalized(
MSKGS_PlayerGiveBoostToServer,
HexColor,
None,
BoosterName,
PlayerBoostStr,
TotalBoostStr);
}
} }
public function DecreaseXPBoost(KFPlayerController Booster) public function DecreaseXPBoost(Controller Booster)
{
local String HexColor;
local String TotalBoost;
local String BoosterName;
`Log_Trace();
UpdateXPBoost();
KFGI.UpdateGameSettings();
HexColor = CfgXPBoost.default.HexColorLeave;
BoosterName = Booster.PlayerReplicationInfo.PlayerName;
TotalBoost = String(XPBoost);
if (XPBoost >= CfgXPBoost.default.MaxBoost)
{
BroadcastChatLocalized(
MSKGS_BoosterLeaveServerMax,
HexColor,
Booster,
BoosterName,
String(CfgXPBoost.default.MaxBoost));
}
else if (XPBoost > 0)
{
BroadcastChatLocalized(
MSKGS_BoosterLeaveServer,
HexColor,
Booster,
BoosterName,
TotalBoost);
}
else
{
BroadcastChatLocalized(
MSKGS_BoosterLeaveServerNoBoost,
HexColor,
Booster,
BoosterName);
}
}
private function BroadcastChatLocalized(E_MSKGS_LocalMessageType LMT, String HexColor, optional Controller Except = None, optional String String1, optional String String2, optional String String3)
{ {
local MSKGS_RepInfo RepInfo; local MSKGS_RepInfo RepInfo;
UpdateXPBoost();
foreach RepInfos(RepInfo) foreach RepInfos(RepInfo)
{ {
if (RepInfo.Owner != Booster) if (RepInfo.Owner != Except)
{ {
// TODO: Recive localized message RepInfo.WriteToChatLocalized(
// Booster left the game LMT,
HexColor,
String1,
String2,
String3);
} }
} }
}
KFGI.UpdateGameSettings(); private function MSKGS_RepInfo FindRepInfo(Controller C)
{
local MSKGS_RepInfo RepInfo;
foreach RepInfos(RepInfo)
if (RepInfo.Owner == C)
break;
return RepInfo;
} }
public function UpdateXPBoost() public function UpdateXPBoost()
{ {
local MSKGS_RepInfo RepInfo; local MSKGS_RepInfo RepInfo;
local int NextBoost; local int NextBoost;
local int Index;
`Log_Trace();
NextBoost = 0; NextBoost = 0;
foreach RepInfos(RepInfo) foreach RepInfos(RepInfo)
{ {
NextBoost += RepInfo.XPBoost(); NextBoost += PlayerXPBoost(RepInfo);
}
if (NextBoost > 0)
{
Index = XPBoosts.Find('BoostValue', NextBoost);
if (Index == INDEX_NONE)
{
`Log_Error("Can't find boost proxy:" @ NextBoost);
}
else
{
ZedProxies = XPBoosts[Index].Zeds;
}
} }
XPBoost = NextBoost; XPBoost = NextBoost;
} }
/* private function int PlayerXPBoost(MSKGS_RepInfo RepInfo)
function AddMskGsMember(Controller C)
{ {
MskGsMemberList.AddItem(C); `Log_Trace();
if (XpNotifications)
if (RepInfo != None) switch (RepInfo.PlayerType())
{ {
if (MskGsMemberList.Length >= 10) case MSKGS_Owner: return CfgXPBoost.default.BoostOwner;
{ case MSKGS_Admin: return CfgXPBoost.default.BoostAdmin;
if (C.PlayerReplicationInfo != NONE) case MSKGS_Group: return CfgXPBoost.default.BoostGroup;
WorldInfo.Game.Broadcast(C, C.PlayerReplicationInfo.PlayerName$" gives a boost to this server! XP bonus: +100% (MAX!)");
else
WorldInfo.Game.Broadcast(C, "XP bonus: +100% (MAX!)");
}
else
{
if (C.PlayerReplicationInfo != NONE)
WorldInfo.Game.Broadcast(C, C.PlayerReplicationInfo.PlayerName$" gives a boost to this server! XP bonus: +"$string(MskGsMemberList.Length * 10)$"%");
else
WorldInfo.Game.Broadcast(C, "XP bonus: +"$string(MskGsMemberList.Length * 10)$"%");
}
} }
MyKFGI.UpdateGameSettings();
return CfgXPBoost.default.BoostPlayer;
} }
function DelMskGsMember(Controller C) private function String PlayerHexColor(MSKGS_RepInfo RepInfo)
{ {
Initialize(); `Log_Trace();
if (MskGsMemberList.Find(C) != INDEX_NONE) switch (RepInfo.PlayerType())
{ {
MskGsMemberList.RemoveItem(C); case MSKGS_Owner: return CfgXPBoost.default.HexColorOwner;
if (XpNotifications) case MSKGS_Admin: return CfgXPBoost.default.HexColorAdmin;
{ case MSKGS_Group: return CfgXPBoost.default.HexColorGroup;
if (MskGsMemberList.Length >= 10)
{
if (C.PlayerReplicationInfo != NONE)
WorldInfo.Game.Broadcast(C, C.PlayerReplicationInfo.PlayerName$" left the game. XP bonus: +100% (MAX!)");
else
WorldInfo.Game.Broadcast(C, "XP bonus: +100% (MAX!)");
}
else if (MskGsMemberList.Length > 0)
{
if (C.PlayerReplicationInfo != NONE)
WorldInfo.Game.Broadcast(C, C.PlayerReplicationInfo.PlayerName$" left the game. XP bonus: +"$string(MskGsMemberList.Length * 10)$"%");
else
WorldInfo.Game.Broadcast(C, "XP bonus: +"$string(MskGsMemberList.Length * 10)$"%");
}
else
{
if (C.PlayerReplicationInfo != NONE)
WorldInfo.Game.Broadcast(C, C.PlayerReplicationInfo.PlayerName$" left the game. No XP bonus now.");
else
WorldInfo.Game.Broadcast(C, "No XP bonus now.");
}
}
MyKFGI.UpdateGameSettings();
} }
return CfgXPBoost.default.HexColorPlayer;
} }
*/
DefaultProperties DefaultProperties
{ {
XPBoosts.Add({(
BoostValue=10,
Zeds[0]={(Zed=class'KFPawn_ZedBloat',Proxy=class'KFPawn_ZedBloat')},
Zeds[1]={(Zed=class'KFPawn_ZedBloat',Proxy=class'KFPawn_ZedBloat')}
)})
XPBoosts.Add({(
BoostValue=10,
Zeds[0]={(Zed=class'KFPawn_ZedBloat',Proxy=class'KFPawn_ZedBloat')},
Zeds[1]={(Zed=class'KFPawn_ZedBloat',Proxy=class'KFPawn_ZedBloat')}
)})
} }

View File

@ -0,0 +1,118 @@
class MSKGS_GameInfo extends Object
implements(IMSKGS_GameInfo);
const CfgXPBoost = class'CfgXPBoost';
const CfgSrvRank = class'CfgSrvRank';
public static function UpdateGameSettings(KFGameInfo_Survival KFGI, string GameModeClass, IMSKGS MSKGS)
{
local name SessionName;
local KFOnlineGameSettings KFGameSettings;
local int NumHumanPlayers;
local KFGameEngine KFEngine;
local PlayerController PC;
local E_LogLevel LogLevel;
LogLevel = (MSKGS == None ? LL_None : MSKGS.GetLogLevel());
`Log_TraceStatic();
`Log_Debug("UpdateGameSettings");
if (KFGI.WorldInfo.NetMode == NM_DedicatedServer || KFGI.WorldInfo.NetMode == NM_ListenServer)
{
if (KFGI.GameInterface != None)
{
KFEngine = KFGameEngine(class'Engine'.static.GetEngine());
SessionName = KFGI.PlayerReplicationInfoClass.default.SessionName;
if (KFGI.PlayfabInter != None && KFGI.PlayfabInter.GetGameSettings() != None)
{
KFGameSettings = KFOnlineGameSettings(KFGI.PlayfabInter.GetGameSettings());
KFGameSettings.bAvailableForTakeover = KFEngine.bAvailableForTakeover;
}
else
{
KFGameSettings = KFOnlineGameSettings(KFGI.GameInterface.GetGameSettings(SessionName));
}
if (KFGameSettings != None)
{
KFGameSettings.Mode = KFGI.default.GameModes.Find('ClassNameAndPath', GameModeClass);
KFGameSettings.Difficulty = KFGI.GameDifficulty;
if (KFGI.WaveNum == 0)
{
KFGameSettings.bInProgress = false;
KFGameSettings.CurrentWave = 1;
}
else
{
KFGameSettings.bInProgress = true;
KFGameSettings.CurrentWave = KFGI.WaveNum;
}
if (KFGI.MyKFGRI != None)
{
KFGameSettings.NumWaves = KFGI.MyKFGRI.GetFinalWaveNum();
KFGI.MyKFGRI.bCustom = CfgSrvRank.default.bCustom;
}
else
{
KFGameSettings.NumWaves = KFGI.WaveMax - 1;
}
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";
}
else
{
KFGameSettings.OwningPlayerName = class'GameReplicationInfo'.default.ServerName $ " | +" $ MSKGS.GetXPBoost() $ "% XP";
}
KFGameSettings.NumPublicConnections = KFGI.MaxPlayersAllowed;
KFGameSettings.bRequiresPassword = KFGI.RequiresPassword();
KFGameSettings.bCustom = CfgSrvRank.default.bCustom;
KFGameSettings.bUsesStats = CfgSrvRank.default.bUsesStats;
KFGameSettings.NumSpectators = KFGI.NumSpectators;
if (KFGI.WorldInfo.IsConsoleDedicatedServer() || KFGI.WorldInfo.IsEOSDedicatedServer())
{
KFGameSettings.MapName = KFGI.WorldInfo.GetMapName(true);
foreach KFGI.WorldInfo.AllControllers(class'PlayerController', PC)
if (PC.bIsPlayer
&& PC.PlayerReplicationInfo != None
&& !PC.PlayerReplicationInfo.bOnlySpectator
&& !PC.PlayerReplicationInfo.bBot)
NumHumanPlayers++;
KFGameSettings.NumOpenPublicConnections = KFGameSettings.NumPublicConnections - NumHumanPlayers;
}
if (KFGI.PlayfabInter != None && KFGI.PlayfabInter.IsRegisteredWithPlayfab())
{
KFGI.PlayfabInter.ServerUpdateOnlineGame();
if (KFGI.WorldInfo.IsEOSDedicatedServer())
{
KFGI.GameInterface.UpdateOnlineGame(SessionName, KFGameSettings, true);
}
}
else
{
KFGI.GameInterface.UpdateOnlineGame(SessionName, KFGameSettings, true);
}
}
}
}
}
defaultproperties
{
}

Some files were not shown because too many files have changed in this diff Show More