bump for aki 3.2.0

This commit is contained in:
CWX 2022-08-19 17:27:56 +01:00
parent 0ab064d968
commit ef532ecc94
3403 changed files with 35863 additions and 15836 deletions

View File

@ -1,27 +0,0 @@
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 { RandomUtil } from "../utils/RandomUtil";
export declare class BotLootGenerator {
protected logger: ILogger;
protected hashUtil: HashUtil;
protected randomUtil: RandomUtil;
protected databaseServer: DatabaseServer;
protected handbookHelper: HandbookHelper;
protected botGeneratorHelper: BotGeneratorHelper;
protected botLootCacheService: BotLootCacheService;
protected configServer: ConfigServer;
protected botConfig: IBotConfig;
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;
}

View File

@ -1,97 +0,0 @@
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 { Item } from "../models/eft/common/tables/IItem";
import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem";
import { ILogger } from "../models/spt/utils/ILogger";
import { DatabaseServer } from "../servers/DatabaseServer";
import { HashUtil } from "../utils/HashUtil";
import { RandomUtil } from "../utils/RandomUtil";
import { JsonUtil } from "../utils/JsonUtil";
export declare class BotWeaponGenerator {
protected jsonUtil: JsonUtil;
protected logger: ILogger;
protected hashUtil: HashUtil;
protected databaseServer: DatabaseServer;
protected itemHelper: ItemHelper;
protected weightedRandomHelper: WeightedRandomHelper;
protected botGeneratorHelper: BotGeneratorHelper;
protected randomUtil: RandomUtil;
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;
/**
* Get the mods necessary to kit out a weapon to its preset level
* @param weaponTpl weapon to find preset for
* @param equipmentSlot the slot the weapon will be placed in
* @param weaponParentId
* @returns array of weapon mods
*/
protected getPresetWeaponMods(weaponTpl: string, equipmentSlot: string, weaponParentId: string, itemTemplate: ITemplateItem, botRole: string): Item[];
/** Checks if all required slots are occupied on a weapon and all it's mods */
protected isWeaponValid(itemList: Item[]): boolean;
/**
* Generates extra magazines or bullets (if magazine is internal) and adds them to TacticalVest and Pockets.
* Additionally, adds extra bullets to SecuredContainer
* @param weaponMods
* @param weaponTemplate
* @param magCounts
* @param ammoTpl
* @param inventory
* @returns
*/
protected generateExtraMagazines(weaponMods: Item[], weaponTemplate: ITemplateItem, magCounts: MinMax, ammoTpl: string, inventory: PmcInventory): void;
/**
* Get a randomised number of bullets for a specific magazine
* @param magCounts min and max count of magazines
* @param magTemplate magazine to generate bullet count for
* @returns bullet count number
*/
protected getRandomisedBulletCount(magCounts: MinMax, magTemplate: ITemplateItem): number;
/**
* Get a randomised count of magazines
* @param magCounts min and max value returned value can be between
* @returns numberical value of magazine count
*/
protected getRandomisedMagazineCount(magCounts: MinMax): number;
/**
* Add ammo to the secure container
* @param stackCount How many stacks of ammo to add
* @param ammoTpl Ammo type to add
* @param stackSize Size of the ammo stack to add
* @param inventory Player inventory
*/
protected addAmmoToSecureContainer(stackCount: number, ammoTpl: string, stackSize: number, inventory: PmcInventory): void;
/**
* Get a weapons magazine tpl from a weapon template
* @param weaponMods mods from a weapon template
* @param weaponTemplate Weapon to get magazine tpl for
* @returns magazine tpl string
*/
protected getMagazineTplFromWeaponTemplate(weaponMods: Item[], weaponTemplate: ITemplateItem): string;
protected addBulletsToVestAndPockets(ammoTpl: string, bulletCount: number, inventory: PmcInventory): void;
/**
* Finds and returns compatible ammo tpl
*
* @param {*} weaponMods
* @param {*} weaponTemplate
* @returns compatible ammo tpl
*/
protected getCompatibleAmmo(weaponMods: Item[], weaponTemplate: ITemplateItem): string;
/**
* Fill existing magazines to full, while replacing their contents with specified ammo
* @param weaponMods
* @param magazine
* @param ammoTpl
*/
protected fillExistingMagazines(weaponMods: Item[], magazine: Item, ammoTpl: string): void;
/**
* Fill each Camora with a bullet
* @param weaponMods Weapon mods to find and update camora mod(s) from
* @param magazineId magazine id to find and add to
* @param ammoTpl ammo template id to hydate with
*/
protected fillCamorasWithAmmo(weaponMods: Item[], magazineId: string, ammoTpl: string): void;
}

View File

@ -1,45 +0,0 @@
import { IPmcData, Victim } from "../models/eft/common/IPmcData";
import { Item } from "../models/eft/common/tables/IItem";
import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData";
import { ILogger } from "../models/spt/utils/ILogger";
import { DatabaseServer } from "../servers/DatabaseServer";
import { SaveServer } from "../servers/SaveServer";
import { JsonUtil } from "../utils/JsonUtil";
import { InventoryHelper } from "./InventoryHelper";
import { PaymentHelper } from "./PaymentHelper";
export declare class InRaidHelper {
protected logger: ILogger;
protected saveServer: SaveServer;
protected jsonUtil: JsonUtil;
protected databaseServer: DatabaseServer;
protected inventoryHelper: InventoryHelper;
protected paymentHelper: PaymentHelper;
constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper);
protected removePlayer(sessionID: string): void;
protected removeMapAccessKey(offraidData: ISaveProgressRequestData, sessionID: string): void;
addUpdToMoneyFromRaid(items: Item[]): void;
/**
* Add positive karma for PMC kills
* @param {*} existingFenceStanding
* @param {*} victims
*/
calculateFenceStandingChangeFromKills(existingFenceStanding: number, victims: Victim[]): void;
setBaseStats(profileData: IPmcData, offraidData: ISaveProgressRequestData, sessionID: string): IPmcData;
markFoundItems(pmcData: IPmcData, profile: IPmcData, isPlayerScav: boolean): IPmcData;
removeFoundInRaidStatusFromItems(profile: IPmcData): IPmcData;
setInventory(sessionID: string, pmcData: IPmcData, profile: IPmcData): IPmcData;
/**
* Clear pmc inventory of all items except those that are exempt
* @param pmcData Player profile
* @param sessionID Session id
* @returns Player profile with pmc inventory cleared
*/
deleteInventory(pmcData: IPmcData, sessionID: string): IPmcData;
/**
* Does the provided items slotId mean its kept on the player after death
* @param slotId slotid of item to check
* @returns true if item is kept after death
*/
isItemKeptAfterDeath(slotId: string): boolean;
getPlayerGear(items: Item[]): Item[];
}

