bump, debugTool needs fixing for 3.2.5, added WIP Halloween event and prepatcher

This commit is contained in:
Craig 2022-10-19 17:27:45 +01:00
parent b70451987a
commit 2d996a9e9f
158 changed files with 2482 additions and 579 deletions

View File

@ -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()

View File

@ -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()
{

View File

@ -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",

View File

@ -3,39 +3,39 @@
<PropertyGroup>
<TargetFramework>net472</TargetFramework>
<AssemblyName>CWX-BushWhacker</AssemblyName>
<Version>1.2.4</Version>
<Version>1.2.5</Version>
</PropertyGroup>
<ItemGroup>
<Reference Include="Aki.Common">
<HintPath>..\Shared\AKI\Aki.Common.dll</HintPath>
<HintPath>..\..\..\Shared\Aki\Aki.Common.dll</HintPath>
</Reference>
<Reference Include="Aki.Reflection">
<HintPath>..\Shared\AKI\Aki.Reflection.dll</HintPath>
<HintPath>..\..\..\Shared\Aki\Aki.Reflection.dll</HintPath>
</Reference>
<Reference Include="Assembly-CSharp">
<HintPath>..\Shared\EFT\Assembly-CSharp.dll</HintPath>
<HintPath>..\..\..\Shared\EFT\Assembly-CSharp.dll</HintPath>
</Reference>
<Reference Include="BepInEx">
<HintPath>..\Shared\BepInEx\BepInEx.dll</HintPath>
<HintPath>..\..\..\Shared\BepInEx\BepInEx.dll</HintPath>
</Reference>
<Reference Include="Comfort">
<HintPath>..\Shared\EFT\Comfort.dll</HintPath>
<HintPath>..\..\..\Shared\EFT\Comfort.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json">
<HintPath>..\Shared\EFT\Newtonsoft.Json.dll</HintPath>
<HintPath>..\..\..\Shared\EFT\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="UnityEngine">
<HintPath>..\Shared\EFT\UnityEngine.dll</HintPath>
<HintPath>..\..\..\Shared\EFT\UnityEngine.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.AssetBundleModule">
<HintPath>..\Shared\EFT\UnityEngine.AssetBundleModule.dll</HintPath>
<HintPath>..\..\..\Shared\EFT\UnityEngine.AssetBundleModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.CoreModule">
<HintPath>..\Shared\EFT\UnityEngine.CoreModule.dll</HintPath>
<HintPath>..\..\..\Shared\EFT\UnityEngine.CoreModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.PhysicsModule">
<HintPath>..\..\..\AKI-All\Modules\project\Shared\Managed\UnityEngine.PhysicsModule.dll</HintPath>
<HintPath>..\..\..\Shared\EFT\UnityEngine.PhysicsModule.dll</HintPath>
</Reference>
</ItemGroup>

View File

@ -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",

View File

@ -2,31 +2,28 @@
<PropertyGroup>
<TargetFramework>net472</TargetFramework>
<Version>1.4.4</Version>
<AssemblyName>CWX-DeSharpener</AssemblyName>
<Version>1.4.5</Version>
<AssemblyName>CWX-DeSharpener</AssemblyName>
</PropertyGroup>
<ItemGroup>
<Reference Include="Aki.Common">
<HintPath>..\Shared\AKI\Aki.Common.dll</HintPath>
<HintPath>..\..\..\Shared\Aki\Aki.Common.dll</HintPath>
</Reference>
<Reference Include="Aki.Reflection">
<HintPath>..\Shared\AKI\Aki.Reflection.dll</HintPath>
<HintPath>..\..\..\Shared\Aki\Aki.Reflection.dll</HintPath>
</Reference>
<Reference Include="Assembly-CSharp">
<HintPath>..\Shared\EFT\Assembly-CSharp.dll</HintPath>
<HintPath>..\..\..\Shared\EFT\Assembly-CSharp.dll</HintPath>
</Reference>
<Reference Include="BepInEx">
<HintPath>..\Shared\BepInEx\BepInEx.dll</HintPath>
</Reference>
<Reference Include="ConfigurationManager">
<HintPath>..\Shared\BepInEx\ConfigurationManager.dll</HintPath>
<HintPath>..\..\..\Shared\BepInEx\BepInEx.dll</HintPath>
</Reference>
<Reference Include="UnityEngine">
<HintPath>..\Shared\EFT\UnityEngine.dll</HintPath>
<HintPath>..\..\..\Shared\EFT\UnityEngine.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.CoreModule">
<HintPath>..\Shared\EFT\UnityEngine.CoreModule.dll</HintPath>
<HintPath>..\..\..\Shared\EFT\UnityEngine.CoreModule.dll</HintPath>
</Reference>
</ItemGroup>

View File

@ -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();
}
}
}

