diff --git a/LTI/Classes/LTI.uc b/LTI/Classes/LTI.uc index c7b9021..bcd3fb7 100644 --- a/LTI/Classes/LTI.uc +++ b/LTI/Classes/LTI.uc @@ -1,7 +1,7 @@ class LTI extends Info config(LTI); -const LatestVersion = 1; +const LatestVersion = 2; const CfgRemoveItems = class'RemoveItems'; const CfgOfficialWeapons = class'OfficialWeapons'; @@ -71,6 +71,8 @@ private function PreInit() case `NO_CONFIG: `Log_Info("Config created"); + case 1: + case MaxInt: `Log_Info("Config updated to version" @ LatestVersion); break; @@ -139,7 +141,13 @@ private function PostInit() return; } - Trader.static.ModifyTrader(KFGRI, RemoveItems, CfgRemoveItems.default.bAll, LogLevel); + Trader.static.ModifyTrader( + KFGRI, + RemoveItems, + CfgRemoveItems.default.bAll, + CfgRemoveItems.default.bHRG, + CfgRemoveItems.default.bDLC, + LogLevel); ReadyToSync = true; @@ -185,7 +193,9 @@ public function bool CreateRepInfo(Controller C) Self, LogLevel, RemoveItems, - CfgRemoveItems.default.bAll); + CfgRemoveItems.default.bAll, + CfgRemoveItems.default.bHRG, + CfgRemoveItems.default.bDLC); RepInfos.AddItem(RepInfo); diff --git a/LTI/Classes/LTIMut.uc b/LTI/Classes/LTIMut.uc index 63f166c..40e528f 100644 --- a/LTI/Classes/LTIMut.uc +++ b/LTI/Classes/LTIMut.uc @@ -35,7 +35,7 @@ public function AddMutator(Mutator Mut) if (Mut == Self) return; if (Mut.Class == Class) - Mut.Destroy(); + LTIMut(Mut).SafeDestroy(); else Super.AddMutator(Mut); } diff --git a/LTI/Classes/LTI_RepInfo.uc b/LTI/Classes/LTI_RepInfo.uc index 2de3bd1..093d8fa 100644 --- a/LTI/Classes/LTI_RepInfo.uc +++ b/LTI/Classes/LTI_RepInfo.uc @@ -9,6 +9,8 @@ var private LTI LTI; var private E_LogLevel LogLevel; var private Array > RemoveItems; var private bool ReplaceMode; +var private bool RemoveHRG; +var private bool RemoveDLC; var private int Recieved; var private int SyncSize; @@ -27,7 +29,7 @@ var private int WaitingGRI; replication { if (bNetInitial && Role == ROLE_Authority) - LogLevel, ReplaceMode, SyncSize; + LogLevel, ReplaceMode, RemoveHRG, RemoveDLC, SyncSize; } public simulated function bool SafeDestroy() @@ -41,7 +43,9 @@ public function PrepareSync( LTI _LTI, E_LogLevel _LogLevel, Array > _RemoveItems, - bool _ReplaceMode) + bool _ReplaceMode, + bool _RemoveHRG, + bool _RemoveDLC) { `Log_Trace(); @@ -49,6 +53,8 @@ public function PrepareSync( LogLevel = _LogLevel; RemoveItems = _RemoveItems; ReplaceMode = _ReplaceMode; + RemoveHRG = _RemoveHRG; + RemoveDLC = _RemoveDLC; SyncSize = RemoveItems.Length; } @@ -216,7 +222,7 @@ private simulated reliable client function ClientSyncFinished() NotificationRightText = ""; NotificationPercent = 0; - Trader.static.ModifyTrader(KFGRI, RemoveItems, ReplaceMode, LogLevel); + Trader.static.ModifyTrader(KFGRI, RemoveItems, ReplaceMode, RemoveHRG, RemoveDLC, LogLevel); `Log_Debug("ClientSyncFinished: Trader.static.ModifyTrader"); ClearTimer(nameof(KeepNotification)); diff --git a/LTI/Classes/RemoveItems.uc b/LTI/Classes/RemoveItems.uc index 47f3508..e15839f 100644 --- a/LTI/Classes/RemoveItems.uc +++ b/LTI/Classes/RemoveItems.uc @@ -3,6 +3,8 @@ class RemoveItems extends Object config(LTI); 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 1: + 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/LTI/Classes/Trader.uc b/LTI/Classes/Trader.uc index c5ea165..91de8bb 100644 --- a/LTI/Classes/Trader.uc +++ b/LTI/Classes/Trader.uc @@ -69,6 +69,8 @@ public static simulated function ModifyTrader( KFGameReplicationInfo KFGRI, Array > RemoveItems, bool ReplaceMode, + bool RemoveHRG, + bool RemoveDLC, E_LogLevel LogLevel) { local KFGFxObject_TraderItems TraderItems; @@ -86,7 +88,9 @@ public static simulated function ModifyTrader( foreach TraderItems.SaleItems(Item) { if (Item.WeaponDef != None - && RemoveItems.Find(Item.WeaponDef) == INDEX_NONE) + && RemoveItems.Find(Item.WeaponDef) == INDEX_NONE + && (!RemoveHRG || (RemoveHRG && InStr(Item.WeaponDef, "_HRG", true) == INDEX_NONE)) + && (!RemoveDLC || (RemoveDLC && Item.WeaponDef.default.SharedUnlockId == SCU_None))) { WeapDefs.AddItem(Item.WeaponDef); } diff --git a/PublicationContent/description.txt b/PublicationContent/description.txt index dca699b..4a4f1e9 100644 --- a/PublicationContent/description.txt +++ b/PublicationContent/description.txt @@ -56,6 +56,9 @@ Unfortunately I can't do anything about it because it's a game problem (not muta [*]Set [b]bOfficialWeaponsList=True[/b] to have an auto-updated list of all official weapons in the config (for a convenient copy-paste). [*]Use [b][LTI.RemoveItems][/b] to remove items from the trader inventory. example: [b]Item=KFGame.KFWeapDef_Mac10[/b] will remove MAC10 from sale. + +[*]Set [b]bHRG=True[/b] to remove HRG items. +[*]Set [b]bDLC=True[/b] to remove DLC items. [/list] [h1]Sources[/h1]