diff --git a/Live/CWX_BushWhacker/Plugin.cs b/Live/CWX_BushWhacker/BushWhacker.cs similarity index 93% rename from Live/CWX_BushWhacker/Plugin.cs rename to Live/CWX_BushWhacker/BushWhacker.cs index 4a1f644..566cc66 100644 --- a/Live/CWX_BushWhacker/Plugin.cs +++ b/Live/CWX_BushWhacker/BushWhacker.cs @@ -3,14 +3,14 @@ using EFT.Interactive; using System.Linq; using UnityEngine; -namespace BushWhacker +namespace CWX_BushWhacker { - [BepInPlugin("com.cwx.bushwhacker", "cwx-bushwhacker", "1.2.4")] + [BepInPlugin("com.cwx.bushwhacker", "cwx-bushwhacker", "1.2.5")] public class BushWhacker : BaseUnityPlugin { public void Start() { - new Patch().Enable(); + new BushWhackerPatch().Enable(); } public static void DisableBushes() diff --git a/Live/CWX_BushWhacker/Patch.cs b/Live/CWX_BushWhacker/BushWhackerPatch.cs similarity index 84% rename from Live/CWX_BushWhacker/Patch.cs rename to Live/CWX_BushWhacker/BushWhackerPatch.cs index ccc93e0..16b439c 100644 --- a/Live/CWX_BushWhacker/Patch.cs +++ b/Live/CWX_BushWhacker/BushWhackerPatch.cs @@ -2,9 +2,9 @@ using EFT; using System.Reflection; -namespace BushWhacker +namespace CWX_BushWhacker { - public class Patch : ModulePatch + public class BushWhackerPatch : ModulePatch { protected override MethodBase GetTargetMethod() { diff --git a/Live/CWX_BushWhacker/CWX-BushWhacker 1.2.4/bepInEx/plugins/CWX-BushWhacker.dll b/Live/CWX_BushWhacker/CWX-BushWhacker 1.2.4/bepInEx/plugins/CWX-BushWhacker.dll deleted file mode 100644 index f89386f..0000000 Binary files a/Live/CWX_BushWhacker/CWX-BushWhacker 1.2.4/bepInEx/plugins/CWX-BushWhacker.dll and /dev/null differ diff --git a/Live/CWX_BushWhacker/CWX-BushWhacker 1.2.5/bepInEx/plugins/CWX-BushWhacker.dll b/Live/CWX_BushWhacker/CWX-BushWhacker 1.2.5/bepInEx/plugins/CWX-BushWhacker.dll new file mode 100644 index 0000000..41030e4 Binary files /dev/null and b/Live/CWX_BushWhacker/CWX-BushWhacker 1.2.5/bepInEx/plugins/CWX-BushWhacker.dll differ diff --git a/Live/CWX_BushWhacker/CWX-BushWhacker 1.2.4/user/mods/CWX-BushWhacker 1.2.4/LICENSE.txt b/Live/CWX_BushWhacker/CWX-BushWhacker 1.2.5/user/mods/CWX-BushWhacker 1.2.5/LICENSE.txt similarity index 100% rename from Live/CWX_BushWhacker/CWX-BushWhacker 1.2.4/user/mods/CWX-BushWhacker 1.2.4/LICENSE.txt rename to Live/CWX_BushWhacker/CWX-BushWhacker 1.2.5/user/mods/CWX-BushWhacker 1.2.5/LICENSE.txt diff --git a/Live/CWX_BushWhacker/CWX-BushWhacker 1.2.4/user/mods/CWX-BushWhacker 1.2.4/package.json b/Live/CWX_BushWhacker/CWX-BushWhacker 1.2.5/user/mods/CWX-BushWhacker 1.2.5/package.json similarity index 95% rename from Live/CWX_BushWhacker/CWX-BushWhacker 1.2.4/user/mods/CWX-BushWhacker 1.2.4/package.json rename to Live/CWX_BushWhacker/CWX-BushWhacker 1.2.5/user/mods/CWX-BushWhacker 1.2.5/package.json index 51136cc..a86c439 100644 --- a/Live/CWX_BushWhacker/CWX-BushWhacker 1.2.4/user/mods/CWX-BushWhacker 1.2.4/package.json +++ b/Live/CWX_BushWhacker/CWX-BushWhacker 1.2.5/user/mods/CWX-BushWhacker 1.2.5/package.json @@ -1,10 +1,10 @@ { "name": "BushWhacker", "author": "CWX", - "version": "1.2.4", + "version": "1.2.5", "license": "NCSA", "main": "src/mod.js", - "akiVersion": "3.2.3", + "akiVersion": "3.2.4", "scripts": { "setup:environment": "npm i", "build:unzipped": "copyfiles -e \"./node_modules/**/*.*\" -e \"./dist/**/*.*\" -e \"./package-lock.json\" -e \"./tsconfig.json\" -e \"./README.txt\" -e \"./mod.code-workspace\" ./**/*.* ./dist", diff --git a/Live/CWX_BushWhacker/CWX-BushWhacker 1.2.4/user/mods/CWX-BushWhacker 1.2.4/src/mod.ts b/Live/CWX_BushWhacker/CWX-BushWhacker 1.2.5/user/mods/CWX-BushWhacker 1.2.5/src/mod.ts similarity index 100% rename from Live/CWX_BushWhacker/CWX-BushWhacker 1.2.4/user/mods/CWX-BushWhacker 1.2.4/src/mod.ts rename to Live/CWX_BushWhacker/CWX-BushWhacker 1.2.5/user/mods/CWX-BushWhacker 1.2.5/src/mod.ts diff --git a/Live/CWX_BushWhacker/CWX_BushWhacker.csproj b/Live/CWX_BushWhacker/CWX_BushWhacker.csproj index 3d095f3..5c74da9 100644 --- a/Live/CWX_BushWhacker/CWX_BushWhacker.csproj +++ b/Live/CWX_BushWhacker/CWX_BushWhacker.csproj @@ -3,39 +3,39 @@ net472 CWX-BushWhacker - 1.2.4 + 1.2.5 - ..\Shared\AKI\Aki.Common.dll + ..\..\..\Shared\Aki\Aki.Common.dll - ..\Shared\AKI\Aki.Reflection.dll + ..\..\..\Shared\Aki\Aki.Reflection.dll - ..\Shared\EFT\Assembly-CSharp.dll + ..\..\..\Shared\EFT\Assembly-CSharp.dll - ..\Shared\BepInEx\BepInEx.dll + ..\..\..\Shared\BepInEx\BepInEx.dll - ..\Shared\EFT\Comfort.dll + ..\..\..\Shared\EFT\Comfort.dll - ..\Shared\EFT\Newtonsoft.Json.dll + ..\..\..\Shared\EFT\Newtonsoft.Json.dll - ..\Shared\EFT\UnityEngine.dll + ..\..\..\Shared\EFT\UnityEngine.dll - ..\Shared\EFT\UnityEngine.AssetBundleModule.dll + ..\..\..\Shared\EFT\UnityEngine.AssetBundleModule.dll - ..\Shared\EFT\UnityEngine.CoreModule.dll + ..\..\..\Shared\EFT\UnityEngine.CoreModule.dll - ..\..\..\AKI-All\Modules\project\Shared\Managed\UnityEngine.PhysicsModule.dll + ..\..\..\Shared\EFT\UnityEngine.PhysicsModule.dll diff --git a/Live/CWX_DeSharpener/CWX-DeSharpener 1.4.4/bepInEx/plugins/CWX-DeSharpener.dll b/Live/CWX_DeSharpener/CWX-DeSharpener 1.4.4/bepInEx/plugins/CWX-DeSharpener.dll deleted file mode 100644 index da29c58..0000000 Binary files a/Live/CWX_DeSharpener/CWX-DeSharpener 1.4.4/bepInEx/plugins/CWX-DeSharpener.dll and /dev/null differ diff --git a/Live/CWX_DeSharpener/CWX-DeSharpener 1.4.5/bepInEx/plugins/CWX-DeSharpener.dll b/Live/CWX_DeSharpener/CWX-DeSharpener 1.4.5/bepInEx/plugins/CWX-DeSharpener.dll new file mode 100644 index 0000000..bff3a9d Binary files /dev/null and b/Live/CWX_DeSharpener/CWX-DeSharpener 1.4.5/bepInEx/plugins/CWX-DeSharpener.dll differ diff --git a/Live/CWX_DeSharpener/CWX-DeSharpener 1.4.4/user/mods/CWX-DeSharpener 1.4.4/LICENSE.txt b/Live/CWX_DeSharpener/CWX-DeSharpener 1.4.5/user/mods/CWX-DeSharpener 1.4.5/LICENSE.txt similarity index 100% rename from Live/CWX_DeSharpener/CWX-DeSharpener 1.4.4/user/mods/CWX-DeSharpener 1.4.4/LICENSE.txt rename to Live/CWX_DeSharpener/CWX-DeSharpener 1.4.5/user/mods/CWX-DeSharpener 1.4.5/LICENSE.txt diff --git a/Live/CWX_DeSharpener/CWX-DeSharpener 1.4.4/user/mods/CWX-DeSharpener 1.4.4/package.json b/Live/CWX_DeSharpener/CWX-DeSharpener 1.4.5/user/mods/CWX-DeSharpener 1.4.5/package.json similarity index 95% rename from Live/CWX_DeSharpener/CWX-DeSharpener 1.4.4/user/mods/CWX-DeSharpener 1.4.4/package.json rename to Live/CWX_DeSharpener/CWX-DeSharpener 1.4.5/user/mods/CWX-DeSharpener 1.4.5/package.json index 79e57da..476a947 100644 --- a/Live/CWX_DeSharpener/CWX-DeSharpener 1.4.4/user/mods/CWX-DeSharpener 1.4.4/package.json +++ b/Live/CWX_DeSharpener/CWX-DeSharpener 1.4.5/user/mods/CWX-DeSharpener 1.4.5/package.json @@ -1,10 +1,10 @@ { "name": "DeSharpener", "author": "CWX", - "version": "1.4.4", + "version": "1.4.5", "license": "NCSA", "main": "src/mod.js", - "akiVersion": "3.2.3", + "akiVersion": "3.2.4", "scripts": { "setup:environment": "npm i", "build:unzipped": "copyfiles -e \"./node_modules/**/*.*\" -e \"./dist/**/*.*\" -e \"./package-lock.json\" -e \"./tsconfig.json\" -e \"./README.txt\" -e \"./mod.code-workspace\" ./**/*.* ./dist", diff --git a/Live/CWX_DeSharpener/CWX-DeSharpener 1.4.4/user/mods/CWX-DeSharpener 1.4.4/src/mod.ts b/Live/CWX_DeSharpener/CWX-DeSharpener 1.4.5/user/mods/CWX-DeSharpener 1.4.5/src/mod.ts similarity index 100% rename from Live/CWX_DeSharpener/CWX-DeSharpener 1.4.4/user/mods/CWX-DeSharpener 1.4.4/src/mod.ts rename to Live/CWX_DeSharpener/CWX-DeSharpener 1.4.5/user/mods/CWX-DeSharpener 1.4.5/src/mod.ts diff --git a/Live/CWX_DeSharpener/CWX_DeSharpener.csproj b/Live/CWX_DeSharpener/CWX_DeSharpener.csproj index 3184092..37c0087 100644 --- a/Live/CWX_DeSharpener/CWX_DeSharpener.csproj +++ b/Live/CWX_DeSharpener/CWX_DeSharpener.csproj @@ -2,31 +2,28 @@ net472 - 1.4.4 - CWX-DeSharpener + 1.4.5 + CWX-DeSharpener - ..\Shared\AKI\Aki.Common.dll + ..\..\..\Shared\Aki\Aki.Common.dll - ..\Shared\AKI\Aki.Reflection.dll + ..\..\..\Shared\Aki\Aki.Reflection.dll - ..\Shared\EFT\Assembly-CSharp.dll + ..\..\..\Shared\EFT\Assembly-CSharp.dll - ..\Shared\BepInEx\BepInEx.dll - - - ..\Shared\BepInEx\ConfigurationManager.dll + ..\..\..\Shared\BepInEx\BepInEx.dll - ..\Shared\EFT\UnityEngine.dll + ..\..\..\Shared\EFT\UnityEngine.dll - ..\Shared\EFT\UnityEngine.CoreModule.dll + ..\..\..\Shared\EFT\UnityEngine.CoreModule.dll diff --git a/Live/CWX_DeSharpener/Program.cs b/Live/CWX_DeSharpener/DeSharpener.cs similarity index 51% rename from Live/CWX_DeSharpener/Program.cs rename to Live/CWX_DeSharpener/DeSharpener.cs index 6f8b64a..ab7ec51 100644 --- a/Live/CWX_DeSharpener/Program.cs +++ b/Live/CWX_DeSharpener/DeSharpener.cs @@ -1,14 +1,13 @@ using BepInEx; -using BepInEx.Configuration; -namespace DeSharpener +namespace CWX_DeSharpener { - [BepInPlugin("com.CWX.DeSharpener", "CWX-DeSharpener", "1.4.4")] - public class Plugin : BaseUnityPlugin + [BepInPlugin("com.CWX.DeSharpener", "CWX-DeSharpener", "1.4.5")] + public class DeSharpener : BaseUnityPlugin { private void Awake() { - new SharpenPatch().Enable(); + new DeSharpenerPatch().Enable(); } } } diff --git a/Live/CWX_DeSharpener/SharpenPatch.cs b/Live/CWX_DeSharpener/DeSharpenerPatch.cs similarity index 86% rename from Live/CWX_DeSharpener/SharpenPatch.cs rename to Live/CWX_DeSharpener/DeSharpenerPatch.cs index a973125..61f6752 100644 --- a/Live/CWX_DeSharpener/SharpenPatch.cs +++ b/Live/CWX_DeSharpener/DeSharpenerPatch.cs @@ -4,13 +4,13 @@ using Aki.Reflection.Patching; using Aki.Reflection.Utils; using System.Linq; -namespace DeSharpener +namespace CWX_DeSharpener { - public class SharpenPatch : ModulePatch + public class DeSharpenerPatch : ModulePatch { private static Type _targetType; - public SharpenPatch() + public DeSharpenerPatch() { _targetType = PatchConstants.EftTypes.Single(IsTargetType); } diff --git a/Live/CWX_DebugTool/config/config.json b/Live/CWX_DebugTool/config/config.json index d4ad390..ececeea 100644 --- a/Live/CWX_DebugTool/config/config.json +++ b/Live/CWX_DebugTool/config/config.json @@ -20,5 +20,12 @@ "changeShrapProps": true, "changeMaxAmmoForKS23": true, "removeDevFromBlacklist": true + }, + "airdropConfig": { + "enableAllTheTime": true, + "changeFlightHeight": true, + "changeStartTime": true, + "changePlaneVolume": true + } } \ No newline at end of file diff --git a/Live/CWX_DebugTool/dist/config/config.json b/Live/CWX_DebugTool/dist/config/config.json index d4ad390..ececeea 100644 --- a/Live/CWX_DebugTool/dist/config/config.json +++ b/Live/CWX_DebugTool/dist/config/config.json @@ -20,5 +20,12 @@ "changeShrapProps": true, "changeMaxAmmoForKS23": true, "removeDevFromBlacklist": true + }, + "airdropConfig": { + "enableAllTheTime": true, + "changeFlightHeight": true, + "changeStartTime": true, + "changePlaneVolume": true + } } \ No newline at end of file diff --git a/Live/CWX_DebugTool/dist/models/IConfig.ts b/Live/CWX_DebugTool/dist/models/IConfig.ts index 29dda5d..2cb6a28 100644 --- a/Live/CWX_DebugTool/dist/models/IConfig.ts +++ b/Live/CWX_DebugTool/dist/models/IConfig.ts @@ -1,40 +1,49 @@ -export interface IConfig +export interface ICwxConfig { showLogs: boolean - globalsConfig: globalsConfig - ragfairConfig: ragfairConfig - locationConfig: locationConfig - inraidConfig: inraidConfig - itemsConfig: itemsConfig + globalsConfig: GlobalsConfig + ragfairConfig: RagfairConfig + locationConfig: LocationConfig + inraidConfig: InraidConfig + itemsConfig: ItemsConfig + airdropConfig: AirdropConfig } -export interface globalsConfig +export interface GlobalsConfig { noFallDamage: boolean openFlea: boolean quickScav: boolean } -export interface ragfairConfig +export interface RagfairConfig { staticTrader: boolean roublesOnly: boolean disableBSGBlacklist: boolean } -export interface locationConfig +export interface LocationConfig { turnLootOff: boolean } -export interface inraidConfig +export interface InraidConfig { turnPVEOff: boolean } -export interface itemsConfig +export interface ItemsConfig { changeShrapProps: boolean changeMaxAmmoForKS23: boolean removeDevFromBlacklist: boolean +} + +export interface AirdropConfig +{ + enableAllTheTime: boolean + changeFlightHeight: boolean + changeStartTime: boolean + changePlaneVolume: boolean } \ No newline at end of file diff --git a/Live/CWX_DebugTool/dist/src/airdropConfig.ts b/Live/CWX_DebugTool/dist/src/airdropConfig.ts new file mode 100644 index 0000000..af7e225 --- /dev/null +++ b/Live/CWX_DebugTool/dist/src/airdropConfig.ts @@ -0,0 +1,70 @@ +import { ConfigTypes } from "@spt-aki/models/enums/ConfigTypes"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; + +import{ IAirdropConfig } from "@spt-aki/models/spt/config/IAirdropConfig" + +import { AirdropConfig } from "models/IConfig"; + +import { inject, injectable } from "tsyringe"; +import { CwxConfigHandler } from "./configHandler"; + +@injectable() +export class CwxAirdropConfig +{ + private tables: IAirdropConfig; + private config: AirdropConfig; + + constructor( + @inject("ConfigServer") private configServer: ConfigServer, + @inject("CwxConfigHandler") private configHandler: CwxConfigHandler + ) + {} + + public applyChanges(): void + { + this.config = this.configHandler.getConfig().airdropConfig; + this.tables = this.configServer.getConfig(ConfigTypes.AIRDROP); + + this.enableAllTheTime(); + this.changeFlightHeight(); + this.changeStartTime(); + this.changePlaneVolume(); + } + + private enableAllTheTime(): void + { + if (this.config.enableAllTheTime) + { + for (const i in this.tables.airdropChancePercent) + { + this.tables.airdropChancePercent[i] = 100; + } + } + } + + private changeFlightHeight(): void + { + if (this.config.changeFlightHeight) + { + this.tables.planeMinFlyHeight = 100; + this.tables.planeMaxFlyHeight = 110; + } + } + + private changeStartTime(): void + { + if (this.config.changeStartTime) + { + this.tables.airdropMinStartTimeSeconds = 10; + this.tables.airdropMaxStartTimeSeconds = 20; + } + } + + private changePlaneVolume(): void + { + if (this.config.changePlaneVolume) + { + this.tables.planeVolume = 0.1; + } + } +} \ No newline at end of file diff --git a/Live/CWX_DebugTool/dist/src/configHandler.ts b/Live/CWX_DebugTool/dist/src/configHandler.ts index 08492fe..76311d4 100644 --- a/Live/CWX_DebugTool/dist/src/configHandler.ts +++ b/Live/CWX_DebugTool/dist/src/configHandler.ts @@ -1,17 +1,17 @@ import { injectable } from "tsyringe"; -import { IConfig } from "../models/IConfig"; +import { ICwxConfig } from "../models/IConfig"; @injectable() -export class CWX_ConfigHandler +export class CwxConfigHandler { - private config: IConfig; + private config: ICwxConfig; constructor() { this.config = require("../config/config.json"); } - public getConfig(): IConfig + public getConfig(): ICwxConfig { return this.config; } diff --git a/Live/CWX_DebugTool/dist/src/globalsConfig.ts b/Live/CWX_DebugTool/dist/src/globalsConfig.ts index ab4f3ee..d2c4cd8 100644 --- a/Live/CWX_DebugTool/dist/src/globalsConfig.ts +++ b/Live/CWX_DebugTool/dist/src/globalsConfig.ts @@ -1,18 +1,19 @@ +import { IGlobals } from "@spt-aki/models/eft/common/IGlobals"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { globalsConfig } from "models/IConfig"; +import { GlobalsConfig } from "models/IConfig"; import { inject, injectable } from "tsyringe"; -import { CWX_ConfigHandler } from "./configHandler"; +import { CwxConfigHandler } from "./configHandler"; @injectable() -export class CWX_GlobalsConfig +export class CwxGlobalsConfig { - private tables; - private config: globalsConfig; + private tables: IGlobals; + private config: GlobalsConfig; constructor( @inject("DatabaseServer") private databaseServer: DatabaseServer, - @inject("CWX_ConfigHandler") private configHandler: CWX_ConfigHandler + @inject("CwxConfigHandler") private configHandler: CwxConfigHandler ) {} @@ -21,12 +22,12 @@ export class CWX_GlobalsConfig this.config = this.configHandler.getConfig().globalsConfig; this.tables = this.databaseServer.getTables().globals; - this.NoFallDamage(); - this.OpenFlea(); - this.QuickScav(); + this.noFallDamage(); + this.openFlea(); + this.quickScav(); } - private NoFallDamage(): void + private noFallDamage(): void { if (this.config.noFallDamage) { @@ -35,7 +36,7 @@ export class CWX_GlobalsConfig } } - private OpenFlea(): void + private openFlea(): void { if (this.config.openFlea) { @@ -43,7 +44,7 @@ export class CWX_GlobalsConfig } } - private QuickScav(): void + private quickScav(): void { if (this.config.quickScav) { diff --git a/Live/CWX_DebugTool/dist/src/inraidConfig.ts b/Live/CWX_DebugTool/dist/src/inraidConfig.ts index 903c387..c32960a 100644 --- a/Live/CWX_DebugTool/dist/src/inraidConfig.ts +++ b/Live/CWX_DebugTool/dist/src/inraidConfig.ts @@ -4,18 +4,18 @@ import { ConfigTypes } from "@spt-aki/models/enums/ConfigTypes"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { IInRaidConfig } from "@spt-aki/models/spt/config/IInRaidConfig"; -import { CWX_ConfigHandler } from "./configHandler"; -import { inraidConfig } from "models/IConfig"; +import { CwxConfigHandler } from "./configHandler"; +import { InraidConfig } from "models/IConfig"; @injectable() -export class CWX_InraidConfig +export class CwxInraidConfig { private tables: IInRaidConfig; - private config: inraidConfig; + private config: InraidConfig; constructor( @inject("ConfigServer") private configServer: ConfigServer, - @inject("CWX_ConfigHandler") private configHandler: CWX_ConfigHandler + @inject("CwxConfigHandler") private configHandler: CwxConfigHandler ) {} @@ -24,10 +24,10 @@ export class CWX_InraidConfig this.config = this.configHandler.getConfig().inraidConfig; this.tables = this.configServer.getConfig(ConfigTypes.IN_RAID); - this.TurnPVEOff(); + this.turnPVEOff(); } - private TurnPVEOff(): void + private turnPVEOff(): void { if (this.config.turnPVEOff) { diff --git a/Live/CWX_DebugTool/dist/src/itemsConfig.ts b/Live/CWX_DebugTool/dist/src/itemsConfig.ts index 5762e0d..812dc21 100644 --- a/Live/CWX_DebugTool/dist/src/itemsConfig.ts +++ b/Live/CWX_DebugTool/dist/src/itemsConfig.ts @@ -1,24 +1,24 @@ import { inject, injectable } from "tsyringe"; -import { CWX_ConfigHandler } from "./configHandler"; +import { CwxConfigHandler } from "./configHandler"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { IItemConfig } from "@spt-aki/models/spt/config/IItemConfig" -import { IConfig } from "models/IConfig"; +import { ItemsConfig } from "models/IConfig"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { ConfigTypes } from "@spt-aki/models/enums/ConfigTypes"; @injectable() -export class CWX_ItemsConfig +export class CwxItemsConfig { private tables: Record; - private config: IConfig; + private config: ItemsConfig; private itemConfig: IItemConfig; constructor( @inject("DatabaseServer") private databaseServer: DatabaseServer, @inject("ConfigServer") private configServer: ConfigServer, - @inject("CWX_ConfigHandler") private configHandler: CWX_ConfigHandler + @inject("CwxConfigHandler") private configHandler: CwxConfigHandler ) {} @@ -26,7 +26,7 @@ export class CWX_ItemsConfig { this.tables = this.databaseServer.getTables().templates.items; this.itemConfig = this.configServer.getConfig(ConfigTypes.ITEM); - this.config = this.configHandler.getConfig(); + this.config = this.configHandler.getConfig().itemsConfig; this.changeShrapProps(); this.changeMaxAmmoForKS23(); @@ -38,7 +38,7 @@ export class CWX_ItemsConfig { const shrap = this.tables["5e85a9a6eacf8c039e4e2ac1"]; - if (this.config.itemsConfig.changeShrapProps) + if (this.config.changeShrapProps) { shrap._props.Damage = 200; shrap._props.InitialSpeed = 1000; @@ -49,7 +49,7 @@ export class CWX_ItemsConfig { const ks23 = this.tables["5f647d9f8499b57dc40ddb93"]; - if (this.config.itemsConfig.changeMaxAmmoForKS23) + if (this.config.changeMaxAmmoForKS23) { ks23._props.Cartridges[0]._max_count = 30; } @@ -57,7 +57,7 @@ export class CWX_ItemsConfig private removeDevFromBlacklist(): void { - if (this.config.itemsConfig.removeDevFromBlacklist) + if (this.config.removeDevFromBlacklist) { this.itemConfig.blacklist.splice(this.itemConfig.blacklist.indexOf("58ac60eb86f77401897560ff")); } diff --git a/Live/CWX_DebugTool/dist/src/locationConfig.ts b/Live/CWX_DebugTool/dist/src/locationConfig.ts index dbfcaa6..a2932af 100644 --- a/Live/CWX_DebugTool/dist/src/locationConfig.ts +++ b/Live/CWX_DebugTool/dist/src/locationConfig.ts @@ -4,18 +4,18 @@ import { ConfigTypes } from "@spt-aki/models/enums/ConfigTypes"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { ILocationConfig } from "@spt-aki/models/spt/config/ILocationConfig"; -import { CWX_ConfigHandler } from "./configHandler"; -import { locationConfig } from "models/IConfig"; +import { CwxConfigHandler } from "./configHandler"; +import { LocationConfig } from "models/IConfig"; @injectable() -export class CWX_LocationConfig +export class CwxLocationConfig { private tables: ILocationConfig; - private config: locationConfig; + private config: LocationConfig; constructor( @inject("ConfigServer") private configServer: ConfigServer, - @inject("CWX_ConfigHandler") private configHandler: CWX_ConfigHandler + @inject("CwxConfigHandler") private configHandler: CwxConfigHandler ) {} @@ -24,10 +24,10 @@ export class CWX_LocationConfig this.config = this.configHandler.getConfig().locationConfig; this.tables = this.configServer.getConfig(ConfigTypes.LOCATION); - this.TurnLootOff(); + this.turnLootOff(); } - private TurnLootOff(): void + private turnLootOff(): void { if (this.config.turnLootOff) { diff --git a/Live/CWX_DebugTool/dist/src/logging.ts b/Live/CWX_DebugTool/dist/src/logging.ts index 441fae2..1e93ba9 100644 --- a/Live/CWX_DebugTool/dist/src/logging.ts +++ b/Live/CWX_DebugTool/dist/src/logging.ts @@ -1,47 +1,53 @@ import { SptLogger } from "@spt-aki/models/spt/logging/SptLogger"; -import { IConfig } from "models/IConfig"; +import { ICwxConfig } from "models/IConfig"; import { inject, injectable } from "tsyringe"; -import { CWX_ConfigHandler } from "./configHandler"; +import { CwxConfigHandler } from "./configHandler"; @injectable() -export class CWX_Logging +export class CwxLogging { - private config: IConfig; + private config: ICwxConfig; constructor( @inject("WinstonLogger") private logger: SptLogger, - @inject("CWX_ConfigHandler") private configHandler: CWX_ConfigHandler + @inject("CwxConfigHandler") private configHandler: CwxConfigHandler ) {} - public SendLogging(): void + public sendLogging(): void { this.config = this.configHandler.getConfig(); // globals - this.NoFallDamage(); - this.OpenFlea(); - this.QuickScav(); + this.noFallDamage(); + this.openFlea(); + this.quickScav(); // ragfair - this.StaticTrader(); - this.RoublesOnly(); - this.DisableBSGBlacklist(); + this.staticTrader(); + this.roublesOnly(); + this.disableBSGBlacklist(); // location - this.TurnLootOff(); + this.turnLootOff(); // inraid - this.TurnPVEOff(); + this.turnPVEOff(); // items this.changeShrapProps(); this.changeMaxAmmoForKS23(); this.removeDevFromBlacklist(); + // airdrops + this.enableAllTheTime(); + this.changeFlightHeight(); + this.changeStartTime(); + this.changePlaneVolume(); + } - private NoFallDamage(): void + private noFallDamage(): void { if (this.config.globalsConfig.noFallDamage) { @@ -49,7 +55,7 @@ export class CWX_Logging } } - private OpenFlea(): void + private openFlea(): void { if (this.config.globalsConfig.openFlea) { @@ -57,7 +63,7 @@ export class CWX_Logging } } - private QuickScav(): void + private quickScav(): void { if (this.config.globalsConfig.quickScav) { @@ -65,7 +71,7 @@ export class CWX_Logging } } - private StaticTrader(): void + private staticTrader(): void { if (this.config.ragfairConfig.staticTrader) { @@ -73,7 +79,7 @@ export class CWX_Logging } } - private RoublesOnly(): void + private roublesOnly(): void { if (this.config.ragfairConfig.roublesOnly) { @@ -81,7 +87,7 @@ export class CWX_Logging } } - private DisableBSGBlacklist(): void + private disableBSGBlacklist(): void { if (this.config.ragfairConfig.disableBSGBlacklist) { @@ -89,7 +95,7 @@ export class CWX_Logging } } - private TurnLootOff(): void + private turnLootOff(): void { if (this.config.locationConfig.turnLootOff) { @@ -97,7 +103,7 @@ export class CWX_Logging } } - private TurnPVEOff(): void + private turnPVEOff(): void { if (this.config.inraidConfig.turnPVEOff) { @@ -129,4 +135,35 @@ export class CWX_Logging } } + private enableAllTheTime(): void + { + if (this.config.airdropConfig.enableAllTheTime) + { + this.logger.info("Enable Airdrops All The Time Activated"); + } + } + + private changeFlightHeight(): void + { + if (this.config.airdropConfig.changeFlightHeight) + { + this.logger.info("Change Flight Height Activated"); + } + } + + private changeStartTime(): void + { + if (this.config.airdropConfig.changeStartTime) + { + this.logger.info("Change Start Time Activated"); + } + } + + private changePlaneVolume(): void + { + if (this.config.airdropConfig.changePlaneVolume) + { + this.logger.info("Change Plane Volume Activated"); + } + } } \ No newline at end of file diff --git a/Live/CWX_DebugTool/dist/src/mod.ts b/Live/CWX_DebugTool/dist/src/mod.ts index 774a88a..a565b22 100644 --- a/Live/CWX_DebugTool/dist/src/mod.ts +++ b/Live/CWX_DebugTool/dist/src/mod.ts @@ -1,37 +1,40 @@ import { DependencyContainer, Lifecycle } from "tsyringe"; import { IPostDBLoadMod } from "@spt-aki/models/external/IPostDBLoadMod"; -import { CWX_ConfigHandler } from "./configHandler"; -import { CWX_GlobalsConfig } from "./globalsConfig"; -import { CWX_Logging } from "./logging"; -import { CWX_RagfairConfig } from "./ragfairConfig"; -import { CWX_LocationConfig } from "./locationConfig"; -import { CWX_InraidConfig } from "./inraidConfig"; -import { CWX_ItemsConfig } from "./itemsConfig"; +import { CwxLogging } from "./logging"; +import { CwxConfigHandler } from "./configHandler"; +import { CwxGlobalsConfig } from "./globalsConfig"; +import { CwxRagfairConfig } from "./ragfairConfig"; +import { CwxLocationConfig } from "./locationConfig"; +import { CwxInraidConfig } from "./inraidConfig"; +import { CwxItemsConfig } from "./itemsConfig"; +import { CwxAirdropConfig } from "./airdropConfig"; class CWX_DebugTool implements IPostDBLoadMod { public postDBLoad(container: DependencyContainer): void { - container.register("CWX_ConfigHandler", CWX_ConfigHandler, {lifecycle:Lifecycle.Singleton}) - container.register("CWX_GlobalsConfig", CWX_GlobalsConfig); - container.register("CWX_RagfairConfig", CWX_RagfairConfig); - container.register("CWX_LocationConfig", CWX_LocationConfig); - container.register("CWX_InraidConfig", CWX_InraidConfig); - container.register("CWX_ItemsConfig", CWX_ItemsConfig); - container.register("CWX_Logging", CWX_Logging); + container.register("CwxConfigHandler", CwxConfigHandler, {lifecycle:Lifecycle.Singleton}) + container.register("CwxGlobalsConfig", CwxGlobalsConfig); + container.register("CwxRagfairConfig", CwxRagfairConfig); + container.register("CwxLocationConfig", CwxLocationConfig); + container.register("CwxInraidConfig", CwxInraidConfig); + container.register("CwxItemsConfig", CwxItemsConfig); + container.register("CwxAirdropConfig", CwxAirdropConfig); + container.register("CwxLogging", CwxLogging); - container.resolve("CWX_GlobalsConfig").applyChanges(); - container.resolve("CWX_RagfairConfig").applyChanges(); - container.resolve("CWX_LocationConfig").applyChanges(); - container.resolve("CWX_InraidConfig").applyChanges(); - container.resolve("CWX_ItemsConfig").applyChanges(); + container.resolve("CwxGlobalsConfig").applyChanges(); + container.resolve("CwxRagfairConfig").applyChanges(); + container.resolve("CwxLocationConfig").applyChanges(); + container.resolve("CwxInraidConfig").applyChanges(); + container.resolve("CwxItemsConfig").applyChanges(); + container.resolve("CwxAirdropConfig").applyChanges(); - if (container.resolve("CWX_ConfigHandler").getConfig().showLogs) + if (container.resolve("CwxConfigHandler").getConfig().showLogs) { - container.resolve("CWX_Logging").SendLogging(); + container.resolve("CwxLogging").sendLogging(); } } } diff --git a/Live/CWX_DebugTool/dist/src/ragfairConfig.ts b/Live/CWX_DebugTool/dist/src/ragfairConfig.ts index 819ecfb..a02a627 100644 --- a/Live/CWX_DebugTool/dist/src/ragfairConfig.ts +++ b/Live/CWX_DebugTool/dist/src/ragfairConfig.ts @@ -4,18 +4,18 @@ import { ConfigTypes } from "@spt-aki/models/enums/ConfigTypes"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; -import { CWX_ConfigHandler } from "./configHandler"; -import { ragfairConfig } from "models/IConfig"; +import { CwxConfigHandler } from "./configHandler"; +import { RagfairConfig } from "models/IConfig"; @injectable() -export class CWX_RagfairConfig +export class CwxRagfairConfig { private tables: IRagfairConfig; - private config: ragfairConfig; + private config: RagfairConfig; constructor( @inject("ConfigServer") private configServer: ConfigServer, - @inject("CWX_ConfigHandler") private configHandler: CWX_ConfigHandler + @inject("CwxConfigHandler") private configHandler: CwxConfigHandler ) {} @@ -24,12 +24,12 @@ export class CWX_RagfairConfig this.config = this.configHandler.getConfig().ragfairConfig; this.tables = this.configServer.getConfig(ConfigTypes.RAGFAIR); - this.StaticTrader(); - this.RoublesOnly(); - this.DisableBSGBlacklist(); + this.staticTrader(); + this.roublesOnly(); + this.disableBSGBlacklist(); } - private StaticTrader(): void + private staticTrader(): void { if (this.config.staticTrader) { @@ -37,7 +37,7 @@ export class CWX_RagfairConfig } } - private RoublesOnly(): void + private roublesOnly(): void { if (this.config.roublesOnly) { @@ -47,7 +47,7 @@ export class CWX_RagfairConfig } } - private DisableBSGBlacklist(): void + private disableBSGBlacklist(): void { if (this.config.disableBSGBlacklist) { diff --git a/Live/CWX_DebugTool/dist/types/ErrorHandler.d.ts b/Live/CWX_DebugTool/dist/types/ErrorHandler.d.ts new file mode 100644 index 0000000..69b0bcd --- /dev/null +++ b/Live/CWX_DebugTool/dist/types/ErrorHandler.d.ts @@ -0,0 +1,6 @@ +export declare class ErrorHandler { + private logger; + private readLine; + constructor(); + handleCriticalError(err: any): void; +} diff --git a/Live/CWX_DebugTool/dist/types/Program.d.ts b/Live/CWX_DebugTool/dist/types/Program.d.ts index d4b71b9..afe5216 100644 --- a/Live/CWX_DebugTool/dist/types/Program.d.ts +++ b/Live/CWX_DebugTool/dist/types/Program.d.ts @@ -1,4 +1,5 @@ export declare class Program { + private errorHandler; constructor(); start(): void; } diff --git a/Live/CWX_DebugTool/dist/types/callbacks/BundleCallbacks.d.ts b/Live/CWX_DebugTool/dist/types/callbacks/BundleCallbacks.d.ts index b28abe1..b7e1703 100644 --- a/Live/CWX_DebugTool/dist/types/callbacks/BundleCallbacks.d.ts +++ b/Live/CWX_DebugTool/dist/types/callbacks/BundleCallbacks.d.ts @@ -1,17 +1,17 @@ import { BundleLoader } from "../loaders/BundleLoader"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { HttpFileUtil } from "../utils/HttpFileUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; export declare class BundleCallbacks { protected logger: ILogger; protected httpResponse: HttpResponseUtil; - protected httpServer: IHttpServer; + protected httpFileUtil: HttpFileUtil; protected bundleLoader: BundleLoader; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpServer: IHttpServer, bundleLoader: BundleLoader, configServer: ConfigServer); + constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, bundleLoader: BundleLoader, configServer: ConfigServer); sendBundle(sessionID: string, req: any, resp: any, body: any): any; getBundles(url: string, info: any, sessionID: string): string; getBundle(url: string, info: any, sessionID: string): string; diff --git a/Live/CWX_DebugTool/dist/types/callbacks/HttpCallbacks.d.ts b/Live/CWX_DebugTool/dist/types/callbacks/HttpCallbacks.d.ts index 94c97bd..43928a1 100644 --- a/Live/CWX_DebugTool/dist/types/callbacks/HttpCallbacks.d.ts +++ b/Live/CWX_DebugTool/dist/types/callbacks/HttpCallbacks.d.ts @@ -1,8 +1,8 @@ import { OnLoad } from "../di/OnLoad"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; +import { HttpServer } from "../servers/HttpServer"; export declare class HttpCallbacks extends OnLoad { - protected httpServer: IHttpServer; - constructor(httpServer: IHttpServer); + protected httpServer: HttpServer; + constructor(httpServer: HttpServer); onLoad(): void; getRoute(): string; getImage(): string; diff --git a/Live/CWX_DebugTool/dist/types/callbacks/ModCallbacks.d.ts b/Live/CWX_DebugTool/dist/types/callbacks/ModCallbacks.d.ts index 58342dc..aec2f59 100644 --- a/Live/CWX_DebugTool/dist/types/callbacks/ModCallbacks.d.ts +++ b/Live/CWX_DebugTool/dist/types/callbacks/ModCallbacks.d.ts @@ -1,18 +1,18 @@ import { OnLoad } from "../di/OnLoad"; import { PostAkiModLoader } from "../loaders/PostAkiModLoader"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { HttpFileUtil } from "../utils/HttpFileUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; declare class ModCallbacks extends OnLoad { protected logger: ILogger; protected httpResponse: HttpResponseUtil; - protected httpServer: IHttpServer; + protected httpFileUtil: HttpFileUtil; protected postAkiModLoader: PostAkiModLoader; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpServer: IHttpServer, postAkiModLoader: PostAkiModLoader, configServer: ConfigServer); + constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, postAkiModLoader: PostAkiModLoader, configServer: ConfigServer); onLoad(): void; getRoute(): string; sendBundle(sessionID: string, req: any, resp: any, body: any): void; diff --git a/Live/CWX_DebugTool/dist/types/controllers/DialogueController.d.ts b/Live/CWX_DebugTool/dist/types/controllers/DialogueController.d.ts index b15c4b6..1b72522 100644 --- a/Live/CWX_DebugTool/dist/types/controllers/DialogueController.d.ts +++ b/Live/CWX_DebugTool/dist/types/controllers/DialogueController.d.ts @@ -2,24 +2,77 @@ import { DialogueHelper } from "../helpers/DialogueHelper"; import { IGetAllAttachmentsResponse } from "../models/eft/dialog/IGetAllAttachmentsResponse"; import { IGetFriendListDataResponse } from "../models/eft/dialog/IGetFriendListDataResponse"; import { IGetMailDialogViewResponseData } from "../models/eft/dialog/IGetMailDialogViewResponseData"; -import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { DialogueInfo, Message } from "../models/eft/profile/IAkiProfile"; import { SaveServer } from "../servers/SaveServer"; -import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +import { TimeUtil } from "../utils/TimeUtil"; export declare class DialogueController { - protected httpResponse: HttpResponseUtil; protected saveServer: SaveServer; + protected timeUtil: TimeUtil; protected dialogueHelper: DialogueHelper; - constructor(httpResponse: HttpResponseUtil, saveServer: SaveServer, dialogueHelper: DialogueHelper); + constructor(saveServer: SaveServer, timeUtil: TimeUtil, dialogueHelper: DialogueHelper); + update(): void; getFriendList(sessionID: string): IGetFriendListDataResponse; - generateDialogueList(sessionID: string): IGetBodyResponseData; + /** + * Create array holding trader dialogs and mail interactions with player + * Set the content of the dialogue on the list tab. + * @param sessionID Session Id + * @returns array of dialogs + */ + generateDialogueList(sessionID: string): DialogueInfo[]; + /** + * Get the content of a dialogue + * @param dialogueID Dialog id + * @param sessionID Session Id + * @returns + */ getDialogueInfo(dialogueID: string, sessionID: string): DialogueInfo; + /** + * Set the content of the dialogue on the details panel, showing all the messages + * for the specified dialogue. + * @param dialogueID Dialog id + * @param sessionID Session id + * @returns IGetMailDialogViewResponseData object + */ generateDialogueView(dialogueID: string, sessionID: string): IGetMailDialogViewResponseData; + /** + * Get a count of messages with attachments from a particular dialog + * @param sessionID Session id + * @param dialogueID Dialog id + * @returns Count of messages with attachments + */ + protected getUnreadMessagesWithAttachmentsCount(sessionID: string, dialogueID: string): number; + /** + * Does array have messages with uncollected rewards (includes expired rewards) + * @param messages Messages to check + * @returns true if uncollected rewards found + */ + protected messagesHaveUncollectedRewards(messages: Message[]): boolean; removeDialogue(dialogueID: string, sessionID: string): void; setDialoguePin(dialogueID: string, shouldPin: boolean, sessionID: string): void; setRead(dialogueIDs: string[], sessionID: string): void; + /** + * Get all uncollected items attached to mail in a particular dialog + * @param dialogueID Dialog to get mail attachments from + * @param sessionID Session id + * @returns + */ getAllAttachments(dialogueID: string, sessionID: string): IGetAllAttachmentsResponse; - protected messagesHaveUncollectedRewards(messages: Message[]): boolean; + /** + * Get messages from a specific dialog that have items not expired + * @param sessionId Session id + * @param dialogueId Dialog to get mail attachments from + * @returns Message array + */ + protected getActiveMessagesFromDialog(sessionId: string, dialogueId: string): Message[]; + /** + * Return array of messages with uncollected items (includes expired) + * @param messages Messages to parse + * @returns messages with items to collect + */ + protected getMessagesWithAttachments(messages: Message[]): Message[]; + /** + * Delete expired items. triggers when updating traders. + * @param sessionID Session id + */ protected removeExpiredItems(sessionID: string): void; - update(): void; } diff --git a/Live/CWX_DebugTool/dist/types/controllers/MatchController.d.ts b/Live/CWX_DebugTool/dist/types/controllers/MatchController.d.ts index 07f6a89..dac6a3f 100644 --- a/Live/CWX_DebugTool/dist/types/controllers/MatchController.d.ts +++ b/Live/CWX_DebugTool/dist/types/controllers/MatchController.d.ts @@ -9,6 +9,7 @@ import { IGetProfileRequestData } from "../models/eft/match/IGetProfileRequestDa import { IJoinMatchRequestData } from "../models/eft/match/IJoinMatchRequestData"; import { IJoinMatchResult } from "../models/eft/match/IJoinMatchResult"; import { IStartOfflineRaidRequestData } from "../models/eft/match/IStartOffineRaidRequestData"; +import { BotDifficulty } from "../models/enums/BotDifficulty"; import { IBotConfig } from "../models/spt/config/IBotConfig"; import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; import { IMatchConfig } from "../models/spt/config/IMatchConfig"; @@ -44,5 +45,11 @@ export declare class MatchController { protected getMatch(location: string): any; getGroupStatus(info: IGetGroupStatusRequestData): any; startOfflineRaid(info: IStartOfflineRaidRequestData, sessionID: string): void; + /** + * Convert a difficulty value from pre-raid screen to a bot difficulty + * @param botDifficulty dropdown difficulty + * @returns bot difficulty + */ + protected convertDifficultyDropdownIntoBotDifficulty(botDifficulty: BotDifficulty): string; endOfflineRaid(info: IEndOfflineRaidRequestData, sessionID: string): void; } diff --git a/Live/CWX_DebugTool/dist/types/controllers/RagfairController.d.ts b/Live/CWX_DebugTool/dist/types/controllers/RagfairController.d.ts index 06af740..fe1f472 100644 --- a/Live/CWX_DebugTool/dist/types/controllers/RagfairController.d.ts +++ b/Live/CWX_DebugTool/dist/types/controllers/RagfairController.d.ts @@ -12,6 +12,7 @@ import { RagfairTaxHelper } from "../helpers/RagfairTaxHelper"; import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { Item } from "../models/eft/common/tables/IItem"; +import { ITraderAssort } from "../models/eft/common/tables/ITrader"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { IAddOfferRequestData, Requirement } from "../models/eft/ragfair/IAddOfferRequestData"; @@ -65,6 +66,35 @@ export declare class RagfairController { protected ragfairConfig: IRagfairConfig; constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, itemEventRouter: ItemEventRouter, ragfairServer: RagfairServer, ragfairPriceService: RagfairPriceService, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer, ragfairSellHelper: RagfairSellHelper, ragfairTaxHelper: RagfairTaxHelper, ragfairSortHelper: RagfairSortHelper, ragfairOfferHelper: RagfairOfferHelper, profileHelper: ProfileHelper, paymentService: PaymentService, handbookHelper: HandbookHelper, paymentHelper: PaymentHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, ragfairOfferGenerator: RagfairOfferGenerator, configServer: ConfigServer); getOffers(sessionID: string, info: ISearchRequestData): IGetOffersResult; + /** + * Get offers for the client based on type of search being performed + * @param searchRequest Client search request data + * @param itemsToAdd + * @param assorts + * @param pmcProfile Player profile + * @returns array of offers + */ + protected getOffersForSearchType(searchRequest: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + /** + * Get categories for the type of search being performed, linked/required/all + * @param searchRequest Client search request data + * @param offers ragfair offers to get categories for + * @returns record with tpls + counts + */ + protected getSpecificCategories(searchRequest: ISearchRequestData, offers: IRagfairOffer[]): Record; + /** + * Add Required offers to offers result + * @param searchRequest Client search request data + * @param assorts + * @param pmcProfile Player profile + * @param result Result object being sent back to client + */ + protected addRequiredOffersToResult(searchRequest: ISearchRequestData, assorts: Record, pmcProfile: IPmcData, result: IGetOffersResult): void; + /** + * Add index to all offers passed in (0-indexed) + * @param offers Offers to add index value to + */ + protected addIndexValueToOffers(offers: IRagfairOffer[]): void; /** * Update a trader flea offer with buy restrictions stored in the traders assort * @param offer flea offer to update diff --git a/Live/CWX_DebugTool/dist/types/di/Container.d.ts b/Live/CWX_DebugTool/dist/types/di/Container.d.ts index 98d1fa1..e339a3b 100644 --- a/Live/CWX_DebugTool/dist/types/di/Container.d.ts +++ b/Live/CWX_DebugTool/dist/types/di/Container.d.ts @@ -3,6 +3,7 @@ import { DependencyContainer } from "tsyringe"; * Handle the registration of classes to be used by the Dependency Injection code */ export declare class Container { + static registerPostLoadTypes(container: DependencyContainer, childContainer: DependencyContainer): void; static registerTypes(depContainer: DependencyContainer): void; static registerListTypes(depContainer: DependencyContainer): void; private static registerUtils; diff --git a/Live/CWX_DebugTool/dist/types/di/Serializer.d.ts b/Live/CWX_DebugTool/dist/types/di/Serializer.d.ts index 70aa7c5..2617007 100644 --- a/Live/CWX_DebugTool/dist/types/di/Serializer.d.ts +++ b/Live/CWX_DebugTool/dist/types/di/Serializer.d.ts @@ -1,5 +1,6 @@ -import { IHttpServer } from "../models/spt/server/IHttpServer"; +/// +import { IncomingMessage, ServerResponse } from "http"; export declare class Serializer { - serialize(sessionID: string, req: any, resp: any, body: any, httpServer: IHttpServer): void; + serialize(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): void; canHandle(something: string): boolean; } diff --git a/Live/CWX_DebugTool/dist/types/generators/LootGenerator.d.ts b/Live/CWX_DebugTool/dist/types/generators/LootGenerator.d.ts index bbc1915..66056c2 100644 --- a/Live/CWX_DebugTool/dist/types/generators/LootGenerator.d.ts +++ b/Live/CWX_DebugTool/dist/types/generators/LootGenerator.d.ts @@ -48,11 +48,12 @@ export declare class LootGenerator { * Find a random item in items.json and add to result array * @param globalDefaultPresets presets to choose from * @param itemTypeCounts item limit counts + * @param itemBlacklist items to skip * @param result array to add found preset to * @returns true if preset was valid and added to pool */ protected findAndAddRandomPresetToLoot(globalDefaultPresets: [string, Preset][], itemTypeCounts: Record, result: LootItem[]): boolean; + }>, itemBlacklist: string[], result: LootItem[]): boolean; } diff --git a/Live/CWX_DebugTool/dist/types/generators/RagfairOfferGenerator.d.ts b/Live/CWX_DebugTool/dist/types/generators/RagfairOfferGenerator.d.ts index 317cd6b..0dc2d61 100644 --- a/Live/CWX_DebugTool/dist/types/generators/RagfairOfferGenerator.d.ts +++ b/Live/CWX_DebugTool/dist/types/generators/RagfairOfferGenerator.d.ts @@ -39,6 +39,13 @@ export declare class RagfairOfferGenerator { protected ragfairConfig: IRagfairConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, ragfairServerHelper: RagfairServerHelper, saveServer: SaveServer, presetHelper: PresetHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferService: RagfairOfferService, ragfairPriceService: RagfairPriceService, ragfairCategoriesService: RagfairCategoriesService, fenceService: FenceService, itemHelper: ItemHelper, configServer: ConfigServer); createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; + /** + * Convert a count of currency into roubles + * @param currencyCount amount of currency to convert into roubles + * @param currencyType Type of currency (euro/dollar/rouble) + * @returns count of roubles + */ + protected calculateRoublePrice(currencyCount: number, currencyType: string): number; protected getTraderId(userID: string): string; protected getRating(userID: string): number; /** diff --git a/Live/CWX_DebugTool/dist/types/helpers/BotHelper.d.ts b/Live/CWX_DebugTool/dist/types/helpers/BotHelper.d.ts index 18738e5..67a6384 100644 --- a/Live/CWX_DebugTool/dist/types/helpers/BotHelper.d.ts +++ b/Live/CWX_DebugTool/dist/types/helpers/BotHelper.d.ts @@ -33,6 +33,12 @@ export declare class BotHelper { * @returns Difficulty object */ getPmcDifficultySettings(type: string, difficulty: string): Difficulty; + /** + * Translate chosen value from pre-raid difficulty dropdown into bot difficulty value + * @param dropDownDifficulty Dropdown difficulty value to convert + * @returns bot difficulty + */ + convertBotDifficultyDropdownToBotDifficulty(dropDownDifficulty: string): string; /** * Choose a random difficulty from - easy/normal/hard/impossible * @returns random difficulty diff --git a/Live/CWX_DebugTool/dist/types/helpers/DialogueHelper.d.ts b/Live/CWX_DebugTool/dist/types/helpers/DialogueHelper.d.ts index e3e2bda..d2be04d 100644 --- a/Live/CWX_DebugTool/dist/types/helpers/DialogueHelper.d.ts +++ b/Live/CWX_DebugTool/dist/types/helpers/DialogueHelper.d.ts @@ -34,7 +34,8 @@ export declare class DialogueHelper { * Get the item contents for a particular message. * @param messageID * @param sessionID + * @param itemId Item being moved to inventory * @returns */ - getMessageItemContents(messageID: string, sessionID: string): Item[]; + getMessageItemContents(messageID: string, sessionID: string, itemId: string): Item[]; } diff --git a/Live/CWX_DebugTool/dist/types/helpers/NotificationSendHelper.d.ts b/Live/CWX_DebugTool/dist/types/helpers/NotificationSendHelper.d.ts index 34e62d9..6c56006 100644 --- a/Live/CWX_DebugTool/dist/types/helpers/NotificationSendHelper.d.ts +++ b/Live/CWX_DebugTool/dist/types/helpers/NotificationSendHelper.d.ts @@ -1,10 +1,10 @@ import { INotification } from "../models/eft/notifier/INotifier"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; +import { HttpServer } from "../servers/HttpServer"; import { NotificationService } from "../services/NotificationService"; export declare class NotificationSendHelper { - protected httpServer: IHttpServer; + protected httpServer: HttpServer; protected notificationService: NotificationService; - constructor(httpServer: IHttpServer, notificationService: NotificationService); + constructor(httpServer: HttpServer, notificationService: NotificationService); /** * Send notification message to the appropiate channel */ diff --git a/Live/CWX_DebugTool/dist/types/helpers/RagfairOfferHelper.d.ts b/Live/CWX_DebugTool/dist/types/helpers/RagfairOfferHelper.d.ts index e9d72ca..ea13aae 100644 --- a/Live/CWX_DebugTool/dist/types/helpers/RagfairOfferHelper.d.ts +++ b/Live/CWX_DebugTool/dist/types/helpers/RagfairOfferHelper.d.ts @@ -48,6 +48,12 @@ export declare class RagfairOfferHelper { constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, configServer: ConfigServer); getValidOffers(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; getOffersForBuild(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + /** + * Get an array of flea offers that are inaccessible to player due to their inadequate loyalty level + * @param offers Offers to check + * @param pmcProfile Players profile with trader loyalty levels + */ + protected getLoyaltyLockedOffers(offers: IRagfairOffer[], pmcProfile: IPmcData): string[]; processOffersOnProfile(sessionID: string): boolean; protected getProfileOffers(sessionID: string): IRagfairOffer[]; protected deleteOfferByOfferId(sessionID: string, offerId: string): void; diff --git a/Live/CWX_DebugTool/dist/types/helpers/RagfairSortHelper.d.ts b/Live/CWX_DebugTool/dist/types/helpers/RagfairSortHelper.d.ts index d20e10c..28d1d38 100644 --- a/Live/CWX_DebugTool/dist/types/helpers/RagfairSortHelper.d.ts +++ b/Live/CWX_DebugTool/dist/types/helpers/RagfairSortHelper.d.ts @@ -1,14 +1,28 @@ import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; +import { RagfairSort } from "../models/enums/RagfairSort"; import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; export declare class RagfairSortHelper { protected databaseServer: DatabaseServer; protected localeService: LocaleService; constructor(databaseServer: DatabaseServer, localeService: LocaleService); - sortOffers(offers: IRagfairOffer[], type: number, direction?: number): IRagfairOffer[]; + /** + * Sort a list of ragfair offers by something (id/rating/offer name/price/expirty time) + * @param offers Offers to sort + * @param type How to sort it + * @param direction Ascending/descending + * @returns Sorted offers + */ + sortOffers(offers: IRagfairOffer[], type: RagfairSort, direction?: number): IRagfairOffer[]; protected sortOffersByID(a: IRagfairOffer, b: IRagfairOffer): number; protected sortOffersByRating(a: IRagfairOffer, b: IRagfairOffer): number; protected sortOffersByName(a: IRagfairOffer, b: IRagfairOffer): number; + /** + * Order two offers by price value + * @param a Offer a + * @param b Offer b + * @returns + */ protected sortOffersByPrice(a: IRagfairOffer, b: IRagfairOffer): number; protected sortOffersByExpiry(a: IRagfairOffer, b: IRagfairOffer): number; } diff --git a/Live/CWX_DebugTool/dist/types/loaders/PreAkiModLoader.d.ts b/Live/CWX_DebugTool/dist/types/loaders/PreAkiModLoader.d.ts index 4ab1689..7a687a5 100644 --- a/Live/CWX_DebugTool/dist/types/loaders/PreAkiModLoader.d.ts +++ b/Live/CWX_DebugTool/dist/types/loaders/PreAkiModLoader.d.ts @@ -9,6 +9,9 @@ import { ModCompilerService } from "../services/ModCompilerService"; import { JsonUtil } from "../utils/JsonUtil"; import { VFS } from "../utils/VFS"; import { BundleLoader } from "./BundleLoader"; +import { IPostAkiLoadMod } from "../models/external/IPostAkiLoadMod"; +import { IPreAkiLoadMod } from "../models/external/IPreAkiLoadMod"; +import { IPostDBLoadMod } from "../models/external/IPostDBLoadMod"; export declare class PreAkiModLoader implements IModLoader { protected logger: ILogger; protected vfs: VFS; @@ -56,12 +59,26 @@ export declare class PreAkiModLoader implements IModLoader { */ protected getModsPackageData(mods: string[]): Record; /** - * Does mod have "delayedLoad(" string in its entry class - * @param modFolderName folder name - * @param modToValidate package.json details + * Use defined safe guard to check if the mod is a IPreAkiLoadMod * @returns boolean */ - protected isModSpt3XXCompatible(modFolderName: string, modToValidate: IPackageJsonData): boolean; + protected isPreAkiLoad(mod: any): mod is IPreAkiLoadMod; + /** + * Use defined safe guard to check if the mod is a IPostAkiLoadMod + * @returns boolean + */ + protected isPostAkiLoad(mod: any): mod is IPostAkiLoadMod; + /** + * Use defined safe guard to check if the mod is a IPostDBLoadMod + * @returns boolean + */ + protected isPostDBAkiLoad(mod: any): mod is IPostDBLoadMod; + /** + * Check that the mod is compatible with SPT 3.X.X + * @param mod the mod to check + * @returns boolean + */ + protected isModSpt3XXCompatible(mod: any): boolean; protected isModCombatibleWithAki(mod: IPackageJsonData): boolean; protected executeMods(container: DependencyContainer): void; sortModsLoadOrder(): string[]; diff --git a/Live/CWX_DebugTool/dist/types/models/eft/common/tables/IBotBase.d.ts b/Live/CWX_DebugTool/dist/types/models/eft/common/tables/IBotBase.d.ts index 25cb861..1c28ae0 100644 --- a/Live/CWX_DebugTool/dist/types/models/eft/common/tables/IBotBase.d.ts +++ b/Live/CWX_DebugTool/dist/types/models/eft/common/tables/IBotBase.d.ts @@ -341,6 +341,7 @@ export interface RagfairInfo { offers: IRagfairOffer[]; } export interface Bonus { + id?: string; type: string; templateId?: string; passive?: boolean; @@ -348,6 +349,8 @@ export interface Bonus { visible?: boolean; value?: number; icon?: string; + filter?: string[]; + skillType?: string; } export interface Note { Time: number; diff --git a/Live/CWX_DebugTool/dist/types/models/eft/ragfair/IRagfairOffer.d.ts b/Live/CWX_DebugTool/dist/types/models/eft/ragfair/IRagfairOffer.d.ts index 141b605..3251a37 100644 --- a/Live/CWX_DebugTool/dist/types/models/eft/ragfair/IRagfairOffer.d.ts +++ b/Live/CWX_DebugTool/dist/types/models/eft/ragfair/IRagfairOffer.d.ts @@ -9,6 +9,7 @@ export interface IRagfairOffer { intId: number; itemsCost: number; requirementsCost: number; + sptRequirementsCostRouble: number; startTime: number; endTime: number; sellInOnePiece: boolean; diff --git a/Live/CWX_DebugTool/dist/types/models/eft/ragfair/ISearchRequestData.d.ts b/Live/CWX_DebugTool/dist/types/models/eft/ragfair/ISearchRequestData.d.ts index 08e7fd3..56d093b 100644 --- a/Live/CWX_DebugTool/dist/types/models/eft/ragfair/ISearchRequestData.d.ts +++ b/Live/CWX_DebugTool/dist/types/models/eft/ragfair/ISearchRequestData.d.ts @@ -1,7 +1,8 @@ +import { RagfairSort } from "../../enums/RagfairSort"; export interface ISearchRequestData { page: number; limit: number; - sortType: number; + sortType: RagfairSort; sortDirection: number; currency: number; priceFrom: number; diff --git a/Live/CWX_DebugTool/dist/types/models/enums/RagfairSort.d.ts b/Live/CWX_DebugTool/dist/types/models/enums/RagfairSort.d.ts new file mode 100644 index 0000000..798a5e7 --- /dev/null +++ b/Live/CWX_DebugTool/dist/types/models/enums/RagfairSort.d.ts @@ -0,0 +1,7 @@ +export declare enum RagfairSort { + ID = 0, + RATING = 3, + OFFER_TITLE = 4, + PRICE = 5, + EXPIRY = 6 +} diff --git a/Live/CWX_DebugTool/dist/types/models/external/HttpFramework.d.ts b/Live/CWX_DebugTool/dist/types/models/external/HttpFramework.d.ts new file mode 100644 index 0000000..3b4a56a --- /dev/null +++ b/Live/CWX_DebugTool/dist/types/models/external/HttpFramework.d.ts @@ -0,0 +1,33 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; +export declare type HandleFn = (_: string, req: IncomingMessage, resp: ServerResponse) => void; +/** + * Associates handlers, HTTP methods and a base url to a listener using a proxy + * @param basePath The base path + * @returns The decorator that create the listener proxy + */ +export declare const Listen: (basePath: string) => any>(Base: T) => T; +/** + * HTTP DELETE decorator + */ +export declare const Delete: (path?: string) => (target: any, propertyKey: string) => void; +/** + * HTTP GET decorator + */ +export declare const Get: (path?: string) => (target: any, propertyKey: string) => void; +/** + * HTTP OPTIONS decorator + */ +export declare const Options: (path?: string) => (target: any, propertyKey: string) => void; +/** + * HTTP PATCH decorator + */ +export declare const Patch: (path?: string) => (target: any, propertyKey: string) => void; +/** + * HTTP POST decorator + */ +export declare const Post: (path?: string) => (target: any, propertyKey: string) => void; +/** + * HTTP PUT decorator + */ +export declare const Put: (path?: string) => (target: any, propertyKey: string) => void; diff --git a/Live/CWX_DebugTool/dist/types/models/spt/config/IHttpConfig.d.ts b/Live/CWX_DebugTool/dist/types/models/spt/config/IHttpConfig.d.ts index c41d035..3fe4787 100644 --- a/Live/CWX_DebugTool/dist/types/models/spt/config/IHttpConfig.d.ts +++ b/Live/CWX_DebugTool/dist/types/models/spt/config/IHttpConfig.d.ts @@ -1,5 +1,6 @@ import { IBaseConfig } from "./IBaseConfig"; export interface IHttpConfig extends IBaseConfig { + webSocketPingDelayMs: number; kind: "aki-http"; ip: string; port: number; diff --git a/Live/CWX_DebugTool/dist/types/routers/ImageRouter.d.ts b/Live/CWX_DebugTool/dist/types/routers/ImageRouter.d.ts index ab03977..675441c 100644 --- a/Live/CWX_DebugTool/dist/types/routers/ImageRouter.d.ts +++ b/Live/CWX_DebugTool/dist/types/routers/ImageRouter.d.ts @@ -1,13 +1,14 @@ /// import { IncomingMessage, ServerResponse } from "http"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; import { ImageRouteService } from "../services/mod/image/ImageRouteService"; +import { HttpFileUtil } from "../utils/HttpFileUtil"; import { VFS } from "../utils/VFS"; export declare class ImageRouter { protected vfs: VFS; protected imageRouteService: ImageRouteService; - constructor(vfs: VFS, imageRouteService: ImageRouteService); + protected httpFileUtil: HttpFileUtil; + constructor(vfs: VFS, imageRouteService: ImageRouteService, httpFileUtil: HttpFileUtil); addRoute(key: string, valueToAdd: string): void; - sendImage(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any, httpServer: IHttpServer): void; + sendImage(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): void; getImage(): string; } diff --git a/Live/CWX_DebugTool/dist/types/routers/serializers/BundleSerializer.d.ts b/Live/CWX_DebugTool/dist/types/routers/serializers/BundleSerializer.d.ts index 912db83..ca4d8b6 100644 --- a/Live/CWX_DebugTool/dist/types/routers/serializers/BundleSerializer.d.ts +++ b/Live/CWX_DebugTool/dist/types/routers/serializers/BundleSerializer.d.ts @@ -1,11 +1,14 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; import { Serializer } from "../../di/Serializer"; import { BundleLoader } from "../../loaders/BundleLoader"; -import { IHttpServer } from "../../models/spt/server/IHttpServer"; import { ILogger } from "../../models/spt/utils/ILogger"; +import { HttpFileUtil } from "../../utils/HttpFileUtil"; export declare class BundleSerializer extends Serializer { protected logger: ILogger; protected bundleLoader: BundleLoader; - constructor(logger: ILogger, bundleLoader: BundleLoader); - serialize(sessionID: string, req: any, resp: any, body: any, httpServer: IHttpServer): void; + protected httpFileUtil: HttpFileUtil; + constructor(logger: ILogger, bundleLoader: BundleLoader, httpFileUtil: HttpFileUtil); + serialize(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): void; canHandle(route: string): boolean; } diff --git a/Live/CWX_DebugTool/dist/types/routers/serializers/ImageSerializer.d.ts b/Live/CWX_DebugTool/dist/types/routers/serializers/ImageSerializer.d.ts index 0e040d4..7f15bcf 100644 --- a/Live/CWX_DebugTool/dist/types/routers/serializers/ImageSerializer.d.ts +++ b/Live/CWX_DebugTool/dist/types/routers/serializers/ImageSerializer.d.ts @@ -1,9 +1,10 @@ -import { IHttpServer } from "../../models/spt/server/IHttpServer"; +/// import { Serializer } from "../../di/Serializer"; import { ImageRouter } from "../ImageRouter"; +import { IncomingMessage, ServerResponse } from "http"; export declare class ImageSerializer extends Serializer { protected imageRouter: ImageRouter; constructor(imageRouter: ImageRouter); - serialize(sessionID: string, req: any, resp: any, body: any, httpServer: IHttpServer): void; + serialize(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): void; canHandle(route: string): boolean; } diff --git a/Live/CWX_DebugTool/dist/types/routers/serializers/NotifySerializer.d.ts b/Live/CWX_DebugTool/dist/types/routers/serializers/NotifySerializer.d.ts index 1779ac9..0d8cc89 100644 --- a/Live/CWX_DebugTool/dist/types/routers/serializers/NotifySerializer.d.ts +++ b/Live/CWX_DebugTool/dist/types/routers/serializers/NotifySerializer.d.ts @@ -1,11 +1,12 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; import { NotifierController } from "../../controllers/NotifierController"; import { Serializer } from "../../di/Serializer"; import { HttpServerHelper } from "../../helpers/HttpServerHelper"; -import { IHttpServer } from "../../models/spt/server/IHttpServer"; export declare class NotifySerializer extends Serializer { protected notifierController: NotifierController; protected httpServerHelper: HttpServerHelper; constructor(notifierController: NotifierController, httpServerHelper: HttpServerHelper); - serialize(_sessionID: string, req: any, resp: any, body: any, httpServer: IHttpServer): void; + serialize(_sessionID: string, req: IncomingMessage, resp: ServerResponse, _: any): void; canHandle(route: string): boolean; } diff --git a/Live/CWX_DebugTool/dist/types/servers/HttpServer.d.ts b/Live/CWX_DebugTool/dist/types/servers/HttpServer.d.ts index 44d802b..f572a8f 100644 --- a/Live/CWX_DebugTool/dist/types/servers/HttpServer.d.ts +++ b/Live/CWX_DebugTool/dist/types/servers/HttpServer.d.ts @@ -1,51 +1,34 @@ /// -/// -import http, { ServerResponse } from "http"; +import http, { IncomingMessage, ServerResponse } from "http"; +import WebSocket from "ws"; import { ApplicationContext } from "../context/ApplicationContext"; -import { Serializer } from "../di/Serializer"; import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { NotifierHelper } from "../helpers/NotifierHelper"; import { INotification } from "../models/eft/notifier/INotifier"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; import { ILogger } from "../models/spt/utils/ILogger"; -import { HttpRouter } from "../routers/HttpRouter"; -import { HttpResponseUtil } from "../utils/HttpResponseUtil"; -import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { ConfigServer } from "./ConfigServer"; import { DatabaseServer } from "./DatabaseServer"; -export declare class HttpServer implements IHttpServer { - protected httpRouter: HttpRouter; +import { IHttpListener } from "./http/IHttpListener"; +export declare class HttpServer { protected logger: ILogger; protected randomUtil: RandomUtil; - protected jsonUtil: JsonUtil; - protected httpResponse: HttpResponseUtil; protected databaseServer: DatabaseServer; protected notifierHelper: NotifierHelper; protected httpServerHelper: HttpServerHelper; - protected serializers: Serializer[]; + protected httpListeners: IHttpListener[]; protected configServer: ConfigServer; protected applicationContext: ApplicationContext; - constructor(httpRouter: HttpRouter, // TODO: delay required - logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, httpServerHelper: HttpServerHelper, serializers: Serializer[], configServer: ConfigServer, applicationContext: ApplicationContext); - protected buffers: {}; - protected onReceive: {}; - protected onRespond: {}; + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, httpServerHelper: HttpServerHelper, httpListeners: IHttpListener[], configServer: ConfigServer, applicationContext: ApplicationContext); protected httpConfig: IHttpConfig; protected webSockets: {}; protected websocketPingHandler: any; getCookies(req: http.IncomingMessage): any; - resetBuffer(sessionID: string): void; - putInBuffer(sessionID: any, data: any, bufLength: number): boolean; - getFromBuffer(sessionID: string): any; - sendZlibJson(resp: any, output: any, sessionID: string): void; sendMessage(sessionID: string, output: INotification): void; - sendFile(resp: ServerResponse, file: any): void; isConnectionWebSocket(sessionID: string): boolean; - sendResponse(sessionID: string, req: any, resp: any, body: Buffer): void; - handleRequest(req: http.IncomingMessage, resp: http.ServerResponse): void; + handleRequest(req: IncomingMessage, resp: ServerResponse): void; load(): void; protected getRandomisedMessage(): string; - wsOnConnection(ws: any, req: any): void; + protected wsOnConnection(ws: WebSocket.WebSocket, req: IncomingMessage): void; } diff --git a/Live/CWX_DebugTool/dist/types/servers/http/AkiHttpListener.d.ts b/Live/CWX_DebugTool/dist/types/servers/http/AkiHttpListener.d.ts new file mode 100644 index 0000000..6f78939 --- /dev/null +++ b/Live/CWX_DebugTool/dist/types/servers/http/AkiHttpListener.d.ts @@ -0,0 +1,26 @@ +/// +/// +import { IncomingMessage, ServerResponse } from "http"; +import { IHttpListener } from "./IHttpListener"; +import { Serializer } from "../../di/Serializer"; +import { ILogger } from "../../models/spt/utils/ILogger"; +import { HttpRouter } from "../../routers/HttpRouter"; +import { HttpResponseUtil } from "../../utils/HttpResponseUtil"; +import { JsonUtil } from "../../utils/JsonUtil"; +import { HttpBufferHandler } from "./HttpBufferHandler"; +export declare class AkiHttpListener implements IHttpListener { + protected httpRouter: HttpRouter; + protected serializers: Serializer[]; + protected logger: ILogger; + protected jsonUtil: JsonUtil; + protected httpResponse: HttpResponseUtil; + protected httpBufferHandler: HttpBufferHandler; + constructor(httpRouter: HttpRouter, // TODO: delay required + serializers: Serializer[], logger: ILogger, jsonUtil: JsonUtil, httpResponse: HttpResponseUtil, httpBufferHandler: HttpBufferHandler); + canHandle(_: string, req: IncomingMessage): boolean; + handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): void; + sendResponse(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: Buffer, output: string): void; + getResponse(sessionID: string, req: IncomingMessage, body: Buffer): string; + protected getBodyInfo(body: Buffer): string; + sendZlibJson(resp: ServerResponse, output: any, sessionID: string): void; +} diff --git a/Live/CWX_DebugTool/dist/types/servers/http/HttpBufferHandler.d.ts b/Live/CWX_DebugTool/dist/types/servers/http/HttpBufferHandler.d.ts new file mode 100644 index 0000000..fec4936 --- /dev/null +++ b/Live/CWX_DebugTool/dist/types/servers/http/HttpBufferHandler.d.ts @@ -0,0 +1,6 @@ +export declare class HttpBufferHandler { + protected buffers: {}; + resetBuffer(sessionID: string): void; + putInBuffer(sessionID: any, data: any, bufLength: number): boolean; + getFromBuffer(sessionID: string): any; +} diff --git a/Live/CWX_DebugTool/dist/types/servers/http/HttpMethods.d.ts b/Live/CWX_DebugTool/dist/types/servers/http/HttpMethods.d.ts new file mode 100644 index 0000000..96031e2 --- /dev/null +++ b/Live/CWX_DebugTool/dist/types/servers/http/HttpMethods.d.ts @@ -0,0 +1,8 @@ +export declare enum HttpMethods { + OPTIONS = "OPTIONS", + GET = "GET", + POST = "POST", + PUT = "PUT", + PATCH = "PATCH", + DELETE = "DELETE" +} diff --git a/Live/CWX_DebugTool/dist/types/servers/http/IHttpListener.d.ts b/Live/CWX_DebugTool/dist/types/servers/http/IHttpListener.d.ts new file mode 100644 index 0000000..758bb5a --- /dev/null +++ b/Live/CWX_DebugTool/dist/types/servers/http/IHttpListener.d.ts @@ -0,0 +1,6 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; +export interface IHttpListener { + canHandle(sessionId: string, req: IncomingMessage): boolean; + handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): void; +} diff --git a/Live/CWX_DebugTool/dist/types/services/BotGenerationCacheService.d.ts b/Live/CWX_DebugTool/dist/types/services/BotGenerationCacheService.d.ts index 670c583..ba53fec 100644 --- a/Live/CWX_DebugTool/dist/types/services/BotGenerationCacheService.d.ts +++ b/Live/CWX_DebugTool/dist/types/services/BotGenerationCacheService.d.ts @@ -35,9 +35,9 @@ export declare class BotGenerationCacheService { protected removeBotFromCache(indexOfBotToReturn: number): void; /** * Get index of bot profile that matches criteria - * @param role role of bot we want - * @param getPmc is requested bot a pmc - * @returns index of found bot + * @param role Role of bot wanted + * @param getPmc Requested bot a pmc + * @returns index of found bot, -1 if not found */ protected getIndexOfBotToReturn(role: string, getPmc: boolean): number; /** diff --git a/Live/CWX_DebugTool/dist/types/services/ProfileFixerService.d.ts b/Live/CWX_DebugTool/dist/types/services/ProfileFixerService.d.ts index 9cb5a38..e772919 100644 --- a/Live/CWX_DebugTool/dist/types/services/ProfileFixerService.d.ts +++ b/Live/CWX_DebugTool/dist/types/services/ProfileFixerService.d.ts @@ -1,6 +1,8 @@ +import { HideoutHelper } from "../helpers/HideoutHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; -import { HideoutSlot } from "../models/eft/common/tables/IBotBase"; +import { Bonus, HideoutSlot } from "../models/eft/common/tables/IBotBase"; import { IPmcDataRepeatableQuest, IRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; +import { StageBonus } from "../models/eft/hideout/IHideoutArea"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { HideoutAreas } from "../models/enums/HideoutAreas"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -9,8 +11,9 @@ import { Watermark } from "../utils/Watermark"; export declare class ProfileFixerService { protected logger: ILogger; protected watermark: Watermark; + protected hideoutHelper: HideoutHelper; protected databaseServer: DatabaseServer; - constructor(logger: ILogger, watermark: Watermark, databaseServer: DatabaseServer); + constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, databaseServer: DatabaseServer); /** * Find issues in the pmc profile data that may cause issues and fix them * @param pmcProfile profile to check and fix @@ -63,4 +66,21 @@ export declare class ProfileFixerService { */ protected updateProfilePocketsToNewId(pmcProfile: IPmcData): void; addMissingArmorRepairSkill(pmcProfile: IPmcData): void; + /** + * Iterate over players hideout areas and find what's build, look for missing bonuses those areas give and add them if missing + * @param pmcProfile Profile to update + */ + addMissingHideoutBonusesToProfile(pmcProfile: IPmcData): void; + /** + * + * @param profileBonuses bonuses from profile + * @param bonus bonus to find + * @returns matching bonus + */ + protected getBonusFromProfile(profileBonuses: Bonus[], bonus: StageBonus): Bonus; + /** + * Checks profile inventiory for items that do not exist inside the items db + * @param pmcProfile Profile to check inventory of + */ + checkForOrphanedModdedItems(pmcProfile: IPmcData): void; } diff --git a/Live/CWX_DebugTool/dist/types/services/mod/httpListener/HttpListenerMod.d.ts b/Live/CWX_DebugTool/dist/types/services/mod/httpListener/HttpListenerMod.d.ts new file mode 100644 index 0000000..2cdfbda --- /dev/null +++ b/Live/CWX_DebugTool/dist/types/services/mod/httpListener/HttpListenerMod.d.ts @@ -0,0 +1,10 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; +import { IHttpListener } from "../../../servers/http/IHttpListener"; +export declare class HttpListenerMod implements IHttpListener { + private canHandleOverride; + private handleOverride; + constructor(canHandleOverride: (sessionId: string, req: IncomingMessage) => boolean, handleOverride: (sessionId: string, req: IncomingMessage, resp: ServerResponse) => void); + canHandle(sessionId: string, req: IncomingMessage): boolean; + handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): void; +} diff --git a/Live/CWX_DebugTool/dist/types/services/mod/httpListener/HttpListenerModService.d.ts b/Live/CWX_DebugTool/dist/types/services/mod/httpListener/HttpListenerModService.d.ts new file mode 100644 index 0000000..9dd3473 --- /dev/null +++ b/Live/CWX_DebugTool/dist/types/services/mod/httpListener/HttpListenerModService.d.ts @@ -0,0 +1,8 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; +import { DependencyContainer } from "tsyringe"; +export declare class HttpListenerModService { + protected container: DependencyContainer; + constructor(container: DependencyContainer); + registerHttpListener(name: string, canHandleOverride: (sessionId: string, req: IncomingMessage) => boolean, handleOverride: (sessionId: string, req: IncomingMessage, resp: ServerResponse) => void): void; +} diff --git a/Live/CWX_DebugTool/dist/types/utils/HttpFileUtil.d.ts b/Live/CWX_DebugTool/dist/types/utils/HttpFileUtil.d.ts new file mode 100644 index 0000000..afc8409 --- /dev/null +++ b/Live/CWX_DebugTool/dist/types/utils/HttpFileUtil.d.ts @@ -0,0 +1,8 @@ +/// +import { ServerResponse } from "http"; +import { HttpServerHelper } from "../helpers/HttpServerHelper"; +export declare class HttpFileUtil { + protected httpServerHelper: HttpServerHelper; + constructor(httpServerHelper: HttpServerHelper); + sendFile(resp: ServerResponse, file: any): void; +} diff --git a/Live/CWX_DebugTool/models/IConfig.ts b/Live/CWX_DebugTool/models/IConfig.ts index 29dda5d..2cb6a28 100644 --- a/Live/CWX_DebugTool/models/IConfig.ts +++ b/Live/CWX_DebugTool/models/IConfig.ts @@ -1,40 +1,49 @@ -export interface IConfig +export interface ICwxConfig { showLogs: boolean - globalsConfig: globalsConfig - ragfairConfig: ragfairConfig - locationConfig: locationConfig - inraidConfig: inraidConfig - itemsConfig: itemsConfig + globalsConfig: GlobalsConfig + ragfairConfig: RagfairConfig + locationConfig: LocationConfig + inraidConfig: InraidConfig + itemsConfig: ItemsConfig + airdropConfig: AirdropConfig } -export interface globalsConfig +export interface GlobalsConfig { noFallDamage: boolean openFlea: boolean quickScav: boolean } -export interface ragfairConfig +export interface RagfairConfig { staticTrader: boolean roublesOnly: boolean disableBSGBlacklist: boolean } -export interface locationConfig +export interface LocationConfig { turnLootOff: boolean } -export interface inraidConfig +export interface InraidConfig { turnPVEOff: boolean } -export interface itemsConfig +export interface ItemsConfig { changeShrapProps: boolean changeMaxAmmoForKS23: boolean removeDevFromBlacklist: boolean +} + +export interface AirdropConfig +{ + enableAllTheTime: boolean + changeFlightHeight: boolean + changeStartTime: boolean + changePlaneVolume: boolean } \ No newline at end of file diff --git a/Live/CWX_DebugTool/src/airdropConfig.ts b/Live/CWX_DebugTool/src/airdropConfig.ts new file mode 100644 index 0000000..af7e225 --- /dev/null +++ b/Live/CWX_DebugTool/src/airdropConfig.ts @@ -0,0 +1,70 @@ +import { ConfigTypes } from "@spt-aki/models/enums/ConfigTypes"; +import { ConfigServer } from "@spt-aki/servers/ConfigServer"; + +import{ IAirdropConfig } from "@spt-aki/models/spt/config/IAirdropConfig" + +import { AirdropConfig } from "models/IConfig"; + +import { inject, injectable } from "tsyringe"; +import { CwxConfigHandler } from "./configHandler"; + +@injectable() +export class CwxAirdropConfig +{ + private tables: IAirdropConfig; + private config: AirdropConfig; + + constructor( + @inject("ConfigServer") private configServer: ConfigServer, + @inject("CwxConfigHandler") private configHandler: CwxConfigHandler + ) + {} + + public applyChanges(): void + { + this.config = this.configHandler.getConfig().airdropConfig; + this.tables = this.configServer.getConfig(ConfigTypes.AIRDROP); + + this.enableAllTheTime(); + this.changeFlightHeight(); + this.changeStartTime(); + this.changePlaneVolume(); + } + + private enableAllTheTime(): void + { + if (this.config.enableAllTheTime) + { + for (const i in this.tables.airdropChancePercent) + { + this.tables.airdropChancePercent[i] = 100; + } + } + } + + private changeFlightHeight(): void + { + if (this.config.changeFlightHeight) + { + this.tables.planeMinFlyHeight = 100; + this.tables.planeMaxFlyHeight = 110; + } + } + + private changeStartTime(): void + { + if (this.config.changeStartTime) + { + this.tables.airdropMinStartTimeSeconds = 10; + this.tables.airdropMaxStartTimeSeconds = 20; + } + } + + private changePlaneVolume(): void + { + if (this.config.changePlaneVolume) + { + this.tables.planeVolume = 0.1; + } + } +} \ No newline at end of file diff --git a/Live/CWX_DebugTool/src/configHandler.ts b/Live/CWX_DebugTool/src/configHandler.ts index 08492fe..76311d4 100644 --- a/Live/CWX_DebugTool/src/configHandler.ts +++ b/Live/CWX_DebugTool/src/configHandler.ts @@ -1,17 +1,17 @@ import { injectable } from "tsyringe"; -import { IConfig } from "../models/IConfig"; +import { ICwxConfig } from "../models/IConfig"; @injectable() -export class CWX_ConfigHandler +export class CwxConfigHandler { - private config: IConfig; + private config: ICwxConfig; constructor() { this.config = require("../config/config.json"); } - public getConfig(): IConfig + public getConfig(): ICwxConfig { return this.config; } diff --git a/Live/CWX_DebugTool/src/globalsConfig.ts b/Live/CWX_DebugTool/src/globalsConfig.ts index ab4f3ee..d2c4cd8 100644 --- a/Live/CWX_DebugTool/src/globalsConfig.ts +++ b/Live/CWX_DebugTool/src/globalsConfig.ts @@ -1,18 +1,19 @@ +import { IGlobals } from "@spt-aki/models/eft/common/IGlobals"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { globalsConfig } from "models/IConfig"; +import { GlobalsConfig } from "models/IConfig"; import { inject, injectable } from "tsyringe"; -import { CWX_ConfigHandler } from "./configHandler"; +import { CwxConfigHandler } from "./configHandler"; @injectable() -export class CWX_GlobalsConfig +export class CwxGlobalsConfig { - private tables; - private config: globalsConfig; + private tables: IGlobals; + private config: GlobalsConfig; constructor( @inject("DatabaseServer") private databaseServer: DatabaseServer, - @inject("CWX_ConfigHandler") private configHandler: CWX_ConfigHandler + @inject("CwxConfigHandler") private configHandler: CwxConfigHandler ) {} @@ -21,12 +22,12 @@ export class CWX_GlobalsConfig this.config = this.configHandler.getConfig().globalsConfig; this.tables = this.databaseServer.getTables().globals; - this.NoFallDamage(); - this.OpenFlea(); - this.QuickScav(); + this.noFallDamage(); + this.openFlea(); + this.quickScav(); } - private NoFallDamage(): void + private noFallDamage(): void { if (this.config.noFallDamage) { @@ -35,7 +36,7 @@ export class CWX_GlobalsConfig } } - private OpenFlea(): void + private openFlea(): void { if (this.config.openFlea) { @@ -43,7 +44,7 @@ export class CWX_GlobalsConfig } } - private QuickScav(): void + private quickScav(): void { if (this.config.quickScav) { diff --git a/Live/CWX_DebugTool/src/inraidConfig.ts b/Live/CWX_DebugTool/src/inraidConfig.ts index 903c387..c32960a 100644 --- a/Live/CWX_DebugTool/src/inraidConfig.ts +++ b/Live/CWX_DebugTool/src/inraidConfig.ts @@ -4,18 +4,18 @@ import { ConfigTypes } from "@spt-aki/models/enums/ConfigTypes"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { IInRaidConfig } from "@spt-aki/models/spt/config/IInRaidConfig"; -import { CWX_ConfigHandler } from "./configHandler"; -import { inraidConfig } from "models/IConfig"; +import { CwxConfigHandler } from "./configHandler"; +import { InraidConfig } from "models/IConfig"; @injectable() -export class CWX_InraidConfig +export class CwxInraidConfig { private tables: IInRaidConfig; - private config: inraidConfig; + private config: InraidConfig; constructor( @inject("ConfigServer") private configServer: ConfigServer, - @inject("CWX_ConfigHandler") private configHandler: CWX_ConfigHandler + @inject("CwxConfigHandler") private configHandler: CwxConfigHandler ) {} @@ -24,10 +24,10 @@ export class CWX_InraidConfig this.config = this.configHandler.getConfig().inraidConfig; this.tables = this.configServer.getConfig(ConfigTypes.IN_RAID); - this.TurnPVEOff(); + this.turnPVEOff(); } - private TurnPVEOff(): void + private turnPVEOff(): void { if (this.config.turnPVEOff) { diff --git a/Live/CWX_DebugTool/src/itemsConfig.ts b/Live/CWX_DebugTool/src/itemsConfig.ts index 5762e0d..812dc21 100644 --- a/Live/CWX_DebugTool/src/itemsConfig.ts +++ b/Live/CWX_DebugTool/src/itemsConfig.ts @@ -1,24 +1,24 @@ import { inject, injectable } from "tsyringe"; -import { CWX_ConfigHandler } from "./configHandler"; +import { CwxConfigHandler } from "./configHandler"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { IItemConfig } from "@spt-aki/models/spt/config/IItemConfig" -import { IConfig } from "models/IConfig"; +import { ItemsConfig } from "models/IConfig"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { ConfigTypes } from "@spt-aki/models/enums/ConfigTypes"; @injectable() -export class CWX_ItemsConfig +export class CwxItemsConfig { private tables: Record; - private config: IConfig; + private config: ItemsConfig; private itemConfig: IItemConfig; constructor( @inject("DatabaseServer") private databaseServer: DatabaseServer, @inject("ConfigServer") private configServer: ConfigServer, - @inject("CWX_ConfigHandler") private configHandler: CWX_ConfigHandler + @inject("CwxConfigHandler") private configHandler: CwxConfigHandler ) {} @@ -26,7 +26,7 @@ export class CWX_ItemsConfig { this.tables = this.databaseServer.getTables().templates.items; this.itemConfig = this.configServer.getConfig(ConfigTypes.ITEM); - this.config = this.configHandler.getConfig(); + this.config = this.configHandler.getConfig().itemsConfig; this.changeShrapProps(); this.changeMaxAmmoForKS23(); @@ -38,7 +38,7 @@ export class CWX_ItemsConfig { const shrap = this.tables["5e85a9a6eacf8c039e4e2ac1"]; - if (this.config.itemsConfig.changeShrapProps) + if (this.config.changeShrapProps) { shrap._props.Damage = 200; shrap._props.InitialSpeed = 1000; @@ -49,7 +49,7 @@ export class CWX_ItemsConfig { const ks23 = this.tables["5f647d9f8499b57dc40ddb93"]; - if (this.config.itemsConfig.changeMaxAmmoForKS23) + if (this.config.changeMaxAmmoForKS23) { ks23._props.Cartridges[0]._max_count = 30; } @@ -57,7 +57,7 @@ export class CWX_ItemsConfig private removeDevFromBlacklist(): void { - if (this.config.itemsConfig.removeDevFromBlacklist) + if (this.config.removeDevFromBlacklist) { this.itemConfig.blacklist.splice(this.itemConfig.blacklist.indexOf("58ac60eb86f77401897560ff")); } diff --git a/Live/CWX_DebugTool/src/locationConfig.ts b/Live/CWX_DebugTool/src/locationConfig.ts index dbfcaa6..a2932af 100644 --- a/Live/CWX_DebugTool/src/locationConfig.ts +++ b/Live/CWX_DebugTool/src/locationConfig.ts @@ -4,18 +4,18 @@ import { ConfigTypes } from "@spt-aki/models/enums/ConfigTypes"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { ILocationConfig } from "@spt-aki/models/spt/config/ILocationConfig"; -import { CWX_ConfigHandler } from "./configHandler"; -import { locationConfig } from "models/IConfig"; +import { CwxConfigHandler } from "./configHandler"; +import { LocationConfig } from "models/IConfig"; @injectable() -export class CWX_LocationConfig +export class CwxLocationConfig { private tables: ILocationConfig; - private config: locationConfig; + private config: LocationConfig; constructor( @inject("ConfigServer") private configServer: ConfigServer, - @inject("CWX_ConfigHandler") private configHandler: CWX_ConfigHandler + @inject("CwxConfigHandler") private configHandler: CwxConfigHandler ) {} @@ -24,10 +24,10 @@ export class CWX_LocationConfig this.config = this.configHandler.getConfig().locationConfig; this.tables = this.configServer.getConfig(ConfigTypes.LOCATION); - this.TurnLootOff(); + this.turnLootOff(); } - private TurnLootOff(): void + private turnLootOff(): void { if (this.config.turnLootOff) { diff --git a/Live/CWX_DebugTool/src/logging.ts b/Live/CWX_DebugTool/src/logging.ts index 441fae2..1e93ba9 100644 --- a/Live/CWX_DebugTool/src/logging.ts +++ b/Live/CWX_DebugTool/src/logging.ts @@ -1,47 +1,53 @@ import { SptLogger } from "@spt-aki/models/spt/logging/SptLogger"; -import { IConfig } from "models/IConfig"; +import { ICwxConfig } from "models/IConfig"; import { inject, injectable } from "tsyringe"; -import { CWX_ConfigHandler } from "./configHandler"; +import { CwxConfigHandler } from "./configHandler"; @injectable() -export class CWX_Logging +export class CwxLogging { - private config: IConfig; + private config: ICwxConfig; constructor( @inject("WinstonLogger") private logger: SptLogger, - @inject("CWX_ConfigHandler") private configHandler: CWX_ConfigHandler + @inject("CwxConfigHandler") private configHandler: CwxConfigHandler ) {} - public SendLogging(): void + public sendLogging(): void { this.config = this.configHandler.getConfig(); // globals - this.NoFallDamage(); - this.OpenFlea(); - this.QuickScav(); + this.noFallDamage(); + this.openFlea(); + this.quickScav(); // ragfair - this.StaticTrader(); - this.RoublesOnly(); - this.DisableBSGBlacklist(); + this.staticTrader(); + this.roublesOnly(); + this.disableBSGBlacklist(); // location - this.TurnLootOff(); + this.turnLootOff(); // inraid - this.TurnPVEOff(); + this.turnPVEOff(); // items this.changeShrapProps(); this.changeMaxAmmoForKS23(); this.removeDevFromBlacklist(); + // airdrops + this.enableAllTheTime(); + this.changeFlightHeight(); + this.changeStartTime(); + this.changePlaneVolume(); + } - private NoFallDamage(): void + private noFallDamage(): void { if (this.config.globalsConfig.noFallDamage) { @@ -49,7 +55,7 @@ export class CWX_Logging } } - private OpenFlea(): void + private openFlea(): void { if (this.config.globalsConfig.openFlea) { @@ -57,7 +63,7 @@ export class CWX_Logging } } - private QuickScav(): void + private quickScav(): void { if (this.config.globalsConfig.quickScav) { @@ -65,7 +71,7 @@ export class CWX_Logging } } - private StaticTrader(): void + private staticTrader(): void { if (this.config.ragfairConfig.staticTrader) { @@ -73,7 +79,7 @@ export class CWX_Logging } } - private RoublesOnly(): void + private roublesOnly(): void { if (this.config.ragfairConfig.roublesOnly) { @@ -81,7 +87,7 @@ export class CWX_Logging } } - private DisableBSGBlacklist(): void + private disableBSGBlacklist(): void { if (this.config.ragfairConfig.disableBSGBlacklist) { @@ -89,7 +95,7 @@ export class CWX_Logging } } - private TurnLootOff(): void + private turnLootOff(): void { if (this.config.locationConfig.turnLootOff) { @@ -97,7 +103,7 @@ export class CWX_Logging } } - private TurnPVEOff(): void + private turnPVEOff(): void { if (this.config.inraidConfig.turnPVEOff) { @@ -129,4 +135,35 @@ export class CWX_Logging } } + private enableAllTheTime(): void + { + if (this.config.airdropConfig.enableAllTheTime) + { + this.logger.info("Enable Airdrops All The Time Activated"); + } + } + + private changeFlightHeight(): void + { + if (this.config.airdropConfig.changeFlightHeight) + { + this.logger.info("Change Flight Height Activated"); + } + } + + private changeStartTime(): void + { + if (this.config.airdropConfig.changeStartTime) + { + this.logger.info("Change Start Time Activated"); + } + } + + private changePlaneVolume(): void + { + if (this.config.airdropConfig.changePlaneVolume) + { + this.logger.info("Change Plane Volume Activated"); + } + } } \ No newline at end of file diff --git a/Live/CWX_DebugTool/src/mod.ts b/Live/CWX_DebugTool/src/mod.ts index 774a88a..a565b22 100644 --- a/Live/CWX_DebugTool/src/mod.ts +++ b/Live/CWX_DebugTool/src/mod.ts @@ -1,37 +1,40 @@ import { DependencyContainer, Lifecycle } from "tsyringe"; import { IPostDBLoadMod } from "@spt-aki/models/external/IPostDBLoadMod"; -import { CWX_ConfigHandler } from "./configHandler"; -import { CWX_GlobalsConfig } from "./globalsConfig"; -import { CWX_Logging } from "./logging"; -import { CWX_RagfairConfig } from "./ragfairConfig"; -import { CWX_LocationConfig } from "./locationConfig"; -import { CWX_InraidConfig } from "./inraidConfig"; -import { CWX_ItemsConfig } from "./itemsConfig"; +import { CwxLogging } from "./logging"; +import { CwxConfigHandler } from "./configHandler"; +import { CwxGlobalsConfig } from "./globalsConfig"; +import { CwxRagfairConfig } from "./ragfairConfig"; +import { CwxLocationConfig } from "./locationConfig"; +import { CwxInraidConfig } from "./inraidConfig"; +import { CwxItemsConfig } from "./itemsConfig"; +import { CwxAirdropConfig } from "./airdropConfig"; class CWX_DebugTool implements IPostDBLoadMod { public postDBLoad(container: DependencyContainer): void { - container.register("CWX_ConfigHandler", CWX_ConfigHandler, {lifecycle:Lifecycle.Singleton}) - container.register("CWX_GlobalsConfig", CWX_GlobalsConfig); - container.register("CWX_RagfairConfig", CWX_RagfairConfig); - container.register("CWX_LocationConfig", CWX_LocationConfig); - container.register("CWX_InraidConfig", CWX_InraidConfig); - container.register("CWX_ItemsConfig", CWX_ItemsConfig); - container.register("CWX_Logging", CWX_Logging); + container.register("CwxConfigHandler", CwxConfigHandler, {lifecycle:Lifecycle.Singleton}) + container.register("CwxGlobalsConfig", CwxGlobalsConfig); + container.register("CwxRagfairConfig", CwxRagfairConfig); + container.register("CwxLocationConfig", CwxLocationConfig); + container.register("CwxInraidConfig", CwxInraidConfig); + container.register("CwxItemsConfig", CwxItemsConfig); + container.register("CwxAirdropConfig", CwxAirdropConfig); + container.register("CwxLogging", CwxLogging); - container.resolve("CWX_GlobalsConfig").applyChanges(); - container.resolve("CWX_RagfairConfig").applyChanges(); - container.resolve("CWX_LocationConfig").applyChanges(); - container.resolve("CWX_InraidConfig").applyChanges(); - container.resolve("CWX_ItemsConfig").applyChanges(); + container.resolve("CwxGlobalsConfig").applyChanges(); + container.resolve("CwxRagfairConfig").applyChanges(); + container.resolve("CwxLocationConfig").applyChanges(); + container.resolve("CwxInraidConfig").applyChanges(); + container.resolve("CwxItemsConfig").applyChanges(); + container.resolve("CwxAirdropConfig").applyChanges(); - if (container.resolve("CWX_ConfigHandler").getConfig().showLogs) + if (container.resolve("CwxConfigHandler").getConfig().showLogs) { - container.resolve("CWX_Logging").SendLogging(); + container.resolve("CwxLogging").sendLogging(); } } } diff --git a/Live/CWX_DebugTool/src/ragfairConfig.ts b/Live/CWX_DebugTool/src/ragfairConfig.ts index 819ecfb..a02a627 100644 --- a/Live/CWX_DebugTool/src/ragfairConfig.ts +++ b/Live/CWX_DebugTool/src/ragfairConfig.ts @@ -4,18 +4,18 @@ import { ConfigTypes } from "@spt-aki/models/enums/ConfigTypes"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; -import { CWX_ConfigHandler } from "./configHandler"; -import { ragfairConfig } from "models/IConfig"; +import { CwxConfigHandler } from "./configHandler"; +import { RagfairConfig } from "models/IConfig"; @injectable() -export class CWX_RagfairConfig +export class CwxRagfairConfig { private tables: IRagfairConfig; - private config: ragfairConfig; + private config: RagfairConfig; constructor( @inject("ConfigServer") private configServer: ConfigServer, - @inject("CWX_ConfigHandler") private configHandler: CWX_ConfigHandler + @inject("CwxConfigHandler") private configHandler: CwxConfigHandler ) {} @@ -24,12 +24,12 @@ export class CWX_RagfairConfig this.config = this.configHandler.getConfig().ragfairConfig; this.tables = this.configServer.getConfig(ConfigTypes.RAGFAIR); - this.StaticTrader(); - this.RoublesOnly(); - this.DisableBSGBlacklist(); + this.staticTrader(); + this.roublesOnly(); + this.disableBSGBlacklist(); } - private StaticTrader(): void + private staticTrader(): void { if (this.config.staticTrader) { @@ -37,7 +37,7 @@ export class CWX_RagfairConfig } } - private RoublesOnly(): void + private roublesOnly(): void { if (this.config.roublesOnly) { @@ -47,7 +47,7 @@ export class CWX_RagfairConfig } } - private DisableBSGBlacklist(): void + private disableBSGBlacklist(): void { if (this.config.disableBSGBlacklist) { diff --git a/Live/CWX_DebugTool/types/ErrorHandler.d.ts b/Live/CWX_DebugTool/types/ErrorHandler.d.ts new file mode 100644 index 0000000..69b0bcd --- /dev/null +++ b/Live/CWX_DebugTool/types/ErrorHandler.d.ts @@ -0,0 +1,6 @@ +export declare class ErrorHandler { + private logger; + private readLine; + constructor(); + handleCriticalError(err: any): void; +} diff --git a/Live/CWX_DebugTool/types/Program.d.ts b/Live/CWX_DebugTool/types/Program.d.ts index d4b71b9..afe5216 100644 --- a/Live/CWX_DebugTool/types/Program.d.ts +++ b/Live/CWX_DebugTool/types/Program.d.ts @@ -1,4 +1,5 @@ export declare class Program { + private errorHandler; constructor(); start(): void; } diff --git a/Live/CWX_DebugTool/types/callbacks/BundleCallbacks.d.ts b/Live/CWX_DebugTool/types/callbacks/BundleCallbacks.d.ts index b28abe1..b7e1703 100644 --- a/Live/CWX_DebugTool/types/callbacks/BundleCallbacks.d.ts +++ b/Live/CWX_DebugTool/types/callbacks/BundleCallbacks.d.ts @@ -1,17 +1,17 @@ import { BundleLoader } from "../loaders/BundleLoader"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { HttpFileUtil } from "../utils/HttpFileUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; export declare class BundleCallbacks { protected logger: ILogger; protected httpResponse: HttpResponseUtil; - protected httpServer: IHttpServer; + protected httpFileUtil: HttpFileUtil; protected bundleLoader: BundleLoader; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpServer: IHttpServer, bundleLoader: BundleLoader, configServer: ConfigServer); + constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, bundleLoader: BundleLoader, configServer: ConfigServer); sendBundle(sessionID: string, req: any, resp: any, body: any): any; getBundles(url: string, info: any, sessionID: string): string; getBundle(url: string, info: any, sessionID: string): string; diff --git a/Live/CWX_DebugTool/types/callbacks/HttpCallbacks.d.ts b/Live/CWX_DebugTool/types/callbacks/HttpCallbacks.d.ts index 94c97bd..43928a1 100644 --- a/Live/CWX_DebugTool/types/callbacks/HttpCallbacks.d.ts +++ b/Live/CWX_DebugTool/types/callbacks/HttpCallbacks.d.ts @@ -1,8 +1,8 @@ import { OnLoad } from "../di/OnLoad"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; +import { HttpServer } from "../servers/HttpServer"; export declare class HttpCallbacks extends OnLoad { - protected httpServer: IHttpServer; - constructor(httpServer: IHttpServer); + protected httpServer: HttpServer; + constructor(httpServer: HttpServer); onLoad(): void; getRoute(): string; getImage(): string; diff --git a/Live/CWX_DebugTool/types/callbacks/ModCallbacks.d.ts b/Live/CWX_DebugTool/types/callbacks/ModCallbacks.d.ts index 58342dc..aec2f59 100644 --- a/Live/CWX_DebugTool/types/callbacks/ModCallbacks.d.ts +++ b/Live/CWX_DebugTool/types/callbacks/ModCallbacks.d.ts @@ -1,18 +1,18 @@ import { OnLoad } from "../di/OnLoad"; import { PostAkiModLoader } from "../loaders/PostAkiModLoader"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { HttpFileUtil } from "../utils/HttpFileUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; declare class ModCallbacks extends OnLoad { protected logger: ILogger; protected httpResponse: HttpResponseUtil; - protected httpServer: IHttpServer; + protected httpFileUtil: HttpFileUtil; protected postAkiModLoader: PostAkiModLoader; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpServer: IHttpServer, postAkiModLoader: PostAkiModLoader, configServer: ConfigServer); + constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, postAkiModLoader: PostAkiModLoader, configServer: ConfigServer); onLoad(): void; getRoute(): string; sendBundle(sessionID: string, req: any, resp: any, body: any): void; diff --git a/Live/CWX_DebugTool/types/controllers/DialogueController.d.ts b/Live/CWX_DebugTool/types/controllers/DialogueController.d.ts index b15c4b6..1b72522 100644 --- a/Live/CWX_DebugTool/types/controllers/DialogueController.d.ts +++ b/Live/CWX_DebugTool/types/controllers/DialogueController.d.ts @@ -2,24 +2,77 @@ import { DialogueHelper } from "../helpers/DialogueHelper"; import { IGetAllAttachmentsResponse } from "../models/eft/dialog/IGetAllAttachmentsResponse"; import { IGetFriendListDataResponse } from "../models/eft/dialog/IGetFriendListDataResponse"; import { IGetMailDialogViewResponseData } from "../models/eft/dialog/IGetMailDialogViewResponseData"; -import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { DialogueInfo, Message } from "../models/eft/profile/IAkiProfile"; import { SaveServer } from "../servers/SaveServer"; -import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +import { TimeUtil } from "../utils/TimeUtil"; export declare class DialogueController { - protected httpResponse: HttpResponseUtil; protected saveServer: SaveServer; + protected timeUtil: TimeUtil; protected dialogueHelper: DialogueHelper; - constructor(httpResponse: HttpResponseUtil, saveServer: SaveServer, dialogueHelper: DialogueHelper); + constructor(saveServer: SaveServer, timeUtil: TimeUtil, dialogueHelper: DialogueHelper); + update(): void; getFriendList(sessionID: string): IGetFriendListDataResponse; - generateDialogueList(sessionID: string): IGetBodyResponseData; + /** + * Create array holding trader dialogs and mail interactions with player + * Set the content of the dialogue on the list tab. + * @param sessionID Session Id + * @returns array of dialogs + */ + generateDialogueList(sessionID: string): DialogueInfo[]; + /** + * Get the content of a dialogue + * @param dialogueID Dialog id + * @param sessionID Session Id + * @returns + */ getDialogueInfo(dialogueID: string, sessionID: string): DialogueInfo; + /** + * Set the content of the dialogue on the details panel, showing all the messages + * for the specified dialogue. + * @param dialogueID Dialog id + * @param sessionID Session id + * @returns IGetMailDialogViewResponseData object + */ generateDialogueView(dialogueID: string, sessionID: string): IGetMailDialogViewResponseData; + /** + * Get a count of messages with attachments from a particular dialog + * @param sessionID Session id + * @param dialogueID Dialog id + * @returns Count of messages with attachments + */ + protected getUnreadMessagesWithAttachmentsCount(sessionID: string, dialogueID: string): number; + /** + * Does array have messages with uncollected rewards (includes expired rewards) + * @param messages Messages to check + * @returns true if uncollected rewards found + */ + protected messagesHaveUncollectedRewards(messages: Message[]): boolean; removeDialogue(dialogueID: string, sessionID: string): void; setDialoguePin(dialogueID: string, shouldPin: boolean, sessionID: string): void; setRead(dialogueIDs: string[], sessionID: string): void; + /** + * Get all uncollected items attached to mail in a particular dialog + * @param dialogueID Dialog to get mail attachments from + * @param sessionID Session id + * @returns + */ getAllAttachments(dialogueID: string, sessionID: string): IGetAllAttachmentsResponse; - protected messagesHaveUncollectedRewards(messages: Message[]): boolean; + /** + * Get messages from a specific dialog that have items not expired + * @param sessionId Session id + * @param dialogueId Dialog to get mail attachments from + * @returns Message array + */ + protected getActiveMessagesFromDialog(sessionId: string, dialogueId: string): Message[]; + /** + * Return array of messages with uncollected items (includes expired) + * @param messages Messages to parse + * @returns messages with items to collect + */ + protected getMessagesWithAttachments(messages: Message[]): Message[]; + /** + * Delete expired items. triggers when updating traders. + * @param sessionID Session id + */ protected removeExpiredItems(sessionID: string): void; - update(): void; } diff --git a/Live/CWX_DebugTool/types/controllers/MatchController.d.ts b/Live/CWX_DebugTool/types/controllers/MatchController.d.ts index 07f6a89..dac6a3f 100644 --- a/Live/CWX_DebugTool/types/controllers/MatchController.d.ts +++ b/Live/CWX_DebugTool/types/controllers/MatchController.d.ts @@ -9,6 +9,7 @@ import { IGetProfileRequestData } from "../models/eft/match/IGetProfileRequestDa import { IJoinMatchRequestData } from "../models/eft/match/IJoinMatchRequestData"; import { IJoinMatchResult } from "../models/eft/match/IJoinMatchResult"; import { IStartOfflineRaidRequestData } from "../models/eft/match/IStartOffineRaidRequestData"; +import { BotDifficulty } from "../models/enums/BotDifficulty"; import { IBotConfig } from "../models/spt/config/IBotConfig"; import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; import { IMatchConfig } from "../models/spt/config/IMatchConfig"; @@ -44,5 +45,11 @@ export declare class MatchController { protected getMatch(location: string): any; getGroupStatus(info: IGetGroupStatusRequestData): any; startOfflineRaid(info: IStartOfflineRaidRequestData, sessionID: string): void; + /** + * Convert a difficulty value from pre-raid screen to a bot difficulty + * @param botDifficulty dropdown difficulty + * @returns bot difficulty + */ + protected convertDifficultyDropdownIntoBotDifficulty(botDifficulty: BotDifficulty): string; endOfflineRaid(info: IEndOfflineRaidRequestData, sessionID: string): void; } diff --git a/Live/CWX_DebugTool/types/controllers/RagfairController.d.ts b/Live/CWX_DebugTool/types/controllers/RagfairController.d.ts index 06af740..fe1f472 100644 --- a/Live/CWX_DebugTool/types/controllers/RagfairController.d.ts +++ b/Live/CWX_DebugTool/types/controllers/RagfairController.d.ts @@ -12,6 +12,7 @@ import { RagfairTaxHelper } from "../helpers/RagfairTaxHelper"; import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { Item } from "../models/eft/common/tables/IItem"; +import { ITraderAssort } from "../models/eft/common/tables/ITrader"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { IAddOfferRequestData, Requirement } from "../models/eft/ragfair/IAddOfferRequestData"; @@ -65,6 +66,35 @@ export declare class RagfairController { protected ragfairConfig: IRagfairConfig; constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, itemEventRouter: ItemEventRouter, ragfairServer: RagfairServer, ragfairPriceService: RagfairPriceService, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer, ragfairSellHelper: RagfairSellHelper, ragfairTaxHelper: RagfairTaxHelper, ragfairSortHelper: RagfairSortHelper, ragfairOfferHelper: RagfairOfferHelper, profileHelper: ProfileHelper, paymentService: PaymentService, handbookHelper: HandbookHelper, paymentHelper: PaymentHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, ragfairOfferGenerator: RagfairOfferGenerator, configServer: ConfigServer); getOffers(sessionID: string, info: ISearchRequestData): IGetOffersResult; + /** + * Get offers for the client based on type of search being performed + * @param searchRequest Client search request data + * @param itemsToAdd + * @param assorts + * @param pmcProfile Player profile + * @returns array of offers + */ + protected getOffersForSearchType(searchRequest: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + /** + * Get categories for the type of search being performed, linked/required/all + * @param searchRequest Client search request data + * @param offers ragfair offers to get categories for + * @returns record with tpls + counts + */ + protected getSpecificCategories(searchRequest: ISearchRequestData, offers: IRagfairOffer[]): Record; + /** + * Add Required offers to offers result + * @param searchRequest Client search request data + * @param assorts + * @param pmcProfile Player profile + * @param result Result object being sent back to client + */ + protected addRequiredOffersToResult(searchRequest: ISearchRequestData, assorts: Record, pmcProfile: IPmcData, result: IGetOffersResult): void; + /** + * Add index to all offers passed in (0-indexed) + * @param offers Offers to add index value to + */ + protected addIndexValueToOffers(offers: IRagfairOffer[]): void; /** * Update a trader flea offer with buy restrictions stored in the traders assort * @param offer flea offer to update diff --git a/Live/CWX_DebugTool/types/di/Container.d.ts b/Live/CWX_DebugTool/types/di/Container.d.ts index 98d1fa1..e339a3b 100644 --- a/Live/CWX_DebugTool/types/di/Container.d.ts +++ b/Live/CWX_DebugTool/types/di/Container.d.ts @@ -3,6 +3,7 @@ import { DependencyContainer } from "tsyringe"; * Handle the registration of classes to be used by the Dependency Injection code */ export declare class Container { + static registerPostLoadTypes(container: DependencyContainer, childContainer: DependencyContainer): void; static registerTypes(depContainer: DependencyContainer): void; static registerListTypes(depContainer: DependencyContainer): void; private static registerUtils; diff --git a/Live/CWX_DebugTool/types/di/Serializer.d.ts b/Live/CWX_DebugTool/types/di/Serializer.d.ts index 70aa7c5..2617007 100644 --- a/Live/CWX_DebugTool/types/di/Serializer.d.ts +++ b/Live/CWX_DebugTool/types/di/Serializer.d.ts @@ -1,5 +1,6 @@ -import { IHttpServer } from "../models/spt/server/IHttpServer"; +/// +import { IncomingMessage, ServerResponse } from "http"; export declare class Serializer { - serialize(sessionID: string, req: any, resp: any, body: any, httpServer: IHttpServer): void; + serialize(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): void; canHandle(something: string): boolean; } diff --git a/Live/CWX_DebugTool/types/generators/LootGenerator.d.ts b/Live/CWX_DebugTool/types/generators/LootGenerator.d.ts index bbc1915..66056c2 100644 --- a/Live/CWX_DebugTool/types/generators/LootGenerator.d.ts +++ b/Live/CWX_DebugTool/types/generators/LootGenerator.d.ts @@ -48,11 +48,12 @@ export declare class LootGenerator { * Find a random item in items.json and add to result array * @param globalDefaultPresets presets to choose from * @param itemTypeCounts item limit counts + * @param itemBlacklist items to skip * @param result array to add found preset to * @returns true if preset was valid and added to pool */ protected findAndAddRandomPresetToLoot(globalDefaultPresets: [string, Preset][], itemTypeCounts: Record, result: LootItem[]): boolean; + }>, itemBlacklist: string[], result: LootItem[]): boolean; } diff --git a/Live/CWX_DebugTool/types/generators/RagfairOfferGenerator.d.ts b/Live/CWX_DebugTool/types/generators/RagfairOfferGenerator.d.ts index 317cd6b..0dc2d61 100644 --- a/Live/CWX_DebugTool/types/generators/RagfairOfferGenerator.d.ts +++ b/Live/CWX_DebugTool/types/generators/RagfairOfferGenerator.d.ts @@ -39,6 +39,13 @@ export declare class RagfairOfferGenerator { protected ragfairConfig: IRagfairConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, ragfairServerHelper: RagfairServerHelper, saveServer: SaveServer, presetHelper: PresetHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferService: RagfairOfferService, ragfairPriceService: RagfairPriceService, ragfairCategoriesService: RagfairCategoriesService, fenceService: FenceService, itemHelper: ItemHelper, configServer: ConfigServer); createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; + /** + * Convert a count of currency into roubles + * @param currencyCount amount of currency to convert into roubles + * @param currencyType Type of currency (euro/dollar/rouble) + * @returns count of roubles + */ + protected calculateRoublePrice(currencyCount: number, currencyType: string): number; protected getTraderId(userID: string): string; protected getRating(userID: string): number; /** diff --git a/Live/CWX_DebugTool/types/helpers/BotHelper.d.ts b/Live/CWX_DebugTool/types/helpers/BotHelper.d.ts index 18738e5..67a6384 100644 --- a/Live/CWX_DebugTool/types/helpers/BotHelper.d.ts +++ b/Live/CWX_DebugTool/types/helpers/BotHelper.d.ts @@ -33,6 +33,12 @@ export declare class BotHelper { * @returns Difficulty object */ getPmcDifficultySettings(type: string, difficulty: string): Difficulty; + /** + * Translate chosen value from pre-raid difficulty dropdown into bot difficulty value + * @param dropDownDifficulty Dropdown difficulty value to convert + * @returns bot difficulty + */ + convertBotDifficultyDropdownToBotDifficulty(dropDownDifficulty: string): string; /** * Choose a random difficulty from - easy/normal/hard/impossible * @returns random difficulty diff --git a/Live/CWX_DebugTool/types/helpers/DialogueHelper.d.ts b/Live/CWX_DebugTool/types/helpers/DialogueHelper.d.ts index e3e2bda..d2be04d 100644 --- a/Live/CWX_DebugTool/types/helpers/DialogueHelper.d.ts +++ b/Live/CWX_DebugTool/types/helpers/DialogueHelper.d.ts @@ -34,7 +34,8 @@ export declare class DialogueHelper { * Get the item contents for a particular message. * @param messageID * @param sessionID + * @param itemId Item being moved to inventory * @returns */ - getMessageItemContents(messageID: string, sessionID: string): Item[]; + getMessageItemContents(messageID: string, sessionID: string, itemId: string): Item[]; } diff --git a/Live/CWX_DebugTool/types/helpers/NotificationSendHelper.d.ts b/Live/CWX_DebugTool/types/helpers/NotificationSendHelper.d.ts index 34e62d9..6c56006 100644 --- a/Live/CWX_DebugTool/types/helpers/NotificationSendHelper.d.ts +++ b/Live/CWX_DebugTool/types/helpers/NotificationSendHelper.d.ts @@ -1,10 +1,10 @@ import { INotification } from "../models/eft/notifier/INotifier"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; +import { HttpServer } from "../servers/HttpServer"; import { NotificationService } from "../services/NotificationService"; export declare class NotificationSendHelper { - protected httpServer: IHttpServer; + protected httpServer: HttpServer; protected notificationService: NotificationService; - constructor(httpServer: IHttpServer, notificationService: NotificationService); + constructor(httpServer: HttpServer, notificationService: NotificationService); /** * Send notification message to the appropiate channel */ diff --git a/Live/CWX_DebugTool/types/helpers/RagfairOfferHelper.d.ts b/Live/CWX_DebugTool/types/helpers/RagfairOfferHelper.d.ts index e9d72ca..ea13aae 100644 --- a/Live/CWX_DebugTool/types/helpers/RagfairOfferHelper.d.ts +++ b/Live/CWX_DebugTool/types/helpers/RagfairOfferHelper.d.ts @@ -48,6 +48,12 @@ export declare class RagfairOfferHelper { constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, configServer: ConfigServer); getValidOffers(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; getOffersForBuild(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; + /** + * Get an array of flea offers that are inaccessible to player due to their inadequate loyalty level + * @param offers Offers to check + * @param pmcProfile Players profile with trader loyalty levels + */ + protected getLoyaltyLockedOffers(offers: IRagfairOffer[], pmcProfile: IPmcData): string[]; processOffersOnProfile(sessionID: string): boolean; protected getProfileOffers(sessionID: string): IRagfairOffer[]; protected deleteOfferByOfferId(sessionID: string, offerId: string): void; diff --git a/Live/CWX_DebugTool/types/helpers/RagfairSortHelper.d.ts b/Live/CWX_DebugTool/types/helpers/RagfairSortHelper.d.ts index d20e10c..28d1d38 100644 --- a/Live/CWX_DebugTool/types/helpers/RagfairSortHelper.d.ts +++ b/Live/CWX_DebugTool/types/helpers/RagfairSortHelper.d.ts @@ -1,14 +1,28 @@ import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; +import { RagfairSort } from "../models/enums/RagfairSort"; import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; export declare class RagfairSortHelper { protected databaseServer: DatabaseServer; protected localeService: LocaleService; constructor(databaseServer: DatabaseServer, localeService: LocaleService); - sortOffers(offers: IRagfairOffer[], type: number, direction?: number): IRagfairOffer[]; + /** + * Sort a list of ragfair offers by something (id/rating/offer name/price/expirty time) + * @param offers Offers to sort + * @param type How to sort it + * @param direction Ascending/descending + * @returns Sorted offers + */ + sortOffers(offers: IRagfairOffer[], type: RagfairSort, direction?: number): IRagfairOffer[]; protected sortOffersByID(a: IRagfairOffer, b: IRagfairOffer): number; protected sortOffersByRating(a: IRagfairOffer, b: IRagfairOffer): number; protected sortOffersByName(a: IRagfairOffer, b: IRagfairOffer): number; + /** + * Order two offers by price value + * @param a Offer a + * @param b Offer b + * @returns + */ protected sortOffersByPrice(a: IRagfairOffer, b: IRagfairOffer): number; protected sortOffersByExpiry(a: IRagfairOffer, b: IRagfairOffer): number; } diff --git a/Live/CWX_DebugTool/types/loaders/PreAkiModLoader.d.ts b/Live/CWX_DebugTool/types/loaders/PreAkiModLoader.d.ts index 4ab1689..7a687a5 100644 --- a/Live/CWX_DebugTool/types/loaders/PreAkiModLoader.d.ts +++ b/Live/CWX_DebugTool/types/loaders/PreAkiModLoader.d.ts @@ -9,6 +9,9 @@ import { ModCompilerService } from "../services/ModCompilerService"; import { JsonUtil } from "../utils/JsonUtil"; import { VFS } from "../utils/VFS"; import { BundleLoader } from "./BundleLoader"; +import { IPostAkiLoadMod } from "../models/external/IPostAkiLoadMod"; +import { IPreAkiLoadMod } from "../models/external/IPreAkiLoadMod"; +import { IPostDBLoadMod } from "../models/external/IPostDBLoadMod"; export declare class PreAkiModLoader implements IModLoader { protected logger: ILogger; protected vfs: VFS; @@ -56,12 +59,26 @@ export declare class PreAkiModLoader implements IModLoader { */ protected getModsPackageData(mods: string[]): Record; /** - * Does mod have "delayedLoad(" string in its entry class - * @param modFolderName folder name - * @param modToValidate package.json details + * Use defined safe guard to check if the mod is a IPreAkiLoadMod * @returns boolean */ - protected isModSpt3XXCompatible(modFolderName: string, modToValidate: IPackageJsonData): boolean; + protected isPreAkiLoad(mod: any): mod is IPreAkiLoadMod; + /** + * Use defined safe guard to check if the mod is a IPostAkiLoadMod + * @returns boolean + */ + protected isPostAkiLoad(mod: any): mod is IPostAkiLoadMod; + /** + * Use defined safe guard to check if the mod is a IPostDBLoadMod + * @returns boolean + */ + protected isPostDBAkiLoad(mod: any): mod is IPostDBLoadMod; + /** + * Check that the mod is compatible with SPT 3.X.X + * @param mod the mod to check + * @returns boolean + */ + protected isModSpt3XXCompatible(mod: any): boolean; protected isModCombatibleWithAki(mod: IPackageJsonData): boolean; protected executeMods(container: DependencyContainer): void; sortModsLoadOrder(): string[]; diff --git a/Live/CWX_DebugTool/types/models/eft/common/tables/IBotBase.d.ts b/Live/CWX_DebugTool/types/models/eft/common/tables/IBotBase.d.ts index 25cb861..1c28ae0 100644 --- a/Live/CWX_DebugTool/types/models/eft/common/tables/IBotBase.d.ts +++ b/Live/CWX_DebugTool/types/models/eft/common/tables/IBotBase.d.ts @@ -341,6 +341,7 @@ export interface RagfairInfo { offers: IRagfairOffer[]; } export interface Bonus { + id?: string; type: string; templateId?: string; passive?: boolean; @@ -348,6 +349,8 @@ export interface Bonus { visible?: boolean; value?: number; icon?: string; + filter?: string[]; + skillType?: string; } export interface Note { Time: number; diff --git a/Live/CWX_DebugTool/types/models/eft/ragfair/IRagfairOffer.d.ts b/Live/CWX_DebugTool/types/models/eft/ragfair/IRagfairOffer.d.ts index 141b605..3251a37 100644 --- a/Live/CWX_DebugTool/types/models/eft/ragfair/IRagfairOffer.d.ts +++ b/Live/CWX_DebugTool/types/models/eft/ragfair/IRagfairOffer.d.ts @@ -9,6 +9,7 @@ export interface IRagfairOffer { intId: number; itemsCost: number; requirementsCost: number; + sptRequirementsCostRouble: number; startTime: number; endTime: number; sellInOnePiece: boolean; diff --git a/Live/CWX_DebugTool/types/models/eft/ragfair/ISearchRequestData.d.ts b/Live/CWX_DebugTool/types/models/eft/ragfair/ISearchRequestData.d.ts index 08e7fd3..56d093b 100644 --- a/Live/CWX_DebugTool/types/models/eft/ragfair/ISearchRequestData.d.ts +++ b/Live/CWX_DebugTool/types/models/eft/ragfair/ISearchRequestData.d.ts @@ -1,7 +1,8 @@ +import { RagfairSort } from "../../enums/RagfairSort"; export interface ISearchRequestData { page: number; limit: number; - sortType: number; + sortType: RagfairSort; sortDirection: number; currency: number; priceFrom: number; diff --git a/Live/CWX_DebugTool/types/models/enums/RagfairSort.d.ts b/Live/CWX_DebugTool/types/models/enums/RagfairSort.d.ts new file mode 100644 index 0000000..798a5e7 --- /dev/null +++ b/Live/CWX_DebugTool/types/models/enums/RagfairSort.d.ts @@ -0,0 +1,7 @@ +export declare enum RagfairSort { + ID = 0, + RATING = 3, + OFFER_TITLE = 4, + PRICE = 5, + EXPIRY = 6 +} diff --git a/Live/CWX_DebugTool/types/models/external/HttpFramework.d.ts b/Live/CWX_DebugTool/types/models/external/HttpFramework.d.ts new file mode 100644 index 0000000..3b4a56a --- /dev/null +++ b/Live/CWX_DebugTool/types/models/external/HttpFramework.d.ts @@ -0,0 +1,33 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; +export declare type HandleFn = (_: string, req: IncomingMessage, resp: ServerResponse) => void; +/** + * Associates handlers, HTTP methods and a base url to a listener using a proxy + * @param basePath The base path + * @returns The decorator that create the listener proxy + */ +export declare const Listen: (basePath: string) => any>(Base: T) => T; +/** + * HTTP DELETE decorator + */ +export declare const Delete: (path?: string) => (target: any, propertyKey: string) => void; +/** + * HTTP GET decorator + */ +export declare const Get: (path?: string) => (target: any, propertyKey: string) => void; +/** + * HTTP OPTIONS decorator + */ +export declare const Options: (path?: string) => (target: any, propertyKey: string) => void; +/** + * HTTP PATCH decorator + */ +export declare const Patch: (path?: string) => (target: any, propertyKey: string) => void; +/** + * HTTP POST decorator + */ +export declare const Post: (path?: string) => (target: any, propertyKey: string) => void; +/** + * HTTP PUT decorator + */ +export declare const Put: (path?: string) => (target: any, propertyKey: string) => void; diff --git a/Live/CWX_DebugTool/types/models/spt/config/IHttpConfig.d.ts b/Live/CWX_DebugTool/types/models/spt/config/IHttpConfig.d.ts index c41d035..3fe4787 100644 --- a/Live/CWX_DebugTool/types/models/spt/config/IHttpConfig.d.ts +++ b/Live/CWX_DebugTool/types/models/spt/config/IHttpConfig.d.ts @@ -1,5 +1,6 @@ import { IBaseConfig } from "./IBaseConfig"; export interface IHttpConfig extends IBaseConfig { + webSocketPingDelayMs: number; kind: "aki-http"; ip: string; port: number; diff --git a/Live/CWX_DebugTool/types/routers/ImageRouter.d.ts b/Live/CWX_DebugTool/types/routers/ImageRouter.d.ts index ab03977..675441c 100644 --- a/Live/CWX_DebugTool/types/routers/ImageRouter.d.ts +++ b/Live/CWX_DebugTool/types/routers/ImageRouter.d.ts @@ -1,13 +1,14 @@ /// import { IncomingMessage, ServerResponse } from "http"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; import { ImageRouteService } from "../services/mod/image/ImageRouteService"; +import { HttpFileUtil } from "../utils/HttpFileUtil"; import { VFS } from "../utils/VFS"; export declare class ImageRouter { protected vfs: VFS; protected imageRouteService: ImageRouteService; - constructor(vfs: VFS, imageRouteService: ImageRouteService); + protected httpFileUtil: HttpFileUtil; + constructor(vfs: VFS, imageRouteService: ImageRouteService, httpFileUtil: HttpFileUtil); addRoute(key: string, valueToAdd: string): void; - sendImage(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any, httpServer: IHttpServer): void; + sendImage(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): void; getImage(): string; } diff --git a/Live/CWX_DebugTool/types/routers/serializers/BundleSerializer.d.ts b/Live/CWX_DebugTool/types/routers/serializers/BundleSerializer.d.ts index 912db83..ca4d8b6 100644 --- a/Live/CWX_DebugTool/types/routers/serializers/BundleSerializer.d.ts +++ b/Live/CWX_DebugTool/types/routers/serializers/BundleSerializer.d.ts @@ -1,11 +1,14 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; import { Serializer } from "../../di/Serializer"; import { BundleLoader } from "../../loaders/BundleLoader"; -import { IHttpServer } from "../../models/spt/server/IHttpServer"; import { ILogger } from "../../models/spt/utils/ILogger"; +import { HttpFileUtil } from "../../utils/HttpFileUtil"; export declare class BundleSerializer extends Serializer { protected logger: ILogger; protected bundleLoader: BundleLoader; - constructor(logger: ILogger, bundleLoader: BundleLoader); - serialize(sessionID: string, req: any, resp: any, body: any, httpServer: IHttpServer): void; + protected httpFileUtil: HttpFileUtil; + constructor(logger: ILogger, bundleLoader: BundleLoader, httpFileUtil: HttpFileUtil); + serialize(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): void; canHandle(route: string): boolean; } diff --git a/Live/CWX_DebugTool/types/routers/serializers/ImageSerializer.d.ts b/Live/CWX_DebugTool/types/routers/serializers/ImageSerializer.d.ts index 0e040d4..7f15bcf 100644 --- a/Live/CWX_DebugTool/types/routers/serializers/ImageSerializer.d.ts +++ b/Live/CWX_DebugTool/types/routers/serializers/ImageSerializer.d.ts @@ -1,9 +1,10 @@ -import { IHttpServer } from "../../models/spt/server/IHttpServer"; +/// import { Serializer } from "../../di/Serializer"; import { ImageRouter } from "../ImageRouter"; +import { IncomingMessage, ServerResponse } from "http"; export declare class ImageSerializer extends Serializer { protected imageRouter: ImageRouter; constructor(imageRouter: ImageRouter); - serialize(sessionID: string, req: any, resp: any, body: any, httpServer: IHttpServer): void; + serialize(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): void; canHandle(route: string): boolean; } diff --git a/Live/CWX_DebugTool/types/routers/serializers/NotifySerializer.d.ts b/Live/CWX_DebugTool/types/routers/serializers/NotifySerializer.d.ts index 1779ac9..0d8cc89 100644 --- a/Live/CWX_DebugTool/types/routers/serializers/NotifySerializer.d.ts +++ b/Live/CWX_DebugTool/types/routers/serializers/NotifySerializer.d.ts @@ -1,11 +1,12 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; import { NotifierController } from "../../controllers/NotifierController"; import { Serializer } from "../../di/Serializer"; import { HttpServerHelper } from "../../helpers/HttpServerHelper"; -import { IHttpServer } from "../../models/spt/server/IHttpServer"; export declare class NotifySerializer extends Serializer { protected notifierController: NotifierController; protected httpServerHelper: HttpServerHelper; constructor(notifierController: NotifierController, httpServerHelper: HttpServerHelper); - serialize(_sessionID: string, req: any, resp: any, body: any, httpServer: IHttpServer): void; + serialize(_sessionID: string, req: IncomingMessage, resp: ServerResponse, _: any): void; canHandle(route: string): boolean; } diff --git a/Live/CWX_DebugTool/types/servers/HttpServer.d.ts b/Live/CWX_DebugTool/types/servers/HttpServer.d.ts index 44d802b..f572a8f 100644 --- a/Live/CWX_DebugTool/types/servers/HttpServer.d.ts +++ b/Live/CWX_DebugTool/types/servers/HttpServer.d.ts @@ -1,51 +1,34 @@ /// -/// -import http, { ServerResponse } from "http"; +import http, { IncomingMessage, ServerResponse } from "http"; +import WebSocket from "ws"; import { ApplicationContext } from "../context/ApplicationContext"; -import { Serializer } from "../di/Serializer"; import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { NotifierHelper } from "../helpers/NotifierHelper"; import { INotification } from "../models/eft/notifier/INotifier"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; -import { IHttpServer } from "../models/spt/server/IHttpServer"; import { ILogger } from "../models/spt/utils/ILogger"; -import { HttpRouter } from "../routers/HttpRouter"; -import { HttpResponseUtil } from "../utils/HttpResponseUtil"; -import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { ConfigServer } from "./ConfigServer"; import { DatabaseServer } from "./DatabaseServer"; -export declare class HttpServer implements IHttpServer { - protected httpRouter: HttpRouter; +import { IHttpListener } from "./http/IHttpListener"; +export declare class HttpServer { protected logger: ILogger; protected randomUtil: RandomUtil; - protected jsonUtil: JsonUtil; - protected httpResponse: HttpResponseUtil; protected databaseServer: DatabaseServer; protected notifierHelper: NotifierHelper; protected httpServerHelper: HttpServerHelper; - protected serializers: Serializer[]; + protected httpListeners: IHttpListener[]; protected configServer: ConfigServer; protected applicationContext: ApplicationContext; - constructor(httpRouter: HttpRouter, // TODO: delay required - logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, httpServerHelper: HttpServerHelper, serializers: Serializer[], configServer: ConfigServer, applicationContext: ApplicationContext); - protected buffers: {}; - protected onReceive: {}; - protected onRespond: {}; + constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, httpServerHelper: HttpServerHelper, httpListeners: IHttpListener[], configServer: ConfigServer, applicationContext: ApplicationContext); protected httpConfig: IHttpConfig; protected webSockets: {}; protected websocketPingHandler: any; getCookies(req: http.IncomingMessage): any; - resetBuffer(sessionID: string): void; - putInBuffer(sessionID: any, data: any, bufLength: number): boolean; - getFromBuffer(sessionID: string): any; - sendZlibJson(resp: any, output: any, sessionID: string): void; sendMessage(sessionID: string, output: INotification): void; - sendFile(resp: ServerResponse, file: any): void; isConnectionWebSocket(sessionID: string): boolean; - sendResponse(sessionID: string, req: any, resp: any, body: Buffer): void; - handleRequest(req: http.IncomingMessage, resp: http.ServerResponse): void; + handleRequest(req: IncomingMessage, resp: ServerResponse): void; load(): void; protected getRandomisedMessage(): string; - wsOnConnection(ws: any, req: any): void; + protected wsOnConnection(ws: WebSocket.WebSocket, req: IncomingMessage): void; } diff --git a/Live/CWX_DebugTool/types/servers/http/AkiHttpListener.d.ts b/Live/CWX_DebugTool/types/servers/http/AkiHttpListener.d.ts new file mode 100644 index 0000000..6f78939 --- /dev/null +++ b/Live/CWX_DebugTool/types/servers/http/AkiHttpListener.d.ts @@ -0,0 +1,26 @@ +/// +/// +import { IncomingMessage, ServerResponse } from "http"; +import { IHttpListener } from "./IHttpListener"; +import { Serializer } from "../../di/Serializer"; +import { ILogger } from "../../models/spt/utils/ILogger"; +import { HttpRouter } from "../../routers/HttpRouter"; +import { HttpResponseUtil } from "../../utils/HttpResponseUtil"; +import { JsonUtil } from "../../utils/JsonUtil"; +import { HttpBufferHandler } from "./HttpBufferHandler"; +export declare class AkiHttpListener implements IHttpListener { + protected httpRouter: HttpRouter; + protected serializers: Serializer[]; + protected logger: ILogger; + protected jsonUtil: JsonUtil; + protected httpResponse: HttpResponseUtil; + protected httpBufferHandler: HttpBufferHandler; + constructor(httpRouter: HttpRouter, // TODO: delay required + serializers: Serializer[], logger: ILogger, jsonUtil: JsonUtil, httpResponse: HttpResponseUtil, httpBufferHandler: HttpBufferHandler); + canHandle(_: string, req: IncomingMessage): boolean; + handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): void; + sendResponse(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: Buffer, output: string): void; + getResponse(sessionID: string, req: IncomingMessage, body: Buffer): string; + protected getBodyInfo(body: Buffer): string; + sendZlibJson(resp: ServerResponse, output: any, sessionID: string): void; +} diff --git a/Live/CWX_DebugTool/types/servers/http/HttpBufferHandler.d.ts b/Live/CWX_DebugTool/types/servers/http/HttpBufferHandler.d.ts new file mode 100644 index 0000000..fec4936 --- /dev/null +++ b/Live/CWX_DebugTool/types/servers/http/HttpBufferHandler.d.ts @@ -0,0 +1,6 @@ +export declare class HttpBufferHandler { + protected buffers: {}; + resetBuffer(sessionID: string): void; + putInBuffer(sessionID: any, data: any, bufLength: number): boolean; + getFromBuffer(sessionID: string): any; +} diff --git a/Live/CWX_DebugTool/types/servers/http/HttpMethods.d.ts b/Live/CWX_DebugTool/types/servers/http/HttpMethods.d.ts new file mode 100644 index 0000000..96031e2 --- /dev/null +++ b/Live/CWX_DebugTool/types/servers/http/HttpMethods.d.ts @@ -0,0 +1,8 @@ +export declare enum HttpMethods { + OPTIONS = "OPTIONS", + GET = "GET", + POST = "POST", + PUT = "PUT", + PATCH = "PATCH", + DELETE = "DELETE" +} diff --git a/Live/CWX_DebugTool/types/servers/http/IHttpListener.d.ts b/Live/CWX_DebugTool/types/servers/http/IHttpListener.d.ts new file mode 100644 index 0000000..758bb5a --- /dev/null +++ b/Live/CWX_DebugTool/types/servers/http/IHttpListener.d.ts @@ -0,0 +1,6 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; +export interface IHttpListener { + canHandle(sessionId: string, req: IncomingMessage): boolean; + handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): void; +} diff --git a/Live/CWX_DebugTool/types/services/BotGenerationCacheService.d.ts b/Live/CWX_DebugTool/types/services/BotGenerationCacheService.d.ts index 670c583..ba53fec 100644 --- a/Live/CWX_DebugTool/types/services/BotGenerationCacheService.d.ts +++ b/Live/CWX_DebugTool/types/services/BotGenerationCacheService.d.ts @@ -35,9 +35,9 @@ export declare class BotGenerationCacheService { protected removeBotFromCache(indexOfBotToReturn: number): void; /** * Get index of bot profile that matches criteria - * @param role role of bot we want - * @param getPmc is requested bot a pmc - * @returns index of found bot + * @param role Role of bot wanted + * @param getPmc Requested bot a pmc + * @returns index of found bot, -1 if not found */ protected getIndexOfBotToReturn(role: string, getPmc: boolean): number; /** diff --git a/Live/CWX_DebugTool/types/services/ProfileFixerService.d.ts b/Live/CWX_DebugTool/types/services/ProfileFixerService.d.ts index 9cb5a38..e772919 100644 --- a/Live/CWX_DebugTool/types/services/ProfileFixerService.d.ts +++ b/Live/CWX_DebugTool/types/services/ProfileFixerService.d.ts @@ -1,6 +1,8 @@ +import { HideoutHelper } from "../helpers/HideoutHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; -import { HideoutSlot } from "../models/eft/common/tables/IBotBase"; +import { Bonus, HideoutSlot } from "../models/eft/common/tables/IBotBase"; import { IPmcDataRepeatableQuest, IRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; +import { StageBonus } from "../models/eft/hideout/IHideoutArea"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { HideoutAreas } from "../models/enums/HideoutAreas"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -9,8 +11,9 @@ import { Watermark } from "../utils/Watermark"; export declare class ProfileFixerService { protected logger: ILogger; protected watermark: Watermark; + protected hideoutHelper: HideoutHelper; protected databaseServer: DatabaseServer; - constructor(logger: ILogger, watermark: Watermark, databaseServer: DatabaseServer); + constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, databaseServer: DatabaseServer); /** * Find issues in the pmc profile data that may cause issues and fix them * @param pmcProfile profile to check and fix @@ -63,4 +66,21 @@ export declare class ProfileFixerService { */ protected updateProfilePocketsToNewId(pmcProfile: IPmcData): void; addMissingArmorRepairSkill(pmcProfile: IPmcData): void; + /** + * Iterate over players hideout areas and find what's build, look for missing bonuses those areas give and add them if missing + * @param pmcProfile Profile to update + */ + addMissingHideoutBonusesToProfile(pmcProfile: IPmcData): void; + /** + * + * @param profileBonuses bonuses from profile + * @param bonus bonus to find + * @returns matching bonus + */ + protected getBonusFromProfile(profileBonuses: Bonus[], bonus: StageBonus): Bonus; + /** + * Checks profile inventiory for items that do not exist inside the items db + * @param pmcProfile Profile to check inventory of + */ + checkForOrphanedModdedItems(pmcProfile: IPmcData): void; } diff --git a/Live/CWX_DebugTool/types/services/mod/httpListener/HttpListenerMod.d.ts b/Live/CWX_DebugTool/types/services/mod/httpListener/HttpListenerMod.d.ts new file mode 100644 index 0000000..2cdfbda --- /dev/null +++ b/Live/CWX_DebugTool/types/services/mod/httpListener/HttpListenerMod.d.ts @@ -0,0 +1,10 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; +import { IHttpListener } from "../../../servers/http/IHttpListener"; +export declare class HttpListenerMod implements IHttpListener { + private canHandleOverride; + private handleOverride; + constructor(canHandleOverride: (sessionId: string, req: IncomingMessage) => boolean, handleOverride: (sessionId: string, req: IncomingMessage, resp: ServerResponse) => void); + canHandle(sessionId: string, req: IncomingMessage): boolean; + handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): void; +} diff --git a/Live/CWX_DebugTool/types/services/mod/httpListener/HttpListenerModService.d.ts b/Live/CWX_DebugTool/types/services/mod/httpListener/HttpListenerModService.d.ts new file mode 100644 index 0000000..9dd3473 --- /dev/null +++ b/Live/CWX_DebugTool/types/services/mod/httpListener/HttpListenerModService.d.ts @@ -0,0 +1,8 @@ +/// +import { IncomingMessage, ServerResponse } from "http"; +import { DependencyContainer } from "tsyringe"; +export declare class HttpListenerModService { + protected container: DependencyContainer; + constructor(container: DependencyContainer); + registerHttpListener(name: string, canHandleOverride: (sessionId: string, req: IncomingMessage) => boolean, handleOverride: (sessionId: string, req: IncomingMessage, resp: ServerResponse) => void): void; +} diff --git a/Live/CWX_DebugTool/types/utils/HttpFileUtil.d.ts b/Live/CWX_DebugTool/types/utils/HttpFileUtil.d.ts new file mode 100644 index 0000000..afc8409 --- /dev/null +++ b/Live/CWX_DebugTool/types/utils/HttpFileUtil.d.ts @@ -0,0 +1,8 @@ +/// +import { ServerResponse } from "http"; +import { HttpServerHelper } from "../helpers/HttpServerHelper"; +export declare class HttpFileUtil { + protected httpServerHelper: HttpServerHelper; + constructor(httpServerHelper: HttpServerHelper); + sendFile(resp: ServerResponse, file: any): void; +} diff --git a/Live/CWX_MasterKey/CWX_MasterKey 1.3.6/bepInEx/plugins/CWX-MasterKey.dll b/Live/CWX_MasterKey/CWX_MasterKey 1.3.6/bepInEx/plugins/CWX-MasterKey.dll deleted file mode 100644 index 052c745..0000000 Binary files a/Live/CWX_MasterKey/CWX_MasterKey 1.3.6/bepInEx/plugins/CWX-MasterKey.dll and /dev/null differ diff --git a/Live/CWX_MasterKey/CWX_MasterKey 1.3.7/bepInEx/plugins/CWX-MasterKey.dll b/Live/CWX_MasterKey/CWX_MasterKey 1.3.7/bepInEx/plugins/CWX-MasterKey.dll new file mode 100644 index 0000000..89d126f Binary files /dev/null and b/Live/CWX_MasterKey/CWX_MasterKey 1.3.7/bepInEx/plugins/CWX-MasterKey.dll differ diff --git a/Live/CWX_MasterKey/CWX_MasterKey 1.3.6/user/mods/CWX-MasterKey 1.3.6/LICENSE.txt b/Live/CWX_MasterKey/CWX_MasterKey 1.3.7/user/mods/CWX-MasterKey 1.3.7/LICENSE.txt similarity index 100% rename from Live/CWX_MasterKey/CWX_MasterKey 1.3.6/user/mods/CWX-MasterKey 1.3.6/LICENSE.txt rename to Live/CWX_MasterKey/CWX_MasterKey 1.3.7/user/mods/CWX-MasterKey 1.3.7/LICENSE.txt diff --git a/Live/CWX_MasterKey/CWX_MasterKey 1.3.6/user/mods/CWX-MasterKey 1.3.6/package.json b/Live/CWX_MasterKey/CWX_MasterKey 1.3.7/user/mods/CWX-MasterKey 1.3.7/package.json similarity index 94% rename from Live/CWX_MasterKey/CWX_MasterKey 1.3.6/user/mods/CWX-MasterKey 1.3.6/package.json rename to Live/CWX_MasterKey/CWX_MasterKey 1.3.7/user/mods/CWX-MasterKey 1.3.7/package.json index 4ef5e2a..2b70942 100644 --- a/Live/CWX_MasterKey/CWX_MasterKey 1.3.6/user/mods/CWX-MasterKey 1.3.6/package.json +++ b/Live/CWX_MasterKey/CWX_MasterKey 1.3.7/user/mods/CWX-MasterKey 1.3.7/package.json @@ -1,10 +1,10 @@ { "name": "MasterKey", "author": "CWX", - "version": "1.3.6", + "version": "1.3.7", "license": "NCSA", "main": "src/mod.js", - "akiVersion": "3.2.3", + "akiVersion": "3.2.4", "scripts": { "setup:environment": "npm i", "build:unzipped": "copyfiles -e \"./node_modules/**/*.*\" -e \"./dist/**/*.*\" -e \"./package-lock.json\" -e \"./tsconfig.json\" -e \"./README.txt\" -e \"./mod.code-workspace\" ./**/*.* ./dist", @@ -22,4 +22,4 @@ "typescript": "4.6.4", "bestzip": "2.2.1" } -} +} \ No newline at end of file diff --git a/Live/CWX_MasterKey/CWX_MasterKey 1.3.6/user/mods/CWX-MasterKey 1.3.6/src/config.json b/Live/CWX_MasterKey/CWX_MasterKey 1.3.7/user/mods/CWX-MasterKey 1.3.7/src/config.json similarity index 100% rename from Live/CWX_MasterKey/CWX_MasterKey 1.3.6/user/mods/CWX-MasterKey 1.3.6/src/config.json rename to Live/CWX_MasterKey/CWX_MasterKey 1.3.7/user/mods/CWX-MasterKey 1.3.7/src/config.json diff --git a/Live/CWX_MasterKey/CWX_MasterKey 1.3.6/user/mods/CWX-MasterKey 1.3.6/src/mod.ts b/Live/CWX_MasterKey/CWX_MasterKey 1.3.7/user/mods/CWX-MasterKey 1.3.7/src/mod.ts similarity index 100% rename from Live/CWX_MasterKey/CWX_MasterKey 1.3.6/user/mods/CWX-MasterKey 1.3.6/src/mod.ts rename to Live/CWX_MasterKey/CWX_MasterKey 1.3.7/user/mods/CWX-MasterKey 1.3.7/src/mod.ts diff --git a/Live/CWX_MasterKey/CWX_MasterKey.csproj b/Live/CWX_MasterKey/CWX_MasterKey.csproj index 9de0a60..ac17f7b 100644 --- a/Live/CWX_MasterKey/CWX_MasterKey.csproj +++ b/Live/CWX_MasterKey/CWX_MasterKey.csproj @@ -2,35 +2,34 @@ net472 - CWX_MasterKey CWX-MasterKey - 1.3.5 + 1.3.7 - ..\Shared\AKI\Aki.Common.dll + ..\..\..\Shared\Aki\Aki.Common.dll - ..\Shared\AKI\Aki.Reflection.dll + ..\..\..\Shared\Aki\Aki.Reflection.dll - ..\..\..\ALT-Mods\Shared\EFT\Assembly-CSharp.dll + ..\..\..\Shared\EFT\Assembly-CSharp.dll - ..\Shared\BepInEx\BepInEx.dll + ..\..\..\Shared\BepInEx\BepInEx.dll - ..\Shared\EFT\Comfort.dll + ..\..\..\Shared\EFT\Comfort.dll - ..\Shared\EFT\Newtonsoft.Json.dll + ..\..\..\Shared\EFT\Newtonsoft.Json.dll - ..\Shared\EFT\UnityEngine.dll + ..\..\..\Shared\EFT\UnityEngine.dll - ..\Shared\EFT\UnityEngine.CoreModule.dll + ..\..\..\Shared\EFT\UnityEngine.CoreModule.dll diff --git a/Live/CWX_MasterKey/MasterKey.cs b/Live/CWX_MasterKey/MasterKey.cs index cf5b727..b4d71cc 100644 --- a/Live/CWX_MasterKey/MasterKey.cs +++ b/Live/CWX_MasterKey/MasterKey.cs @@ -1,96 +1,13 @@ using BepInEx; -using EFT.Interactive; -using System.Linq; -using UnityEngine; -using System.Net; -using System.Threading; -using System.Collections.Generic; -using Aki.Common.Http; -using Aki.Common.Utils; namespace CWX_MasterKey { - public static class MasterKey + [BepInPlugin("com.CWX.MasterKey", "CWX-MasterKey", "1.3.7")] + public class MasterKey : BaseUnityPlugin { - static object lockObject = new object(); - - // Black, Blue, Green, Red, Yellow, Violet - static string[] keys = new string[] { "5c1d0f4986f7744bb01837fa", "5c1d0c5f86f7744bb2683cf0", "5c1d0dc586f7744baf2e7b79", "5c1d0efb86f7744baf2e7b7b", "5c1d0d6d86f7744bb2683e1f", "5c1e495a86f7743109743dfb" }; - - public static void Start() + private void Awake() { - ConfigClass config = new ConfigClass(); - bool lockWasTaken = false; - - string keyToUse = "5c1d0d6d86f7744bb2683e1f"; - - try - { - Monitor.Enter(lockObject, ref lockWasTaken); - - config = GetConfig(); - } - catch (WebException) - { - Debug.LogError("[CWX_Masterkey] Issue happened whilst getting config from server"); - } - finally - { - if (lockWasTaken) - { - Monitor.Exit(lockObject); - } - } - - if (keys.Any(x => x == config.keyId)) - { - keyToUse = config.keyId; - } - - List allDoors = GameObject.FindObjectsOfType().ToList(); // mechanical doors - List allKeyCardDoors = GameObject.FindObjectsOfType().ToList(); // keycard doors - List allKeyContainers = GameObject.FindObjectsOfType().ToList(); // locked loot containers - List allTrunks = GameObject.FindObjectsOfType().ToList(); // locked car trunks - - foreach (Door door in allDoors) // mechanical doors - { - if (!door.KeyId.IsNullOrWhiteSpace() || !door.KeyId.IsNullOrEmpty()) - { - door.KeyId = keyToUse; - } - } - - foreach (KeycardDoor door in allKeyCardDoors) // keycard doors - { - if (!door.KeyId.IsNullOrWhiteSpace() || !door.KeyId.IsNullOrEmpty()) - { - door.KeyId = keyToUse; - } - } - - foreach (LootableContainer door in allKeyContainers) // locked loot containers - { - if (!door.KeyId.IsNullOrWhiteSpace() || !door.KeyId.IsNullOrEmpty()) - { - door.KeyId = keyToUse; - } - } - - foreach (Trunk door in allTrunks) // locked car trunks - { - if (!door.KeyId.IsNullOrWhiteSpace() || !door.KeyId.IsNullOrEmpty()) - { - door.KeyId = keyToUse; - } - } - } - - public static ConfigClass GetConfig() - { - var json = RequestHandler.GetJson($"/cwx/masterkey"); - var jsonClass = Json.Deserialize(json); - - return jsonClass; + new MasterKeyPatch().Enable(); } } -} \ No newline at end of file +} diff --git a/Live/CWX_MasterKey/ConfigClass.cs b/Live/CWX_MasterKey/MasterKeyConfigClass.cs similarity index 69% rename from Live/CWX_MasterKey/ConfigClass.cs rename to Live/CWX_MasterKey/MasterKeyConfigClass.cs index f98e0db..6b9c913 100644 --- a/Live/CWX_MasterKey/ConfigClass.cs +++ b/Live/CWX_MasterKey/MasterKeyConfigClass.cs @@ -1,6 +1,6 @@ namespace CWX_MasterKey { - public class ConfigClass + public class MasterKeyConfigClass { public string keyId { get; set; } } diff --git a/Live/CWX_MasterKey/Patch.cs b/Live/CWX_MasterKey/MasterKeyPatch.cs similarity index 81% rename from Live/CWX_MasterKey/Patch.cs rename to Live/CWX_MasterKey/MasterKeyPatch.cs index 00c10bf..a802da3 100644 --- a/Live/CWX_MasterKey/Patch.cs +++ b/Live/CWX_MasterKey/MasterKeyPatch.cs @@ -14,7 +14,9 @@ namespace CWX_MasterKey [PatchPostfix] private static void PatchPostFix() { - MasterKey.Start(); + MasterKeyScript masterKey = new MasterKeyScript(); + + masterKey.Start(); } } } \ No newline at end of file diff --git a/Live/CWX_MasterKey/MasterKeyScript.cs b/Live/CWX_MasterKey/MasterKeyScript.cs new file mode 100644 index 0000000..539e873 --- /dev/null +++ b/Live/CWX_MasterKey/MasterKeyScript.cs @@ -0,0 +1,113 @@ +using Aki.Common.Http; +using Aki.Common.Utils; +using BepInEx; +using Comfort.Common; +using EFT; +using EFT.Interactive; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Threading; +using UnityEngine; + +namespace CWX_MasterKey +{ + public class MasterKeyScript + { + private object _lockObject = new object(); + + // Black, Blue, Green, Red, Yellow, Violet + private readonly string[] _keys = { "5c1d0f4986f7744bb01837fa", "5c1d0c5f86f7744bb2683cf0", "5c1d0dc586f7744baf2e7b79", "5c1d0efb86f7744baf2e7b7b", "5c1d0d6d86f7744bb2683e1f", "5c1e495a86f7743109743dfb" }; + private string _keyToUse = "5c1d0d6d86f7744bb2683e1f"; + + public void Start() + { + MasterKeyConfigClass config = new MasterKeyConfigClass(); + bool lockWasTaken = false; + + try + { + Monitor.Enter(_lockObject, ref lockWasTaken); + + config = GetConfig(); + } + catch (WebException) + { + Debug.LogError("[CWX_MasterKey] Issue happened whilst getting config from server"); + } + finally + { + if (lockWasTaken) + { + Monitor.Exit(_lockObject); + } + } + + if (_keys.Any(x => x == config.keyId)) + { + _keyToUse = config.keyId; + } + + if (!CheckPlayer()) + { + return; + } + + List allDoors = GameObject.FindObjectsOfType().ToList(); // mechanical doors + List allKeyCardDoors = GameObject.FindObjectsOfType().ToList(); // keycard doors + List allKeyContainers = GameObject.FindObjectsOfType().ToList(); // locked loot containers + List allTrunks = GameObject.FindObjectsOfType().ToList(); // locked car trunks + + foreach (Door door in allDoors) // mechanical doors + { + if (!door.KeyId.IsNullOrWhiteSpace() || !door.KeyId.IsNullOrEmpty()) + { + door.KeyId = _keyToUse; + } + } + + foreach (KeycardDoor door in allKeyCardDoors) // keycard doors + { + if (!door.KeyId.IsNullOrWhiteSpace() || !door.KeyId.IsNullOrEmpty()) + { + door.KeyId = _keyToUse; + } + } + + foreach (LootableContainer door in allKeyContainers) // locked loot containers + { + if (!door.KeyId.IsNullOrWhiteSpace() || !door.KeyId.IsNullOrEmpty()) + { + door.KeyId = _keyToUse; + } + } + + foreach (Trunk door in allTrunks) // locked car trunks + { + if (!door.KeyId.IsNullOrWhiteSpace() || !door.KeyId.IsNullOrEmpty()) + { + door.KeyId = _keyToUse; + } + } + } + + public MasterKeyConfigClass GetConfig() + { + var json = RequestHandler.GetJson($"/cwx/masterkey"); + var jsonClass = Json.Deserialize(json); + + return jsonClass; + } + + public bool CheckPlayer() + { + GameWorld gameWorld = Singleton.Instance; + + Player player= gameWorld.RegisteredPlayers.Find(p => p.IsYourPlayer); + + var items = player.Profile.Inventory.Equipment.GetAllItems(); + + return items.Any(item => item.TemplateId == _keyToUse); + } + } +} \ No newline at end of file diff --git a/Live/CWX_MasterKey/program.cs b/Live/CWX_MasterKey/program.cs deleted file mode 100644 index ab73b19..0000000 --- a/Live/CWX_MasterKey/program.cs +++ /dev/null @@ -1,13 +0,0 @@ -using BepInEx; - -namespace CWX_MasterKey -{ - [BepInPlugin("com.CWX.MasterKey", "CWX-MasterKey", "1.3.5")] - public class Plugin : BaseUnityPlugin - { - private void Awake() - { - new MasterKeyPatch().Enable(); - } - } -} diff --git a/Live/CWX_Mods.sln b/Live/CWX_Mods.sln index 265998e..c0922f6 100644 --- a/Live/CWX_Mods.sln +++ b/Live/CWX_Mods.sln @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.1.32407.343 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CWX_WeatherPatch", "CWX_WeatherPatcher\CWX_WeatherPatch.csproj", "{0E6813D8-8989-4643-9D11-138F21CE4963}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CWX_WeatherPatcher", "CWX_WeatherPatcher\CWX_WeatherPatcher.csproj", "{0E6813D8-8989-4643-9D11-138F21CE4963}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CWX_BushWhacker", "CWX_BushWhacker\CWX_BushWhacker.csproj", "{FBA1D35B-1115-4333-8A6F-6F5884BD47D9}" EndProject diff --git a/Live/CWX_VoiceAdder/CWX_VoiceAdder.csproj b/Live/CWX_VoiceAdder/CWX_VoiceAdder.csproj index 78c5d6a..5549b18 100644 --- a/Live/CWX_VoiceAdder/CWX_VoiceAdder.csproj +++ b/Live/CWX_VoiceAdder/CWX_VoiceAdder.csproj @@ -7,28 +7,28 @@ - ..\Shared\BepInEx\0Harmony.dll + ..\..\..\Shared\BepInEx\0Harmony.dll - ..\Shared\AKI\Aki.Common.dll + ..\..\..\Shared\Aki\Aki.Common.dll - ..\Shared\AKI\Aki.Reflection.dll + ..\..\..\Shared\Aki\Aki.Reflection.dll - ..\Shared\EFT\Assembly-CSharp.dll + ..\..\..\Shared\EFT\Assembly-CSharp.dll - ..\Shared\BepInEx\BepInEx.dll + ..\..\..\Shared\BepInEx\BepInEx.dll - ..\Shared\EFT\Newtonsoft.Json.dll + ..\..\..\Shared\EFT\Newtonsoft.Json.dll - ..\Shared\EFT\UnityEngine.dll + ..\..\..\Shared\EFT\UnityEngine.dll - ..\Shared\EFT\UnityEngine.CoreModule.dll + ..\..\..\Shared\EFT\UnityEngine.CoreModule.dll diff --git a/Live/CWX_WeatherPatcher/CWX_JsonConverter.cs b/Live/CWX_WeatherPatcher/CWX_JsonConverter.cs deleted file mode 100644 index f42f19c..0000000 --- a/Live/CWX_WeatherPatcher/CWX_JsonConverter.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace CWX_WeatherPatch -{ - public class JSONClass - { - public float Cloudness { get; set; } - public int WindDirection { get; set; } - public float Wind { get; set; } - public float Rain { get; set; } - public float RainRandomness { get; set; } - } -} diff --git a/Live/CWX_WeatherPatcher/CWX_WeatherPatch.csproj b/Live/CWX_WeatherPatcher/CWX_WeatherPatch.csproj deleted file mode 100644 index b7c60fd..0000000 --- a/Live/CWX_WeatherPatcher/CWX_WeatherPatch.csproj +++ /dev/null @@ -1,45 +0,0 @@ - - - - net472 - 2.4.4 - CWX-WeatherPatcher - - - - - ..\Shared\AKI\Aki.Common.dll - - - ..\Shared\AKI\Aki.Reflection.dll - - - ..\..\..\ALT-Mods\Shared\EFT\Assembly-CSharp.dll - - - ..\Shared\BepInEx\BepInEx.dll - - - ..\Shared\EFT\UnityEngine.dll - - - ..\Shared\EFT\UnityEngine.CoreModule.dll - - - - - - True - True - Settings.settings - - - - - - SettingsSingleFileGenerator - Settings.Designer.cs - - - - diff --git a/Live/CWX_WeatherPatcher/CWX_WeatherPatcher 2.4.4/BepInEx/plugins/CWX-WeatherPatcher.dll b/Live/CWX_WeatherPatcher/CWX_WeatherPatcher 2.4.4/BepInEx/plugins/CWX-WeatherPatcher.dll deleted file mode 100644 index 4e5b76b..0000000 Binary files a/Live/CWX_WeatherPatcher/CWX_WeatherPatcher 2.4.4/BepInEx/plugins/CWX-WeatherPatcher.dll and /dev/null differ diff --git a/Live/CWX_WeatherPatcher/CWX_WeatherPatcher 2.4.5/BepInEx/plugins/CWX-WeatherPatcher.dll b/Live/CWX_WeatherPatcher/CWX_WeatherPatcher 2.4.5/BepInEx/plugins/CWX-WeatherPatcher.dll new file mode 100644 index 0000000..a875869 Binary files /dev/null and b/Live/CWX_WeatherPatcher/CWX_WeatherPatcher 2.4.5/BepInEx/plugins/CWX-WeatherPatcher.dll differ diff --git a/Live/CWX_WeatherPatcher/CWX_WeatherPatcher 2.4.4/user/mods/CWX-WeatherPatcher 2.4.4/LICENSE.txt b/Live/CWX_WeatherPatcher/CWX_WeatherPatcher 2.4.5/user/mods/CWX-WeatherPatcher 2.4.5/LICENSE.txt similarity index 100% rename from Live/CWX_WeatherPatcher/CWX_WeatherPatcher 2.4.4/user/mods/CWX-WeatherPatcher 2.4.4/LICENSE.txt rename to Live/CWX_WeatherPatcher/CWX_WeatherPatcher 2.4.5/user/mods/CWX-WeatherPatcher 2.4.5/LICENSE.txt diff --git a/Live/CWX_WeatherPatcher/CWX_WeatherPatcher 2.4.4/user/mods/CWX-WeatherPatcher 2.4.4/package.json b/Live/CWX_WeatherPatcher/CWX_WeatherPatcher 2.4.5/user/mods/CWX-WeatherPatcher 2.4.5/package.json similarity index 95% rename from Live/CWX_WeatherPatcher/CWX_WeatherPatcher 2.4.4/user/mods/CWX-WeatherPatcher 2.4.4/package.json rename to Live/CWX_WeatherPatcher/CWX_WeatherPatcher 2.4.5/user/mods/CWX-WeatherPatcher 2.4.5/package.json index 0a35d7e..ed04106 100644 --- a/Live/CWX_WeatherPatcher/CWX_WeatherPatcher 2.4.4/user/mods/CWX-WeatherPatcher 2.4.4/package.json +++ b/Live/CWX_WeatherPatcher/CWX_WeatherPatcher 2.4.5/user/mods/CWX-WeatherPatcher 2.4.5/package.json @@ -1,10 +1,10 @@ { "name": "WeatherPatcher", "author": "CWX", - "version": "2.4.4", + "version": "2.4.5", "license": "NCSA", "main": "src/mod.js", - "akiVersion": "3.2.3", + "akiVersion": "3.2.4", "scripts": { "setup:environment": "npm i", "build:unzipped": "copyfiles -e \"./node_modules/**/*.*\" -e \"./dist/**/*.*\" -e \"./package-lock.json\" -e \"./tsconfig.json\" -e \"./README.txt\" -e \"./mod.code-workspace\" ./**/*.* ./dist", diff --git a/Live/CWX_WeatherPatcher/CWX_WeatherPatcher 2.4.4/user/mods/CWX-WeatherPatcher 2.4.4/src/mod.ts b/Live/CWX_WeatherPatcher/CWX_WeatherPatcher 2.4.5/user/mods/CWX-WeatherPatcher 2.4.5/src/mod.ts similarity index 100% rename from Live/CWX_WeatherPatcher/CWX_WeatherPatcher 2.4.4/user/mods/CWX-WeatherPatcher 2.4.4/src/mod.ts rename to Live/CWX_WeatherPatcher/CWX_WeatherPatcher 2.4.5/user/mods/CWX-WeatherPatcher 2.4.5/src/mod.ts diff --git a/Live/CWX_WeatherPatcher/CWX_WeatherPatcher.csproj b/Live/CWX_WeatherPatcher/CWX_WeatherPatcher.csproj new file mode 100644 index 0000000..b5b47d0 --- /dev/null +++ b/Live/CWX_WeatherPatcher/CWX_WeatherPatcher.csproj @@ -0,0 +1,30 @@ + + + + net472 + CWX-WeatherPatcher + 2.4.5 + + + + + ..\..\..\Shared\Aki\Aki.Common.dll + + + ..\..\..\Shared\Aki\Aki.Reflection.dll + + + ..\..\..\Shared\EFT\Assembly-CSharp.dll + + + ..\..\..\Shared\BepInEx\BepInEx.dll + + + ..\..\..\Shared\EFT\UnityEngine.dll + + + ..\..\..\Shared\EFT\UnityEngine.CoreModule.dll + + + + diff --git a/Live/CWX_WeatherPatcher/GClassPatch.cs b/Live/CWX_WeatherPatcher/GClassPatch.cs index fd8d192..97dd85d 100644 --- a/Live/CWX_WeatherPatcher/GClassPatch.cs +++ b/Live/CWX_WeatherPatcher/GClassPatch.cs @@ -1,10 +1,9 @@ using Aki.Reflection.Patching; using System.Reflection; -using EFT; namespace CWX_WeatherPatcher { - class GClassPatch : ModulePatch // MAKES CHANGES TO WeatherClass SMETHOD_0 + public class GClassPatch : ModulePatch // MAKES CHANGES TO WeatherClass SMETHOD_0 { protected override MethodBase GetTargetMethod() { diff --git a/Live/CWX_WeatherPatcher/GameWorldPatch.cs b/Live/CWX_WeatherPatcher/GameWorldPatch.cs index fbf36c3..5faa3b4 100644 --- a/Live/CWX_WeatherPatcher/GameWorldPatch.cs +++ b/Live/CWX_WeatherPatcher/GameWorldPatch.cs @@ -1,9 +1,8 @@ using System.Reflection; using Aki.Reflection.Patching; -using CWX_WeatherPatcher; using EFT; -namespace CWX_WeatherPatch +namespace CWX_WeatherPatcher { public class GameWorldPatch : ModulePatch { @@ -15,7 +14,7 @@ namespace CWX_WeatherPatch [PatchPostfix] private static void PatchPostFix() { - Plugin.Fix(); + WeatherPatcher.Fix(); } } } \ No newline at end of file diff --git a/Live/CWX_WeatherPatcher/LevelSettingsPatch.cs b/Live/CWX_WeatherPatcher/LevelSettingsPatch.cs index 39dfb89..64c6405 100644 --- a/Live/CWX_WeatherPatcher/LevelSettingsPatch.cs +++ b/Live/CWX_WeatherPatcher/LevelSettingsPatch.cs @@ -3,7 +3,7 @@ using System.Reflection; namespace CWX_WeatherPatcher { - class LevelSettingsPatch : ModulePatch // MAKES CHANGES TO LevelSettings + public class LevelSettingsPatch : ModulePatch // MAKES CHANGES TO LevelSettings { protected override MethodBase GetTargetMethod() { diff --git a/Live/CWX_WeatherPatcher/TOD_ScatteringPatch.cs b/Live/CWX_WeatherPatcher/TodScatteringPatch.cs similarity index 84% rename from Live/CWX_WeatherPatcher/TOD_ScatteringPatch.cs rename to Live/CWX_WeatherPatcher/TodScatteringPatch.cs index 1042acd..f6a3e98 100644 --- a/Live/CWX_WeatherPatcher/TOD_ScatteringPatch.cs +++ b/Live/CWX_WeatherPatcher/TodScatteringPatch.cs @@ -3,7 +3,7 @@ using System.Reflection; namespace CWX_WeatherPatcher { - class TOD_ScatteringPatch : ModulePatch // MAKES CHANGES TO TOD_SCATTERING FOG + public class TodScatteringPatch : ModulePatch // MAKES CHANGES TO TOD_SCATTERING FOG { protected override MethodBase GetTargetMethod() { diff --git a/Live/CWX_WeatherPatcher/Program.cs b/Live/CWX_WeatherPatcher/WeatherPatcher.cs similarity index 88% rename from Live/CWX_WeatherPatcher/Program.cs rename to Live/CWX_WeatherPatcher/WeatherPatcher.cs index 547d36e..05e15a5 100644 --- a/Live/CWX_WeatherPatcher/Program.cs +++ b/Live/CWX_WeatherPatcher/WeatherPatcher.cs @@ -1,18 +1,17 @@ using BepInEx; -using CWX_WeatherPatch; using EFT.Weather; namespace CWX_WeatherPatcher { - [BepInPlugin("com.CWX.WeatherPatcher", "CWX-WeatherPatcher", "2.4.4")] - public class Plugin : BaseUnityPlugin + [BepInPlugin("com.CWX.WeatherPatcher", "CWX-WeatherPatcher", "2.4.5")] + public class WeatherPatcher : BaseUnityPlugin { private void Awake() { new GClassPatch().Enable(); new CustomGlobalFogPatch().Enable(); new LevelSettingsPatch().Enable(); - new TOD_ScatteringPatch().Enable(); + new TodScatteringPatch().Enable(); new GameWorldPatch().Enable(); } diff --git a/WIP/CWX-HalloweenEvent/CWX_HalloweenEvent.csproj b/WIP/CWX-HalloweenEvent/CWX_HalloweenEvent.csproj new file mode 100644 index 0000000..54c16d4 --- /dev/null +++ b/WIP/CWX-HalloweenEvent/CWX_HalloweenEvent.csproj @@ -0,0 +1,36 @@ + + + + net472 + CWX_HalloweenEvent + 1.0.0 + + + + + ..\..\..\Shared\Aki\Aki.Common.dll + + + ..\..\..\Shared\Aki\Aki.Reflection.dll + + + ..\..\..\Shared\EFT\Assembly-CSharp.dll + + + ..\..\..\Shared\BepInEx\BepInEx.dll + + + ..\..\..\Shared\EFT\Comfort.dll + + + ..\..\..\Shared\EFT\Newtonsoft.Json.dll + + + ..\..\..\Shared\EFT\UnityEngine.dll + + + ..\..\..\Shared\EFT\UnityEngine.CoreModule.dll + + + + diff --git a/WIP/CWX-HalloweenEvent/CWX_HalloweenEvent.sln b/WIP/CWX-HalloweenEvent/CWX_HalloweenEvent.sln new file mode 100644 index 0000000..3e54ea6 --- /dev/null +++ b/WIP/CWX-HalloweenEvent/CWX_HalloweenEvent.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.3.32922.545 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CWX_HalloweenEvent", "CWX_HalloweenEvent.csproj", "{ABD20003-B8FA-4A42-A664-7BBAF4008C5A}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {ABD20003-B8FA-4A42-A664-7BBAF4008C5A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {ABD20003-B8FA-4A42-A664-7BBAF4008C5A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {ABD20003-B8FA-4A42-A664-7BBAF4008C5A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {ABD20003-B8FA-4A42-A664-7BBAF4008C5A}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {63808E07-B7DA-4D9A-B2D9-E0CB4352C497} + EndGlobalSection +EndGlobal diff --git a/WIP/CWX-HalloweenEvent/Changes/EventWeather.cs b/WIP/CWX-HalloweenEvent/Changes/EventWeather.cs new file mode 100644 index 0000000..825265a --- /dev/null +++ b/WIP/CWX-HalloweenEvent/Changes/EventWeather.cs @@ -0,0 +1,80 @@ +using Comfort.Common; +using EFT; +using EFT.Weather; +using GPUInstancer; +using System; +using UnityEngine; + +namespace CWX_HalloweenEvent.Changes +{ + public class EventWeather + { + public WeatherController WController; + public Transform SkyDomeGameObject; + public TOD_Sky SkySettings; + public TOD_Time TimeSettings; + public GameWorld GWorld; + + // The separation isn't needed, but is easier to read. + public void Enable() + { + // Initialise all Vars. + InitVars(); + + // Change all the vars. + ChangeVars(); + } + + private void InitVars() + { + // Finds the GameWorld Instance + GWorld = Singleton.Instance; + + // Finds the WeatherControllers Instance. + WController = WeatherController.Instance; + + // Finds the SkyDome GameObject. + SkyDomeGameObject = WController.transform.Find("Sky Dome"); + + // Finds the TOD_Time attached to SkyDome. + TimeSettings = SkyDomeGameObject.GetComponent(); + + // Finds the TOD_Sky Instance; + SkySettings = TOD_Sky.Instance; + } + + private void ChangeVars() + { + // Enables WeatherDebug and removes clouds and makes lightning 100% possible + WController.WeatherDebug.Enabled = true; + WController.WeatherDebug.CloudDensity = -1f; + WController.WeatherDebug.LightningThunderProbability = 100f; + + // Disables the higher clouds. + SkyDomeGameObject.transform.Find("Clouds").gameObject.SetActive(false); + + // Sets the SkyColor to Red + for (int i = 0; i < SkySettings.Night.SkyColor.colorKeys.Length ; i++) + { + SkySettings.Night.SkyColor.colorKeys[i].color.r = 1f; + SkySettings.Night.SkyColor.colorKeys[i].color.g = 0f; + SkySettings.Night.SkyColor.colorKeys[i].color.b = 0f; + SkySettings.Night.SkyColor.colorKeys[i].color.a = 1f; + } + + // Makes the stars a little brighter + SkySettings.Stars.Brightness = 10f; + + // Makes the moon 200% bigger + SkySettings.Moon.MeshSize = 3f; + + // Disables the lower clouds. + WController.CloudsController.enabled = false; + + WController.RainController.enabled = false; + + // Sets the time to midnight whatever was picked on the raid select screen. + TimeSettings.GameDateTime.Reset(new DateTime(2022, 10, 14, 3, 0, 0)); + } + } +} diff --git a/WIP/CWX-HalloweenEvent/HalloweenEvent.cs b/WIP/CWX-HalloweenEvent/HalloweenEvent.cs new file mode 100644 index 0000000..199e10f --- /dev/null +++ b/WIP/CWX-HalloweenEvent/HalloweenEvent.cs @@ -0,0 +1,37 @@ +using BepInEx; +using CWX_HalloweenEvent.Patches; +using EFT.Weather; +using System; + +namespace CWX_HalloweenEvent +{ + [BepInPlugin("com.cwx.HalloweenEvent", "cwx-HalloweenEvent", "1.0.0")] + public class HalloweenEvent : BaseUnityPlugin + { + public void Start() + { + new LevelSettingsPatch().Enable(); + new RaidStartPatch().Enable(); + } + + /* + * + * 1. Orange Moon and Evening time. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ + } +} diff --git a/WIP/CWX-HalloweenEvent/Patches/LevelSettingPatch.cs b/WIP/CWX-HalloweenEvent/Patches/LevelSettingPatch.cs new file mode 100644 index 0000000..adf4ba6 --- /dev/null +++ b/WIP/CWX-HalloweenEvent/Patches/LevelSettingPatch.cs @@ -0,0 +1,20 @@ +using Aki.Reflection.Patching; +using System.Reflection; + +namespace CWX_HalloweenEvent.Patches +{ + public class LevelSettingsPatch : ModulePatch + { + protected override MethodBase GetTargetMethod() + { + return typeof(LevelSettings).GetMethod("ApplySettings", BindingFlags.Public | BindingFlags.Instance); + } + + [PatchPostfix] + private static void PostFixPatch(ref LevelSettings __instance) + { + __instance.fog = false; + __instance.fogEndDistance = 0f; + } + } +} diff --git a/WIP/CWX-HalloweenEvent/Patches/RaidStartPatch.cs b/WIP/CWX-HalloweenEvent/Patches/RaidStartPatch.cs new file mode 100644 index 0000000..e178211 --- /dev/null +++ b/WIP/CWX-HalloweenEvent/Patches/RaidStartPatch.cs @@ -0,0 +1,22 @@ +using Aki.Reflection.Patching; +using EFT; +using System.Reflection; +using CWX_HalloweenEvent.Changes; + +namespace CWX_HalloweenEvent.Patches +{ + public class RaidStartPatch : ModulePatch + { + protected override MethodBase GetTargetMethod() + { + return typeof(GameWorld).GetMethod("OnGameStarted", BindingFlags.Public | BindingFlags.Instance); + } + + [PatchPostfix] + public static void PatchPostFix() + { + EventWeather eventWeather = new EventWeather(); + eventWeather.Enable(); + } + } +} diff --git a/WIP/CWX-PrePatcher/CWX_NewAiType/CWX_NewAiType.csproj b/WIP/CWX-PrePatcher/CWX_NewAiType/CWX_NewAiType.csproj new file mode 100644 index 0000000..f6c60a4 --- /dev/null +++ b/WIP/CWX-PrePatcher/CWX_NewAiType/CWX_NewAiType.csproj @@ -0,0 +1,39 @@ + + + + net472 + CWX_NewAiType + 1.0.0 + + + + + ..\..\..\..\Shared\BepInEx\0Harmony.dll + + + ..\..\..\..\Shared\Aki\Aki.Common.dll + + + ..\..\..\..\Shared\Aki\Aki.Reflection.dll + + + ..\..\..\..\Shared\EFT\Assembly-CSharp.dll + + + ..\..\..\..\Shared\BepInEx\BepInEx.dll + + + ..\..\..\..\Shared\EFT\Comfort.dll + + + ..\..\..\..\Shared\EFT\Newtonsoft.Json.dll + + + ..\..\..\..\Shared\EFT\UnityEngine.dll + + + ..\..\..\..\Shared\EFT\UnityEngine.CoreModule.dll + + + + diff --git a/WIP/CWX-PrePatcher/CWX_NewAiType/Constants/Constants.cs b/WIP/CWX-PrePatcher/CWX_NewAiType/Constants/Constants.cs new file mode 100644 index 0000000..948433c --- /dev/null +++ b/WIP/CWX-PrePatcher/CWX_NewAiType/Constants/Constants.cs @@ -0,0 +1,16 @@ +namespace CWX_NewAiType.Constants +{ + public static class Constants + { + public static class WildSpawnType + { + public const string sptUsec = "sptUsec"; + + } + + public static class CounterTag + { + public const string KilledSptUsec = "KilledSptUsec"; + } + } +} diff --git a/WIP/CWX-PrePatcher/CWX_NewAiType/NewAiType.cs b/WIP/CWX-PrePatcher/CWX_NewAiType/NewAiType.cs new file mode 100644 index 0000000..c29e3f4 --- /dev/null +++ b/WIP/CWX-PrePatcher/CWX_NewAiType/NewAiType.cs @@ -0,0 +1,15 @@ +using BepInEx; +using CWX_NewAiType.Patches; + +namespace CWX_NewAiType +{ + [BepInPlugin("com.CWX.NewAiType", "CWX-NewAiType", "1.0.0")] + public class NewAiType : BaseUnityPlugin + { + public NewAiType() + { + StaticPatches.PatchBotGlobalSettings(); + StaticPatches.InitKillCounters(); + } + } +} \ No newline at end of file diff --git a/WIP/CWX-PrePatcher/CWX_NewAiType/Patches/PlayerStatTrackerOnKillPatch.cs b/WIP/CWX-PrePatcher/CWX_NewAiType/Patches/PlayerStatTrackerOnKillPatch.cs new file mode 100644 index 0000000..f3d7c25 --- /dev/null +++ b/WIP/CWX-PrePatcher/CWX_NewAiType/Patches/PlayerStatTrackerOnKillPatch.cs @@ -0,0 +1,191 @@ +using CWX_NewAiType.utils; +using EFT; +using HarmonyLib; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection.Emit; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; +using Aki.Reflection.Patching; +using CWX_NewAiType.Constants; + +namespace CWX_NewAiType.Patches +{ + internal class PlayerStatTrackerOnKillPatch : ModulePatch + { + protected override MethodBase GetTargetMethod() + { + var method = ClassResolver.StatisticsServerClass + .GetMethod("OnEnemyKill", BindingFlags.Public | BindingFlags.Instance); + + if (method == null) + { + throw new NullReferenceException(); + } + + return method; + } + + private static IEnumerable PatchTranspile(ILGenerator generator, IEnumerable instructions) + { + var codes = new List(instructions); + + var newInstructionInsertIndex = -1; + + // Generate various labels we'll be using later + var SptInstructionStartLabel = generator.DefineLabel(); + var killedSptUsecLabel = generator.DefineLabel(); + var SptAddLongJumpLabel = generator.DefineLabel(); + var SptSkipFlagLabel = generator.DefineLabel(); + + // This label we'll need to locate when scanning through instructions + var switchEndLabel = default(Label); + var killXpClassGetter = default(MethodInfo); + + for (var i = 0; i < codes.Count; i++) + { + // We locate the label that points to the end of the switch statement + if (codes[i].opcode == OpCodes.Ldfld && + (FieldInfo)codes[i].operand == AccessTools.Field(ClassResolver.KillExperienceConfigClass, "VictimLevelExp")) + { + switchEndLabel = (Label)codes[i + 2].operand; + continue; + } + + // We locate the index for where our instructions will be inserted + if (codes[i].opcode == OpCodes.Ldfld && + (FieldInfo)codes[i].operand == AccessTools.Field(ClassResolver.KillExperienceConfigClass, "VictimBotLevelExp")) + { + newInstructionInsertIndex = i + 2; + killXpClassGetter = (MethodInfo)codes[i - 2].operand; + continue; + } + + // We locate the instruction from which we can locate the relevant switch statement + if (codes[i].opcode == OpCodes.Ldsfld && + (FieldInfo)codes[i].operand == AccessTools.Field(ClassResolver.StatisticsCounterClass, "KilledUsec")) + { + // From here, 4 codes back is where the switch should start + if (codes[i - 4].opcode != OpCodes.Switch) + { + throw new NullReferenceException(); + } + + // We grab the switch operand, which is just an array of labels + var switchOperand = (Label[])codes[i - 4].operand; + // The third label in the switch operand points to the ArgumentOutOfRangeException + var outOfRangeLabel = switchOperand[2]; + + // We create a new list of labels, and add all the old values to it + var newSwitchOperand = new List