View File

@ -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);
}

View File

@ -20,5 +20,12 @@
"changeShrapProps": true,
"changeMaxAmmoForKS23": true,
"removeDevFromBlacklist": true
},
"airdropConfig": {
"enableAllTheTime": true,
"changeFlightHeight": true,
"changeStartTime": true,
"changePlaneVolume": true
}
}

View File

@ -20,5 +20,12 @@
"changeShrapProps": true,
"changeMaxAmmoForKS23": true,
"removeDevFromBlacklist": true
},
"airdropConfig": {
"enableAllTheTime": true,
"changeFlightHeight": true,
"changeStartTime": true,
"changePlaneVolume": true
}
}

View File

@ -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
}

View File

@ -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;
}
}
}

View File

@ -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;
}

View File

@ -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)
{

View File

@ -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)
{

View File

@ -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<string, ITemplateItem>;
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"));
}

View File

@ -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)
{

View File

@ -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");
}
}
}

View File

@ -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", CWX_ConfigHandler, {lifecycle:Lifecycle.Singleton})
container.register<CWX_GlobalsConfig>("CWX_GlobalsConfig", CWX_GlobalsConfig);
container.register<CWX_RagfairConfig>("CWX_RagfairConfig", CWX_RagfairConfig);
container.register<CWX_LocationConfig>("CWX_LocationConfig", CWX_LocationConfig);
container.register<CWX_InraidConfig>("CWX_InraidConfig", CWX_InraidConfig);
container.register<CWX_ItemsConfig>("CWX_ItemsConfig", CWX_ItemsConfig);
container.register<CWX_Logging>("CWX_Logging", CWX_Logging);
container.register<CwxConfigHandler>("CwxConfigHandler", CwxConfigHandler, {lifecycle:Lifecycle.Singleton})
container.register<CwxGlobalsConfig>("CwxGlobalsConfig", CwxGlobalsConfig);
container.register<CwxRagfairConfig>("CwxRagfairConfig", CwxRagfairConfig);
container.register<CwxLocationConfig>("CwxLocationConfig", CwxLocationConfig);
container.register<CwxInraidConfig>("CwxInraidConfig", CwxInraidConfig);
container.register<CwxItemsConfig>("CwxItemsConfig", CwxItemsConfig);
container.register<CwxAirdropConfig>("CwxAirdropConfig", CwxAirdropConfig);
container.register<CwxLogging>("CwxLogging", CwxLogging);
container.resolve<CWX_GlobalsConfig>("CWX_GlobalsConfig").applyChanges();
container.resolve<CWX_RagfairConfig>("CWX_RagfairConfig").applyChanges();
container.resolve<CWX_LocationConfig>("CWX_LocationConfig").applyChanges();
container.resolve<CWX_InraidConfig>("CWX_InraidConfig").applyChanges();
container.resolve<CWX_ItemsConfig>("CWX_ItemsConfig").applyChanges();
container.resolve<CwxGlobalsConfig>("CwxGlobalsConfig").applyChanges();
container.resolve<CwxRagfairConfig>("CwxRagfairConfig").applyChanges();
container.resolve<CwxLocationConfig>("CwxLocationConfig").applyChanges();
container.resolve<CwxInraidConfig>("CwxInraidConfig").applyChanges();
container.resolve<CwxItemsConfig>("CwxItemsConfig").applyChanges();
container.resolve<CwxAirdropConfig>("CwxAirdropConfig").applyChanges();
if (container.resolve<CWX_ConfigHandler>("CWX_ConfigHandler").getConfig().showLogs)
if (container.resolve<CwxConfigHandler>("CwxConfigHandler").getConfig().showLogs)
{
container.resolve<CWX_Logging>("CWX_Logging").SendLogging();
container.resolve<CwxLogging>("CwxLogging").sendLogging();
}
}
}

View File

