Merge pull request '3.2.1 update' (#7) from clodan/ModExamples:321-update into master

Reviewed-on: #7
This commit is contained in:
chomp 2022-08-15 21:08:34 +00:00
commit 8c9fad5dc0
564 changed files with 4699 additions and 1967 deletions

View File

@ -4,7 +4,7 @@
"main": "src/mod.js", "main": "src/mod.js",
"license": "MIT", "license": "MIT",
"author": "Chomp", "author": "Chomp",
"akiVersion": "3.1.1", "akiVersion": "3.2.1",
"scripts": { "scripts": {
"setup:environment": "npm i", "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", "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

@ -1,5 +1,5 @@
import { InsuranceController } from "../controllers/InsuranceController"; import { InsuranceController } from "../controllers/InsuranceController";
import { OnLoadOnUpdate } from "../di/OnLoadOnUpdate"; import { OnUpdate } from "../di/OnUpdate";
import { IPmcData } from "../models/eft/common/IPmcData"; import { IPmcData } from "../models/eft/common/IPmcData";
import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData";
import { IGetInsuranceCostRequestData } from "../models/eft/insurance/IGetInsuranceCostRequestData"; import { IGetInsuranceCostRequestData } from "../models/eft/insurance/IGetInsuranceCostRequestData";
@ -10,14 +10,13 @@ import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig";
import { ConfigServer } from "../servers/ConfigServer"; import { ConfigServer } from "../servers/ConfigServer";
import { InsuranceService } from "../services/InsuranceService"; import { InsuranceService } from "../services/InsuranceService";
import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil";
export declare class InsuranceCallbacks extends OnLoadOnUpdate { export declare class InsuranceCallbacks extends OnUpdate {
protected insuranceController: InsuranceController; protected insuranceController: InsuranceController;
protected insuranceService: InsuranceService; protected insuranceService: InsuranceService;
protected httpResponse: HttpResponseUtil; protected httpResponse: HttpResponseUtil;
protected configServer: ConfigServer; protected configServer: ConfigServer;
protected insuranceConfig: IInsuranceConfig; protected insuranceConfig: IInsuranceConfig;
constructor(insuranceController: InsuranceController, insuranceService: InsuranceService, httpResponse: HttpResponseUtil, configServer: ConfigServer); constructor(insuranceController: InsuranceController, insuranceService: InsuranceService, httpResponse: HttpResponseUtil, configServer: ConfigServer);
onLoad(): void;
getInsuranceCost(url: string, info: IGetInsuranceCostRequestData, sessionID: string): IGetBodyResponseData<IGetInsuranceCostResponseData>; getInsuranceCost(url: string, info: IGetInsuranceCostRequestData, sessionID: string): IGetBodyResponseData<IGetInsuranceCostResponseData>;
insure(pmcData: IPmcData, body: IInsureRequestData, sessionID: string): IItemEventRouterResponse; insure(pmcData: IPmcData, body: IInsureRequestData, sessionID: string): IItemEventRouterResponse;
onUpdate(secondsSinceLastRun: number): boolean; onUpdate(secondsSinceLastRun: number): boolean;

View File

@ -9,10 +9,10 @@ export declare class TraderCallbacks extends OnLoadOnUpdate {
protected traderController: TraderController; protected traderController: TraderController;
constructor(httpResponse: HttpResponseUtil, traderController: TraderController); constructor(httpResponse: HttpResponseUtil, traderController: TraderController);
onLoad(): void; onLoad(): void;
onUpdate(): boolean;
getRoute(): string; getRoute(): string;
getTraderSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<ITraderBase[]>; getTraderSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<ITraderBase[]>;
getProfilePurchases(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<Record<string, IBarterScheme[][]>>; getProfilePurchases(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<Record<string, IBarterScheme[][]>>;
getTrader(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<ITraderBase>; getTrader(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<ITraderBase>;
getAssort(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<ITraderAssort>; getAssort(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<ITraderAssort>;
onUpdate(): boolean;
} }

View File

@ -25,4 +25,5 @@ export declare class GameController {
protected logProfileDetails(fullProfile: IAkiProfile): void; protected logProfileDetails(fullProfile: IAkiProfile): void;
getGameConfig(sessionID: string): IGameConfigResponse; getGameConfig(sessionID: string): IGameConfigResponse;
getServer(): any[]; getServer(): any[];
getValidGameVersion(): any;
} }

View File

@ -28,6 +28,7 @@ import { HashUtil } from "../utils/HashUtil";
import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil";
import { RandomUtil } from "../utils/RandomUtil"; import { RandomUtil } from "../utils/RandomUtil";
import { TimeUtil } from "../utils/TimeUtil"; import { TimeUtil } from "../utils/TimeUtil";
import { JsonUtil } from "../utils/JsonUtil";
export declare class HideoutController { export declare class HideoutController {
protected logger: ILogger; protected logger: ILogger;
protected hashUtil: HashUtil; protected hashUtil: HashUtil;
@ -45,9 +46,10 @@ export declare class HideoutController {
protected hideoutHelper: HideoutHelper; protected hideoutHelper: HideoutHelper;
protected scavCaseRewardGenerator: ScavCaseRewardGenerator; protected scavCaseRewardGenerator: ScavCaseRewardGenerator;
protected configServer: ConfigServer; protected configServer: ConfigServer;
protected jsonUtil: JsonUtil;
protected static nameBackendCountersCrafting: string; protected static nameBackendCountersCrafting: string;
protected hideoutConfig: IHideoutConfig; protected hideoutConfig: IHideoutConfig;
constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, itemEventRouter: ItemEventRouter, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, configServer: ConfigServer); constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, itemEventRouter: ItemEventRouter, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, configServer: ConfigServer, jsonUtil: JsonUtil);
upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse;
upgradeComplete(pmcData: IPmcData, body: HideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; upgradeComplete(pmcData: IPmcData, body: HideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse;
/** /**

View File

@ -5,9 +5,11 @@ import { ItemHelper } from "../helpers/ItemHelper";
import { ProfileHelper } from "../helpers/ProfileHelper"; import { ProfileHelper } from "../helpers/ProfileHelper";
import { QuestHelper } from "../helpers/QuestHelper"; import { QuestHelper } from "../helpers/QuestHelper";
import { TraderHelper } from "../helpers/TraderHelper"; import { TraderHelper } from "../helpers/TraderHelper";
import { IPmcData } from "../models/eft/common/IPmcData";
import { IRegisterPlayerRequestData } from "../models/eft/inRaid/IRegisterPlayerRequestData"; import { IRegisterPlayerRequestData } from "../models/eft/inRaid/IRegisterPlayerRequestData";
import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData";
import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; import { IInRaidConfig } from "../models/spt/config/IInRaidConfig";
import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer"; import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer"; import { DatabaseServer } from "../servers/DatabaseServer";
import { SaveServer } from "../servers/SaveServer"; import { SaveServer } from "../servers/SaveServer";
@ -15,6 +17,7 @@ import { InsuranceService } from "../services/InsuranceService";
import { JsonUtil } from "../utils/JsonUtil"; import { JsonUtil } from "../utils/JsonUtil";
import { TimeUtil } from "../utils/TimeUtil"; import { TimeUtil } from "../utils/TimeUtil";
export declare class InraidController { export declare class InraidController {
protected logger: ILogger;
protected saveServer: SaveServer; protected saveServer: SaveServer;
protected jsonUtil: JsonUtil; protected jsonUtil: JsonUtil;
protected timeUtil: TimeUtil; protected timeUtil: TimeUtil;
@ -29,7 +32,7 @@ export declare class InraidController {
protected inRaidHelper: InRaidHelper; protected inRaidHelper: InRaidHelper;
protected configServer: ConfigServer; protected configServer: ConfigServer;
protected inraidConfig: IInRaidConfig; protected inraidConfig: IInRaidConfig;
constructor(saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, configServer: ConfigServer); constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, configServer: ConfigServer);
addPlayer(sessionID: string, info: IRegisterPlayerRequestData): void; addPlayer(sessionID: string, info: IRegisterPlayerRequestData): void;
saveProgress(offraidData: ISaveProgressRequestData, sessionID: string): void; saveProgress(offraidData: ISaveProgressRequestData, sessionID: string): void;
/** /**
@ -38,7 +41,7 @@ export declare class InraidController {
* @param pmcData player profile * @param pmcData player profile
* @param isPlayerScav Was the player a pScav * @param isPlayerScav Was the player a pScav
*/ */
private markOrRemoveFoundInRaidItems; protected markOrRemoveFoundInRaidItems(offraidData: ISaveProgressRequestData, pmcData: IPmcData, isPlayerScav: boolean): void;
private handlePostRaidPlayerScavProcess; protected handlePostRaidPlayerScavProcess(scavData: IPmcData, sessionID: string, offraidData: ISaveProgressRequestData, pmcData: IPmcData, isDead: boolean): void;
private handlePostRaidPlayerScavKarmaChanges; protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData, scavData: IPmcData, sessionID: string): void;
} }

View File

@ -11,21 +11,25 @@ import { IJoinMatchResult } from "../models/eft/match/IJoinMatchResult";
import { IStartOfflineRaidRequestData } from "../models/eft/match/IStartOffineRaidRequestData"; import { IStartOfflineRaidRequestData } from "../models/eft/match/IStartOffineRaidRequestData";
import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; import { IInRaidConfig } from "../models/spt/config/IInRaidConfig";
import { IMatchConfig } from "../models/spt/config/IMatchConfig"; import { IMatchConfig } from "../models/spt/config/IMatchConfig";
import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer"; import { ConfigServer } from "../servers/ConfigServer";
import { SaveServer } from "../servers/SaveServer"; import { SaveServer } from "../servers/SaveServer";
import { BotLootCacheService } from "../services/BotLootCacheService"; import { BotLootCacheService } from "../services/BotLootCacheService";
import { MatchLocationService } from "../services/MatchLocationService"; import { MatchLocationService } from "../services/MatchLocationService";
import { ProfileSnapshotService } from "../services/ProfileSnapshotService";
export declare class MatchController { export declare class MatchController {
protected logger: ILogger;
protected saveServer: SaveServer; protected saveServer: SaveServer;
protected profileHelper: ProfileHelper; protected profileHelper: ProfileHelper;
protected matchLocationService: MatchLocationService; protected matchLocationService: MatchLocationService;
protected traderHelper: TraderHelper; protected traderHelper: TraderHelper;
protected botLootCacheService: BotLootCacheService; protected botLootCacheService: BotLootCacheService;
protected configServer: ConfigServer; protected configServer: ConfigServer;
protected profileSnapshotService: ProfileSnapshotService;
protected applicationContext: ApplicationContext; protected applicationContext: ApplicationContext;
protected matchConfig: IMatchConfig; protected matchConfig: IMatchConfig;
protected inraidConfig: IInRaidConfig; protected inraidConfig: IInRaidConfig;
constructor(saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, applicationContext: ApplicationContext); constructor(logger: ILogger, saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, applicationContext: ApplicationContext);
getEnabled(): boolean; getEnabled(): boolean;
getProfile(info: IGetProfileRequestData): IPmcData[]; getProfile(info: IGetProfileRequestData): IPmcData[];
createGroup(sessionID: string, info: ICreateGroupRequestData): any; createGroup(sessionID: string, info: ICreateGroupRequestData): any;

View File

@ -17,10 +17,25 @@ export declare class TraderController {
protected traderAssortService: TraderAssortService; protected traderAssortService: TraderAssortService;
protected jsonUtil: JsonUtil; protected jsonUtil: JsonUtil;
constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, timeUtil: TimeUtil, traderAssortService: TraderAssortService, jsonUtil: JsonUtil); constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, timeUtil: TimeUtil, traderAssortService: TraderAssortService, jsonUtil: JsonUtil);
/**
* Runs when onLoad event is fired
* Iterate over traders, ensure an unmolested copy of their assorts is stored in traderAssortService
* Store timestamp of next assort refresh in nextResupply property of traders .base object
*/
load(): void; load(): void;
getTrader(traderID: string, sessionID: string): ITraderBase; /**
* Runs when onUpdate is fired
* If current time is > nextResupply(expire) time of trader, refresh traders assorts and
* @returns has run
*/
update(): boolean;
/**
* Return an array of all traders
* @param sessionID Session id
* @returns array if ITraderBase objects
*/
getAllTraders(sessionID: string): ITraderBase[]; getAllTraders(sessionID: string): ITraderBase[];
updateTraders(): boolean; getTrader(sessionID: string, traderID: string): ITraderBase;
getAssort(sessionId: string, traderId: string): ITraderAssort; getAssort(sessionId: string, traderId: string): ITraderAssort;
getPurchasesData(traderID: string, sessionID: string): Record<string, IBarterScheme[][]>; getPurchasesData(sessionID: string, traderID: string): Record<string, IBarterScheme[][]>;
} }

View File

@ -41,15 +41,37 @@ export declare class RagfairOfferGenerator {
createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer;
protected getTraderId(userID: string): string; protected getTraderId(userID: string): string;
protected getRating(userID: string): number; protected getRating(userID: string): number;
/**
* Is the offers user rating growing
* @param userID user to check rating of
* @returns true if its growing
*/
protected getRatingGrowing(userID: string): boolean; protected getRatingGrowing(userID: string): boolean;
/**
* Get number of section until offer should expire
* @param userID Id of the offer owner
* @param time Time the offer is posted
* @returns number of seconds until offer expires
*/
protected getOfferEndTime(userID: string, time: number): number; protected getOfferEndTime(userID: string, time: number): number;
/** /**
* Create multiple offers for items by using a unique list of items we've generated previously * Create multiple offers for items by using a unique list of items we've generated previously
* @param expiredOffers * @param expiredOffers optional, expired offers to regenerate
*/ */
generateDynamicOffers(expiredOffers?: Item[]): void; generateDynamicOffers(expiredOffers?: Item[]): void;
generateTraderOffers(traderID: string): void; /**
* Generate trader offers on flea using the traders assort data
* @param traderID Trader to generate offers for
*/
generateFleaOffersForTrader(traderID: string): void;
protected getItemCondition(userID: string, items: Item[], itemDetails: ITemplateItem): Item[]; protected getItemCondition(userID: string, items: Item[], itemDetails: ITemplateItem): Item[];
/**
* Add missing conditions to an item if needed
* Durabiltiy for repairable items
* HpResource for medical items
* @param item item to add conditions to
* @returns Item with conditions added
*/
protected addMissingCondition(item: Item): Item; protected addMissingCondition(item: Item): Item;
protected getOfferRequirements(items: Item[]): { protected getOfferRequirements(items: Item[]): {
count: number; count: number;
@ -57,6 +79,14 @@ export declare class RagfairOfferGenerator {
}[]; }[];
/** /**
* Create a flea offer and store it in the Ragfair server offers array * Create a flea offer and store it in the Ragfair server offers array
* @param userID owner of the offer
* @param time time offer is put up
* @param items items in the offer
* @param barterScheme
* @param loyalLevel
* @param price price of offer
* @param sellInOnePiece
* @returns
*/ */
createFleaOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; createFleaOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer;
} }

View File

@ -5,6 +5,7 @@ import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequ
import { ILogger } from "../models/spt/utils/ILogger"; import { ILogger } from "../models/spt/utils/ILogger";
import { DatabaseServer } from "../servers/DatabaseServer"; import { DatabaseServer } from "../servers/DatabaseServer";
import { SaveServer } from "../servers/SaveServer"; import { SaveServer } from "../servers/SaveServer";
import { ProfileFixerService } from "../services/ProfileFixerService";
import { JsonUtil } from "../utils/JsonUtil"; import { JsonUtil } from "../utils/JsonUtil";
import { InventoryHelper } from "./InventoryHelper"; import { InventoryHelper } from "./InventoryHelper";
import { PaymentHelper } from "./PaymentHelper"; import { PaymentHelper } from "./PaymentHelper";
@ -15,7 +16,8 @@ export declare class InRaidHelper {
protected databaseServer: DatabaseServer; protected databaseServer: DatabaseServer;
protected inventoryHelper: InventoryHelper; protected inventoryHelper: InventoryHelper;
protected paymentHelper: PaymentHelper; protected paymentHelper: PaymentHelper;
constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper); protected profileFixerService: ProfileFixerService;
constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper, profileFixerService: ProfileFixerService);
/** /**
* Reset the SPT inraid property stored in a profile to 'none' * Reset the SPT inraid property stored in a profile to 'none'
* @param sessionID Session id * @param sessionID Session id

View File

@ -43,6 +43,7 @@ export declare class InventoryHelper {
constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, configServer: ConfigServer); constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, configServer: ConfigServer);
addItem(pmcData: IPmcData, body: IAddItemRequestData, output: IItemEventRouterResponse, sessionID: string, callback: any, foundInRaid?: boolean, addUpd?: any): IItemEventRouterResponse; addItem(pmcData: IPmcData, body: IAddItemRequestData, output: IItemEventRouterResponse, sessionID: string, callback: any, foundInRaid?: boolean, addUpd?: any): IItemEventRouterResponse;
removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse;
removeItemByCount(pmcData: IPmcData, itemId: string, count: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse;
getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): Record<number, number>; getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): Record<number, number>;
protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): Record<number, number>; protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): Record<number, number>;
protected getInventoryItemHash(inventoryItem: Item[]): InventoryHelper.InventoryItemHash; protected getInventoryItemHash(inventoryItem: Item[]): InventoryHelper.InventoryItemHash;

View File

@ -2,22 +2,26 @@ import { IPmcData } from "../models/eft/common/IPmcData";
import { Stats } from "../models/eft/common/tables/IBotBase"; import { Stats } from "../models/eft/common/tables/IBotBase";
import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile";
import { IValidateNicknameRequestData } from "../models/eft/profile/IValidateNicknameRequestData"; import { IValidateNicknameRequestData } from "../models/eft/profile/IValidateNicknameRequestData";
import { ILogger } from "../models/spt/utils/ILogger";
import { DatabaseServer } from "../servers/DatabaseServer"; import { DatabaseServer } from "../servers/DatabaseServer";
import { SaveServer } from "../servers/SaveServer"; import { SaveServer } from "../servers/SaveServer";
import { FenceService } from "../services/FenceService"; import { FenceService } from "../services/FenceService";
import { ProfileSnapshotService } from "../services/ProfileSnapshotService";
import { JsonUtil } from "../utils/JsonUtil"; import { JsonUtil } from "../utils/JsonUtil";
import { TimeUtil } from "../utils/TimeUtil"; import { TimeUtil } from "../utils/TimeUtil";
import { Watermark } from "../utils/Watermark"; import { Watermark } from "../utils/Watermark";
import { ItemHelper } from "./ItemHelper"; import { ItemHelper } from "./ItemHelper";
export declare class ProfileHelper { export declare class ProfileHelper {
protected logger: ILogger;
protected jsonUtil: JsonUtil; protected jsonUtil: JsonUtil;
protected watermark: Watermark; protected watermark: Watermark;
protected timeUtil: TimeUtil; protected timeUtil: TimeUtil;
protected saveServer: SaveServer; protected saveServer: SaveServer;
protected databaseServer: DatabaseServer; protected databaseServer: DatabaseServer;
protected itemHelper: ItemHelper; protected itemHelper: ItemHelper;
protected profileSnapshotService: ProfileSnapshotService;
protected fenceService: FenceService; protected fenceService: FenceService;
constructor(jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, fenceService: FenceService); constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, fenceService: FenceService);
resetProfileQuestCondition(sessionID: string, conditionId: string): void; resetProfileQuestCondition(sessionID: string, conditionId: string): void;
getCompleteProfile(sessionID: string): IPmcData[]; getCompleteProfile(sessionID: string): IPmcData[];
isNicknameTaken(info: IValidateNicknameRequestData, sessionID: string): boolean; isNicknameTaken(info: IValidateNicknameRequestData, sessionID: string): boolean;

View File

@ -42,7 +42,15 @@ export declare class QuestHelper {
*/ */
evaluateLevel(pmcProfile: IPmcData, cond: AvailableForConditions): boolean; evaluateLevel(pmcProfile: IPmcData, cond: AvailableForConditions): boolean;
getDeltaQuests(before: IQuest[], after: IQuest[]): IQuest[]; getDeltaQuests(before: IQuest[], after: IQuest[]): IQuest[];
rewardSkillPoints(sessionID: string, pmcData: IPmcData, output: IItemEventRouterResponse, skillName: string, progress: number): void; /**
* Increase skill points of a skill on player profile
* @param sessionID Session id
* @param pmcData Player profile
* @param output output object to send back to client
* @param skillName Name of skill to increase skill points of
* @param progressAmount Amount of skill points to add to skill
*/
rewardSkillPoints(sessionID: string, pmcData: IPmcData, output: IItemEventRouterResponse, skillName: string, progressAmount: number): void;
getQuestLocale(questId: string): any; getQuestLocale(questId: string): any;
/** /**
* Debug Routine for showing some information on the * Debug Routine for showing some information on the

View File

@ -1,7 +1,8 @@
import { RagfairAssortGenerator } from "../generators/RagfairAssortGenerator"; import { RagfairAssortGenerator } from "../generators/RagfairAssortGenerator";
import { RagfairOfferGenerator } from "../generators/RagfairOfferGenerator"; import { RagfairOfferGenerator } from "../generators/RagfairOfferGenerator";
import { IPmcData } from "../models/eft/common/IPmcData";
import { Item } from "../models/eft/common/tables/IItem"; import { Item } from "../models/eft/common/tables/IItem";
import { ITraderAssort } from "../models/eft/common/tables/ITrader"; import { ITrader, ITraderAssort } from "../models/eft/common/tables/ITrader";
import { ITraderConfig } from "../models/spt/config/ITraderConfig"; import { ITraderConfig } from "../models/spt/config/ITraderConfig";
import { ILogger } from "../models/spt/utils/ILogger"; import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer"; import { ConfigServer } from "../servers/ConfigServer";
@ -10,13 +11,16 @@ import { FenceService } from "../services/FenceService";
import { TraderAssortService } from "../services/TraderAssortService"; import { TraderAssortService } from "../services/TraderAssortService";
import { JsonUtil } from "../utils/JsonUtil"; import { JsonUtil } from "../utils/JsonUtil";
import { MathUtil } from "../utils/MathUtil"; import { MathUtil } from "../utils/MathUtil";
import { TimeUtil } from "../utils/TimeUtil";
import { AssortHelper } from "./AssortHelper"; import { AssortHelper } from "./AssortHelper";
import { PaymentHelper } from "./PaymentHelper"; import { PaymentHelper } from "./PaymentHelper";
import { ProfileHelper } from "./ProfileHelper"; import { ProfileHelper } from "./ProfileHelper";
import { TraderHelper } from "./TraderHelper";
export declare class TraderAssortHelper { export declare class TraderAssortHelper {
protected logger: ILogger; protected logger: ILogger;
protected jsonUtil: JsonUtil; protected jsonUtil: JsonUtil;
protected mathUtil: MathUtil; protected mathUtil: MathUtil;
protected timeUtil: TimeUtil;
protected databaseServer: DatabaseServer; protected databaseServer: DatabaseServer;
protected profileHelper: ProfileHelper; protected profileHelper: ProfileHelper;
protected assortHelper: AssortHelper; protected assortHelper: AssortHelper;
@ -24,18 +28,37 @@ export declare class TraderAssortHelper {
protected ragfairAssortGenerator: RagfairAssortGenerator; protected ragfairAssortGenerator: RagfairAssortGenerator;
protected ragfairOfferGenerator: RagfairOfferGenerator; protected ragfairOfferGenerator: RagfairOfferGenerator;
protected traderAssortService: TraderAssortService; protected traderAssortService: TraderAssortService;
protected traderHelper: TraderHelper;
protected fenceService: FenceService; protected fenceService: FenceService;
protected configServer: ConfigServer; protected configServer: ConfigServer;
protected traderConfig: ITraderConfig; protected traderConfig: ITraderConfig;
constructor(logger: ILogger, jsonUtil: JsonUtil, mathUtil: MathUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, paymentHelper: PaymentHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, fenceService: FenceService, configServer: ConfigServer); constructor(logger: ILogger, jsonUtil: JsonUtil, mathUtil: MathUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, paymentHelper: PaymentHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, traderHelper: TraderHelper, fenceService: FenceService, configServer: ConfigServer);
/** /**
* Get a traders assorts * Get a traders assorts
* Can be used for returning ragfair / fence assorts * Can be used for returning ragfair / fence assorts
* Filter out assorts not unlocked due to level OR quest completion
* @param sessionId session id * @param sessionId session id
* @param traderId trader id * @param traderId traders id
* @returns a traders assorts * @returns a traders' assorts
*/ */
getAssort(sessionId: string, traderId: string): ITraderAssort; getAssort(sessionId: string, traderId: string): ITraderAssort;
/**
* if the fence assorts have expired, re-generate them
* @param pmcProfile Players profile
*/
refreshFenceAssortIfExpired(pmcProfile: IPmcData): void;
/**
* Reset a traders assorts and move nextResupply value to future
* Flag trader as needing a flea offer reset to be picked up by flea update() function
* @param trader trader details to alter
*/
resetExpiredTrader(trader: ITrader): void;
/**
* Does the supplied trader need its assorts refreshed
* @param traderID Trader to check
* @returns true they need refreshing
*/
traderAssortsHaveExpired(traderID: string): boolean;
/** /**
* Iterate over all assorts barter_scheme values, find barters selling for money and multiply by multipler in config * Iterate over all assorts barter_scheme values, find barters selling for money and multiply by multipler in config
* @param traderAssort Assorts to multiple price of * @param traderAssort Assorts to multiple price of

View File

@ -9,6 +9,7 @@ import { DatabaseServer } from "../servers/DatabaseServer";
import { SaveServer } from "../servers/SaveServer"; import { SaveServer } from "../servers/SaveServer";
import { FenceService } from "../services/FenceService"; import { FenceService } from "../services/FenceService";
import { PlayerService } from "../services/PlayerService"; import { PlayerService } from "../services/PlayerService";
import { TimeUtil } from "../utils/TimeUtil";
import { HandbookHelper } from "./HandbookHelper"; import { HandbookHelper } from "./HandbookHelper";
import { ItemHelper } from "./ItemHelper"; import { ItemHelper } from "./ItemHelper";
import { PaymentHelper } from "./PaymentHelper"; import { PaymentHelper } from "./PaymentHelper";
@ -23,9 +24,10 @@ export declare class TraderHelper {
protected handbookHelper: HandbookHelper; protected handbookHelper: HandbookHelper;
protected playerService: PlayerService; protected playerService: PlayerService;
protected fenceService: FenceService; protected fenceService: FenceService;
protected timeUtil: TimeUtil;
protected configServer: ConfigServer; protected configServer: ConfigServer;
protected traderConfig: ITraderConfig; protected traderConfig: ITraderConfig;
constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, itemHelper: ItemHelper, handbookHelper: HandbookHelper, playerService: PlayerService, fenceService: FenceService, configServer: ConfigServer); constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, itemHelper: ItemHelper, handbookHelper: HandbookHelper, playerService: PlayerService, fenceService: FenceService, timeUtil: TimeUtil, configServer: ConfigServer);
getTrader(traderID: string, sessionID: string): ITraderBase; getTrader(traderID: string, sessionID: string): ITraderBase;
getTraderAssortsById(traderId: string): ITraderAssort; getTraderAssortsById(traderId: string): ITraderAssort;
/** /**
@ -97,6 +99,17 @@ export declare class TraderHelper {
* @param sessionID session id * @param sessionID session id
*/ */
lvlUp(traderID: string, sessionID: string): void; lvlUp(traderID: string, sessionID: string): void;
/**
* Get the next update timestamp for a trader
* @param traderID Trader to look up update value for
* @returns future timestamp
*/
getNextUpdateTimestamp(traderID: string): number;
/**
* Get the reset time between trader assort refreshes in seconds
* @param traderId Trader to look up
* @returns Time in seconds
*/
getTraderUpdateSeconds(traderId: string): number; getTraderUpdateSeconds(traderId: string): number;
/** /**
* check if an item is allowed to be sold to a trader * check if an item is allowed to be sold to a trader

View File

@ -32,6 +32,17 @@ export declare class PreAkiModLoader implements IModLoader {
getModPath(mod: string): string; getModPath(mod: string): string;
protected importClass(name: string, filepath: string, container: DependencyContainer): void; protected importClass(name: string, filepath: string, container: DependencyContainer): void;
protected importMods(): Promise<void>; protected importMods(): Promise<void>;
/**
* Check for duplciate mods loaded, show error if duplicate mod found
* @param modPackageData dictionary of mod package.json data
*/
protected checkForDuplicateMods(modPackageData: Record<string, IPackageJsonData>): void;
/**
* Check for and return duplicate strings inside an array
* @param stringArray Array to check for duplicates
* @returns string array of duplicates, empty if none found
*/
protected getDuplicates(stringArray: string[]): string[];
/** /**
* *
* @param mods Get an array of broken/invalid mods by name * @param mods Get an array of broken/invalid mods by name

View File

@ -137,7 +137,7 @@ export interface BotLocationModifier {
VisibleDistance: number; VisibleDistance: number;
} }
export interface MinMaxBot { export interface MinMaxBot {
WildSpawnType: string; WildSpawnType: WildSpawnType;
max: number; max: number;
min: number; min: number;
} }
@ -195,7 +195,7 @@ export interface Wave {
BotPreset: string; BotPreset: string;
BotSide: string; BotSide: string;
SpawnPoints: string; SpawnPoints: string;
WildSpawnType: string; WildSpawnType: WildSpawnType;
isPlayers: boolean; isPlayers: boolean;
number: number; number: number;
slots_max: number; slots_max: number;
@ -203,3 +203,7 @@ export interface Wave {
time_max: number; time_max: number;
time_min: number; time_min: number;
} }
export declare enum WildSpawnType {
ASSAULT = "assault",
MARKSMAN = "marksman"
}

View File

@ -66,13 +66,13 @@ export interface IBan {
dateTime: number; dateTime: number;
} }
export declare enum BanType { export declare enum BanType {
Chat = 0, CHAT = 0,
RagFair = 1, RAGFAIR = 1,
Voip = 2, VOIP = 2,
Trading = 3, TRADING = 3,
Online = 4, ONLINE = 4,
Friends = 5, FRIENDS = 5,
ChangeNickname = 6 CHANGE_NICKNAME = 6
} }
export interface Customization { export interface Customization {
Head: string; Head: string;
@ -312,11 +312,11 @@ export interface Notes {
export interface CarExtractCounts { export interface CarExtractCounts {
} }
export declare enum SurvivorClass { export declare enum SurvivorClass {
Unknown = 0, UNKNOWN = 0,
Neutralizer = 1, NEUTRALIZER = 1,
Marauder = 2, MARAUDER = 2,
Paramedic = 3, PARAMEDIC = 3,
Survivor = 4 SURVIVOR = 4
} }
export interface Quest { export interface Quest {
qid: string; qid: string;

View File

@ -7,7 +7,7 @@ export interface ITrader {
suits?: ISuit[]; suits?: ISuit[];
} }
export interface ITraderBase { export interface ITraderBase {
refreshAssort: boolean; refreshTraderRagfairOffers: boolean;
_id: string; _id: string;
avatar: string; avatar: string;
balance_dol: number; balance_dol: number;
@ -58,7 +58,7 @@ export interface Repair {
quality: string; quality: string;
} }
export interface ITraderAssort { export interface ITraderAssort {
nextResupply?: number; nextResupply: number;
items: Item[]; items: Item[];
barter_scheme: Record<string, IBarterScheme[][]>; barter_scheme: Record<string, IBarterScheme[][]>;
loyal_level_items: Record<string, number>; loyal_level_items: Record<string, number>;

View File

@ -1,5 +1,5 @@
export declare enum Effect { export declare enum Effect {
Fracture = "Fracture", FRACTURE = "Fracture",
LightBleeding = "LightBleeding", LIGHT_BLEEDING = "LightBleeding",
HeavyBleeding = "HeavyBleeding" HEAVY_BLEEDING = "HeavyBleeding"
} }

View File

@ -7,12 +7,12 @@ export interface IOffraidHealRequestData extends IBaseInteractionRequestData {
time: number; time: number;
} }
export declare enum BodyPart { export declare enum BodyPart {
Head = 0, HEAD = "Head",
Chest = 1, CHEST = "Chest",
Stomach = 2, STOMACH = "Stomach",
LeftArm = 3, LEFT_ARM = "LeftArm",
RightArm = 4, RIGHT_ARM = "RightArm",
LeftLeg = 5, LEFT_LEG = "LeftLeg",
RightLeg = 6, RIGHT_LEG = "RightLeg",
Common = 7 COMMON = "Common"
} }

View File

@ -1,9 +1,9 @@
export interface INotifierChannel { export interface INotifierChannel {
"server": string; server: string;
"channel_id": string; channel_id: string;
"url": string; url: string;
"notifierServer": string; notifierServer: string;
"ws": string; ws: string;
} }
import { Message } from "../profile/IAkiProfile"; import { Message } from "../profile/IAkiProfile";
export interface INotification { export interface INotification {

View File

@ -1,7 +1,7 @@
export declare enum BotAmount { export declare enum BotAmount {
AsOnline = "AsOnline", AS_ONLINE = "AsOnline",
Low = "Low", LOW = "Low",
Medium = "Medium", MEDIUM = "Medium",
High = "High", HIGH = "High",
Horde = "Horde" HORDE = "Horde"
} }

View File

@ -1,8 +1,8 @@
export declare enum BotDifficulty { export declare enum BotDifficulty {
AsOnline = "AsOnline", AS_ONLINE = "AsOnline",
Easy = "Easy", EASY = "Easy",
Medium = "Medium", MEDIUM = "Medium",
Hard = "Hard", HARD = "Hard",
Impossible = "Impossible", IMPOSSIBLE = "Impossible",
Random = "Random" RANDOM = "Random"
} }

View File

@ -1,13 +1,13 @@
export declare enum MemberCategory { export declare enum MemberCategory {
Default = 0, DEFAULT = 0,
Developer = 1, DEVELOPER = 1,
UniqueId = 2, UNIQUE_ID = 2,
Trader = 4, TRADER = 4,
Group = 8, GROUP = 8,
System = 16, SYSTEM = 16,
ChatModerator = 32, CHAT_MODERATOR = 32,
ChatModeratorWithPermanentBan = 64, CHAT_MODERATOR_WITH_PERMANENT_BAN = 64,
UnitTest = 128, UNIT_TEST = 128,
Sherpa = 256, SHERPA = 256,
Emissary = 512 EMISSARY = 512
} }

View File

@ -1,8 +1,8 @@
export declare enum QuestRewardType { export declare enum QuestRewardType {
Skill = "Skill", SKILL = "Skill",
Experience = "Experience", EXPERIENCE = "Experience",
TraderStanding = "TraderStanding", TRADER_STANDING = "TraderStanding",
TraderUnlock = "TraderUnlock", TRADER_UNLOCK = "TraderUnlock",
Item = "Item", ITEM = "Item",
AssortmentUnlock = "AssortmentUnlock" ASSORTMENT_UNLOCK = "AssortmentUnlock"
} }

View File

@ -1,5 +1,5 @@
export declare enum RaidMode { export declare enum RaidMode {
Online = "Online", ONLINE = "Online",
Local = "Local", LOCAL = "Local",
Coop = "Coop" COOP = "Coop"
} }

View File

@ -11,13 +11,13 @@ export declare class BotLootCache {
grenadeItems: ITemplateItem[]; grenadeItems: ITemplateItem[];
} }
export declare enum LootCacheType { export declare enum LootCacheType {
Special = "Special", SPECIAL = "Special",
Backpack = "Backpack", BACKPACK = "Backpack",
Pocket = "Pocket", POCKET = "Pocket",
Vest = "Vest", VEST = "Vest",
Combined = "Combined", COMBINED = "Combined",
HealingItems = "HealingItems", HEALING_ITEMS = "HealingItems",
DrugItems = "DrugItems", DRUG_ITEMS = "DrugItems",
StimItems = "StimItems", STIM_ITEMS = "StimItems",
GrenadeItems = "GrenadeItems" GRENADE_ITEMS = "GrenadeItems"
} }

View File

@ -2,6 +2,10 @@ import { IBaseConfig } from "./IBaseConfig";
export interface IHideoutConfig extends IBaseConfig { export interface IHideoutConfig extends IBaseConfig {
kind: "aki-hideout"; kind: "aki-hideout";
runIntervalSeconds: number; runIntervalSeconds: number;
fuelDrainRateMultipler: number;
hoursForSkillCrafting: number; hoursForSkillCrafting: number;
generatorSpeedWithoutFuel: number;
generatorFuelFlowRate: number;
airFilterUnitFlowRate: number;
/** SEE HIDEOUTHELPER BEFORE CHANGING CONFIG */
gpuBoostRate: number;
} }

View File

@ -27,7 +27,13 @@ export interface Reputation {
gain: number; gain: number;
loss: number; loss: number;
} }
export declare class OfferAdjustment {
maxPriceDifferenceBelowHandbookPercent: number;
handbookPriceMultipier: number;
priceThreshholdRub: number;
}
export interface Dynamic { export interface Dynamic {
offerAdjustment: OfferAdjustment;
expiredOfferThreshold: number; expiredOfferThreshold: number;
offerItemCount: MinMax; offerItemCount: MinMax;
price: MinMax; price: MinMax;

View File

@ -1,11 +1,11 @@
export declare enum LogBackgroundColor { export declare enum LogBackgroundColor {
default = "", DEFAULT = "",
black = "blackBG", BLACK = "blackBG",
red = "redBG", RED = "redBG",
green = "greenBG", GREEN = "greenBG",
yellow = "yellowBG", YELLOW = "yellowBG",
blue = "blueBG", BLUE = "blueBG",
magenta = "magentaBG", MAGENTA = "magentaBG",
cyan = "cyanBG", CYAN = "cyanBG",
white = "whiteBG" WHITE = "whiteBG"
} }

View File

@ -1,11 +1,11 @@
export declare enum LogTextColor { export declare enum LogTextColor {
black = "black", BLACK = "black",
red = "red", RED = "red",
green = "green", GREEN = "green",
yellow = "yellow", YELLOW = "yellow",
blue = "blue", BLUE = "blue",
magenta = "magenta", MAGENTA = "magenta",
cyan = "cyan", CYAN = "cyan",
white = "white", WHITE = "white",
gray = "" GRAY = ""
} }

View File

@ -13,10 +13,10 @@ export interface ILocaleGlobalBase {
season: Record<string, string>; season: Record<string, string>;
customization: Record<string, ILocaleProps>; customization: Record<string, ILocaleProps>;
repeatableQuest: Record<string, string>; repeatableQuest: Record<string, string>;
templates: ILocaleTemplateBase; templates: Record<string, ILocaleProps>;
locations: ILocaleLocationsBase; locations: Record<string, ILocaleProps>;
banners: ILocaleBannersBase; banners: Record<string, ILocaleProps>;
trading: ILocaleTradingBase; trading: Record<string, ILocaleTradingProps>;
} }
export interface ILocaleQuest { export interface ILocaleQuest {
name: string; name: string;
@ -31,23 +31,11 @@ export interface ILocaleQuest {
export interface ILocalePreset { export interface ILocalePreset {
Name: string; Name: string;
} }
export interface ILocaleTemplateBase {
templates: Record<string, ILocaleProps>;
}
export interface ILocaleLocationsBase {
locations: Record<string, ILocaleProps>;
}
export interface ILocaleBannersBase {
locations: Record<string, ILocaleProps>;
}
export interface ILocaleProps { export interface ILocaleProps {
Name: string; Name: string;
ShortName: string; ShortName: string;
Description: string; Description: string;
} }
export interface ILocaleTradingBase {
locations: Record<string, ILocaleTradingProps>;
}
export interface ILocaleTradingProps { export interface ILocaleTradingProps {
FullName: string; FullName: string;
FirstName: string; FirstName: string;

View File

@ -1,4 +1,6 @@
import { RagfairOfferGenerator } from "../generators/RagfairOfferGenerator"; import { RagfairOfferGenerator } from "../generators/RagfairOfferGenerator";
import { TraderAssortHelper } from "../helpers/TraderAssortHelper";
import { TraderHelper } from "../helpers/TraderHelper";
import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer";
import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig";
import { ILogger } from "../models/spt/utils/ILogger"; import { ILogger } from "../models/spt/utils/ILogger";
@ -12,11 +14,18 @@ export declare class RagfairServer {
protected ragfairOfferService: RagfairOfferService; protected ragfairOfferService: RagfairOfferService;
protected ragfairCategoriesService: RagfairCategoriesService; protected ragfairCategoriesService: RagfairCategoriesService;
protected ragfairRequiredItemsService: RagfairRequiredItemsService; protected ragfairRequiredItemsService: RagfairRequiredItemsService;
protected traderHelper: TraderHelper;
protected traderAssortHelper: TraderAssortHelper;
protected configServer: ConfigServer; protected configServer: ConfigServer;
protected ragfairConfig: IRagfairConfig; protected ragfairConfig: IRagfairConfig;
constructor(logger: ILogger, ragfairOfferGenerator: RagfairOfferGenerator, ragfairOfferService: RagfairOfferService, ragfairCategoriesService: RagfairCategoriesService, ragfairRequiredItemsService: RagfairRequiredItemsService, configServer: ConfigServer); constructor(logger: ILogger, ragfairOfferGenerator: RagfairOfferGenerator, ragfairOfferService: RagfairOfferService, ragfairCategoriesService: RagfairCategoriesService, ragfairRequiredItemsService: RagfairRequiredItemsService, traderHelper: TraderHelper, traderAssortHelper: TraderAssortHelper, configServer: ConfigServer);
load(): void; load(): void;
update(): void; update(): void;
/**
* Get traders who need to be periodically refreshed
* @returns string array of traders
*/
protected getUpdateableTraders(): string[];
getAllCategories(): Record<string, number>; getAllCategories(): Record<string, number>;
getBespokeCategories(offers: IRagfairOffer[]): Record<string, number>; getBespokeCategories(offers: IRagfairOffer[]): Record<string, number>;
/** /**

View File

@ -11,10 +11,12 @@ import { DatabaseServer } from "../servers/DatabaseServer";
import { HashUtil } from "../utils/HashUtil"; import { HashUtil } from "../utils/HashUtil";
import { JsonUtil } from "../utils/JsonUtil"; import { JsonUtil } from "../utils/JsonUtil";
import { RandomUtil } from "../utils/RandomUtil"; import { RandomUtil } from "../utils/RandomUtil";
import { TimeUtil } from "../utils/TimeUtil";
export declare class FenceService { export declare class FenceService {
protected logger: ILogger; protected logger: ILogger;
protected hashUtil: HashUtil; protected hashUtil: HashUtil;
protected jsonUtil: JsonUtil; protected jsonUtil: JsonUtil;
protected timeUtil: TimeUtil;
protected randomUtil: RandomUtil; protected randomUtil: RandomUtil;
protected databaseServer: DatabaseServer; protected databaseServer: DatabaseServer;
protected handbookHelper: HandbookHelper; protected handbookHelper: HandbookHelper;
@ -23,11 +25,24 @@ export declare class FenceService {
protected configServer: ConfigServer; protected configServer: ConfigServer;
protected fenceAssort: ITraderAssort; protected fenceAssort: ITraderAssort;
protected traderConfig: ITraderConfig; protected traderConfig: ITraderConfig;
constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, configServer: ConfigServer); constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, configServer: ConfigServer);
protected setFenceAssort(fenceAssort: ITraderAssort): void; protected setFenceAssort(fenceAssort: ITraderAssort): void;
getFenceAssorts(): ITraderAssort; getFenceAssorts(): ITraderAssort;
hasExpiredCache(refreshAssort: boolean): boolean; /**
* Get the count of items fence offers
* @returns number
*/
getOfferCount(): number;
generateFenceAssortCache(pmcData: IPmcData): void; generateFenceAssortCache(pmcData: IPmcData): void;
/**
* Get the next update timestamp for fence
* @returns future timestamp
*/
getNextFenceUpdateTimestamp(): number;
/**
* Get fence refresh time in seconds
*/
protected getFenceRefreshTime(): number;
/** /**
* Get the fence level the passed in profile has * Get the fence level the passed in profile has
* @param pmcData Player profile * @param pmcData Player profile

View File

@ -0,0 +1,30 @@
import { IAkiProfile } from "../models/eft/profile/IAkiProfile";
import { JsonUtil } from "../utils/JsonUtil";
export declare class ProfileSnapshotService {
protected jsonUtil: JsonUtil;
protected storedProfileSnapshots: Record<string, IAkiProfile>;
constructor(jsonUtil: JsonUtil);
/**
* Store a profile into an in-memory object
* @param sessionID session id - acts as the key
* @param profile - profile to save
*/
storeProfileSnapshot(sessionID: string, profile: IAkiProfile): void;
/**
* Retreve a stored profile
* @param sessionID key
* @returns A player profile object
*/
getProfileSnapshot(sessionID: string): IAkiProfile;
/**
* Does a profile exists against the provided key
* @param sessionID key
* @returns true if exists
*/
hasProfileSnapshot(sessionID: string): boolean;
/**
* Remove a stored profile by key
* @param sessionID key
*/
clearProfileSnapshot(sessionID: string): void;
}

View File

@ -24,7 +24,6 @@ export declare class RagfairOfferService {
protected httpResponse: HttpResponseUtil; protected httpResponse: HttpResponseUtil;
protected configServer: ConfigServer; protected configServer: ConfigServer;
protected playerOffersLoaded: boolean; protected playerOffersLoaded: boolean;
protected toUpdate: Record<string, boolean>;
protected expiredOffers: Item[]; protected expiredOffers: Item[];
protected offers: IRagfairOffer[]; protected offers: IRagfairOffer[];
protected ragfairConfig: IRagfairConfig; protected ragfairConfig: IRagfairConfig;
@ -38,8 +37,6 @@ export declare class RagfairOfferService {
getOffersOfType(templateId: string): IRagfairOffer[]; getOffersOfType(templateId: string): IRagfairOffer[];
addOffer(offer: IRagfairOffer): void; addOffer(offer: IRagfairOffer): void;
addOfferToExpired(staleOffer: IRagfairOffer): void; addOfferToExpired(staleOffer: IRagfairOffer): void;
setTraderUpdateStatus(traderId: string, shouldUpdate: boolean): void;
shouldTraderBeUpdated(traderID: string): boolean;
getExpiredOfferCount(): number; getExpiredOfferCount(): number;
/** /**
* Get an array of expired items not yet processed into new offers * Get an array of expired items not yet processed into new offers
@ -53,12 +50,15 @@ export declare class RagfairOfferService {
* @returns offer exists - true * @returns offer exists - true
*/ */
doesOfferExist(offerId: string): boolean; doesOfferExist(offerId: string): boolean;
getTraders(): Record<string, boolean>;
flagTraderForUpdate(expiredOfferUserId: string): void;
removeOfferById(offerId: string): void; removeOfferById(offerId: string): void;
removeOfferStack(offerID: string, amount: number): void; removeOfferStack(offerID: string, amount: number): void;
removeAllOffersByTrader(traderId: string): void; removeAllOffersByTrader(traderId: string): void;
addTradersToUpdateList(): void; /**
* Do the trader offers on flea need to be refreshed
* @param traderID Trader to check
* @returns true if they do
*/
traderOffersNeedRefreshing(traderID: string): boolean;
addPlayerOffers(): void; addPlayerOffers(): void;
expireStaleOffers(): void; expireStaleOffers(): void;
/** /**

View File

@ -27,6 +27,20 @@ export declare class RagfairPriceService {
getDynamicPrice(itemTpl: string): number; getDynamicPrice(itemTpl: string): number;
getAllFleaPrices(): Record<string, number>; getAllFleaPrices(): Record<string, number>;
getFleaPriceForItem(tplId: string): number; getFleaPriceForItem(tplId: string): number;
/**
* Check to see if an items price is below its handbook price and adjust accoring to values set to config/ragfair.json
* @param itemPrice price of item
* @param itemTpl item template Id being checked
* @returns adjusted price value in roubles
*/
protected adjustPriceIfBelowHandbook(itemPrice: number, itemTpl: string): number;
/**
* Get the percentage difference between two values
* @param a numerical value a
* @param b numerical value b
* @returns different in percent
*/
protected getPriceDifference(a: number, b: number): number;
getStaticPriceForItem(tplId: string): number; getStaticPriceForItem(tplId: string): number;
getBarterPrice(barterScheme: IBarterScheme[]): number; getBarterPrice(barterScheme: IBarterScheme[]): number;
getDynamicOfferPrice(items: Item[], desiredCurrency: string): number; getDynamicOfferPrice(items: Item[], desiredCurrency: string): number;

View File

@ -2,5 +2,10 @@ import { ITraderAssort } from "../models/eft/common/tables/ITrader";
export declare class TraderAssortService { export declare class TraderAssortService {
protected pristineTraderAssorts: Record<string, ITraderAssort>; protected pristineTraderAssorts: Record<string, ITraderAssort>;
getPristineTraderAssort(traderId: string): ITraderAssort; getPristineTraderAssort(traderId: string): ITraderAssort;
/**
* Store trader assorts inside a class property
* @param traderId Traderid to store assorts against
* @param assort Assorts to store
*/
setPristineTraderAssort(traderId: string, assort: ITraderAssort): void; setPristineTraderAssort(traderId: string, assort: ITraderAssort): void;
} }

View File

@ -4,6 +4,10 @@ export declare class TimeUtil {
formatDate(date: Date): string; formatDate(date: Date): string;
getDate(): string; getDate(): string;
getTime(): string; getTime(): string;
/**
* Get timestamp in seconds
* @returns
*/
getTimestamp(): number; getTimestamp(): number;
/** /**
* mail in eft requires time be in a specific format * mail in eft requires time be in a specific format

View File

@ -4,7 +4,7 @@
"author": "Chomp", "author": "Chomp",
"license": "MIT", "license": "MIT",
"main": "src/mod.js", "main": "src/mod.js",
"akiVersion": "3.1.1", "akiVersion": "3.2.1",
"isBundleMod": true, "isBundleMod": true,
"scripts": { "scripts": {
"setup:environment": "npm i", "setup:environment": "npm i",

View File

@ -1,5 +1,5 @@
import { InsuranceController } from "../controllers/InsuranceController"; import { InsuranceController } from "../controllers/InsuranceController";
import { OnLoadOnUpdate } from "../di/OnLoadOnUpdate"; import { OnUpdate } from "../di/OnUpdate";
import { IPmcData } from "../models/eft/common/IPmcData"; import { IPmcData } from "../models/eft/common/IPmcData";
import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData";
import { IGetInsuranceCostRequestData } from "../models/eft/insurance/IGetInsuranceCostRequestData"; import { IGetInsuranceCostRequestData } from "../models/eft/insurance/IGetInsuranceCostRequestData";
@ -10,14 +10,13 @@ import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig";
import { ConfigServer } from "../servers/ConfigServer"; import { ConfigServer } from "../servers/ConfigServer";
import { InsuranceService } from "../services/InsuranceService"; import { InsuranceService } from "../services/InsuranceService";
import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil";
export declare class InsuranceCallbacks extends OnLoadOnUpdate { export declare class InsuranceCallbacks extends OnUpdate {
protected insuranceController: InsuranceController; protected insuranceController: InsuranceController;
protected insuranceService: InsuranceService; protected insuranceService: InsuranceService;
protected httpResponse: HttpResponseUtil; protected httpResponse: HttpResponseUtil;
protected configServer: ConfigServer; protected configServer: ConfigServer;
protected insuranceConfig: IInsuranceConfig; protected insuranceConfig: IInsuranceConfig;
constructor(insuranceController: InsuranceController, insuranceService: InsuranceService, httpResponse: HttpResponseUtil, configServer: ConfigServer); constructor(insuranceController: InsuranceController, insuranceService: InsuranceService, httpResponse: HttpResponseUtil, configServer: ConfigServer);
onLoad(): void;
getInsuranceCost(url: string, info: IGetInsuranceCostRequestData, sessionID: string): IGetBodyResponseData<IGetInsuranceCostResponseData>; getInsuranceCost(url: string, info: IGetInsuranceCostRequestData, sessionID: string): IGetBodyResponseData<IGetInsuranceCostResponseData>;
insure(pmcData: IPmcData, body: IInsureRequestData, sessionID: string): IItemEventRouterResponse; insure(pmcData: IPmcData, body: IInsureRequestData, sessionID: string): IItemEventRouterResponse;
onUpdate(secondsSinceLastRun: number): boolean; onUpdate(secondsSinceLastRun: number): boolean;

View File

@ -9,10 +9,10 @@ export declare class TraderCallbacks extends OnLoadOnUpdate {
protected traderController: TraderController; protected traderController: TraderController;
constructor(httpResponse: HttpResponseUtil, traderController: TraderController); constructor(httpResponse: HttpResponseUtil, traderController: TraderController);
onLoad(): void; onLoad(): void;
onUpdate(): boolean;
getRoute(): string; getRoute(): string;
getTraderSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<ITraderBase[]>; getTraderSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<ITraderBase[]>;
getProfilePurchases(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<Record<string, IBarterScheme[][]>>; getProfilePurchases(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<Record<string, IBarterScheme[][]>>;
getTrader(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<ITraderBase>; getTrader(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<ITraderBase>;
getAssort(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<ITraderAssort>; getAssort(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<ITraderAssort>;
onUpdate(): boolean;
} }

View File

@ -25,4 +25,5 @@ export declare class GameController {
protected logProfileDetails(fullProfile: IAkiProfile): void; protected logProfileDetails(fullProfile: IAkiProfile): void;
getGameConfig(sessionID: string): IGameConfigResponse; getGameConfig(sessionID: string): IGameConfigResponse;
getServer(): any[]; getServer(): any[];
getValidGameVersion(): any;
} }

View File

@ -28,6 +28,7 @@ import { HashUtil } from "../utils/HashUtil";
import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil";
import { RandomUtil } from "../utils/RandomUtil"; import { RandomUtil } from "../utils/RandomUtil";
import { TimeUtil } from "../utils/TimeUtil"; import { TimeUtil } from "../utils/TimeUtil";
import { JsonUtil } from "../utils/JsonUtil";
export declare class HideoutController { export declare class HideoutController {
protected logger: ILogger; protected logger: ILogger;
protected hashUtil: HashUtil; protected hashUtil: HashUtil;
@ -45,9 +46,10 @@ export declare class HideoutController {
protected hideoutHelper: HideoutHelper; protected hideoutHelper: HideoutHelper;
protected scavCaseRewardGenerator: ScavCaseRewardGenerator; protected scavCaseRewardGenerator: ScavCaseRewardGenerator;
protected configServer: ConfigServer; protected configServer: ConfigServer;
protected jsonUtil: JsonUtil;
protected static nameBackendCountersCrafting: string; protected static nameBackendCountersCrafting: string;
protected hideoutConfig: IHideoutConfig; protected hideoutConfig: IHideoutConfig;
constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, itemEventRouter: ItemEventRouter, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, configServer: ConfigServer); constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, itemEventRouter: ItemEventRouter, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, configServer: ConfigServer, jsonUtil: JsonUtil);
upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse;
upgradeComplete(pmcData: IPmcData, body: HideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; upgradeComplete(pmcData: IPmcData, body: HideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse;
/** /**

View File

@ -5,9 +5,11 @@ import { ItemHelper } from "../helpers/ItemHelper";
import { ProfileHelper } from "../helpers/ProfileHelper"; import { ProfileHelper } from "../helpers/ProfileHelper";
import { QuestHelper } from "../helpers/QuestHelper"; import { QuestHelper } from "../helpers/QuestHelper";
import { TraderHelper } from "../helpers/TraderHelper"; import { TraderHelper } from "../helpers/TraderHelper";
import { IPmcData } from "../models/eft/common/IPmcData";
import { IRegisterPlayerRequestData } from "../models/eft/inRaid/IRegisterPlayerRequestData"; import { IRegisterPlayerRequestData } from "../models/eft/inRaid/IRegisterPlayerRequestData";
import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData";
import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; import { IInRaidConfig } from "../models/spt/config/IInRaidConfig";
import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer"; import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer"; import { DatabaseServer } from "../servers/DatabaseServer";
import { SaveServer } from "../servers/SaveServer"; import { SaveServer } from "../servers/SaveServer";
@ -15,6 +17,7 @@ import { InsuranceService } from "../services/InsuranceService";
import { JsonUtil } from "../utils/JsonUtil"; import { JsonUtil } from "../utils/JsonUtil";
import { TimeUtil } from "../utils/TimeUtil"; import { TimeUtil } from "../utils/TimeUtil";
export declare class InraidController { export declare class InraidController {
protected logger: ILogger;
protected saveServer: SaveServer; protected saveServer: SaveServer;
protected jsonUtil: JsonUtil; protected jsonUtil: JsonUtil;
protected timeUtil: TimeUtil; protected timeUtil: TimeUtil;
@ -29,7 +32,7 @@ export declare class InraidController {
protected inRaidHelper: InRaidHelper; protected inRaidHelper: InRaidHelper;
protected configServer: ConfigServer; protected configServer: ConfigServer;
protected inraidConfig: IInRaidConfig; protected inraidConfig: IInRaidConfig;
constructor(saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, configServer: ConfigServer); constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, configServer: ConfigServer);
addPlayer(sessionID: string, info: IRegisterPlayerRequestData): void; addPlayer(sessionID: string, info: IRegisterPlayerRequestData): void;
saveProgress(offraidData: ISaveProgressRequestData, sessionID: string): void; saveProgress(offraidData: ISaveProgressRequestData, sessionID: string): void;
/** /**
@ -38,7 +41,7 @@ export declare class InraidController {
* @param pmcData player profile * @param pmcData player profile
* @param isPlayerScav Was the player a pScav * @param isPlayerScav Was the player a pScav
*/ */
private markOrRemoveFoundInRaidItems; protected markOrRemoveFoundInRaidItems(offraidData: ISaveProgressRequestData, pmcData: IPmcData, isPlayerScav: boolean): void;
private handlePostRaidPlayerScavProcess; protected handlePostRaidPlayerScavProcess(scavData: IPmcData, sessionID: string, offraidData: ISaveProgressRequestData, pmcData: IPmcData, isDead: boolean): void;
private handlePostRaidPlayerScavKarmaChanges; protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData, scavData: IPmcData, sessionID: string): void;
} }

View File

@ -11,21 +11,25 @@ import { IJoinMatchResult } from "../models/eft/match/IJoinMatchResult";
import { IStartOfflineRaidRequestData } from "../models/eft/match/IStartOffineRaidRequestData"; import { IStartOfflineRaidRequestData } from "../models/eft/match/IStartOffineRaidRequestData";
import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; import { IInRaidConfig } from "../models/spt/config/IInRaidConfig";
import { IMatchConfig } from "../models/spt/config/IMatchConfig"; import { IMatchConfig } from "../models/spt/config/IMatchConfig";
import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer"; import { ConfigServer } from "../servers/ConfigServer";
import { SaveServer } from "../servers/SaveServer"; import { SaveServer } from "../servers/SaveServer";
import { BotLootCacheService } from "../services/BotLootCacheService"; import { BotLootCacheService } from "../services/BotLootCacheService";
import { MatchLocationService } from "../services/MatchLocationService"; import { MatchLocationService } from "../services/MatchLocationService";
import { ProfileSnapshotService } from "../services/ProfileSnapshotService";
export declare class MatchController { export declare class MatchController {
protected logger: ILogger;
protected saveServer: SaveServer; protected saveServer: SaveServer;
protected profileHelper: ProfileHelper; protected profileHelper: ProfileHelper;
protected matchLocationService: MatchLocationService; protected matchLocationService: MatchLocationService;
protected traderHelper: TraderHelper; protected traderHelper: TraderHelper;
protected botLootCacheService: BotLootCacheService; protected botLootCacheService: BotLootCacheService;
protected configServer: ConfigServer; protected configServer: ConfigServer;
protected profileSnapshotService: ProfileSnapshotService;
protected applicationContext: ApplicationContext; protected applicationContext: ApplicationContext;
protected matchConfig: IMatchConfig; protected matchConfig: IMatchConfig;
protected inraidConfig: IInRaidConfig; protected inraidConfig: IInRaidConfig;
constructor(saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, applicationContext: ApplicationContext); constructor(logger: ILogger, saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, applicationContext: ApplicationContext);
getEnabled(): boolean; getEnabled(): boolean;
getProfile(info: IGetProfileRequestData): IPmcData[]; getProfile(info: IGetProfileRequestData): IPmcData[];
createGroup(sessionID: string, info: ICreateGroupRequestData): any; createGroup(sessionID: string, info: ICreateGroupRequestData): any;

View File

@ -17,10 +17,25 @@ export declare class TraderController {
protected traderAssortService: TraderAssortService; protected traderAssortService: TraderAssortService;
protected jsonUtil: JsonUtil; protected jsonUtil: JsonUtil;
constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, timeUtil: TimeUtil, traderAssortService: TraderAssortService, jsonUtil: JsonUtil); constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, timeUtil: TimeUtil, traderAssortService: TraderAssortService, jsonUtil: JsonUtil);
/**
* Runs when onLoad event is fired
* Iterate over traders, ensure an unmolested copy of their assorts is stored in traderAssortService
* Store timestamp of next assort refresh in nextResupply property of traders .base object
*/
load(): void; load(): void;
getTrader(traderID: string, sessionID: string): ITraderBase; /**
* Runs when onUpdate is fired
* If current time is > nextResupply(expire) time of trader, refresh traders assorts and
* @returns has run
*/
update(): boolean;
/**
* Return an array of all traders
* @param sessionID Session id
* @returns array if ITraderBase objects
*/
getAllTraders(sessionID: string): ITraderBase[]; getAllTraders(sessionID: string): ITraderBase[];
updateTraders(): boolean; getTrader(sessionID: string, traderID: string): ITraderBase;
getAssort(sessionId: string, traderId: string): ITraderAssort; getAssort(sessionId: string, traderId: string): ITraderAssort;
getPurchasesData(traderID: string, sessionID: string): Record<string, IBarterScheme[][]>; getPurchasesData(sessionID: string, traderID: string): Record<string, IBarterScheme[][]>;
} }

View File

@ -41,15 +41,37 @@ export declare class RagfairOfferGenerator {
createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer;
protected getTraderId(userID: string): string; protected getTraderId(userID: string): string;
protected getRating(userID: string): number; protected getRating(userID: string): number;
/**
* Is the offers user rating growing
* @param userID user to check rating of
* @returns true if its growing
*/
protected getRatingGrowing(userID: string): boolean; protected getRatingGrowing(userID: string): boolean;
/**
* Get number of section until offer should expire
* @param userID Id of the offer owner
* @param time Time the offer is posted
* @returns number of seconds until offer expires
*/
protected getOfferEndTime(userID: string, time: number): number; protected getOfferEndTime(userID: string, time: number): number;
/** /**
* Create multiple offers for items by using a unique list of items we've generated previously * Create multiple offers for items by using a unique list of items we've generated previously
* @param expiredOffers * @param expiredOffers optional, expired offers to regenerate
*/ */
generateDynamicOffers(expiredOffers?: Item[]): void; generateDynamicOffers(expiredOffers?: Item[]): void;
generateTraderOffers(traderID: string): void; /**
* Generate trader offers on flea using the traders assort data
* @param traderID Trader to generate offers for
*/
generateFleaOffersForTrader(traderID: string): void;
protected getItemCondition(userID: string, items: Item[], itemDetails: ITemplateItem): Item[]; protected getItemCondition(userID: string, items: Item[], itemDetails: ITemplateItem): Item[];
/**
* Add missing conditions to an item if needed
* Durabiltiy for repairable items
* HpResource for medical items
* @param item item to add conditions to
* @returns Item with conditions added
*/
protected addMissingCondition(item: Item): Item; protected addMissingCondition(item: Item): Item;
protected getOfferRequirements(items: Item[]): { protected getOfferRequirements(items: Item[]): {
count: number; count: number;
@ -57,6 +79,14 @@ export declare class RagfairOfferGenerator {
}[]; }[];
/** /**
* Create a flea offer and store it in the Ragfair server offers array * Create a flea offer and store it in the Ragfair server offers array
* @param userID owner of the offer
* @param time time offer is put up
* @param items items in the offer
* @param barterScheme
* @param loyalLevel
* @param price price of offer
* @param sellInOnePiece
* @returns
*/ */
createFleaOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; createFleaOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer;
} }

View File

@ -5,6 +5,7 @@ import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequ
import { ILogger } from "../models/spt/utils/ILogger"; import { ILogger } from "../models/spt/utils/ILogger";
import { DatabaseServer } from "../servers/DatabaseServer"; import { DatabaseServer } from "../servers/DatabaseServer";
import { SaveServer } from "../servers/SaveServer"; import { SaveServer } from "../servers/SaveServer";
import { ProfileFixerService } from "../services/ProfileFixerService";
import { JsonUtil } from "../utils/JsonUtil"; import { JsonUtil } from "../utils/JsonUtil";
import { InventoryHelper } from "./InventoryHelper"; import { InventoryHelper } from "./InventoryHelper";
import { PaymentHelper } from "./PaymentHelper"; import { PaymentHelper } from "./PaymentHelper";
@ -15,7 +16,8 @@ export declare class InRaidHelper {
protected databaseServer: DatabaseServer; protected databaseServer: DatabaseServer;
protected inventoryHelper: InventoryHelper; protected inventoryHelper: InventoryHelper;
protected paymentHelper: PaymentHelper; protected paymentHelper: PaymentHelper;
constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper); protected profileFixerService: ProfileFixerService;
constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper, profileFixerService: ProfileFixerService);
/** /**
* Reset the SPT inraid property stored in a profile to 'none' * Reset the SPT inraid property stored in a profile to 'none'
* @param sessionID Session id * @param sessionID Session id

View File

@ -43,6 +43,7 @@ export declare class InventoryHelper {
constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, configServer: ConfigServer); constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, configServer: ConfigServer);
addItem(pmcData: IPmcData, body: IAddItemRequestData, output: IItemEventRouterResponse, sessionID: string, callback: any, foundInRaid?: boolean, addUpd?: any): IItemEventRouterResponse; addItem(pmcData: IPmcData, body: IAddItemRequestData, output: IItemEventRouterResponse, sessionID: string, callback: any, foundInRaid?: boolean, addUpd?: any): IItemEventRouterResponse;
removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse;
removeItemByCount(pmcData: IPmcData, itemId: string, count: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse;
getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): Record<number, number>; getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): Record<number, number>;
protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): Record<number, number>; protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): Record<number, number>;
protected getInventoryItemHash(inventoryItem: Item[]): InventoryHelper.InventoryItemHash; protected getInventoryItemHash(inventoryItem: Item[]): InventoryHelper.InventoryItemHash;

View File

@ -2,22 +2,26 @@ import { IPmcData } from "../models/eft/common/IPmcData";
import { Stats } from "../models/eft/common/tables/IBotBase"; import { Stats } from "../models/eft/common/tables/IBotBase";
import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile";
import { IValidateNicknameRequestData } from "../models/eft/profile/IValidateNicknameRequestData"; import { IValidateNicknameRequestData } from "../models/eft/profile/IValidateNicknameRequestData";
import { ILogger } from "../models/spt/utils/ILogger";
import { DatabaseServer } from "../servers/DatabaseServer"; import { DatabaseServer } from "../servers/DatabaseServer";
import { SaveServer } from "../servers/SaveServer"; import { SaveServer } from "../servers/SaveServer";
import { FenceService } from "../services/FenceService"; import { FenceService } from "../services/FenceService";
import { ProfileSnapshotService } from "../services/ProfileSnapshotService";
import { JsonUtil } from "../utils/JsonUtil"; import { JsonUtil } from "../utils/JsonUtil";
import { TimeUtil } from "../utils/TimeUtil"; import { TimeUtil } from "../utils/TimeUtil";
import { Watermark } from "../utils/Watermark"; import { Watermark } from "../utils/Watermark";
import { ItemHelper } from "./ItemHelper"; import { ItemHelper } from "./ItemHelper";
export declare class ProfileHelper { export declare class ProfileHelper {
protected logger: ILogger;
protected jsonUtil: JsonUtil; protected jsonUtil: JsonUtil;
protected watermark: Watermark; protected watermark: Watermark;
protected timeUtil: TimeUtil; protected timeUtil: TimeUtil;
protected saveServer: SaveServer; protected saveServer: SaveServer;
protected databaseServer: DatabaseServer; protected databaseServer: DatabaseServer;
protected itemHelper: ItemHelper; protected itemHelper: ItemHelper;
protected profileSnapshotService: ProfileSnapshotService;
protected fenceService: FenceService; protected fenceService: FenceService;
constructor(jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, fenceService: FenceService); constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, fenceService: FenceService);
resetProfileQuestCondition(sessionID: string, conditionId: string): void; resetProfileQuestCondition(sessionID: string, conditionId: string): void;
getCompleteProfile(sessionID: string): IPmcData[]; getCompleteProfile(sessionID: string): IPmcData[];
isNicknameTaken(info: IValidateNicknameRequestData, sessionID: string): boolean; isNicknameTaken(info: IValidateNicknameRequestData, sessionID: string): boolean;

View File

@ -42,7 +42,15 @@ export declare class QuestHelper {
*/ */
evaluateLevel(pmcProfile: IPmcData, cond: AvailableForConditions): boolean; evaluateLevel(pmcProfile: IPmcData, cond: AvailableForConditions): boolean;
getDeltaQuests(before: IQuest[], after: IQuest[]): IQuest[]; getDeltaQuests(before: IQuest[], after: IQuest[]): IQuest[];
rewardSkillPoints(sessionID: string, pmcData: IPmcData, output: IItemEventRouterResponse, skillName: string, progress: number): void; /**
* Increase skill points of a skill on player profile
* @param sessionID Session id
* @param pmcData Player profile
* @param output output object to send back to client
* @param skillName Name of skill to increase skill points of
* @param progressAmount Amount of skill points to add to skill
*/
rewardSkillPoints(sessionID: string, pmcData: IPmcData, output: IItemEventRouterResponse, skillName: string, progressAmount: number): void;
getQuestLocale(questId: string): any; getQuestLocale(questId: string): any;
/** /**
* Debug Routine for showing some information on the * Debug Routine for showing some information on the

View File

@ -1,7 +1,8 @@
import { RagfairAssortGenerator } from "../generators/RagfairAssortGenerator"; import { RagfairAssortGenerator } from "../generators/RagfairAssortGenerator";
import { RagfairOfferGenerator } from "../generators/RagfairOfferGenerator"; import { RagfairOfferGenerator } from "../generators/RagfairOfferGenerator";
import { IPmcData } from "../models/eft/common/IPmcData";
import { Item } from "../models/eft/common/tables/IItem"; import { Item } from "../models/eft/common/tables/IItem";
import { ITraderAssort } from "../models/eft/common/tables/ITrader"; import { ITrader, ITraderAssort } from "../models/eft/common/tables/ITrader";
import { ITraderConfig } from "../models/spt/config/ITraderConfig"; import { ITraderConfig } from "../models/spt/config/ITraderConfig";
import { ILogger } from "../models/spt/utils/ILogger"; import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer"; import { ConfigServer } from "../servers/ConfigServer";
@ -10,13 +11,16 @@ import { FenceService } from "../services/FenceService";
import { TraderAssortService } from "../services/TraderAssortService"; import { TraderAssortService } from "../services/TraderAssortService";
import { JsonUtil } from "../utils/JsonUtil"; import { JsonUtil } from "../utils/JsonUtil";
import { MathUtil } from "../utils/MathUtil"; import { MathUtil } from "../utils/MathUtil";
import { TimeUtil } from "../utils/TimeUtil";
import { AssortHelper } from "./AssortHelper"; import { AssortHelper } from "./AssortHelper";
import { PaymentHelper } from "./PaymentHelper"; import { PaymentHelper } from "./PaymentHelper";
import { ProfileHelper } from "./ProfileHelper"; import { ProfileHelper } from "./ProfileHelper";
import { TraderHelper } from "./TraderHelper";
export declare class TraderAssortHelper { export declare class TraderAssortHelper {
protected logger: ILogger; protected logger: ILogger;
protected jsonUtil: JsonUtil; protected jsonUtil: JsonUtil;
protected mathUtil: MathUtil; protected mathUtil: MathUtil;
protected timeUtil: TimeUtil;
protected databaseServer: DatabaseServer; protected databaseServer: DatabaseServer;
protected profileHelper: ProfileHelper; protected profileHelper: ProfileHelper;
protected assortHelper: AssortHelper; protected assortHelper: AssortHelper;
@ -24,18 +28,37 @@ export declare class TraderAssortHelper {
protected ragfairAssortGenerator: RagfairAssortGenerator; protected ragfairAssortGenerator: RagfairAssortGenerator;
protected ragfairOfferGenerator: RagfairOfferGenerator; protected ragfairOfferGenerator: RagfairOfferGenerator;
protected traderAssortService: TraderAssortService; protected traderAssortService: TraderAssortService;
protected traderHelper: TraderHelper;
protected fenceService: FenceService; protected fenceService: FenceService;
protected configServer: ConfigServer; protected configServer: ConfigServer;
protected traderConfig: ITraderConfig; protected traderConfig: ITraderConfig;
constructor(logger: ILogger, jsonUtil: JsonUtil, mathUtil: MathUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, paymentHelper: PaymentHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, fenceService: FenceService, configServer: ConfigServer); constructor(logger: ILogger, jsonUtil: JsonUtil, mathUtil: MathUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, paymentHelper: PaymentHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, traderHelper: TraderHelper, fenceService: FenceService, configServer: ConfigServer);
/** /**
* Get a traders assorts * Get a traders assorts
* Can be used for returning ragfair / fence assorts * Can be used for returning ragfair / fence assorts
* Filter out assorts not unlocked due to level OR quest completion
* @param sessionId session id * @param sessionId session id
* @param traderId trader id * @param traderId traders id
* @returns a traders assorts * @returns a traders' assorts
*/ */
getAssort(sessionId: string, traderId: string): ITraderAssort; getAssort(sessionId: string, traderId: string): ITraderAssort;
/**
* if the fence assorts have expired, re-generate them
* @param pmcProfile Players profile
*/
refreshFenceAssortIfExpired(pmcProfile: IPmcData): void;
/**
* Reset a traders assorts and move nextResupply value to future
* Flag trader as needing a flea offer reset to be picked up by flea update() function
* @param trader trader details to alter
*/
resetExpiredTrader(trader: ITrader): void;
/**
* Does the supplied trader need its assorts refreshed
* @param traderID Trader to check
* @returns true they need refreshing
*/
traderAssortsHaveExpired(traderID: string): boolean;
/** /**
* Iterate over all assorts barter_scheme values, find barters selling for money and multiply by multipler in config * Iterate over all assorts barter_scheme values, find barters selling for money and multiply by multipler in config
* @param traderAssort Assorts to multiple price of * @param traderAssort Assorts to multiple price of

View File

@ -9,6 +9,7 @@ import { DatabaseServer } from "../servers/DatabaseServer";
import { SaveServer } from "../servers/SaveServer"; import { SaveServer } from "../servers/SaveServer";
import { FenceService } from "../services/FenceService"; import { FenceService } from "../services/FenceService";
import { PlayerService } from "../services/PlayerService"; import { PlayerService } from "../services/PlayerService";
import { TimeUtil } from "../utils/TimeUtil";
import { HandbookHelper } from "./HandbookHelper"; import { HandbookHelper } from "./HandbookHelper";
import { ItemHelper } from "./ItemHelper"; import { ItemHelper } from "./ItemHelper";
import { PaymentHelper } from "./PaymentHelper"; import { PaymentHelper } from "./PaymentHelper";
@ -23,9 +24,10 @@ export declare class TraderHelper {
protected handbookHelper: HandbookHelper; protected handbookHelper: HandbookHelper;
protected playerService: PlayerService; protected playerService: PlayerService;
protected fenceService: FenceService; protected fenceService: FenceService;
protected timeUtil: TimeUtil;
protected configServer: ConfigServer; protected configServer: ConfigServer;
protected traderConfig: ITraderConfig; protected traderConfig: ITraderConfig;
constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, itemHelper: ItemHelper, handbookHelper: HandbookHelper, playerService: PlayerService, fenceService: FenceService, configServer: ConfigServer); constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, itemHelper: ItemHelper, handbookHelper: HandbookHelper, playerService: PlayerService, fenceService: FenceService, timeUtil: TimeUtil, configServer: ConfigServer);
getTrader(traderID: string, sessionID: string): ITraderBase; getTrader(traderID: string, sessionID: string): ITraderBase;
getTraderAssortsById(traderId: string): ITraderAssort; getTraderAssortsById(traderId: string): ITraderAssort;
/** /**
@ -97,6 +99,17 @@ export declare class TraderHelper {
* @param sessionID session id * @param sessionID session id
*/ */
lvlUp(traderID: string, sessionID: string): void; lvlUp(traderID: string, sessionID: string): void;
/**
* Get the next update timestamp for a trader
* @param traderID Trader to look up update value for
* @returns future timestamp
*/
getNextUpdateTimestamp(traderID: string): number;
/**
* Get the reset time between trader assort refreshes in seconds
* @param traderId Trader to look up
* @returns Time in seconds
*/
getTraderUpdateSeconds(traderId: string): number; getTraderUpdateSeconds(traderId: string): number;
/** /**
* check if an item is allowed to be sold to a trader * check if an item is allowed to be sold to a trader

View File

@ -32,6 +32,17 @@ export declare class PreAkiModLoader implements IModLoader {
getModPath(mod: string): string; getModPath(mod: string): string;
protected importClass(name: string, filepath: string, container: DependencyContainer): void; protected importClass(name: string, filepath: string, container: DependencyContainer): void;
protected importMods(): Promise<void>; protected importMods(): Promise<void>;
/**
* Check for duplciate mods loaded, show error if duplicate mod found
* @param modPackageData dictionary of mod package.json data
*/
protected checkForDuplicateMods(modPackageData: Record<string, IPackageJsonData>): void;
/**
* Check for and return duplicate strings inside an array
* @param stringArray Array to check for duplicates
* @returns string array of duplicates, empty if none found
*/
protected getDuplicates(stringArray: string[]): string[];
/** /**
* *
* @param mods Get an array of broken/invalid mods by name * @param mods Get an array of broken/invalid mods by name

View File

@ -137,7 +137,7 @@ export interface BotLocationModifier {
VisibleDistance: number; VisibleDistance: number;
} }
export interface MinMaxBot { export interface MinMaxBot {
WildSpawnType: string; WildSpawnType: WildSpawnType;
max: number; max: number;
min: number; min: number;
} }
@ -195,7 +195,7 @@ export interface Wave {
BotPreset: string; BotPreset: string;
BotSide: string; BotSide: string;
SpawnPoints: string; SpawnPoints: string;
WildSpawnType: string; WildSpawnType: WildSpawnType;
isPlayers: boolean; isPlayers: boolean;
number: number; number: number;
slots_max: number; slots_max: number;
@ -203,3 +203,7 @@ export interface Wave {
time_max: number; time_max: number;
time_min: number; time_min: number;
} }
export declare enum WildSpawnType {
ASSAULT = "assault",
MARKSMAN = "marksman"
}

View File

@ -66,13 +66,13 @@ export interface IBan {
dateTime: number; dateTime: number;
} }
export declare enum BanType { export declare enum BanType {
Chat = 0, CHAT = 0,
RagFair = 1, RAGFAIR = 1,
Voip = 2, VOIP = 2,
Trading = 3, TRADING = 3,
Online = 4, ONLINE = 4,
Friends = 5, FRIENDS = 5,
ChangeNickname = 6 CHANGE_NICKNAME = 6
} }
export interface Customization { export interface Customization {
Head: string; Head: string;
@ -312,11 +312,11 @@ export interface Notes {
export interface CarExtractCounts { export interface CarExtractCounts {
} }
export declare enum SurvivorClass { export declare enum SurvivorClass {
Unknown = 0, UNKNOWN = 0,
Neutralizer = 1, NEUTRALIZER = 1,
Marauder = 2, MARAUDER = 2,
Paramedic = 3, PARAMEDIC = 3,
Survivor = 4 SURVIVOR = 4
} }
export interface Quest { export interface Quest {
qid: string; qid: string;

View File

@ -7,7 +7,7 @@ export interface ITrader {
suits?: ISuit[]; suits?: ISuit[];
} }
export interface ITraderBase { export interface ITraderBase {
refreshAssort: boolean; refreshTraderRagfairOffers: boolean;
_id: string; _id: string;
avatar: string; avatar: string;
balance_dol: number; balance_dol: number;
@ -58,7 +58,7 @@ export interface Repair {
quality: string; quality: string;
} }
export interface ITraderAssort { export interface ITraderAssort {
nextResupply?: number; nextResupply: number;
items: Item[]; items: Item[];
barter_scheme: Record<string, IBarterScheme[][]>; barter_scheme: Record<string, IBarterScheme[][]>;
loyal_level_items: Record<string, number>; loyal_level_items: Record<string, number>;

View File

@ -1,5 +1,5 @@
export declare enum Effect { export declare enum Effect {
Fracture = "Fracture", FRACTURE = "Fracture",
LightBleeding = "LightBleeding", LIGHT_BLEEDING = "LightBleeding",
HeavyBleeding = "HeavyBleeding" HEAVY_BLEEDING = "HeavyBleeding"
} }

View File

@ -7,12 +7,12 @@ export interface IOffraidHealRequestData extends IBaseInteractionRequestData {
time: number; time: number;
} }
export declare enum BodyPart { export declare enum BodyPart {
Head = 0, HEAD = "Head",
Chest = 1, CHEST = "Chest",
Stomach = 2, STOMACH = "Stomach",
LeftArm = 3, LEFT_ARM = "LeftArm",
RightArm = 4, RIGHT_ARM = "RightArm",
LeftLeg = 5, LEFT_LEG = "LeftLeg",
RightLeg = 6, RIGHT_LEG = "RightLeg",
Common = 7 COMMON = "Common"
} }

View File

@ -1,9 +1,9 @@
export interface INotifierChannel { export interface INotifierChannel {
"server": string; server: string;
"channel_id": string; channel_id: string;
"url": string; url: string;
"notifierServer": string; notifierServer: string;
"ws": string; ws: string;
} }
import { Message } from "../profile/IAkiProfile"; import { Message } from "../profile/IAkiProfile";
export interface INotification { export interface INotification {

View File

@ -1,7 +1,7 @@
export declare enum BotAmount { export declare enum BotAmount {
AsOnline = "AsOnline", AS_ONLINE = "AsOnline",
Low = "Low", LOW = "Low",
Medium = "Medium", MEDIUM = "Medium",
High = "High", HIGH = "High",
Horde = "Horde" HORDE = "Horde"
} }

View File

@ -1,8 +1,8 @@
export declare enum BotDifficulty { export declare enum BotDifficulty {
AsOnline = "AsOnline", AS_ONLINE = "AsOnline",
Easy = "Easy", EASY = "Easy",
Medium = "Medium", MEDIUM = "Medium",
Hard = "Hard", HARD = "Hard",
Impossible = "Impossible", IMPOSSIBLE = "Impossible",
Random = "Random" RANDOM = "Random"
} }

View File

@ -1,13 +1,13 @@
export declare enum MemberCategory { export declare enum MemberCategory {
Default = 0, DEFAULT = 0,
Developer = 1, DEVELOPER = 1,
UniqueId = 2, UNIQUE_ID = 2,
Trader = 4, TRADER = 4,
Group = 8, GROUP = 8,
System = 16, SYSTEM = 16,
ChatModerator = 32, CHAT_MODERATOR = 32,
ChatModeratorWithPermanentBan = 64, CHAT_MODERATOR_WITH_PERMANENT_BAN = 64,
UnitTest = 128, UNIT_TEST = 128,
Sherpa = 256, SHERPA = 256,
Emissary = 512 EMISSARY = 512
} }

View File

@ -1,8 +1,8 @@
export declare enum QuestRewardType { export declare enum QuestRewardType {
Skill = "Skill", SKILL = "Skill",
Experience = "Experience", EXPERIENCE = "Experience",
TraderStanding = "TraderStanding", TRADER_STANDING = "TraderStanding",
TraderUnlock = "TraderUnlock", TRADER_UNLOCK = "TraderUnlock",
Item = "Item", ITEM = "Item",
AssortmentUnlock = "AssortmentUnlock" ASSORTMENT_UNLOCK = "AssortmentUnlock"
} }

View File

@ -1,5 +1,5 @@
export declare enum RaidMode { export declare enum RaidMode {
Online = "Online", ONLINE = "Online",
Local = "Local", LOCAL = "Local",
Coop = "Coop" COOP = "Coop"
} }

View File

@ -11,13 +11,13 @@ export declare class BotLootCache {
grenadeItems: ITemplateItem[]; grenadeItems: ITemplateItem[];
} }
export declare enum LootCacheType { export declare enum LootCacheType {
Special = "Special", SPECIAL = "Special",
Backpack = "Backpack", BACKPACK = "Backpack",
Pocket = "Pocket", POCKET = "Pocket",
Vest = "Vest", VEST = "Vest",
Combined = "Combined", COMBINED = "Combined",
HealingItems = "HealingItems", HEALING_ITEMS = "HealingItems",
DrugItems = "DrugItems", DRUG_ITEMS = "DrugItems",
StimItems = "StimItems", STIM_ITEMS = "StimItems",
GrenadeItems = "GrenadeItems" GRENADE_ITEMS = "GrenadeItems"
} }

View File

@ -2,6 +2,10 @@ import { IBaseConfig } from "./IBaseConfig";
export interface IHideoutConfig extends IBaseConfig { export interface IHideoutConfig extends IBaseConfig {
kind: "aki-hideout"; kind: "aki-hideout";
runIntervalSeconds: number; runIntervalSeconds: number;
fuelDrainRateMultipler: number;
hoursForSkillCrafting: number; hoursForSkillCrafting: number;
generatorSpeedWithoutFuel: number;
generatorFuelFlowRate: number;
airFilterUnitFlowRate: number;
/** SEE HIDEOUTHELPER BEFORE CHANGING CONFIG */
gpuBoostRate: number;
} }

View File

@ -27,7 +27,13 @@ export interface Reputation {
gain: number; gain: number;
loss: number; loss: number;
} }
export declare class OfferAdjustment {
maxPriceDifferenceBelowHandbookPercent: number;
handbookPriceMultipier: number;
priceThreshholdRub: number;
}
export interface Dynamic { export interface Dynamic {
offerAdjustment: OfferAdjustment;
expiredOfferThreshold: number; expiredOfferThreshold: number;
offerItemCount: MinMax; offerItemCount: MinMax;
price: MinMax; price: MinMax;

View File

@ -1,11 +1,11 @@
export declare enum LogBackgroundColor { export declare enum LogBackgroundColor {
default = "", DEFAULT = "",
black = "blackBG", BLACK = "blackBG",
red = "redBG", RED = "redBG",
green = "greenBG", GREEN = "greenBG",
yellow = "yellowBG", YELLOW = "yellowBG",
blue = "blueBG", BLUE = "blueBG",
magenta = "magentaBG", MAGENTA = "magentaBG",
cyan = "cyanBG", CYAN = "cyanBG",
white = "whiteBG" WHITE = "whiteBG"
} }

View File

@ -1,11 +1,11 @@
export declare enum LogTextColor { export declare enum LogTextColor {
black = "black", BLACK = "black",
red = "red", RED = "red",
green = "green", GREEN = "green",
yellow = "yellow", YELLOW = "yellow",
blue = "blue", BLUE = "blue",
magenta = "magenta", MAGENTA = "magenta",
cyan = "cyan", CYAN = "cyan",
white = "white", WHITE = "white",
gray = "" GRAY = ""
} }

View File

@ -13,10 +13,10 @@ export interface ILocaleGlobalBase {
season: Record<string, string>; season: Record<string, string>;
customization: Record<string, ILocaleProps>; customization: Record<string, ILocaleProps>;
repeatableQuest: Record<string, string>; repeatableQuest: Record<string, string>;
templates: ILocaleTemplateBase; templates: Record<string, ILocaleProps>;
locations: ILocaleLocationsBase; locations: Record<string, ILocaleProps>;
banners: ILocaleBannersBase; banners: Record<string, ILocaleProps>;
trading: ILocaleTradingBase; trading: Record<string, ILocaleTradingProps>;
} }
export interface ILocaleQuest { export interface ILocaleQuest {
name: string; name: string;
@ -31,23 +31,11 @@ export interface ILocaleQuest {
export interface ILocalePreset { export interface ILocalePreset {
Name: string; Name: string;
} }
export interface ILocaleTemplateBase {
templates: Record<string, ILocaleProps>;
}
export interface ILocaleLocationsBase {
locations: Record<string, ILocaleProps>;
}
export interface ILocaleBannersBase {
locations: Record<string, ILocaleProps>;
}
export interface ILocaleProps { export interface ILocaleProps {
Name: string; Name: string;
ShortName: string; ShortName: string;
Description: string; Description: string;
} }
export interface ILocaleTradingBase {
locations: Record<string, ILocaleTradingProps>;
}
export interface ILocaleTradingProps { export interface ILocaleTradingProps {
FullName: string; FullName: string;
FirstName: string; FirstName: string;

View File

@ -1,4 +1,6 @@
import { RagfairOfferGenerator } from "../generators/RagfairOfferGenerator"; import { RagfairOfferGenerator } from "../generators/RagfairOfferGenerator";
import { TraderAssortHelper } from "../helpers/TraderAssortHelper";
import { TraderHelper } from "../helpers/TraderHelper";
import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer";
import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig";
import { ILogger } from "../models/spt/utils/ILogger"; import { ILogger } from "../models/spt/utils/ILogger";
@ -12,11 +14,18 @@ export declare class RagfairServer {
protected ragfairOfferService: RagfairOfferService; protected ragfairOfferService: RagfairOfferService;
protected ragfairCategoriesService: RagfairCategoriesService; protected ragfairCategoriesService: RagfairCategoriesService;
protected ragfairRequiredItemsService: RagfairRequiredItemsService; protected ragfairRequiredItemsService: RagfairRequiredItemsService;
protected traderHelper: TraderHelper;
protected traderAssortHelper: TraderAssortHelper;
protected configServer: ConfigServer; protected configServer: ConfigServer;
protected ragfairConfig: IRagfairConfig; protected ragfairConfig: IRagfairConfig;
constructor(logger: ILogger, ragfairOfferGenerator: RagfairOfferGenerator, ragfairOfferService: RagfairOfferService, ragfairCategoriesService: RagfairCategoriesService, ragfairRequiredItemsService: RagfairRequiredItemsService, configServer: ConfigServer); constructor(logger: ILogger, ragfairOfferGenerator: RagfairOfferGenerator, ragfairOfferService: RagfairOfferService, ragfairCategoriesService: RagfairCategoriesService, ragfairRequiredItemsService: RagfairRequiredItemsService, traderHelper: TraderHelper, traderAssortHelper: TraderAssortHelper, configServer: ConfigServer);
load(): void; load(): void;
update(): void; update(): void;
/**
* Get traders who need to be periodically refreshed
* @returns string array of traders
*/
protected getUpdateableTraders(): string[];
getAllCategories(): Record<string, number>; getAllCategories(): Record<string, number>;
getBespokeCategories(offers: IRagfairOffer[]): Record<string, number>; getBespokeCategories(offers: IRagfairOffer[]): Record<string, number>;
/** /**

View File

@ -11,10 +11,12 @@ import { DatabaseServer } from "../servers/DatabaseServer";
import { HashUtil } from "../utils/HashUtil"; import { HashUtil } from "../utils/HashUtil";
import { JsonUtil } from "../utils/JsonUtil"; import { JsonUtil } from "../utils/JsonUtil";
import { RandomUtil } from "../utils/RandomUtil"; import { RandomUtil } from "../utils/RandomUtil";
import { TimeUtil } from "../utils/TimeUtil";
export declare class FenceService { export declare class FenceService {
protected logger: ILogger; protected logger: ILogger;
protected hashUtil: HashUtil; protected hashUtil: HashUtil;
protected jsonUtil: JsonUtil; protected jsonUtil: JsonUtil;
protected timeUtil: TimeUtil;
protected randomUtil: RandomUtil; protected randomUtil: RandomUtil;
protected databaseServer: DatabaseServer; protected databaseServer: DatabaseServer;
protected handbookHelper: HandbookHelper; protected handbookHelper: HandbookHelper;
@ -23,11 +25,24 @@ export declare class FenceService {
protected configServer: ConfigServer; protected configServer: ConfigServer;
protected fenceAssort: ITraderAssort; protected fenceAssort: ITraderAssort;
protected traderConfig: ITraderConfig; protected traderConfig: ITraderConfig;
constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, configServer: ConfigServer); constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, configServer: ConfigServer);
protected setFenceAssort(fenceAssort: ITraderAssort): void; protected setFenceAssort(fenceAssort: ITraderAssort): void;
getFenceAssorts(): ITraderAssort; getFenceAssorts(): ITraderAssort;
hasExpiredCache(refreshAssort: boolean): boolean; /**
* Get the count of items fence offers
* @returns number
*/
getOfferCount(): number;
generateFenceAssortCache(pmcData: IPmcData): void; generateFenceAssortCache(pmcData: IPmcData): void;
/**
* Get the next update timestamp for fence
* @returns future timestamp
*/
getNextFenceUpdateTimestamp(): number;
/**
* Get fence refresh time in seconds
*/
protected getFenceRefreshTime(): number;
/** /**
* Get the fence level the passed in profile has * Get the fence level the passed in profile has
* @param pmcData Player profile * @param pmcData Player profile

View File

@ -0,0 +1,30 @@
import { IAkiProfile } from "../models/eft/profile/IAkiProfile";
import { JsonUtil } from "../utils/JsonUtil";
export declare class ProfileSnapshotService {
protected jsonUtil: JsonUtil;
protected storedProfileSnapshots: Record<string, IAkiProfile>;
constructor(jsonUtil: JsonUtil);
/**
* Store a profile into an in-memory object
* @param sessionID session id - acts as the key
* @param profile - profile to save
*/
storeProfileSnapshot(sessionID: string, profile: IAkiProfile): void;
/**
* Retreve a stored profile
* @param sessionID key
* @returns A player profile object
*/
getProfileSnapshot(sessionID: string): IAkiProfile;
/**
* Does a profile exists against the provided key
* @param sessionID key
* @returns true if exists
*/
hasProfileSnapshot(sessionID: string): boolean;
/**
* Remove a stored profile by key
* @param sessionID key
*/
clearProfileSnapshot(sessionID: string): void;
}

View File

@ -24,7 +24,6 @@ export declare class RagfairOfferService {
protected httpResponse: HttpResponseUtil; protected httpResponse: HttpResponseUtil;
protected configServer: ConfigServer; protected configServer: ConfigServer;
protected playerOffersLoaded: boolean; protected playerOffersLoaded: boolean;
protected toUpdate: Record<string, boolean>;
protected expiredOffers: Item[]; protected expiredOffers: Item[];
protected offers: IRagfairOffer[]; protected offers: IRagfairOffer[];
protected ragfairConfig: IRagfairConfig; protected ragfairConfig: IRagfairConfig;
@ -38,8 +37,6 @@ export declare class RagfairOfferService {
getOffersOfType(templateId: string): IRagfairOffer[]; getOffersOfType(templateId: string): IRagfairOffer[];
addOffer(offer: IRagfairOffer): void; addOffer(offer: IRagfairOffer): void;
addOfferToExpired(staleOffer: IRagfairOffer): void; addOfferToExpired(staleOffer: IRagfairOffer): void;
setTraderUpdateStatus(traderId: string, shouldUpdate: boolean): void;
shouldTraderBeUpdated(traderID: string): boolean;
getExpiredOfferCount(): number; getExpiredOfferCount(): number;
/** /**
* Get an array of expired items not yet processed into new offers * Get an array of expired items not yet processed into new offers
@ -53,12 +50,15 @@ export declare class RagfairOfferService {
* @returns offer exists - true * @returns offer exists - true
*/ */
doesOfferExist(offerId: string): boolean; doesOfferExist(offerId: string): boolean;
getTraders(): Record<string, boolean>;
flagTraderForUpdate(expiredOfferUserId: string): void;
removeOfferById(offerId: string): void; removeOfferById(offerId: string): void;
removeOfferStack(offerID: string, amount: number): void; removeOfferStack(offerID: string, amount: number): void;
removeAllOffersByTrader(traderId: string): void; removeAllOffersByTrader(traderId: string): void;
addTradersToUpdateList(): void; /**
* Do the trader offers on flea need to be refreshed
* @param traderID Trader to check
* @returns true if they do
*/
traderOffersNeedRefreshing(traderID: string): boolean;
addPlayerOffers(): void; addPlayerOffers(): void;
expireStaleOffers(): void; expireStaleOffers(): void;
/** /**

View File

@ -27,6 +27,20 @@ export declare class RagfairPriceService {
getDynamicPrice(itemTpl: string): number; getDynamicPrice(itemTpl: string): number;
getAllFleaPrices(): Record<string, number>; getAllFleaPrices(): Record<string, number>;
getFleaPriceForItem(tplId: string): number; getFleaPriceForItem(tplId: string): number;
/**
* Check to see if an items price is below its handbook price and adjust accoring to values set to config/ragfair.json
* @param itemPrice price of item
* @param itemTpl item template Id being checked
* @returns adjusted price value in roubles
*/
protected adjustPriceIfBelowHandbook(itemPrice: number, itemTpl: string): number;
/**
* Get the percentage difference between two values
* @param a numerical value a
* @param b numerical value b
* @returns different in percent
*/
protected getPriceDifference(a: number, b: number): number;
getStaticPriceForItem(tplId: string): number; getStaticPriceForItem(tplId: string): number;
getBarterPrice(barterScheme: IBarterScheme[]): number; getBarterPrice(barterScheme: IBarterScheme[]): number;
getDynamicOfferPrice(items: Item[], desiredCurrency: string): number; getDynamicOfferPrice(items: Item[], desiredCurrency: string): number;

View File

@ -2,5 +2,10 @@ import { ITraderAssort } from "../models/eft/common/tables/ITrader";
export declare class TraderAssortService { export declare class TraderAssortService {
protected pristineTraderAssorts: Record<string, ITraderAssort>; protected pristineTraderAssorts: Record<string, ITraderAssort>;
getPristineTraderAssort(traderId: string): ITraderAssort; getPristineTraderAssort(traderId: string): ITraderAssort;
/**
* Store trader assorts inside a class property
* @param traderId Traderid to store assorts against
* @param assort Assorts to store
*/
setPristineTraderAssort(traderId: string, assort: ITraderAssort): void; setPristineTraderAssort(traderId: string, assort: ITraderAssort): void;
} }

View File

@ -4,6 +4,10 @@ export declare class TimeUtil {
formatDate(date: Date): string; formatDate(date: Date): string;
getDate(): string; getDate(): string;
getTime(): string; getTime(): string;
/**
* Get timestamp in seconds
* @returns
*/
getTimestamp(): number; getTimestamp(): number;
/** /**
* mail in eft requires time be in a specific format * mail in eft requires time be in a specific format

View File

@ -4,7 +4,7 @@
"main": "src/mod.js", "main": "src/mod.js",
"license": "MIT", "license": "MIT",
"author": "Chomp", "author": "Chomp",
"akiVersion": "3.1.1", "akiVersion": "3.2.1",
"scripts": { "scripts": {
"setup:environment": "npm i", "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", "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

@ -1,5 +1,5 @@
import { InsuranceController } from "../controllers/InsuranceController"; import { InsuranceController } from "../controllers/InsuranceController";
import { OnLoadOnUpdate } from "../di/OnLoadOnUpdate"; import { OnUpdate } from "../di/OnUpdate";
import { IPmcData } from "../models/eft/common/IPmcData"; import { IPmcData } from "../models/eft/common/IPmcData";
import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData";
import { IGetInsuranceCostRequestData } from "../models/eft/insurance/IGetInsuranceCostRequestData"; import { IGetInsuranceCostRequestData } from "../models/eft/insurance/IGetInsuranceCostRequestData";
@ -10,14 +10,13 @@ import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig";
import { ConfigServer } from "../servers/ConfigServer"; import { ConfigServer } from "../servers/ConfigServer";
import { InsuranceService } from "../services/InsuranceService"; import { InsuranceService } from "../services/InsuranceService";
import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil";
export declare class InsuranceCallbacks extends OnLoadOnUpdate { export declare class InsuranceCallbacks extends OnUpdate {
protected insuranceController: InsuranceController; protected insuranceController: InsuranceController;
protected insuranceService: InsuranceService; protected insuranceService: InsuranceService;
protected httpResponse: HttpResponseUtil; protected httpResponse: HttpResponseUtil;
protected configServer: ConfigServer; protected configServer: ConfigServer;
protected insuranceConfig: IInsuranceConfig; protected insuranceConfig: IInsuranceConfig;
constructor(insuranceController: InsuranceController, insuranceService: InsuranceService, httpResponse: HttpResponseUtil, configServer: ConfigServer); constructor(insuranceController: InsuranceController, insuranceService: InsuranceService, httpResponse: HttpResponseUtil, configServer: ConfigServer);
onLoad(): void;
getInsuranceCost(url: string, info: IGetInsuranceCostRequestData, sessionID: string): IGetBodyResponseData<IGetInsuranceCostResponseData>; getInsuranceCost(url: string, info: IGetInsuranceCostRequestData, sessionID: string): IGetBodyResponseData<IGetInsuranceCostResponseData>;
insure(pmcData: IPmcData, body: IInsureRequestData, sessionID: string): IItemEventRouterResponse; insure(pmcData: IPmcData, body: IInsureRequestData, sessionID: string): IItemEventRouterResponse;
onUpdate(secondsSinceLastRun: number): boolean; onUpdate(secondsSinceLastRun: number): boolean;

View File

@ -9,10 +9,10 @@ export declare class TraderCallbacks extends OnLoadOnUpdate {
protected traderController: TraderController; protected traderController: TraderController;
constructor(httpResponse: HttpResponseUtil, traderController: TraderController); constructor(httpResponse: HttpResponseUtil, traderController: TraderController);
onLoad(): void; onLoad(): void;
onUpdate(): boolean;
getRoute(): string; getRoute(): string;
getTraderSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<ITraderBase[]>; getTraderSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<ITraderBase[]>;
getProfilePurchases(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<Record<string, IBarterScheme[][]>>; getProfilePurchases(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<Record<string, IBarterScheme[][]>>;
getTrader(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<ITraderBase>; getTrader(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<ITraderBase>;
getAssort(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<ITraderAssort>; getAssort(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<ITraderAssort>;
onUpdate(): boolean;
} }

View File

@ -25,4 +25,5 @@ export declare class GameController {
protected logProfileDetails(fullProfile: IAkiProfile): void; protected logProfileDetails(fullProfile: IAkiProfile): void;
getGameConfig(sessionID: string): IGameConfigResponse; getGameConfig(sessionID: string): IGameConfigResponse;
getServer(): any[]; getServer(): any[];
getValidGameVersion(): any;
} }

View File

@ -28,6 +28,7 @@ import { HashUtil } from "../utils/HashUtil";
import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil";
import { RandomUtil } from "../utils/RandomUtil"; import { RandomUtil } from "../utils/RandomUtil";
import { TimeUtil } from "../utils/TimeUtil"; import { TimeUtil } from "../utils/TimeUtil";
import { JsonUtil } from "../utils/JsonUtil";
export declare class HideoutController { export declare class HideoutController {
protected logger: ILogger; protected logger: ILogger;
protected hashUtil: HashUtil; protected hashUtil: HashUtil;
@ -45,9 +46,10 @@ export declare class HideoutController {
protected hideoutHelper: HideoutHelper; protected hideoutHelper: HideoutHelper;
protected scavCaseRewardGenerator: ScavCaseRewardGenerator; protected scavCaseRewardGenerator: ScavCaseRewardGenerator;
protected configServer: ConfigServer; protected configServer: ConfigServer;
protected jsonUtil: JsonUtil;
protected static nameBackendCountersCrafting: string; protected static nameBackendCountersCrafting: string;
protected hideoutConfig: IHideoutConfig; protected hideoutConfig: IHideoutConfig;
constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, itemEventRouter: ItemEventRouter, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, configServer: ConfigServer); constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, itemEventRouter: ItemEventRouter, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, configServer: ConfigServer, jsonUtil: JsonUtil);
upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse;
upgradeComplete(pmcData: IPmcData, body: HideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; upgradeComplete(pmcData: IPmcData, body: HideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse;
/** /**

View File

@ -5,9 +5,11 @@ import { ItemHelper } from "../helpers/ItemHelper";
import { ProfileHelper } from "../helpers/ProfileHelper"; import { ProfileHelper } from "../helpers/ProfileHelper";
import { QuestHelper } from "../helpers/QuestHelper"; import { QuestHelper } from "../helpers/QuestHelper";
import { TraderHelper } from "../helpers/TraderHelper"; import { TraderHelper } from "../helpers/TraderHelper";
import { IPmcData } from "../models/eft/common/IPmcData";
import { IRegisterPlayerRequestData } from "../models/eft/inRaid/IRegisterPlayerRequestData"; import { IRegisterPlayerRequestData } from "../models/eft/inRaid/IRegisterPlayerRequestData";
import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData";
import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; import { IInRaidConfig } from "../models/spt/config/IInRaidConfig";
import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer"; import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer"; import { DatabaseServer } from "../servers/DatabaseServer";
import { SaveServer } from "../servers/SaveServer"; import { SaveServer } from "../servers/SaveServer";
@ -15,6 +17,7 @@ import { InsuranceService } from "../services/InsuranceService";
import { JsonUtil } from "../utils/JsonUtil"; import { JsonUtil } from "../utils/JsonUtil";
import { TimeUtil } from "../utils/TimeUtil"; import { TimeUtil } from "../utils/TimeUtil";
export declare class InraidController { export declare class InraidController {
protected logger: ILogger;
protected saveServer: SaveServer; protected saveServer: SaveServer;
protected jsonUtil: JsonUtil; protected jsonUtil: JsonUtil;
protected timeUtil: TimeUtil; protected timeUtil: TimeUtil;
@ -29,7 +32,7 @@ export declare class InraidController {
protected inRaidHelper: InRaidHelper; protected inRaidHelper: InRaidHelper;
protected configServer: ConfigServer; protected configServer: ConfigServer;
protected inraidConfig: IInRaidConfig; protected inraidConfig: IInRaidConfig;
constructor(saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, configServer: ConfigServer); constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, configServer: ConfigServer);
addPlayer(sessionID: string, info: IRegisterPlayerRequestData): void; addPlayer(sessionID: string, info: IRegisterPlayerRequestData): void;
saveProgress(offraidData: ISaveProgressRequestData, sessionID: string): void; saveProgress(offraidData: ISaveProgressRequestData, sessionID: string): void;
/** /**
@ -38,7 +41,7 @@ export declare class InraidController {
* @param pmcData player profile * @param pmcData player profile
* @param isPlayerScav Was the player a pScav * @param isPlayerScav Was the player a pScav
*/ */
private markOrRemoveFoundInRaidItems; protected markOrRemoveFoundInRaidItems(offraidData: ISaveProgressRequestData, pmcData: IPmcData, isPlayerScav: boolean): void;
private handlePostRaidPlayerScavProcess; protected handlePostRaidPlayerScavProcess(scavData: IPmcData, sessionID: string, offraidData: ISaveProgressRequestData, pmcData: IPmcData, isDead: boolean): void;
private handlePostRaidPlayerScavKarmaChanges; protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData, scavData: IPmcData, sessionID: string): void;
} }

View File

@ -11,21 +11,25 @@ import { IJoinMatchResult } from "../models/eft/match/IJoinMatchResult";
import { IStartOfflineRaidRequestData } from "../models/eft/match/IStartOffineRaidRequestData"; import { IStartOfflineRaidRequestData } from "../models/eft/match/IStartOffineRaidRequestData";
import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; import { IInRaidConfig } from "../models/spt/config/IInRaidConfig";
import { IMatchConfig } from "../models/spt/config/IMatchConfig"; import { IMatchConfig } from "../models/spt/config/IMatchConfig";
import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer"; import { ConfigServer } from "../servers/ConfigServer";
import { SaveServer } from "../servers/SaveServer"; import { SaveServer } from "../servers/SaveServer";
import { BotLootCacheService } from "../services/BotLootCacheService"; import { BotLootCacheService } from "../services/BotLootCacheService";
import { MatchLocationService } from "../services/MatchLocationService"; import { MatchLocationService } from "../services/MatchLocationService";
import { ProfileSnapshotService } from "../services/ProfileSnapshotService";
export declare class MatchController { export declare class MatchController {
protected logger: ILogger;
protected saveServer: SaveServer; protected saveServer: SaveServer;
protected profileHelper: ProfileHelper; protected profileHelper: ProfileHelper;
protected matchLocationService: MatchLocationService; protected matchLocationService: MatchLocationService;
protected traderHelper: TraderHelper; protected traderHelper: TraderHelper;
protected botLootCacheService: BotLootCacheService; protected botLootCacheService: BotLootCacheService;
protected configServer: ConfigServer; protected configServer: ConfigServer;
protected profileSnapshotService: ProfileSnapshotService;
protected applicationContext: ApplicationContext; protected applicationContext: ApplicationContext;
protected matchConfig: IMatchConfig; protected matchConfig: IMatchConfig;
protected inraidConfig: IInRaidConfig; protected inraidConfig: IInRaidConfig;
constructor(saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, applicationContext: ApplicationContext); constructor(logger: ILogger, saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, applicationContext: ApplicationContext);
getEnabled(): boolean; getEnabled(): boolean;
getProfile(info: IGetProfileRequestData): IPmcData[]; getProfile(info: IGetProfileRequestData): IPmcData[];
createGroup(sessionID: string, info: ICreateGroupRequestData): any; createGroup(sessionID: string, info: ICreateGroupRequestData): any;

View File

@ -17,10 +17,25 @@ export declare class TraderController {
protected traderAssortService: TraderAssortService; protected traderAssortService: TraderAssortService;
protected jsonUtil: JsonUtil; protected jsonUtil: JsonUtil;
constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, timeUtil: TimeUtil, traderAssortService: TraderAssortService, jsonUtil: JsonUtil); constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, timeUtil: TimeUtil, traderAssortService: TraderAssortService, jsonUtil: JsonUtil);
/**
* Runs when onLoad event is fired
* Iterate over traders, ensure an unmolested copy of their assorts is stored in traderAssortService
* Store timestamp of next assort refresh in nextResupply property of traders .base object
*/
load(): void; load(): void;
getTrader(traderID: string, sessionID: string): ITraderBase; /**
* Runs when onUpdate is fired
* If current time is > nextResupply(expire) time of trader, refresh traders assorts and
* @returns has run
*/
update(): boolean;
/**
* Return an array of all traders
* @param sessionID Session id
* @returns array if ITraderBase objects
*/
getAllTraders(sessionID: string): ITraderBase[]; getAllTraders(sessionID: string): ITraderBase[];
updateTraders(): boolean; getTrader(sessionID: string, traderID: string): ITraderBase;
getAssort(sessionId: string, traderId: string): ITraderAssort; getAssort(sessionId: string, traderId: string): ITraderAssort;
getPurchasesData(traderID: string, sessionID: string): Record<string, IBarterScheme[][]>; getPurchasesData(sessionID: string, traderID: string): Record<string, IBarterScheme[][]>;
} }

View File

@ -41,15 +41,37 @@ export declare class RagfairOfferGenerator {
createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer;
protected getTraderId(userID: string): string; protected getTraderId(userID: string): string;
protected getRating(userID: string): number; protected getRating(userID: string): number;
/**
* Is the offers user rating growing
* @param userID user to check rating of
* @returns true if its growing
*/
protected getRatingGrowing(userID: string): boolean; protected getRatingGrowing(userID: string): boolean;
/**
* Get number of section until offer should expire
* @param userID Id of the offer owner
* @param time Time the offer is posted
* @returns number of seconds until offer expires
*/
protected getOfferEndTime(userID: string, time: number): number; protected getOfferEndTime(userID: string, time: number): number;
/** /**
* Create multiple offers for items by using a unique list of items we've generated previously * Create multiple offers for items by using a unique list of items we've generated previously
* @param expiredOffers * @param expiredOffers optional, expired offers to regenerate
*/ */
generateDynamicOffers(expiredOffers?: Item[]): void; generateDynamicOffers(expiredOffers?: Item[]): void;
generateTraderOffers(traderID: string): void; /**
* Generate trader offers on flea using the traders assort data
* @param traderID Trader to generate offers for
*/
generateFleaOffersForTrader(traderID: string): void;
protected getItemCondition(userID: string, items: Item[], itemDetails: ITemplateItem): Item[]; protected getItemCondition(userID: string, items: Item[], itemDetails: ITemplateItem): Item[];
/**
* Add missing conditions to an item if needed
* Durabiltiy for repairable items
* HpResource for medical items
* @param item item to add conditions to
* @returns Item with conditions added
*/
protected addMissingCondition(item: Item): Item; protected addMissingCondition(item: Item): Item;
protected getOfferRequirements(items: Item[]): { protected getOfferRequirements(items: Item[]): {
count: number; count: number;
@ -57,6 +79,14 @@ export declare class RagfairOfferGenerator {
}[]; }[];
/** /**
* Create a flea offer and store it in the Ragfair server offers array * Create a flea offer and store it in the Ragfair server offers array
* @param userID owner of the offer
* @param time time offer is put up
* @param items items in the offer
* @param barterScheme
* @param loyalLevel
* @param price price of offer
* @param sellInOnePiece
* @returns
*/ */
createFleaOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; createFleaOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer;
} }

View File

@ -5,6 +5,7 @@ import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequ
import { ILogger } from "../models/spt/utils/ILogger"; import { ILogger } from "../models/spt/utils/ILogger";
import { DatabaseServer } from "../servers/DatabaseServer"; import { DatabaseServer } from "../servers/DatabaseServer";
import { SaveServer } from "../servers/SaveServer"; import { SaveServer } from "../servers/SaveServer";
import { ProfileFixerService } from "../services/ProfileFixerService";
import { JsonUtil } from "../utils/JsonUtil"; import { JsonUtil } from "../utils/JsonUtil";
import { InventoryHelper } from "./InventoryHelper"; import { InventoryHelper } from "./InventoryHelper";
import { PaymentHelper } from "./PaymentHelper"; import { PaymentHelper } from "./PaymentHelper";
@ -15,7 +16,8 @@ export declare class InRaidHelper {
protected databaseServer: DatabaseServer; protected databaseServer: DatabaseServer;
protected inventoryHelper: InventoryHelper; protected inventoryHelper: InventoryHelper;
protected paymentHelper: PaymentHelper; protected paymentHelper: PaymentHelper;
constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper); protected profileFixerService: ProfileFixerService;
constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper, profileFixerService: ProfileFixerService);
/** /**
* Reset the SPT inraid property stored in a profile to 'none' * Reset the SPT inraid property stored in a profile to 'none'
* @param sessionID Session id * @param sessionID Session id

View File

@ -43,6 +43,7 @@ export declare class InventoryHelper {
constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, configServer: ConfigServer); constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, configServer: ConfigServer);
addItem(pmcData: IPmcData, body: IAddItemRequestData, output: IItemEventRouterResponse, sessionID: string, callback: any, foundInRaid?: boolean, addUpd?: any): IItemEventRouterResponse; addItem(pmcData: IPmcData, body: IAddItemRequestData, output: IItemEventRouterResponse, sessionID: string, callback: any, foundInRaid?: boolean, addUpd?: any): IItemEventRouterResponse;
removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse;
removeItemByCount(pmcData: IPmcData, itemId: string, count: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse;
getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): Record<number, number>; getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): Record<number, number>;
protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): Record<number, number>; protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): Record<number, number>;
protected getInventoryItemHash(inventoryItem: Item[]): InventoryHelper.InventoryItemHash; protected getInventoryItemHash(inventoryItem: Item[]): InventoryHelper.InventoryItemHash;

View File

@ -2,22 +2,26 @@ import { IPmcData } from "../models/eft/common/IPmcData";
import { Stats } from "../models/eft/common/tables/IBotBase"; import { Stats } from "../models/eft/common/tables/IBotBase";
import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile";
import { IValidateNicknameRequestData } from "../models/eft/profile/IValidateNicknameRequestData"; import { IValidateNicknameRequestData } from "../models/eft/profile/IValidateNicknameRequestData";
import { ILogger } from "../models/spt/utils/ILogger";
import { DatabaseServer } from "../servers/DatabaseServer"; import { DatabaseServer } from "../servers/DatabaseServer";
import { SaveServer } from "../servers/SaveServer"; import { SaveServer } from "../servers/SaveServer";
import { FenceService } from "../services/FenceService"; import { FenceService } from "../services/FenceService";
import { ProfileSnapshotService } from "../services/ProfileSnapshotService";
import { JsonUtil } from "../utils/JsonUtil"; import { JsonUtil } from "../utils/JsonUtil";
import { TimeUtil } from "../utils/TimeUtil"; import { TimeUtil } from "../utils/TimeUtil";
import { Watermark } from "../utils/Watermark"; import { Watermark } from "../utils/Watermark";
import { ItemHelper } from "./ItemHelper"; import { ItemHelper } from "./ItemHelper";
export declare class ProfileHelper { export declare class ProfileHelper {
protected logger: ILogger;
protected jsonUtil: JsonUtil; protected jsonUtil: JsonUtil;
protected watermark: Watermark; protected watermark: Watermark;
protected timeUtil: TimeUtil; protected timeUtil: TimeUtil;
protected saveServer: SaveServer; protected saveServer: SaveServer;
protected databaseServer: DatabaseServer; protected databaseServer: DatabaseServer;
protected itemHelper: ItemHelper; protected itemHelper: ItemHelper;
protected profileSnapshotService: ProfileSnapshotService;
protected fenceService: FenceService; protected fenceService: FenceService;
constructor(jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, fenceService: FenceService); constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, fenceService: FenceService);
resetProfileQuestCondition(sessionID: string, conditionId: string): void; resetProfileQuestCondition(sessionID: string, conditionId: string): void;
getCompleteProfile(sessionID: string): IPmcData[]; getCompleteProfile(sessionID: string): IPmcData[];
isNicknameTaken(info: IValidateNicknameRequestData, sessionID: string): boolean; isNicknameTaken(info: IValidateNicknameRequestData, sessionID: string): boolean;

View File

@ -42,7 +42,15 @@ export declare class QuestHelper {
*/ */
evaluateLevel(pmcProfile: IPmcData, cond: AvailableForConditions): boolean; evaluateLevel(pmcProfile: IPmcData, cond: AvailableForConditions): boolean;
getDeltaQuests(before: IQuest[], after: IQuest[]): IQuest[]; getDeltaQuests(before: IQuest[], after: IQuest[]): IQuest[];
rewardSkillPoints(sessionID: string, pmcData: IPmcData, output: IItemEventRouterResponse, skillName: string, progress: number): void; /**
* Increase skill points of a skill on player profile
* @param sessionID Session id
* @param pmcData Player profile
* @param output output object to send back to client
* @param skillName Name of skill to increase skill points of
* @param progressAmount Amount of skill points to add to skill
*/
rewardSkillPoints(sessionID: string, pmcData: IPmcData, output: IItemEventRouterResponse, skillName: string, progressAmount: number): void;
getQuestLocale(questId: string): any; getQuestLocale(questId: string): any;
/** /**
* Debug Routine for showing some information on the * Debug Routine for showing some information on the

View File

@ -1,7 +1,8 @@
import { RagfairAssortGenerator } from "../generators/RagfairAssortGenerator"; import { RagfairAssortGenerator } from "../generators/RagfairAssortGenerator";
import { RagfairOfferGenerator } from "../generators/RagfairOfferGenerator"; import { RagfairOfferGenerator } from "../generators/RagfairOfferGenerator";
import { IPmcData } from "../models/eft/common/IPmcData";
import { Item } from "../models/eft/common/tables/IItem"; import { Item } from "../models/eft/common/tables/IItem";
import { ITraderAssort } from "../models/eft/common/tables/ITrader"; import { ITrader, ITraderAssort } from "../models/eft/common/tables/ITrader";
import { ITraderConfig } from "../models/spt/config/ITraderConfig"; import { ITraderConfig } from "../models/spt/config/ITraderConfig";
import { ILogger } from "../models/spt/utils/ILogger"; import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer"; import { ConfigServer } from "../servers/ConfigServer";
@ -10,13 +11,16 @@ import { FenceService } from "../services/FenceService";
import { TraderAssortService } from "../services/TraderAssortService"; import { TraderAssortService } from "../services/TraderAssortService";
import { JsonUtil } from "../utils/JsonUtil"; import { JsonUtil } from "../utils/JsonUtil";
import { MathUtil } from "../utils/MathUtil"; import { MathUtil } from "../utils/MathUtil";
import { TimeUtil } from "../utils/TimeUtil";
import { AssortHelper } from "./AssortHelper"; import { AssortHelper } from "./AssortHelper";
import { PaymentHelper } from "./PaymentHelper"; import { PaymentHelper } from "./PaymentHelper";
import { ProfileHelper } from "./ProfileHelper"; import { ProfileHelper } from "./ProfileHelper";
import { TraderHelper } from "./TraderHelper";
export declare class TraderAssortHelper { export declare class TraderAssortHelper {
protected logger: ILogger; protected logger: ILogger;
protected jsonUtil: JsonUtil; protected jsonUtil: JsonUtil;
protected mathUtil: MathUtil; protected mathUtil: MathUtil;
protected timeUtil: TimeUtil;
protected databaseServer: DatabaseServer; protected databaseServer: DatabaseServer;
protected profileHelper: ProfileHelper; protected profileHelper: ProfileHelper;
protected assortHelper: AssortHelper; protected assortHelper: AssortHelper;
@ -24,18 +28,37 @@ export declare class TraderAssortHelper {
protected ragfairAssortGenerator: RagfairAssortGenerator; protected ragfairAssortGenerator: RagfairAssortGenerator;
protected ragfairOfferGenerator: RagfairOfferGenerator; protected ragfairOfferGenerator: RagfairOfferGenerator;
protected traderAssortService: TraderAssortService; protected traderAssortService: TraderAssortService;
protected traderHelper: TraderHelper;
protected fenceService: FenceService; protected fenceService: FenceService;
protected configServer: ConfigServer; protected configServer: ConfigServer;
protected traderConfig: ITraderConfig; protected traderConfig: ITraderConfig;
constructor(logger: ILogger, jsonUtil: JsonUtil, mathUtil: MathUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, paymentHelper: PaymentHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, fenceService: FenceService, configServer: ConfigServer); constructor(logger: ILogger, jsonUtil: JsonUtil, mathUtil: MathUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, paymentHelper: PaymentHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, traderHelper: TraderHelper, fenceService: FenceService, configServer: ConfigServer);
/** /**
* Get a traders assorts * Get a traders assorts
* Can be used for returning ragfair / fence assorts * Can be used for returning ragfair / fence assorts
* Filter out assorts not unlocked due to level OR quest completion
* @param sessionId session id * @param sessionId session id
* @param traderId trader id * @param traderId traders id
* @returns a traders assorts * @returns a traders' assorts
*/ */
getAssort(sessionId: string, traderId: string): ITraderAssort; getAssort(sessionId: string, traderId: string): ITraderAssort;
/**
* if the fence assorts have expired, re-generate them
* @param pmcProfile Players profile
*/
refreshFenceAssortIfExpired(pmcProfile: IPmcData): void;
/**
* Reset a traders assorts and move nextResupply value to future
* Flag trader as needing a flea offer reset to be picked up by flea update() function
* @param trader trader details to alter
*/
resetExpiredTrader(trader: ITrader): void;
/**
* Does the supplied trader need its assorts refreshed
* @param traderID Trader to check
* @returns true they need refreshing
*/
traderAssortsHaveExpired(traderID: string): boolean;
/** /**
* Iterate over all assorts barter_scheme values, find barters selling for money and multiply by multipler in config * Iterate over all assorts barter_scheme values, find barters selling for money and multiply by multipler in config
* @param traderAssort Assorts to multiple price of * @param traderAssort Assorts to multiple price of

View File

@ -9,6 +9,7 @@ import { DatabaseServer } from "../servers/DatabaseServer";
import { SaveServer } from "../servers/SaveServer"; import { SaveServer } from "../servers/SaveServer";
import { FenceService } from "../services/FenceService"; import { FenceService } from "../services/FenceService";
import { PlayerService } from "../services/PlayerService"; import { PlayerService } from "../services/PlayerService";
import { TimeUtil } from "../utils/TimeUtil";
import { HandbookHelper } from "./HandbookHelper"; import { HandbookHelper } from "./HandbookHelper";
import { ItemHelper } from "./ItemHelper"; import { ItemHelper } from "./ItemHelper";
import { PaymentHelper } from "./PaymentHelper"; import { PaymentHelper } from "./PaymentHelper";
@ -23,9 +24,10 @@ export declare class TraderHelper {
protected handbookHelper: HandbookHelper; protected handbookHelper: HandbookHelper;
protected playerService: PlayerService; protected playerService: PlayerService;
protected fenceService: FenceService; protected fenceService: FenceService;
protected timeUtil: TimeUtil;
protected configServer: ConfigServer; protected configServer: ConfigServer;
protected traderConfig: ITraderConfig; protected traderConfig: ITraderConfig;
constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, itemHelper: ItemHelper, handbookHelper: HandbookHelper, playerService: PlayerService, fenceService: FenceService, configServer: ConfigServer); constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, itemHelper: ItemHelper, handbookHelper: HandbookHelper, playerService: PlayerService, fenceService: FenceService, timeUtil: TimeUtil, configServer: ConfigServer);
getTrader(traderID: string, sessionID: string): ITraderBase; getTrader(traderID: string, sessionID: string): ITraderBase;
getTraderAssortsById(traderId: string): ITraderAssort; getTraderAssortsById(traderId: string): ITraderAssort;
/** /**
@ -97,6 +99,17 @@ export declare class TraderHelper {
* @param sessionID session id * @param sessionID session id
*/ */
lvlUp(traderID: string, sessionID: string): void; lvlUp(traderID: string, sessionID: string): void;
/**
* Get the next update timestamp for a trader
* @param traderID Trader to look up update value for
* @returns future timestamp
*/
getNextUpdateTimestamp(traderID: string): number;
/**
* Get the reset time between trader assort refreshes in seconds
* @param traderId Trader to look up
* @returns Time in seconds
*/
getTraderUpdateSeconds(traderId: string): number; getTraderUpdateSeconds(traderId: string): number;
/** /**
* check if an item is allowed to be sold to a trader * check if an item is allowed to be sold to a trader

View File

@ -32,6 +32,17 @@ export declare class PreAkiModLoader implements IModLoader {
getModPath(mod: string): string; getModPath(mod: string): string;
protected importClass(name: string, filepath: string, container: DependencyContainer): void; protected importClass(name: string, filepath: string, container: DependencyContainer): void;
protected importMods(): Promise<void>; protected importMods(): Promise<void>;
/**
* Check for duplciate mods loaded, show error if duplicate mod found
* @param modPackageData dictionary of mod package.json data
*/
protected checkForDuplicateMods(modPackageData: Record<string, IPackageJsonData>): void;
/**
* Check for and return duplicate strings inside an array
* @param stringArray Array to check for duplicates
* @returns string array of duplicates, empty if none found
*/
protected getDuplicates(stringArray: string[]): string[];
/** /**
* *
* @param mods Get an array of broken/invalid mods by name * @param mods Get an array of broken/invalid mods by name

View File

@ -137,7 +137,7 @@ export interface BotLocationModifier {
VisibleDistance: number; VisibleDistance: number;
} }
export interface MinMaxBot { export interface MinMaxBot {
WildSpawnType: string; WildSpawnType: WildSpawnType;
max: number; max: number;
min: number; min: number;
} }
@ -195,7 +195,7 @@ export interface Wave {
BotPreset: string; BotPreset: string;
BotSide: string; BotSide: string;
SpawnPoints: string; SpawnPoints: string;
WildSpawnType: string; WildSpawnType: WildSpawnType;
isPlayers: boolean; isPlayers: boolean;
number: number; number: number;
slots_max: number; slots_max: number;
@ -203,3 +203,7 @@ export interface Wave {
time_max: number; time_max: number;
time_min: number; time_min: number;
} }
export declare enum WildSpawnType {
ASSAULT = "assault",
MARKSMAN = "marksman"
}

View File

@ -66,13 +66,13 @@ export interface IBan {
dateTime: number; dateTime: number;
} }
export declare enum BanType { export declare enum BanType {
Chat = 0, CHAT = 0,
RagFair = 1, RAGFAIR = 1,
Voip = 2, VOIP = 2,
Trading = 3, TRADING = 3,
Online = 4, ONLINE = 4,
Friends = 5, FRIENDS = 5,
ChangeNickname = 6 CHANGE_NICKNAME = 6
} }
export interface Customization { export interface Customization {
Head: string; Head: string;
@ -312,11 +312,11 @@ export interface Notes {
export interface CarExtractCounts { export interface CarExtractCounts {
} }
export declare enum SurvivorClass { export declare enum SurvivorClass {
Unknown = 0, UNKNOWN = 0,
Neutralizer = 1, NEUTRALIZER = 1,
Marauder = 2, MARAUDER = 2,
Paramedic = 3, PARAMEDIC = 3,
Survivor = 4 SURVIVOR = 4
} }
export interface Quest { export interface Quest {
qid: string; qid: string;

View File

@ -7,7 +7,7 @@ export interface ITrader {
suits?: ISuit[]; suits?: ISuit[];
} }
export interface ITraderBase { export interface ITraderBase {
refreshAssort: boolean; refreshTraderRagfairOffers: boolean;
_id: string; _id: string;
avatar: string; avatar: string;
balance_dol: number; balance_dol: number;
@ -58,7 +58,7 @@ export interface Repair {
quality: string; quality: string;
} }
export interface ITraderAssort { export interface ITraderAssort {
nextResupply?: number; nextResupply: number;
items: Item[]; items: Item[];
barter_scheme: Record<string, IBarterScheme[][]>; barter_scheme: Record<string, IBarterScheme[][]>;
loyal_level_items: Record<string, number>; loyal_level_items: Record<string, number>;

View File

@ -1,5 +1,5 @@
export declare enum Effect { export declare enum Effect {
Fracture = "Fracture", FRACTURE = "Fracture",
LightBleeding = "LightBleeding", LIGHT_BLEEDING = "LightBleeding",
HeavyBleeding = "HeavyBleeding" HEAVY_BLEEDING = "HeavyBleeding"
} }

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