Update types folders

This commit is contained in:
Chomp 2022-07-24 21:22:02 +01:00
parent d2f5908185
commit 6d75f99d7a
252 changed files with 3220 additions and 770 deletions

View File

@ -1,9 +1,6 @@
import { GameHelper } from "../helpers/GameHelper";
import { HttpServerHelper } from "../helpers/HttpServerHelper";
import { ProfileHelper } from "../helpers/ProfileHelper";
import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData";
import { IPmcData } from "../models/eft/common/IPmcData";
import { IPmcDataRepeatableQuest, IRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests";
import { IGameConfigResponse } from "../models/eft/game/IGameConfigResponse";
import { IAkiProfile } from "../models/eft/profile/IAkiProfile";
import { ICoreConfig } from "../models/spt/config/ICoreConfig";
@ -11,6 +8,7 @@ import { IHttpConfig } from "../models/spt/config/IHttpConfig";
import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer";
import { LocaleService } from "../services/LocaleService";
import { ProfileFixerService } from "../services/ProfileFixerService";
import { Watermark } from "../utils/Watermark";
export declare class GameController {
protected logger: ILogger;
@ -18,25 +16,13 @@ export declare class GameController {
protected httpServerHelper: HttpServerHelper;
protected localeService: LocaleService;
protected profileHelper: ProfileHelper;
protected gameHelper: GameHelper;
protected profileFixerService: ProfileFixerService;
protected configServer: ConfigServer;
protected httpConfig: IHttpConfig;
protected coreConfig: ICoreConfig;
constructor(logger: ILogger, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, gameHelper: GameHelper, configServer: ConfigServer);
constructor(logger: ILogger, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, configServer: ConfigServer);
gameStart(_url: string, _info: IEmptyRequestData, sessionID: string): void;
protected addMissingBonusesProperty(pmcProfile: IPmcData): void;
protected addMissingRepeatableQuestsProperty(pmcProfile: IPmcData): void;
protected addMissingWeaponRepairSkill(pmcProfile: IPmcData): void;
protected addMissingAkiVersionTagToProfile(fullProfile: IAkiProfile): void;
/**
* In 18876 bsg changed the pockets tplid to be one that has 3 additional special slots
* @param pmcProfile
*/
protected updateProfilePocketsToNewId(pmcProfile: IPmcData): void;
protected addMissingArmorRepairSkill(pmcProfile: IPmcData): void;
protected fixNullTraderSalesSums(pmcProfile: IPmcData): void;
protected removeDanglingBackendCounters(pmcProfile: IPmcData): void;
protected logProfileDetails(fullProfile: IAkiProfile): void;
getGameConfig(sessionID: string): IGameConfigResponse;
getServer(): any[];
protected getActiveRepeatableQuests(repeatableQuests: IPmcDataRepeatableQuest[]): IRepeatableQuest[];
}

View File

@ -12,16 +12,18 @@ import { IInRaidConfig } from "../models/spt/config/IInRaidConfig";
import { IMatchConfig } from "../models/spt/config/IMatchConfig";
import { ConfigServer } from "../servers/ConfigServer";
import { SaveServer } from "../servers/SaveServer";
import { BotLootCacheService } from "../services/BotLootCacheService";
import { MatchLocationService } from "../services/MatchLocationService";
export declare class MatchController {
protected saveServer: SaveServer;
protected profileHelper: ProfileHelper;
protected matchLocationService: MatchLocationService;
protected traderHelper: TraderHelper;
protected botLootCacheService: BotLootCacheService;
protected configServer: ConfigServer;
protected matchConfig: IMatchConfig;
protected inraidConfig: IInRaidConfig;
constructor(saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, configServer: ConfigServer);
constructor(saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer);
getEnabled(): boolean;
getProfile(info: IGetProfileRequestData): IPmcData[];
createGroup(sessionID: string, info: ICreateGroupRequestData): any;

View File

@ -11,6 +11,7 @@ import { ISearchFriendResponse } from "../models/eft/profile/ISearchFriendRespon
import { IValidateNicknameRequestData } from "../models/eft/profile/IValidateNicknameRequestData";
import { DatabaseServer } from "../servers/DatabaseServer";
import { SaveServer } from "../servers/SaveServer";
import { ProfileFixerService } from "../services/ProfileFixerService";
import { HashUtil } from "../utils/HashUtil";
import { TimeUtil } from "../utils/TimeUtil";
export declare class ProfileController {
@ -19,13 +20,20 @@ export declare class ProfileController {
protected saveServer: SaveServer;
protected databaseServer: DatabaseServer;
protected itemHelper: ItemHelper;
protected profileFixerService: ProfileFixerService;
protected traderHelper: TraderHelper;
protected extendedProfileHelper: ExtendedProfileHelper;
constructor(hashUtil: HashUtil, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, traderHelper: TraderHelper, extendedProfileHelper: ExtendedProfileHelper);
constructor(hashUtil: HashUtil, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileFixerService: ProfileFixerService, traderHelper: TraderHelper, extendedProfileHelper: ExtendedProfileHelper);
getMiniProfiles(): IMiniProfile[];
getMiniProfile(sessionID: string): any;
getCompleteProfile(sessionID: string): IPmcData[];
createProfile(info: IProfileCreateRequestData, sessionID: string): void;
/**
* Generate a player scav object
* pmc profile MUST exist first before pscav can be generated
* @param sessionID
* @returns IPmcData object
*/
generatePlayerScav(sessionID: string): IPmcData;
validateNickname(info: IValidateNicknameRequestData, sessionID: string): string;
changeNickname(info: IProfileChangeNicknameRequestData, sessionID: string): string;

View File

@ -1,4 +1,3 @@
import { GameHelper } from "../helpers/GameHelper";
import { ItemHelper } from "../helpers/ItemHelper";
import { PresetHelper } from "../helpers/PresetHelper";
import { ProfileHelper } from "../helpers/ProfileHelper";
@ -16,6 +15,7 @@ import { ItemEventRouter } from "../routers/ItemEventRouter";
import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer";
import { PaymentService } from "../services/PaymentService";
import { ProfileFixerService } from "../services/ProfileFixerService";
import { JsonUtil } from "../utils/JsonUtil";
import { MathUtil } from "../utils/MathUtil";
import { ObjectId } from "../utils/ObjectId";
@ -58,14 +58,14 @@ export declare class RepeatableQuestController {
protected itemHelper: ItemHelper;
protected presetHelper: PresetHelper;
protected profileHelper: ProfileHelper;
protected gameHelper: GameHelper;
protected profileFixerService: ProfileFixerService;
protected ragfairServerHelper: RagfairServerHelper;
protected itemEventRouter: ItemEventRouter;
protected paymentService: PaymentService;
protected objectId: ObjectId;
protected configServer: ConfigServer;
protected questConfig: IQuestConfig;
constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, gameHelper: GameHelper, ragfairServerHelper: RagfairServerHelper, itemEventRouter: ItemEventRouter, paymentService: PaymentService, objectId: ObjectId, configServer: ConfigServer);
constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, itemEventRouter: ItemEventRouter, paymentService: PaymentService, objectId: ObjectId, configServer: ConfigServer);
/**
* This is the method reached by the /client/repeatalbeQuests/activityPeriods endpoint
* Returns an array of objects in the format of repeatable quests to the client.

View File

@ -1,29 +1,27 @@
import { PMCLootGenerator } from "../generators/PMCLootGenerator";
import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper";
import { HandbookHelper } from "../helpers/HandbookHelper";
import { Inventory as PmcInventory } from "../models/eft/common/IPmcData";
import { ItemMinMax, Items } from "../models/eft/common/tables/IBotType";
import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem";
import { IBotConfig } from "../models/spt/config/IBotConfig";
import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer";
import { BotLootCacheService } from "../services/BotLootCacheService";
import { HashUtil } from "../utils/HashUtil";
import { JsonUtil } from "../utils/JsonUtil";
import { RandomUtil } from "../utils/RandomUtil";
export declare class BotLootGenerator {
protected jsonUtil: JsonUtil;
protected logger: ILogger;
protected hashUtil: HashUtil;
protected randomUtil: RandomUtil;
protected databaseServer: DatabaseServer;
protected handbookHelper: HandbookHelper;
protected botGeneratorHelper: BotGeneratorHelper;
protected pmcLootGenerator: PMCLootGenerator;
protected botLootCacheService: BotLootCacheService;
protected configServer: ConfigServer;
protected botConfig: IBotConfig;
constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, pmcLootGenerator: PMCLootGenerator, configServer: ConfigServer);
generateLoot(lootPool: Items, itemCounts: ItemMinMax, isPmc: boolean, inventory: PmcInventory): void;
constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer);
generateLoot(lootPool: Items, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, inventory: PmcInventory): void;
protected getRandomisedCount(min: number, max: number, nValue: number): number;
protected addLootFromPool(pool: ITemplateItem[], equipmentSlots: string[], count: number, inventory: PmcInventory, totalValueLimit?: number, useLimits?: boolean): void;
/** Compares two item templates by their price to spawn chance ratio */
protected compareByValue(a: ITemplateItem, b: ITemplateItem): number;
}

View File

@ -2,7 +2,7 @@ import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper";
import { ItemHelper } from "../helpers/ItemHelper";
import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper";
import { Inventory as PmcInventory } from "../models/eft/common/IPmcData";
import { Inventory, MinMax, ModsChances } from "../models/eft/common/tables/IBotType";
import { Inventory, MinMax, Mods, ModsChances } from "../models/eft/common/tables/IBotType";
import { Item } from "../models/eft/common/tables/IItem";
import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem";
import { ILogger } from "../models/spt/utils/ILogger";
@ -22,6 +22,35 @@ export declare class BotWeaponGenerator {
private readonly modMagazineSlotId;
constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil);
generateWeapon(equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, magCounts: MinMax, botRole: string, isPmc: boolean, inventory: PmcInventory): void;
/**
* Create a list of mods for a weapon defined by the weaponTpl parameter
* @param weaponTpl Weapon to generate mods for
*/
protected getWeaponMods(weaponTpl: string): Mods;
/**
* Get a dictionary of items and their attachments
* @param itemTpl item to look up attachments for
* @param weaponModsResult Mods array to add to
*/
protected getItemAttachmentsRecursive(itemTpl: string, weaponModsResult: Mods): void;
protected isTplAnOptic(tplToCheck: string): boolean;
/**
* Get a weapon tpl from a bot jsons inventory
* @param weaponSlot slot to get randomised tpl for
* @param templateInventory
* @returns
*/
protected getRandomisedWeaponTplForSlot(weaponSlot: string, templateInventory: Inventory): string;
/**
* Get an array with a single object being the the weapon as defined by the weaponTpl parameter
* @param weaponTpl weapon to generate array around
* @param equipmentId
* @param weaponSlot
* @param itemTemplate
* @param botRole bot we're generating for
* @returns Item array
*/
protected getWeaponBase(weaponTpl: string, equipmentId: string, weaponSlot: string, itemTemplate: ITemplateItem, botRole: string): Item[];
/**
* Get the mods necessary to kit out a weapon to its preset level
* @param weaponTpl weapon to find preset for

View File

@ -11,6 +11,7 @@ import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer";
import { SaveServer } from "../servers/SaveServer";
import { FenceService } from "../services/FenceService";
import { RagfairCategoriesService } from "../services/RagfairCategoriesService";
import { RagfairOfferService } from "../services/RagfairOfferService";
import { RagfairPriceService } from "../services/RagfairPriceService";
import { HashUtil } from "../utils/HashUtil";
@ -18,7 +19,6 @@ import { JsonUtil } from "../utils/JsonUtil";
import { RandomUtil } from "../utils/RandomUtil";
import { TimeUtil } from "../utils/TimeUtil";
import { RagfairAssortGenerator } from "./RagfairAssortGenerator";
import { RagfairCategoriesService } from "../services/RagfairCategoriesService";
export declare class RagfairOfferGenerator {
protected logger: ILogger;
protected jsonUtil: JsonUtil;

View File

@ -2,15 +2,20 @@ import { BotGenerator } from "../generators/BotGenerator";
import { IPmcData, Skills, Stats } from "../models/eft/common/IPmcData";
import { DatabaseServer } from "../servers/DatabaseServer";
import { SaveServer } from "../servers/SaveServer";
import { BotLootCacheService } from "../services/BotLootCacheService";
import { FenceService } from "../services/FenceService";
import { JsonUtil } from "../utils/JsonUtil";
import { TimeUtil } from "../utils/TimeUtil";
import { Watermark } from "../utils/Watermark";
import { ItemHelper } from "./ItemHelper";
import { ProfileHelper } from "./ProfileHelper";
/**
* This class needs to exist outside of ProfileHelper to ensure cyclic deps don't cause the server to fail on load
*/
export declare class ExtendedProfileHelper extends ProfileHelper {
protected botLootCacheService: BotLootCacheService;
protected botGenerator: BotGenerator;
constructor(jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, fenceService: FenceService, botGenerator: BotGenerator);
constructor(jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, botLootCacheService: BotLootCacheService, fenceService: FenceService, botGenerator: BotGenerator);
generatePlayerScav(sessionID: string): IPmcData;
protected getScavSkills(sessionID: string): Skills;
protected removeSecureContainer(profile: IPmcData): IPmcData;

View File

@ -1,11 +0,0 @@
import { IPmcData } from "../models/eft/common/IPmcData";
import { ILogger } from "../models/spt/utils/ILogger";
export declare class GameHelper {
protected logger: ILogger;
constructor(logger: ILogger);
/**
* Remove condition conters no longer used
* @param pmcProfile profile to remove old counters from
*/
removeDanglingConditionCounters(pmcProfile: IPmcData): void;
}

View File

@ -162,10 +162,10 @@ declare class ItemHelper {
* Find Barter items in the inventory
* @param {string} by
* @param {Object} pmcData
* @param {string} barter_itemID
* @returns Array
* @param {string} barterItemId
* @returns Array of Item objects
*/
findBarterItems(by: string, pmcData: IPmcData, barter_itemID: string): any[];
findBarterItems(by: string, pmcData: IPmcData, barterItemId: string): Item[];
/**
*
* @param pmcData

View File

@ -2,24 +2,32 @@ import { RagfairAssortGenerator } from "../generators/RagfairAssortGenerator";
import { RagfairOfferGenerator } from "../generators/RagfairOfferGenerator";
import { Item } from "../models/eft/common/tables/IItem";
import { ITraderAssort } from "../models/eft/common/tables/ITrader";
import { ITraderConfig } from "../models/spt/config/ITraderConfig";
import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer";
import { FenceService } from "../services/FenceService";
import { TraderAssortService } from "../services/TraderAssortService";
import { JsonUtil } from "../utils/JsonUtil";
import { MathUtil } from "../utils/MathUtil";
import { AssortHelper } from "./AssortHelper";
import { PaymentHelper } from "./PaymentHelper";
import { ProfileHelper } from "./ProfileHelper";
export declare class TraderAssortHelper {
protected logger: ILogger;
protected jsonUtil: JsonUtil;
protected mathUtil: MathUtil;
protected databaseServer: DatabaseServer;
protected profileHelper: ProfileHelper;
protected assortHelper: AssortHelper;
protected paymentHelper: PaymentHelper;
protected ragfairAssortGenerator: RagfairAssortGenerator;
protected ragfairOfferGenerator: RagfairOfferGenerator;
protected traderAssortService: TraderAssortService;
protected fenceService: FenceService;
constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, fenceService: FenceService);
protected configServer: ConfigServer;
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);
/**
* Get a traders assorts
* Can be used for returning ragfair / fence assorts
@ -29,7 +37,12 @@ export declare class TraderAssortHelper {
*/
getAssort(sessionId: string, traderId: string): ITraderAssort;
/**
* Get an array of pristine trader items prior to any alteration by player
* 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
*/
protected multiplyItemPricesByConfigMultipler(traderAssort: ITraderAssort): void;
/**
* Get an array of pristine trader items prior to any alteration by player (as they were on server start)
* @param traderId trader id
* @returns array of Items
*/

View File

@ -29,7 +29,7 @@ export declare class TraderHelper {
getTrader(traderID: string, sessionID: string): ITraderBase;
getTraderAssortsById(traderId: string): ITraderAssort;
/**
* Reset a trader back to its initial state as seen by a level 1 player
* Reset a profiles trader data back to its initial state as seen by a level 1 player
* Does NOT take into account different profile levels
* @param sessionID session id
* @param traderID trader id to reset

View File

@ -18,6 +18,8 @@ export interface TemplateSide {
trader: ProfileTraderTemplate;
}
export interface ProfileTraderTemplate {
initialLoyaltyLevel: number;
initialStanding: number;
initialSalesSum: number;
jaegerUnlocked: boolean;
}

View File

@ -0,0 +1,23 @@
import { ITemplateItem } from "../../eft/common/tables/ITemplateItem";
export declare class BotLootCache {
backpackLoot: ITemplateItem[];
pocketLoot: ITemplateItem[];
vestLoot: ITemplateItem[];
combinedPoolLoot: ITemplateItem[];
specialItems: ITemplateItem[];
healingItems: ITemplateItem[];
drugItems: ITemplateItem[];
stimItems: ITemplateItem[];
grenadeItems: ITemplateItem[];
}
export declare enum LootCacheType {
Special = "Special",
Backpack = "Backpack",
Pocket = "Pocket",
Vest = "Vest",
Combined = "Combined",
HealingItems = "HealingItems",
DrugItems = "DrugItems",
StimItems = "StimItems",
GrenadeItems = "GrenadeItems"
}

View File

@ -3,13 +3,17 @@ export interface ITraderConfig extends IBaseConfig {
kind: "aki-trader";
updateTime: UpdateTime[];
updateTimeDefault: number;
fenceAssortSize: number;
fenceMaxPresetsCount: number;
fencePresetPriceMult: number;
traderPriceMultipler: number;
minDurabilityForSale: number;
fenceItemIgnoreList: string[];
fence: FenceConfig;
}
export interface UpdateTime {
traderId: string;
seconds: number;
}
export interface FenceConfig {
assortSize: number;
maxPresetsCount: number;
presetPriceMult: number;
blacklist: string[];
}

View File

@ -0,0 +1,59 @@
import { PMCLootGenerator } from "../generators/PMCLootGenerator";
import { Items } from "../models/eft/common/tables/IBotType";
import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem";
import { BotLootCache, LootCacheType } from "../models/spt/bots/BotLootCache";
import { ILogger } from "../models/spt/utils/ILogger";
import { DatabaseServer } from "../servers/DatabaseServer";
import { JsonUtil } from "../utils/JsonUtil";
import { RagfairPriceService } from "./RagfairPriceService";
export declare class BotLootCacheService {
protected logger: ILogger;
protected jsonUtil: JsonUtil;
protected databaseServer: DatabaseServer;
protected pmcLootGenerator: PMCLootGenerator;
protected ragfairPriceService: RagfairPriceService;
protected lootCache: Record<string, BotLootCache>;
constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, ragfairPriceService: RagfairPriceService);
/**
* Remove all cached bot loot data
*/
clearCache(): void;
/**
* Get the fully created loot array, ordered by price low to high
* @param botRole bot to get loot for
* @param isPmc is the bot a pmc
* @param lootType what type of loot is needed
* @param lootPool the full pool of loot (needed when cache is empty)
* @returns ITemplateItem array
*/
getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, lootPool: Items): ITemplateItem[];
/**
* Generate loot for a bot and store inside a private class property
* @param botRole
* @param lootType
* @param lootPool the full pool of loot we use to create the various sub-categories with
* @param isPmc
*/
protected addLootToCache(botRole: string, isPmc: boolean, lootType: LootCacheType, lootPool: Items): void;
/**
* Check if a bot type exists inside the loot cache
* @param botRole role to check for
* @returns true if they exist
*/
protected botRoleExistsInCache(botRole: string): boolean;
/**
* If lootcache is null, init with empty property arrays
* @param botRole Bot role to hydrate
*/
protected initCacheForBotRole(botRole: string): void;
/**
* Compares two item prices by their flea (or handbook if that doesnt exist) price
* -1 when a < b
* 0 when a === b
* 1 when a > b
* @param itemAPrice
* @param itemBPrice
* @returns
*/
protected compareByValue(itemAPrice: number, itemBPrice: number): number;
}

View File

@ -45,5 +45,22 @@ export declare class PaymentService {
* ancestor with slotId=hideout
*/
protected isItemInStash(pmcData: IPmcData, item: Item): boolean;
/**
* Remove currency from player stash/inventory
* @param pmcData Player profile to find and remove currency from
* @param currencyTpl Type of currency to pay
* @param amountToPay money value to pay
* @param sessionID Sessino id
* @param output output object to send to client
* @returns IItemEventRouterResponse
*/
addPaymentToOutput(pmcData: IPmcData, currencyTpl: string, amountToPay: number, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse;
/**
* Prioritise player stash first over player inventory
* Post-raid healing would often take money out of the players pockets/secure container
* @param a Firsat money stack item
* @param b Second money stack item
* @returns sorted item
*/
protected moneySort(a: Item, b: Item): number;
}

View File

@ -0,0 +1,40 @@
import { IPmcData } from "../models/eft/common/IPmcData";
import { IPmcDataRepeatableQuest, IRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests";
import { IAkiProfile } from "../models/eft/profile/IAkiProfile";
import { ILogger } from "../models/spt/utils/ILogger";
import { DatabaseServer } from "../servers/DatabaseServer";
import { Watermark } from "../utils/Watermark";
export declare class ProfileFixerService {
protected logger: ILogger;
protected watermark: Watermark;
protected databaseServer: DatabaseServer;
constructor(logger: ILogger, watermark: Watermark, databaseServer: DatabaseServer);
/**
* Find issues in the pmc profile data that may cause issues and fix them
* @param pmcProfile profile to check and fix
*/
checkForAndFixPmcProfileIssues(pmcProfile: IPmcData): void;
/**
* Add tag to profile to indicate when it was made
* @param fullProfile
*/
addMissingAkiVersionTagToProfile(fullProfile: IAkiProfile): void;
/**
* TODO - make this non-public - currently used by RepeatableQuestController
* Remove unused condition counters
* @param pmcProfile profile to remove old counters from
*/
removeDanglingConditionCounters(pmcProfile: IPmcData): void;
protected removeDanglingBackendCounters(pmcProfile: IPmcData): void;
protected getActiveRepeatableQuests(repeatableQuests: IPmcDataRepeatableQuest[]): IRepeatableQuest[];
protected fixNullTraderSalesSums(pmcProfile: IPmcData): void;
protected addMissingBonusesProperty(pmcProfile: IPmcData): void;
protected addMissingRepeatableQuestsProperty(pmcProfile: IPmcData): void;
protected addMissingWorkbenchWeaponSkills(pmcProfile: IPmcData): void;
/**
* In 18876 bsg changed the pockets tplid to be one that has 3 additional special slots
* @param pmcProfile
*/
protected updateProfilePocketsToNewId(pmcProfile: IPmcData): void;
addMissingArmorRepairSkill(pmcProfile: IPmcData): void;
}

View File

@ -1,9 +1,6 @@
import { GameHelper } from "../helpers/GameHelper";
import { HttpServerHelper } from "../helpers/HttpServerHelper";
import { ProfileHelper } from "../helpers/ProfileHelper";
import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData";
import { IPmcData } from "../models/eft/common/IPmcData";
import { IPmcDataRepeatableQuest, IRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests";
import { IGameConfigResponse } from "../models/eft/game/IGameConfigResponse";
import { IAkiProfile } from "../models/eft/profile/IAkiProfile";
import { ICoreConfig } from "../models/spt/config/ICoreConfig";
@ -11,6 +8,7 @@ import { IHttpConfig } from "../models/spt/config/IHttpConfig";
import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer";
import { LocaleService } from "../services/LocaleService";
import { ProfileFixerService } from "../services/ProfileFixerService";
import { Watermark } from "../utils/Watermark";
export declare class GameController {
protected logger: ILogger;
@ -18,25 +16,13 @@ export declare class GameController {
protected httpServerHelper: HttpServerHelper;
protected localeService: LocaleService;
protected profileHelper: ProfileHelper;
protected gameHelper: GameHelper;
protected profileFixerService: ProfileFixerService;
protected configServer: ConfigServer;
protected httpConfig: IHttpConfig;
protected coreConfig: ICoreConfig;
constructor(logger: ILogger, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, gameHelper: GameHelper, configServer: ConfigServer);
constructor(logger: ILogger, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, configServer: ConfigServer);
gameStart(_url: string, _info: IEmptyRequestData, sessionID: string): void;
protected addMissingBonusesProperty(pmcProfile: IPmcData): void;
protected addMissingRepeatableQuestsProperty(pmcProfile: IPmcData): void;
protected addMissingWeaponRepairSkill(pmcProfile: IPmcData): void;
protected addMissingAkiVersionTagToProfile(fullProfile: IAkiProfile): void;
/**
* In 18876 bsg changed the pockets tplid to be one that has 3 additional special slots
* @param pmcProfile
*/
protected updateProfilePocketsToNewId(pmcProfile: IPmcData): void;
protected addMissingArmorRepairSkill(pmcProfile: IPmcData): void;
protected fixNullTraderSalesSums(pmcProfile: IPmcData): void;
protected removeDanglingBackendCounters(pmcProfile: IPmcData): void;
protected logProfileDetails(fullProfile: IAkiProfile): void;
getGameConfig(sessionID: string): IGameConfigResponse;
getServer(): any[];
protected getActiveRepeatableQuests(repeatableQuests: IPmcDataRepeatableQuest[]): IRepeatableQuest[];
}

View File

@ -12,16 +12,18 @@ import { IInRaidConfig } from "../models/spt/config/IInRaidConfig";
import { IMatchConfig } from "../models/spt/config/IMatchConfig";
import { ConfigServer } from "../servers/ConfigServer";
import { SaveServer } from "../servers/SaveServer";
import { BotLootCacheService } from "../services/BotLootCacheService";
import { MatchLocationService } from "../services/MatchLocationService";
export declare class MatchController {
protected saveServer: SaveServer;
protected profileHelper: ProfileHelper;
protected matchLocationService: MatchLocationService;
protected traderHelper: TraderHelper;
protected botLootCacheService: BotLootCacheService;
protected configServer: ConfigServer;
protected matchConfig: IMatchConfig;
protected inraidConfig: IInRaidConfig;
constructor(saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, configServer: ConfigServer);
constructor(saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer);
getEnabled(): boolean;
getProfile(info: IGetProfileRequestData): IPmcData[];
createGroup(sessionID: string, info: ICreateGroupRequestData): any;

View File

@ -11,6 +11,7 @@ import { ISearchFriendResponse } from "../models/eft/profile/ISearchFriendRespon
import { IValidateNicknameRequestData } from "../models/eft/profile/IValidateNicknameRequestData";
import { DatabaseServer } from "../servers/DatabaseServer";
import { SaveServer } from "../servers/SaveServer";
import { ProfileFixerService } from "../services/ProfileFixerService";
import { HashUtil } from "../utils/HashUtil";
import { TimeUtil } from "../utils/TimeUtil";
export declare class ProfileController {
@ -19,13 +20,20 @@ export declare class ProfileController {
protected saveServer: SaveServer;
protected databaseServer: DatabaseServer;
protected itemHelper: ItemHelper;
protected profileFixerService: ProfileFixerService;
protected traderHelper: TraderHelper;
protected extendedProfileHelper: ExtendedProfileHelper;
constructor(hashUtil: HashUtil, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, traderHelper: TraderHelper, extendedProfileHelper: ExtendedProfileHelper);
constructor(hashUtil: HashUtil, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileFixerService: ProfileFixerService, traderHelper: TraderHelper, extendedProfileHelper: ExtendedProfileHelper);
getMiniProfiles(): IMiniProfile[];
getMiniProfile(sessionID: string): any;
getCompleteProfile(sessionID: string): IPmcData[];
createProfile(info: IProfileCreateRequestData, sessionID: string): void;
/**
* Generate a player scav object
* pmc profile MUST exist first before pscav can be generated
* @param sessionID
* @returns IPmcData object
*/
generatePlayerScav(sessionID: string): IPmcData;
validateNickname(info: IValidateNicknameRequestData, sessionID: string): string;
changeNickname(info: IProfileChangeNicknameRequestData, sessionID: string): string;

View File

@ -1,4 +1,3 @@
import { GameHelper } from "../helpers/GameHelper";
import { ItemHelper } from "../helpers/ItemHelper";
import { PresetHelper } from "../helpers/PresetHelper";
import { ProfileHelper } from "../helpers/ProfileHelper";
@ -16,6 +15,7 @@ import { ItemEventRouter } from "../routers/ItemEventRouter";
import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer";
import { PaymentService } from "../services/PaymentService";
import { ProfileFixerService } from "../services/ProfileFixerService";
import { JsonUtil } from "../utils/JsonUtil";
import { MathUtil } from "../utils/MathUtil";
import { ObjectId } from "../utils/ObjectId";
@ -58,14 +58,14 @@ export declare class RepeatableQuestController {
protected itemHelper: ItemHelper;
protected presetHelper: PresetHelper;
protected profileHelper: ProfileHelper;
protected gameHelper: GameHelper;
protected profileFixerService: ProfileFixerService;
protected ragfairServerHelper: RagfairServerHelper;
protected itemEventRouter: ItemEventRouter;
protected paymentService: PaymentService;
protected objectId: ObjectId;
protected configServer: ConfigServer;
protected questConfig: IQuestConfig;
constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, gameHelper: GameHelper, ragfairServerHelper: RagfairServerHelper, itemEventRouter: ItemEventRouter, paymentService: PaymentService, objectId: ObjectId, configServer: ConfigServer);
constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, itemEventRouter: ItemEventRouter, paymentService: PaymentService, objectId: ObjectId, configServer: ConfigServer);
/**
* This is the method reached by the /client/repeatalbeQuests/activityPeriods endpoint
* Returns an array of objects in the format of repeatable quests to the client.

View File

@ -1,29 +1,27 @@
import { PMCLootGenerator } from "../generators/PMCLootGenerator";
import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper";
import { HandbookHelper } from "../helpers/HandbookHelper";
import { Inventory as PmcInventory } from "../models/eft/common/IPmcData";
import { ItemMinMax, Items } from "../models/eft/common/tables/IBotType";
import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem";
import { IBotConfig } from "../models/spt/config/IBotConfig";
import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer";
import { BotLootCacheService } from "../services/BotLootCacheService";
import { HashUtil } from "../utils/HashUtil";
import { JsonUtil } from "../utils/JsonUtil";
import { RandomUtil } from "../utils/RandomUtil";
export declare class BotLootGenerator {
protected jsonUtil: JsonUtil;
protected logger: ILogger;
protected hashUtil: HashUtil;
protected randomUtil: RandomUtil;
protected databaseServer: DatabaseServer;
protected handbookHelper: HandbookHelper;
protected botGeneratorHelper: BotGeneratorHelper;
protected pmcLootGenerator: PMCLootGenerator;
protected botLootCacheService: BotLootCacheService;
protected configServer: ConfigServer;
protected botConfig: IBotConfig;
constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, pmcLootGenerator: PMCLootGenerator, configServer: ConfigServer);
generateLoot(lootPool: Items, itemCounts: ItemMinMax, isPmc: boolean, inventory: PmcInventory): void;
constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer);
generateLoot(lootPool: Items, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, inventory: PmcInventory): void;
protected getRandomisedCount(min: number, max: number, nValue: number): number;
protected addLootFromPool(pool: ITemplateItem[], equipmentSlots: string[], count: number, inventory: PmcInventory, totalValueLimit?: number, useLimits?: boolean): void;
/** Compares two item templates by their price to spawn chance ratio */
protected compareByValue(a: ITemplateItem, b: ITemplateItem): number;
}

View File

@ -2,7 +2,7 @@ import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper";
import { ItemHelper } from "../helpers/ItemHelper";
import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper";
import { Inventory as PmcInventory } from "../models/eft/common/IPmcData";
import { Inventory, MinMax, ModsChances } from "../models/eft/common/tables/IBotType";
import { Inventory, MinMax, Mods, ModsChances } from "../models/eft/common/tables/IBotType";
import { Item } from "../models/eft/common/tables/IItem";
import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem";
import { ILogger } from "../models/spt/utils/ILogger";
@ -22,6 +22,35 @@ export declare class BotWeaponGenerator {
private readonly modMagazineSlotId;
constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil);
generateWeapon(equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, magCounts: MinMax, botRole: string, isPmc: boolean, inventory: PmcInventory): void;
/**
* Create a list of mods for a weapon defined by the weaponTpl parameter
* @param weaponTpl Weapon to generate mods for
*/
protected getWeaponMods(weaponTpl: string): Mods;
/**
* Get a dictionary of items and their attachments
* @param itemTpl item to look up attachments for
* @param weaponModsResult Mods array to add to
*/
protected getItemAttachmentsRecursive(itemTpl: string, weaponModsResult: Mods): void;
protected isTplAnOptic(tplToCheck: string): boolean;
/**
* Get a weapon tpl from a bot jsons inventory
* @param weaponSlot slot to get randomised tpl for
* @param templateInventory
* @returns
*/
protected getRandomisedWeaponTplForSlot(weaponSlot: string, templateInventory: Inventory): string;
/**
* Get an array with a single object being the the weapon as defined by the weaponTpl parameter
* @param weaponTpl weapon to generate array around
* @param equipmentId
* @param weaponSlot
* @param itemTemplate
* @param botRole bot we're generating for
* @returns Item array
*/
protected getWeaponBase(weaponTpl: string, equipmentId: string, weaponSlot: string, itemTemplate: ITemplateItem, botRole: string): Item[];
/**
* Get the mods necessary to kit out a weapon to its preset level
* @param weaponTpl weapon to find preset for

View File

@ -11,6 +11,7 @@ import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer";
import { SaveServer } from "../servers/SaveServer";
import { FenceService } from "../services/FenceService";
import { RagfairCategoriesService } from "../services/RagfairCategoriesService";
import { RagfairOfferService } from "../services/RagfairOfferService";
import { RagfairPriceService } from "../services/RagfairPriceService";
import { HashUtil } from "../utils/HashUtil";
@ -18,7 +19,6 @@ import { JsonUtil } from "../utils/JsonUtil";
import { RandomUtil } from "../utils/RandomUtil";
import { TimeUtil } from "../utils/TimeUtil";
import { RagfairAssortGenerator } from "./RagfairAssortGenerator";
import { RagfairCategoriesService } from "../services/RagfairCategoriesService";
export declare class RagfairOfferGenerator {
protected logger: ILogger;
protected jsonUtil: JsonUtil;

View File

@ -2,15 +2,20 @@ import { BotGenerator } from "../generators/BotGenerator";
import { IPmcData, Skills, Stats } from "../models/eft/common/IPmcData";
import { DatabaseServer } from "../servers/DatabaseServer";
import { SaveServer } from "../servers/SaveServer";
import { BotLootCacheService } from "../services/BotLootCacheService";
import { FenceService } from "../services/FenceService";
import { JsonUtil } from "../utils/JsonUtil";
import { TimeUtil } from "../utils/TimeUtil";
import { Watermark } from "../utils/Watermark";
import { ItemHelper } from "./ItemHelper";
import { ProfileHelper } from "./ProfileHelper";
/**
* This class needs to exist outside of ProfileHelper to ensure cyclic deps don't cause the server to fail on load
*/
export declare class ExtendedProfileHelper extends ProfileHelper {
protected botLootCacheService: BotLootCacheService;
protected botGenerator: BotGenerator;
constructor(jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, fenceService: FenceService, botGenerator: BotGenerator);
constructor(jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, botLootCacheService: BotLootCacheService, fenceService: FenceService, botGenerator: BotGenerator);
generatePlayerScav(sessionID: string): IPmcData;
protected getScavSkills(sessionID: string): Skills;
protected removeSecureContainer(profile: IPmcData): IPmcData;

View File

@ -1,11 +0,0 @@
import { IPmcData } from "../models/eft/common/IPmcData";
import { ILogger } from "../models/spt/utils/ILogger";
export declare class GameHelper {
protected logger: ILogger;
constructor(logger: ILogger);
/**
* Remove condition conters no longer used
* @param pmcProfile profile to remove old counters from
*/
removeDanglingConditionCounters(pmcProfile: IPmcData): void;
}

View File

@ -162,10 +162,10 @@ declare class ItemHelper {
* Find Barter items in the inventory
* @param {string} by
* @param {Object} pmcData
* @param {string} barter_itemID
* @returns Array
* @param {string} barterItemId
* @returns Array of Item objects
*/
findBarterItems(by: string, pmcData: IPmcData, barter_itemID: string): any[];
findBarterItems(by: string, pmcData: IPmcData, barterItemId: string): Item[];
/**
*
* @param pmcData

View File

@ -2,24 +2,32 @@ import { RagfairAssortGenerator } from "../generators/RagfairAssortGenerator";
import { RagfairOfferGenerator } from "../generators/RagfairOfferGenerator";
import { Item } from "../models/eft/common/tables/IItem";
import { ITraderAssort } from "../models/eft/common/tables/ITrader";
import { ITraderConfig } from "../models/spt/config/ITraderConfig";
import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer";
import { FenceService } from "../services/FenceService";
import { TraderAssortService } from "../services/TraderAssortService";
import { JsonUtil } from "../utils/JsonUtil";
import { MathUtil } from "../utils/MathUtil";
import { AssortHelper } from "./AssortHelper";
import { PaymentHelper } from "./PaymentHelper";
import { ProfileHelper } from "./ProfileHelper";
export declare class TraderAssortHelper {
protected logger: ILogger;
protected jsonUtil: JsonUtil;
protected mathUtil: MathUtil;
protected databaseServer: DatabaseServer;
protected profileHelper: ProfileHelper;
protected assortHelper: AssortHelper;
protected paymentHelper: PaymentHelper;
protected ragfairAssortGenerator: RagfairAssortGenerator;
protected ragfairOfferGenerator: RagfairOfferGenerator;
protected traderAssortService: TraderAssortService;
protected fenceService: FenceService;
constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, fenceService: FenceService);
protected configServer: ConfigServer;
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);
/**
* Get a traders assorts
* Can be used for returning ragfair / fence assorts
@ -29,7 +37,12 @@ export declare class TraderAssortHelper {
*/
getAssort(sessionId: string, traderId: string): ITraderAssort;
/**
* Get an array of pristine trader items prior to any alteration by player
* 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
*/
protected multiplyItemPricesByConfigMultipler(traderAssort: ITraderAssort): void;
/**
* Get an array of pristine trader items prior to any alteration by player (as they were on server start)
* @param traderId trader id
* @returns array of Items
*/

View File

@ -29,7 +29,7 @@ export declare class TraderHelper {
getTrader(traderID: string, sessionID: string): ITraderBase;
getTraderAssortsById(traderId: string): ITraderAssort;
/**
* Reset a trader back to its initial state as seen by a level 1 player
* Reset a profiles trader data back to its initial state as seen by a level 1 player
* Does NOT take into account different profile levels
* @param sessionID session id
* @param traderID trader id to reset

View File

@ -18,6 +18,8 @@ export interface TemplateSide {
trader: ProfileTraderTemplate;
}
export interface ProfileTraderTemplate {
initialLoyaltyLevel: number;
initialStanding: number;
initialSalesSum: number;
jaegerUnlocked: boolean;
}

View File

@ -0,0 +1,23 @@
import { ITemplateItem } from "../../eft/common/tables/ITemplateItem";
export declare class BotLootCache {
backpackLoot: ITemplateItem[];
pocketLoot: ITemplateItem[];
vestLoot: ITemplateItem[];
combinedPoolLoot: ITemplateItem[];
specialItems: ITemplateItem[];
healingItems: ITemplateItem[];
drugItems: ITemplateItem[];
stimItems: ITemplateItem[];
grenadeItems: ITemplateItem[];
}
export declare enum LootCacheType {
Special = "Special",
Backpack = "Backpack",
Pocket = "Pocket",
Vest = "Vest",
Combined = "Combined",
HealingItems = "HealingItems",
DrugItems = "DrugItems",
StimItems = "StimItems",
GrenadeItems = "GrenadeItems"
}

View File

@ -3,13 +3,17 @@ export interface ITraderConfig extends IBaseConfig {
kind: "aki-trader";
updateTime: UpdateTime[];
updateTimeDefault: number;
fenceAssortSize: number;
fenceMaxPresetsCount: number;
fencePresetPriceMult: number;
traderPriceMultipler: number;
minDurabilityForSale: number;
fenceItemIgnoreList: string[];
fence: FenceConfig;
}
export interface UpdateTime {
traderId: string;
seconds: number;
}
export interface FenceConfig {
assortSize: number;
maxPresetsCount: number;
presetPriceMult: number;
blacklist: string[];
}

View File

@ -0,0 +1,59 @@
import { PMCLootGenerator } from "../generators/PMCLootGenerator";
import { Items } from "../models/eft/common/tables/IBotType";
import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem";
import { BotLootCache, LootCacheType } from "../models/spt/bots/BotLootCache";
import { ILogger } from "../models/spt/utils/ILogger";
import { DatabaseServer } from "../servers/DatabaseServer";
import { JsonUtil } from "../utils/JsonUtil";
import { RagfairPriceService } from "./RagfairPriceService";
export declare class BotLootCacheService {
protected logger: ILogger;
protected jsonUtil: JsonUtil;
protected databaseServer: DatabaseServer;
protected pmcLootGenerator: PMCLootGenerator;
protected ragfairPriceService: RagfairPriceService;
protected lootCache: Record<string, BotLootCache>;
constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, ragfairPriceService: RagfairPriceService);
/**
* Remove all cached bot loot data
*/
clearCache(): void;
/**
* Get the fully created loot array, ordered by price low to high
* @param botRole bot to get loot for
* @param isPmc is the bot a pmc
* @param lootType what type of loot is needed
* @param lootPool the full pool of loot (needed when cache is empty)
* @returns ITemplateItem array
*/
getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, lootPool: Items): ITemplateItem[];
/**
* Generate loot for a bot and store inside a private class property
* @param botRole
* @param lootType
* @param lootPool the full pool of loot we use to create the various sub-categories with
* @param isPmc
*/
protected addLootToCache(botRole: string, isPmc: boolean, lootType: LootCacheType, lootPool: Items): void;
/**
* Check if a bot type exists inside the loot cache
* @param botRole role to check for
* @returns true if they exist
*/
protected botRoleExistsInCache(botRole: string): boolean;
/**
* If lootcache is null, init with empty property arrays
* @param botRole Bot role to hydrate
*/
protected initCacheForBotRole(botRole: string): void;
/**
* Compares two item prices by their flea (or handbook if that doesnt exist) price
* -1 when a < b
* 0 when a === b
* 1 when a > b
* @param itemAPrice
* @param itemBPrice
* @returns
*/
protected compareByValue(itemAPrice: number, itemBPrice: number): number;
}

View File

@ -45,5 +45,22 @@ export declare class PaymentService {
* ancestor with slotId=hideout
*/
protected isItemInStash(pmcData: IPmcData, item: Item): boolean;
/**
* Remove currency from player stash/inventory
* @param pmcData Player profile to find and remove currency from
* @param currencyTpl Type of currency to pay
* @param amountToPay money value to pay
* @param sessionID Sessino id
* @param output output object to send to client
* @returns IItemEventRouterResponse
*/
addPaymentToOutput(pmcData: IPmcData, currencyTpl: string, amountToPay: number, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse;
/**
* Prioritise player stash first over player inventory
* Post-raid healing would often take money out of the players pockets/secure container
* @param a Firsat money stack item
* @param b Second money stack item
* @returns sorted item
*/
protected moneySort(a: Item, b: Item): number;
}

View File

@ -0,0 +1,40 @@
import { IPmcData } from "../models/eft/common/IPmcData";
import { IPmcDataRepeatableQuest, IRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests";
import { IAkiProfile } from "../models/eft/profile/IAkiProfile";
import { ILogger } from "../models/spt/utils/ILogger";
import { DatabaseServer } from "../servers/DatabaseServer";
import { Watermark } from "../utils/Watermark";
export declare class ProfileFixerService {
protected logger: ILogger;
protected watermark: Watermark;
protected databaseServer: DatabaseServer;
constructor(logger: ILogger, watermark: Watermark, databaseServer: DatabaseServer);
/**
* Find issues in the pmc profile data that may cause issues and fix them
* @param pmcProfile profile to check and fix
*/
checkForAndFixPmcProfileIssues(pmcProfile: IPmcData): void;
/**
* Add tag to profile to indicate when it was made
* @param fullProfile
*/
addMissingAkiVersionTagToProfile(fullProfile: IAkiProfile): void;
/**
* TODO - make this non-public - currently used by RepeatableQuestController
* Remove unused condition counters
* @param pmcProfile profile to remove old counters from
*/
removeDanglingConditionCounters(pmcProfile: IPmcData): void;
protected removeDanglingBackendCounters(pmcProfile: IPmcData): void;
protected getActiveRepeatableQuests(repeatableQuests: IPmcDataRepeatableQuest[]): IRepeatableQuest[];
protected fixNullTraderSalesSums(pmcProfile: IPmcData): void;
protected addMissingBonusesProperty(pmcProfile: IPmcData): void;
protected addMissingRepeatableQuestsProperty(pmcProfile: IPmcData): void;
protected addMissingWorkbenchWeaponSkills(pmcProfile: IPmcData): void;
/**
* In 18876 bsg changed the pockets tplid to be one that has 3 additional special slots
* @param pmcProfile
*/
protected updateProfilePocketsToNewId(pmcProfile: IPmcData): void;
addMissingArmorRepairSkill(pmcProfile: IPmcData): void;
}

View File

@ -1,9 +1,6 @@
import { GameHelper } from "../helpers/GameHelper";
import { HttpServerHelper } from "../helpers/HttpServerHelper";
import { ProfileHelper } from "../helpers/ProfileHelper";
import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData";
import { IPmcData } from "../models/eft/common/IPmcData";
import { IPmcDataRepeatableQuest, IRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests";
import { IGameConfigResponse } from "../models/eft/game/IGameConfigResponse";
import { IAkiProfile } from "../models/eft/profile/IAkiProfile";
import { ICoreConfig } from "../models/spt/config/ICoreConfig";
@ -11,6 +8,7 @@ import { IHttpConfig } from "../models/spt/config/IHttpConfig";
import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer";
import { LocaleService } from "../services/LocaleService";
import { ProfileFixerService } from "../services/ProfileFixerService";
import { Watermark } from "../utils/Watermark";
export declare class GameController {
protected logger: ILogger;
@ -18,25 +16,13 @@ export declare class GameController {
protected httpServerHelper: HttpServerHelper;
protected localeService: LocaleService;
protected profileHelper: ProfileHelper;
protected gameHelper: GameHelper;
protected profileFixerService: ProfileFixerService;
protected configServer: ConfigServer;
protected httpConfig: IHttpConfig;
protected coreConfig: ICoreConfig;
constructor(logger: ILogger, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, gameHelper: GameHelper, configServer: ConfigServer);
constructor(logger: ILogger, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, configServer: ConfigServer);
gameStart(_url: string, _info: IEmptyRequestData, sessionID: string): void;
protected addMissingBonusesProperty(pmcProfile: IPmcData): void;
protected addMissingRepeatableQuestsProperty(pmcProfile: IPmcData): void;
protected addMissingWeaponRepairSkill(pmcProfile: IPmcData): void;
protected addMissingAkiVersionTagToProfile(fullProfile: IAkiProfile): void;
/**
* In 18876 bsg changed the pockets tplid to be one that has 3 additional special slots
* @param pmcProfile
*/
protected updateProfilePocketsToNewId(pmcProfile: IPmcData): void;
protected addMissingArmorRepairSkill(pmcProfile: IPmcData): void;
protected fixNullTraderSalesSums(pmcProfile: IPmcData): void;
protected removeDanglingBackendCounters(pmcProfile: IPmcData): void;
protected logProfileDetails(fullProfile: IAkiProfile): void;
getGameConfig(sessionID: string): IGameConfigResponse;
getServer(): any[];
protected getActiveRepeatableQuests(repeatableQuests: IPmcDataRepeatableQuest[]): IRepeatableQuest[];
}

View File

@ -12,16 +12,18 @@ import { IInRaidConfig } from "../models/spt/config/IInRaidConfig";
import { IMatchConfig } from "../models/spt/config/IMatchConfig";
import { ConfigServer } from "../servers/ConfigServer";
import { SaveServer } from "../servers/SaveServer";
import { BotLootCacheService } from "../services/BotLootCacheService";
import { MatchLocationService } from "../services/MatchLocationService";
export declare class MatchController {
protected saveServer: SaveServer;
protected profileHelper: ProfileHelper;
protected matchLocationService: MatchLocationService;
protected traderHelper: TraderHelper;
protected botLootCacheService: BotLootCacheService;
protected configServer: ConfigServer;
protected matchConfig: IMatchConfig;
protected inraidConfig: IInRaidConfig;
constructor(saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, configServer: ConfigServer);
constructor(saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer);
getEnabled(): boolean;
getProfile(info: IGetProfileRequestData): IPmcData[];
createGroup(sessionID: string, info: ICreateGroupRequestData): any;

View File

@ -11,6 +11,7 @@ import { ISearchFriendResponse } from "../models/eft/profile/ISearchFriendRespon
import { IValidateNicknameRequestData } from "../models/eft/profile/IValidateNicknameRequestData";
import { DatabaseServer } from "../servers/DatabaseServer";
import { SaveServer } from "../servers/SaveServer";
import { ProfileFixerService } from "../services/ProfileFixerService";
import { HashUtil } from "../utils/HashUtil";
import { TimeUtil } from "../utils/TimeUtil";
export declare class ProfileController {
@ -19,13 +20,20 @@ export declare class ProfileController {
protected saveServer: SaveServer;
protected databaseServer: DatabaseServer;
protected itemHelper: ItemHelper;
protected profileFixerService: ProfileFixerService;
protected traderHelper: TraderHelper;
protected extendedProfileHelper: ExtendedProfileHelper;
constructor(hashUtil: HashUtil, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, traderHelper: TraderHelper, extendedProfileHelper: ExtendedProfileHelper);
constructor(hashUtil: HashUtil, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileFixerService: ProfileFixerService, traderHelper: TraderHelper, extendedProfileHelper: ExtendedProfileHelper);
getMiniProfiles(): IMiniProfile[];
getMiniProfile(sessionID: string): any;
getCompleteProfile(sessionID: string): IPmcData[];
createProfile(info: IProfileCreateRequestData, sessionID: string): void;
/**
* Generate a player scav object
* pmc profile MUST exist first before pscav can be generated
* @param sessionID
* @returns IPmcData object
*/
generatePlayerScav(sessionID: string): IPmcData;
validateNickname(info: IValidateNicknameRequestData, sessionID: string): string;
changeNickname(info: IProfileChangeNicknameRequestData, sessionID: string): string;

View File

@ -1,4 +1,3 @@
import { GameHelper } from "../helpers/GameHelper";
import { ItemHelper } from "../helpers/ItemHelper";
import { PresetHelper } from "../helpers/PresetHelper";
import { ProfileHelper } from "../helpers/ProfileHelper";
@ -16,6 +15,7 @@ import { ItemEventRouter } from "../routers/ItemEventRouter";
import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer";
import { PaymentService } from "../services/PaymentService";
import { ProfileFixerService } from "../services/ProfileFixerService";
import { JsonUtil } from "../utils/JsonUtil";
import { MathUtil } from "../utils/MathUtil";
import { ObjectId } from "../utils/ObjectId";
@ -58,14 +58,14 @@ export declare class RepeatableQuestController {
protected itemHelper: ItemHelper;
protected presetHelper: PresetHelper;
protected profileHelper: ProfileHelper;
protected gameHelper: GameHelper;
protected profileFixerService: ProfileFixerService;
protected ragfairServerHelper: RagfairServerHelper;
protected itemEventRouter: ItemEventRouter;
protected paymentService: PaymentService;
protected objectId: ObjectId;
protected configServer: ConfigServer;
protected questConfig: IQuestConfig;
constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, gameHelper: GameHelper, ragfairServerHelper: RagfairServerHelper, itemEventRouter: ItemEventRouter, paymentService: PaymentService, objectId: ObjectId, configServer: ConfigServer);
constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, itemEventRouter: ItemEventRouter, paymentService: PaymentService, objectId: ObjectId, configServer: ConfigServer);
/**
* This is the method reached by the /client/repeatalbeQuests/activityPeriods endpoint
* Returns an array of objects in the format of repeatable quests to the client.

View File

@ -1,29 +1,27 @@
import { PMCLootGenerator } from "../generators/PMCLootGenerator";
import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper";
import { HandbookHelper } from "../helpers/HandbookHelper";
import { Inventory as PmcInventory } from "../models/eft/common/IPmcData";
import { ItemMinMax, Items } from "../models/eft/common/tables/IBotType";
import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem";
import { IBotConfig } from "../models/spt/config/IBotConfig";
import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer";
import { BotLootCacheService } from "../services/BotLootCacheService";
import { HashUtil } from "../utils/HashUtil";
import { JsonUtil } from "../utils/JsonUtil";
import { RandomUtil } from "../utils/RandomUtil";
export declare class BotLootGenerator {
protected jsonUtil: JsonUtil;
protected logger: ILogger;
protected hashUtil: HashUtil;
protected randomUtil: RandomUtil;
protected databaseServer: DatabaseServer;
protected handbookHelper: HandbookHelper;
protected botGeneratorHelper: BotGeneratorHelper;
protected pmcLootGenerator: PMCLootGenerator;
protected botLootCacheService: BotLootCacheService;
protected configServer: ConfigServer;
protected botConfig: IBotConfig;
constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, pmcLootGenerator: PMCLootGenerator, configServer: ConfigServer);
generateLoot(lootPool: Items, itemCounts: ItemMinMax, isPmc: boolean, inventory: PmcInventory): void;
constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer);
generateLoot(lootPool: Items, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, inventory: PmcInventory): void;
protected getRandomisedCount(min: number, max: number, nValue: number): number;
protected addLootFromPool(pool: ITemplateItem[], equipmentSlots: string[], count: number, inventory: PmcInventory, totalValueLimit?: number, useLimits?: boolean): void;
/** Compares two item templates by their price to spawn chance ratio */
protected compareByValue(a: ITemplateItem, b: ITemplateItem): number;
}

View File

@ -2,7 +2,7 @@ import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper";
import { ItemHelper } from "../helpers/ItemHelper";
import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper";
import { Inventory as PmcInventory } from "../models/eft/common/IPmcData";
import { Inventory, MinMax, ModsChances } from "../models/eft/common/tables/IBotType";
import { Inventory, MinMax, Mods, ModsChances } from "../models/eft/common/tables/IBotType";
import { Item } from "../models/eft/common/tables/IItem";
import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem";
import { ILogger } from "../models/spt/utils/ILogger";
@ -22,6 +22,35 @@ export declare class BotWeaponGenerator {
private readonly modMagazineSlotId;
constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil);
generateWeapon(equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, magCounts: MinMax, botRole: string, isPmc: boolean, inventory: PmcInventory): void;
/**
* Create a list of mods for a weapon defined by the weaponTpl parameter
* @param weaponTpl Weapon to generate mods for
*/
protected getWeaponMods(weaponTpl: string): Mods;
/**
* Get a dictionary of items and their attachments
* @param itemTpl item to look up attachments for
* @param weaponModsResult Mods array to add to
*/
protected getItemAttachmentsRecursive(itemTpl: string, weaponModsResult: Mods): void;
protected isTplAnOptic(tplToCheck: string): boolean;
/**
* Get a weapon tpl from a bot jsons inventory
* @param weaponSlot slot to get randomised tpl for
* @param templateInventory
* @returns
*/
protected getRandomisedWeaponTplForSlot(weaponSlot: string, templateInventory: Inventory): string;
/**
* Get an array with a single object being the the weapon as defined by the weaponTpl parameter
* @param weaponTpl weapon to generate array around
* @param equipmentId
* @param weaponSlot
* @param itemTemplate
* @param botRole bot we're generating for
* @returns Item array
*/
protected getWeaponBase(weaponTpl: string, equipmentId: string, weaponSlot: string, itemTemplate: ITemplateItem, botRole: string): Item[];
/**
* Get the mods necessary to kit out a weapon to its preset level
* @param weaponTpl weapon to find preset for

View File

@ -11,6 +11,7 @@ import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer";
import { SaveServer } from "../servers/SaveServer";
import { FenceService } from "../services/FenceService";
import { RagfairCategoriesService } from "../services/RagfairCategoriesService";
import { RagfairOfferService } from "../services/RagfairOfferService";
import { RagfairPriceService } from "../services/RagfairPriceService";
import { HashUtil } from "../utils/HashUtil";
@ -18,7 +19,6 @@ import { JsonUtil } from "../utils/JsonUtil";
import { RandomUtil } from "../utils/RandomUtil";
import { TimeUtil } from "../utils/TimeUtil";
import { RagfairAssortGenerator } from "./RagfairAssortGenerator";
import { RagfairCategoriesService } from "../services/RagfairCategoriesService";
export declare class RagfairOfferGenerator {
protected logger: ILogger;
protected jsonUtil: JsonUtil;

View File

@ -2,15 +2,20 @@ import { BotGenerator } from "../generators/BotGenerator";
import { IPmcData, Skills, Stats } from "../models/eft/common/IPmcData";
import { DatabaseServer } from "../servers/DatabaseServer";
import { SaveServer } from "../servers/SaveServer";
import { BotLootCacheService } from "../services/BotLootCacheService";
import { FenceService } from "../services/FenceService";
import { JsonUtil } from "../utils/JsonUtil";
import { TimeUtil } from "../utils/TimeUtil";
import { Watermark } from "../utils/Watermark";
import { ItemHelper } from "./ItemHelper";
import { ProfileHelper } from "./ProfileHelper";
/**
* This class needs to exist outside of ProfileHelper to ensure cyclic deps don't cause the server to fail on load
*/
export declare class ExtendedProfileHelper extends ProfileHelper {
protected botLootCacheService: BotLootCacheService;
protected botGenerator: BotGenerator;
constructor(jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, fenceService: FenceService, botGenerator: BotGenerator);
constructor(jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, botLootCacheService: BotLootCacheService, fenceService: FenceService, botGenerator: BotGenerator);
generatePlayerScav(sessionID: string): IPmcData;
protected getScavSkills(sessionID: string): Skills;
protected removeSecureContainer(profile: IPmcData): IPmcData;

View File

@ -1,11 +0,0 @@
import { IPmcData } from "../models/eft/common/IPmcData";
import { ILogger } from "../models/spt/utils/ILogger";
export declare class GameHelper {
protected logger: ILogger;
constructor(logger: ILogger);
/**
* Remove condition conters no longer used
* @param pmcProfile profile to remove old counters from
*/
removeDanglingConditionCounters(pmcProfile: IPmcData): void;
}

View File

@ -162,10 +162,10 @@ declare class ItemHelper {
* Find Barter items in the inventory
* @param {string} by
* @param {Object} pmcData
* @param {string} barter_itemID
* @returns Array
* @param {string} barterItemId
* @returns Array of Item objects
*/
findBarterItems(by: string, pmcData: IPmcData, barter_itemID: string): any[];
findBarterItems(by: string, pmcData: IPmcData, barterItemId: string): Item[];
/**
*
* @param pmcData

View File

@ -2,24 +2,32 @@ import { RagfairAssortGenerator } from "../generators/RagfairAssortGenerator";
import { RagfairOfferGenerator } from "../generators/RagfairOfferGenerator";
import { Item } from "../models/eft/common/tables/IItem";
import { ITraderAssort } from "../models/eft/common/tables/ITrader";
import { ITraderConfig } from "../models/spt/config/ITraderConfig";
import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer";
import { FenceService } from "../services/FenceService";
import { TraderAssortService } from "../services/TraderAssortService";
import { JsonUtil } from "../utils/JsonUtil";
import { MathUtil } from "../utils/MathUtil";
import { AssortHelper } from "./AssortHelper";
import { PaymentHelper } from "./PaymentHelper";
import { ProfileHelper } from "./ProfileHelper";
export declare class TraderAssortHelper {
protected logger: ILogger;
protected jsonUtil: JsonUtil;
protected mathUtil: MathUtil;
protected databaseServer: DatabaseServer;
protected profileHelper: ProfileHelper;
protected assortHelper: AssortHelper;
protected paymentHelper: PaymentHelper;
protected ragfairAssortGenerator: RagfairAssortGenerator;
protected ragfairOfferGenerator: RagfairOfferGenerator;
protected traderAssortService: TraderAssortService;
protected fenceService: FenceService;
constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, fenceService: FenceService);
protected configServer: ConfigServer;
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);
/**
* Get a traders assorts
* Can be used for returning ragfair / fence assorts
@ -29,7 +37,12 @@ export declare class TraderAssortHelper {
*/
getAssort(sessionId: string, traderId: string): ITraderAssort;
/**
* Get an array of pristine trader items prior to any alteration by player
* 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
*/
protected multiplyItemPricesByConfigMultipler(traderAssort: ITraderAssort): void;
/**
* Get an array of pristine trader items prior to any alteration by player (as they were on server start)
* @param traderId trader id
* @returns array of Items
*/

View File

@ -29,7 +29,7 @@ export declare class TraderHelper {
getTrader(traderID: string, sessionID: string): ITraderBase;
getTraderAssortsById(traderId: string): ITraderAssort;
/**
* Reset a trader back to its initial state as seen by a level 1 player
* Reset a profiles trader data back to its initial state as seen by a level 1 player
* Does NOT take into account different profile levels
* @param sessionID session id
* @param traderID trader id to reset

View File

@ -18,6 +18,8 @@ export interface TemplateSide {
trader: ProfileTraderTemplate;
}
export interface ProfileTraderTemplate {
initialLoyaltyLevel: number;
initialStanding: number;
initialSalesSum: number;
jaegerUnlocked: boolean;
}

View File

@ -0,0 +1,23 @@
import { ITemplateItem } from "../../eft/common/tables/ITemplateItem";
export declare class BotLootCache {
backpackLoot: ITemplateItem[];
pocketLoot: ITemplateItem[];
vestLoot: ITemplateItem[];
combinedPoolLoot: ITemplateItem[];
specialItems: ITemplateItem[];
healingItems: ITemplateItem[];
drugItems: ITemplateItem[];
stimItems: ITemplateItem[];
grenadeItems: ITemplateItem[];
}
export declare enum LootCacheType {
Special = "Special",
Backpack = "Backpack",
Pocket = "Pocket",
Vest = "Vest",
Combined = "Combined",
HealingItems = "HealingItems",
DrugItems = "DrugItems",
StimItems = "StimItems",
GrenadeItems = "GrenadeItems"
}

View File

@ -3,13 +3,17 @@ export interface ITraderConfig extends IBaseConfig {
kind: "aki-trader";
updateTime: UpdateTime[];
updateTimeDefault: number;
fenceAssortSize: number;
fenceMaxPresetsCount: number;
fencePresetPriceMult: number;
traderPriceMultipler: number;
minDurabilityForSale: number;
fenceItemIgnoreList: string[];
fence: FenceConfig;
}
export interface UpdateTime {
traderId: string;
seconds: number;
}
export interface FenceConfig {
assortSize: number;
maxPresetsCount: number;
presetPriceMult: number;
blacklist: string[];
}

View File

@ -0,0 +1,59 @@
import { PMCLootGenerator } from "../generators/PMCLootGenerator";
import { Items } from "../models/eft/common/tables/IBotType";
import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem";
import { BotLootCache, LootCacheType } from "../models/spt/bots/BotLootCache";
import { ILogger } from "../models/spt/utils/ILogger";
import { DatabaseServer } from "../servers/DatabaseServer";
import { JsonUtil } from "../utils/JsonUtil";
import { RagfairPriceService } from "./RagfairPriceService";
export declare class BotLootCacheService {
protected logger: ILogger;
protected jsonUtil: JsonUtil;
protected databaseServer: DatabaseServer;
protected pmcLootGenerator: PMCLootGenerator;
protected ragfairPriceService: RagfairPriceService;
protected lootCache: Record<string, BotLootCache>;
constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, ragfairPriceService: RagfairPriceService);
/**
* Remove all cached bot loot data
*/
clearCache(): void;
/**
* Get the fully created loot array, ordered by price low to high
* @param botRole bot to get loot for
* @param isPmc is the bot a pmc
* @param lootType what type of loot is needed
* @param lootPool the full pool of loot (needed when cache is empty)
* @returns ITemplateItem array
*/
getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, lootPool: Items): ITemplateItem[];
/**
* Generate loot for a bot and store inside a private class property
* @param botRole
* @param lootType
* @param lootPool the full pool of loot we use to create the various sub-categories with
* @param isPmc
*/
protected addLootToCache(botRole: string, isPmc: boolean, lootType: LootCacheType, lootPool: Items): void;
/**
* Check if a bot type exists inside the loot cache
* @param botRole role to check for
* @returns true if they exist
*/
protected botRoleExistsInCache(botRole: string): boolean;
/**
* If lootcache is null, init with empty property arrays
* @param botRole Bot role to hydrate
*/
protected initCacheForBotRole(botRole: string): void;
/**
* Compares two item prices by their flea (or handbook if that doesnt exist) price
* -1 when a < b
* 0 when a === b
* 1 when a > b
* @param itemAPrice
* @param itemBPrice
* @returns
*/
protected compareByValue(itemAPrice: number, itemBPrice: number): number;
}

View File

@ -45,5 +45,22 @@ export declare class PaymentService {
* ancestor with slotId=hideout
*/
protected isItemInStash(pmcData: IPmcData, item: Item): boolean;
/**
* Remove currency from player stash/inventory
* @param pmcData Player profile to find and remove currency from
* @param currencyTpl Type of currency to pay
* @param amountToPay money value to pay
* @param sessionID Sessino id
* @param output output object to send to client
* @returns IItemEventRouterResponse
*/
addPaymentToOutput(pmcData: IPmcData, currencyTpl: string, amountToPay: number, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse;
/**
* Prioritise player stash first over player inventory
* Post-raid healing would often take money out of the players pockets/secure container
* @param a Firsat money stack item
* @param b Second money stack item
* @returns sorted item
*/
protected moneySort(a: Item, b: Item): number;
}

View File

@ -0,0 +1,40 @@
import { IPmcData } from "../models/eft/common/IPmcData";
import { IPmcDataRepeatableQuest, IRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests";
import { IAkiProfile } from "../models/eft/profile/IAkiProfile";
import { ILogger } from "../models/spt/utils/ILogger";
import { DatabaseServer } from "../servers/DatabaseServer";
import { Watermark } from "../utils/Watermark";
export declare class ProfileFixerService {
protected logger: ILogger;
protected watermark: Watermark;
protected databaseServer: DatabaseServer;
constructor(logger: ILogger, watermark: Watermark, databaseServer: DatabaseServer);
/**
* Find issues in the pmc profile data that may cause issues and fix them
* @param pmcProfile profile to check and fix
*/
checkForAndFixPmcProfileIssues(pmcProfile: IPmcData): void;
/**
* Add tag to profile to indicate when it was made
* @param fullProfile
*/
addMissingAkiVersionTagToProfile(fullProfile: IAkiProfile): void;
/**
* TODO - make this non-public - currently used by RepeatableQuestController
* Remove unused condition counters
* @param pmcProfile profile to remove old counters from
*/
removeDanglingConditionCounters(pmcProfile: IPmcData): void;
protected removeDanglingBackendCounters(pmcProfile: IPmcData): void;
protected getActiveRepeatableQuests(repeatableQuests: IPmcDataRepeatableQuest[]): IRepeatableQuest[];
protected fixNullTraderSalesSums(pmcProfile: IPmcData): void;
protected addMissingBonusesProperty(pmcProfile: IPmcData): void;
protected addMissingRepeatableQuestsProperty(pmcProfile: IPmcData): void;
protected addMissingWorkbenchWeaponSkills(pmcProfile: IPmcData): void;
/**
* In 18876 bsg changed the pockets tplid to be one that has 3 additional special slots
* @param pmcProfile
*/
protected updateProfilePocketsToNewId(pmcProfile: IPmcData): void;
addMissingArmorRepairSkill(pmcProfile: IPmcData): void;
}

View File

@ -1,9 +1,6 @@
import { GameHelper } from "../helpers/GameHelper";
import { HttpServerHelper } from "../helpers/HttpServerHelper";
import { ProfileHelper } from "../helpers/ProfileHelper";
import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData";
import { IPmcData } from "../models/eft/common/IPmcData";
import { IPmcDataRepeatableQuest, IRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests";
import { IGameConfigResponse } from "../models/eft/game/IGameConfigResponse";
import { IAkiProfile } from "../models/eft/profile/IAkiProfile";
import { ICoreConfig } from "../models/spt/config/ICoreConfig";
@ -11,6 +8,7 @@ import { IHttpConfig } from "../models/spt/config/IHttpConfig";
import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer";
import { LocaleService } from "../services/LocaleService";
import { ProfileFixerService } from "../services/ProfileFixerService";
import { Watermark } from "../utils/Watermark";
export declare class GameController {
protected logger: ILogger;
@ -18,25 +16,13 @@ export declare class GameController {
protected httpServerHelper: HttpServerHelper;
protected localeService: LocaleService;
protected profileHelper: ProfileHelper;
protected gameHelper: GameHelper;
protected profileFixerService: ProfileFixerService;
protected configServer: ConfigServer;
protected httpConfig: IHttpConfig;
protected coreConfig: ICoreConfig;
constructor(logger: ILogger, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, gameHelper: GameHelper, configServer: ConfigServer);
constructor(logger: ILogger, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, configServer: ConfigServer);
gameStart(_url: string, _info: IEmptyRequestData, sessionID: string): void;
protected addMissingBonusesProperty(pmcProfile: IPmcData): void;
protected addMissingRepeatableQuestsProperty(pmcProfile: IPmcData): void;
protected addMissingWeaponRepairSkill(pmcProfile: IPmcData): void;
protected addMissingAkiVersionTagToProfile(fullProfile: IAkiProfile): void;
/**
* In 18876 bsg changed the pockets tplid to be one that has 3 additional special slots
* @param pmcProfile
*/
protected updateProfilePocketsToNewId(pmcProfile: IPmcData): void;
protected addMissingArmorRepairSkill(pmcProfile: IPmcData): void;
protected fixNullTraderSalesSums(pmcProfile: IPmcData): void;
protected removeDanglingBackendCounters(pmcProfile: IPmcData): void;
protected logProfileDetails(fullProfile: IAkiProfile): void;
getGameConfig(sessionID: string): IGameConfigResponse;
getServer(): any[];
protected getActiveRepeatableQuests(repeatableQuests: IPmcDataRepeatableQuest[]): IRepeatableQuest[];
}

View File

@ -12,16 +12,18 @@ import { IInRaidConfig } from "../models/spt/config/IInRaidConfig";
import { IMatchConfig } from "../models/spt/config/IMatchConfig";
import { ConfigServer } from "../servers/ConfigServer";
import { SaveServer } from "../servers/SaveServer";
import { BotLootCacheService } from "../services/BotLootCacheService";
import { MatchLocationService } from "../services/MatchLocationService";
export declare class MatchController {
protected saveServer: SaveServer;
protected profileHelper: ProfileHelper;
protected matchLocationService: MatchLocationService;
protected traderHelper: TraderHelper;
protected botLootCacheService: BotLootCacheService;
protected configServer: ConfigServer;
protected matchConfig: IMatchConfig;
protected inraidConfig: IInRaidConfig;
constructor(saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, configServer: ConfigServer);
constructor(saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer);
getEnabled(): boolean;
getProfile(info: IGetProfileRequestData): IPmcData[];
createGroup(sessionID: string, info: ICreateGroupRequestData): any;

View File

@ -11,6 +11,7 @@ import { ISearchFriendResponse } from "../models/eft/profile/ISearchFriendRespon
import { IValidateNicknameRequestData } from "../models/eft/profile/IValidateNicknameRequestData";
import { DatabaseServer } from "../servers/DatabaseServer";
import { SaveServer } from "../servers/SaveServer";
import { ProfileFixerService } from "../services/ProfileFixerService";
import { HashUtil } from "../utils/HashUtil";
import { TimeUtil } from "../utils/TimeUtil";
export declare class ProfileController {
@ -19,13 +20,20 @@ export declare class ProfileController {
protected saveServer: SaveServer;
protected databaseServer: DatabaseServer;
protected itemHelper: ItemHelper;
protected profileFixerService: ProfileFixerService;
protected traderHelper: TraderHelper;
protected extendedProfileHelper: ExtendedProfileHelper;
constructor(hashUtil: HashUtil, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, traderHelper: TraderHelper, extendedProfileHelper: ExtendedProfileHelper);
constructor(hashUtil: HashUtil, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileFixerService: ProfileFixerService, traderHelper: TraderHelper, extendedProfileHelper: ExtendedProfileHelper);
getMiniProfiles(): IMiniProfile[];
getMiniProfile(sessionID: string): any;
getCompleteProfile(sessionID: string): IPmcData[];
createProfile(info: IProfileCreateRequestData, sessionID: string): void;
/**
* Generate a player scav object
* pmc profile MUST exist first before pscav can be generated
* @param sessionID
* @returns IPmcData object
*/
generatePlayerScav(sessionID: string): IPmcData;
validateNickname(info: IValidateNicknameRequestData, sessionID: string): string;
changeNickname(info: IProfileChangeNicknameRequestData, sessionID: string): string;

View File

@ -1,4 +1,3 @@
import { GameHelper } from "../helpers/GameHelper";
import { ItemHelper } from "../helpers/ItemHelper";
import { PresetHelper } from "../helpers/PresetHelper";
import { ProfileHelper } from "../helpers/ProfileHelper";
@ -16,6 +15,7 @@ import { ItemEventRouter } from "../routers/ItemEventRouter";
import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer";
import { PaymentService } from "../services/PaymentService";
import { ProfileFixerService } from "../services/ProfileFixerService";
import { JsonUtil } from "../utils/JsonUtil";
import { MathUtil } from "../utils/MathUtil";
import { ObjectId } from "../utils/ObjectId";
@ -58,14 +58,14 @@ export declare class RepeatableQuestController {
protected itemHelper: ItemHelper;
protected presetHelper: PresetHelper;
protected profileHelper: ProfileHelper;
protected gameHelper: GameHelper;
protected profileFixerService: ProfileFixerService;
protected ragfairServerHelper: RagfairServerHelper;
protected itemEventRouter: ItemEventRouter;
protected paymentService: PaymentService;
protected objectId: ObjectId;
protected configServer: ConfigServer;
protected questConfig: IQuestConfig;
constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, gameHelper: GameHelper, ragfairServerHelper: RagfairServerHelper, itemEventRouter: ItemEventRouter, paymentService: PaymentService, objectId: ObjectId, configServer: ConfigServer);
constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, itemEventRouter: ItemEventRouter, paymentService: PaymentService, objectId: ObjectId, configServer: ConfigServer);
/**
* This is the method reached by the /client/repeatalbeQuests/activityPeriods endpoint
* Returns an array of objects in the format of repeatable quests to the client.

View File

@ -1,29 +1,27 @@
import { PMCLootGenerator } from "../generators/PMCLootGenerator";
import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper";
import { HandbookHelper } from "../helpers/HandbookHelper";
import { Inventory as PmcInventory } from "../models/eft/common/IPmcData";
import { ItemMinMax, Items } from "../models/eft/common/tables/IBotType";
import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem";
import { IBotConfig } from "../models/spt/config/IBotConfig";
import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer";
import { BotLootCacheService } from "../services/BotLootCacheService";
import { HashUtil } from "../utils/HashUtil";
import { JsonUtil } from "../utils/JsonUtil";
import { RandomUtil } from "../utils/RandomUtil";
export declare class BotLootGenerator {
protected jsonUtil: JsonUtil;
protected logger: ILogger;
protected hashUtil: HashUtil;
protected randomUtil: RandomUtil;
protected databaseServer: DatabaseServer;
protected handbookHelper: HandbookHelper;
protected botGeneratorHelper: BotGeneratorHelper;
protected pmcLootGenerator: PMCLootGenerator;
protected botLootCacheService: BotLootCacheService;
protected configServer: ConfigServer;
protected botConfig: IBotConfig;
constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, pmcLootGenerator: PMCLootGenerator, configServer: ConfigServer);
generateLoot(lootPool: Items, itemCounts: ItemMinMax, isPmc: boolean, inventory: PmcInventory): void;
constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer);
generateLoot(lootPool: Items, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, inventory: PmcInventory): void;
protected getRandomisedCount(min: number, max: number, nValue: number): number;
protected addLootFromPool(pool: ITemplateItem[], equipmentSlots: string[], count: number, inventory: PmcInventory, totalValueLimit?: number, useLimits?: boolean): void;
/** Compares two item templates by their price to spawn chance ratio */
protected compareByValue(a: ITemplateItem, b: ITemplateItem): number;
}

View File

@ -2,7 +2,7 @@ import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper";
import { ItemHelper } from "../helpers/ItemHelper";
import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper";
import { Inventory as PmcInventory } from "../models/eft/common/IPmcData";
import { Inventory, MinMax, ModsChances } from "../models/eft/common/tables/IBotType";
import { Inventory, MinMax, Mods, ModsChances } from "../models/eft/common/tables/IBotType";
import { Item } from "../models/eft/common/tables/IItem";
import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem";
import { ILogger } from "../models/spt/utils/ILogger";
@ -22,6 +22,35 @@ export declare class BotWeaponGenerator {
private readonly modMagazineSlotId;
constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil);
generateWeapon(equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, magCounts: MinMax, botRole: string, isPmc: boolean, inventory: PmcInventory): void;
/**
* Create a list of mods for a weapon defined by the weaponTpl parameter
* @param weaponTpl Weapon to generate mods for
*/
protected getWeaponMods(weaponTpl: string): Mods;
/**
* Get a dictionary of items and their attachments
* @param itemTpl item to look up attachments for
* @param weaponModsResult Mods array to add to
*/
protected getItemAttachmentsRecursive(itemTpl: string, weaponModsResult: Mods): void;
protected isTplAnOptic(tplToCheck: string): boolean;
/**
* Get a weapon tpl from a bot jsons inventory
* @param weaponSlot slot to get randomised tpl for
* @param templateInventory
* @returns
*/
protected getRandomisedWeaponTplForSlot(weaponSlot: string, templateInventory: Inventory): string;
/**
* Get an array with a single object being the the weapon as defined by the weaponTpl parameter
* @param weaponTpl weapon to generate array around
* @param equipmentId
* @param weaponSlot
* @param itemTemplate
* @param botRole bot we're generating for
* @returns Item array
*/
protected getWeaponBase(weaponTpl: string, equipmentId: string, weaponSlot: string, itemTemplate: ITemplateItem, botRole: string): Item[];
/**
* Get the mods necessary to kit out a weapon to its preset level
* @param weaponTpl weapon to find preset for

View File

@ -11,6 +11,7 @@ import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer";
import { SaveServer } from "../servers/SaveServer";
import { FenceService } from "../services/FenceService";
import { RagfairCategoriesService } from "../services/RagfairCategoriesService";
import { RagfairOfferService } from "../services/RagfairOfferService";
import { RagfairPriceService } from "../services/RagfairPriceService";
import { HashUtil } from "../utils/HashUtil";
@ -18,7 +19,6 @@ import { JsonUtil } from "../utils/JsonUtil";
import { RandomUtil } from "../utils/RandomUtil";
import { TimeUtil } from "../utils/TimeUtil";
import { RagfairAssortGenerator } from "./RagfairAssortGenerator";
import { RagfairCategoriesService } from "../services/RagfairCategoriesService";
export declare class RagfairOfferGenerator {
protected logger: ILogger;
protected jsonUtil: JsonUtil;

View File

@ -2,15 +2,20 @@ import { BotGenerator } from "../generators/BotGenerator";
import { IPmcData, Skills, Stats } from "../models/eft/common/IPmcData";
import { DatabaseServer } from "../servers/DatabaseServer";
import { SaveServer } from "../servers/SaveServer";
import { BotLootCacheService } from "../services/BotLootCacheService";
import { FenceService } from "../services/FenceService";
import { JsonUtil } from "../utils/JsonUtil";
import { TimeUtil } from "../utils/TimeUtil";
import { Watermark } from "../utils/Watermark";
import { ItemHelper } from "./ItemHelper";
import { ProfileHelper } from "./ProfileHelper";
/**
* This class needs to exist outside of ProfileHelper to ensure cyclic deps don't cause the server to fail on load
*/
export declare class ExtendedProfileHelper extends ProfileHelper {
protected botLootCacheService: BotLootCacheService;
protected botGenerator: BotGenerator;
constructor(jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, fenceService: FenceService, botGenerator: BotGenerator);
constructor(jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, botLootCacheService: BotLootCacheService, fenceService: FenceService, botGenerator: BotGenerator);
generatePlayerScav(sessionID: string): IPmcData;
protected getScavSkills(sessionID: string): Skills;
protected removeSecureContainer(profile: IPmcData): IPmcData;

View File

@ -1,11 +0,0 @@
import { IPmcData } from "../models/eft/common/IPmcData";
import { ILogger } from "../models/spt/utils/ILogger";
export declare class GameHelper {
protected logger: ILogger;
constructor(logger: ILogger);
/**
* Remove condition conters no longer used
* @param pmcProfile profile to remove old counters from
*/
removeDanglingConditionCounters(pmcProfile: IPmcData): void;
}

View File

@ -162,10 +162,10 @@ declare class ItemHelper {
* Find Barter items in the inventory
* @param {string} by
* @param {Object} pmcData
* @param {string} barter_itemID
* @returns Array
* @param {string} barterItemId
* @returns Array of Item objects
*/
findBarterItems(by: string, pmcData: IPmcData, barter_itemID: string): any[];
findBarterItems(by: string, pmcData: IPmcData, barterItemId: string): Item[];
/**
*
* @param pmcData

View File

@ -2,24 +2,32 @@ import { RagfairAssortGenerator } from "../generators/RagfairAssortGenerator";
import { RagfairOfferGenerator } from "../generators/RagfairOfferGenerator";
import { Item } from "../models/eft/common/tables/IItem";
import { ITraderAssort } from "../models/eft/common/tables/ITrader";
import { ITraderConfig } from "../models/spt/config/ITraderConfig";
import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer";
import { FenceService } from "../services/FenceService";
import { TraderAssortService } from "../services/TraderAssortService";
import { JsonUtil } from "../utils/JsonUtil";
import { MathUtil } from "../utils/MathUtil";
import { AssortHelper } from "./AssortHelper";
import { PaymentHelper } from "./PaymentHelper";
import { ProfileHelper } from "./ProfileHelper";
export declare class TraderAssortHelper {
protected logger: ILogger;
protected jsonUtil: JsonUtil;
protected mathUtil: MathUtil;
protected databaseServer: DatabaseServer;
protected profileHelper: ProfileHelper;
protected assortHelper: AssortHelper;
protected paymentHelper: PaymentHelper;
protected ragfairAssortGenerator: RagfairAssortGenerator;
protected ragfairOfferGenerator: RagfairOfferGenerator;
protected traderAssortService: TraderAssortService;
protected fenceService: FenceService;
constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, fenceService: FenceService);
protected configServer: ConfigServer;
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);
/**
* Get a traders assorts
* Can be used for returning ragfair / fence assorts
@ -29,7 +37,12 @@ export declare class TraderAssortHelper {
*/
getAssort(sessionId: string, traderId: string): ITraderAssort;
/**
* Get an array of pristine trader items prior to any alteration by player
* 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
*/
protected multiplyItemPricesByConfigMultipler(traderAssort: ITraderAssort): void;
/**
* Get an array of pristine trader items prior to any alteration by player (as they were on server start)
* @param traderId trader id
* @returns array of Items
*/

View File

@ -29,7 +29,7 @@ export declare class TraderHelper {
getTrader(traderID: string, sessionID: string): ITraderBase;
getTraderAssortsById(traderId: string): ITraderAssort;
/**
* Reset a trader back to its initial state as seen by a level 1 player
* Reset a profiles trader data back to its initial state as seen by a level 1 player
* Does NOT take into account different profile levels
* @param sessionID session id
* @param traderID trader id to reset

View File

@ -18,6 +18,8 @@ export interface TemplateSide {
trader: ProfileTraderTemplate;
}
export interface ProfileTraderTemplate {
initialLoyaltyLevel: number;
initialStanding: number;
initialSalesSum: number;
jaegerUnlocked: boolean;
}

View File

@ -0,0 +1,23 @@
import { ITemplateItem } from "../../eft/common/tables/ITemplateItem";
export declare class BotLootCache {
backpackLoot: ITemplateItem[];
pocketLoot: ITemplateItem[];
vestLoot: ITemplateItem[];
combinedPoolLoot: ITemplateItem[];
specialItems: ITemplateItem[];
healingItems: ITemplateItem[];
drugItems: ITemplateItem[];
stimItems: ITemplateItem[];
grenadeItems: ITemplateItem[];
}
export declare enum LootCacheType {
Special = "Special",
Backpack = "Backpack",
Pocket = "Pocket",
Vest = "Vest",
Combined = "Combined",
HealingItems = "HealingItems",
DrugItems = "DrugItems",
StimItems = "StimItems",
GrenadeItems = "GrenadeItems"
}

View File

@ -3,13 +3,17 @@ export interface ITraderConfig extends IBaseConfig {
kind: "aki-trader";
updateTime: UpdateTime[];
updateTimeDefault: number;
fenceAssortSize: number;
fenceMaxPresetsCount: number;
fencePresetPriceMult: number;
traderPriceMultipler: number;
minDurabilityForSale: number;
fenceItemIgnoreList: string[];
fence: FenceConfig;
}
export interface UpdateTime {
traderId: string;
seconds: number;
}
export interface FenceConfig {
assortSize: number;
maxPresetsCount: number;
presetPriceMult: number;
blacklist: string[];
}

View File

@ -0,0 +1,59 @@
import { PMCLootGenerator } from "../generators/PMCLootGenerator";
import { Items } from "../models/eft/common/tables/IBotType";
import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem";
import { BotLootCache, LootCacheType } from "../models/spt/bots/BotLootCache";
import { ILogger } from "../models/spt/utils/ILogger";
import { DatabaseServer } from "../servers/DatabaseServer";
import { JsonUtil } from "../utils/JsonUtil";
import { RagfairPriceService } from "./RagfairPriceService";
export declare class BotLootCacheService {
protected logger: ILogger;
protected jsonUtil: JsonUtil;
protected databaseServer: DatabaseServer;
protected pmcLootGenerator: PMCLootGenerator;
protected ragfairPriceService: RagfairPriceService;
protected lootCache: Record<string, BotLootCache>;
constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, ragfairPriceService: RagfairPriceService);
/**
* Remove all cached bot loot data
*/
clearCache(): void;
/**
* Get the fully created loot array, ordered by price low to high
* @param botRole bot to get loot for
* @param isPmc is the bot a pmc
* @param lootType what type of loot is needed
* @param lootPool the full pool of loot (needed when cache is empty)
* @returns ITemplateItem array
*/
getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, lootPool: Items): ITemplateItem[];
/**
* Generate loot for a bot and store inside a private class property
* @param botRole
* @param lootType
* @param lootPool the full pool of loot we use to create the various sub-categories with
* @param isPmc
*/
protected addLootToCache(botRole: string, isPmc: boolean, lootType: LootCacheType, lootPool: Items): void;
/**
* Check if a bot type exists inside the loot cache
* @param botRole role to check for
* @returns true if they exist
*/
protected botRoleExistsInCache(botRole: string): boolean;
/**
* If lootcache is null, init with empty property arrays
* @param botRole Bot role to hydrate
*/
protected initCacheForBotRole(botRole: string): void;
/**
* Compares two item prices by their flea (or handbook if that doesnt exist) price
* -1 when a < b
* 0 when a === b
* 1 when a > b
* @param itemAPrice
* @param itemBPrice
* @returns
*/
protected compareByValue(itemAPrice: number, itemBPrice: number): number;
}

View File

@ -45,5 +45,22 @@ export declare class PaymentService {
* ancestor with slotId=hideout
*/
protected isItemInStash(pmcData: IPmcData, item: Item): boolean;
/**
* Remove currency from player stash/inventory
* @param pmcData Player profile to find and remove currency from
* @param currencyTpl Type of currency to pay
* @param amountToPay money value to pay
* @param sessionID Sessino id
* @param output output object to send to client
* @returns IItemEventRouterResponse
*/
addPaymentToOutput(pmcData: IPmcData, currencyTpl: string, amountToPay: number, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse;
/**
* Prioritise player stash first over player inventory
* Post-raid healing would often take money out of the players pockets/secure container
* @param a Firsat money stack item
* @param b Second money stack item
* @returns sorted item
*/
protected moneySort(a: Item, b: Item): number;
}

View File

@ -0,0 +1,40 @@
import { IPmcData } from "../models/eft/common/IPmcData";
import { IPmcDataRepeatableQuest, IRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests";
import { IAkiProfile } from "../models/eft/profile/IAkiProfile";
import { ILogger } from "../models/spt/utils/ILogger";
import { DatabaseServer } from "../servers/DatabaseServer";
import { Watermark } from "../utils/Watermark";
export declare class ProfileFixerService {
protected logger: ILogger;
protected watermark: Watermark;
protected databaseServer: DatabaseServer;
constructor(logger: ILogger, watermark: Watermark, databaseServer: DatabaseServer);
/**
* Find issues in the pmc profile data that may cause issues and fix them
* @param pmcProfile profile to check and fix
*/
checkForAndFixPmcProfileIssues(pmcProfile: IPmcData): void;
/**
* Add tag to profile to indicate when it was made
* @param fullProfile
*/
addMissingAkiVersionTagToProfile(fullProfile: IAkiProfile): void;
/**
* TODO - make this non-public - currently used by RepeatableQuestController
* Remove unused condition counters
* @param pmcProfile profile to remove old counters from
*/
removeDanglingConditionCounters(pmcProfile: IPmcData): void;
protected removeDanglingBackendCounters(pmcProfile: IPmcData): void;
protected getActiveRepeatableQuests(repeatableQuests: IPmcDataRepeatableQuest[]): IRepeatableQuest[];
protected fixNullTraderSalesSums(pmcProfile: IPmcData): void;
protected addMissingBonusesProperty(pmcProfile: IPmcData): void;
protected addMissingRepeatableQuestsProperty(pmcProfile: IPmcData): void;
protected addMissingWorkbenchWeaponSkills(pmcProfile: IPmcData): void;
/**
* In 18876 bsg changed the pockets tplid to be one that has 3 additional special slots
* @param pmcProfile
*/
protected updateProfilePocketsToNewId(pmcProfile: IPmcData): void;
addMissingArmorRepairSkill(pmcProfile: IPmcData): void;
}

View File

@ -1,9 +1,6 @@
import { GameHelper } from "../helpers/GameHelper";
import { HttpServerHelper } from "../helpers/HttpServerHelper";
import { ProfileHelper } from "../helpers/ProfileHelper";
import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData";
import { IPmcData } from "../models/eft/common/IPmcData";
import { IPmcDataRepeatableQuest, IRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests";
import { IGameConfigResponse } from "../models/eft/game/IGameConfigResponse";
import { IAkiProfile } from "../models/eft/profile/IAkiProfile";
import { ICoreConfig } from "../models/spt/config/ICoreConfig";
@ -11,6 +8,7 @@ import { IHttpConfig } from "../models/spt/config/IHttpConfig";
import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer";
import { LocaleService } from "../services/LocaleService";
import { ProfileFixerService } from "../services/ProfileFixerService";
import { Watermark } from "../utils/Watermark";
export declare class GameController {
protected logger: ILogger;
@ -18,25 +16,13 @@ export declare class GameController {
protected httpServerHelper: HttpServerHelper;
protected localeService: LocaleService;
protected profileHelper: ProfileHelper;
protected gameHelper: GameHelper;
protected profileFixerService: ProfileFixerService;
protected configServer: ConfigServer;
protected httpConfig: IHttpConfig;
protected coreConfig: ICoreConfig;
constructor(logger: ILogger, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, gameHelper: GameHelper, configServer: ConfigServer);
constructor(logger: ILogger, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, configServer: ConfigServer);
gameStart(_url: string, _info: IEmptyRequestData, sessionID: string): void;
protected addMissingBonusesProperty(pmcProfile: IPmcData): void;
protected addMissingRepeatableQuestsProperty(pmcProfile: IPmcData): void;
protected addMissingWeaponRepairSkill(pmcProfile: IPmcData): void;
protected addMissingAkiVersionTagToProfile(fullProfile: IAkiProfile): void;
/**
* In 18876 bsg changed the pockets tplid to be one that has 3 additional special slots
* @param pmcProfile
*/
protected updateProfilePocketsToNewId(pmcProfile: IPmcData): void;
protected addMissingArmorRepairSkill(pmcProfile: IPmcData): void;
protected fixNullTraderSalesSums(pmcProfile: IPmcData): void;
protected removeDanglingBackendCounters(pmcProfile: IPmcData): void;
protected logProfileDetails(fullProfile: IAkiProfile): void;
getGameConfig(sessionID: string): IGameConfigResponse;
getServer(): any[];
protected getActiveRepeatableQuests(repeatableQuests: IPmcDataRepeatableQuest[]): IRepeatableQuest[];
}

View File

@ -12,16 +12,18 @@ import { IInRaidConfig } from "../models/spt/config/IInRaidConfig";
import { IMatchConfig } from "../models/spt/config/IMatchConfig";
import { ConfigServer } from "../servers/ConfigServer";
import { SaveServer } from "../servers/SaveServer";
import { BotLootCacheService } from "../services/BotLootCacheService";
import { MatchLocationService } from "../services/MatchLocationService";
export declare class MatchController {
protected saveServer: SaveServer;
protected profileHelper: ProfileHelper;
protected matchLocationService: MatchLocationService;
protected traderHelper: TraderHelper;
protected botLootCacheService: BotLootCacheService;
protected configServer: ConfigServer;
protected matchConfig: IMatchConfig;
protected inraidConfig: IInRaidConfig;
constructor(saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, configServer: ConfigServer);
constructor(saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer);
getEnabled(): boolean;
getProfile(info: IGetProfileRequestData): IPmcData[];
createGroup(sessionID: string, info: ICreateGroupRequestData): any;

View File

@ -11,6 +11,7 @@ import { ISearchFriendResponse } from "../models/eft/profile/ISearchFriendRespon
import { IValidateNicknameRequestData } from "../models/eft/profile/IValidateNicknameRequestData";
import { DatabaseServer } from "../servers/DatabaseServer";
import { SaveServer } from "../servers/SaveServer";
import { ProfileFixerService } from "../services/ProfileFixerService";
import { HashUtil } from "../utils/HashUtil";
import { TimeUtil } from "../utils/TimeUtil";
export declare class ProfileController {
@ -19,13 +20,20 @@ export declare class ProfileController {
protected saveServer: SaveServer;
protected databaseServer: DatabaseServer;
protected itemHelper: ItemHelper;
protected profileFixerService: ProfileFixerService;
protected traderHelper: TraderHelper;
protected extendedProfileHelper: ExtendedProfileHelper;
constructor(hashUtil: HashUtil, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, traderHelper: TraderHelper, extendedProfileHelper: ExtendedProfileHelper);
constructor(hashUtil: HashUtil, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileFixerService: ProfileFixerService, traderHelper: TraderHelper, extendedProfileHelper: ExtendedProfileHelper);
getMiniProfiles(): IMiniProfile[];
getMiniProfile(sessionID: string): any;
getCompleteProfile(sessionID: string): IPmcData[];
createProfile(info: IProfileCreateRequestData, sessionID: string): void;
/**
* Generate a player scav object
* pmc profile MUST exist first before pscav can be generated
* @param sessionID
* @returns IPmcData object
*/
generatePlayerScav(sessionID: string): IPmcData;
validateNickname(info: IValidateNicknameRequestData, sessionID: string): string;
changeNickname(info: IProfileChangeNicknameRequestData, sessionID: string): string;

View File

@ -1,4 +1,3 @@
import { GameHelper } from "../helpers/GameHelper";
import { ItemHelper } from "../helpers/ItemHelper";
import { PresetHelper } from "../helpers/PresetHelper";
import { ProfileHelper } from "../helpers/ProfileHelper";
@ -16,6 +15,7 @@ import { ItemEventRouter } from "../routers/ItemEventRouter";
import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer";
import { PaymentService } from "../services/PaymentService";
import { ProfileFixerService } from "../services/ProfileFixerService";
import { JsonUtil } from "../utils/JsonUtil";
import { MathUtil } from "../utils/MathUtil";
import { ObjectId } from "../utils/ObjectId";
@ -58,14 +58,14 @@ export declare class RepeatableQuestController {
protected itemHelper: ItemHelper;
protected presetHelper: PresetHelper;
protected profileHelper: ProfileHelper;
protected gameHelper: GameHelper;
protected profileFixerService: ProfileFixerService;
protected ragfairServerHelper: RagfairServerHelper;
protected itemEventRouter: ItemEventRouter;
protected paymentService: PaymentService;
protected objectId: ObjectId;
protected configServer: ConfigServer;
protected questConfig: IQuestConfig;
constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, gameHelper: GameHelper, ragfairServerHelper: RagfairServerHelper, itemEventRouter: ItemEventRouter, paymentService: PaymentService, objectId: ObjectId, configServer: ConfigServer);
constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, itemEventRouter: ItemEventRouter, paymentService: PaymentService, objectId: ObjectId, configServer: ConfigServer);
/**
* This is the method reached by the /client/repeatalbeQuests/activityPeriods endpoint
* Returns an array of objects in the format of repeatable quests to the client.

View File

@ -1,29 +1,27 @@
import { PMCLootGenerator } from "../generators/PMCLootGenerator";
import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper";
import { HandbookHelper } from "../helpers/HandbookHelper";
import { Inventory as PmcInventory } from "../models/eft/common/IPmcData";
import { ItemMinMax, Items } from "../models/eft/common/tables/IBotType";
import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem";
import { IBotConfig } from "../models/spt/config/IBotConfig";
import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer";
import { BotLootCacheService } from "../services/BotLootCacheService";
import { HashUtil } from "../utils/HashUtil";
import { JsonUtil } from "../utils/JsonUtil";
import { RandomUtil } from "../utils/RandomUtil";
export declare class BotLootGenerator {
protected jsonUtil: JsonUtil;
protected logger: ILogger;
protected hashUtil: HashUtil;
protected randomUtil: RandomUtil;
protected databaseServer: DatabaseServer;
protected handbookHelper: HandbookHelper;
protected botGeneratorHelper: BotGeneratorHelper;
protected pmcLootGenerator: PMCLootGenerator;
protected botLootCacheService: BotLootCacheService;
protected configServer: ConfigServer;
protected botConfig: IBotConfig;
constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, pmcLootGenerator: PMCLootGenerator, configServer: ConfigServer);
generateLoot(lootPool: Items, itemCounts: ItemMinMax, isPmc: boolean, inventory: PmcInventory): void;
constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer);
generateLoot(lootPool: Items, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, inventory: PmcInventory): void;
protected getRandomisedCount(min: number, max: number, nValue: number): number;
protected addLootFromPool(pool: ITemplateItem[], equipmentSlots: string[], count: number, inventory: PmcInventory, totalValueLimit?: number, useLimits?: boolean): void;
/** Compares two item templates by their price to spawn chance ratio */
protected compareByValue(a: ITemplateItem, b: ITemplateItem): number;
}

View File

@ -2,7 +2,7 @@ import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper";
import { ItemHelper } from "../helpers/ItemHelper";
import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper";
import { Inventory as PmcInventory } from "../models/eft/common/IPmcData";
import { Inventory, MinMax, ModsChances } from "../models/eft/common/tables/IBotType";
import { Inventory, MinMax, Mods, ModsChances } from "../models/eft/common/tables/IBotType";
import { Item } from "../models/eft/common/tables/IItem";
import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem";
import { ILogger } from "../models/spt/utils/ILogger";
@ -22,6 +22,35 @@ export declare class BotWeaponGenerator {
private readonly modMagazineSlotId;
constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil);
generateWeapon(equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, magCounts: MinMax, botRole: string, isPmc: boolean, inventory: PmcInventory): void;
/**
* Create a list of mods for a weapon defined by the weaponTpl parameter
* @param weaponTpl Weapon to generate mods for
*/
protected getWeaponMods(weaponTpl: string): Mods;
/**
* Get a dictionary of items and their attachments
* @param itemTpl item to look up attachments for
* @param weaponModsResult Mods array to add to
*/
protected getItemAttachmentsRecursive(itemTpl: string, weaponModsResult: Mods): void;
protected isTplAnOptic(tplToCheck: string): boolean;
/**
* Get a weapon tpl from a bot jsons inventory
* @param weaponSlot slot to get randomised tpl for
* @param templateInventory
* @returns
*/
protected getRandomisedWeaponTplForSlot(weaponSlot: string, templateInventory: Inventory): string;
/**
* Get an array with a single object being the the weapon as defined by the weaponTpl parameter
* @param weaponTpl weapon to generate array around
* @param equipmentId
* @param weaponSlot
* @param itemTemplate
* @param botRole bot we're generating for
* @returns Item array
*/
protected getWeaponBase(weaponTpl: string, equipmentId: string, weaponSlot: string, itemTemplate: ITemplateItem, botRole: string): Item[];
/**
* Get the mods necessary to kit out a weapon to its preset level
* @param weaponTpl weapon to find preset for

View File

@ -11,6 +11,7 @@ import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer";
import { SaveServer } from "../servers/SaveServer";
import { FenceService } from "../services/FenceService";
import { RagfairCategoriesService } from "../services/RagfairCategoriesService";
import { RagfairOfferService } from "../services/RagfairOfferService";
import { RagfairPriceService } from "../services/RagfairPriceService";
import { HashUtil } from "../utils/HashUtil";
@ -18,7 +19,6 @@ import { JsonUtil } from "../utils/JsonUtil";
import { RandomUtil } from "../utils/RandomUtil";
import { TimeUtil } from "../utils/TimeUtil";
import { RagfairAssortGenerator } from "./RagfairAssortGenerator";
import { RagfairCategoriesService } from "../services/RagfairCategoriesService";
export declare class RagfairOfferGenerator {
protected logger: ILogger;
protected jsonUtil: JsonUtil;

View File

@ -2,15 +2,20 @@ import { BotGenerator } from "../generators/BotGenerator";
import { IPmcData, Skills, Stats } from "../models/eft/common/IPmcData";
import { DatabaseServer } from "../servers/DatabaseServer";
import { SaveServer } from "../servers/SaveServer";
import { BotLootCacheService } from "../services/BotLootCacheService";
import { FenceService } from "../services/FenceService";
import { JsonUtil } from "../utils/JsonUtil";
import { TimeUtil } from "../utils/TimeUtil";
import { Watermark } from "../utils/Watermark";
import { ItemHelper } from "./ItemHelper";
import { ProfileHelper } from "./ProfileHelper";
/**
* This class needs to exist outside of ProfileHelper to ensure cyclic deps don't cause the server to fail on load
*/
export declare class ExtendedProfileHelper extends ProfileHelper {
protected botLootCacheService: BotLootCacheService;
protected botGenerator: BotGenerator;
constructor(jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, fenceService: FenceService, botGenerator: BotGenerator);
constructor(jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, botLootCacheService: BotLootCacheService, fenceService: FenceService, botGenerator: BotGenerator);
generatePlayerScav(sessionID: string): IPmcData;
protected getScavSkills(sessionID: string): Skills;
protected removeSecureContainer(profile: IPmcData): IPmcData;

View File

@ -1,11 +0,0 @@
import { IPmcData } from "../models/eft/common/IPmcData";
import { ILogger } from "../models/spt/utils/ILogger";
export declare class GameHelper {
protected logger: ILogger;
constructor(logger: ILogger);
/**
* Remove condition conters no longer used
* @param pmcProfile profile to remove old counters from
*/
removeDanglingConditionCounters(pmcProfile: IPmcData): void;
}

View File

@ -162,10 +162,10 @@ declare class ItemHelper {
* Find Barter items in the inventory
* @param {string} by
* @param {Object} pmcData
* @param {string} barter_itemID
* @returns Array
* @param {string} barterItemId
* @returns Array of Item objects
*/
findBarterItems(by: string, pmcData: IPmcData, barter_itemID: string): any[];
findBarterItems(by: string, pmcData: IPmcData, barterItemId: string): Item[];
/**
*
* @param pmcData

View File

@ -2,24 +2,32 @@ import { RagfairAssortGenerator } from "../generators/RagfairAssortGenerator";
import { RagfairOfferGenerator } from "../generators/RagfairOfferGenerator";
import { Item } from "../models/eft/common/tables/IItem";
import { ITraderAssort } from "../models/eft/common/tables/ITrader";
import { ITraderConfig } from "../models/spt/config/ITraderConfig";
import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer";
import { FenceService } from "../services/FenceService";
import { TraderAssortService } from "../services/TraderAssortService";
import { JsonUtil } from "../utils/JsonUtil";
import { MathUtil } from "../utils/MathUtil";
import { AssortHelper } from "./AssortHelper";
import { PaymentHelper } from "./PaymentHelper";
import { ProfileHelper } from "./ProfileHelper";
export declare class TraderAssortHelper {
protected logger: ILogger;
protected jsonUtil: JsonUtil;
protected mathUtil: MathUtil;
protected databaseServer: DatabaseServer;
protected profileHelper: ProfileHelper;
protected assortHelper: AssortHelper;
protected paymentHelper: PaymentHelper;
protected ragfairAssortGenerator: RagfairAssortGenerator;
protected ragfairOfferGenerator: RagfairOfferGenerator;
protected traderAssortService: TraderAssortService;
protected fenceService: FenceService;
constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, assortHelper: AssortHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferGenerator: RagfairOfferGenerator, traderAssortService: TraderAssortService, fenceService: FenceService);
protected configServer: ConfigServer;
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);
/**
* Get a traders assorts
* Can be used for returning ragfair / fence assorts
@ -29,7 +37,12 @@ export declare class TraderAssortHelper {
*/
getAssort(sessionId: string, traderId: string): ITraderAssort;
/**
* Get an array of pristine trader items prior to any alteration by player
* 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
*/
protected multiplyItemPricesByConfigMultipler(traderAssort: ITraderAssort): void;
/**
* Get an array of pristine trader items prior to any alteration by player (as they were on server start)
* @param traderId trader id
* @returns array of Items
*/

View File

@ -29,7 +29,7 @@ export declare class TraderHelper {
getTrader(traderID: string, sessionID: string): ITraderBase;
getTraderAssortsById(traderId: string): ITraderAssort;
/**
* Reset a trader back to its initial state as seen by a level 1 player
* Reset a profiles trader data back to its initial state as seen by a level 1 player
* Does NOT take into account different profile levels
* @param sessionID session id
* @param traderID trader id to reset

View File

@ -18,6 +18,8 @@ export interface TemplateSide {
trader: ProfileTraderTemplate;
}
export interface ProfileTraderTemplate {
initialLoyaltyLevel: number;
initialStanding: number;
initialSalesSum: number;
jaegerUnlocked: boolean;
}

View File

@ -0,0 +1,23 @@
import { ITemplateItem } from "../../eft/common/tables/ITemplateItem";
export declare class BotLootCache {
backpackLoot: ITemplateItem[];
pocketLoot: ITemplateItem[];
vestLoot: ITemplateItem[];
combinedPoolLoot: ITemplateItem[];
specialItems: ITemplateItem[];
healingItems: ITemplateItem[];
drugItems: ITemplateItem[];
stimItems: ITemplateItem[];
grenadeItems: ITemplateItem[];
}
export declare enum LootCacheType {
Special = "Special",
Backpack = "Backpack",
Pocket = "Pocket",
Vest = "Vest",
Combined = "Combined",
HealingItems = "HealingItems",
DrugItems = "DrugItems",
StimItems = "StimItems",
GrenadeItems = "GrenadeItems"
}

View File

@ -3,13 +3,17 @@ export interface ITraderConfig extends IBaseConfig {
kind: "aki-trader";
updateTime: UpdateTime[];
updateTimeDefault: number;
fenceAssortSize: number;
fenceMaxPresetsCount: number;
fencePresetPriceMult: number;
traderPriceMultipler: number;
minDurabilityForSale: number;
fenceItemIgnoreList: string[];
fence: FenceConfig;
}
export interface UpdateTime {
traderId: string;
seconds: number;
}
export interface FenceConfig {
assortSize: number;
maxPresetsCount: number;
presetPriceMult: number;
blacklist: string[];
}

View File

@ -0,0 +1,59 @@
import { PMCLootGenerator } from "../generators/PMCLootGenerator";
import { Items } from "../models/eft/common/tables/IBotType";
import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem";
import { BotLootCache, LootCacheType } from "../models/spt/bots/BotLootCache";
import { ILogger } from "../models/spt/utils/ILogger";
import { DatabaseServer } from "../servers/DatabaseServer";
import { JsonUtil } from "../utils/JsonUtil";
import { RagfairPriceService } from "./RagfairPriceService";
export declare class BotLootCacheService {
protected logger: ILogger;
protected jsonUtil: JsonUtil;
protected databaseServer: DatabaseServer;
protected pmcLootGenerator: PMCLootGenerator;
protected ragfairPriceService: RagfairPriceService;
protected lootCache: Record<string, BotLootCache>;
constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, pmcLootGenerator: PMCLootGenerator, ragfairPriceService: RagfairPriceService);
/**
* Remove all cached bot loot data
*/
clearCache(): void;
/**
* Get the fully created loot array, ordered by price low to high
* @param botRole bot to get loot for
* @param isPmc is the bot a pmc
* @param lootType what type of loot is needed
* @param lootPool the full pool of loot (needed when cache is empty)
* @returns ITemplateItem array
*/
getLootFromCache(botRole: string, isPmc: boolean, lootType: LootCacheType, lootPool: Items): ITemplateItem[];
/**
* Generate loot for a bot and store inside a private class property
* @param botRole
* @param lootType
* @param lootPool the full pool of loot we use to create the various sub-categories with
* @param isPmc
*/
protected addLootToCache(botRole: string, isPmc: boolean, lootType: LootCacheType, lootPool: Items): void;
/**
* Check if a bot type exists inside the loot cache
* @param botRole role to check for
* @returns true if they exist
*/
protected botRoleExistsInCache(botRole: string): boolean;
/**
* If lootcache is null, init with empty property arrays
* @param botRole Bot role to hydrate
*/
protected initCacheForBotRole(botRole: string): void;
/**
* Compares two item prices by their flea (or handbook if that doesnt exist) price
* -1 when a < b
* 0 when a === b
* 1 when a > b
* @param itemAPrice
* @param itemBPrice
* @returns
*/
protected compareByValue(itemAPrice: number, itemBPrice: number): number;
}

View File

@ -45,5 +45,22 @@ export declare class PaymentService {
* ancestor with slotId=hideout
*/
protected isItemInStash(pmcData: IPmcData, item: Item): boolean;
/**
* Remove currency from player stash/inventory
* @param pmcData Player profile to find and remove currency from
* @param currencyTpl Type of currency to pay
* @param amountToPay money value to pay
* @param sessionID Sessino id
* @param output output object to send to client
* @returns IItemEventRouterResponse
*/
addPaymentToOutput(pmcData: IPmcData, currencyTpl: string, amountToPay: number, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse;
/**
* Prioritise player stash first over player inventory
* Post-raid healing would often take money out of the players pockets/secure container
* @param a Firsat money stack item
* @param b Second money stack item
* @returns sorted item
*/
protected moneySort(a: Item, b: Item): number;
}

View File

@ -0,0 +1,40 @@
import { IPmcData } from "../models/eft/common/IPmcData";
import { IPmcDataRepeatableQuest, IRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests";
import { IAkiProfile } from "../models/eft/profile/IAkiProfile";
import { ILogger } from "../models/spt/utils/ILogger";
import { DatabaseServer } from "../servers/DatabaseServer";
import { Watermark } from "../utils/Watermark";
export declare class ProfileFixerService {
protected logger: ILogger;
protected watermark: Watermark;
protected databaseServer: DatabaseServer;
constructor(logger: ILogger, watermark: Watermark, databaseServer: DatabaseServer);
/**
* Find issues in the pmc profile data that may cause issues and fix them
* @param pmcProfile profile to check and fix
*/
checkForAndFixPmcProfileIssues(pmcProfile: IPmcData): void;
/**
* Add tag to profile to indicate when it was made
* @param fullProfile
*/
addMissingAkiVersionTagToProfile(fullProfile: IAkiProfile): void;
/**
* TODO - make this non-public - currently used by RepeatableQuestController
* Remove unused condition counters
* @param pmcProfile profile to remove old counters from
*/
removeDanglingConditionCounters(pmcProfile: IPmcData): void;
protected removeDanglingBackendCounters(pmcProfile: IPmcData): void;
protected getActiveRepeatableQuests(repeatableQuests: IPmcDataRepeatableQuest[]): IRepeatableQuest[];
protected fixNullTraderSalesSums(pmcProfile: IPmcData): void;
protected addMissingBonusesProperty(pmcProfile: IPmcData): void;
protected addMissingRepeatableQuestsProperty(pmcProfile: IPmcData): void;
protected addMissingWorkbenchWeaponSkills(pmcProfile: IPmcData): void;
/**
* In 18876 bsg changed the pockets tplid to be one that has 3 additional special slots
* @param pmcProfile
*/
protected updateProfilePocketsToNewId(pmcProfile: IPmcData): void;
addMissingArmorRepairSkill(pmcProfile: IPmcData): void;
}

View File

@ -1,9 +1,6 @@
import { GameHelper } from "../helpers/GameHelper";
import { HttpServerHelper } from "../helpers/HttpServerHelper";
import { ProfileHelper } from "../helpers/ProfileHelper";
import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData";
import { IPmcData } from "../models/eft/common/IPmcData";
import { IPmcDataRepeatableQuest, IRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests";
import { IGameConfigResponse } from "../models/eft/game/IGameConfigResponse";
import { IAkiProfile } from "../models/eft/profile/IAkiProfile";
import { ICoreConfig } from "../models/spt/config/ICoreConfig";
@ -11,6 +8,7 @@ import { IHttpConfig } from "../models/spt/config/IHttpConfig";
import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer";
import { LocaleService } from "../services/LocaleService";
import { ProfileFixerService } from "../services/ProfileFixerService";
import { Watermark } from "../utils/Watermark";
export declare class GameController {
protected logger: ILogger;
@ -18,25 +16,13 @@ export declare class GameController {
protected httpServerHelper: HttpServerHelper;
protected localeService: LocaleService;
protected profileHelper: ProfileHelper;
protected gameHelper: GameHelper;
protected profileFixerService: ProfileFixerService;
protected configServer: ConfigServer;
protected httpConfig: IHttpConfig;
protected coreConfig: ICoreConfig;
constructor(logger: ILogger, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, gameHelper: GameHelper, configServer: ConfigServer);
constructor(logger: ILogger, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, configServer: ConfigServer);
gameStart(_url: string, _info: IEmptyRequestData, sessionID: string): void;
protected addMissingBonusesProperty(pmcProfile: IPmcData): void;
protected addMissingRepeatableQuestsProperty(pmcProfile: IPmcData): void;
protected addMissingWeaponRepairSkill(pmcProfile: IPmcData): void;
protected addMissingAkiVersionTagToProfile(fullProfile: IAkiProfile): void;
/**
* In 18876 bsg changed the pockets tplid to be one that has 3 additional special slots
* @param pmcProfile
*/
protected updateProfilePocketsToNewId(pmcProfile: IPmcData): void;
protected addMissingArmorRepairSkill(pmcProfile: IPmcData): void;
protected fixNullTraderSalesSums(pmcProfile: IPmcData): void;
protected removeDanglingBackendCounters(pmcProfile: IPmcData): void;
protected logProfileDetails(fullProfile: IAkiProfile): void;
getGameConfig(sessionID: string): IGameConfigResponse;
getServer(): any[];
protected getActiveRepeatableQuests(repeatableQuests: IPmcDataRepeatableQuest[]): IRepeatableQuest[];
}

View File

@ -12,16 +12,18 @@ import { IInRaidConfig } from "../models/spt/config/IInRaidConfig";
import { IMatchConfig } from "../models/spt/config/IMatchConfig";
import { ConfigServer } from "../servers/ConfigServer";
import { SaveServer } from "../servers/SaveServer";
import { BotLootCacheService } from "../services/BotLootCacheService";
import { MatchLocationService } from "../services/MatchLocationService";
export declare class MatchController {
protected saveServer: SaveServer;
protected profileHelper: ProfileHelper;
protected matchLocationService: MatchLocationService;
protected traderHelper: TraderHelper;
protected botLootCacheService: BotLootCacheService;
protected configServer: ConfigServer;
protected matchConfig: IMatchConfig;
protected inraidConfig: IInRaidConfig;
constructor(saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, configServer: ConfigServer);
constructor(saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer);
getEnabled(): boolean;
getProfile(info: IGetProfileRequestData): IPmcData[];
createGroup(sessionID: string, info: ICreateGroupRequestData): any;

View File

@ -11,6 +11,7 @@ import { ISearchFriendResponse } from "../models/eft/profile/ISearchFriendRespon
import { IValidateNicknameRequestData } from "../models/eft/profile/IValidateNicknameRequestData";
import { DatabaseServer } from "../servers/DatabaseServer";
import { SaveServer } from "../servers/SaveServer";
import { ProfileFixerService } from "../services/ProfileFixerService";
import { HashUtil } from "../utils/HashUtil";
import { TimeUtil } from "../utils/TimeUtil";
export declare class ProfileController {
@ -19,13 +20,20 @@ export declare class ProfileController {
protected saveServer: SaveServer;
protected databaseServer: DatabaseServer;
protected itemHelper: ItemHelper;
protected profileFixerService: ProfileFixerService;
protected traderHelper: TraderHelper;
protected extendedProfileHelper: ExtendedProfileHelper;
constructor(hashUtil: HashUtil, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, traderHelper: TraderHelper, extendedProfileHelper: ExtendedProfileHelper);
constructor(hashUtil: HashUtil, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileFixerService: ProfileFixerService, traderHelper: TraderHelper, extendedProfileHelper: ExtendedProfileHelper);
getMiniProfiles(): IMiniProfile[];
getMiniProfile(sessionID: string): any;
getCompleteProfile(sessionID: string): IPmcData[];
createProfile(info: IProfileCreateRequestData, sessionID: string): void;
/**
* Generate a player scav object
* pmc profile MUST exist first before pscav can be generated
* @param sessionID
* @returns IPmcData object
*/
generatePlayerScav(sessionID: string): IPmcData;
validateNickname(info: IValidateNicknameRequestData, sessionID: string): string;
changeNickname(info: IProfileChangeNicknameRequestData, sessionID: string): string;

View File

@ -1,4 +1,3 @@
import { GameHelper } from "../helpers/GameHelper";
import { ItemHelper } from "../helpers/ItemHelper";
import { PresetHelper } from "../helpers/PresetHelper";
import { ProfileHelper } from "../helpers/ProfileHelper";
@ -16,6 +15,7 @@ import { ItemEventRouter } from "../routers/ItemEventRouter";
import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer";
import { PaymentService } from "../services/PaymentService";
import { ProfileFixerService } from "../services/ProfileFixerService";
import { JsonUtil } from "../utils/JsonUtil";
import { MathUtil } from "../utils/MathUtil";
import { ObjectId } from "../utils/ObjectId";
@ -58,14 +58,14 @@ export declare class RepeatableQuestController {
protected itemHelper: ItemHelper;
protected presetHelper: PresetHelper;
protected profileHelper: ProfileHelper;
protected gameHelper: GameHelper;
protected profileFixerService: ProfileFixerService;
protected ragfairServerHelper: RagfairServerHelper;
protected itemEventRouter: ItemEventRouter;
protected paymentService: PaymentService;
protected objectId: ObjectId;
protected configServer: ConfigServer;
protected questConfig: IQuestConfig;
constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, gameHelper: GameHelper, ragfairServerHelper: RagfairServerHelper, itemEventRouter: ItemEventRouter, paymentService: PaymentService, objectId: ObjectId, configServer: ConfigServer);
constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, itemEventRouter: ItemEventRouter, paymentService: PaymentService, objectId: ObjectId, configServer: ConfigServer);
/**
* This is the method reached by the /client/repeatalbeQuests/activityPeriods endpoint
* Returns an array of objects in the format of repeatable quests to the client.

View File

@ -1,29 +1,27 @@
import { PMCLootGenerator } from "../generators/PMCLootGenerator";
import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper";
import { HandbookHelper } from "../helpers/HandbookHelper";
import { Inventory as PmcInventory } from "../models/eft/common/IPmcData";
import { ItemMinMax, Items } from "../models/eft/common/tables/IBotType";
import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem";
import { IBotConfig } from "../models/spt/config/IBotConfig";
import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer";
import { BotLootCacheService } from "../services/BotLootCacheService";
import { HashUtil } from "../utils/HashUtil";
import { JsonUtil } from "../utils/JsonUtil";
import { RandomUtil } from "../utils/RandomUtil";
export declare class BotLootGenerator {
protected jsonUtil: JsonUtil;
protected logger: ILogger;
protected hashUtil: HashUtil;
protected randomUtil: RandomUtil;
protected databaseServer: DatabaseServer;
protected handbookHelper: HandbookHelper;
protected botGeneratorHelper: BotGeneratorHelper;
protected pmcLootGenerator: PMCLootGenerator;
protected botLootCacheService: BotLootCacheService;
protected configServer: ConfigServer;
protected botConfig: IBotConfig;
constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, pmcLootGenerator: PMCLootGenerator, configServer: ConfigServer);
generateLoot(lootPool: Items, itemCounts: ItemMinMax, isPmc: boolean, inventory: PmcInventory): void;
constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer);
generateLoot(lootPool: Items, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, inventory: PmcInventory): void;
protected getRandomisedCount(min: number, max: number, nValue: number): number;
protected addLootFromPool(pool: ITemplateItem[], equipmentSlots: string[], count: number, inventory: PmcInventory, totalValueLimit?: number, useLimits?: boolean): void;
/** Compares two item templates by their price to spawn chance ratio */
protected compareByValue(a: ITemplateItem, b: ITemplateItem): number;
}

View File

@ -2,7 +2,7 @@ import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper";
import { ItemHelper } from "../helpers/ItemHelper";
import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper";
import { Inventory as PmcInventory } from "../models/eft/common/IPmcData";
import { Inventory, MinMax, ModsChances } from "../models/eft/common/tables/IBotType";
import { Inventory, MinMax, Mods, ModsChances } from "../models/eft/common/tables/IBotType";
import { Item } from "../models/eft/common/tables/IItem";
import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem";
import { ILogger } from "../models/spt/utils/ILogger";
@ -22,6 +22,35 @@ export declare class BotWeaponGenerator {
private readonly modMagazineSlotId;
constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil);
generateWeapon(equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, magCounts: MinMax, botRole: string, isPmc: boolean, inventory: PmcInventory): void;
/**
* Create a list of mods for a weapon defined by the weaponTpl parameter
* @param weaponTpl Weapon to generate mods for
*/
protected getWeaponMods(weaponTpl: string): Mods;
/**
* Get a dictionary of items and their attachments
* @param itemTpl item to look up attachments for
* @param weaponModsResult Mods array to add to
*/
protected getItemAttachmentsRecursive(itemTpl: string, weaponModsResult: Mods): void;
protected isTplAnOptic(tplToCheck: string): boolean;
/**
* Get a weapon tpl from a bot jsons inventory
* @param weaponSlot slot to get randomised tpl for
* @param templateInventory
* @returns
*/
protected getRandomisedWeaponTplForSlot(weaponSlot: string, templateInventory: Inventory): string;
/**
* Get an array with a single object being the the weapon as defined by the weaponTpl parameter
* @param weaponTpl weapon to generate array around
* @param equipmentId
* @param weaponSlot
* @param itemTemplate
* @param botRole bot we're generating for
* @returns Item array
*/
protected getWeaponBase(weaponTpl: string, equipmentId: string, weaponSlot: string, itemTemplate: ITemplateItem, botRole: string): Item[];
/**
* Get the mods necessary to kit out a weapon to its preset level
* @param weaponTpl weapon to find preset for

View File

@ -11,6 +11,7 @@ import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer";
import { SaveServer } from "../servers/SaveServer";
import { FenceService } from "../services/FenceService";
import { RagfairCategoriesService } from "../services/RagfairCategoriesService";
import { RagfairOfferService } from "../services/RagfairOfferService";
import { RagfairPriceService } from "../services/RagfairPriceService";
import { HashUtil } from "../utils/HashUtil";
@ -18,7 +19,6 @@ import { JsonUtil } from "../utils/JsonUtil";
import { RandomUtil } from "../utils/RandomUtil";
import { TimeUtil } from "../utils/TimeUtil";
import { RagfairAssortGenerator } from "./RagfairAssortGenerator";
import { RagfairCategoriesService } from "../services/RagfairCategoriesService";
export declare class RagfairOfferGenerator {
protected logger: ILogger;
protected jsonUtil: JsonUtil;

View File

@ -2,15 +2,20 @@ import { BotGenerator } from "../generators/BotGenerator";
import { IPmcData, Skills, Stats } from "../models/eft/common/IPmcData";
import { DatabaseServer } from "../servers/DatabaseServer";
import { SaveServer } from "../servers/SaveServer";
import { BotLootCacheService } from "../services/BotLootCacheService";
import { FenceService } from "../services/FenceService";
import { JsonUtil } from "../utils/JsonUtil";
import { TimeUtil } from "../utils/TimeUtil";
import { Watermark } from "../utils/Watermark";
import { ItemHelper } from "./ItemHelper";
import { ProfileHelper } from "./ProfileHelper";
/**
* This class needs to exist outside of ProfileHelper to ensure cyclic deps don't cause the server to fail on load
*/
export declare class ExtendedProfileHelper extends ProfileHelper {
protected botLootCacheService: BotLootCacheService;
protected botGenerator: BotGenerator;
constructor(jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, fenceService: FenceService, botGenerator: BotGenerator);
constructor(jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, botLootCacheService: BotLootCacheService, fenceService: FenceService, botGenerator: BotGenerator);
generatePlayerScav(sessionID: string): IPmcData;
protected getScavSkills(sessionID: string): Skills;
protected removeSecureContainer(profile: IPmcData): IPmcData;

View File

@ -1,11 +0,0 @@
import { IPmcData } from "../models/eft/common/IPmcData";
import { ILogger } from "../models/spt/utils/ILogger";
export declare class GameHelper {
protected logger: ILogger;
constructor(logger: ILogger);
/**
* Remove condition conters no longer used
* @param pmcProfile profile to remove old counters from
*/
removeDanglingConditionCounters(pmcProfile: IPmcData): void;
}

View File

@ -162,10 +162,10 @@ declare class ItemHelper {
* Find Barter items in the inventory
* @param {string} by
* @param {Object} pmcData
* @param {string} barter_itemID
* @returns Array
* @param {string} barterItemId
* @returns Array of Item objects
*/
findBarterItems(by: string, pmcData: IPmcData, barter_itemID: string): any[];
findBarterItems(by: string, pmcData: IPmcData, barterItemId: string): Item[];
/**
*
* @param pmcData

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