@ -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)
{

View File

@ -0,0 +1,6 @@
export declare class ErrorHandler {
private logger;
private readLine;
constructor();
handleCriticalError(err: any): void;
}

View File

@ -1,4 +1,5 @@
export declare class Program {
private errorHandler;
constructor();
start(): void;
}

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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<DialogueInfo[]>;
/**
* 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;
}

View File

@ -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;
}

View File

@ -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<string, ITraderAssort>, 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<string, number>;
/**
* 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<string, ITraderAssort>, 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

View File

@ -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;

View File

@ -1,5 +1,6 @@
import { IHttpServer } from "../models/spt/server/IHttpServer";
/// <reference types="node" />
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;
}

View File

@ -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<string, {
current: number;
max: number;
}>, result: LootItem[]): boolean;
}>, itemBlacklist: string[], result: LootItem[]): boolean;
}

View File

@ -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;
/**

View File

@ -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

View File

@ -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[];
}

View File

@ -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
*/

View File

@ -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<string, ITraderAssort>, pmcProfile: IPmcData): IRagfairOffer[];
getOffersForBuild(info: ISearchRequestData, itemsToAdd: string[], assorts: Record<string, ITraderAssort>, 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;

View File

@ -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;
}

View File

@ -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<string, IPackageJsonData>;
/**
* 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[];

View File

@ -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;

View File

@ -9,6 +9,7 @@ export interface IRagfairOffer {
intId: number;
itemsCost: number;
requirementsCost: number;
sptRequirementsCostRouble: number;
startTime: number;
endTime: number;
sellInOnePiece: boolean;

View File

@ -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;

View File

@ -0,0 +1,7 @@
export declare enum RagfairSort {
ID = 0,
RATING = 3,
OFFER_TITLE = 4,
PRICE = 5,
EXPIRY = 6
}

View File

@ -0,0 +1,33 @@
/// <reference types="node" />
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) => <T extends new (...args: any[]) => 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;

View File

@ -1,5 +1,6 @@
import { IBaseConfig } from "./IBaseConfig";
export interface IHttpConfig extends IBaseConfig {
webSocketPingDelayMs: number;
kind: "aki-http";
ip: string;
port: number;

View File

@ -1,13 +1,14 @@
/// <reference types="node" />
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;
}

View File

@ -1,11 +1,14 @@
/// <reference types="node" />
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;
}

View File

@ -1,9 +1,10 @@
import { IHttpServer } from "../../models/spt/server/IHttpServer";
/// <reference types="node" />
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;
}

View File

@ -1,11 +1,12 @@
/// <reference types="node" />
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;
}

View File

@ -1,51 +1,34 @@
/// <reference types="node" />
/// <reference types="node" />
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;
}

View File

@ -0,0 +1,26 @@
/// <reference types="node" />
/// <reference types="node" />
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;
}

View File

@ -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;
}

View File

@ -0,0 +1,8 @@
export declare enum HttpMethods {
OPTIONS = "OPTIONS",
GET = "GET",
POST = "POST",
PUT = "PUT",
PATCH = "PATCH",
DELETE = "DELETE"
}

View File

@ -0,0 +1,6 @@
/// <reference types="node" />
import { IncomingMessage, ServerResponse } from "http";
export interface IHttpListener {
canHandle(sessionId: string, req: IncomingMessage): boolean;
handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): void;
}

View File

@ -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;
/**

View File

@ -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;
}

View File

@ -0,0 +1,10 @@
/// <reference types="node" />
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;
}

View File

@ -0,0 +1,8 @@
/// <reference types="node" />
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;
}

View File

@ -0,0 +1,8 @@
/// <reference types="node" />
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;
}

View File

@ -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
}

View File

@ -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;
}
}
}

View File

@ -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;
}

View File

@ -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)
{

View File

@ -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)
{

View File

@ -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<string, ITemplateItem>;
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"));
}

View File

@ -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)
{

View File

@ -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");
}
}
}

View File

@ -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", CWX_ConfigHandler, {lifecycle:Lifecycle.Singleton})
container.register<CWX_GlobalsConfig>("CWX_GlobalsConfig", CWX_GlobalsConfig);
container.register<CWX_RagfairConfig>("CWX_RagfairConfig", CWX_RagfairConfig);
container.register<CWX_LocationConfig>("CWX_LocationConfig", CWX_LocationConfig);
container.register<CWX_InraidConfig>("CWX_InraidConfig", CWX_InraidConfig);
container.register<CWX_ItemsConfig>("CWX_ItemsConfig", CWX_ItemsConfig);
container.register<CWX_Logging>("CWX_Logging", CWX_Logging);
container.register<CwxConfigHandler>("CwxConfigHandler", CwxConfigHandler, {lifecycle:Lifecycle.Singleton})
container.register<CwxGlobalsConfig>("CwxGlobalsConfig", CwxGlobalsConfig);
container.register<CwxRagfairConfig>("CwxRagfairConfig", CwxRagfairConfig);
container.register<CwxLocationConfig>("CwxLocationConfig", CwxLocationConfig);
container.register<CwxInraidConfig>("CwxInraidConfig", CwxInraidConfig);
container.register<CwxItemsConfig>("CwxItemsConfig", CwxItemsConfig);
container.register<CwxAirdropConfig>("CwxAirdropConfig", CwxAirdropConfig);
container.register<CwxLogging>("CwxLogging", CwxLogging);
container.resolve<CWX_GlobalsConfig>("CWX_GlobalsConfig").applyChanges();
container.resolve<CWX_RagfairConfig>("CWX_RagfairConfig").applyChanges();
container.resolve<CWX_LocationConfig>("CWX_LocationConfig").applyChanges();
container.resolve<CWX_InraidConfig>("CWX_InraidConfig").applyChanges();
container.resolve<CWX_ItemsConfig>("CWX_ItemsConfig").applyChanges();
container.resolve<CwxGlobalsConfig>("CwxGlobalsConfig").applyChanges();
container.resolve<CwxRagfairConfig>("CwxRagfairConfig").applyChanges();
container.resolve<CwxLocationConfig>("CwxLocationConfig").applyChanges();
container.resolve<CwxInraidConfig>("CwxInraidConfig").applyChanges();
container.resolve<CwxItemsConfig>("CwxItemsConfig").applyChanges();
container.resolve<CwxAirdropConfig>("CwxAirdropConfig").applyChanges();
if (container.resolve<CWX_ConfigHandler>("CWX_ConfigHandler").getConfig().showLogs)
if (container.resolve<CwxConfigHandler>("CwxConfigHandler").getConfig().showLogs)
{
container.resolve<CWX_Logging>("CWX_Logging").SendLogging();
container.resolve<CwxLogging>("CwxLogging").sendLogging();
}
}
}

View File

@ -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)
{

View File

@ -0,0 +1,6 @@
export declare class ErrorHandler {
private logger;
private readLine;
constructor();
handleCriticalError(err: any): void;
}

View File

@ -1,4 +1,5 @@
export declare class Program {
private errorHandler;
constructor();
start(): void;
}

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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<DialogueInfo[]>;
/**
* 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;
}

View File

@ -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;
}

View File

@ -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<string, ITraderAssort>, 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<string, number>;
/**
* 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<string, ITraderAssort>, 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

View File

@ -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;

View File

@ -1,5 +1,6 @@
import { IHttpServer } from "../models/spt/server/IHttpServer";
/// <reference types="node" />
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;
}

View File

@ -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<string, {
current: number;
max: number;
}>, result: LootItem[]): boolean;
}>, itemBlacklist: string[], result: LootItem[]): boolean;
}

View File

@ -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;
/**

View File

@ -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

View File

@ -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[];
}

View File

@ -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
*/

View File

@ -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<string, ITraderAssort>, pmcProfile: IPmcData): IRagfairOffer[];
getOffersForBuild(info: ISearchRequestData, itemsToAdd: string[], assorts: Record<string, ITraderAssort>, 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;

View File

@ -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;
}

View File

@ -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<string, IPackageJsonData>;
/**
* 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[];

View File

@ -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;

View File

@ -9,6 +9,7 @@ export interface IRagfairOffer {
intId: number;
itemsCost: number;
requirementsCost: number;
sptRequirementsCostRouble: number;
startTime: number;
endTime: number;
sellInOnePiece: boolean;

View File

@ -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;

View File

@ -0,0 +1,7 @@
export declare enum RagfairSort {
ID = 0,
RATING = 3,
OFFER_TITLE = 4,
PRICE = 5,
EXPIRY = 6
}

View File

@ -0,0 +1,33 @@
/// <reference types="node" />
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) => <T extends new (...args: any[]) => 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;

View File

@ -1,5 +1,6 @@
import { IBaseConfig } from "./IBaseConfig";
export interface IHttpConfig extends IBaseConfig {
webSocketPingDelayMs: number;
kind: "aki-http";
ip: string;
port: number;

Some files were not shown because too many files have changed in this diff Show More