From 434bdb1782474b9388fdab396fee4349779c6bbd Mon Sep 17 00:00:00 2001 From: GenZmeY Date: Tue, 7 Dec 2021 04:26:58 +0300 Subject: [PATCH] refactoring --- MskGs/Classes/KFGameInfoHelper.uc | 100 +++++++++++++++ MskGs/Classes/KFPawnProxy_ZedBloat.uc | 9 ++ MskGs/Classes/MskGsGFxMoviePlayer_Manager.uc | 1 - .../Classes/MskGsGFxTraderContainer_Store.uc | 4 +- MskGs/Classes/MskGsGFxWidget_PartyInGame.uc | 6 - MskGs/Classes/MskGsMut.uc | 20 ++- MskGs/Classes/MskGs_Endless.uc | 112 ++-------------- MskGs/Classes/MskGs_Objective.uc | 111 ++-------------- MskGs/Classes/MskGs_Survival.uc | 112 ++-------------- MskGs/Classes/MskGs_VersusSurvival.uc | 111 ++-------------- MskGs/Classes/MskGs_WeeklySurvival.uc | 120 +----------------- 11 files changed, 168 insertions(+), 538 deletions(-) create mode 100644 MskGs/Classes/KFGameInfoHelper.uc create mode 100644 MskGs/Classes/KFPawnProxy_ZedBloat.uc delete mode 100644 MskGs/Classes/MskGsGFxWidget_PartyInGame.uc diff --git a/MskGs/Classes/KFGameInfoHelper.uc b/MskGs/Classes/KFGameInfoHelper.uc new file mode 100644 index 0000000..e152335 --- /dev/null +++ b/MskGs/Classes/KFGameInfoHelper.uc @@ -0,0 +1,100 @@ +class KFGameInfoHelper extends object; + +static function UpdateGameSettings(KFGameInfo_Survival KFGI, bool bUsesStats, string GameModeClass) +{ + local name SessionName; + local KFOnlineGameSettings KFGameSettings; + local int NumHumanPlayers; + local KFGameEngine KFEngine; + local PlayerController PC; + + 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 = class'KFGameInfo'.static.GetGameModeNumFromClass(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 = False; + } + else + { + KFGameSettings.NumWaves = KFGI.WaveMax - 1; + } + KFGameSettings.OwningPlayerName = class'GameReplicationInfo'.default.ServerName; + + KFGameSettings.NumPublicConnections = KFGI.MaxPlayersAllowed; + KFGameSettings.bRequiresPassword = KFGI.RequiresPassword(); + KFGameSettings.bCustom = False; + KFGameSettings.bUsesStats = 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.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); + } + } + } + } +} + +static function class PickProxyZed(class MonsterClass, Controller Killer) +{ + `log(">>>>>>>>>>>>> DBG: monsterclass"@MonsterClass); + return MonsterClass; +} + +defaultproperties +{ + +} \ No newline at end of file diff --git a/MskGs/Classes/KFPawnProxy_ZedBloat.uc b/MskGs/Classes/KFPawnProxy_ZedBloat.uc new file mode 100644 index 0000000..0d73567 --- /dev/null +++ b/MskGs/Classes/KFPawnProxy_ZedBloat.uc @@ -0,0 +1,9 @@ +class KFPawnProxy_ZedBloat extends KFPawn_ZedBloat; + +DefaultProperties +{ + XPValues(0)=17*2.0f + XPValues(1)=22*2.0f + XPValues(2)=30*2.0f + XPValues(3)=34*2.0f +} diff --git a/MskGs/Classes/MskGsGFxMoviePlayer_Manager.uc b/MskGs/Classes/MskGsGFxMoviePlayer_Manager.uc index 3e59f96..35fa26c 100644 --- a/MskGs/Classes/MskGsGFxMoviePlayer_Manager.uc +++ b/MskGs/Classes/MskGsGFxMoviePlayer_Manager.uc @@ -3,7 +3,6 @@ class MskGsGFxMoviePlayer_Manager extends KFGFxMoviePlayer_Manager defaultproperties { - InGamePartyWidgetClass=class'MskGsGFxWidget_PartyInGame' WidgetBindings.Remove((WidgetName="traderMenu",WidgetClass=class'KFGFxMenu_Trader')) WidgetBindings.Add((WidgetName="traderMenu",WidgetClass=class'MskGsGFxMenu_Trader')) } diff --git a/MskGs/Classes/MskGsGFxTraderContainer_Store.uc b/MskGs/Classes/MskGsGFxTraderContainer_Store.uc index f9381f6..490ec30 100644 --- a/MskGs/Classes/MskGsGFxTraderContainer_Store.uc +++ b/MskGs/Classes/MskGsGFxTraderContainer_Store.uc @@ -1,7 +1,7 @@ class MskGsGFxTraderContainer_Store extends KFGFxTraderContainer_Store; +/* var bool GroupMember; - function Initialize(KFGFxObject_Menu NewParentMenu) { local OnlineSubsystemSteamworks OnlineSub; @@ -13,6 +13,7 @@ function Initialize(KFGFxObject_Menu NewParentMenu) class'OnlineSubsystem'.Static.StringToUniqueNetId("0x017000000223386E", GroupID); GroupMember = OnlineSub.CheckPlayerGroup(GroupID); } +*/ function bool IsItemFiltered(STraderItem Item, optional bool bDebug) { @@ -32,4 +33,5 @@ function bool IsItemFiltered(STraderItem Item, optional bool bDebug) defaultproperties { + } diff --git a/MskGs/Classes/MskGsGFxWidget_PartyInGame.uc b/MskGs/Classes/MskGsGFxWidget_PartyInGame.uc deleted file mode 100644 index 0aac9bf..0000000 --- a/MskGs/Classes/MskGsGFxWidget_PartyInGame.uc +++ /dev/null @@ -1,6 +0,0 @@ -class MskGsGFxWidget_PartyInGame extends KFGFxWidget_PartyInGame within GFxMoviePlayer; - -defaultproperties -{ - PlayerSlots=8 -} diff --git a/MskGs/Classes/MskGsMut.uc b/MskGs/Classes/MskGsMut.uc index 1022060..61a130e 100644 --- a/MskGs/Classes/MskGsMut.uc +++ b/MskGs/Classes/MskGsMut.uc @@ -1,7 +1,7 @@ Class MskGsMut extends KFMutator config(MskGs); -const CurrentVersion = 2; +const CurrentVersion = 3; var config int ConfigVersion; var config bool bEnableMapStats; @@ -9,6 +9,7 @@ var config string SortStats; var config bool bOfficialNextMapOnly; var config bool bRandomizeNextMap; var config int WeapDespawnTime; +var config int DoshDespawnTime; var config array KickProtectedList; var config array PerPlayerMaxMonsters; @@ -52,6 +53,11 @@ function InitConfig() PerPlayerMaxMonsters.AddItem(34); PerPlayerMaxMonsters.AddItem(36); } + case 2: + if (DoshDespawnTime == 0) + { + DoshDespawnTime = 60 * 5; + } case 2147483647: `log("[MskGsMut] Config updated to version"@CurrentVersion); break; @@ -175,7 +181,7 @@ private function bool IsUID(String ID) function bool CheckRelevance(Actor Other) { local bool SuperRelevant; - local KFDroppedPickup PlayerWeap; + local KFDroppedPickup DroppedPickup; SuperRelevant = super.CheckRelevance(Other); @@ -185,13 +191,15 @@ function bool CheckRelevance(Actor Other) return SuperRelevant; } - PlayerWeap = KFDroppedPickup(Other); + DroppedPickup = KFDroppedPickup(Other); // otherwise modify weapon lifespan - if (PlayerWeap != None) + if (DroppedPickup != None) { - PlayerWeap.Lifespan = WeapDespawnTime; - return SuperRelevant; + if (KFDroppedPickup_Cash(DroppedPickup) != None) + DroppedPickup.Lifespan = DoshDespawnTime; + else + DroppedPickup.Lifespan = WeapDespawnTime; } return SuperRelevant; diff --git a/MskGs/Classes/MskGs_Endless.uc b/MskGs/Classes/MskGs_Endless.uc index 431f399..2710f9c 100644 --- a/MskGs/Classes/MskGs_Endless.uc +++ b/MskGs/Classes/MskGs_Endless.uc @@ -1,5 +1,7 @@ class MskGs_Endless extends KFGameInfo_Endless; +var const class KFGIH; + simulated function ExileServerUsingKickBan() { return; @@ -7,112 +9,16 @@ simulated function ExileServerUsingKickBan() function UpdateGameSettings() { - local name SessionName; - local KFOnlineGameSettings KFGameSettings; - local int NumHumanPlayers; - local KFGameEngine KFEngine; - local PlayerController PC; + KFGIH.static.UpdateGameSettings(Self, !IsUnrankedGame(), "KFGameContent.KFGameInfo_Endless"); +} - if (WorldInfo.NetMode == NM_DedicatedServer || WorldInfo.NetMode == NM_ListenServer) - { - //`REMOVEMESOON_ServerTakeoverLog("KFGameInfo_Survival.UpdateGameSettings 1 - GameInterface: "$GameInterface); - if (GameInterface != None) - { - KFEngine = KFGameEngine(class'Engine'.static.GetEngine()); - - SessionName = PlayerReplicationInfoClass.default.SessionName; - - if( PlayfabInter != none && PlayfabInter.GetGameSettings() != none ) - { - KFGameSettings = KFOnlineGameSettings(PlayfabInter.GetGameSettings()); - KFGameSettings.bAvailableForTakeover = KFEngine.bAvailableForTakeover; - } - else - { - KFGameSettings = KFOnlineGameSettings(GameInterface.GetGameSettings(SessionName)); - } - //Ensure bug-for-bug compatibility with KF1 - - //`REMOVEMESOON_ServerTakeoverLog("KFGameInfo_Survival.UpdateGameSettings 2 - KFGameSettings: "$KFGameSettings); - - if (KFGameSettings != None) - { - //`REMOVEMESOON_ServerTakeoverLog("KFGameInfo_Survival.UpdateGameSettings 3 - KFGameSettings.bAvailableForTakeover: "$KFGameSettings.bAvailableForTakeover); - - KFGameSettings.Mode = default.GameModes.Find('ClassNameAndPath', "KFGameContent.KFGameInfo_Endless"); - KFGameSettings.Difficulty = GameDifficulty; - //Ensure bug-for-bug compatibility with KF1 - if (WaveNum == 0) - { - KFGameSettings.bInProgress = false; - KFGameSettings.CurrentWave = 1; - } - else - { - KFGameSettings.bInProgress = true; - KFGameSettings.CurrentWave = WaveNum; - } - //Also from KF1 - if(MyKFGRI != none) - { - KFGameSettings.NumWaves = MyKFGRI.GetFinalWaveNum(); - } - else - { - KFGameSettings.NumWaves = WaveMax - 1; - } - KFGameSettings.OwningPlayerName = class'GameReplicationInfo'.default.ServerName; - - KFGameSettings.NumPublicConnections = MaxPlayersAllowed; - KFGameSettings.bRequiresPassword = RequiresPassword(); - KFGameSettings.bCustom = False; - KFGameSettings.bUsesStats = !IsUnrankedGame(); - KFGameSettings.NumSpectators = NumSpectators; - KFGameSettings.bServerExiled = false; - if(MyKFGRI != none) - { - MyKFGRI.bCustom = False; - } - - // Set the map name - //@SABER_EGS IsEOSDedicatedServer() case added - if( WorldInfo.IsConsoleDedicatedServer() || WorldInfo.IsEOSDedicatedServer() ) - { - KFGameSettings.MapName = WorldInfo.GetMapName(true); - foreach WorldInfo.AllControllers(class'PlayerController', PC) - if (PC.bIsPlayer - && PC.PlayerReplicationInfo != none - && !PC.PlayerReplicationInfo.bBot) - NumHumanPlayers++; - KFGameSettings.NumOpenPublicConnections = KFGameSettings.NumPublicConnections - NumHumanPlayers; - } - - //`REMOVEMESOON_ServerTakeoverLog("KFGameInfo_Survival.UpdateGameSettings 4 - PlayfabInter: "$PlayfabInter); - if (PlayfabInter != none) - { - //`REMOVEMESOON_ServerTakeoverLog("KFGameInfo_Survival.UpdateGameSettings 4.1 - IsRegisteredWithPlayfab: "$PlayfabInter.IsRegisteredWithPlayfab()); - } - - if( PlayfabInter != none && PlayfabInter.IsRegisteredWithPlayfab() ) - { - PlayfabInter.ServerUpdateOnlineGame(); - //@SABER_EGS_BEGIN Crossplay support - if (WorldInfo.IsEOSDedicatedServer()) { - GameInterface.UpdateOnlineGame(SessionName, KFGameSettings, true); - } - //@SABER_EGS_END - } - else - { - //Trigger re-broadcast of game settings - GameInterface.UpdateOnlineGame(SessionName, KFGameSettings, true); - } - } - } - } +protected function DistributeMoneyAndXP(class MonsterClass, const out array DamageHistory, Controller Killer) +{ + Super.DistributeMoneyAndXP(KFGIH.static.PickProxyZed(MonsterClass, Killer), DamageHistory, Killer); } defaultproperties { + KFGIH=class'KFGameInfoHelper' bIsCustomGame=False -} \ No newline at end of file +} diff --git a/MskGs/Classes/MskGs_Objective.uc b/MskGs/Classes/MskGs_Objective.uc index c0e98d6..b0d8d56 100644 --- a/MskGs/Classes/MskGs_Objective.uc +++ b/MskGs/Classes/MskGs_Objective.uc @@ -1,5 +1,7 @@ class MskGs_Objective extends KFGameInfo_Objective; +var const class KFGIH; + simulated function ExileServerUsingKickBan() { return; @@ -7,111 +9,16 @@ simulated function ExileServerUsingKickBan() function UpdateGameSettings() { - local name SessionName; - local KFOnlineGameSettings KFGameSettings; - local int NumHumanPlayers; - local KFGameEngine KFEngine; - local PlayerController PC; + KFGIH.static.UpdateGameSettings(Self, !IsUnrankedGame(), "KFGameContent.KFGameInfo_Objective"); +} - if (WorldInfo.NetMode == NM_DedicatedServer || WorldInfo.NetMode == NM_ListenServer) - { - //`REMOVEMESOON_ServerTakeoverLog("KFGameInfo_Survival.UpdateGameSettings 1 - GameInterface: "$GameInterface); - if (GameInterface != None) - { - KFEngine = KFGameEngine(class'Engine'.static.GetEngine()); - - SessionName = PlayerReplicationInfoClass.default.SessionName; - - if( PlayfabInter != none && PlayfabInter.GetGameSettings() != none ) - { - KFGameSettings = KFOnlineGameSettings(PlayfabInter.GetGameSettings()); - KFGameSettings.bAvailableForTakeover = KFEngine.bAvailableForTakeover; - } - else - { - KFGameSettings = KFOnlineGameSettings(GameInterface.GetGameSettings(SessionName)); - } - //Ensure bug-for-bug compatibility with KF1 - - //`REMOVEMESOON_ServerTakeoverLog("KFGameInfo_Survival.UpdateGameSettings 2 - KFGameSettings: "$KFGameSettings); - - if (KFGameSettings != None) - { - //`REMOVEMESOON_ServerTakeoverLog("KFGameInfo_Survival.UpdateGameSettings 3 - KFGameSettings.bAvailableForTakeover: "$KFGameSettings.bAvailableForTakeover); - - KFGameSettings.Mode = default.GameModes.Find('ClassNameAndPath', "KFGameContent.KFGameInfo_Objective"); - KFGameSettings.Difficulty = GameDifficulty; - //Ensure bug-for-bug compatibility with KF1 - if (WaveNum == 0) - { - KFGameSettings.bInProgress = false; - KFGameSettings.CurrentWave = 1; - } - else - { - KFGameSettings.bInProgress = true; - KFGameSettings.CurrentWave = WaveNum; - } - //Also from KF1 - if(MyKFGRI != none) - { - KFGameSettings.NumWaves = MyKFGRI.GetFinalWaveNum(); - } - else - { - KFGameSettings.NumWaves = WaveMax - 1; - } - KFGameSettings.OwningPlayerName = class'GameReplicationInfo'.default.ServerName; - - KFGameSettings.NumPublicConnections = MaxPlayersAllowed; - KFGameSettings.bRequiresPassword = RequiresPassword(); - KFGameSettings.bCustom = False; - KFGameSettings.bUsesStats = !IsUnrankedGame(); - KFGameSettings.NumSpectators = NumSpectators; - if(MyKFGRI != none) - { - MyKFGRI.bCustom = False; - } - - // Set the map name - //@SABER_EGS IsEOSDedicatedServer() case added - if( WorldInfo.IsConsoleDedicatedServer() || WorldInfo.IsEOSDedicatedServer() ) - { - KFGameSettings.MapName = WorldInfo.GetMapName(true); - foreach WorldInfo.AllControllers(class'PlayerController', PC) - if (PC.bIsPlayer - && PC.PlayerReplicationInfo != none - && !PC.PlayerReplicationInfo.bBot) - NumHumanPlayers++; - KFGameSettings.NumOpenPublicConnections = KFGameSettings.NumPublicConnections - NumHumanPlayers; - } - - //`REMOVEMESOON_ServerTakeoverLog("KFGameInfo_Survival.UpdateGameSettings 4 - PlayfabInter: "$PlayfabInter); - if (PlayfabInter != none) - { - //`REMOVEMESOON_ServerTakeoverLog("KFGameInfo_Survival.UpdateGameSettings 4.1 - IsRegisteredWithPlayfab: "$PlayfabInter.IsRegisteredWithPlayfab()); - } - - if( PlayfabInter != none && PlayfabInter.IsRegisteredWithPlayfab() ) - { - PlayfabInter.ServerUpdateOnlineGame(); - //@SABER_EGS_BEGIN Crossplay support - if (WorldInfo.IsEOSDedicatedServer()) { - GameInterface.UpdateOnlineGame(SessionName, KFGameSettings, true); - } - //@SABER_EGS_END - } - else - { - //Trigger re-broadcast of game settings - GameInterface.UpdateOnlineGame(SessionName, KFGameSettings, true); - } - } - } - } +protected function DistributeMoneyAndXP(class MonsterClass, const out array DamageHistory, Controller Killer) +{ + Super.DistributeMoneyAndXP(KFGIH.static.PickProxyZed(MonsterClass, Killer), DamageHistory, Killer); } defaultproperties { + KFGIH=class'KFGameInfoHelper' bIsCustomGame=False -} \ No newline at end of file +} diff --git a/MskGs/Classes/MskGs_Survival.uc b/MskGs/Classes/MskGs_Survival.uc index d5e0670..fa93228 100644 --- a/MskGs/Classes/MskGs_Survival.uc +++ b/MskGs/Classes/MskGs_Survival.uc @@ -1,5 +1,7 @@ class MskGs_Survival extends KFGameInfo_Survival; +var const class KFGIH; + simulated function ExileServerUsingKickBan() { return; @@ -7,112 +9,16 @@ simulated function ExileServerUsingKickBan() function UpdateGameSettings() { - local name SessionName; - local KFOnlineGameSettings KFGameSettings; - local int NumHumanPlayers; - local KFGameEngine KFEngine; - local PlayerController PC; + KFGIH.static.UpdateGameSettings(Self, !IsUnrankedGame(), "KFGameContent.KFGameInfo_Survival"); +} - if (WorldInfo.NetMode == NM_DedicatedServer || WorldInfo.NetMode == NM_ListenServer) - { - //`REMOVEMESOON_ServerTakeoverLog("KFGameInfo_Survival.UpdateGameSettings 1 - GameInterface: "$GameInterface); - if (GameInterface != None) - { - KFEngine = KFGameEngine(class'Engine'.static.GetEngine()); - - SessionName = PlayerReplicationInfoClass.default.SessionName; - - if( PlayfabInter != none && PlayfabInter.GetGameSettings() != none ) - { - KFGameSettings = KFOnlineGameSettings(PlayfabInter.GetGameSettings()); - KFGameSettings.bAvailableForTakeover = KFEngine.bAvailableForTakeover; - } - else - { - KFGameSettings = KFOnlineGameSettings(GameInterface.GetGameSettings(SessionName)); - } - //Ensure bug-for-bug compatibility with KF1 - - //`REMOVEMESOON_ServerTakeoverLog("KFGameInfo_Survival.UpdateGameSettings 2 - KFGameSettings: "$KFGameSettings); - - if (KFGameSettings != None) - { - //`REMOVEMESOON_ServerTakeoverLog("KFGameInfo_Survival.UpdateGameSettings 3 - KFGameSettings.bAvailableForTakeover: "$KFGameSettings.bAvailableForTakeover); - - KFGameSettings.Mode = default.GameModes.Find('ClassNameAndPath', "KFGameContent.KFGameInfo_Survival"); - KFGameSettings.Difficulty = GameDifficulty; - //Ensure bug-for-bug compatibility with KF1 - if (WaveNum == 0) - { - KFGameSettings.bInProgress = false; - KFGameSettings.CurrentWave = 1; - } - else - { - KFGameSettings.bInProgress = true; - KFGameSettings.CurrentWave = WaveNum; - } - //Also from KF1 - if(MyKFGRI != none) - { - KFGameSettings.NumWaves = MyKFGRI.GetFinalWaveNum(); - } - else - { - KFGameSettings.NumWaves = WaveMax - 1; - } - KFGameSettings.OwningPlayerName = class'GameReplicationInfo'.default.ServerName; - - KFGameSettings.NumPublicConnections = MaxPlayersAllowed; - KFGameSettings.bRequiresPassword = RequiresPassword(); - KFGameSettings.bCustom = False; - KFGameSettings.bUsesStats = !IsUnrankedGame(); - KFGameSettings.NumSpectators = NumSpectators; - if(MyKFGRI != none) - { - MyKFGRI.bCustom = False; - } - - // Set the map name - //@SABER_EGS IsEOSDedicatedServer() case added - if( WorldInfo.IsConsoleDedicatedServer() || WorldInfo.IsEOSDedicatedServer() ) - { - KFGameSettings.MapName = WorldInfo.GetMapName(true); - foreach WorldInfo.AllControllers(class'PlayerController', PC) - if (PC.bIsPlayer - && PC.PlayerReplicationInfo != none - && !PC.PlayerReplicationInfo.bBot) - NumHumanPlayers++; - - KFGameSettings.NumOpenPublicConnections = KFGameSettings.NumPublicConnections - NumHumanPlayers; - } - - //`REMOVEMESOON_ServerTakeoverLog("KFGameInfo_Survival.UpdateGameSettings 4 - PlayfabInter: "$PlayfabInter); - if (PlayfabInter != none) - { - //`REMOVEMESOON_ServerTakeoverLog("KFGameInfo_Survival.UpdateGameSettings 4.1 - IsRegisteredWithPlayfab: "$PlayfabInter.IsRegisteredWithPlayfab()); - } - - if( PlayfabInter != none && PlayfabInter.IsRegisteredWithPlayfab() ) - { - PlayfabInter.ServerUpdateOnlineGame(); - //@SABER_EGS_BEGIN Crossplay support - if (WorldInfo.IsEOSDedicatedServer()) { - GameInterface.UpdateOnlineGame(SessionName, KFGameSettings, true); - } - //@SABER_EGS_END - } - else - { - //Trigger re-broadcast of game settings - GameInterface.UpdateOnlineGame(SessionName, KFGameSettings, true); - } - } - } - } +protected function DistributeMoneyAndXP(class MonsterClass, const out array DamageHistory, Controller Killer) +{ + Super.DistributeMoneyAndXP(KFGIH.static.PickProxyZed(MonsterClass, Killer), DamageHistory, Killer); } defaultproperties { + KFGIH=class'KFGameInfoHelper' bIsCustomGame=False -} \ No newline at end of file +} diff --git a/MskGs/Classes/MskGs_VersusSurvival.uc b/MskGs/Classes/MskGs_VersusSurvival.uc index e28a4be..73f88a0 100644 --- a/MskGs/Classes/MskGs_VersusSurvival.uc +++ b/MskGs/Classes/MskGs_VersusSurvival.uc @@ -1,5 +1,7 @@ class MskGs_VersusSurvival extends KFGameInfo_VersusSurvival; +var const class KFGIH; + simulated function ExileServerUsingKickBan() { return; @@ -7,111 +9,16 @@ simulated function ExileServerUsingKickBan() function UpdateGameSettings() { - local name SessionName; - local KFOnlineGameSettings KFGameSettings; - local int NumHumanPlayers; - local KFGameEngine KFEngine; - local PlayerController PC; + KFGIH.static.UpdateGameSettings(Self, !IsUnrankedGame(), "KFGameContent.KFGameInfo_VersusSurvival"); +} - if (WorldInfo.NetMode == NM_DedicatedServer || WorldInfo.NetMode == NM_ListenServer) - { - //`REMOVEMESOON_ServerTakeoverLog("KFGameInfo_Survival.UpdateGameSettings 1 - GameInterface: "$GameInterface); - if (GameInterface != None) - { - KFEngine = KFGameEngine(class'Engine'.static.GetEngine()); - - SessionName = PlayerReplicationInfoClass.default.SessionName; - - if( PlayfabInter != none && PlayfabInter.GetGameSettings() != none ) - { - KFGameSettings = KFOnlineGameSettings(PlayfabInter.GetGameSettings()); - KFGameSettings.bAvailableForTakeover = KFEngine.bAvailableForTakeover; - } - else - { - KFGameSettings = KFOnlineGameSettings(GameInterface.GetGameSettings(SessionName)); - } - //Ensure bug-for-bug compatibility with KF1 - - //`REMOVEMESOON_ServerTakeoverLog("KFGameInfo_Survival.UpdateGameSettings 2 - KFGameSettings: "$KFGameSettings); - - if (KFGameSettings != None) - { - //`REMOVEMESOON_ServerTakeoverLog("KFGameInfo_Survival.UpdateGameSettings 3 - KFGameSettings.bAvailableForTakeover: "$KFGameSettings.bAvailableForTakeover); - - KFGameSettings.Mode = default.GameModes.Find('ClassNameAndPath', "KFGameContent.KFGameInfo_VersusSurvival"); - KFGameSettings.Difficulty = GameDifficulty; - //Ensure bug-for-bug compatibility with KF1 - if (WaveNum == 0) - { - KFGameSettings.bInProgress = false; - KFGameSettings.CurrentWave = 1; - } - else - { - KFGameSettings.bInProgress = true; - KFGameSettings.CurrentWave = WaveNum; - } - //Also from KF1 - if(MyKFGRI != none) - { - KFGameSettings.NumWaves = MyKFGRI.GetFinalWaveNum(); - } - else - { - KFGameSettings.NumWaves = WaveMax - 1; - } - KFGameSettings.OwningPlayerName = class'GameReplicationInfo'.default.ServerName; - - KFGameSettings.NumPublicConnections = MaxPlayersAllowed; - KFGameSettings.bRequiresPassword = RequiresPassword(); - KFGameSettings.bCustom = False; - KFGameSettings.bUsesStats = !IsUnrankedGame(); - KFGameSettings.NumSpectators = NumSpectators; - if(MyKFGRI != none) - { - MyKFGRI.bCustom = False; - } - - // Set the map name - //@SABER_EGS IsEOSDedicatedServer() case added - if( WorldInfo.IsConsoleDedicatedServer() || WorldInfo.IsEOSDedicatedServer() ) - { - KFGameSettings.MapName = WorldInfo.GetMapName(true); - foreach WorldInfo.AllControllers(class'PlayerController', PC) - if (PC.bIsPlayer - && PC.PlayerReplicationInfo != none - && !PC.PlayerReplicationInfo.bBot) - NumHumanPlayers++; - KFGameSettings.NumOpenPublicConnections = KFGameSettings.NumPublicConnections - NumHumanPlayers; - } - - //`REMOVEMESOON_ServerTakeoverLog("KFGameInfo_Survival.UpdateGameSettings 4 - PlayfabInter: "$PlayfabInter); - if (PlayfabInter != none) - { - //`REMOVEMESOON_ServerTakeoverLog("KFGameInfo_Survival.UpdateGameSettings 4.1 - IsRegisteredWithPlayfab: "$PlayfabInter.IsRegisteredWithPlayfab()); - } - - if( PlayfabInter != none && PlayfabInter.IsRegisteredWithPlayfab() ) - { - PlayfabInter.ServerUpdateOnlineGame(); - //@SABER_EGS_BEGIN Crossplay support - if (WorldInfo.IsEOSDedicatedServer()) { - GameInterface.UpdateOnlineGame(SessionName, KFGameSettings, true); - } - //@SABER_EGS_END - } - else - { - //Trigger re-broadcast of game settings - GameInterface.UpdateOnlineGame(SessionName, KFGameSettings, true); - } - } - } - } +protected function DistributeMoneyAndXP(class MonsterClass, const out array DamageHistory, Controller Killer) +{ + Super.DistributeMoneyAndXP(KFGIH.static.PickProxyZed(MonsterClass, Killer), DamageHistory, Killer); } defaultproperties { + KFGIH=class'KFGameInfoHelper' bIsCustomGame=False -} \ No newline at end of file +} diff --git a/MskGs/Classes/MskGs_WeeklySurvival.uc b/MskGs/Classes/MskGs_WeeklySurvival.uc index 140ccf6..e8c8de4 100644 --- a/MskGs/Classes/MskGs_WeeklySurvival.uc +++ b/MskGs/Classes/MskGs_WeeklySurvival.uc @@ -1,5 +1,7 @@ class MskGs_WeeklySurvival extends KFGameInfo_WeeklySurvival; +var const class KFGIH; + simulated function ExileServerUsingKickBan() { return; @@ -7,126 +9,16 @@ simulated function ExileServerUsingKickBan() function UpdateGameSettings() { - local name SessionName; - local KFOnlineGameSettings KFGameSettings; - local int NumHumanPlayers; - local KFGameEngine KFEngine; - local PlayerController PC; - - if (WorldInfo.NetMode == NM_DedicatedServer || WorldInfo.NetMode == NM_ListenServer) - { - //`REMOVEMESOON_ServerTakeoverLog("KFGameInfo_Survival.UpdateGameSettings 1 - GameInterface: "$GameInterface); - if (GameInterface != None) - { - KFEngine = KFGameEngine(class'Engine'.static.GetEngine()); - - SessionName = PlayerReplicationInfoClass.default.SessionName; - - if( PlayfabInter != none && PlayfabInter.GetGameSettings() != none ) - { - KFGameSettings = KFOnlineGameSettings(PlayfabInter.GetGameSettings()); - KFGameSettings.bAvailableForTakeover = KFEngine.bAvailableForTakeover; - } - else - { - KFGameSettings = KFOnlineGameSettings(GameInterface.GetGameSettings(SessionName)); - } - //Ensure bug-for-bug compatibility with KF1 - - //`REMOVEMESOON_ServerTakeoverLog("KFGameInfo_Survival.UpdateGameSettings 2 - KFGameSettings: "$KFGameSettings); - - if (KFGameSettings != None) - { - //`REMOVEMESOON_ServerTakeoverLog("KFGameInfo_Survival.UpdateGameSettings 3 - KFGameSettings.bAvailableForTakeover: "$KFGameSettings.bAvailableForTakeover); - - KFGameSettings.Mode = default.GameModes.Find('ClassNameAndPath', "KFGameContent.KFGameInfo_WeeklySurvival"); - KFGameSettings.Difficulty = GameDifficulty; - //Ensure bug-for-bug compatibility with KF1 - if (WaveNum == 0) - { - KFGameSettings.bInProgress = false; - KFGameSettings.CurrentWave = 1; - } - else - { - KFGameSettings.bInProgress = true; - KFGameSettings.CurrentWave = WaveNum; - } - //Also from KF1 - if(MyKFGRI != none) - { - KFGameSettings.NumWaves = MyKFGRI.GetFinalWaveNum(); - } - else - { - KFGameSettings.NumWaves = WaveMax - 1; - } - KFGameSettings.OwningPlayerName = class'GameReplicationInfo'.default.ServerName; - - KFGameSettings.NumPublicConnections = MaxPlayersAllowed; - KFGameSettings.bRequiresPassword = RequiresPassword(); - KFGameSettings.bCustom = False; - KFGameSettings.bUsesStats = !IsUnrankedGame(); - KFGameSettings.NumSpectators = NumSpectators; - if(MyKFGRI != none) - { - MyKFGRI.bCustom = False; - } - - // Set the map name - //@SABER_EGS IsEOSDedicatedServer() case added - if( WorldInfo.IsConsoleDedicatedServer() || WorldInfo.IsEOSDedicatedServer() ) - { - KFGameSettings.MapName = WorldInfo.GetMapName(true); - foreach WorldInfo.AllControllers(class'PlayerController', PC) - if (PC.bIsPlayer - && PC.PlayerReplicationInfo != none - && !PC.PlayerReplicationInfo.bBot) - NumHumanPlayers++; - KFGameSettings.NumOpenPublicConnections = KFGameSettings.NumPublicConnections - NumHumanPlayers; - } - - //`REMOVEMESOON_ServerTakeoverLog("KFGameInfo_Survival.UpdateGameSettings 4 - PlayfabInter: "$PlayfabInter); - if (PlayfabInter != none) - { - //`REMOVEMESOON_ServerTakeoverLog("KFGameInfo_Survival.UpdateGameSettings 4.1 - IsRegisteredWithPlayfab: "$PlayfabInter.IsRegisteredWithPlayfab()); - } - - if( PlayfabInter != none && PlayfabInter.IsRegisteredWithPlayfab() ) - { - PlayfabInter.ServerUpdateOnlineGame(); - //@SABER_EGS_BEGIN Crossplay support - if (WorldInfo.IsEOSDedicatedServer()) { - GameInterface.UpdateOnlineGame(SessionName, KFGameSettings, true); - } - //@SABER_EGS_END - } - else - { - //Trigger re-broadcast of game settings - GameInterface.UpdateOnlineGame(SessionName, KFGameSettings, true); - } - } - } - } + KFGIH.static.UpdateGameSettings(Self, !IsUnrankedGame(), "KFGameContent.KFGameInfo_WeeklySurvival"); } -function EndOfMatch(bool bVictory) +protected function DistributeMoneyAndXP(class MonsterClass, const out array DamageHistory, Controller Killer) { - local KFPlayerController KFPC; - - super.EndOfMatch(bVictory); - - if (bVictory) - { - foreach WorldInfo.AllControllers(class'KFPlayerController', KFPC) - { - KFPC.ClientCompletedWeeklySurvival(); - } - } + Super.DistributeMoneyAndXP(KFGIH.static.PickProxyZed(MonsterClass, Killer), DamageHistory, Killer); } defaultproperties { + KFGIH=class'KFGameInfoHelper' bIsCustomGame=False }