View File

@ -1,101 +0,0 @@
import { BackendCounter, Bonus } from "../IPmcData";
import { Item } from "./IItem";
export interface IBotBase {
_id: string;
aid: string;
savage: any;
Info: Info;
Customization: Customization;
Health: Health;
Inventory: Inventory;
Skills: Skills;
Stats: Stats;
Encyclopedia: any;
ConditionCounters: ConditionCounters;
BackendCounters: Record<string, BackendCounter>;
InsuredItems: any[];
Hideout: Hideout;
Bonuses: Bonus[];
}
export interface Info {
Nickname: string;
LowerNickname: string;
Side: string;
Voice: string;
Level: number;
Experience: number;
RegistrationDate: number;
GameVersion: string;
AccountType: number;
MemberCategory: number;
lockedMoveCommands: boolean;
SavageLockTime: number;
LastTimePlayedAsSavage: number;
Settings: Settings;
NicknameChangeDate: number;
NeedWipeOptions: any[];
lastCompletedWipe: any;
BannedState: boolean;
BannedUntil: number;
IsStreamerModeAvailable: boolean;
}
export interface Settings {
Role: string;
BotDifficulty: string;
Experience: number;
StandingForKill: number;
AggressorBonus: number;
}
export interface Customization {
Head: string;
Body: string;
Feet: string;
Hands: string;
}
export interface Health {
}
export interface Inventory {
items: Item[];
equipment: string;
stash: string;
sortingTable: string;
questRaidItems: string;
questStashItems: string;
fastPanel: FastPanel;
}
export interface FastPanel {
}
export interface Skills {
Common: any[];
Mastering: any[];
Points: number;
}
export interface Stats {
SessionCounters: SessionCounters;
OverallCounters: OverallCounters;
}
export interface SessionCounters {
Items: any[];
}
export interface OverallCounters {
Items: any[];
}
export interface ConditionCounters {
Counters: any[];
}
export interface Hideout {
Production: Production;
Areas: Area[];
}
export interface Production {
}
export interface Area {
type: number;
level: number;
active: boolean;
passiveBonusesEnabled: boolean;
completeTime: number;
constructing: boolean;
slots: any[];
lastRecipe: any;
}

View File

@ -1,27 +0,0 @@
import { IBaseConfig } from "./IBaseConfig";
export interface IHideoutConfig extends IBaseConfig {
kind: "aki-hideout";
runIntervalSeconds: number;
scavCase: ScavCase;
fuelDrainRateMultipler: number;
}
export interface ScavCase {
rewardParentBlacklist: string[];
rewardItemBlacklist: any[];
ammoRewards: AmmoRewards;
moneyRewards: MoneyRewards;
}
export interface AmmoRewards {
giveMultipleOfTen: boolean;
minAmount: number;
}
export interface MoneyRewards {
enabled: boolean;
rub: MinMax;
usd: MinMax;
eur: MinMax;
}
export interface MinMax {
min: number;
max: number;
}

View File

@ -1,8 +0,0 @@
export declare class TimeUtil {
static readonly oneHourAsSeconds = 3600;
formatTime(date: Date): string;
formatDate(date: Date): string;
getDate(): string;
getTime(): string;
getTimestamp(): number;
}

View File

