From 8c3ed68acb582598b24318efe2c2d295ddad6b0e Mon Sep 17 00:00:00 2001 From: GenZmeY Date: Sun, 27 Nov 2022 03:37:26 +0300 Subject: [PATCH] add remove DLC and HRG --- CTI/Classes/CTI.uc | 17 ++++++++++++++--- CTI/Classes/CTI_RepInfo.uc | 12 +++++++++--- CTI/Classes/RemoveItems.uc | 17 +++++++++++++++++ CTI/Classes/Trader.uc | 4 ++++ PublicationContent/description.txt | 2 ++ 5 files changed, 46 insertions(+), 6 deletions(-) diff --git a/CTI/Classes/CTI.uc b/CTI/Classes/CTI.uc index e8ff478..a1f7a44 100644 --- a/CTI/Classes/CTI.uc +++ b/CTI/Classes/CTI.uc @@ -1,7 +1,7 @@ class CTI extends Info config(CTI); -const LatestVersion = 2; +const LatestVersion = 3; const CfgRemoveItems = class'RemoveItems'; const CfgAddItems = class'AddItems'; @@ -94,6 +94,8 @@ private function PreInit() case 1: bOfficialWeaponsList = false; + case 2: + case MaxInt: `Log_Info("Config updated to version" @ LatestVersion); break; @@ -180,7 +182,14 @@ private function PostInit() Preload(AddItems); } - Trader.static.ModifyTrader(KFGRI, RemoveItems, AddItems, CfgRemoveItems.default.bAll, LogLevel); + Trader.static.ModifyTrader( + KFGRI, + RemoveItems, + AddItems, + CfgRemoveItems.default.bAll, + CfgRemoveItems.default.bHRG, + CfgRemoveItems.default.bDLC, + LogLevel); ReadyToSync = true; @@ -273,7 +282,9 @@ public function bool CreateRepInfo(Controller C) LogLevel, RemoveItems, AddItems, - CfgRemoveItems.default.bAll); + CfgRemoveItems.default.bAll, + CfgRemoveItems.default.bHRG, + CfgRemoveItems.default.bDLC); RepInfos.AddItem(RepInfo); diff --git a/CTI/Classes/CTI_RepInfo.uc b/CTI/Classes/CTI_RepInfo.uc index 5017e34..043da90 100644 --- a/CTI/Classes/CTI_RepInfo.uc +++ b/CTI/Classes/CTI_RepInfo.uc @@ -10,6 +10,8 @@ var private E_LogLevel LogLevel; var private Array > RemoveItems; var private Array > AddItems; var private bool ReplaceMode; +var private bool RemoveHRG; +var private bool RemoveDLC; var private bool PreloadContent; var private int Recieved; @@ -29,7 +31,7 @@ var private int WaitingGRI; replication { if (bNetInitial && Role == ROLE_Authority) - LogLevel, ReplaceMode, SyncSize; + LogLevel, ReplaceMode, RemoveHRG, RemoveDLC, SyncSize; } public simulated function bool SafeDestroy() @@ -44,7 +46,9 @@ public function PrepareSync( E_LogLevel _LogLevel, Array > _RemoveItems, Array > _AddItems, - bool _ReplaceMode) + bool _ReplaceMode, + bool _RemoveHRG, + bool _RemoveDLC) { `Log_Trace(); @@ -53,6 +57,8 @@ public function PrepareSync( RemoveItems = _RemoveItems; AddItems = _AddItems; ReplaceMode = _ReplaceMode; + RemoveHRG = _RemoveHRG; + RemoveDLC = _RemoveDLC; SyncSize = RemoveItems.Length + AddItems.Length; } @@ -227,7 +233,7 @@ private simulated reliable client function ClientSyncFinished() NotificationRightText = ""; NotificationPercent = 0; - Trader.static.ModifyTrader(KFGRI, RemoveItems, AddItems, ReplaceMode, LogLevel); + Trader.static.ModifyTrader(KFGRI, RemoveItems, AddItems, ReplaceMode, RemoveHRG, RemoveDLC, LogLevel); `Log_Debug("ClientSyncFinished: Trader.static.ModifyTrader"); ClearTimer(nameof(KeepNotification)); diff --git a/CTI/Classes/RemoveItems.uc b/CTI/Classes/RemoveItems.uc index 1626484..c9864ff 100644 --- a/CTI/Classes/RemoveItems.uc +++ b/CTI/Classes/RemoveItems.uc @@ -3,6 +3,8 @@ class RemoveItems extends Object config(CTI); var public config bool bAll; +var public config bool bHRG; +var public config bool bDLC; var private config Array Item; public static function InitConfig(int Version, int LatestVersion) @@ -12,6 +14,10 @@ public static function InitConfig(int Version, int LatestVersion) case `NO_CONFIG: ApplyDefault(); + case 2: + default.bHRG = false; + default.bDLC = false; + default: break; } @@ -24,6 +30,8 @@ public static function InitConfig(int Version, int LatestVersion) private static function ApplyDefault() { default.bAll = false; + default.bHRG = false; + default.bDLC = false; default.Item.Length = 0; default.Item.AddItem("KFGame.KFWeapDef_9mmDual"); } @@ -43,6 +51,15 @@ public static function Array > Load(E_LogLevel LogLeve } else { + if (default.bHRG) + { + `Log_Info("Remove all HRG items"); + } + if (default.bDLC) + { + `Log_Info("Remove all DLC items"); + } + foreach default.Item(ItemRaw, Line) { ItemWeapDef = class(DynamicLoadObject(ItemRaw, class'Class')); diff --git a/CTI/Classes/Trader.uc b/CTI/Classes/Trader.uc index cc41f6c..d552762 100644 --- a/CTI/Classes/Trader.uc +++ b/CTI/Classes/Trader.uc @@ -91,6 +91,8 @@ public static simulated function ModifyTrader( Array > RemoveItems, Array > AddItems, bool ReplaceMode, + bool RemoveHRG, + bool RemoveDLC, E_LogLevel LogLevel) { local KFGFxObject_TraderItems TraderItems; @@ -110,6 +112,8 @@ public static simulated function ModifyTrader( { if (Item.WeaponDef != None && RemoveItems.Find(Item.WeaponDef) == INDEX_NONE + && (!RemoveHRG || (RemoveHRG && InStr(Item.WeaponDef, "_HRG", true) == INDEX_NONE)) + && (!RemoveDLC || (RemoveDLC && Item.WeaponDef.default.SharedUnlockId == SCU_None)) && WeaponClassIsUnique(Item.WeaponDef.default.WeaponClassPath, AddItems, LogLevel)) { WeapDefs.AddItem(Item.WeaponDef); diff --git a/PublicationContent/description.txt b/PublicationContent/description.txt index 3286fa9..b5dc519 100644 --- a/PublicationContent/description.txt +++ b/PublicationContent/description.txt @@ -65,6 +65,8 @@ Unfortunately I can't do anything about it because it's a game problem (not muta example: [b]Item=KFGame.KFWeapDef_Mac10[/b] will remove MAC10 from sale. [*]Set [b]bAll=True[/b] if you want to remove all items (can be useful if you want to set the entire sale list in the [b][CTI.AddItems][/b] section yourself). +[*]Set [b]bHRG=True[/b] to remove HRG items. +[*]Set [b]bDLC=True[/b] to remove DLC items. [*]Use [b][CTI.AddItems][/b] to add items to the trader inventory. example: [b]Item=WeaponPack.KFWeapDef_XM25[/b] will add [url=https://steamcommunity.com/sharedfiles/filedetails/?id=1147408497]XM25[/url] to sale.