19 Commits

Author SHA1 Message Date
94a4368842 Merge pull request #3 from GenZmeY/v1136
Update v1136 (unlock new DLC weapons)
2022-12-07 23:28:50 +03:00
22862616c0 Merge pull request #2 from GenZmeY/RemoveMore
DLC and HRG remove
2022-12-07 23:28:36 +03:00
6c3d9f094e unlock new DLC weapons 2022-11-28 01:00:44 +03:00
8c3ed68acb add remove DLC and HRG 2022-11-27 03:37:26 +03:00
89c7eccb6f update build tools 2022-10-13 22:42:09 +03:00
f7d86b4492 Merge pull request #1 from GenZmeY/v1133
add WeapDef_G36C and WeapDef_Scythe
2022-10-13 22:38:13 +03:00
c25366d207 update description 2022-10-01 20:49:22 +03:00
f9b70d8066 update description 2022-10-01 20:47:38 +03:00
95871b2f89 update description 2022-10-01 20:30:34 +03:00
11768dfbc2 update description 2022-10-01 20:24:18 +03:00
cc55913e5a update description 2022-10-01 20:21:12 +03:00
a87f5bf697 update build tools 2022-09-13 04:36:39 +03:00
eb33a6e1ff add WeapDef_G36C and WeapDef_Scythe 2022-09-12 23:38:09 +03:00
25e9d96b44 update build tools 2022-09-02 16:22:18 +03:00
2d2975b7ed Merge branch 'master' of https://github.com/GenZmeY/KF2-CustomTraderInventory 2022-09-02 15:30:27 +03:00
247eef02aa update build tools 2022-09-02 15:29:52 +03:00
a00d80918f Update description.txt 2022-09-02 11:48:27 +03:00
5e4086c861 fix false "error": "Cant destroy RepInfo" 2022-08-30 09:55:09 +03:00
f92bea7114 fix notify login/logout order 2022-08-30 08:26:40 +03:00
14 changed files with 139 additions and 52 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*.psd
/ignore

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;
@ -253,10 +262,7 @@ public function NotifyLogout(Controller C)
{ {
`Log_Trace(); `Log_Trace();
if (!DestroyRepInfo(C)) DestroyRepInfo(C);
{
`Log_Error("Can't destroy RepInfo of:" @ C);
}
} }
public function bool CreateRepInfo(Controller C) public function bool CreateRepInfo(Controller C)
@ -276,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);
@ -304,8 +312,8 @@ public function bool DestroyRepInfo(Controller C)
{ {
if (RepInfo.Owner == C) if (RepInfo.Owner == C)
{ {
RepInfo.SafeDestroy();
RepInfos.RemoveItem(RepInfo); RepInfos.RemoveItem(RepInfo);
RepInfo.SafeDestroy();
return true; return true;
} }
} }

View File

@ -42,16 +42,16 @@ public function AddMutator(Mutator Mut)
public function NotifyLogin(Controller C) public function NotifyLogin(Controller C)
{ {
Super.NotifyLogin(C);
CTI.NotifyLogin(C); CTI.NotifyLogin(C);
Super.NotifyLogin(C);
} }
public function NotifyLogout(Controller C) public function NotifyLogout(Controller C)
{ {
Super.NotifyLogout(C);
CTI.NotifyLogout(C); CTI.NotifyLogout(C);
Super.NotifyLogout(C);
} }
DefaultProperties DefaultProperties

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

@ -0,0 +1,7 @@
class CTI_WeapDef_G36C extends KFWeapDef_G36C
abstract;
defaultproperties
{
SharedUnlockId = SCU_None
}

View File

@ -0,0 +1,7 @@
class CTI_WeapDef_HVStormCannon extends KFWeapDef_HVStormCannon
abstract;
defaultproperties
{
SharedUnlockId = SCU_None
}

View File

@ -0,0 +1,7 @@
class CTI_WeapDef_Scythe extends KFWeapDef_Scythe
abstract;
defaultproperties
{
SharedUnlockId = SCU_None
}

View File

@ -0,0 +1,7 @@
class CTI_WeapDef_ZedMKIII extends KFWeapDef_ZedMKIII
abstract;
defaultproperties
{
SharedUnlockId = SCU_None
}

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

@ -169,27 +169,31 @@ private static function bool ReplaceFilter(KFGameInfo KFGI, E_LogLevel LogLevel)
defaultproperties defaultproperties
{ {
WeapDefDLCReplacements(0) = class'CTI_WeapDef_AutoTurret' WeapDefDLCReplacements.Add(class'CTI_WeapDef_AutoTurret')
WeapDefDLCReplacements(1) = class'CTI_WeapDef_BladedPistol' WeapDefDLCReplacements.Add(class'CTI_WeapDef_BladedPistol')
WeapDefDLCReplacements(2) = class'CTI_WeapDef_Blunderbuss' WeapDefDLCReplacements.Add(class'CTI_WeapDef_Blunderbuss')
WeapDefDLCReplacements(3) = class'CTI_WeapDef_ChainBat' WeapDefDLCReplacements.Add(class'CTI_WeapDef_ChainBat')
WeapDefDLCReplacements(4) = class'CTI_WeapDef_ChiappaRhino' WeapDefDLCReplacements.Add(class'CTI_WeapDef_ChiappaRhino')
WeapDefDLCReplacements(5) = class'CTI_WeapDef_ChiappaRhinoDual' WeapDefDLCReplacements.Add(class'CTI_WeapDef_ChiappaRhinoDual')
WeapDefDLCReplacements(6) = class'CTI_WeapDef_CompoundBow' WeapDefDLCReplacements.Add(class'CTI_WeapDef_CompoundBow')
WeapDefDLCReplacements(7) = class'CTI_WeapDef_Doshinegun' WeapDefDLCReplacements.Add(class'CTI_WeapDef_Doshinegun')
WeapDefDLCReplacements(8) = class'CTI_WeapDef_DualBladed' WeapDefDLCReplacements.Add(class'CTI_WeapDef_DualBladed')
WeapDefDLCReplacements(9) = class'CTI_WeapDef_FAMAS' WeapDefDLCReplacements.Add(class'CTI_WeapDef_FAMAS')
WeapDefDLCReplacements(10) = class'CTI_WeapDef_G18' WeapDefDLCReplacements.Add(class'CTI_WeapDef_G18')
WeapDefDLCReplacements(11) = class'CTI_WeapDef_GravityImploder' WeapDefDLCReplacements.Add(class'CTI_WeapDef_G36C')
WeapDefDLCReplacements(12) = class'CTI_WeapDef_IonThruster' WeapDefDLCReplacements.Add(class'CTI_WeapDef_GravityImploder')
WeapDefDLCReplacements(13) = class'CTI_WeapDef_Mine_Reconstructor' WeapDefDLCReplacements.Add(class'CTI_WeapDef_HVStormCannon')
WeapDefDLCReplacements(14) = class'CTI_WeapDef_Minigun' WeapDefDLCReplacements.Add(class'CTI_WeapDef_IonThruster')
WeapDefDLCReplacements(15) = class'CTI_WeapDef_MosinNagant' WeapDefDLCReplacements.Add(class'CTI_WeapDef_Mine_Reconstructor')
WeapDefDLCReplacements(16) = class'CTI_WeapDef_ParasiteImplanter' WeapDefDLCReplacements.Add(class'CTI_WeapDef_Minigun')
WeapDefDLCReplacements(17) = class'CTI_WeapDef_Pistol_DualG18' WeapDefDLCReplacements.Add(class'CTI_WeapDef_MosinNagant')
WeapDefDLCReplacements(18) = class'CTI_WeapDef_Pistol_G18C' WeapDefDLCReplacements.Add(class'CTI_WeapDef_ParasiteImplanter')
WeapDefDLCReplacements(19) = class'CTI_WeapDef_Rifle_FrostShotgunAxe' WeapDefDLCReplacements.Add(class'CTI_WeapDef_Pistol_DualG18')
WeapDefDLCReplacements(20) = class'CTI_WeapDef_ShrinkRayGun' WeapDefDLCReplacements.Add(class'CTI_WeapDef_Pistol_G18C')
WeapDefDLCReplacements(21) = class'CTI_WeapDef_ThermiteBore' WeapDefDLCReplacements.Add(class'CTI_WeapDef_Rifle_FrostShotgunAxe')
WeapDefDLCReplacements(22) = class'CTI_WeapDef_Zweihander' WeapDefDLCReplacements.Add(class'CTI_WeapDef_Scythe')
WeapDefDLCReplacements.Add(class'CTI_WeapDef_ShrinkRayGun')
WeapDefDLCReplacements.Add(class'CTI_WeapDef_ThermiteBore')
WeapDefDLCReplacements.Add(class'CTI_WeapDef_ZedMKIII')
WeapDefDLCReplacements.Add(class'CTI_WeapDef_Zweihander')
} }

View File

@ -16,7 +16,7 @@ No. This mod is not whitelisted and will de-rank your server. Any XP gained will
[olist] [olist]
[*]Subscribe to this mutator; [*]Subscribe to this mutator;
[*]Start KF2; [*]Start KF2;
[*]Open console (`) and input: [*]Open console (~) and input:
[b]open KF-BioticsLab?Mutator=CTI.CTIMut[/b] [b]open KF-BioticsLab?Mutator=CTI.CTIMut[/b]
(replace the map and add the parameters you need) (replace the map and add the parameters you need)
[*]<Enter>. [*]<Enter>.
@ -34,8 +34,20 @@ No. This mod is not whitelisted and will de-rank your server. Any XP gained will
[*]Add mutator to server start parameters: [b]?Mutator=CTI.CTIMut[/b] and restart the server. [*]Add mutator to server start parameters: [b]?Mutator=CTI.CTIMut[/b] and restart the server.
[/olist] [/olist]
[h1]Important setup information[/h1]
The config should be created on first start, but now the game contains a bug that initializes the config values randomly if they are not explicitly set. Thus, the config may have incorrect values or not be created at all.
So if you are using this mutator for the first time, I highly recommend doing the following:
[olist]
[*]Create (modify) [b]KFCTI.ini[/b] manually. Put the following content there:
[b][CTI.CTI]
Version=0[/b]
[*]Start the game/server with CTI to generate the contents of the config.
[*]Close the game/server.
[/olist]
[b]Right now this is the only way to correctly create the default config.[/b]
Unfortunately I can't do anything about it because it's a game problem (not mutator). I hope TWI fixes this someday.
[h1]Setup (KFCTI.ini)[/h1] [h1]Setup (KFCTI.ini)[/h1]
Config will be created at the first start[b]*[/b].
[list] [list]
[*]Set [b]bPreloadContent=True[/b] to load weapon models in advance and have no lags during the game. [*]Set [b]bPreloadContent=True[/b] to load weapon models in advance and have no lags during the game.
@ -53,23 +65,20 @@ Config will be created at the first start[b]*[/b].
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.
[/list] [/list]
[h1]🔗 [url=https://steamcommunity.com/workshop/filedetails/discussion/2830826239/3409804177172972154]Weapon Packs Items[/url][/h1]
❗️ Note that if you need an empty list anywhere (for example, you don't want to delete some of the traders's weapons), leave at least one line there:
[b]Item=""[/b]
This is necessary to explicitly initialize the list (because of the bug I wrote about above) to avoid initialization with random values.
[h1]Notes[/h1] [h1]Notes[/h1]
📌 Mutator does not contain custom weapons. You must have the required weapon packs in your subscriptions to be able to add them to the trader. 📌 Mutator does not contain custom weapons. You must have the required weapon packs in your subscriptions to be able to add them to the trader.
📌 If you are using this mutator to add weapons, you should [b]not[/b] use mutators from weapon packs (just having them in subscriptions is enough). 📌 If you are using this mutator to add weapons, you should [b]not[/b] use mutators from weapon packs (just having them in subscriptions is enough).
[h1]Troubleshooting[/h1]
[b](*)[/b] If your config is not created for some reason, create it manually with the following content:
[b][CTI.CTI]
Version=0
[/b]
Then start the server and check the file again - config content should be generated.
[h1]Sources[/h1] [h1]Sources[/h1]
[url=https://github.com/GenZmeY/KF2-CustomTraderInventory]https://github.com/GenZmeY/KF2-CustomTraderInventory[/url] [b](GNU GPLv3)[/b] [url=https://github.com/GenZmeY/KF2-CustomTraderInventory]https://github.com/GenZmeY/KF2-CustomTraderInventory[/url] [b](GNU GPLv3)[/b]

View File

@ -11,6 +11,15 @@ StripSource="True"
PackageBuildOrder="CTI" PackageBuildOrder="CTI"
### Brew parameters ###
# Packages you want to brew using @peelz's patched KFEditor.
# Useful for cases where regular brew doesn't put *.upk inside the package.
# Specify them with a space as a separator,
# The order doesn't matter
PackagePeelzBrew=""
### Steam Workshop upload parameters ### ### Steam Workshop upload parameters ###
# Mutators that will be uploaded to the workshop # Mutators that will be uploaded to the workshop
@ -30,7 +39,7 @@ Map="KF-Nuked"
# Endless: KFGameContent.KFGameInfo_Endless # Endless: KFGameContent.KFGameInfo_Endless
# Objective: KFGameContent.KFGameInfo_Objective # Objective: KFGameContent.KFGameInfo_Objective
# Versus: KFGameContent.KFGameInfo_VersusSurvival # Versus: KFGameContent.KFGameInfo_VersusSurvival
Game="KFGameContent.KFGameInfo_Endless" Game="KFGameContent.KFGameInfo_Survival"
# Difficulty: # Difficulty:
# Normal: 0 # Normal: 0

2
tools

Submodule tools updated: 2f173aad7a...d830a5ea16