@ -1,10 +1,10 @@
{
"name": "BushWhacker",
"author": "CWX",
"version": "1.2.0",
"version": "1.2.1",
"license": "NCSA",
"main": "src/mod.js",
"akiVersion": "3.1.1",
"akiVersion": "3.2.0",
"scripts": {
"setup:environment": "npm i",
"build:unzipped": "copyfiles -e \"./node_modules/**/*.*\" -e \"./dist/**/*.*\" -e \"./package-lock.json\" -e \"./tsconfig.json\" -e \"./README.txt\" -e \"./mod.code-workspace\" ./**/*.* ./dist",

View File

@ -0,0 +1,14 @@
import { DependencyContainer } from "tsyringe";
import { IPreAkiLoadMod } from "@spt-aki/models/external/IPreAkiLoadMod";
class CWX_BushWhacker implements IPreAkiLoadMod
{
private pkg;
public preAkiLoad(container: DependencyContainer): void
{
this.pkg = require("../package.json")
}
}
module.exports = { mod: new CWX_BushWhacker() }

View File

@ -16,7 +16,7 @@ export declare class NotifierCallbacks {
* until we actually have something to send because otherwise we'd spam the client
* and the client would abort the connection due to spam.
*/
sendNotification(_sessionID: string, req: any, resp: any, _data: any): void;
sendNotification(sessionID: string, req: any, resp: any, data: any): void;
getNotifier(url: string, info: any, sessionID: string): IGetBodyResponseData<any[]>;
createNotifierChannel(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<INotifierChannel>;
selectProfile(url: string, info: ISelectProfileRequestData, sessionID: string): IGetBodyResponseData<any>;

View File

@ -0,0 +1,9 @@
import { ContextVariable } from "./ContextVariable";
import { ContextVariableType } from "./ContextVariableType";
export declare class ApplicationContext {
private variables;
private static holderMaxSize;
getLatestValue(type: ContextVariableType): ContextVariable;
getValues(type: ContextVariableType): ContextVariable[];
addValue(type: ContextVariableType, value: any): void;
}

View File

@ -0,0 +1,10 @@
import { ContextVariableType } from "./ContextVariableType";
export declare class ContextVariable {
private value;
private timestamp;
private type;
constructor(value: any, type: ContextVariableType);
getValue(): any;
getTimestamp(): Date;
getType(): ContextVariableType;
}

View File

@ -0,0 +1,4 @@
export declare enum ContextVariableType {
SESSION_ID = 0,
MATCH_INFO = 1
}

View File

@ -30,6 +30,6 @@ export declare class BotController {
*/
getBotDifficulty(type: string, difficulty: string): Difficulty;
protected getPmcDifficultySettings(pmcType: "bear" | "usec", difficulty: string): Difficulty;
generate(info: IGenerateBotsRequestData, playerScav?: boolean): IBotBase[];
generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[];
getBotCap(): number;
}

View File

@ -1,14 +1,15 @@
import { ScavCaseRewardGenerator } from "../generators/ScavCaseRewardGenerator";
import { HideoutHelper } from "../helpers/HideoutHelper";
import { InventoryHelper } from "../helpers/InventoryHelper";
import { PaymentHelper } from "../helpers/PaymentHelper";
import { PresetHelper } from "../helpers/PresetHelper";
import { ProfileHelper } from "../helpers/ProfileHelper";
import { HideoutArea, IPmcData, Product } from "../models/eft/common/IPmcData";
import { IPmcData } from "../models/eft/common/IPmcData";
import { HideoutArea, Product } from "../models/eft/common/tables/IBotBase";
import { HideoutUpgradeCompleteRequestData } from "../models/eft/hideout/HideoutUpgradeCompleteRequestData";
import { IHideoutContinousProductionStartRequestData } from "../models/eft/hideout/IHideoutContinousProductionStartRequestData";
import { IHideoutProduction } from "../models/eft/hideout/IHideoutProduction";
import { IHideoutPutItemInRequestData } from "../models/eft/hideout/IHideoutPutItemInRequestData";
import { IHideoutScavCase } from "../models/eft/hideout/IHideoutScavCase";
import { IHideoutScavCaseStartRequestData } from "../models/eft/hideout/IHideoutScavCaseStartRequestData";
import { IHideoutSingleProductionStartRequestData } from "../models/eft/hideout/IHideoutSingleProductionStartRequestData";
import { IHideoutTakeItemOutRequestData } from "../models/eft/hideout/IHideoutTakeItemOutRequestData";
@ -42,26 +43,59 @@ export declare class HideoutController {
protected httpResponse: HttpResponseUtil;
protected profileHelper: ProfileHelper;
protected hideoutHelper: HideoutHelper;
protected scavCaseRewardGenerator: ScavCaseRewardGenerator;
protected configServer: ConfigServer;
protected static nameBackendCountersCrafting: string;
protected hideoutConfig: IHideoutConfig;
constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, itemEventRouter: ItemEventRouter, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, configServer: ConfigServer);
constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, itemEventRouter: ItemEventRouter, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, configServer: ConfigServer);
upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse;
upgradeComplete(pmcData: IPmcData, body: HideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse;
putItemsInAreaSlots(pmcData: IPmcData, body: IHideoutPutItemInRequestData, sessionID: string): IItemEventRouterResponse;
/**
* Create item in hideout slot item array, remove item from player inventory
* @param pmcData Profile data
* @param addItemToHideoutRequest reqeust from client to place item in area slot
* @param sessionID Session id
* @returns IItemEventRouterResponse object
*/
putItemsInAreaSlots(pmcData: IPmcData, addItemToHideoutRequest: IHideoutPutItemInRequestData, sessionID: string): IItemEventRouterResponse;
takeItemsFromAreaSlots(pmcData: IPmcData, body: IHideoutTakeItemOutRequestData, sessionID: string): IItemEventRouterResponse;
protected removeItemFromGenerator(sessionID: string, pmcData: IPmcData, body: IHideoutTakeItemOutRequestData, output: IItemEventRouterResponse, hideoutArea: HideoutArea): IItemEventRouterResponse;
/**
* Find resource item in hideout area, add copy to player inventory, remove Item from hideout slot
* @param sessionID Session id
* @param pmcData Profile to update
* @param removeResourceRequest client request
* @param output response to send to client
* @param hideoutArea Area fuel is being removed from
* @returns IItemEventRouterResponse response
*/
protected removeResourceFromArea(sessionID: string, pmcData: IPmcData, removeResourceRequest: IHideoutTakeItemOutRequestData, output: IItemEventRouterResponse, hideoutArea: HideoutArea): IItemEventRouterResponse;
toggleArea(pmcData: IPmcData, body: IHideoutToggleAreaRequestData, sessionID: string): IItemEventRouterResponse;
singleProductionStart(pmcData: IPmcData, body: IHideoutSingleProductionStartRequestData, sessionID: string): IItemEventRouterResponse;
/**
* Handles event after clicking 'start' on the scav case hideout page
* @param pmcData player profile
* @param body client request object
* @param sessionID session id
* @returns item event router response
*/
scavCaseProductionStart(pmcData: IPmcData, body: IHideoutScavCaseStartRequestData, sessionID: string): IItemEventRouterResponse;
protected getRandomisedItemRarityCounter(recipe: IHideoutScavCase): {
[x: string]: number;
};
protected getRandomisedScavRewards(rarityItemCounter: {
[x: string]: number;
}): Product[];
/**
* Add generated scav case rewards to player profile
* @param pmcData player profile to add rewards to
* @param rewards reward items to add to profile
*/
protected addScavCaseRewardsToProfile(pmcData: IPmcData, rewards: Product[]): void;
continuousProductionStart(pmcData: IPmcData, body: IHideoutContinousProductionStartRequestData, sessionID: string): IItemEventRouterResponse;
takeProduction(pmcData: IPmcData, body: IHideoutTakeProductionRequestData, sessionID: string): IItemEventRouterResponse;
protected handleRecipie(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, body: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse;
/**
* Handles giving rewards stored in player profile to player after clicking 'get rewards'
* @param sessionID
* @param pmcData
* @param body
* @param output
* @returns
*/
protected handleScavCase(sessionID: string, pmcData: IPmcData, body: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse;
registerProduction(pmcData: IPmcData, body: IHideoutSingleProductionStartRequestData | IHideoutContinousProductionStartRequestData, sessionID: string): IItemEventRouterResponse;
update(): void;

View File

@ -1,7 +1,8 @@
import { ExtendedProfileHelper } from "../helpers/ExtendedProfileHelper";
import { PlayerScavGenerator } from "../generators/PlayerScavGenerator";
import { HealthHelper } from "../helpers/HealthHelper";
import { InRaidHelper } from "../helpers/InRaidHelper";
import { ItemHelper } from "../helpers/ItemHelper";
import { ProfileHelper } from "../helpers/ProfileHelper";
import { QuestHelper } from "../helpers/QuestHelper";
import { TraderHelper } from "../helpers/TraderHelper";
import { IRegisterPlayerRequestData } from "../models/eft/inRaid/IRegisterPlayerRequestData";
@ -12,20 +13,32 @@ import { DatabaseServer } from "../servers/DatabaseServer";
import { SaveServer } from "../servers/SaveServer";
import { InsuranceService } from "../services/InsuranceService";
import { JsonUtil } from "../utils/JsonUtil";
import { TimeUtil } from "../utils/TimeUtil";
export declare class InraidController {
protected saveServer: SaveServer;
protected jsonUtil: JsonUtil;
protected timeUtil: TimeUtil;
protected databaseServer: DatabaseServer;
protected questHelper: QuestHelper;
protected itemHelper: ItemHelper;
protected extendedProfileHelper: ExtendedProfileHelper;
protected profileHelper: ProfileHelper;
protected playerScavGenerator: PlayerScavGenerator;
protected healthHelper: HealthHelper;
protected traderHelper: TraderHelper;
protected insuranceService: InsuranceService;
protected inRaidHelper: InRaidHelper;
protected configServer: ConfigServer;
protected inraidConfig: IInRaidConfig;
constructor(saveServer: SaveServer, jsonUtil: JsonUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, extendedProfileHelper: ExtendedProfileHelper, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, configServer: ConfigServer);
constructor(saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, configServer: ConfigServer);
addPlayer(sessionID: string, info: IRegisterPlayerRequestData): void;
saveProgress(offraidData: ISaveProgressRequestData, sessionID: string): void;
/**
* Mark inventory items as FiR if player survived raid, otherwise remove FiR from them
* @param offraidData Save Progress Request
* @param pmcData player profile
* @param isPlayerScav Was the player a pScav
*/
private markOrRemoveFoundInRaidItems;
private handlePostRaidPlayerScavProcess;
private handlePostRaidPlayerScavKarmaChanges;
}

View File

@ -41,5 +41,4 @@ export declare class InsuranceController {
* @returns response object to send to client
*/
cost(info: IGetInsuranceCostRequestData, sessionID: string): IGetInsuranceCostResponseData;
doAbsolutelyNothing(): void;
}

View File

@ -1,3 +1,4 @@
import { ApplicationContext } from "../context/ApplicationContext";
import { ProfileHelper } from "../helpers/ProfileHelper";
import { TraderHelper } from "../helpers/TraderHelper";
import { IPmcData } from "../models/eft/common/IPmcData";
@ -21,9 +22,10 @@ export declare class MatchController {
protected traderHelper: TraderHelper;
protected botLootCacheService: BotLootCacheService;
protected configServer: ConfigServer;
protected applicationContext: ApplicationContext;
protected matchConfig: IMatchConfig;
protected inraidConfig: IInRaidConfig;
constructor(saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer);
constructor(saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, applicationContext: ApplicationContext);
getEnabled(): boolean;
getProfile(info: IGetProfileRequestData): IPmcData[];
createGroup(sessionID: string, info: ICreateGroupRequestData): any;

View File

@ -2,11 +2,10 @@ import { IPmcData } from "../models/eft/common/IPmcData";
import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse";
import { INoteActionData } from "../models/eft/notes/INoteActionData";
import { ItemEventRouter } from "../routers/ItemEventRouter";
declare class NoteController {
export declare class NoteController {
protected itemEventRouter: ItemEventRouter;
constructor(itemEventRouter: ItemEventRouter);
addNote(pmcData: IPmcData, body: INoteActionData, sessionID: string): IItemEventRouterResponse;
editNote(pmcData: IPmcData, body: INoteActionData, sessionID: string): IItemEventRouterResponse;
deleteNote(pmcData: IPmcData, body: INoteActionData, sessionID: string): IItemEventRouterResponse;
}
export { NoteController };

View File

@ -1,5 +1,6 @@
import { ExtendedProfileHelper } from "../helpers/ExtendedProfileHelper";
import { PlayerScavGenerator } from "../generators/PlayerScavGenerator";
import { ItemHelper } from "../helpers/ItemHelper";
import { ProfileHelper } from "../helpers/ProfileHelper";
import { TraderHelper } from "../helpers/TraderHelper";
import { IPmcData } from "../models/eft/common/IPmcData";
import { IMiniProfile } from "../models/eft/launcher/IMiniProfile";
@ -21,9 +22,10 @@ export declare class ProfileController {
protected databaseServer: DatabaseServer;
protected itemHelper: ItemHelper;
protected profileFixerService: ProfileFixerService;
protected playerScavGenerator: PlayerScavGenerator;
protected traderHelper: TraderHelper;
protected extendedProfileHelper: ExtendedProfileHelper;
constructor(hashUtil: HashUtil, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileFixerService: ProfileFixerService, traderHelper: TraderHelper, extendedProfileHelper: ExtendedProfileHelper);
protected profileHelper: ProfileHelper;
constructor(hashUtil: HashUtil, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileFixerService: ProfileFixerService, playerScavGenerator: PlayerScavGenerator, traderHelper: TraderHelper, profileHelper: ProfileHelper);
getMiniProfiles(): IMiniProfile[];
getMiniProfile(sessionID: string): any;
getCompleteProfile(sessionID: string): IPmcData[];

View File

@ -21,7 +21,6 @@ export declare class RepairController {
protected repairHelper: RepairHelper;
protected configServer: ConfigServer;
protected repairConfig: IRepairConfig;
protected readonly WEAPON_SKILL_REPAIR_GAIN: number;
constructor(logger: ILogger, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, configServer: ConfigServer);
/**
* Repair with trader

View File

@ -4,7 +4,8 @@ import { ProfileHelper } from "../helpers/ProfileHelper";
import { RagfairServerHelper } from "../helpers/RagfairServerHelper";
import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData";
import { Exit } from "../models/eft/common/ILocationBase";
import { IPmcData, TraderInfo } from "../models/eft/common/IPmcData";
import { IPmcData } from "../models/eft/common/IPmcData";
import { TraderInfo } from "../models/eft/common/tables/IBotBase";
import { ICompletion, ICompletionAvailableFor, IElimination, IEliminationCondition, IExploration, IExplorationCondition, IPmcDataRepeatableQuest, IRepeatableQuest, IReward, IRewards } from "../models/eft/common/tables/IRepeatableQuests";
import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse";
import { IRepeatableQuestChangeRequest } from "../models/eft/quests/IRepeatableQuestChangeRequest";

View File

@ -1,13 +1,14 @@
import { BotHelper } from "../helpers/BotHelper";
import { GameEventHelper } from "../helpers/GameEventHelper";
import { ProfileHelper } from "../helpers/ProfileHelper";
import { IGenerateBotsRequestData } from "../models/eft/bot/IGenerateBotsRequestData";
import { Health as PmcHealth } from "../models/eft/common/IPmcData";
import { IBotBase } from "../models/eft/common/tables/IBotBase";
import { Health, Inventory, Skills } from "../models/eft/common/tables/IBotType";
import { Health as PmcHealth, IBotBase, Skills } from "../models/eft/common/tables/IBotBase";
import { Health, IBotType, Inventory } from "../models/eft/common/tables/IBotType";
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 { BotEquipmentFilterService } from "../services/BotEquipmentFilterService";
import { HashUtil } from "../utils/HashUtil";
import { JsonUtil } from "../utils/JsonUtil";
import { RandomUtil } from "../utils/RandomUtil";
@ -23,19 +24,30 @@ export declare class BotGenerator {
protected hashUtil: HashUtil;
protected randomUtil: RandomUtil;
protected jsonUtil: JsonUtil;
protected profileHelper: ProfileHelper;
protected databaseServer: DatabaseServer;
protected botInventoryGenerator: BotInventoryGenerator;
protected botEquipmentFilterService: BotEquipmentFilterService;
protected botHelper: BotHelper;
protected gameEventHelper: GameEventHelper;
protected configServer: ConfigServer;
protected botConfig: IBotConfig;
constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botHelper: BotHelper, gameEventHelper: GameEventHelper, configServer: ConfigServer);
generate(info: IGenerateBotsRequestData, playerScav?: boolean): IBotBase[];
constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botEquipmentFilterService: BotEquipmentFilterService, botHelper: BotHelper, gameEventHelper: GameEventHelper, configServer: ConfigServer);
/**
* Choose if a bot should become a Pmc by checking if bot type is allowed to become a Pmc in bot config
* @param isPlayerScav is a player scav being generated, forces choice returned to never be a pmc
* Generate a player scav bot object
* @param role e.g. assault / pmcbot
* @param difficulty easy/normal/hard/impossible
* @param botTemplate base bot template to use (e.g. assault/pmcbot)
* @returns
*/
protected shouldBotBePmc(isPlayerScav: boolean, role: string): boolean;
generatePlayerScav(role: string, difficulty: string, botTemplate: IBotType): IBotBase;
generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[];
/**
* Choose if a bot should become a PMC by checking if bot type is allowed to become a Pmc in botConfig.convertFromChances and doing a random int check
* @param botRole the bot role to check if should be a pmc
* @returns true if should be a pmc
*/
protected shouldBotBePmc(botRole: string): boolean;
/**
* Get a randomised PMC side based on bot config value 'isUsec'
* @returns pmc side as string
@ -46,7 +58,7 @@ export declare class BotGenerator {
* @returns IBotBase object
*/
protected getCloneOfBotBase(): IBotBase;
protected generateBot(bot: IBotBase, role: string, isPmc: boolean): IBotBase;
protected generateBot(bot: IBotBase, role: string, node: IBotType, isPmc: boolean, isPlayerScav?: boolean): IBotBase;
/**
* Log the number of PMCs generated to the debug console
*/

View File

@ -1,4 +1,4 @@
import { Inventory as PmcInventory } from "../models/eft/common/IPmcData";
import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase";
import { Inventory, Chances, Generation, Mods } from "../models/eft/common/tables/IBotType";
import { HashUtil } from "../utils/HashUtil";
import { RandomUtil } from "../utils/RandomUtil";

View File

@ -0,0 +1,124 @@
import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper";
import { HandbookHelper } from "../helpers/HandbookHelper";
import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase";
import { Chances, Inventory, ItemMinMax, ModsChances } from "../models/eft/common/tables/IBotType";
import { Item } from "../models/eft/common/tables/IItem";
import { ITemplateItem, Props } 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 { RandomUtil } from "../utils/RandomUtil";
import { BotWeaponGenerator } from "./BotWeaponGenerator";
export declare class BotLootGenerator {
protected logger: ILogger;
protected hashUtil: HashUtil;
protected randomUtil: RandomUtil;
protected databaseServer: DatabaseServer;
protected handbookHelper: HandbookHelper;
protected botGeneratorHelper: BotGeneratorHelper;
protected botWeaponGenerator: BotWeaponGenerator;
protected botLootCacheService: BotLootCacheService;
protected configServer: ConfigServer;
protected botConfig: IBotConfig;
constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botLootCacheService: BotLootCacheService, configServer: ConfigServer);
generateLoot(templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances): void;
protected getRandomisedCount(min: number, max: number, nValue: number): number;
/**
* Take random items from a pool and add to an inventory until totalItemCount or totalValueLimit is reached
* @param pool pool of items to pick from
* @param equipmentSlots What equality slot will the loot items be added to
* @param totalItemCount Max count of items to add
* @param inventoryToAddItemsTo bot inventory loot will be added to
* @param botRole role of the bot loot is being generated for (assault/pmcbot)
* @param useLimits should item limit counts be used as defined in config/bot.json
* @param totalValueLimitRub total value of loot allowed in roubles
* @param isPmc is the bot being generated for a pmc
*/
protected addLootFromPool(pool: ITemplateItem[], equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, useLimits?: boolean, totalValueLimitRub?: number, isPmc?: boolean): void;
/**
* Add generated weapons to inventory as loot
* @param botInventory inventory to add preset to
* @param equipmentSlot slot to place the preset in (backpack)
* @param templateInventory bots template, assault.json
* @param modChances chances for mods to spawn on weapon
* @param botRole bots role, .e.g. pmcBot
* @param isPmc are we generating for a pmc
*/
protected addLooseWeaponsToInventorySlot(botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean): void;
/**
* Get a random item from the pool parameter using the biasedRandomNumber system
* @param pool pool of items to pick an item from
* @param isPmc is the bot being created a pmc
* @returns ITemplateItem object
*/
protected getRandomItemFromPool(pool: ITemplateItem[], isPmc: boolean): ITemplateItem;
/**
* Get the loot nvalue from botconfig
* @param isPmc if true the pmc nvalue is returned
* @returns nvalue as number
*/
protected getBotLootNValue(isPmc: boolean): number;
/**
* Update item limit array to contain items that have a limit
* All values are set to 0
* @param isPmc is the bot a pmc
* @param botRole role the bot has
* @param limitCount
*/
protected initItemLimitArray(isPmc: boolean, botRole: string, limitCount: Record<string, number>): void;
/**
* Check if an item has reached its bot-specific spawn limit
* @param itemTemplate Item we check to see if its reached spawn limit
* @param botRole Bot type
* @param isPmc Is bot we're working with a pmc
* @param limitCount spawn limits for items on bot
* @param itemSpawnLimits the limits this bot is allowed to have
* @returns true if item has reached spawn limit
*/
protected itemHasReachedSpawnLimit(itemTemplate: ITemplateItem, botRole: string, isPmc: boolean, limitCount: Record<string, number>, itemSpawnLimits: Record<string, number>): boolean;
/**
* Is the item an ammo box
* @param props props of the item to check
* @returns true if item is an ammo box
*/
protected isAmmoBox(props: Props): boolean;
/**
* Create an object that contains the ammo stack for an ammo box
* @param parentId ammo box id
* @param props ammo box props
* @returns Item object
*/
protected createAmmoForAmmoBox(parentId: string, props: Props): Item;
/**
* Randomise the stack size of a money object, uses different values for pmc or scavs
* @param isPmc is this a PMC
* @param itemTemplate item details
* @param moneyItem Money stack to randomise
*/
protected randomiseMoneyStackSize(isPmc: boolean, itemTemplate: ITemplateItem, moneyItem: Item): void;
/**
* Randomise the size of an ammo stack
* @param isPmc is this a PMC
* @param itemTemplate item details
* @param ammoItem Ammo stack to randomise
*/
protected randomiseAmmoStackSize(isPmc: boolean, itemTemplate: ITemplateItem, ammoItem: Item): void;
/**
* Get spawn limits for a specific bot type from bot.json config
* If no limit found for a non pmc bot, fall back to defaults
* @param isPmc is the bot we want limits for a pmc
* @param botRole what role does the bot have
* @returns dictionary of tplIds and limit
*/
protected getItemSpawnLimitsForBotType(isPmc: boolean, botRole: string): Record<string, number>;
/**
* Get the parentId or tplId of item inside spawnLimits object if it exists
* @param itemTemplate item we want to look for in spawn limits
* @param spawnLimits Limits to check for item
* @returns id as string, otherwise undefined
*/
protected getMatchingIdFromSpawnLimits(itemTemplate: ITemplateItem, spawnLimits: Record<string, number>): string;
}

View File

@ -0,0 +1,173 @@
import { BotGeneratorHelper } from "../helpers/BotGeneratorHelper";
import { ItemHelper } from "../helpers/ItemHelper";
import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper";
import { MinMax } from "../models/common/MinMax";
import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase";
import { Inventory, ModsChances } from "../models/eft/common/tables/IBotType";
import { Item } from "../models/eft/common/tables/IItem";
import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem";
import { GenerateWeaponResult } from "../models/spt/bots/GenerateWeaponResult";
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 { HashUtil } from "../utils/HashUtil";
import { JsonUtil } from "../utils/JsonUtil";
import { RandomUtil } from "../utils/RandomUtil";
export declare class BotWeaponGenerator {
protected jsonUtil: JsonUtil;
protected logger: ILogger;
protected hashUtil: HashUtil;
protected databaseServer: DatabaseServer;
protected itemHelper: ItemHelper;
protected weightedRandomHelper: WeightedRandomHelper;
protected botGeneratorHelper: BotGeneratorHelper;
protected randomUtil: RandomUtil;
protected configServer: ConfigServer;
protected readonly modMagazineSlotId = "mod_magazine";
protected botConfig: IBotConfig;
constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil, configServer: ConfigServer);
/**
* Get a random weapon from a bots pool of weapons (weighted)
* @param equipmentSlot Primary/secondary/holster
* @param botTemplateInventory e.g. assault.json
* @returns weapon tpl
*/
pickWeightedWeaponTplFromPool(equipmentSlot: string, botTemplateInventory: Inventory): string;
/**
* Generated a weapon based on the supplied weapon tpl
* @param weaponTpl weapon tpl to generate (use pickWeightedWeaponTplFromPool())
* @param equipmentSlot slot to fit into, primary/secondary/holster
* @param botTemplateInventory e.g. assault.json
* @param weaponParentId
* @param modChances
* @param botRole
* @param isPmc
* @returns GenerateWeaponResult object
*/
generateWeaponByTpl(weaponTpl: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean): GenerateWeaponResult;
/**
* Generate an entirely random weapon
* @param equipmentSlot Primary/secondary/holster
* @param botTemplateInventory e.g. assault.json
* @param weaponParentId
* @param modChances
* @param botRole
* @param isPmc
* @returns GenerateWeaponResult object
*/
generateRandomWeapon(equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean): GenerateWeaponResult;
/**
* Create array with weapon base as only element
* Add additional properties as required
* @param weaponTpl
* @param weaponParentId
* @param equipmentSlot
* @param weaponItemTemplate
* @param botRole for durability values
* @returns
*/
constructWeaponBaseArray(weaponTpl: string, weaponParentId: string, equipmentSlot: string, weaponItemTemplate: ITemplateItem, botRole: string): Item[];
/**
* Add compatible magazines to an inventory based on a generated weapon
* @param weaponDetails
* @param magCounts
* @param inventory
* @param botRole the bot type we're getting generating extra mags for
*/
addExtraMagazinesToInventory(weaponDetails: GenerateWeaponResult, magCounts: MinMax, inventory: PmcInventory, botRole: string): void;
/**
* Get the mods necessary to kit out a weapon to its preset level
* @param weaponTpl weapon to find preset for
* @param equipmentSlot the slot the weapon will be placed in
* @param weaponParentId Value used for the parentid
* @returns array of weapon mods
*/
protected getPresetWeaponMods(weaponTpl: string, equipmentSlot: string, weaponParentId: string, itemTemplate: ITemplateItem, botRole: string): Item[];
/** Checks if all required slots are occupied on a weapon and all it's mods */
protected isWeaponValid(weaponItemArray: Item[]): boolean;
/**
* Generates extra magazines or bullets (if magazine is internal) and adds them to TacticalVest and Pockets.
* Additionally, adds extra bullets to SecuredContainer
* @param weaponMods
* @param weaponTemplate
* @param magCounts
* @param ammoTpl
* @param inventory
* @param botRole the bot type we're getting generating extra mags for
* @returns
*/
protected generateExtraMagazines(weaponMods: Item[], weaponTemplate: ITemplateItem, magCounts: MinMax, ammoTpl: string, inventory: PmcInventory, botRole: string): void;
/**
* Get a randomised number of bullets for a specific magazine
* @param magCounts min and max count of magazines
* @param magTemplate magazine to generate bullet count for
* @returns bullet count number
*/
protected getRandomisedBulletCount(magCounts: MinMax, magTemplate: ITemplateItem): number;
/**
* Get a randomised count of magazines
* @param magCounts min and max value returned value can be between
* @returns numberical value of magazine count
*/
protected getRandomisedMagazineCount(magCounts: MinMax): number;
/**
* Add ammo to the secure container
* @param stackCount How many stacks of ammo to add
* @param ammoTpl Ammo type to add
* @param stackSize Size of the ammo stack to add
* @param inventory Player inventory
*/
protected addAmmoToSecureContainer(stackCount: number, ammoTpl: string, stackSize: number, inventory: PmcInventory): void;
/**
* Get a weapons magazine tpl from a weapon template
* @param weaponMods mods from a weapon template
* @param weaponTemplate Weapon to get magazine tpl for
* @param botRole the bot type we are getting the magazine for
* @returns magazine tpl string
*/
protected getMagazineTplFromWeaponTemplate(weaponMods: Item[], weaponTemplate: ITemplateItem, botRole: string): string;
/**
* Get a weapons default magazine template id
* @param weaponTemplate weapon to get default magazine for
* @returns tpl of magazine
*/
protected getWeaponsDefaultMagazineTpl(weaponTemplate: ITemplateItem): string;
protected addBulletsToVestAndPockets(ammoTpl: string, bulletCount: number, inventory: PmcInventory): void;
/**
* Finds and return a compatible ammo tpl based on the bots ammo weightings (x.json/inventory/equipment/ammo)
* @param ammo a list of ammo tpls the weapon can use
* @param weaponTemplate the weapon we want to pick ammo for
* @param isPmc is the ammo being gathered for a pmc (runs pmc ammo filtering)
* @returns an ammo tpl that works with the desired gun
*/
protected getCompatibleAmmo(ammo: Record<string, Record<string, number>>, weaponTemplate: ITemplateItem, isPmc: boolean): string;
/**
* Get a weapons compatible cartridge caliber
* @param weaponTemplate Weapon to look up caliber of
* @returns caliber as string
*/
protected getWeaponCaliber(weaponTemplate: ITemplateItem): string;
/**
* Fill existing magazines to full, while replacing their contents with specified ammo
* @param weaponMods
* @param magazine
* @param ammoTpl
*/
protected fillExistingMagazines(weaponMods: Item[], magazine: Item, ammoTpl: string): void;
/**
* Add cartridge item to weapon Item array, if it already exists, update
* @param weaponMods Weapon items array to amend
* @param magazine magazine item details we're adding cartridges to
* @param chosenAmmo cartridge to put into the magazine
* @param newStackSize how many cartridges should go into the magazine
*/
protected addOrUpdateMagazinesChildWithAmmo(weaponMods: Item[], magazine: Item, chosenAmmo: string, newStackSize: number): void;
/**
* Fill each Camora with a bullet
* @param weaponMods Weapon mods to find and update camora mod(s) from
* @param magazineId magazine id to find and add to
* @param ammoTpl ammo template id to hydate with
*/
protected fillCamorasWithAmmo(weaponMods: Item[], magazineId: string, ammoTpl: string): void;
}

View File

@ -0,0 +1,67 @@
import { BotHelper } from "../helpers/BotHelper";
import { ProfileHelper } from "../helpers/ProfileHelper";
import { IPmcData } from "../models/eft/common/IPmcData";
import { Skills, Stats } from "../models/eft/common/tables/IBotBase";
import { IBotType } from "../models/eft/common/tables/IBotType";
import { IPlayerScavConfig, KarmaLevel } from "../models/spt/config/IPlayerScavConfig";
import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer";
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 { BotGenerator } from "./BotGenerator";
export declare class PlayerScavGenerator {
protected logger: ILogger;
protected databaseServer: DatabaseServer;
protected saveServer: SaveServer;
protected profileHelper: ProfileHelper;
protected botHelper: BotHelper;
protected jsonUtil: JsonUtil;
protected fenceService: FenceService;
protected botLootCacheService: BotLootCacheService;
protected botGenerator: BotGenerator;
protected configServer: ConfigServer;
protected playerScavConfig: IPlayerScavConfig;
constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, botHelper: BotHelper, jsonUtil: JsonUtil, fenceService: FenceService, botLootCacheService: BotLootCacheService, botGenerator: BotGenerator, configServer: ConfigServer);
/**
* Update a player profile to include a new player scav profile
* @param sessionID session id to specify what profile is updated
* @returns profile object
*/
generate(sessionID: string): IPmcData;
/**
* Get the scav karama level for a profile
* Is also the fence trader rep level
* @param pmcData pmc profile
* @returns karma level
*/
protected getScavKarmaLevel(pmcData: IPmcData): number;
/**
* Get a baseBot template
* If the parameter doesnt match "assault", take parts from the loot type and apply to the return bot template
* @param botTypeForLoot bot type to use for inventory/chances
* @returns IBotType object
*/
protected constructBotBaseTemplate(botTypeForLoot: string): IBotType;
/**
* Adjust equipment/mod/item generation values based on scav karma levels
* @param karmaSettings Values to modify the bot template with
* @param baseBotNode bot template to modify according to karama level settings
*/
protected adjustBotTemplateWithKarmaSpecificSettings(karmaSettings: KarmaLevel, baseBotNode: IBotType): void;
protected getScavSkills(scavProfile: IPmcData): Skills;
protected getDefaultScavSkills(): Skills;
protected getScavStats(scavProfile: IPmcData): Stats;
protected getScavLevel(scavProfile: IPmcData): number;
protected getScavExperience(scavProfile: IPmcData): number;
/**
* Set cooldown till pscav is playable
* take into account scav cooldown bonus
* @param scavData scav profile
* @param pmcData pmc profile
* @returns
*/
protected setScavCooldownTimer(scavData: IPmcData, pmcData: IPmcData): IPmcData;
}

View File

@ -0,0 +1,105 @@
import { ItemHelper } from "../helpers/ItemHelper";
import { Product } from "../models/eft/common/tables/IBotBase";
import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem";
import { IHideoutScavCase } from "../models/eft/hideout/IHideoutScavCase";
import { IHideoutScavCaseStartRequestData } from "../models/eft/hideout/IHideoutScavCaseStartRequestData";
import { IScavCaseConfig } from "../models/spt/config/IScavCaseConfig";
import { RewardCountAndPriceDetails, ScavCaseRewardCountsAndPrices } from "../models/spt/hideout/ScavCaseRewardCountsAndPrices";
import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer";
import { RagfairPriceService } from "../services/RagfairPriceService";
import { HashUtil } from "../utils/HashUtil";
import { RandomUtil } from "../utils/RandomUtil";
export declare class ScavCaseRewardGenerator {
protected logger: ILogger;
protected randomUtil: RandomUtil;
protected hashUtil: HashUtil;
protected itemHelper: ItemHelper;
protected databaseServer: DatabaseServer;
protected ragfairPriceService: RagfairPriceService;
protected configServer: ConfigServer;
protected scavCaseConfig: IScavCaseConfig;
constructor(logger: ILogger, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, configServer: ConfigServer);
/**
* Create an array of rewards that will be given to the player upon completing their scav case build
* @param body client request
* @returns Product array
*/
generate(body: IHideoutScavCaseStartRequestData): Product[];
/**
* Get all db items that are not blacklisted in scavcase config
* @returns filtered array of db items
*/
protected getDbItems(): ITemplateItem[];
/**
* Check if a template id has a blacklisted parent id
* @param tplid template id to check
* @returns true if item is blacklisted
*/
protected itemHasBlacklistedParent(tplid: string): boolean;
/**
* Pick a number of items to be rewards, the count is defined by the values in
* @param items item pool to pick rewards from
* @param itemFilters how the rewards should be filtered down (by item count)
* @returns
*/
protected pickRandomRewards(items: ITemplateItem[], itemFilters: RewardCountAndPriceDetails, rarity: string): ITemplateItem[];
/**
* Choose if money should be a reward based on the moneyRewardChancePercent config chance in scavCaseConfig
* @returns true if reward should be money
*/
protected rewardShouldBeMoney(): boolean;
/**
* Choose if ammo should be a reward based on the ammoRewardChancePercent config chance in scavCaseConfig
* @returns true if reward should be ammo
*/
protected rewardShouldBeAmmo(): boolean;
/**
* Choose from rouble/dollar/euro at random
*/
protected getRandomMoney(): ITemplateItem;
/**
* Get a random ammo from items.json that is not in the ammo blacklist AND inside the price rage defined in scavcase.json config
* @param rarity The rarity this ammo reward is for
* @returns random ammo item from items.json
*/
protected getRandomAmmo(rarity: string): ITemplateItem;
/**
* Take all the rewards picked create the Product object array ready to return to calling code
* Also add a stack count to ammo and money
* @param rewardItems items to convert
* @returns Product array
*/
protected randomiseContainerItemRewards(rewardItems: ITemplateItem[], rarity: string): Product[];
/**
* Add a randomised stack count to ammo or money items
* @param item money or ammo item
* @param resultItem money or ammo item with a randomise stack size
*/
protected addStackCountToAmmoAndMoney(item: ITemplateItem, resultItem: {
_id: string;
_tpl: string;
upd: any;
}, rarity: string): void;
/**
*
* @param dbItems all items from the items.json
* @param itemFilters controls how the dbItems will be filtered and returned (handbook price)
* @returns filtered dbItems array
*/
protected getFilteredItemsByPrice(dbItems: ITemplateItem[], itemFilters: RewardCountAndPriceDetails): ITemplateItem[];
/**
* Gathers the reward options from config and scavcase.json into a single object
* @param scavCaseDetails scavcase.json values
* @returns ScavCaseRewardCountsAndPrices object
*/
protected getScavCaseRewardCountsAndPrices(scavCaseDetails: IHideoutScavCase): ScavCaseRewardCountsAndPrices;
/**
* Randomises the size of ammo and money stacks
* @param itemToCalculate ammo or money item
* @param rarity rarity (common/rare/superrare)
* @returns value to set stack count to
*/
protected getRandomAmountRewardForScavCase(itemToCalculate: ITemplateItem, rarity: string): number;
}

View File

@ -1,5 +1,5 @@
import { DurabilityLimitsHelper } from "../helpers/DurabilityLimitsHelper";
import { Inventory as PmcInventory } from "../models/eft/common/IPmcData";
import { Inventory as PmcInventory } from "../models/eft/common/tables/IBotBase";
import { Mods, ModsChances } from "../models/eft/common/tables/IBotType";
import { Item, Repairable, Upd } from "../models/eft/common/tables/IItem";
import { Grid, ITemplateItem, Slot } from "../models/eft/common/tables/ITemplateItem";
@ -28,20 +28,13 @@ export declare class BotGeneratorHelper {
protected configServer: ConfigServer;
protected botConfig: IBotConfig;
constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, configServer: ConfigServer);
generateModsForItem(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances, isPmc?: boolean): Item[];
generateModsForItem(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances): Item[];
/**
* Is this magazine cylinder related (revolvers and grenade launchers)
* @param magazineParentName the name of the magazines parent
* @returns true if it is cylinder related
*/
magazineIsCylinderRelated(magazineParentName: string): boolean;
/**
* Get a list of non black-listed cartridges from the PMC bot config
* @param modSlot mod item slot
* @param itemModPool
* @returns string array of cartridges PMCs can use
*/
protected getNonBlacklistedCartridges(modSlot: string, itemModPool: Record<string, string[]>): string[];
/**
* randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot
* never return true for an item that has 0% spawn chance
@ -53,6 +46,7 @@ export declare class BotGeneratorHelper {
protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances): boolean;
/**
* Get a list of containers that hold ammo
* e.g. mod_magazine
* @returns string array
*/
protected getAmmoContainers(): string[];

View File

@ -1,4 +1,4 @@
import { Difficulty } from "../models/eft/common/tables/IBotType";
import { Difficulty, IBotType } from "../models/eft/common/tables/IBotType";
import { IBotConfig } from "../models/spt/config/IBotConfig";
import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer";
@ -14,6 +14,7 @@ export declare class BotHelper {
protected botConfig: IBotConfig;
constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, configServer: ConfigServer);
getBotDifficultySettings(type: string, difficulty: string): Difficulty;
getBotTemplate(role: string): IBotType;
getPmcDifficultySettings(type: string, difficulty: string): Difficulty;
/**
* Randomise the chance the PMC will attack their own side

View File

@ -1,3 +1,4 @@
import { Item } from "../models/eft/common/tables/IItem";
import { Dialogue, MessageContent, MessagePreview } from "../models/eft/profile/IAkiProfile";
import { MessageType } from "../models/enums/MessageType";
import { DatabaseServer } from "../servers/DatabaseServer";
@ -15,7 +16,25 @@ export declare class DialogueHelper {
protected itemHelper: ItemHelper;
constructor(hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, notificationSendHelper: NotificationSendHelper, itemHelper: ItemHelper);
createMessageContext(templateId: string, messageType: MessageType, maxStoreTime: number): MessageContent;
/**
* Add a templated message to the dialogue.
* @param dialogueID
* @param messageContent
* @param sessionID
* @param rewards
*/
addDialogueMessage(dialogueID: string, messageContent: MessageContent, sessionID: string, rewards?: any[]): void;
/**
* Get the preview contents of the last message in a dialogue.
* @param dialogue
* @returns
*/
getMessagePreview(dialogue: Dialogue): MessagePreview;
getMessageItemContents(messageID: string, sessionID: string): any[];
/**
* Get the item contents for a particular message.
* @param messageID
* @param sessionID
* @returns
*/
getMessageItemContents(messageID: string, sessionID: string): Item[];
}

View File

@ -2,7 +2,7 @@ import { DatabaseServer } from "../servers/DatabaseServer";
export declare class GameEventHelper {
protected databaseServer: DatabaseServer;
constructor(databaseServer: DatabaseServer);
get EVENT(): Record<string, string>;
get events(): Record<string, string>;
get christmasEventItems(): string[];
itemIsChristmasRelated(itemId: string): boolean;
christmasEventEnabled(): boolean;

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