Compare commits

..

6 Commits
1.3.0 ... main

11 changed files with 928 additions and 72 deletions

View File

@ -1,10 +1,10 @@
{ {
"name": "Valens-Progression", "name": "Valens-Progression",
"version": "1.3.0", "version": "1.3.3",
"main": "src/mod.js", "main": "src/mod.js",
"license": "CC BY-NC-ND 4.0", "license": "CC BY-NC-ND 4.0",
"author": "Valens", "author": "Valens",
"akiVersion": ">=3.4.*", "akiVersion": ">=3.5.*",
"scripts": { "scripts": {
"setup:environment": "npm i", "setup:environment": "npm i",
"build:unzipped": "copyfiles -e \"./node_modules/**/*.*\" -e \"./dist/**/*.*\" -e \"./package-lock.json\" -e \"./tsconfig.json\" -e \"./README.txt\" -e \"./mod.code-workspace\" \"./**/*.*\" ./dist", "build:unzipped": "copyfiles -e \"./node_modules/**/*.*\" -e \"./dist/**/*.*\" -e \"./package-lock.json\" -e \"./tsconfig.json\" -e \"./README.txt\" -e \"./mod.code-workspace\" \"./**/*.*\" ./dist",

View File

@ -1,16 +1,18 @@
import { DependencyContainer } from "tsyringe";
import { IPostDBLoadMod } from "@spt-aki/models/external/IPostDBLoadMod";
import { DatabaseServer } from "@spt-aki/servers/DatabaseServer";
import { ConfigServer } from "@spt-aki/servers/ConfigServer";
import { ConfigTypes } from "@spt-aki/models/enums/ConfigTypes"; import { ConfigTypes } from "@spt-aki/models/enums/ConfigTypes";
import { IPostDBLoadMod } from "@spt-aki/models/external/IPostDBLoadMod";
import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig";
import { ConfigServer } from "@spt-aki/servers/ConfigServer";
import { DatabaseServer } from "@spt-aki/servers/DatabaseServer";
import { DependencyContainer } from "tsyringe";
//import { Scavs } from "./scavs"; //import { Scavs } from "./scavs";
import { ILocationConfig } from "@spt-aki/models/spt/config/ILocationConfig";
import { PMCs } from "./pmc"; import { PMCs } from "./pmc";
class ValensProgression implements IPostDBLoadMod class ValensProgression implements IPostDBLoadMod
{ {
private configServer: ConfigServer; private configServer: ConfigServer;
private locationConfig: ILocationConfig
private botConfig: IBotConfig; private botConfig: IBotConfig;
private databaseServer: DatabaseServer; private databaseServer: DatabaseServer;
// private scavs: Scavs; // private scavs: Scavs;
@ -20,6 +22,7 @@ class ValensProgression implements IPostDBLoadMod
{ {
// get database from server // get database from server
this.configServer = container.resolve<ConfigServer>("ConfigServer"); this.configServer = container.resolve<ConfigServer>("ConfigServer");
this.locationConfig = this.configServer.getConfig<ILocationConfig>(ConfigTypes.LOCATION);
this.botConfig = this.configServer.getConfig<IBotConfig>(ConfigTypes.BOT); this.botConfig = this.configServer.getConfig<IBotConfig>(ConfigTypes.BOT);
this.databaseServer = container.resolve<DatabaseServer>("DatabaseServer"); this.databaseServer = container.resolve<DatabaseServer>("DatabaseServer");
@ -27,7 +30,7 @@ class ValensProgression implements IPostDBLoadMod
// this.scavs = new Scavs(this.botConfig, this.databaseServer); // this.scavs = new Scavs(this.botConfig, this.databaseServer);
// this.scavs.updateScavs(); // this.scavs.updateScavs();
this.pmcs = new PMCs(this.botConfig, this.databaseServer); this.pmcs = new PMCs(this.locationConfig, this.botConfig, this.databaseServer);
this.pmcs.updatePmcs(); this.pmcs.updatePmcs();
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -42,6 +42,13 @@ export declare class TraderController {
* @returns array if ITraderBase objects * @returns array if ITraderBase objects
*/ */
getAllTraders(sessionID: string): ITraderBase[]; getAllTraders(sessionID: string): ITraderBase[];
/**
* Order traders by their traderId (Ttid)
* @param traderA First trader to compare
* @param traderB Second trader to compare
* @returns 1,-1 or 0
*/
protected sortByTraderId(traderA: ITraderBase, traderB: ITraderBase): number;
getTrader(sessionID: string, traderID: string): ITraderBase; getTrader(sessionID: string, traderID: string): ITraderBase;
getAssort(sessionId: string, traderId: string): ITraderAssort; getAssort(sessionId: string, traderId: string): ITraderAssort;
getPurchasesData(sessionID: string, traderID: string): Record<string, IBarterScheme[][]>; getPurchasesData(sessionID: string, traderID: string): Record<string, IBarterScheme[][]>;

View File

@ -14,12 +14,14 @@ import { SeasonalEventService } from "../services/SeasonalEventService";
import { HashUtil } from "../utils/HashUtil"; import { HashUtil } from "../utils/HashUtil";
import { JsonUtil } from "../utils/JsonUtil"; import { JsonUtil } from "../utils/JsonUtil";
import { RandomUtil } from "../utils/RandomUtil"; import { RandomUtil } from "../utils/RandomUtil";
import { TimeUtil } from "../utils/TimeUtil";
import { BotInventoryGenerator } from "./BotInventoryGenerator"; import { BotInventoryGenerator } from "./BotInventoryGenerator";
import { BotLevelGenerator } from "./BotLevelGenerator"; import { BotLevelGenerator } from "./BotLevelGenerator";
export declare class BotGenerator { export declare class BotGenerator {
protected logger: ILogger; protected logger: ILogger;
protected hashUtil: HashUtil; protected hashUtil: HashUtil;
protected randomUtil: RandomUtil; protected randomUtil: RandomUtil;
protected timeUtil: TimeUtil;
protected jsonUtil: JsonUtil; protected jsonUtil: JsonUtil;
protected profileHelper: ProfileHelper; protected profileHelper: ProfileHelper;
protected databaseServer: DatabaseServer; protected databaseServer: DatabaseServer;
@ -32,7 +34,7 @@ export declare class BotGenerator {
protected seasonalEventService: SeasonalEventService; protected seasonalEventService: SeasonalEventService;
protected configServer: ConfigServer; protected configServer: ConfigServer;
protected botConfig: IBotConfig; protected botConfig: IBotConfig;
constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botLevelGenerator: BotLevelGenerator, botEquipmentFilterService: BotEquipmentFilterService, weightedRandomHelper: WeightedRandomHelper, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, seasonalEventService: SeasonalEventService, configServer: ConfigServer); constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, timeUtil: TimeUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botLevelGenerator: BotLevelGenerator, botEquipmentFilterService: BotEquipmentFilterService, weightedRandomHelper: WeightedRandomHelper, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, seasonalEventService: SeasonalEventService, configServer: ConfigServer);
/** /**
* Generate a player scav bot object * Generate a player scav bot object
* @param role e.g. assault / pmcbot * @param role e.g. assault / pmcbot

View File

@ -1,4 +1,5 @@
import { ItemHelper } from "../helpers/ItemHelper"; import { ItemHelper } from "../helpers/ItemHelper";
import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem";
import { IBotConfig } from "../models/spt/config/IBotConfig"; import { IBotConfig } from "../models/spt/config/IBotConfig";
import { ConfigServer } from "../servers/ConfigServer"; import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer"; import { DatabaseServer } from "../servers/DatabaseServer";
@ -15,6 +16,7 @@ export declare class PMCLootGenerator {
protected itemFilterService: ItemFilterService; protected itemFilterService: ItemFilterService;
protected seasonalEventService: SeasonalEventService; protected seasonalEventService: SeasonalEventService;
protected pocketLootPool: string[]; protected pocketLootPool: string[];
protected vestLootPool: string[];
protected backpackLootPool: string[]; protected backpackLootPool: string[];
protected botConfig: IBotConfig; protected botConfig: IBotConfig;
constructor(itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService); constructor(itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService);
@ -23,6 +25,18 @@ export declare class PMCLootGenerator {
* @returns string array of tpls * @returns string array of tpls
*/ */
generatePMCPocketLootPool(): string[]; generatePMCPocketLootPool(): string[];
/**
* Create an array of loot items a PMC can have in their vests
* @returns string array of tpls
*/
generatePMCVestLootPool(): string[];
/**
* Check if item has a width/hide that lets it fit into a 1x2 slot
* 1x1 / 1x2 / 2x1
* @param item Item to check size of
* @returns true if it fits
*/
protected itemFitsInto1By2Slot(item: ITemplateItem): boolean;
/** /**
* Create an array of loot items a PMC can have in their backpack * Create an array of loot items a PMC can have in their backpack
* @returns string array of tpls * @returns string array of tpls

View File

@ -1,5 +1,6 @@
import { IPmcData } from "../models/eft/common/IPmcData"; import { IPmcData } from "../models/eft/common/IPmcData";
import { ITraderAssort } from "../models/eft/common/tables/ITrader"; import { ITraderAssort } from "../models/eft/common/tables/ITrader";
import { QuestStatus } from "../models/enums/QuestStatus";
import { ILogger } from "../models/spt/utils/ILogger"; import { ILogger } from "../models/spt/utils/ILogger";
import { DatabaseServer } from "../servers/DatabaseServer"; import { DatabaseServer } from "../servers/DatabaseServer";
import { LocalisationService } from "../services/LocalisationService"; import { LocalisationService } from "../services/LocalisationService";
@ -15,12 +16,22 @@ export declare class AssortHelper {
/** /**
* Remove assorts from a trader that have not been unlocked yet * Remove assorts from a trader that have not been unlocked yet
* @param pmcProfile player profile * @param pmcProfile player profile
* @param traderId traders id * @param traderId traders id the assort belongs to
* @param assort assort items from a trader * @param traderAssorts All assort items from same trader
* @param mergedQuestAssorts An object of quest assort to quest id unlocks for all traders * @param mergedQuestAssorts Dict of quest assort to quest id unlocks for all traders
* @returns assort items minus locked quest assorts * @returns assort items minus locked quest assorts
*/ */
stripLockedQuestAssort(pmcProfile: IPmcData, traderId: string, assort: ITraderAssort, mergedQuestAssorts: Record<string, Record<string, string>>, flea?: boolean): ITraderAssort; stripLockedQuestAssort(pmcProfile: IPmcData, traderId: string, traderAssorts: ITraderAssort, mergedQuestAssorts: Record<string, Record<string, string>>, flea?: boolean): ITraderAssort;
/**
* Get a quest id + the statuses quest can be in to unlock assort
* @param mergedQuestAssorts quest assorts to search for assort id
* @param assortId Assort to look for linked quest id
* @returns quest id + array of quest status the assort should show for
*/
protected getQuestIdAndStatusThatShowAssort(mergedQuestAssorts: Record<string, Record<string, string>>, assortId: string): {
questId: string;
status: QuestStatus[];
};
/** /**
* Remove assorts from a trader that have not been unlocked yet * Remove assorts from a trader that have not been unlocked yet
* @param pmcProfile player profile * @param pmcProfile player profile

View File

@ -40,7 +40,7 @@ export declare class QuestHelper {
protected questConfig: IQuestConfig; protected questConfig: IQuestConfig;
constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, configServer: ConfigServer); constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, configServer: ConfigServer);
/** /**
* Get status of a quest by quest id * Get status of a quest in player profile by its id
* @param pmcData Profile to search * @param pmcData Profile to search
* @param questID Quest id to look up * @param questID Quest id to look up
* @returns QuestStatus enum * @returns QuestStatus enum

View File

@ -47,7 +47,22 @@ export declare class RagfairOfferHelper {
protected questConfig: IQuestConfig; protected questConfig: IQuestConfig;
constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, configServer: ConfigServer); constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, configServer: ConfigServer);
getValidOffers(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record<string, ITraderAssort>, pmcProfile: IPmcData): IRagfairOffer[]; getValidOffers(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record<string, ITraderAssort>, pmcProfile: IPmcData): IRagfairOffer[];
getOffersForBuild(info: ISearchRequestData, itemsToAdd: string[], assorts: Record<string, ITraderAssort>, pmcProfile: IPmcData): IRagfairOffer[]; /**
* Get offers from flea/traders specifically when building weapon preset
* @param searchRequest Search request data
* @param itemsToAdd string array of item tpls to search for
* @param traderAssorts All trader assorts player can access/buy
* @param pmcProfile Player profile
* @returns ITraderAssort
*/
getOffersForBuild(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record<string, ITraderAssort>, pmcProfile: IPmcData): IRagfairOffer[];
/**
* Check if offer item is quest locked for current player by looking at sptQuestLocked property in traders barter_scheme
* @param offer Offer to check is quest locked
* @param traderAssorts all trader assorts for player
* @returns true if quest locked
*/
traderOfferItemQuestLocked(offer: IRagfairOffer, traderAssorts: Record<string, ITraderAssort>): boolean;
/** /**
* Has a traders offer ran out of stock to sell to player * Has a traders offer ran out of stock to sell to player
* @param offer Offer to check stock of * @param offer Offer to check stock of

View File

@ -1,5 +1,8 @@
import { MinMax } from "../../common/MinMax"; import { MinMax } from "../../common/MinMax";
export interface IPmcConfig { export interface IPmcConfig {
vestLoot: SlotLootSettings;
pocketLoot: SlotLootSettings;
backpackLoot: SlotLootSettings;
dynamicLoot: DynamicLoot; dynamicLoot: DynamicLoot;
useDifficultyOverride: boolean; useDifficultyOverride: boolean;
difficulty: string; difficulty: string;
@ -22,8 +25,11 @@ export interface PmcTypes {
usec: string; usec: string;
bear: string; bear: string;
} }
export interface DynamicLoot { export interface SlotLootSettings {
whitelist: string[]; whitelist: string[];
blacklist: string[]; blacklist: string[];
moneyStackLimits: Record<string, number>; moneyStackLimits: Record<string, number>;
} }
export interface DynamicLoot {
moneyStackLimits: Record<string, number>;
}

View File

@ -30,6 +30,8 @@ export interface Reputation {
} }
export interface Dynamic { export interface Dynamic {
purchasesAreFoundInRaid: boolean; purchasesAreFoundInRaid: boolean;
/** Use the highest trader price for an offer if its greater than the price in templates/prices.json */
useTraderPriceForOffersIfHigher: boolean;
barter: Barter; barter: Barter;
offerAdjustment: OfferAdjustment; offerAdjustment: OfferAdjustment;
expiredOfferThreshold: number; expiredOfferThreshold: number;