Merge pull request #2 from GenZmeY/RemoveMore

DLC and HRG remove
This commit is contained in:
GenZmeY 2022-12-07 23:28:36 +03:00 committed by GitHub
commit 22862616c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 46 additions and 6 deletions

View File

@ -1,7 +1,7 @@
class CTI extends Info class CTI extends Info
config(CTI); config(CTI);
const LatestVersion = 2; const LatestVersion = 3;
const CfgRemoveItems = class'RemoveItems'; const CfgRemoveItems = class'RemoveItems';
const CfgAddItems = class'AddItems'; const CfgAddItems = class'AddItems';
@ -94,6 +94,8 @@ private function PreInit()
case 1: case 1:
bOfficialWeaponsList = false; bOfficialWeaponsList = false;
case 2:
case MaxInt: case MaxInt:
`Log_Info("Config updated to version" @ LatestVersion); `Log_Info("Config updated to version" @ LatestVersion);
break; break;
@ -180,7 +182,14 @@ private function PostInit()
Preload(AddItems); 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; ReadyToSync = true;
@ -273,7 +282,9 @@ public function bool CreateRepInfo(Controller C)
LogLevel, LogLevel,
RemoveItems, RemoveItems,
AddItems, AddItems,
CfgRemoveItems.default.bAll); CfgRemoveItems.default.bAll,
CfgRemoveItems.default.bHRG,
CfgRemoveItems.default.bDLC);
RepInfos.AddItem(RepInfo); RepInfos.AddItem(RepInfo);

View File

@ -10,6 +10,8 @@ var private E_LogLevel LogLevel;
var private Array<class<KFWeaponDefinition> > RemoveItems; var private Array<class<KFWeaponDefinition> > RemoveItems;
var private Array<class<KFWeaponDefinition> > AddItems; var private Array<class<KFWeaponDefinition> > AddItems;
var private bool ReplaceMode; var private bool ReplaceMode;
var private bool RemoveHRG;
var private bool RemoveDLC;
var private bool PreloadContent; var private bool PreloadContent;
var private int Recieved; var private int Recieved;
@ -29,7 +31,7 @@ var private int WaitingGRI;
replication replication
{ {
if (bNetInitial && Role == ROLE_Authority) if (bNetInitial && Role == ROLE_Authority)
LogLevel, ReplaceMode, SyncSize; LogLevel, ReplaceMode, RemoveHRG, RemoveDLC, SyncSize;
} }
public simulated function bool SafeDestroy() public simulated function bool SafeDestroy()
@ -44,7 +46,9 @@ public function PrepareSync(
E_LogLevel _LogLevel, E_LogLevel _LogLevel,
Array<class<KFWeaponDefinition> > _RemoveItems, Array<class<KFWeaponDefinition> > _RemoveItems,
Array<class<KFWeaponDefinition> > _AddItems, Array<class<KFWeaponDefinition> > _AddItems,
bool _ReplaceMode) bool _ReplaceMode,
bool _RemoveHRG,
bool _RemoveDLC)
{ {
`Log_Trace(); `Log_Trace();
@ -53,6 +57,8 @@ public function PrepareSync(
RemoveItems = _RemoveItems; RemoveItems = _RemoveItems;
AddItems = _AddItems; AddItems = _AddItems;
ReplaceMode = _ReplaceMode; ReplaceMode = _ReplaceMode;
RemoveHRG = _RemoveHRG;
RemoveDLC = _RemoveDLC;
SyncSize = RemoveItems.Length + AddItems.Length; SyncSize = RemoveItems.Length + AddItems.Length;
} }
@ -227,7 +233,7 @@ private simulated reliable client function ClientSyncFinished()
NotificationRightText = ""; NotificationRightText = "";
NotificationPercent = 0; 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"); `Log_Debug("ClientSyncFinished: Trader.static.ModifyTrader");
ClearTimer(nameof(KeepNotification)); ClearTimer(nameof(KeepNotification));

View File

@ -3,6 +3,8 @@ class RemoveItems extends Object
config(CTI); config(CTI);
var public config bool bAll; var public config bool bAll;
var public config bool bHRG;
var public config bool bDLC;
var private config Array<String> Item; var private config Array<String> Item;
public static function InitConfig(int Version, int LatestVersion) public static function InitConfig(int Version, int LatestVersion)
@ -12,6 +14,10 @@ public static function InitConfig(int Version, int LatestVersion)
case `NO_CONFIG: case `NO_CONFIG:
ApplyDefault(); ApplyDefault();
case 2:
default.bHRG = false;
default.bDLC = false;
default: break; default: break;
} }
@ -24,6 +30,8 @@ public static function InitConfig(int Version, int LatestVersion)
private static function ApplyDefault() private static function ApplyDefault()
{ {
default.bAll = false; default.bAll = false;
default.bHRG = false;
default.bDLC = false;
default.Item.Length = 0; default.Item.Length = 0;
default.Item.AddItem("KFGame.KFWeapDef_9mmDual"); default.Item.AddItem("KFGame.KFWeapDef_9mmDual");
} }
@ -43,6 +51,15 @@ public static function Array<class<KFWeaponDefinition> > Load(E_LogLevel LogLeve
} }
else else
{ {
if (default.bHRG)
{
`Log_Info("Remove all HRG items");
}
if (default.bDLC)
{
`Log_Info("Remove all DLC items");
}
foreach default.Item(ItemRaw, Line) foreach default.Item(ItemRaw, Line)
{ {
ItemWeapDef = class<KFWeaponDefinition>(DynamicLoadObject(ItemRaw, class'Class')); ItemWeapDef = class<KFWeaponDefinition>(DynamicLoadObject(ItemRaw, class'Class'));

View File

@ -91,6 +91,8 @@ public static simulated function ModifyTrader(
Array<class<KFWeaponDefinition> > RemoveItems, Array<class<KFWeaponDefinition> > RemoveItems,
Array<class<KFWeaponDefinition> > AddItems, Array<class<KFWeaponDefinition> > AddItems,
bool ReplaceMode, bool ReplaceMode,
bool RemoveHRG,
bool RemoveDLC,
E_LogLevel LogLevel) E_LogLevel LogLevel)
{ {
local KFGFxObject_TraderItems TraderItems; local KFGFxObject_TraderItems TraderItems;
@ -110,6 +112,8 @@ public static simulated function ModifyTrader(
{ {
if (Item.WeaponDef != None 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))
&& WeaponClassIsUnique(Item.WeaponDef.default.WeaponClassPath, AddItems, LogLevel)) && WeaponClassIsUnique(Item.WeaponDef.default.WeaponClassPath, AddItems, LogLevel))
{ {
WeapDefs.AddItem(Item.WeaponDef); WeapDefs.AddItem(Item.WeaponDef);

View File

@ -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. 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]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. [*]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. example: [b]Item=WeaponPack.KFWeapDef_XM25[/b] will add [url=https://steamcommunity.com/sharedfiles/filedetails/?id=1147408497]XM25[/url] to sale.