diff --git a/TypeScript/10ScopesAndTypes/types/callbacks/GameCallbacks.d.ts b/TypeScript/10ScopesAndTypes/types/callbacks/GameCallbacks.d.ts index aa80036..46f79f9 100644 --- a/TypeScript/10ScopesAndTypes/types/callbacks/GameCallbacks.d.ts +++ b/TypeScript/10ScopesAndTypes/types/callbacks/GameCallbacks.d.ts @@ -1,4 +1,5 @@ import { GameController } from "../controllers/GameController"; +import { OnLoad } from "../di/OnLoad"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { ICheckVersionResponse } from "../models/eft/game/ICheckVersionResponse"; import { ICurrentGroupResponse } from "../models/eft/game/ICurrentGroupResponse"; @@ -15,12 +16,14 @@ import { INullResponseData } from "../models/eft/httpResponse/INullResponseData" import { SaveServer } from "../servers/SaveServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { Watermark } from "../utils/Watermark"; -declare class GameCallbacks { +declare class GameCallbacks implements OnLoad { protected httpResponse: HttpResponseUtil; protected watermark: Watermark; protected saveServer: SaveServer; protected gameController: GameController; constructor(httpResponse: HttpResponseUtil, watermark: Watermark, saveServer: SaveServer, gameController: GameController); + onLoad(): Promise; + getRoute(): string; /** * Handle client/game/version/validate * @returns INullResponseData diff --git a/TypeScript/10ScopesAndTypes/types/controllers/GameController.d.ts b/TypeScript/10ScopesAndTypes/types/controllers/GameController.d.ts index 04e3abb..e88610e 100644 --- a/TypeScript/10ScopesAndTypes/types/controllers/GameController.d.ts +++ b/TypeScript/10ScopesAndTypes/types/controllers/GameController.d.ts @@ -61,13 +61,14 @@ export declare class GameController { protected pmcConfig: IPmcConfig; protected lootConfig: ILootConfig; constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, randomUtil: RandomUtil, encodingUtil: EncodingUtil, hideoutHelper: HideoutHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, seasonalEventService: SeasonalEventService, itemBaseClassService: ItemBaseClassService, giftService: GiftService, applicationContext: ApplicationContext, configServer: ConfigServer); + load(): void; /** * Handle client/game/start */ gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; protected addCustomLooseLootPositions(): void; protected adjustLooseLootSpawnProbabilities(): void; - protected setHideoutAreasAndCraftsTo30Secs(): void; + protected setHideoutAreasAndCraftsTo40Secs(): void; /** * 3.7.0 moved AIDs to be numeric, old profiles need to be migrated * We store the old AID value in new field `sessionId` diff --git a/TypeScript/10ScopesAndTypes/types/controllers/HealthController.d.ts b/TypeScript/10ScopesAndTypes/types/controllers/HealthController.d.ts index 1938297..2d7ff09 100644 --- a/TypeScript/10ScopesAndTypes/types/controllers/HealthController.d.ts +++ b/TypeScript/10ScopesAndTypes/types/controllers/HealthController.d.ts @@ -29,34 +29,35 @@ export declare class HealthController { * stores in-raid player health * @param pmcData Player profile * @param info Request data - * @param sessionID + * @param sessionID Player id * @param addEffects Should effects found be added or removed from profile + * @param deleteExistingEffects Should all prior effects be removed before apply new ones */ saveVitality(pmcData: IPmcData, info: ISyncHealthRequestData, sessionID: string, addEffects?: boolean, deleteExistingEffects?: boolean): void; /** * When healing in menu - * @param pmcData - * @param body - * @param sessionID - * @returns + * @param pmcData Player profile + * @param request Healing request + * @param sessionID Player id + * @returns IItemEventRouterResponse */ - offraidHeal(pmcData: IPmcData, body: IOffraidHealRequestData, sessionID: string): IItemEventRouterResponse; + offraidHeal(pmcData: IPmcData, request: IOffraidHealRequestData, sessionID: string): IItemEventRouterResponse; /** * Handle Eat event * Consume food/water outside of a raid * @param pmcData Player profile - * @param body request Object + * @param request Eat request * @param sessionID Session id * @returns IItemEventRouterResponse */ - offraidEat(pmcData: IPmcData, body: IOffraidEatRequestData, sessionID: string): IItemEventRouterResponse; + offraidEat(pmcData: IPmcData, request: IOffraidEatRequestData, sessionID: string): IItemEventRouterResponse; /** * Handle RestoreHealth event * Occurs on post-raid healing page * @param pmcData player profile * @param healthTreatmentRequest Request data from client * @param sessionID Session id - * @returns + * @returns IItemEventRouterResponse */ healthTreatment(pmcData: IPmcData, healthTreatmentRequest: IHealthTreatmentRequestData, sessionID: string): IItemEventRouterResponse; /** @@ -66,12 +67,4 @@ export declare class HealthController { * @param sessionID */ applyWorkoutChanges(pmcData: IPmcData, info: IWorkoutData, sessionId: string): void; - /** - * Iterate over treatment request diff and find effects to remove from player limbs - * @param sessionId - * @param profile Profile to update - * @param treatmentRequest client request - * @param output response to send to client - */ - protected removeEffectsAfterPostRaidHeal(sessionId: string, profile: IPmcData, treatmentRequest: IHealthTreatmentRequestData, output: IItemEventRouterResponse): void; } diff --git a/TypeScript/10ScopesAndTypes/types/controllers/HideoutController.d.ts b/TypeScript/10ScopesAndTypes/types/controllers/HideoutController.d.ts index 877c076..a90a16d 100644 --- a/TypeScript/10ScopesAndTypes/types/controllers/HideoutController.d.ts +++ b/TypeScript/10ScopesAndTypes/types/controllers/HideoutController.d.ts @@ -88,11 +88,11 @@ export declare class HideoutController { * @param pmcData Profile to edit * @param output Object to send back to client * @param sessionID Session/player id - * @param profileHideoutArea Current hideout data for profile + * @param profileParentHideoutArea Current hideout area for profile * @param dbHideoutArea Hideout area being upgraded * @param hideoutStage Stage hideout area is being upgraded to */ - protected addContainerImprovementToProfile(output: IItemEventRouterResponse, sessionID: string, pmcData: IPmcData, profileHideoutArea: HideoutArea, dbHideoutArea: IHideoutArea, hideoutStage: Stage): void; + protected addContainerImprovementToProfile(output: IItemEventRouterResponse, sessionID: string, pmcData: IPmcData, profileParentHideoutArea: HideoutArea, dbHideoutArea: IHideoutArea, hideoutStage: Stage): void; /** * Add an inventory item to profile from a hideout area stage data * @param pmcData Profile to update diff --git a/TypeScript/10ScopesAndTypes/types/controllers/LocationController.d.ts b/TypeScript/10ScopesAndTypes/types/controllers/LocationController.d.ts index 94d496a..94f5fce 100644 --- a/TypeScript/10ScopesAndTypes/types/controllers/LocationController.d.ts +++ b/TypeScript/10ScopesAndTypes/types/controllers/LocationController.d.ts @@ -4,6 +4,7 @@ import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { ILocationBase } from "../models/eft/common/ILocationBase"; import { ILocationsGenerateAllResponse } from "../models/eft/common/ILocationsSourceDestinationBase"; import { IAirdropLootResult } from "../models/eft/location/IAirdropLootResult"; +import { IGetLocationRequestData } from "../models/eft/location/IGetLocationRequestData"; import { AirdropTypeEnum } from "../models/enums/AirdropType"; import { IAirdropConfig } from "../models/spt/config/IAirdropConfig"; import { ILocationConfig } from "../models/spt/config/ILocationConfig"; @@ -34,10 +35,11 @@ export declare class LocationController { /** * Handle client/location/getLocalloot * Get a location (map) with generated loot data - * @param location Map to generate loot for + * @param sessionId Player id + * @param request Map request to generate * @returns ILocationBase */ - get(location: string): ILocationBase; + get(sessionId: string, request: IGetLocationRequestData): ILocationBase; /** * Generate a maps base location with loot * @param name Map name diff --git a/TypeScript/10ScopesAndTypes/types/controllers/QuestController.d.ts b/TypeScript/10ScopesAndTypes/types/controllers/QuestController.d.ts index 7d494a6..bd8a70f 100644 --- a/TypeScript/10ScopesAndTypes/types/controllers/QuestController.d.ts +++ b/TypeScript/10ScopesAndTypes/types/controllers/QuestController.d.ts @@ -61,7 +61,7 @@ export declare class QuestController { * @param playerLevel level of player to test against quest * @returns true if quest can be seen/accepted by player of defined level */ - protected playerLevelFulfillsQuestRequrement(quest: IQuest, playerLevel: number): boolean; + protected playerLevelFulfillsQuestRequirement(quest: IQuest, playerLevel: number): boolean; /** * Should a quest be shown to the player in trader quest screen * @param questId Quest to check diff --git a/TypeScript/10ScopesAndTypes/types/controllers/RagfairController.d.ts b/TypeScript/10ScopesAndTypes/types/controllers/RagfairController.d.ts index 76c27f7..bda37cd 100644 --- a/TypeScript/10ScopesAndTypes/types/controllers/RagfairController.d.ts +++ b/TypeScript/10ScopesAndTypes/types/controllers/RagfairController.d.ts @@ -21,6 +21,7 @@ import { IGetMarketPriceRequestData } from "../models/eft/ragfair/IGetMarketPric import { IGetOffersResult } from "../models/eft/ragfair/IGetOffersResult"; import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; import { ISearchRequestData } from "../models/eft/ragfair/ISearchRequestData"; +import { IProcessBuyTradeRequestData } from "../models/eft/trade/IProcessBuyTradeRequestData"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; @@ -125,6 +126,18 @@ export declare class RagfairController { * @returns IItemEventRouterResponse */ addPlayerOffer(pmcData: IPmcData, offerRequest: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Charge player a listing fee for using flea, pulls charge from data previously sent by client + * @param sessionID Player id + * @param rootItem Base item being listed (used when client tax cost not found and must be done on server) + * @param pmcData Player profile + * @param requirementsPriceInRub Rouble cost player chose for listing (used when client tax cost not found and must be done on server) + * @param itemStackCount How many items were listed in player (used when client tax cost not found and must be done on server) + * @param offerRequest Add offer request object from client + * @param output IItemEventRouterResponse + * @returns True if charging tax to player failed + */ + protected chargePlayerTaxFee(sessionID: string, rootItem: Item, pmcData: IPmcData, requirementsPriceInRub: number, itemStackCount: number, offerRequest: IAddOfferRequestData, output: IItemEventRouterResponse): boolean; /** * Is the item to be listed on the flea valid * @param offerRequest Client offer request @@ -158,4 +171,11 @@ export declare class RagfairController { */ removeOffer(offerId: string, sessionID: string): IItemEventRouterResponse; extendOffer(info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Create a basic trader request object with price and currency type + * @param currency What currency: RUB, EURO, USD + * @param value Amount of currency + * @returns IProcessBuyTradeRequestData + */ + protected createBuyTradeRequestObject(currency: string, value: number): IProcessBuyTradeRequestData; } diff --git a/TypeScript/10ScopesAndTypes/types/generators/BotEquipmentModGenerator.d.ts b/TypeScript/10ScopesAndTypes/types/generators/BotEquipmentModGenerator.d.ts index ccbbbbf..f7abb84 100644 --- a/TypeScript/10ScopesAndTypes/types/generators/BotEquipmentModGenerator.d.ts +++ b/TypeScript/10ScopesAndTypes/types/generators/BotEquipmentModGenerator.d.ts @@ -14,7 +14,6 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; import { BotEquipmentModPoolService } from "../services/BotEquipmentModPoolService"; import { BotModLimits, BotWeaponModLimitService } from "../services/BotWeaponModLimitService"; -import { ItemBaseClassService } from "../services/ItemBaseClassService"; import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; @@ -29,7 +28,6 @@ export declare class BotEquipmentModGenerator { protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; protected botEquipmentFilterService: BotEquipmentFilterService; - protected itemBaseClassService: ItemBaseClassService; protected itemFilterService: ItemFilterService; protected profileHelper: ProfileHelper; protected botWeaponModLimitService: BotWeaponModLimitService; @@ -40,7 +38,7 @@ export declare class BotEquipmentModGenerator { protected botEquipmentModPoolService: BotEquipmentModPoolService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, itemHelper: ItemHelper, botEquipmentFilterService: BotEquipmentFilterService, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponModLimitService: BotWeaponModLimitService, botHelper: BotHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, botEquipmentModPoolService: BotEquipmentModPoolService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, itemHelper: ItemHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponModLimitService: BotWeaponModLimitService, botHelper: BotHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, botEquipmentModPoolService: BotEquipmentModPoolService, configServer: ConfigServer); /** * Check mods are compatible and add to array * @param equipment Equipment item to add mods to diff --git a/TypeScript/10ScopesAndTypes/types/generators/LocationGenerator.d.ts b/TypeScript/10ScopesAndTypes/types/generators/LocationGenerator.d.ts index b8169d3..46a514b 100644 --- a/TypeScript/10ScopesAndTypes/types/generators/LocationGenerator.d.ts +++ b/TypeScript/10ScopesAndTypes/types/generators/LocationGenerator.d.ts @@ -65,10 +65,11 @@ export declare class LocationGenerator { protected getGuaranteedContainers(staticContainersOnMap: IStaticContainerData[]): IStaticContainerData[]; /** * Choose a number of containers based on their probabilty value to fulfil the desired count in containerData.chosenCount + * @param groupId Name of the group the containers are being collected for * @param containerData Containers and probability values for a groupId * @returns List of chosen container Ids */ - protected getContainersByProbabilty(containerData: IContainerGroupCount): string[]; + protected getContainersByProbabilty(groupId: string, containerData: IContainerGroupCount): string[]; /** * Get a mapping of each groupid and the containers in that group + count of containers to spawn on map * @param containersGroups Container group values diff --git a/TypeScript/10ScopesAndTypes/types/generators/PMCLootGenerator.d.ts b/TypeScript/10ScopesAndTypes/types/generators/PMCLootGenerator.d.ts index 9acff69..abb5615 100644 --- a/TypeScript/10ScopesAndTypes/types/generators/PMCLootGenerator.d.ts +++ b/TypeScript/10ScopesAndTypes/types/generators/PMCLootGenerator.d.ts @@ -31,12 +31,12 @@ export declare class PMCLootGenerator { */ generatePMCVestLootPool(): string[]; /** - * Check if item has a width/height that lets it fit into a 1x2/2x1 slot - * 1x1 / 1x2 / 2x1 + * Check if item has a width/height that lets it fit into a 2x2 slot + * 1x1 / 1x2 / 2x1 / 2x2 * @param item Item to check size of * @returns true if it fits */ - protected itemFitsInto1By2Slot(item: ITemplateItem): boolean; + protected itemFitsInto2By2Slot(item: ITemplateItem): boolean; /** * Create an array of loot items a PMC can have in their backpack * @returns string array of tpls diff --git a/TypeScript/10ScopesAndTypes/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/10ScopesAndTypes/types/generators/RagfairOfferGenerator.d.ts index a627191..58e0b68 100644 --- a/TypeScript/10ScopesAndTypes/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/10ScopesAndTypes/types/generators/RagfairOfferGenerator.d.ts @@ -55,11 +55,10 @@ export declare class RagfairOfferGenerator { * @param items Items in the offer * @param barterScheme Cost of item (currency or barter) * @param loyalLevel Loyalty level needed to buy item - * @param price Price of offer - * @param sellInOnePiece Set StackObjectsCount to 1 + * @param sellInOnePiece Flags sellInOnePiece to be true * @returns IRagfairOffer */ - createFleaOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; + createFleaOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, sellInOnePiece?: boolean): IRagfairOffer; /** * Create an offer object ready to send to ragfairOfferService.addOffer() * @param userID Owner of the offer @@ -67,17 +66,16 @@ export declare class RagfairOfferGenerator { * @param items Items in the offer * @param barterScheme Cost of item (currency or barter) * @param loyalLevel Loyalty level needed to buy item - * @param price Price of offer * @param sellInOnePiece Set StackObjectsCount to 1 * @returns IRagfairOffer */ - protected createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; + protected createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, sellInOnePiece?: boolean): IRagfairOffer; /** * Calculate the offer price that's listed on the flea listing * @param offerRequirements barter requirements for offer * @returns rouble cost of offer */ - protected calculateOfferListingPrice(offerRequirements: OfferRequirement[]): number; + protected convertOfferRequirementsIntoRoubles(offerRequirements: OfferRequirement[]): number; /** * Get avatar url from trader table in db * @param isTrader Is user we're getting avatar for a trader @@ -137,7 +135,7 @@ export declare class RagfairOfferGenerator { * @param itemDetails raw db item details * @returns Item array */ - protected createSingleOfferForItem(items: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; + protected createSingleOfferForItem(items: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; /** * Generate trader offers on flea using the traders assort data * @param traderID Trader to generate offers for @@ -151,7 +149,7 @@ export declare class RagfairOfferGenerator { * @param itemDetails db details of first item * @returns */ - protected getItemCondition(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): Item[]; + protected randomiseItemUpdProperties(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): Item[]; /** * Get the relevant condition id if item tpl matches in ragfair.json/condition * @param tpl Item to look for matching condition object @@ -184,7 +182,7 @@ export declare class RagfairOfferGenerator { * @param offerItems Items for sale in offer * @returns Barter scheme */ - protected createBarterRequirement(offerItems: Item[]): IBarterScheme[]; + protected createBarterBarterScheme(offerItems: Item[]): IBarterScheme[]; /** * Get an array of flea prices + item tpl, cached in generator class inside `allowedFleaPriceItemsForBarter` * @returns array with tpl/price values @@ -196,7 +194,9 @@ export declare class RagfairOfferGenerator { /** * Create a random currency-based barter scheme for an array of items * @param offerItems Items on offer + * @param isPackOffer Is the barter scheme being created for a pack offer + * @param multipler What to multiply the resulting price by * @returns Barter scheme for offer */ - protected createCurrencyRequirement(offerItems: Item[]): IBarterScheme[]; + protected createCurrencyBarterScheme(offerItems: Item[], isPackOffer: boolean, multipler?: number): IBarterScheme[]; } diff --git a/TypeScript/10ScopesAndTypes/types/generators/ScavCaseRewardGenerator.d.ts b/TypeScript/10ScopesAndTypes/types/generators/ScavCaseRewardGenerator.d.ts index 4ba1888..b5935d0 100644 --- a/TypeScript/10ScopesAndTypes/types/generators/ScavCaseRewardGenerator.d.ts +++ b/TypeScript/10ScopesAndTypes/types/generators/ScavCaseRewardGenerator.d.ts @@ -25,6 +25,8 @@ export declare class ScavCaseRewardGenerator { protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected scavCaseConfig: IScavCaseConfig; + protected dbItemsCache: ITemplateItem[]; + protected dbAmmoItemsCache: ITemplateItem[]; constructor(logger: ILogger, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * Create an array of rewards that will be given to the player upon completing their scav case build @@ -33,10 +35,10 @@ export declare class ScavCaseRewardGenerator { */ generate(recipeId: string): Product[]; /** - * Get all db items that are not blacklisted in scavcase config - * @returns filtered array of db items + * Get all db items that are not blacklisted in scavcase config or global blacklist + * Store in class field */ - protected getDbItems(): ITemplateItem[]; + protected cacheDbItems(): void; /** * Pick a number of items to be rewards, the count is defined by the values in * @param items item pool to pick rewards from diff --git a/TypeScript/10ScopesAndTypes/types/generators/WeatherGenerator.d.ts b/TypeScript/10ScopesAndTypes/types/generators/WeatherGenerator.d.ts index 2e2403c..6471bb1 100644 --- a/TypeScript/10ScopesAndTypes/types/generators/WeatherGenerator.d.ts +++ b/TypeScript/10ScopesAndTypes/types/generators/WeatherGenerator.d.ts @@ -52,6 +52,7 @@ export declare class WeatherGenerator { */ protected setCurrentDateTime(weather: IWeather): void; protected getWeightedWindDirection(): WindDirection; + protected getWeightedClouds(): number; protected getWeightedWindSpeed(): number; protected getWeightedFog(): number; protected getWeightedRain(): number; diff --git a/TypeScript/10ScopesAndTypes/types/helpers/HealthHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/HealthHelper.d.ts index 3694a6e..e4cdcd6 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/HealthHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/HealthHelper.d.ts @@ -27,6 +27,7 @@ export declare class HealthHelper { * @param request Heal request * @param sessionID Session id * @param addEffects Should effects be added or removed (default - add) + * @param deleteExistingEffects Should all prior effects be removed before apply new ones */ saveVitality(pmcData: IPmcData, request: ISyncHealthRequestData, sessionID: string, addEffects?: boolean, deleteExistingEffects?: boolean): void; /** diff --git a/TypeScript/10ScopesAndTypes/types/helpers/InRaidHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/InRaidHelper.d.ts index bf584c2..b4c0c1c 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/InRaidHelper.d.ts @@ -53,7 +53,7 @@ export declare class InRaidHelper { * @param victim Who was killed by player * @returns a numerical standing gain or loss */ - protected getStandingChangeForKill(victim: Victim): number; + protected getFenceStandingChangeForKillAsScav(victim: Victim): number; /** * Reset a profile to a baseline, used post-raid * Reset points earned during session property diff --git a/TypeScript/10ScopesAndTypes/types/helpers/ItemHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/ItemHelper.d.ts index 99fca56..00f190f 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/ItemHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/ItemHelper.d.ts @@ -26,6 +26,7 @@ declare class ItemHelper { protected itemBaseClassService: ItemBaseClassService; protected localisationService: LocalisationService; protected localeService: LocaleService; + protected readonly defaultInvalidBaseTypes: string[]; constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, localisationService: LocalisationService, localeService: LocaleService); /** * Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash @@ -67,6 +68,11 @@ declare class ItemHelper { * @returns Price in roubles (undefined if not found) */ getDynamicItemPrice(tpl: string): number; + /** + * Update items upd.StackObjectsCount to be 1 if its upd is missing or StackObjectsCount is undefined + * @param item Item to update + * @returns Fixed item + */ fixItemStackCount(item: Item): Item; /** * AmmoBoxes contain StackSlots which need to be filled for the AmmoBox to have content. @@ -125,19 +131,19 @@ declare class ItemHelper { getItemQualityModifier(item: Item): number; /** * Get a quality value based on a repairable items (weapon/armor) current state between current and max durability - * @param itemDetails - * @param repairable repairable object - * @param item - * @returns a number between 0 and 1 + * @param itemDetails Db details for item we want quality value for + * @param repairable Repairable properties + * @param item Item quality value is for + * @returns A number between 0 and 1 */ protected getRepairableItemQualityValue(itemDetails: ITemplateItem, repairable: Repairable, item: Item): number; /** * Recursive function that looks at every item from parameter and gets their childrens Ids + includes parent item in results - * @param items - * @param itemID + * @param items Array of items (item + possible children) + * @param itemId Parent items id * @returns an array of strings */ - findAndReturnChildrenByItems(items: Item[], itemID: string): string[]; + findAndReturnChildrenByItems(items: Item[], itemId: string): string[]; /** * A variant of findAndReturnChildren where the output is list of item objects instead of their ids. * @param items @@ -164,12 +170,6 @@ declare class ItemHelper { * @returns true if it is a dogtag */ isDogtag(tpl: string): boolean; - /** - * Can the item passed in be sold to a trader because it is raw money - * @param tpl Item template id to check - * @returns true if unsellable - */ - isNotSellable(tpl: string): boolean; /** * Gets the identifier for a child using slotId, locationX and locationY. * @param item @@ -183,19 +183,19 @@ declare class ItemHelper { */ isItemTplStackable(tpl: string): boolean; /** - * split item stack if it exceeds its StackMaxSize property - * @param itemToSplit item being split into smaller stacks + * split item stack if it exceeds its items StackMaxSize property + * @param itemToSplit Item to split into smaller stacks * @returns Array of split items */ splitStack(itemToSplit: Item): Item[]; /** - * Find Barter items in the inventory + * Find Barter items from array of items * @param {string} by tpl or id - * @param {Object} pmcData + * @param {Item[]} items Array of items to iterate over * @param {string} barterItemId * @returns Array of Item objects */ - findBarterItems(by: "tpl" | "id", pmcData: IPmcData, barterItemId: string): Item[]; + findBarterItems(by: "tpl" | "id", items: Item[], barterItemId: string): Item[]; /** * Regenerate all guids with new ids, exceptions are for items that cannot be altered (e.g. stash/sorting table) * @param pmcData Player profile @@ -262,10 +262,21 @@ declare class ItemHelper { * @param minSizePercent % the magazine must be filled to */ fillMagazineWithCartridge(magazine: Item[], magTemplate: ITemplateItem, cartridgeTpl: string, minSizePercent?: number): void; + /** + * Choose a random bullet type from the list of possible a magazine has + * @param magTemplate Magazine template from Db + * @returns Tpl of cartridge + */ protected getRandomValidCaliber(magTemplate: ITemplateItem): string; + /** + * Chose a randomly weighted cartridge that fits + * @param caliber Desired caliber + * @param staticAmmoDist Cartridges and thier weights + * @returns Tpl of cartrdige + */ protected drawAmmoTpl(caliber: string, staticAmmoDist: Record): string; /** - * + * Create a basic cartrige object * @param parentId container cartridges will be placed in * @param ammoTpl Cartridge to insert * @param stackCount Count of cartridges inside parent diff --git a/TypeScript/10ScopesAndTypes/types/helpers/QuestHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/QuestHelper.d.ts index e04b6e0..5c749d3 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/QuestHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/QuestHelper.d.ts @@ -21,6 +21,7 @@ import { DialogueHelper } from "./DialogueHelper"; import { ItemHelper } from "./ItemHelper"; import { PaymentHelper } from "./PaymentHelper"; import { ProfileHelper } from "./ProfileHelper"; +import { QuestConditionHelper } from "./QuestConditionHelper"; import { RagfairServerHelper } from "./RagfairServerHelper"; import { TraderHelper } from "./TraderHelper"; export declare class QuestHelper { @@ -29,6 +30,7 @@ export declare class QuestHelper { protected timeUtil: TimeUtil; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; + protected questConditionHelper: QuestConditionHelper; protected eventOutputHolder: EventOutputHolder; protected databaseServer: DatabaseServer; protected localeService: LocaleService; @@ -41,7 +43,7 @@ export declare class QuestHelper { protected mailSendService: MailSendService; protected configServer: ConfigServer; 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, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, questConditionHelper: QuestConditionHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, mailSendService: MailSendService, configServer: ConfigServer); /** * Get status of a quest in player profile by its id * @param pmcData Profile to search @@ -119,7 +121,7 @@ export declare class QuestHelper { * @param sessionID Session id * @returns Quests accessible to player incuding newly unlocked quests now quest (startedQuestId) was started */ - acceptedUnlocked(startedQuestId: string, sessionID: string): IQuest[]; + getNewlyAccessibleQuestsWhenStartingQuest(startedQuestId: string, sessionID: string): IQuest[]; /** * Get quests that can be shown to player after failing a quest * @param failedQuestId Id of the quest failed by player diff --git a/TypeScript/10ScopesAndTypes/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/RagfairOfferHelper.d.ts index de9d550..0699259 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/RagfairOfferHelper.d.ts @@ -1,4 +1,5 @@ import { IPmcData } from "../models/eft/common/IPmcData"; +import { Item } from "../models/eft/common/tables/IItem"; import { ITraderAssort } from "../models/eft/common/tables/ITrader"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; @@ -13,10 +14,10 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { LocaleService } from "../services/LocaleService"; import { LocalisationService } from "../services/LocalisationService"; +import { MailSendService } from "../services/MailSendService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { HashUtil } from "../utils/HashUtil"; import { TimeUtil } from "../utils/TimeUtil"; -import { DialogueHelper } from "./DialogueHelper"; import { ItemHelper } from "./ItemHelper"; import { PaymentHelper } from "./PaymentHelper"; import { PresetHelper } from "./PresetHelper"; @@ -33,7 +34,6 @@ export declare class RagfairOfferHelper { protected databaseServer: DatabaseServer; protected traderHelper: TraderHelper; protected saveServer: SaveServer; - protected dialogueHelper: DialogueHelper; protected itemHelper: ItemHelper; protected paymentHelper: PaymentHelper; protected presetHelper: PresetHelper; @@ -44,11 +44,12 @@ export declare class RagfairOfferHelper { protected ragfairOfferService: RagfairOfferService; protected localeService: LocaleService; protected localisationService: LocalisationService; + protected mailSendService: MailSendService; protected configServer: ConfigServer; protected static goodSoldTemplate: string; protected ragfairConfig: IRagfairConfig; 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, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, localisationService: LocalisationService, mailSendService: MailSendService, configServer: ConfigServer); /** * Passthrough to ragfairOfferService.getOffers(), get flea offers a player should see * @param searchRequest Data from client @@ -119,19 +120,26 @@ export declare class RagfairOfferHelper { */ protected getProfileOffers(sessionID: string): IRagfairOffer[]; /** - * Delete an offer from a desired profile + * Delete an offer from a desired profile and from ragfair offers * @param sessionID Session id of profile to delete offer from - * @param offerId Offer id to delete + * @param offerId Id of offer to delete */ - protected deleteOfferByOfferId(sessionID: string, offerId: string): void; + protected deleteOfferById(sessionID: string, offerId: string): void; /** * Complete the selling of players' offer * @param sessionID Session id * @param offer Sold offer details * @param boughtAmount Amount item was purchased for - * @returns Client response + * @returns IItemEventRouterResponse */ protected completeOffer(sessionID: string, offer: IRagfairOffer, boughtAmount: number): IItemEventRouterResponse; + /** + * Get a localised message for when players offer has sold on flea + * @param itemTpl Item sold + * @param boughtAmount How many were purchased + * @returns Localised message text + */ + protected getLocalisedOfferSoldMessage(itemTpl: string, boughtAmount: number): string; /** * Should a ragfair offer be visible to the player * @param searchRequest Search request @@ -142,4 +150,12 @@ export declare class RagfairOfferHelper { * @returns True = should be shown to player */ isDisplayableOffer(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, offer: IRagfairOffer, pmcProfile: IPmcData): boolean; + /** + * Is items quality value within desired range + * @param item Item to check quality of + * @param min Desired minimum quality + * @param max Desired maximum quality + * @returns True if in range + */ + protected itemQualityInRange(item: Item, min: number, max: number): boolean; } diff --git a/TypeScript/10ScopesAndTypes/types/helpers/RagfairSellHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/RagfairSellHelper.d.ts index 251d7ca..913b408 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/RagfairSellHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/RagfairSellHelper.d.ts @@ -13,12 +13,12 @@ export declare class RagfairSellHelper { constructor(logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, configServer: ConfigServer); /** * Get the percent chance to sell an item based on its average listed price vs player chosen listing price - * @param baseChancePercent Base chance to sell item * @param averageOfferPriceRub Price of average offer in roubles * @param playerListedPriceRub Price player listed item for in roubles + * @param qualityMultiplier Quality multipler of item being sold * @returns percent value */ - calculateSellChance(baseChancePercent: number, averageOfferPriceRub: number, playerListedPriceRub: number): number; + calculateSellChance(averageOfferPriceRub: number, playerListedPriceRub: number, qualityMultiplier: number): number; /** * Get percent chance to sell an item when price is below items average listing price * @param playerListedPriceRub Price player listed item for in roubles diff --git a/TypeScript/10ScopesAndTypes/types/helpers/TraderHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/TraderHelper.d.ts index c163f7a..6680ccf 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/TraderHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/TraderHelper.d.ts @@ -35,7 +35,7 @@ export declare class TraderHelper { protected highestTraderBuyPriceItems: Record; constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, handbookHelper: HandbookHelper, itemHelper: ItemHelper, playerService: PlayerService, localisationService: LocalisationService, fenceService: FenceService, timeUtil: TimeUtil, randomUtil: RandomUtil, configServer: ConfigServer); getTrader(traderID: string, sessionID: string): ITraderBase; - getTraderAssortsById(traderId: string): ITraderAssort; + getTraderAssortsByTraderId(traderId: string): ITraderAssort; /** * 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 diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/IBotBase.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/IBotBase.d.ts index ee40958..6c7b76f 100644 --- a/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/IBotBase.d.ts @@ -281,7 +281,7 @@ export interface InsuredItem { export interface Hideout { Production: Record; Areas: HideoutArea[]; - Improvements: Record; + Improvement: Record; Seed: number; sptUpdateLastRunTimestamp: number; } diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/health/IHealthTreatmentRequestData.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/health/IHealthTreatmentRequestData.d.ts index 7fb80a8..598e60c 100644 --- a/TypeScript/10ScopesAndTypes/types/models/eft/health/IHealthTreatmentRequestData.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/eft/health/IHealthTreatmentRequestData.d.ts @@ -1,12 +1,14 @@ export interface IHealthTreatmentRequestData { Action: "RestoreHealth"; trader: string; - items: Item[]; + items: Cost[]; difference: Difference; timestamp: number; } -export interface Item { +export interface Cost { + /** Id of stack to take money from */ id: string; + /** Amount of money to take off player for treatment */ count: number; } export interface Difference { @@ -25,5 +27,6 @@ export interface BodyParts { } export interface BodyPart { Health: number; + /** Effects in array are to be removed */ Effects: string[]; } diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/notifier/INotifier.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/notifier/INotifier.d.ts index ce25dee..c6c6979 100644 --- a/TypeScript/10ScopesAndTypes/types/models/eft/notifier/INotifier.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/eft/notifier/INotifier.d.ts @@ -14,6 +14,11 @@ export interface INotification { } export declare enum NotificationType { RAGFAIR_OFFER_SOLD = "RagfairOfferSold", + RAGFAIR_RATING_CHANGE = "RagfairRatingChange", + /** ChatMessageReceived */ NEW_MESSAGE = "new_message", - PING = "ping" + PING = "ping", + TRADER_SUPPLY = "TraderSupply", + TRADER_STANDING = "TraderStanding", + UNLOCK_TRADER = "UnlockTrader" } diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/notifier/ISelectProfileResponse.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/notifier/ISelectProfileResponse.d.ts index ecb668a..f2d6be7 100644 --- a/TypeScript/10ScopesAndTypes/types/models/eft/notifier/ISelectProfileResponse.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/eft/notifier/ISelectProfileResponse.d.ts @@ -1,6 +1,3 @@ -import { INotifierChannel } from "./INotifier"; export interface ISelectProfileResponse { status: string; - notifier: INotifierChannel; - notifierServer: string; } diff --git a/TypeScript/10ScopesAndTypes/types/models/enums/WeatherType.d.ts b/TypeScript/10ScopesAndTypes/types/models/enums/WeatherType.d.ts index d31fefe..503dc30 100644 --- a/TypeScript/10ScopesAndTypes/types/models/enums/WeatherType.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/enums/WeatherType.d.ts @@ -1,19 +1,19 @@ export declare enum WeatherType { - CLEAR_DAY = 1, - CLEAR_WIND = 2, - CLEAR_NIGHT = 3, - PARTLY_CLOUD_DAY = 4, - PARTLY_CLOUD_NIGHT = 5, - CLEAR_FOG_DAY = 6, - CLEAR_FOG_NIGHT = 7, - CLOUDFOG = 8, - FOG = 9, - MOSTLY_CLOUD = 10, - LIGHT_RAIN = 11, - RAIN = 12, - CLOUD_WIND = 13, - CLOUD_WIND_RAIN = 14, - FULL_CLOUD = 15, - THUNDER_CLOUD = 16, - NONE = 0 + CLEAR_DAY = 0, + CLEAR_WIND = 1, + CLEAR_NIGHT = 2, + PARTLY_CLOUD_DAY = 3, + PARTLY_CLOUD_NIGHT = 4, + CLEAR_FOG_DAY = 5, + CLEAR_FOG_NIGHT = 6, + CLOUD_FOG = 7, + FOG = 8, + MOSTLY_CLOUD = 9, + LIGHT_RAIN = 10, + RAIN = 11, + CLOUD_WIND = 12, + CLOUD_WIND_RAIN = 13, + FULL_CLOUD = 14, + THUNDER_CLOUD = 15, + NONE = 16 } diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/config/IRagfairConfig.d.ts index 7c04857..7aea24f 100644 --- a/TypeScript/10ScopesAndTypes/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/spt/config/IRagfairConfig.d.ts @@ -41,7 +41,8 @@ export interface Dynamic { /** Use the highest trader price for an offer if its greater than the price in templates/prices.json */ useTraderPriceForOffersIfHigher: boolean; /** Barter offer specific settings */ - barter: Barter; + barter: IBarterDetails; + pack: IPackDetails; /** Dynamic offer price below handbook adjustment values */ offerAdjustment: OfferAdjustment; /** How many offers should expire before an offer regeneration occurs */ @@ -49,9 +50,7 @@ export interface Dynamic { /** How many offers should be listed */ offerItemCount: MinMax; /** How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) */ - price: MinMax; - /** How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) */ - presetPrice: MinMax; + priceRanges: IPriceRanges; /** Should default presets to listed only or should non-standard presets found in globals.json be listed too */ showDefaultPresetsOnly: boolean; endTimeSeconds: MinMax; @@ -74,7 +73,12 @@ export interface Dynamic { /** Dict of price limits keyed by item type */ unreasonableModPrices: Record; } -export interface Barter { +export interface IPriceRanges { + default: MinMax; + preset: MinMax; + pack: MinMax; +} +export interface IBarterDetails { /** Should barter offers be generated */ enable: boolean; /** Percentage change an offer is listed as a barter */ @@ -90,6 +94,18 @@ export interface Barter { /** Item Tpls to never be turned into a barter */ itemTypeBlacklist: string[]; } +export interface IPackDetails { + /** Should pack offers be generated */ + enable: boolean; + /** Percentage change an offer is listed as a pack */ + chancePercent: number; + /** Min number of required items for a pack */ + itemCountMin: number; + /** Max number of required items for a pack */ + itemCountMax: number; + /** item types to allow being a pack */ + itemTypeWhitelist: string[]; +} export interface OfferAdjustment { /** Shuld offer price be adjusted when below handbook price */ adjustPriceWhenBelowHandbookPrice: boolean; diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/config/IWeatherConfig.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/config/IWeatherConfig.d.ts index 41a1c83..6ecf35b 100644 --- a/TypeScript/10ScopesAndTypes/types/models/spt/config/IWeatherConfig.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/spt/config/IWeatherConfig.d.ts @@ -7,7 +7,7 @@ export interface IWeatherConfig extends IBaseConfig { weather: Weather; } export interface Weather { - clouds: MinMax; + clouds: WeatherSettings; windSpeed: WeatherSettings; windDirection: WeatherSettings; windGustiness: MinMax; diff --git a/TypeScript/10ScopesAndTypes/types/services/HashCacheService.d.ts b/TypeScript/10ScopesAndTypes/types/services/HashCacheService.d.ts index 5320f28..9968478 100644 --- a/TypeScript/10ScopesAndTypes/types/services/HashCacheService.d.ts +++ b/TypeScript/10ScopesAndTypes/types/services/HashCacheService.d.ts @@ -11,7 +11,18 @@ export declare class HashCacheService { protected modHashes: any; protected readonly modCachePath = "./user/cache/modCache.json"; constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); + /** + * Return a stored hash by key + * @param modName Name of mod to get hash for + * @returns Mod hash + */ getStoredModHash(modName: string): string; + /** + * Does the generated hash match the stored hash + * @param modName name of mod + * @param modContent + * @returns True if they match + */ modContentMatchesStoredHash(modName: string, modContent: string): boolean; hashMatchesStoredHash(modName: string, modHash: string): boolean; storeModContent(modName: string, modContent: string): void; diff --git a/TypeScript/10ScopesAndTypes/types/services/MailSendService.d.ts b/TypeScript/10ScopesAndTypes/types/services/MailSendService.d.ts index 19397dc..fe4a7fe 100644 --- a/TypeScript/10ScopesAndTypes/types/services/MailSendService.d.ts +++ b/TypeScript/10ScopesAndTypes/types/services/MailSendService.d.ts @@ -35,7 +35,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendDirectNpcMessageToPlayer(playerId: string, sender: Traders, messageType: MessageType, message: string, items?: Item[], maxStorageTimeSeconds?: any): void; + sendDirectNpcMessageToPlayer(playerId: string, sender: Traders, messageType: MessageType, message: string, items?: Item[], maxStorageTimeSeconds?: any, systemData?: any, ragfair?: any): void; /** * Send a message from an NPC (e.g. prapor) to the player with or without items * @param playerId Players id to send message to @@ -45,7 +45,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendLocalisedNpcMessageToPlayer(playerId: string, sender: Traders, messageType: MessageType, messageLocaleId: string, items?: Item[], maxStorageTimeSeconds?: any, systemData?: any): void; + sendLocalisedNpcMessageToPlayer(playerId: string, sender: Traders, messageType: MessageType, messageLocaleId: string, items?: Item[], maxStorageTimeSeconds?: any, systemData?: any, ragfair?: any): void; /** * Send a message from SYSTEM to the player with or without items * @param playerId Players id to send message to diff --git a/TypeScript/10ScopesAndTypes/types/services/MatchBotDetailsCacheService.d.ts b/TypeScript/10ScopesAndTypes/types/services/MatchBotDetailsCacheService.d.ts index eb365dd..c1bd322 100644 --- a/TypeScript/10ScopesAndTypes/types/services/MatchBotDetailsCacheService.d.ts +++ b/TypeScript/10ScopesAndTypes/types/services/MatchBotDetailsCacheService.d.ts @@ -1,7 +1,7 @@ import { IBotBase } from "../models/eft/common/tables/IBotBase"; import { ILogger } from "../models/spt/utils/ILogger"; import { LocalisationService } from "./LocalisationService"; -/** Cache bots in a dictionary, keyed by the bots name, keying by name isnt idea as its not unique but this is used by the post-raid system which doesnt have any bot ids, only name */ +/** Cache bots in a dictionary, keyed by the bots name, keying by name isnt ideal as its not unique but this is used by the post-raid system which doesnt have any bot ids, only name */ export declare class MatchBotDetailsCacheService { protected logger: ILogger; protected localisationService: LocalisationService; @@ -17,9 +17,9 @@ export declare class MatchBotDetailsCacheService { */ clearCache(): void; /** - * Find a bot in the cache by its name + * Find a bot in the cache by its name and side * @param botName Name of bot to find * @returns Bot details */ - getBotByName(botName: string): IBotBase; + getBotByNameAndSide(botName: string, botSide: string): IBotBase; } diff --git a/TypeScript/10ScopesAndTypes/types/services/ModCompilerService.d.ts b/TypeScript/10ScopesAndTypes/types/services/ModCompilerService.d.ts index a4bf3c8..e306177 100644 --- a/TypeScript/10ScopesAndTypes/types/services/ModCompilerService.d.ts +++ b/TypeScript/10ScopesAndTypes/types/services/ModCompilerService.d.ts @@ -1,14 +1,36 @@ import { CompilerOptions } from "typescript"; import type { ILogger } from "../models/spt/utils/ILogger"; -import { HashCacheService } from "./HashCacheService"; import { VFS } from "../utils/VFS"; +import { HashCacheService } from "./HashCacheService"; export declare class ModCompilerService { protected logger: ILogger; protected hashCacheService: HashCacheService; protected vfs: VFS; constructor(logger: ILogger, hashCacheService: HashCacheService, vfs: VFS); + /** + * Convert a mods TS into JS + * @param modName Name of mod + * @param modPath Dir path to mod + * @param modTypeScriptFiles + * @returns + */ compileMod(modName: string, modPath: string, modTypeScriptFiles: string[]): Promise; + /** + * Convert a TS file into JS + * @param fileNames Paths to TS files + * @param options Compiler options + */ protected compile(fileNames: string[], options: CompilerOptions): Promise; + /** + * Do the files at the provided paths exist + * @param fileNames + * @returns + */ protected areFilesReady(fileNames: string[]): boolean; + /** + * Wait the provided number of milliseconds + * @param ms Milliseconds + * @returns + */ protected delay(ms: number): Promise; } diff --git a/TypeScript/10ScopesAndTypes/types/services/PaymentService.d.ts b/TypeScript/10ScopesAndTypes/types/services/PaymentService.d.ts index 1c9c32b..fb5f92c 100644 --- a/TypeScript/10ScopesAndTypes/types/services/PaymentService.d.ts +++ b/TypeScript/10ScopesAndTypes/types/services/PaymentService.d.ts @@ -61,23 +61,26 @@ export declare class PaymentService { * Get all money stacks in inventory and prioritse items in stash * @param pmcData * @param currencyTpl + * @param playerStashId Players stash id * @returns Sorting money items */ - protected getSortedMoneyItemsInInventory(pmcData: IPmcData, currencyTpl: string): Item[]; + protected getSortedMoneyItemsInInventory(pmcData: IPmcData, currencyTpl: string, playerStashId: string): Item[]; /** * Prioritise player stash first over player inventory * Post-raid healing would often take money out of the players pockets/secure container * @param a First money stack item * @param b Second money stack item * @param inventoryItems players inventory items + * @param playerStashId Players stash id * @returns sort order */ - protected prioritiseStashSort(a: Item, b: Item, inventoryItems: Item[]): number; + protected prioritiseStashSort(a: Item, b: Item, inventoryItems: Item[], playerStashId: string): number; /** * Recursivly check items parents to see if it is inside the players inventory, not stash * @param itemId item id to check * @param inventoryItems player inventory + * @param playerStashId Players stash id * @returns true if its in inventory */ - protected isInInventory(itemId: string, inventoryItems: Item[]): boolean; + protected isInStash(itemId: string, inventoryItems: Item[], playerStashId: string): boolean; } diff --git a/TypeScript/10ScopesAndTypes/types/services/ProfileFixerService.d.ts b/TypeScript/10ScopesAndTypes/types/services/ProfileFixerService.d.ts index c8232fc..bc1e42e 100644 --- a/TypeScript/10ScopesAndTypes/types/services/ProfileFixerService.d.ts +++ b/TypeScript/10ScopesAndTypes/types/services/ProfileFixerService.d.ts @@ -14,6 +14,7 @@ import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; import { Watermark } from "../utils/Watermark"; import { LocalisationService } from "./LocalisationService"; @@ -27,17 +28,19 @@ export declare class ProfileFixerService { protected itemHelper: ItemHelper; protected localisationService: LocalisationService; protected timeUtil: TimeUtil; + protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, profileHelper: ProfileHelper, itemHelper: ItemHelper, localisationService: LocalisationService, timeUtil: TimeUtil, databaseServer: DatabaseServer, configServer: ConfigServer); + constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, profileHelper: ProfileHelper, itemHelper: ItemHelper, localisationService: LocalisationService, timeUtil: TimeUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, configServer: ConfigServer); /** * 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; protected addMissingGunStandContainerImprovements(pmcProfile: IPmcData): void; + protected ensureGunStandLevelsMatch(pmcProfile: IPmcData): void; protected addHideoutAreaStashes(pmcProfile: IPmcData): void; protected addMissingHideoutWallAreas(pmcProfile: IPmcData): void; protected adjustUnreasonableModFleaPrices(): void; @@ -131,4 +134,9 @@ export declare class ProfileFixerService { * @param pmcProfile Profile to add missing IDs to */ addMissingIdsToBonuses(pmcProfile: IPmcData): void; + /** + * At some point the property name was changed,migrate data across to new name + * @param pmcProfile + */ + protected migrateImprovements(pmcProfile: IPmcData): void; } diff --git a/TypeScript/10ScopesAndTypes/types/services/RagfairPriceService.d.ts b/TypeScript/10ScopesAndTypes/types/services/RagfairPriceService.d.ts index e245efa..ff35327 100644 --- a/TypeScript/10ScopesAndTypes/types/services/RagfairPriceService.d.ts +++ b/TypeScript/10ScopesAndTypes/types/services/RagfairPriceService.d.ts @@ -3,6 +3,7 @@ import { HandbookHelper } from "../helpers/HandbookHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { TraderHelper } from "../helpers/TraderHelper"; +import { MinMax } from "../models/common/MinMax"; import { IPreset } from "../models/eft/common/IGlobals"; import { Item } from "../models/eft/common/tables/IItem"; import { IBarterScheme } from "../models/eft/common/tables/ITrader"; @@ -35,10 +36,6 @@ export declare class RagfairPriceService implements OnLoad { * Generate static (handbook) and dynamic (prices.json) flea prices, store inside class as dictionaries */ onLoad(): Promise; - /** - * Add placeholder values for items missing from handbook - */ - protected addMissingHandbookPrices(): void; getRoute(): string; /** * Iterate over all items of type "Item" in db and get template price, store in cache @@ -91,9 +88,17 @@ export declare class RagfairPriceService implements OnLoad { * Generate a currency cost for an item and its mods * @param items Item with mods to get price for * @param desiredCurrency Currency price desired in + * @param isPackOffer Price is for a pack type offer * @returns cost of item in desired currency */ - getDynamicOfferPrice(items: Item[], desiredCurrency: string): number; + getDynamicOfferPriceForOffer(items: Item[], desiredCurrency: string, isPackOffer: boolean): number; + /** + * Get different min/max price multipliers for different offer types (preset/pack/default) + * @param isPreset Offer is a preset + * @param isPack Offer is a pack + * @returns MinMax values + */ + protected getOfferTypeRangeValues(isPreset: boolean, isPack: boolean): MinMax; /** * Check to see if an items price is below its handbook price and adjust accoring to values set to config/ragfair.json * @param itemPrice price of item @@ -104,10 +109,10 @@ export declare class RagfairPriceService implements OnLoad { /** * Multiply the price by a randomised curve where n = 2, shift = 2 * @param existingPrice price to alter - * @param isPreset is the item we're multiplying a preset + * @param rangeValues min and max to adjust price by * @returns multiplied price */ - protected randomisePrice(existingPrice: number, isPreset: boolean): number; + protected randomiseOfferPrice(existingPrice: number, rangeValues: MinMax): number; /** * Calculate the cost of a weapon preset by adding together the price of its mods + base price of default weapon preset * @param item base weapon diff --git a/TypeScript/11BundleLoadingSample/types/callbacks/GameCallbacks.d.ts b/TypeScript/11BundleLoadingSample/types/callbacks/GameCallbacks.d.ts index aa80036..46f79f9 100644 --- a/TypeScript/11BundleLoadingSample/types/callbacks/GameCallbacks.d.ts +++ b/TypeScript/11BundleLoadingSample/types/callbacks/GameCallbacks.d.ts @@ -1,4 +1,5 @@ import { GameController } from "../controllers/GameController"; +import { OnLoad } from "../di/OnLoad"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { ICheckVersionResponse } from "../models/eft/game/ICheckVersionResponse"; import { ICurrentGroupResponse } from "../models/eft/game/ICurrentGroupResponse"; @@ -15,12 +16,14 @@ import { INullResponseData } from "../models/eft/httpResponse/INullResponseData" import { SaveServer } from "../servers/SaveServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { Watermark } from "../utils/Watermark"; -declare class GameCallbacks { +declare class GameCallbacks implements OnLoad { protected httpResponse: HttpResponseUtil; protected watermark: Watermark; protected saveServer: SaveServer; protected gameController: GameController; constructor(httpResponse: HttpResponseUtil, watermark: Watermark, saveServer: SaveServer, gameController: GameController); + onLoad(): Promise; + getRoute(): string; /** * Handle client/game/version/validate * @returns INullResponseData diff --git a/TypeScript/11BundleLoadingSample/types/controllers/GameController.d.ts b/TypeScript/11BundleLoadingSample/types/controllers/GameController.d.ts index 04e3abb..e88610e 100644 --- a/TypeScript/11BundleLoadingSample/types/controllers/GameController.d.ts +++ b/TypeScript/11BundleLoadingSample/types/controllers/GameController.d.ts @@ -61,13 +61,14 @@ export declare class GameController { protected pmcConfig: IPmcConfig; protected lootConfig: ILootConfig; constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, randomUtil: RandomUtil, encodingUtil: EncodingUtil, hideoutHelper: HideoutHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, seasonalEventService: SeasonalEventService, itemBaseClassService: ItemBaseClassService, giftService: GiftService, applicationContext: ApplicationContext, configServer: ConfigServer); + load(): void; /** * Handle client/game/start */ gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; protected addCustomLooseLootPositions(): void; protected adjustLooseLootSpawnProbabilities(): void; - protected setHideoutAreasAndCraftsTo30Secs(): void; + protected setHideoutAreasAndCraftsTo40Secs(): void; /** * 3.7.0 moved AIDs to be numeric, old profiles need to be migrated * We store the old AID value in new field `sessionId` diff --git a/TypeScript/11BundleLoadingSample/types/controllers/HealthController.d.ts b/TypeScript/11BundleLoadingSample/types/controllers/HealthController.d.ts index 1938297..2d7ff09 100644 --- a/TypeScript/11BundleLoadingSample/types/controllers/HealthController.d.ts +++ b/TypeScript/11BundleLoadingSample/types/controllers/HealthController.d.ts @@ -29,34 +29,35 @@ export declare class HealthController { * stores in-raid player health * @param pmcData Player profile * @param info Request data - * @param sessionID + * @param sessionID Player id * @param addEffects Should effects found be added or removed from profile + * @param deleteExistingEffects Should all prior effects be removed before apply new ones */ saveVitality(pmcData: IPmcData, info: ISyncHealthRequestData, sessionID: string, addEffects?: boolean, deleteExistingEffects?: boolean): void; /** * When healing in menu - * @param pmcData - * @param body - * @param sessionID - * @returns + * @param pmcData Player profile + * @param request Healing request + * @param sessionID Player id + * @returns IItemEventRouterResponse */ - offraidHeal(pmcData: IPmcData, body: IOffraidHealRequestData, sessionID: string): IItemEventRouterResponse; + offraidHeal(pmcData: IPmcData, request: IOffraidHealRequestData, sessionID: string): IItemEventRouterResponse; /** * Handle Eat event * Consume food/water outside of a raid * @param pmcData Player profile - * @param body request Object + * @param request Eat request * @param sessionID Session id * @returns IItemEventRouterResponse */ - offraidEat(pmcData: IPmcData, body: IOffraidEatRequestData, sessionID: string): IItemEventRouterResponse; + offraidEat(pmcData: IPmcData, request: IOffraidEatRequestData, sessionID: string): IItemEventRouterResponse; /** * Handle RestoreHealth event * Occurs on post-raid healing page * @param pmcData player profile * @param healthTreatmentRequest Request data from client * @param sessionID Session id - * @returns + * @returns IItemEventRouterResponse */ healthTreatment(pmcData: IPmcData, healthTreatmentRequest: IHealthTreatmentRequestData, sessionID: string): IItemEventRouterResponse; /** @@ -66,12 +67,4 @@ export declare class HealthController { * @param sessionID */ applyWorkoutChanges(pmcData: IPmcData, info: IWorkoutData, sessionId: string): void; - /** - * Iterate over treatment request diff and find effects to remove from player limbs - * @param sessionId - * @param profile Profile to update - * @param treatmentRequest client request - * @param output response to send to client - */ - protected removeEffectsAfterPostRaidHeal(sessionId: string, profile: IPmcData, treatmentRequest: IHealthTreatmentRequestData, output: IItemEventRouterResponse): void; } diff --git a/TypeScript/11BundleLoadingSample/types/controllers/HideoutController.d.ts b/TypeScript/11BundleLoadingSample/types/controllers/HideoutController.d.ts index 877c076..a90a16d 100644 --- a/TypeScript/11BundleLoadingSample/types/controllers/HideoutController.d.ts +++ b/TypeScript/11BundleLoadingSample/types/controllers/HideoutController.d.ts @@ -88,11 +88,11 @@ export declare class HideoutController { * @param pmcData Profile to edit * @param output Object to send back to client * @param sessionID Session/player id - * @param profileHideoutArea Current hideout data for profile + * @param profileParentHideoutArea Current hideout area for profile * @param dbHideoutArea Hideout area being upgraded * @param hideoutStage Stage hideout area is being upgraded to */ - protected addContainerImprovementToProfile(output: IItemEventRouterResponse, sessionID: string, pmcData: IPmcData, profileHideoutArea: HideoutArea, dbHideoutArea: IHideoutArea, hideoutStage: Stage): void; + protected addContainerImprovementToProfile(output: IItemEventRouterResponse, sessionID: string, pmcData: IPmcData, profileParentHideoutArea: HideoutArea, dbHideoutArea: IHideoutArea, hideoutStage: Stage): void; /** * Add an inventory item to profile from a hideout area stage data * @param pmcData Profile to update diff --git a/TypeScript/11BundleLoadingSample/types/controllers/LocationController.d.ts b/TypeScript/11BundleLoadingSample/types/controllers/LocationController.d.ts index 94d496a..94f5fce 100644 --- a/TypeScript/11BundleLoadingSample/types/controllers/LocationController.d.ts +++ b/TypeScript/11BundleLoadingSample/types/controllers/LocationController.d.ts @@ -4,6 +4,7 @@ import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { ILocationBase } from "../models/eft/common/ILocationBase"; import { ILocationsGenerateAllResponse } from "../models/eft/common/ILocationsSourceDestinationBase"; import { IAirdropLootResult } from "../models/eft/location/IAirdropLootResult"; +import { IGetLocationRequestData } from "../models/eft/location/IGetLocationRequestData"; import { AirdropTypeEnum } from "../models/enums/AirdropType"; import { IAirdropConfig } from "../models/spt/config/IAirdropConfig"; import { ILocationConfig } from "../models/spt/config/ILocationConfig"; @@ -34,10 +35,11 @@ export declare class LocationController { /** * Handle client/location/getLocalloot * Get a location (map) with generated loot data - * @param location Map to generate loot for + * @param sessionId Player id + * @param request Map request to generate * @returns ILocationBase */ - get(location: string): ILocationBase; + get(sessionId: string, request: IGetLocationRequestData): ILocationBase; /** * Generate a maps base location with loot * @param name Map name diff --git a/TypeScript/11BundleLoadingSample/types/controllers/QuestController.d.ts b/TypeScript/11BundleLoadingSample/types/controllers/QuestController.d.ts index 7d494a6..bd8a70f 100644 --- a/TypeScript/11BundleLoadingSample/types/controllers/QuestController.d.ts +++ b/TypeScript/11BundleLoadingSample/types/controllers/QuestController.d.ts @@ -61,7 +61,7 @@ export declare class QuestController { * @param playerLevel level of player to test against quest * @returns true if quest can be seen/accepted by player of defined level */ - protected playerLevelFulfillsQuestRequrement(quest: IQuest, playerLevel: number): boolean; + protected playerLevelFulfillsQuestRequirement(quest: IQuest, playerLevel: number): boolean; /** * Should a quest be shown to the player in trader quest screen * @param questId Quest to check diff --git a/TypeScript/11BundleLoadingSample/types/controllers/RagfairController.d.ts b/TypeScript/11BundleLoadingSample/types/controllers/RagfairController.d.ts index 76c27f7..bda37cd 100644 --- a/TypeScript/11BundleLoadingSample/types/controllers/RagfairController.d.ts +++ b/TypeScript/11BundleLoadingSample/types/controllers/RagfairController.d.ts @@ -21,6 +21,7 @@ import { IGetMarketPriceRequestData } from "../models/eft/ragfair/IGetMarketPric import { IGetOffersResult } from "../models/eft/ragfair/IGetOffersResult"; import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; import { ISearchRequestData } from "../models/eft/ragfair/ISearchRequestData"; +import { IProcessBuyTradeRequestData } from "../models/eft/trade/IProcessBuyTradeRequestData"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; @@ -125,6 +126,18 @@ export declare class RagfairController { * @returns IItemEventRouterResponse */ addPlayerOffer(pmcData: IPmcData, offerRequest: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Charge player a listing fee for using flea, pulls charge from data previously sent by client + * @param sessionID Player id + * @param rootItem Base item being listed (used when client tax cost not found and must be done on server) + * @param pmcData Player profile + * @param requirementsPriceInRub Rouble cost player chose for listing (used when client tax cost not found and must be done on server) + * @param itemStackCount How many items were listed in player (used when client tax cost not found and must be done on server) + * @param offerRequest Add offer request object from client + * @param output IItemEventRouterResponse + * @returns True if charging tax to player failed + */ + protected chargePlayerTaxFee(sessionID: string, rootItem: Item, pmcData: IPmcData, requirementsPriceInRub: number, itemStackCount: number, offerRequest: IAddOfferRequestData, output: IItemEventRouterResponse): boolean; /** * Is the item to be listed on the flea valid * @param offerRequest Client offer request @@ -158,4 +171,11 @@ export declare class RagfairController { */ removeOffer(offerId: string, sessionID: string): IItemEventRouterResponse; extendOffer(info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Create a basic trader request object with price and currency type + * @param currency What currency: RUB, EURO, USD + * @param value Amount of currency + * @returns IProcessBuyTradeRequestData + */ + protected createBuyTradeRequestObject(currency: string, value: number): IProcessBuyTradeRequestData; } diff --git a/TypeScript/11BundleLoadingSample/types/generators/BotEquipmentModGenerator.d.ts b/TypeScript/11BundleLoadingSample/types/generators/BotEquipmentModGenerator.d.ts index ccbbbbf..f7abb84 100644 --- a/TypeScript/11BundleLoadingSample/types/generators/BotEquipmentModGenerator.d.ts +++ b/TypeScript/11BundleLoadingSample/types/generators/BotEquipmentModGenerator.d.ts @@ -14,7 +14,6 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; import { BotEquipmentModPoolService } from "../services/BotEquipmentModPoolService"; import { BotModLimits, BotWeaponModLimitService } from "../services/BotWeaponModLimitService"; -import { ItemBaseClassService } from "../services/ItemBaseClassService"; import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; @@ -29,7 +28,6 @@ export declare class BotEquipmentModGenerator { protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; protected botEquipmentFilterService: BotEquipmentFilterService; - protected itemBaseClassService: ItemBaseClassService; protected itemFilterService: ItemFilterService; protected profileHelper: ProfileHelper; protected botWeaponModLimitService: BotWeaponModLimitService; @@ -40,7 +38,7 @@ export declare class BotEquipmentModGenerator { protected botEquipmentModPoolService: BotEquipmentModPoolService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, itemHelper: ItemHelper, botEquipmentFilterService: BotEquipmentFilterService, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponModLimitService: BotWeaponModLimitService, botHelper: BotHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, botEquipmentModPoolService: BotEquipmentModPoolService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, itemHelper: ItemHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponModLimitService: BotWeaponModLimitService, botHelper: BotHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, botEquipmentModPoolService: BotEquipmentModPoolService, configServer: ConfigServer); /** * Check mods are compatible and add to array * @param equipment Equipment item to add mods to diff --git a/TypeScript/11BundleLoadingSample/types/generators/LocationGenerator.d.ts b/TypeScript/11BundleLoadingSample/types/generators/LocationGenerator.d.ts index b8169d3..46a514b 100644 --- a/TypeScript/11BundleLoadingSample/types/generators/LocationGenerator.d.ts +++ b/TypeScript/11BundleLoadingSample/types/generators/LocationGenerator.d.ts @@ -65,10 +65,11 @@ export declare class LocationGenerator { protected getGuaranteedContainers(staticContainersOnMap: IStaticContainerData[]): IStaticContainerData[]; /** * Choose a number of containers based on their probabilty value to fulfil the desired count in containerData.chosenCount + * @param groupId Name of the group the containers are being collected for * @param containerData Containers and probability values for a groupId * @returns List of chosen container Ids */ - protected getContainersByProbabilty(containerData: IContainerGroupCount): string[]; + protected getContainersByProbabilty(groupId: string, containerData: IContainerGroupCount): string[]; /** * Get a mapping of each groupid and the containers in that group + count of containers to spawn on map * @param containersGroups Container group values diff --git a/TypeScript/11BundleLoadingSample/types/generators/PMCLootGenerator.d.ts b/TypeScript/11BundleLoadingSample/types/generators/PMCLootGenerator.d.ts index 9acff69..abb5615 100644 --- a/TypeScript/11BundleLoadingSample/types/generators/PMCLootGenerator.d.ts +++ b/TypeScript/11BundleLoadingSample/types/generators/PMCLootGenerator.d.ts @@ -31,12 +31,12 @@ export declare class PMCLootGenerator { */ generatePMCVestLootPool(): string[]; /** - * Check if item has a width/height that lets it fit into a 1x2/2x1 slot - * 1x1 / 1x2 / 2x1 + * Check if item has a width/height that lets it fit into a 2x2 slot + * 1x1 / 1x2 / 2x1 / 2x2 * @param item Item to check size of * @returns true if it fits */ - protected itemFitsInto1By2Slot(item: ITemplateItem): boolean; + protected itemFitsInto2By2Slot(item: ITemplateItem): boolean; /** * Create an array of loot items a PMC can have in their backpack * @returns string array of tpls diff --git a/TypeScript/11BundleLoadingSample/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/11BundleLoadingSample/types/generators/RagfairOfferGenerator.d.ts index a627191..58e0b68 100644 --- a/TypeScript/11BundleLoadingSample/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/11BundleLoadingSample/types/generators/RagfairOfferGenerator.d.ts @@ -55,11 +55,10 @@ export declare class RagfairOfferGenerator { * @param items Items in the offer * @param barterScheme Cost of item (currency or barter) * @param loyalLevel Loyalty level needed to buy item - * @param price Price of offer - * @param sellInOnePiece Set StackObjectsCount to 1 + * @param sellInOnePiece Flags sellInOnePiece to be true * @returns IRagfairOffer */ - createFleaOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; + createFleaOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, sellInOnePiece?: boolean): IRagfairOffer; /** * Create an offer object ready to send to ragfairOfferService.addOffer() * @param userID Owner of the offer @@ -67,17 +66,16 @@ export declare class RagfairOfferGenerator { * @param items Items in the offer * @param barterScheme Cost of item (currency or barter) * @param loyalLevel Loyalty level needed to buy item - * @param price Price of offer * @param sellInOnePiece Set StackObjectsCount to 1 * @returns IRagfairOffer */ - protected createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; + protected createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, sellInOnePiece?: boolean): IRagfairOffer; /** * Calculate the offer price that's listed on the flea listing * @param offerRequirements barter requirements for offer * @returns rouble cost of offer */ - protected calculateOfferListingPrice(offerRequirements: OfferRequirement[]): number; + protected convertOfferRequirementsIntoRoubles(offerRequirements: OfferRequirement[]): number; /** * Get avatar url from trader table in db * @param isTrader Is user we're getting avatar for a trader @@ -137,7 +135,7 @@ export declare class RagfairOfferGenerator { * @param itemDetails raw db item details * @returns Item array */ - protected createSingleOfferForItem(items: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; + protected createSingleOfferForItem(items: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; /** * Generate trader offers on flea using the traders assort data * @param traderID Trader to generate offers for @@ -151,7 +149,7 @@ export declare class RagfairOfferGenerator { * @param itemDetails db details of first item * @returns */ - protected getItemCondition(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): Item[]; + protected randomiseItemUpdProperties(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): Item[]; /** * Get the relevant condition id if item tpl matches in ragfair.json/condition * @param tpl Item to look for matching condition object @@ -184,7 +182,7 @@ export declare class RagfairOfferGenerator { * @param offerItems Items for sale in offer * @returns Barter scheme */ - protected createBarterRequirement(offerItems: Item[]): IBarterScheme[]; + protected createBarterBarterScheme(offerItems: Item[]): IBarterScheme[]; /** * Get an array of flea prices + item tpl, cached in generator class inside `allowedFleaPriceItemsForBarter` * @returns array with tpl/price values @@ -196,7 +194,9 @@ export declare class RagfairOfferGenerator { /** * Create a random currency-based barter scheme for an array of items * @param offerItems Items on offer + * @param isPackOffer Is the barter scheme being created for a pack offer + * @param multipler What to multiply the resulting price by * @returns Barter scheme for offer */ - protected createCurrencyRequirement(offerItems: Item[]): IBarterScheme[]; + protected createCurrencyBarterScheme(offerItems: Item[], isPackOffer: boolean, multipler?: number): IBarterScheme[]; } diff --git a/TypeScript/11BundleLoadingSample/types/generators/ScavCaseRewardGenerator.d.ts b/TypeScript/11BundleLoadingSample/types/generators/ScavCaseRewardGenerator.d.ts index 4ba1888..b5935d0 100644 --- a/TypeScript/11BundleLoadingSample/types/generators/ScavCaseRewardGenerator.d.ts +++ b/TypeScript/11BundleLoadingSample/types/generators/ScavCaseRewardGenerator.d.ts @@ -25,6 +25,8 @@ export declare class ScavCaseRewardGenerator { protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected scavCaseConfig: IScavCaseConfig; + protected dbItemsCache: ITemplateItem[]; + protected dbAmmoItemsCache: ITemplateItem[]; constructor(logger: ILogger, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * Create an array of rewards that will be given to the player upon completing their scav case build @@ -33,10 +35,10 @@ export declare class ScavCaseRewardGenerator { */ generate(recipeId: string): Product[]; /** - * Get all db items that are not blacklisted in scavcase config - * @returns filtered array of db items + * Get all db items that are not blacklisted in scavcase config or global blacklist + * Store in class field */ - protected getDbItems(): ITemplateItem[]; + protected cacheDbItems(): void; /** * Pick a number of items to be rewards, the count is defined by the values in * @param items item pool to pick rewards from diff --git a/TypeScript/11BundleLoadingSample/types/generators/WeatherGenerator.d.ts b/TypeScript/11BundleLoadingSample/types/generators/WeatherGenerator.d.ts index 2e2403c..6471bb1 100644 --- a/TypeScript/11BundleLoadingSample/types/generators/WeatherGenerator.d.ts +++ b/TypeScript/11BundleLoadingSample/types/generators/WeatherGenerator.d.ts @@ -52,6 +52,7 @@ export declare class WeatherGenerator { */ protected setCurrentDateTime(weather: IWeather): void; protected getWeightedWindDirection(): WindDirection; + protected getWeightedClouds(): number; protected getWeightedWindSpeed(): number; protected getWeightedFog(): number; protected getWeightedRain(): number; diff --git a/TypeScript/11BundleLoadingSample/types/helpers/HealthHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/HealthHelper.d.ts index 3694a6e..e4cdcd6 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/HealthHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/HealthHelper.d.ts @@ -27,6 +27,7 @@ export declare class HealthHelper { * @param request Heal request * @param sessionID Session id * @param addEffects Should effects be added or removed (default - add) + * @param deleteExistingEffects Should all prior effects be removed before apply new ones */ saveVitality(pmcData: IPmcData, request: ISyncHealthRequestData, sessionID: string, addEffects?: boolean, deleteExistingEffects?: boolean): void; /** diff --git a/TypeScript/11BundleLoadingSample/types/helpers/InRaidHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/InRaidHelper.d.ts index bf584c2..b4c0c1c 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/InRaidHelper.d.ts @@ -53,7 +53,7 @@ export declare class InRaidHelper { * @param victim Who was killed by player * @returns a numerical standing gain or loss */ - protected getStandingChangeForKill(victim: Victim): number; + protected getFenceStandingChangeForKillAsScav(victim: Victim): number; /** * Reset a profile to a baseline, used post-raid * Reset points earned during session property diff --git a/TypeScript/11BundleLoadingSample/types/helpers/ItemHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/ItemHelper.d.ts index 99fca56..00f190f 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/ItemHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/ItemHelper.d.ts @@ -26,6 +26,7 @@ declare class ItemHelper { protected itemBaseClassService: ItemBaseClassService; protected localisationService: LocalisationService; protected localeService: LocaleService; + protected readonly defaultInvalidBaseTypes: string[]; constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, localisationService: LocalisationService, localeService: LocaleService); /** * Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash @@ -67,6 +68,11 @@ declare class ItemHelper { * @returns Price in roubles (undefined if not found) */ getDynamicItemPrice(tpl: string): number; + /** + * Update items upd.StackObjectsCount to be 1 if its upd is missing or StackObjectsCount is undefined + * @param item Item to update + * @returns Fixed item + */ fixItemStackCount(item: Item): Item; /** * AmmoBoxes contain StackSlots which need to be filled for the AmmoBox to have content. @@ -125,19 +131,19 @@ declare class ItemHelper { getItemQualityModifier(item: Item): number; /** * Get a quality value based on a repairable items (weapon/armor) current state between current and max durability - * @param itemDetails - * @param repairable repairable object - * @param item - * @returns a number between 0 and 1 + * @param itemDetails Db details for item we want quality value for + * @param repairable Repairable properties + * @param item Item quality value is for + * @returns A number between 0 and 1 */ protected getRepairableItemQualityValue(itemDetails: ITemplateItem, repairable: Repairable, item: Item): number; /** * Recursive function that looks at every item from parameter and gets their childrens Ids + includes parent item in results - * @param items - * @param itemID + * @param items Array of items (item + possible children) + * @param itemId Parent items id * @returns an array of strings */ - findAndReturnChildrenByItems(items: Item[], itemID: string): string[]; + findAndReturnChildrenByItems(items: Item[], itemId: string): string[]; /** * A variant of findAndReturnChildren where the output is list of item objects instead of their ids. * @param items @@ -164,12 +170,6 @@ declare class ItemHelper { * @returns true if it is a dogtag */ isDogtag(tpl: string): boolean; - /** - * Can the item passed in be sold to a trader because it is raw money - * @param tpl Item template id to check - * @returns true if unsellable - */ - isNotSellable(tpl: string): boolean; /** * Gets the identifier for a child using slotId, locationX and locationY. * @param item @@ -183,19 +183,19 @@ declare class ItemHelper { */ isItemTplStackable(tpl: string): boolean; /** - * split item stack if it exceeds its StackMaxSize property - * @param itemToSplit item being split into smaller stacks + * split item stack if it exceeds its items StackMaxSize property + * @param itemToSplit Item to split into smaller stacks * @returns Array of split items */ splitStack(itemToSplit: Item): Item[]; /** - * Find Barter items in the inventory + * Find Barter items from array of items * @param {string} by tpl or id - * @param {Object} pmcData + * @param {Item[]} items Array of items to iterate over * @param {string} barterItemId * @returns Array of Item objects */ - findBarterItems(by: "tpl" | "id", pmcData: IPmcData, barterItemId: string): Item[]; + findBarterItems(by: "tpl" | "id", items: Item[], barterItemId: string): Item[]; /** * Regenerate all guids with new ids, exceptions are for items that cannot be altered (e.g. stash/sorting table) * @param pmcData Player profile @@ -262,10 +262,21 @@ declare class ItemHelper { * @param minSizePercent % the magazine must be filled to */ fillMagazineWithCartridge(magazine: Item[], magTemplate: ITemplateItem, cartridgeTpl: string, minSizePercent?: number): void; + /** + * Choose a random bullet type from the list of possible a magazine has + * @param magTemplate Magazine template from Db + * @returns Tpl of cartridge + */ protected getRandomValidCaliber(magTemplate: ITemplateItem): string; + /** + * Chose a randomly weighted cartridge that fits + * @param caliber Desired caliber + * @param staticAmmoDist Cartridges and thier weights + * @returns Tpl of cartrdige + */ protected drawAmmoTpl(caliber: string, staticAmmoDist: Record): string; /** - * + * Create a basic cartrige object * @param parentId container cartridges will be placed in * @param ammoTpl Cartridge to insert * @param stackCount Count of cartridges inside parent diff --git a/TypeScript/11BundleLoadingSample/types/helpers/QuestHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/QuestHelper.d.ts index e04b6e0..5c749d3 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/QuestHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/QuestHelper.d.ts @@ -21,6 +21,7 @@ import { DialogueHelper } from "./DialogueHelper"; import { ItemHelper } from "./ItemHelper"; import { PaymentHelper } from "./PaymentHelper"; import { ProfileHelper } from "./ProfileHelper"; +import { QuestConditionHelper } from "./QuestConditionHelper"; import { RagfairServerHelper } from "./RagfairServerHelper"; import { TraderHelper } from "./TraderHelper"; export declare class QuestHelper { @@ -29,6 +30,7 @@ export declare class QuestHelper { protected timeUtil: TimeUtil; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; + protected questConditionHelper: QuestConditionHelper; protected eventOutputHolder: EventOutputHolder; protected databaseServer: DatabaseServer; protected localeService: LocaleService; @@ -41,7 +43,7 @@ export declare class QuestHelper { protected mailSendService: MailSendService; protected configServer: ConfigServer; 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, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, questConditionHelper: QuestConditionHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, mailSendService: MailSendService, configServer: ConfigServer); /** * Get status of a quest in player profile by its id * @param pmcData Profile to search @@ -119,7 +121,7 @@ export declare class QuestHelper { * @param sessionID Session id * @returns Quests accessible to player incuding newly unlocked quests now quest (startedQuestId) was started */ - acceptedUnlocked(startedQuestId: string, sessionID: string): IQuest[]; + getNewlyAccessibleQuestsWhenStartingQuest(startedQuestId: string, sessionID: string): IQuest[]; /** * Get quests that can be shown to player after failing a quest * @param failedQuestId Id of the quest failed by player diff --git a/TypeScript/11BundleLoadingSample/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/RagfairOfferHelper.d.ts index de9d550..0699259 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/RagfairOfferHelper.d.ts @@ -1,4 +1,5 @@ import { IPmcData } from "../models/eft/common/IPmcData"; +import { Item } from "../models/eft/common/tables/IItem"; import { ITraderAssort } from "../models/eft/common/tables/ITrader"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; @@ -13,10 +14,10 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { LocaleService } from "../services/LocaleService"; import { LocalisationService } from "../services/LocalisationService"; +import { MailSendService } from "../services/MailSendService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { HashUtil } from "../utils/HashUtil"; import { TimeUtil } from "../utils/TimeUtil"; -import { DialogueHelper } from "./DialogueHelper"; import { ItemHelper } from "./ItemHelper"; import { PaymentHelper } from "./PaymentHelper"; import { PresetHelper } from "./PresetHelper"; @@ -33,7 +34,6 @@ export declare class RagfairOfferHelper { protected databaseServer: DatabaseServer; protected traderHelper: TraderHelper; protected saveServer: SaveServer; - protected dialogueHelper: DialogueHelper; protected itemHelper: ItemHelper; protected paymentHelper: PaymentHelper; protected presetHelper: PresetHelper; @@ -44,11 +44,12 @@ export declare class RagfairOfferHelper { protected ragfairOfferService: RagfairOfferService; protected localeService: LocaleService; protected localisationService: LocalisationService; + protected mailSendService: MailSendService; protected configServer: ConfigServer; protected static goodSoldTemplate: string; protected ragfairConfig: IRagfairConfig; 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, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, localisationService: LocalisationService, mailSendService: MailSendService, configServer: ConfigServer); /** * Passthrough to ragfairOfferService.getOffers(), get flea offers a player should see * @param searchRequest Data from client @@ -119,19 +120,26 @@ export declare class RagfairOfferHelper { */ protected getProfileOffers(sessionID: string): IRagfairOffer[]; /** - * Delete an offer from a desired profile + * Delete an offer from a desired profile and from ragfair offers * @param sessionID Session id of profile to delete offer from - * @param offerId Offer id to delete + * @param offerId Id of offer to delete */ - protected deleteOfferByOfferId(sessionID: string, offerId: string): void; + protected deleteOfferById(sessionID: string, offerId: string): void; /** * Complete the selling of players' offer * @param sessionID Session id * @param offer Sold offer details * @param boughtAmount Amount item was purchased for - * @returns Client response + * @returns IItemEventRouterResponse */ protected completeOffer(sessionID: string, offer: IRagfairOffer, boughtAmount: number): IItemEventRouterResponse; + /** + * Get a localised message for when players offer has sold on flea + * @param itemTpl Item sold + * @param boughtAmount How many were purchased + * @returns Localised message text + */ + protected getLocalisedOfferSoldMessage(itemTpl: string, boughtAmount: number): string; /** * Should a ragfair offer be visible to the player * @param searchRequest Search request @@ -142,4 +150,12 @@ export declare class RagfairOfferHelper { * @returns True = should be shown to player */ isDisplayableOffer(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, offer: IRagfairOffer, pmcProfile: IPmcData): boolean; + /** + * Is items quality value within desired range + * @param item Item to check quality of + * @param min Desired minimum quality + * @param max Desired maximum quality + * @returns True if in range + */ + protected itemQualityInRange(item: Item, min: number, max: number): boolean; } diff --git a/TypeScript/11BundleLoadingSample/types/helpers/RagfairSellHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/RagfairSellHelper.d.ts index 251d7ca..913b408 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/RagfairSellHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/RagfairSellHelper.d.ts @@ -13,12 +13,12 @@ export declare class RagfairSellHelper { constructor(logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, configServer: ConfigServer); /** * Get the percent chance to sell an item based on its average listed price vs player chosen listing price - * @param baseChancePercent Base chance to sell item * @param averageOfferPriceRub Price of average offer in roubles * @param playerListedPriceRub Price player listed item for in roubles + * @param qualityMultiplier Quality multipler of item being sold * @returns percent value */ - calculateSellChance(baseChancePercent: number, averageOfferPriceRub: number, playerListedPriceRub: number): number; + calculateSellChance(averageOfferPriceRub: number, playerListedPriceRub: number, qualityMultiplier: number): number; /** * Get percent chance to sell an item when price is below items average listing price * @param playerListedPriceRub Price player listed item for in roubles diff --git a/TypeScript/11BundleLoadingSample/types/helpers/TraderHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/TraderHelper.d.ts index c163f7a..6680ccf 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/TraderHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/TraderHelper.d.ts @@ -35,7 +35,7 @@ export declare class TraderHelper { protected highestTraderBuyPriceItems: Record; constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, handbookHelper: HandbookHelper, itemHelper: ItemHelper, playerService: PlayerService, localisationService: LocalisationService, fenceService: FenceService, timeUtil: TimeUtil, randomUtil: RandomUtil, configServer: ConfigServer); getTrader(traderID: string, sessionID: string): ITraderBase; - getTraderAssortsById(traderId: string): ITraderAssort; + getTraderAssortsByTraderId(traderId: string): ITraderAssort; /** * 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 diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/IBotBase.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/IBotBase.d.ts index ee40958..6c7b76f 100644 --- a/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/IBotBase.d.ts @@ -281,7 +281,7 @@ export interface InsuredItem { export interface Hideout { Production: Record; Areas: HideoutArea[]; - Improvements: Record; + Improvement: Record; Seed: number; sptUpdateLastRunTimestamp: number; } diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/health/IHealthTreatmentRequestData.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/health/IHealthTreatmentRequestData.d.ts index 7fb80a8..598e60c 100644 --- a/TypeScript/11BundleLoadingSample/types/models/eft/health/IHealthTreatmentRequestData.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/eft/health/IHealthTreatmentRequestData.d.ts @@ -1,12 +1,14 @@ export interface IHealthTreatmentRequestData { Action: "RestoreHealth"; trader: string; - items: Item[]; + items: Cost[]; difference: Difference; timestamp: number; } -export interface Item { +export interface Cost { + /** Id of stack to take money from */ id: string; + /** Amount of money to take off player for treatment */ count: number; } export interface Difference { @@ -25,5 +27,6 @@ export interface BodyParts { } export interface BodyPart { Health: number; + /** Effects in array are to be removed */ Effects: string[]; } diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/notifier/INotifier.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/notifier/INotifier.d.ts index ce25dee..c6c6979 100644 --- a/TypeScript/11BundleLoadingSample/types/models/eft/notifier/INotifier.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/eft/notifier/INotifier.d.ts @@ -14,6 +14,11 @@ export interface INotification { } export declare enum NotificationType { RAGFAIR_OFFER_SOLD = "RagfairOfferSold", + RAGFAIR_RATING_CHANGE = "RagfairRatingChange", + /** ChatMessageReceived */ NEW_MESSAGE = "new_message", - PING = "ping" + PING = "ping", + TRADER_SUPPLY = "TraderSupply", + TRADER_STANDING = "TraderStanding", + UNLOCK_TRADER = "UnlockTrader" } diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/notifier/ISelectProfileResponse.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/notifier/ISelectProfileResponse.d.ts index ecb668a..f2d6be7 100644 --- a/TypeScript/11BundleLoadingSample/types/models/eft/notifier/ISelectProfileResponse.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/eft/notifier/ISelectProfileResponse.d.ts @@ -1,6 +1,3 @@ -import { INotifierChannel } from "./INotifier"; export interface ISelectProfileResponse { status: string; - notifier: INotifierChannel; - notifierServer: string; } diff --git a/TypeScript/11BundleLoadingSample/types/models/enums/WeatherType.d.ts b/TypeScript/11BundleLoadingSample/types/models/enums/WeatherType.d.ts index d31fefe..503dc30 100644 --- a/TypeScript/11BundleLoadingSample/types/models/enums/WeatherType.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/enums/WeatherType.d.ts @@ -1,19 +1,19 @@ export declare enum WeatherType { - CLEAR_DAY = 1, - CLEAR_WIND = 2, - CLEAR_NIGHT = 3, - PARTLY_CLOUD_DAY = 4, - PARTLY_CLOUD_NIGHT = 5, - CLEAR_FOG_DAY = 6, - CLEAR_FOG_NIGHT = 7, - CLOUDFOG = 8, - FOG = 9, - MOSTLY_CLOUD = 10, - LIGHT_RAIN = 11, - RAIN = 12, - CLOUD_WIND = 13, - CLOUD_WIND_RAIN = 14, - FULL_CLOUD = 15, - THUNDER_CLOUD = 16, - NONE = 0 + CLEAR_DAY = 0, + CLEAR_WIND = 1, + CLEAR_NIGHT = 2, + PARTLY_CLOUD_DAY = 3, + PARTLY_CLOUD_NIGHT = 4, + CLEAR_FOG_DAY = 5, + CLEAR_FOG_NIGHT = 6, + CLOUD_FOG = 7, + FOG = 8, + MOSTLY_CLOUD = 9, + LIGHT_RAIN = 10, + RAIN = 11, + CLOUD_WIND = 12, + CLOUD_WIND_RAIN = 13, + FULL_CLOUD = 14, + THUNDER_CLOUD = 15, + NONE = 16 } diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/config/IRagfairConfig.d.ts index 7c04857..7aea24f 100644 --- a/TypeScript/11BundleLoadingSample/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/spt/config/IRagfairConfig.d.ts @@ -41,7 +41,8 @@ export interface Dynamic { /** Use the highest trader price for an offer if its greater than the price in templates/prices.json */ useTraderPriceForOffersIfHigher: boolean; /** Barter offer specific settings */ - barter: Barter; + barter: IBarterDetails; + pack: IPackDetails; /** Dynamic offer price below handbook adjustment values */ offerAdjustment: OfferAdjustment; /** How many offers should expire before an offer regeneration occurs */ @@ -49,9 +50,7 @@ export interface Dynamic { /** How many offers should be listed */ offerItemCount: MinMax; /** How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) */ - price: MinMax; - /** How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) */ - presetPrice: MinMax; + priceRanges: IPriceRanges; /** Should default presets to listed only or should non-standard presets found in globals.json be listed too */ showDefaultPresetsOnly: boolean; endTimeSeconds: MinMax; @@ -74,7 +73,12 @@ export interface Dynamic { /** Dict of price limits keyed by item type */ unreasonableModPrices: Record; } -export interface Barter { +export interface IPriceRanges { + default: MinMax; + preset: MinMax; + pack: MinMax; +} +export interface IBarterDetails { /** Should barter offers be generated */ enable: boolean; /** Percentage change an offer is listed as a barter */ @@ -90,6 +94,18 @@ export interface Barter { /** Item Tpls to never be turned into a barter */ itemTypeBlacklist: string[]; } +export interface IPackDetails { + /** Should pack offers be generated */ + enable: boolean; + /** Percentage change an offer is listed as a pack */ + chancePercent: number; + /** Min number of required items for a pack */ + itemCountMin: number; + /** Max number of required items for a pack */ + itemCountMax: number; + /** item types to allow being a pack */ + itemTypeWhitelist: string[]; +} export interface OfferAdjustment { /** Shuld offer price be adjusted when below handbook price */ adjustPriceWhenBelowHandbookPrice: boolean; diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/config/IWeatherConfig.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/config/IWeatherConfig.d.ts index 41a1c83..6ecf35b 100644 --- a/TypeScript/11BundleLoadingSample/types/models/spt/config/IWeatherConfig.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/spt/config/IWeatherConfig.d.ts @@ -7,7 +7,7 @@ export interface IWeatherConfig extends IBaseConfig { weather: Weather; } export interface Weather { - clouds: MinMax; + clouds: WeatherSettings; windSpeed: WeatherSettings; windDirection: WeatherSettings; windGustiness: MinMax; diff --git a/TypeScript/11BundleLoadingSample/types/services/HashCacheService.d.ts b/TypeScript/11BundleLoadingSample/types/services/HashCacheService.d.ts index 5320f28..9968478 100644 --- a/TypeScript/11BundleLoadingSample/types/services/HashCacheService.d.ts +++ b/TypeScript/11BundleLoadingSample/types/services/HashCacheService.d.ts @@ -11,7 +11,18 @@ export declare class HashCacheService { protected modHashes: any; protected readonly modCachePath = "./user/cache/modCache.json"; constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); + /** + * Return a stored hash by key + * @param modName Name of mod to get hash for + * @returns Mod hash + */ getStoredModHash(modName: string): string; + /** + * Does the generated hash match the stored hash + * @param modName name of mod + * @param modContent + * @returns True if they match + */ modContentMatchesStoredHash(modName: string, modContent: string): boolean; hashMatchesStoredHash(modName: string, modHash: string): boolean; storeModContent(modName: string, modContent: string): void; diff --git a/TypeScript/11BundleLoadingSample/types/services/MailSendService.d.ts b/TypeScript/11BundleLoadingSample/types/services/MailSendService.d.ts index 19397dc..fe4a7fe 100644 --- a/TypeScript/11BundleLoadingSample/types/services/MailSendService.d.ts +++ b/TypeScript/11BundleLoadingSample/types/services/MailSendService.d.ts @@ -35,7 +35,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendDirectNpcMessageToPlayer(playerId: string, sender: Traders, messageType: MessageType, message: string, items?: Item[], maxStorageTimeSeconds?: any): void; + sendDirectNpcMessageToPlayer(playerId: string, sender: Traders, messageType: MessageType, message: string, items?: Item[], maxStorageTimeSeconds?: any, systemData?: any, ragfair?: any): void; /** * Send a message from an NPC (e.g. prapor) to the player with or without items * @param playerId Players id to send message to @@ -45,7 +45,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendLocalisedNpcMessageToPlayer(playerId: string, sender: Traders, messageType: MessageType, messageLocaleId: string, items?: Item[], maxStorageTimeSeconds?: any, systemData?: any): void; + sendLocalisedNpcMessageToPlayer(playerId: string, sender: Traders, messageType: MessageType, messageLocaleId: string, items?: Item[], maxStorageTimeSeconds?: any, systemData?: any, ragfair?: any): void; /** * Send a message from SYSTEM to the player with or without items * @param playerId Players id to send message to diff --git a/TypeScript/11BundleLoadingSample/types/services/MatchBotDetailsCacheService.d.ts b/TypeScript/11BundleLoadingSample/types/services/MatchBotDetailsCacheService.d.ts index eb365dd..c1bd322 100644 --- a/TypeScript/11BundleLoadingSample/types/services/MatchBotDetailsCacheService.d.ts +++ b/TypeScript/11BundleLoadingSample/types/services/MatchBotDetailsCacheService.d.ts @@ -1,7 +1,7 @@ import { IBotBase } from "../models/eft/common/tables/IBotBase"; import { ILogger } from "../models/spt/utils/ILogger"; import { LocalisationService } from "./LocalisationService"; -/** Cache bots in a dictionary, keyed by the bots name, keying by name isnt idea as its not unique but this is used by the post-raid system which doesnt have any bot ids, only name */ +/** Cache bots in a dictionary, keyed by the bots name, keying by name isnt ideal as its not unique but this is used by the post-raid system which doesnt have any bot ids, only name */ export declare class MatchBotDetailsCacheService { protected logger: ILogger; protected localisationService: LocalisationService; @@ -17,9 +17,9 @@ export declare class MatchBotDetailsCacheService { */ clearCache(): void; /** - * Find a bot in the cache by its name + * Find a bot in the cache by its name and side * @param botName Name of bot to find * @returns Bot details */ - getBotByName(botName: string): IBotBase; + getBotByNameAndSide(botName: string, botSide: string): IBotBase; } diff --git a/TypeScript/11BundleLoadingSample/types/services/ModCompilerService.d.ts b/TypeScript/11BundleLoadingSample/types/services/ModCompilerService.d.ts index a4bf3c8..e306177 100644 --- a/TypeScript/11BundleLoadingSample/types/services/ModCompilerService.d.ts +++ b/TypeScript/11BundleLoadingSample/types/services/ModCompilerService.d.ts @@ -1,14 +1,36 @@ import { CompilerOptions } from "typescript"; import type { ILogger } from "../models/spt/utils/ILogger"; -import { HashCacheService } from "./HashCacheService"; import { VFS } from "../utils/VFS"; +import { HashCacheService } from "./HashCacheService"; export declare class ModCompilerService { protected logger: ILogger; protected hashCacheService: HashCacheService; protected vfs: VFS; constructor(logger: ILogger, hashCacheService: HashCacheService, vfs: VFS); + /** + * Convert a mods TS into JS + * @param modName Name of mod + * @param modPath Dir path to mod + * @param modTypeScriptFiles + * @returns + */ compileMod(modName: string, modPath: string, modTypeScriptFiles: string[]): Promise; + /** + * Convert a TS file into JS + * @param fileNames Paths to TS files + * @param options Compiler options + */ protected compile(fileNames: string[], options: CompilerOptions): Promise; + /** + * Do the files at the provided paths exist + * @param fileNames + * @returns + */ protected areFilesReady(fileNames: string[]): boolean; + /** + * Wait the provided number of milliseconds + * @param ms Milliseconds + * @returns + */ protected delay(ms: number): Promise; } diff --git a/TypeScript/11BundleLoadingSample/types/services/PaymentService.d.ts b/TypeScript/11BundleLoadingSample/types/services/PaymentService.d.ts index 1c9c32b..fb5f92c 100644 --- a/TypeScript/11BundleLoadingSample/types/services/PaymentService.d.ts +++ b/TypeScript/11BundleLoadingSample/types/services/PaymentService.d.ts @@ -61,23 +61,26 @@ export declare class PaymentService { * Get all money stacks in inventory and prioritse items in stash * @param pmcData * @param currencyTpl + * @param playerStashId Players stash id * @returns Sorting money items */ - protected getSortedMoneyItemsInInventory(pmcData: IPmcData, currencyTpl: string): Item[]; + protected getSortedMoneyItemsInInventory(pmcData: IPmcData, currencyTpl: string, playerStashId: string): Item[]; /** * Prioritise player stash first over player inventory * Post-raid healing would often take money out of the players pockets/secure container * @param a First money stack item * @param b Second money stack item * @param inventoryItems players inventory items + * @param playerStashId Players stash id * @returns sort order */ - protected prioritiseStashSort(a: Item, b: Item, inventoryItems: Item[]): number; + protected prioritiseStashSort(a: Item, b: Item, inventoryItems: Item[], playerStashId: string): number; /** * Recursivly check items parents to see if it is inside the players inventory, not stash * @param itemId item id to check * @param inventoryItems player inventory + * @param playerStashId Players stash id * @returns true if its in inventory */ - protected isInInventory(itemId: string, inventoryItems: Item[]): boolean; + protected isInStash(itemId: string, inventoryItems: Item[], playerStashId: string): boolean; } diff --git a/TypeScript/11BundleLoadingSample/types/services/ProfileFixerService.d.ts b/TypeScript/11BundleLoadingSample/types/services/ProfileFixerService.d.ts index c8232fc..bc1e42e 100644 --- a/TypeScript/11BundleLoadingSample/types/services/ProfileFixerService.d.ts +++ b/TypeScript/11BundleLoadingSample/types/services/ProfileFixerService.d.ts @@ -14,6 +14,7 @@ import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; import { Watermark } from "../utils/Watermark"; import { LocalisationService } from "./LocalisationService"; @@ -27,17 +28,19 @@ export declare class ProfileFixerService { protected itemHelper: ItemHelper; protected localisationService: LocalisationService; protected timeUtil: TimeUtil; + protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, profileHelper: ProfileHelper, itemHelper: ItemHelper, localisationService: LocalisationService, timeUtil: TimeUtil, databaseServer: DatabaseServer, configServer: ConfigServer); + constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, profileHelper: ProfileHelper, itemHelper: ItemHelper, localisationService: LocalisationService, timeUtil: TimeUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, configServer: ConfigServer); /** * 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; protected addMissingGunStandContainerImprovements(pmcProfile: IPmcData): void; + protected ensureGunStandLevelsMatch(pmcProfile: IPmcData): void; protected addHideoutAreaStashes(pmcProfile: IPmcData): void; protected addMissingHideoutWallAreas(pmcProfile: IPmcData): void; protected adjustUnreasonableModFleaPrices(): void; @@ -131,4 +134,9 @@ export declare class ProfileFixerService { * @param pmcProfile Profile to add missing IDs to */ addMissingIdsToBonuses(pmcProfile: IPmcData): void; + /** + * At some point the property name was changed,migrate data across to new name + * @param pmcProfile + */ + protected migrateImprovements(pmcProfile: IPmcData): void; } diff --git a/TypeScript/11BundleLoadingSample/types/services/RagfairPriceService.d.ts b/TypeScript/11BundleLoadingSample/types/services/RagfairPriceService.d.ts index e245efa..ff35327 100644 --- a/TypeScript/11BundleLoadingSample/types/services/RagfairPriceService.d.ts +++ b/TypeScript/11BundleLoadingSample/types/services/RagfairPriceService.d.ts @@ -3,6 +3,7 @@ import { HandbookHelper } from "../helpers/HandbookHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { TraderHelper } from "../helpers/TraderHelper"; +import { MinMax } from "../models/common/MinMax"; import { IPreset } from "../models/eft/common/IGlobals"; import { Item } from "../models/eft/common/tables/IItem"; import { IBarterScheme } from "../models/eft/common/tables/ITrader"; @@ -35,10 +36,6 @@ export declare class RagfairPriceService implements OnLoad { * Generate static (handbook) and dynamic (prices.json) flea prices, store inside class as dictionaries */ onLoad(): Promise; - /** - * Add placeholder values for items missing from handbook - */ - protected addMissingHandbookPrices(): void; getRoute(): string; /** * Iterate over all items of type "Item" in db and get template price, store in cache @@ -91,9 +88,17 @@ export declare class RagfairPriceService implements OnLoad { * Generate a currency cost for an item and its mods * @param items Item with mods to get price for * @param desiredCurrency Currency price desired in + * @param isPackOffer Price is for a pack type offer * @returns cost of item in desired currency */ - getDynamicOfferPrice(items: Item[], desiredCurrency: string): number; + getDynamicOfferPriceForOffer(items: Item[], desiredCurrency: string, isPackOffer: boolean): number; + /** + * Get different min/max price multipliers for different offer types (preset/pack/default) + * @param isPreset Offer is a preset + * @param isPack Offer is a pack + * @returns MinMax values + */ + protected getOfferTypeRangeValues(isPreset: boolean, isPack: boolean): MinMax; /** * Check to see if an items price is below its handbook price and adjust accoring to values set to config/ragfair.json * @param itemPrice price of item @@ -104,10 +109,10 @@ export declare class RagfairPriceService implements OnLoad { /** * Multiply the price by a randomised curve where n = 2, shift = 2 * @param existingPrice price to alter - * @param isPreset is the item we're multiplying a preset + * @param rangeValues min and max to adjust price by * @returns multiplied price */ - protected randomisePrice(existingPrice: number, isPreset: boolean): number; + protected randomiseOfferPrice(existingPrice: number, rangeValues: MinMax): number; /** * Calculate the cost of a weapon preset by adding together the price of its mods + base price of default weapon preset * @param item base weapon diff --git a/TypeScript/12ClassExtensionOverride/types/callbacks/GameCallbacks.d.ts b/TypeScript/12ClassExtensionOverride/types/callbacks/GameCallbacks.d.ts index aa80036..46f79f9 100644 --- a/TypeScript/12ClassExtensionOverride/types/callbacks/GameCallbacks.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/callbacks/GameCallbacks.d.ts @@ -1,4 +1,5 @@ import { GameController } from "../controllers/GameController"; +import { OnLoad } from "../di/OnLoad"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { ICheckVersionResponse } from "../models/eft/game/ICheckVersionResponse"; import { ICurrentGroupResponse } from "../models/eft/game/ICurrentGroupResponse"; @@ -15,12 +16,14 @@ import { INullResponseData } from "../models/eft/httpResponse/INullResponseData" import { SaveServer } from "../servers/SaveServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { Watermark } from "../utils/Watermark"; -declare class GameCallbacks { +declare class GameCallbacks implements OnLoad { protected httpResponse: HttpResponseUtil; protected watermark: Watermark; protected saveServer: SaveServer; protected gameController: GameController; constructor(httpResponse: HttpResponseUtil, watermark: Watermark, saveServer: SaveServer, gameController: GameController); + onLoad(): Promise; + getRoute(): string; /** * Handle client/game/version/validate * @returns INullResponseData diff --git a/TypeScript/12ClassExtensionOverride/types/controllers/GameController.d.ts b/TypeScript/12ClassExtensionOverride/types/controllers/GameController.d.ts index 04e3abb..e88610e 100644 --- a/TypeScript/12ClassExtensionOverride/types/controllers/GameController.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/controllers/GameController.d.ts @@ -61,13 +61,14 @@ export declare class GameController { protected pmcConfig: IPmcConfig; protected lootConfig: ILootConfig; constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, randomUtil: RandomUtil, encodingUtil: EncodingUtil, hideoutHelper: HideoutHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, seasonalEventService: SeasonalEventService, itemBaseClassService: ItemBaseClassService, giftService: GiftService, applicationContext: ApplicationContext, configServer: ConfigServer); + load(): void; /** * Handle client/game/start */ gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; protected addCustomLooseLootPositions(): void; protected adjustLooseLootSpawnProbabilities(): void; - protected setHideoutAreasAndCraftsTo30Secs(): void; + protected setHideoutAreasAndCraftsTo40Secs(): void; /** * 3.7.0 moved AIDs to be numeric, old profiles need to be migrated * We store the old AID value in new field `sessionId` diff --git a/TypeScript/12ClassExtensionOverride/types/controllers/HealthController.d.ts b/TypeScript/12ClassExtensionOverride/types/controllers/HealthController.d.ts index 1938297..2d7ff09 100644 --- a/TypeScript/12ClassExtensionOverride/types/controllers/HealthController.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/controllers/HealthController.d.ts @@ -29,34 +29,35 @@ export declare class HealthController { * stores in-raid player health * @param pmcData Player profile * @param info Request data - * @param sessionID + * @param sessionID Player id * @param addEffects Should effects found be added or removed from profile + * @param deleteExistingEffects Should all prior effects be removed before apply new ones */ saveVitality(pmcData: IPmcData, info: ISyncHealthRequestData, sessionID: string, addEffects?: boolean, deleteExistingEffects?: boolean): void; /** * When healing in menu - * @param pmcData - * @param body - * @param sessionID - * @returns + * @param pmcData Player profile + * @param request Healing request + * @param sessionID Player id + * @returns IItemEventRouterResponse */ - offraidHeal(pmcData: IPmcData, body: IOffraidHealRequestData, sessionID: string): IItemEventRouterResponse; + offraidHeal(pmcData: IPmcData, request: IOffraidHealRequestData, sessionID: string): IItemEventRouterResponse; /** * Handle Eat event * Consume food/water outside of a raid * @param pmcData Player profile - * @param body request Object + * @param request Eat request * @param sessionID Session id * @returns IItemEventRouterResponse */ - offraidEat(pmcData: IPmcData, body: IOffraidEatRequestData, sessionID: string): IItemEventRouterResponse; + offraidEat(pmcData: IPmcData, request: IOffraidEatRequestData, sessionID: string): IItemEventRouterResponse; /** * Handle RestoreHealth event * Occurs on post-raid healing page * @param pmcData player profile * @param healthTreatmentRequest Request data from client * @param sessionID Session id - * @returns + * @returns IItemEventRouterResponse */ healthTreatment(pmcData: IPmcData, healthTreatmentRequest: IHealthTreatmentRequestData, sessionID: string): IItemEventRouterResponse; /** @@ -66,12 +67,4 @@ export declare class HealthController { * @param sessionID */ applyWorkoutChanges(pmcData: IPmcData, info: IWorkoutData, sessionId: string): void; - /** - * Iterate over treatment request diff and find effects to remove from player limbs - * @param sessionId - * @param profile Profile to update - * @param treatmentRequest client request - * @param output response to send to client - */ - protected removeEffectsAfterPostRaidHeal(sessionId: string, profile: IPmcData, treatmentRequest: IHealthTreatmentRequestData, output: IItemEventRouterResponse): void; } diff --git a/TypeScript/12ClassExtensionOverride/types/controllers/HideoutController.d.ts b/TypeScript/12ClassExtensionOverride/types/controllers/HideoutController.d.ts index 877c076..a90a16d 100644 --- a/TypeScript/12ClassExtensionOverride/types/controllers/HideoutController.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/controllers/HideoutController.d.ts @@ -88,11 +88,11 @@ export declare class HideoutController { * @param pmcData Profile to edit * @param output Object to send back to client * @param sessionID Session/player id - * @param profileHideoutArea Current hideout data for profile + * @param profileParentHideoutArea Current hideout area for profile * @param dbHideoutArea Hideout area being upgraded * @param hideoutStage Stage hideout area is being upgraded to */ - protected addContainerImprovementToProfile(output: IItemEventRouterResponse, sessionID: string, pmcData: IPmcData, profileHideoutArea: HideoutArea, dbHideoutArea: IHideoutArea, hideoutStage: Stage): void; + protected addContainerImprovementToProfile(output: IItemEventRouterResponse, sessionID: string, pmcData: IPmcData, profileParentHideoutArea: HideoutArea, dbHideoutArea: IHideoutArea, hideoutStage: Stage): void; /** * Add an inventory item to profile from a hideout area stage data * @param pmcData Profile to update diff --git a/TypeScript/12ClassExtensionOverride/types/controllers/LocationController.d.ts b/TypeScript/12ClassExtensionOverride/types/controllers/LocationController.d.ts index 94d496a..94f5fce 100644 --- a/TypeScript/12ClassExtensionOverride/types/controllers/LocationController.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/controllers/LocationController.d.ts @@ -4,6 +4,7 @@ import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { ILocationBase } from "../models/eft/common/ILocationBase"; import { ILocationsGenerateAllResponse } from "../models/eft/common/ILocationsSourceDestinationBase"; import { IAirdropLootResult } from "../models/eft/location/IAirdropLootResult"; +import { IGetLocationRequestData } from "../models/eft/location/IGetLocationRequestData"; import { AirdropTypeEnum } from "../models/enums/AirdropType"; import { IAirdropConfig } from "../models/spt/config/IAirdropConfig"; import { ILocationConfig } from "../models/spt/config/ILocationConfig"; @@ -34,10 +35,11 @@ export declare class LocationController { /** * Handle client/location/getLocalloot * Get a location (map) with generated loot data - * @param location Map to generate loot for + * @param sessionId Player id + * @param request Map request to generate * @returns ILocationBase */ - get(location: string): ILocationBase; + get(sessionId: string, request: IGetLocationRequestData): ILocationBase; /** * Generate a maps base location with loot * @param name Map name diff --git a/TypeScript/12ClassExtensionOverride/types/controllers/QuestController.d.ts b/TypeScript/12ClassExtensionOverride/types/controllers/QuestController.d.ts index 7d494a6..bd8a70f 100644 --- a/TypeScript/12ClassExtensionOverride/types/controllers/QuestController.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/controllers/QuestController.d.ts @@ -61,7 +61,7 @@ export declare class QuestController { * @param playerLevel level of player to test against quest * @returns true if quest can be seen/accepted by player of defined level */ - protected playerLevelFulfillsQuestRequrement(quest: IQuest, playerLevel: number): boolean; + protected playerLevelFulfillsQuestRequirement(quest: IQuest, playerLevel: number): boolean; /** * Should a quest be shown to the player in trader quest screen * @param questId Quest to check diff --git a/TypeScript/12ClassExtensionOverride/types/controllers/RagfairController.d.ts b/TypeScript/12ClassExtensionOverride/types/controllers/RagfairController.d.ts index 76c27f7..bda37cd 100644 --- a/TypeScript/12ClassExtensionOverride/types/controllers/RagfairController.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/controllers/RagfairController.d.ts @@ -21,6 +21,7 @@ import { IGetMarketPriceRequestData } from "../models/eft/ragfair/IGetMarketPric import { IGetOffersResult } from "../models/eft/ragfair/IGetOffersResult"; import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; import { ISearchRequestData } from "../models/eft/ragfair/ISearchRequestData"; +import { IProcessBuyTradeRequestData } from "../models/eft/trade/IProcessBuyTradeRequestData"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; @@ -125,6 +126,18 @@ export declare class RagfairController { * @returns IItemEventRouterResponse */ addPlayerOffer(pmcData: IPmcData, offerRequest: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Charge player a listing fee for using flea, pulls charge from data previously sent by client + * @param sessionID Player id + * @param rootItem Base item being listed (used when client tax cost not found and must be done on server) + * @param pmcData Player profile + * @param requirementsPriceInRub Rouble cost player chose for listing (used when client tax cost not found and must be done on server) + * @param itemStackCount How many items were listed in player (used when client tax cost not found and must be done on server) + * @param offerRequest Add offer request object from client + * @param output IItemEventRouterResponse + * @returns True if charging tax to player failed + */ + protected chargePlayerTaxFee(sessionID: string, rootItem: Item, pmcData: IPmcData, requirementsPriceInRub: number, itemStackCount: number, offerRequest: IAddOfferRequestData, output: IItemEventRouterResponse): boolean; /** * Is the item to be listed on the flea valid * @param offerRequest Client offer request @@ -158,4 +171,11 @@ export declare class RagfairController { */ removeOffer(offerId: string, sessionID: string): IItemEventRouterResponse; extendOffer(info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Create a basic trader request object with price and currency type + * @param currency What currency: RUB, EURO, USD + * @param value Amount of currency + * @returns IProcessBuyTradeRequestData + */ + protected createBuyTradeRequestObject(currency: string, value: number): IProcessBuyTradeRequestData; } diff --git a/TypeScript/12ClassExtensionOverride/types/generators/BotEquipmentModGenerator.d.ts b/TypeScript/12ClassExtensionOverride/types/generators/BotEquipmentModGenerator.d.ts index ccbbbbf..f7abb84 100644 --- a/TypeScript/12ClassExtensionOverride/types/generators/BotEquipmentModGenerator.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/generators/BotEquipmentModGenerator.d.ts @@ -14,7 +14,6 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; import { BotEquipmentModPoolService } from "../services/BotEquipmentModPoolService"; import { BotModLimits, BotWeaponModLimitService } from "../services/BotWeaponModLimitService"; -import { ItemBaseClassService } from "../services/ItemBaseClassService"; import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; @@ -29,7 +28,6 @@ export declare class BotEquipmentModGenerator { protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; protected botEquipmentFilterService: BotEquipmentFilterService; - protected itemBaseClassService: ItemBaseClassService; protected itemFilterService: ItemFilterService; protected profileHelper: ProfileHelper; protected botWeaponModLimitService: BotWeaponModLimitService; @@ -40,7 +38,7 @@ export declare class BotEquipmentModGenerator { protected botEquipmentModPoolService: BotEquipmentModPoolService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, itemHelper: ItemHelper, botEquipmentFilterService: BotEquipmentFilterService, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponModLimitService: BotWeaponModLimitService, botHelper: BotHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, botEquipmentModPoolService: BotEquipmentModPoolService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, itemHelper: ItemHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponModLimitService: BotWeaponModLimitService, botHelper: BotHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, botEquipmentModPoolService: BotEquipmentModPoolService, configServer: ConfigServer); /** * Check mods are compatible and add to array * @param equipment Equipment item to add mods to diff --git a/TypeScript/12ClassExtensionOverride/types/generators/LocationGenerator.d.ts b/TypeScript/12ClassExtensionOverride/types/generators/LocationGenerator.d.ts index b8169d3..46a514b 100644 --- a/TypeScript/12ClassExtensionOverride/types/generators/LocationGenerator.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/generators/LocationGenerator.d.ts @@ -65,10 +65,11 @@ export declare class LocationGenerator { protected getGuaranteedContainers(staticContainersOnMap: IStaticContainerData[]): IStaticContainerData[]; /** * Choose a number of containers based on their probabilty value to fulfil the desired count in containerData.chosenCount + * @param groupId Name of the group the containers are being collected for * @param containerData Containers and probability values for a groupId * @returns List of chosen container Ids */ - protected getContainersByProbabilty(containerData: IContainerGroupCount): string[]; + protected getContainersByProbabilty(groupId: string, containerData: IContainerGroupCount): string[]; /** * Get a mapping of each groupid and the containers in that group + count of containers to spawn on map * @param containersGroups Container group values diff --git a/TypeScript/12ClassExtensionOverride/types/generators/PMCLootGenerator.d.ts b/TypeScript/12ClassExtensionOverride/types/generators/PMCLootGenerator.d.ts index 9acff69..abb5615 100644 --- a/TypeScript/12ClassExtensionOverride/types/generators/PMCLootGenerator.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/generators/PMCLootGenerator.d.ts @@ -31,12 +31,12 @@ export declare class PMCLootGenerator { */ generatePMCVestLootPool(): string[]; /** - * Check if item has a width/height that lets it fit into a 1x2/2x1 slot - * 1x1 / 1x2 / 2x1 + * Check if item has a width/height that lets it fit into a 2x2 slot + * 1x1 / 1x2 / 2x1 / 2x2 * @param item Item to check size of * @returns true if it fits */ - protected itemFitsInto1By2Slot(item: ITemplateItem): boolean; + protected itemFitsInto2By2Slot(item: ITemplateItem): boolean; /** * Create an array of loot items a PMC can have in their backpack * @returns string array of tpls diff --git a/TypeScript/12ClassExtensionOverride/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/12ClassExtensionOverride/types/generators/RagfairOfferGenerator.d.ts index a627191..58e0b68 100644 --- a/TypeScript/12ClassExtensionOverride/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/generators/RagfairOfferGenerator.d.ts @@ -55,11 +55,10 @@ export declare class RagfairOfferGenerator { * @param items Items in the offer * @param barterScheme Cost of item (currency or barter) * @param loyalLevel Loyalty level needed to buy item - * @param price Price of offer - * @param sellInOnePiece Set StackObjectsCount to 1 + * @param sellInOnePiece Flags sellInOnePiece to be true * @returns IRagfairOffer */ - createFleaOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; + createFleaOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, sellInOnePiece?: boolean): IRagfairOffer; /** * Create an offer object ready to send to ragfairOfferService.addOffer() * @param userID Owner of the offer @@ -67,17 +66,16 @@ export declare class RagfairOfferGenerator { * @param items Items in the offer * @param barterScheme Cost of item (currency or barter) * @param loyalLevel Loyalty level needed to buy item - * @param price Price of offer * @param sellInOnePiece Set StackObjectsCount to 1 * @returns IRagfairOffer */ - protected createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; + protected createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, sellInOnePiece?: boolean): IRagfairOffer; /** * Calculate the offer price that's listed on the flea listing * @param offerRequirements barter requirements for offer * @returns rouble cost of offer */ - protected calculateOfferListingPrice(offerRequirements: OfferRequirement[]): number; + protected convertOfferRequirementsIntoRoubles(offerRequirements: OfferRequirement[]): number; /** * Get avatar url from trader table in db * @param isTrader Is user we're getting avatar for a trader @@ -137,7 +135,7 @@ export declare class RagfairOfferGenerator { * @param itemDetails raw db item details * @returns Item array */ - protected createSingleOfferForItem(items: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; + protected createSingleOfferForItem(items: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; /** * Generate trader offers on flea using the traders assort data * @param traderID Trader to generate offers for @@ -151,7 +149,7 @@ export declare class RagfairOfferGenerator { * @param itemDetails db details of first item * @returns */ - protected getItemCondition(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): Item[]; + protected randomiseItemUpdProperties(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): Item[]; /** * Get the relevant condition id if item tpl matches in ragfair.json/condition * @param tpl Item to look for matching condition object @@ -184,7 +182,7 @@ export declare class RagfairOfferGenerator { * @param offerItems Items for sale in offer * @returns Barter scheme */ - protected createBarterRequirement(offerItems: Item[]): IBarterScheme[]; + protected createBarterBarterScheme(offerItems: Item[]): IBarterScheme[]; /** * Get an array of flea prices + item tpl, cached in generator class inside `allowedFleaPriceItemsForBarter` * @returns array with tpl/price values @@ -196,7 +194,9 @@ export declare class RagfairOfferGenerator { /** * Create a random currency-based barter scheme for an array of items * @param offerItems Items on offer + * @param isPackOffer Is the barter scheme being created for a pack offer + * @param multipler What to multiply the resulting price by * @returns Barter scheme for offer */ - protected createCurrencyRequirement(offerItems: Item[]): IBarterScheme[]; + protected createCurrencyBarterScheme(offerItems: Item[], isPackOffer: boolean, multipler?: number): IBarterScheme[]; } diff --git a/TypeScript/12ClassExtensionOverride/types/generators/ScavCaseRewardGenerator.d.ts b/TypeScript/12ClassExtensionOverride/types/generators/ScavCaseRewardGenerator.d.ts index 4ba1888..b5935d0 100644 --- a/TypeScript/12ClassExtensionOverride/types/generators/ScavCaseRewardGenerator.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/generators/ScavCaseRewardGenerator.d.ts @@ -25,6 +25,8 @@ export declare class ScavCaseRewardGenerator { protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected scavCaseConfig: IScavCaseConfig; + protected dbItemsCache: ITemplateItem[]; + protected dbAmmoItemsCache: ITemplateItem[]; constructor(logger: ILogger, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * Create an array of rewards that will be given to the player upon completing their scav case build @@ -33,10 +35,10 @@ export declare class ScavCaseRewardGenerator { */ generate(recipeId: string): Product[]; /** - * Get all db items that are not blacklisted in scavcase config - * @returns filtered array of db items + * Get all db items that are not blacklisted in scavcase config or global blacklist + * Store in class field */ - protected getDbItems(): ITemplateItem[]; + protected cacheDbItems(): void; /** * Pick a number of items to be rewards, the count is defined by the values in * @param items item pool to pick rewards from diff --git a/TypeScript/12ClassExtensionOverride/types/generators/WeatherGenerator.d.ts b/TypeScript/12ClassExtensionOverride/types/generators/WeatherGenerator.d.ts index 2e2403c..6471bb1 100644 --- a/TypeScript/12ClassExtensionOverride/types/generators/WeatherGenerator.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/generators/WeatherGenerator.d.ts @@ -52,6 +52,7 @@ export declare class WeatherGenerator { */ protected setCurrentDateTime(weather: IWeather): void; protected getWeightedWindDirection(): WindDirection; + protected getWeightedClouds(): number; protected getWeightedWindSpeed(): number; protected getWeightedFog(): number; protected getWeightedRain(): number; diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/HealthHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/HealthHelper.d.ts index 3694a6e..e4cdcd6 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/HealthHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/HealthHelper.d.ts @@ -27,6 +27,7 @@ export declare class HealthHelper { * @param request Heal request * @param sessionID Session id * @param addEffects Should effects be added or removed (default - add) + * @param deleteExistingEffects Should all prior effects be removed before apply new ones */ saveVitality(pmcData: IPmcData, request: ISyncHealthRequestData, sessionID: string, addEffects?: boolean, deleteExistingEffects?: boolean): void; /** diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/InRaidHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/InRaidHelper.d.ts index bf584c2..b4c0c1c 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/InRaidHelper.d.ts @@ -53,7 +53,7 @@ export declare class InRaidHelper { * @param victim Who was killed by player * @returns a numerical standing gain or loss */ - protected getStandingChangeForKill(victim: Victim): number; + protected getFenceStandingChangeForKillAsScav(victim: Victim): number; /** * Reset a profile to a baseline, used post-raid * Reset points earned during session property diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/ItemHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/ItemHelper.d.ts index 99fca56..00f190f 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/ItemHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/ItemHelper.d.ts @@ -26,6 +26,7 @@ declare class ItemHelper { protected itemBaseClassService: ItemBaseClassService; protected localisationService: LocalisationService; protected localeService: LocaleService; + protected readonly defaultInvalidBaseTypes: string[]; constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, localisationService: LocalisationService, localeService: LocaleService); /** * Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash @@ -67,6 +68,11 @@ declare class ItemHelper { * @returns Price in roubles (undefined if not found) */ getDynamicItemPrice(tpl: string): number; + /** + * Update items upd.StackObjectsCount to be 1 if its upd is missing or StackObjectsCount is undefined + * @param item Item to update + * @returns Fixed item + */ fixItemStackCount(item: Item): Item; /** * AmmoBoxes contain StackSlots which need to be filled for the AmmoBox to have content. @@ -125,19 +131,19 @@ declare class ItemHelper { getItemQualityModifier(item: Item): number; /** * Get a quality value based on a repairable items (weapon/armor) current state between current and max durability - * @param itemDetails - * @param repairable repairable object - * @param item - * @returns a number between 0 and 1 + * @param itemDetails Db details for item we want quality value for + * @param repairable Repairable properties + * @param item Item quality value is for + * @returns A number between 0 and 1 */ protected getRepairableItemQualityValue(itemDetails: ITemplateItem, repairable: Repairable, item: Item): number; /** * Recursive function that looks at every item from parameter and gets their childrens Ids + includes parent item in results - * @param items - * @param itemID + * @param items Array of items (item + possible children) + * @param itemId Parent items id * @returns an array of strings */ - findAndReturnChildrenByItems(items: Item[], itemID: string): string[]; + findAndReturnChildrenByItems(items: Item[], itemId: string): string[]; /** * A variant of findAndReturnChildren where the output is list of item objects instead of their ids. * @param items @@ -164,12 +170,6 @@ declare class ItemHelper { * @returns true if it is a dogtag */ isDogtag(tpl: string): boolean; - /** - * Can the item passed in be sold to a trader because it is raw money - * @param tpl Item template id to check - * @returns true if unsellable - */ - isNotSellable(tpl: string): boolean; /** * Gets the identifier for a child using slotId, locationX and locationY. * @param item @@ -183,19 +183,19 @@ declare class ItemHelper { */ isItemTplStackable(tpl: string): boolean; /** - * split item stack if it exceeds its StackMaxSize property - * @param itemToSplit item being split into smaller stacks + * split item stack if it exceeds its items StackMaxSize property + * @param itemToSplit Item to split into smaller stacks * @returns Array of split items */ splitStack(itemToSplit: Item): Item[]; /** - * Find Barter items in the inventory + * Find Barter items from array of items * @param {string} by tpl or id - * @param {Object} pmcData + * @param {Item[]} items Array of items to iterate over * @param {string} barterItemId * @returns Array of Item objects */ - findBarterItems(by: "tpl" | "id", pmcData: IPmcData, barterItemId: string): Item[]; + findBarterItems(by: "tpl" | "id", items: Item[], barterItemId: string): Item[]; /** * Regenerate all guids with new ids, exceptions are for items that cannot be altered (e.g. stash/sorting table) * @param pmcData Player profile @@ -262,10 +262,21 @@ declare class ItemHelper { * @param minSizePercent % the magazine must be filled to */ fillMagazineWithCartridge(magazine: Item[], magTemplate: ITemplateItem, cartridgeTpl: string, minSizePercent?: number): void; + /** + * Choose a random bullet type from the list of possible a magazine has + * @param magTemplate Magazine template from Db + * @returns Tpl of cartridge + */ protected getRandomValidCaliber(magTemplate: ITemplateItem): string; + /** + * Chose a randomly weighted cartridge that fits + * @param caliber Desired caliber + * @param staticAmmoDist Cartridges and thier weights + * @returns Tpl of cartrdige + */ protected drawAmmoTpl(caliber: string, staticAmmoDist: Record): string; /** - * + * Create a basic cartrige object * @param parentId container cartridges will be placed in * @param ammoTpl Cartridge to insert * @param stackCount Count of cartridges inside parent diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/QuestHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/QuestHelper.d.ts index e04b6e0..5c749d3 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/QuestHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/QuestHelper.d.ts @@ -21,6 +21,7 @@ import { DialogueHelper } from "./DialogueHelper"; import { ItemHelper } from "./ItemHelper"; import { PaymentHelper } from "./PaymentHelper"; import { ProfileHelper } from "./ProfileHelper"; +import { QuestConditionHelper } from "./QuestConditionHelper"; import { RagfairServerHelper } from "./RagfairServerHelper"; import { TraderHelper } from "./TraderHelper"; export declare class QuestHelper { @@ -29,6 +30,7 @@ export declare class QuestHelper { protected timeUtil: TimeUtil; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; + protected questConditionHelper: QuestConditionHelper; protected eventOutputHolder: EventOutputHolder; protected databaseServer: DatabaseServer; protected localeService: LocaleService; @@ -41,7 +43,7 @@ export declare class QuestHelper { protected mailSendService: MailSendService; protected configServer: ConfigServer; 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, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, questConditionHelper: QuestConditionHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, mailSendService: MailSendService, configServer: ConfigServer); /** * Get status of a quest in player profile by its id * @param pmcData Profile to search @@ -119,7 +121,7 @@ export declare class QuestHelper { * @param sessionID Session id * @returns Quests accessible to player incuding newly unlocked quests now quest (startedQuestId) was started */ - acceptedUnlocked(startedQuestId: string, sessionID: string): IQuest[]; + getNewlyAccessibleQuestsWhenStartingQuest(startedQuestId: string, sessionID: string): IQuest[]; /** * Get quests that can be shown to player after failing a quest * @param failedQuestId Id of the quest failed by player diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/RagfairOfferHelper.d.ts index de9d550..0699259 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/RagfairOfferHelper.d.ts @@ -1,4 +1,5 @@ import { IPmcData } from "../models/eft/common/IPmcData"; +import { Item } from "../models/eft/common/tables/IItem"; import { ITraderAssort } from "../models/eft/common/tables/ITrader"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; @@ -13,10 +14,10 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { LocaleService } from "../services/LocaleService"; import { LocalisationService } from "../services/LocalisationService"; +import { MailSendService } from "../services/MailSendService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { HashUtil } from "../utils/HashUtil"; import { TimeUtil } from "../utils/TimeUtil"; -import { DialogueHelper } from "./DialogueHelper"; import { ItemHelper } from "./ItemHelper"; import { PaymentHelper } from "./PaymentHelper"; import { PresetHelper } from "./PresetHelper"; @@ -33,7 +34,6 @@ export declare class RagfairOfferHelper { protected databaseServer: DatabaseServer; protected traderHelper: TraderHelper; protected saveServer: SaveServer; - protected dialogueHelper: DialogueHelper; protected itemHelper: ItemHelper; protected paymentHelper: PaymentHelper; protected presetHelper: PresetHelper; @@ -44,11 +44,12 @@ export declare class RagfairOfferHelper { protected ragfairOfferService: RagfairOfferService; protected localeService: LocaleService; protected localisationService: LocalisationService; + protected mailSendService: MailSendService; protected configServer: ConfigServer; protected static goodSoldTemplate: string; protected ragfairConfig: IRagfairConfig; 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, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, localisationService: LocalisationService, mailSendService: MailSendService, configServer: ConfigServer); /** * Passthrough to ragfairOfferService.getOffers(), get flea offers a player should see * @param searchRequest Data from client @@ -119,19 +120,26 @@ export declare class RagfairOfferHelper { */ protected getProfileOffers(sessionID: string): IRagfairOffer[]; /** - * Delete an offer from a desired profile + * Delete an offer from a desired profile and from ragfair offers * @param sessionID Session id of profile to delete offer from - * @param offerId Offer id to delete + * @param offerId Id of offer to delete */ - protected deleteOfferByOfferId(sessionID: string, offerId: string): void; + protected deleteOfferById(sessionID: string, offerId: string): void; /** * Complete the selling of players' offer * @param sessionID Session id * @param offer Sold offer details * @param boughtAmount Amount item was purchased for - * @returns Client response + * @returns IItemEventRouterResponse */ protected completeOffer(sessionID: string, offer: IRagfairOffer, boughtAmount: number): IItemEventRouterResponse; + /** + * Get a localised message for when players offer has sold on flea + * @param itemTpl Item sold + * @param boughtAmount How many were purchased + * @returns Localised message text + */ + protected getLocalisedOfferSoldMessage(itemTpl: string, boughtAmount: number): string; /** * Should a ragfair offer be visible to the player * @param searchRequest Search request @@ -142,4 +150,12 @@ export declare class RagfairOfferHelper { * @returns True = should be shown to player */ isDisplayableOffer(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, offer: IRagfairOffer, pmcProfile: IPmcData): boolean; + /** + * Is items quality value within desired range + * @param item Item to check quality of + * @param min Desired minimum quality + * @param max Desired maximum quality + * @returns True if in range + */ + protected itemQualityInRange(item: Item, min: number, max: number): boolean; } diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/RagfairSellHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/RagfairSellHelper.d.ts index 251d7ca..913b408 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/RagfairSellHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/RagfairSellHelper.d.ts @@ -13,12 +13,12 @@ export declare class RagfairSellHelper { constructor(logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, configServer: ConfigServer); /** * Get the percent chance to sell an item based on its average listed price vs player chosen listing price - * @param baseChancePercent Base chance to sell item * @param averageOfferPriceRub Price of average offer in roubles * @param playerListedPriceRub Price player listed item for in roubles + * @param qualityMultiplier Quality multipler of item being sold * @returns percent value */ - calculateSellChance(baseChancePercent: number, averageOfferPriceRub: number, playerListedPriceRub: number): number; + calculateSellChance(averageOfferPriceRub: number, playerListedPriceRub: number, qualityMultiplier: number): number; /** * Get percent chance to sell an item when price is below items average listing price * @param playerListedPriceRub Price player listed item for in roubles diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/TraderHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/TraderHelper.d.ts index c163f7a..6680ccf 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/TraderHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/TraderHelper.d.ts @@ -35,7 +35,7 @@ export declare class TraderHelper { protected highestTraderBuyPriceItems: Record; constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, handbookHelper: HandbookHelper, itemHelper: ItemHelper, playerService: PlayerService, localisationService: LocalisationService, fenceService: FenceService, timeUtil: TimeUtil, randomUtil: RandomUtil, configServer: ConfigServer); getTrader(traderID: string, sessionID: string): ITraderBase; - getTraderAssortsById(traderId: string): ITraderAssort; + getTraderAssortsByTraderId(traderId: string): ITraderAssort; /** * 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 diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/IBotBase.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/IBotBase.d.ts index ee40958..6c7b76f 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/IBotBase.d.ts @@ -281,7 +281,7 @@ export interface InsuredItem { export interface Hideout { Production: Record; Areas: HideoutArea[]; - Improvements: Record; + Improvement: Record; Seed: number; sptUpdateLastRunTimestamp: number; } diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/health/IHealthTreatmentRequestData.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/health/IHealthTreatmentRequestData.d.ts index 7fb80a8..598e60c 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/eft/health/IHealthTreatmentRequestData.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/health/IHealthTreatmentRequestData.d.ts @@ -1,12 +1,14 @@ export interface IHealthTreatmentRequestData { Action: "RestoreHealth"; trader: string; - items: Item[]; + items: Cost[]; difference: Difference; timestamp: number; } -export interface Item { +export interface Cost { + /** Id of stack to take money from */ id: string; + /** Amount of money to take off player for treatment */ count: number; } export interface Difference { @@ -25,5 +27,6 @@ export interface BodyParts { } export interface BodyPart { Health: number; + /** Effects in array are to be removed */ Effects: string[]; } diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/notifier/INotifier.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/notifier/INotifier.d.ts index ce25dee..c6c6979 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/eft/notifier/INotifier.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/notifier/INotifier.d.ts @@ -14,6 +14,11 @@ export interface INotification { } export declare enum NotificationType { RAGFAIR_OFFER_SOLD = "RagfairOfferSold", + RAGFAIR_RATING_CHANGE = "RagfairRatingChange", + /** ChatMessageReceived */ NEW_MESSAGE = "new_message", - PING = "ping" + PING = "ping", + TRADER_SUPPLY = "TraderSupply", + TRADER_STANDING = "TraderStanding", + UNLOCK_TRADER = "UnlockTrader" } diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/notifier/ISelectProfileResponse.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/notifier/ISelectProfileResponse.d.ts index ecb668a..f2d6be7 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/eft/notifier/ISelectProfileResponse.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/notifier/ISelectProfileResponse.d.ts @@ -1,6 +1,3 @@ -import { INotifierChannel } from "./INotifier"; export interface ISelectProfileResponse { status: string; - notifier: INotifierChannel; - notifierServer: string; } diff --git a/TypeScript/12ClassExtensionOverride/types/models/enums/WeatherType.d.ts b/TypeScript/12ClassExtensionOverride/types/models/enums/WeatherType.d.ts index d31fefe..503dc30 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/enums/WeatherType.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/enums/WeatherType.d.ts @@ -1,19 +1,19 @@ export declare enum WeatherType { - CLEAR_DAY = 1, - CLEAR_WIND = 2, - CLEAR_NIGHT = 3, - PARTLY_CLOUD_DAY = 4, - PARTLY_CLOUD_NIGHT = 5, - CLEAR_FOG_DAY = 6, - CLEAR_FOG_NIGHT = 7, - CLOUDFOG = 8, - FOG = 9, - MOSTLY_CLOUD = 10, - LIGHT_RAIN = 11, - RAIN = 12, - CLOUD_WIND = 13, - CLOUD_WIND_RAIN = 14, - FULL_CLOUD = 15, - THUNDER_CLOUD = 16, - NONE = 0 + CLEAR_DAY = 0, + CLEAR_WIND = 1, + CLEAR_NIGHT = 2, + PARTLY_CLOUD_DAY = 3, + PARTLY_CLOUD_NIGHT = 4, + CLEAR_FOG_DAY = 5, + CLEAR_FOG_NIGHT = 6, + CLOUD_FOG = 7, + FOG = 8, + MOSTLY_CLOUD = 9, + LIGHT_RAIN = 10, + RAIN = 11, + CLOUD_WIND = 12, + CLOUD_WIND_RAIN = 13, + FULL_CLOUD = 14, + THUNDER_CLOUD = 15, + NONE = 16 } diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IRagfairConfig.d.ts index 7c04857..7aea24f 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IRagfairConfig.d.ts @@ -41,7 +41,8 @@ export interface Dynamic { /** Use the highest trader price for an offer if its greater than the price in templates/prices.json */ useTraderPriceForOffersIfHigher: boolean; /** Barter offer specific settings */ - barter: Barter; + barter: IBarterDetails; + pack: IPackDetails; /** Dynamic offer price below handbook adjustment values */ offerAdjustment: OfferAdjustment; /** How many offers should expire before an offer regeneration occurs */ @@ -49,9 +50,7 @@ export interface Dynamic { /** How many offers should be listed */ offerItemCount: MinMax; /** How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) */ - price: MinMax; - /** How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) */ - presetPrice: MinMax; + priceRanges: IPriceRanges; /** Should default presets to listed only or should non-standard presets found in globals.json be listed too */ showDefaultPresetsOnly: boolean; endTimeSeconds: MinMax; @@ -74,7 +73,12 @@ export interface Dynamic { /** Dict of price limits keyed by item type */ unreasonableModPrices: Record; } -export interface Barter { +export interface IPriceRanges { + default: MinMax; + preset: MinMax; + pack: MinMax; +} +export interface IBarterDetails { /** Should barter offers be generated */ enable: boolean; /** Percentage change an offer is listed as a barter */ @@ -90,6 +94,18 @@ export interface Barter { /** Item Tpls to never be turned into a barter */ itemTypeBlacklist: string[]; } +export interface IPackDetails { + /** Should pack offers be generated */ + enable: boolean; + /** Percentage change an offer is listed as a pack */ + chancePercent: number; + /** Min number of required items for a pack */ + itemCountMin: number; + /** Max number of required items for a pack */ + itemCountMax: number; + /** item types to allow being a pack */ + itemTypeWhitelist: string[]; +} export interface OfferAdjustment { /** Shuld offer price be adjusted when below handbook price */ adjustPriceWhenBelowHandbookPrice: boolean; diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/config/IWeatherConfig.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IWeatherConfig.d.ts index 41a1c83..6ecf35b 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/spt/config/IWeatherConfig.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IWeatherConfig.d.ts @@ -7,7 +7,7 @@ export interface IWeatherConfig extends IBaseConfig { weather: Weather; } export interface Weather { - clouds: MinMax; + clouds: WeatherSettings; windSpeed: WeatherSettings; windDirection: WeatherSettings; windGustiness: MinMax; diff --git a/TypeScript/12ClassExtensionOverride/types/services/HashCacheService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/HashCacheService.d.ts index 5320f28..9968478 100644 --- a/TypeScript/12ClassExtensionOverride/types/services/HashCacheService.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/services/HashCacheService.d.ts @@ -11,7 +11,18 @@ export declare class HashCacheService { protected modHashes: any; protected readonly modCachePath = "./user/cache/modCache.json"; constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); + /** + * Return a stored hash by key + * @param modName Name of mod to get hash for + * @returns Mod hash + */ getStoredModHash(modName: string): string; + /** + * Does the generated hash match the stored hash + * @param modName name of mod + * @param modContent + * @returns True if they match + */ modContentMatchesStoredHash(modName: string, modContent: string): boolean; hashMatchesStoredHash(modName: string, modHash: string): boolean; storeModContent(modName: string, modContent: string): void; diff --git a/TypeScript/12ClassExtensionOverride/types/services/MailSendService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/MailSendService.d.ts index 19397dc..fe4a7fe 100644 --- a/TypeScript/12ClassExtensionOverride/types/services/MailSendService.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/services/MailSendService.d.ts @@ -35,7 +35,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendDirectNpcMessageToPlayer(playerId: string, sender: Traders, messageType: MessageType, message: string, items?: Item[], maxStorageTimeSeconds?: any): void; + sendDirectNpcMessageToPlayer(playerId: string, sender: Traders, messageType: MessageType, message: string, items?: Item[], maxStorageTimeSeconds?: any, systemData?: any, ragfair?: any): void; /** * Send a message from an NPC (e.g. prapor) to the player with or without items * @param playerId Players id to send message to @@ -45,7 +45,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendLocalisedNpcMessageToPlayer(playerId: string, sender: Traders, messageType: MessageType, messageLocaleId: string, items?: Item[], maxStorageTimeSeconds?: any, systemData?: any): void; + sendLocalisedNpcMessageToPlayer(playerId: string, sender: Traders, messageType: MessageType, messageLocaleId: string, items?: Item[], maxStorageTimeSeconds?: any, systemData?: any, ragfair?: any): void; /** * Send a message from SYSTEM to the player with or without items * @param playerId Players id to send message to diff --git a/TypeScript/12ClassExtensionOverride/types/services/MatchBotDetailsCacheService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/MatchBotDetailsCacheService.d.ts index eb365dd..c1bd322 100644 --- a/TypeScript/12ClassExtensionOverride/types/services/MatchBotDetailsCacheService.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/services/MatchBotDetailsCacheService.d.ts @@ -1,7 +1,7 @@ import { IBotBase } from "../models/eft/common/tables/IBotBase"; import { ILogger } from "../models/spt/utils/ILogger"; import { LocalisationService } from "./LocalisationService"; -/** Cache bots in a dictionary, keyed by the bots name, keying by name isnt idea as its not unique but this is used by the post-raid system which doesnt have any bot ids, only name */ +/** Cache bots in a dictionary, keyed by the bots name, keying by name isnt ideal as its not unique but this is used by the post-raid system which doesnt have any bot ids, only name */ export declare class MatchBotDetailsCacheService { protected logger: ILogger; protected localisationService: LocalisationService; @@ -17,9 +17,9 @@ export declare class MatchBotDetailsCacheService { */ clearCache(): void; /** - * Find a bot in the cache by its name + * Find a bot in the cache by its name and side * @param botName Name of bot to find * @returns Bot details */ - getBotByName(botName: string): IBotBase; + getBotByNameAndSide(botName: string, botSide: string): IBotBase; } diff --git a/TypeScript/12ClassExtensionOverride/types/services/ModCompilerService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/ModCompilerService.d.ts index a4bf3c8..e306177 100644 --- a/TypeScript/12ClassExtensionOverride/types/services/ModCompilerService.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/services/ModCompilerService.d.ts @@ -1,14 +1,36 @@ import { CompilerOptions } from "typescript"; import type { ILogger } from "../models/spt/utils/ILogger"; -import { HashCacheService } from "./HashCacheService"; import { VFS } from "../utils/VFS"; +import { HashCacheService } from "./HashCacheService"; export declare class ModCompilerService { protected logger: ILogger; protected hashCacheService: HashCacheService; protected vfs: VFS; constructor(logger: ILogger, hashCacheService: HashCacheService, vfs: VFS); + /** + * Convert a mods TS into JS + * @param modName Name of mod + * @param modPath Dir path to mod + * @param modTypeScriptFiles + * @returns + */ compileMod(modName: string, modPath: string, modTypeScriptFiles: string[]): Promise; + /** + * Convert a TS file into JS + * @param fileNames Paths to TS files + * @param options Compiler options + */ protected compile(fileNames: string[], options: CompilerOptions): Promise; + /** + * Do the files at the provided paths exist + * @param fileNames + * @returns + */ protected areFilesReady(fileNames: string[]): boolean; + /** + * Wait the provided number of milliseconds + * @param ms Milliseconds + * @returns + */ protected delay(ms: number): Promise; } diff --git a/TypeScript/12ClassExtensionOverride/types/services/PaymentService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/PaymentService.d.ts index 1c9c32b..fb5f92c 100644 --- a/TypeScript/12ClassExtensionOverride/types/services/PaymentService.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/services/PaymentService.d.ts @@ -61,23 +61,26 @@ export declare class PaymentService { * Get all money stacks in inventory and prioritse items in stash * @param pmcData * @param currencyTpl + * @param playerStashId Players stash id * @returns Sorting money items */ - protected getSortedMoneyItemsInInventory(pmcData: IPmcData, currencyTpl: string): Item[]; + protected getSortedMoneyItemsInInventory(pmcData: IPmcData, currencyTpl: string, playerStashId: string): Item[]; /** * Prioritise player stash first over player inventory * Post-raid healing would often take money out of the players pockets/secure container * @param a First money stack item * @param b Second money stack item * @param inventoryItems players inventory items + * @param playerStashId Players stash id * @returns sort order */ - protected prioritiseStashSort(a: Item, b: Item, inventoryItems: Item[]): number; + protected prioritiseStashSort(a: Item, b: Item, inventoryItems: Item[], playerStashId: string): number; /** * Recursivly check items parents to see if it is inside the players inventory, not stash * @param itemId item id to check * @param inventoryItems player inventory + * @param playerStashId Players stash id * @returns true if its in inventory */ - protected isInInventory(itemId: string, inventoryItems: Item[]): boolean; + protected isInStash(itemId: string, inventoryItems: Item[], playerStashId: string): boolean; } diff --git a/TypeScript/12ClassExtensionOverride/types/services/ProfileFixerService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/ProfileFixerService.d.ts index c8232fc..bc1e42e 100644 --- a/TypeScript/12ClassExtensionOverride/types/services/ProfileFixerService.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/services/ProfileFixerService.d.ts @@ -14,6 +14,7 @@ import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; import { Watermark } from "../utils/Watermark"; import { LocalisationService } from "./LocalisationService"; @@ -27,17 +28,19 @@ export declare class ProfileFixerService { protected itemHelper: ItemHelper; protected localisationService: LocalisationService; protected timeUtil: TimeUtil; + protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, profileHelper: ProfileHelper, itemHelper: ItemHelper, localisationService: LocalisationService, timeUtil: TimeUtil, databaseServer: DatabaseServer, configServer: ConfigServer); + constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, profileHelper: ProfileHelper, itemHelper: ItemHelper, localisationService: LocalisationService, timeUtil: TimeUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, configServer: ConfigServer); /** * 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; protected addMissingGunStandContainerImprovements(pmcProfile: IPmcData): void; + protected ensureGunStandLevelsMatch(pmcProfile: IPmcData): void; protected addHideoutAreaStashes(pmcProfile: IPmcData): void; protected addMissingHideoutWallAreas(pmcProfile: IPmcData): void; protected adjustUnreasonableModFleaPrices(): void; @@ -131,4 +134,9 @@ export declare class ProfileFixerService { * @param pmcProfile Profile to add missing IDs to */ addMissingIdsToBonuses(pmcProfile: IPmcData): void; + /** + * At some point the property name was changed,migrate data across to new name + * @param pmcProfile + */ + protected migrateImprovements(pmcProfile: IPmcData): void; } diff --git a/TypeScript/12ClassExtensionOverride/types/services/RagfairPriceService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/RagfairPriceService.d.ts index e245efa..ff35327 100644 --- a/TypeScript/12ClassExtensionOverride/types/services/RagfairPriceService.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/services/RagfairPriceService.d.ts @@ -3,6 +3,7 @@ import { HandbookHelper } from "../helpers/HandbookHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { TraderHelper } from "../helpers/TraderHelper"; +import { MinMax } from "../models/common/MinMax"; import { IPreset } from "../models/eft/common/IGlobals"; import { Item } from "../models/eft/common/tables/IItem"; import { IBarterScheme } from "../models/eft/common/tables/ITrader"; @@ -35,10 +36,6 @@ export declare class RagfairPriceService implements OnLoad { * Generate static (handbook) and dynamic (prices.json) flea prices, store inside class as dictionaries */ onLoad(): Promise; - /** - * Add placeholder values for items missing from handbook - */ - protected addMissingHandbookPrices(): void; getRoute(): string; /** * Iterate over all items of type "Item" in db and get template price, store in cache @@ -91,9 +88,17 @@ export declare class RagfairPriceService implements OnLoad { * Generate a currency cost for an item and its mods * @param items Item with mods to get price for * @param desiredCurrency Currency price desired in + * @param isPackOffer Price is for a pack type offer * @returns cost of item in desired currency */ - getDynamicOfferPrice(items: Item[], desiredCurrency: string): number; + getDynamicOfferPriceForOffer(items: Item[], desiredCurrency: string, isPackOffer: boolean): number; + /** + * Get different min/max price multipliers for different offer types (preset/pack/default) + * @param isPreset Offer is a preset + * @param isPack Offer is a pack + * @returns MinMax values + */ + protected getOfferTypeRangeValues(isPreset: boolean, isPack: boolean): MinMax; /** * Check to see if an items price is below its handbook price and adjust accoring to values set to config/ragfair.json * @param itemPrice price of item @@ -104,10 +109,10 @@ export declare class RagfairPriceService implements OnLoad { /** * Multiply the price by a randomised curve where n = 2, shift = 2 * @param existingPrice price to alter - * @param isPreset is the item we're multiplying a preset + * @param rangeValues min and max to adjust price by * @returns multiplied price */ - protected randomisePrice(existingPrice: number, isPreset: boolean): number; + protected randomiseOfferPrice(existingPrice: number, rangeValues: MinMax): number; /** * Calculate the cost of a weapon preset by adding together the price of its mods + base price of default weapon preset * @param item base weapon diff --git a/TypeScript/13AddTrader/types/callbacks/GameCallbacks.d.ts b/TypeScript/13AddTrader/types/callbacks/GameCallbacks.d.ts index aa80036..46f79f9 100644 --- a/TypeScript/13AddTrader/types/callbacks/GameCallbacks.d.ts +++ b/TypeScript/13AddTrader/types/callbacks/GameCallbacks.d.ts @@ -1,4 +1,5 @@ import { GameController } from "../controllers/GameController"; +import { OnLoad } from "../di/OnLoad"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { ICheckVersionResponse } from "../models/eft/game/ICheckVersionResponse"; import { ICurrentGroupResponse } from "../models/eft/game/ICurrentGroupResponse"; @@ -15,12 +16,14 @@ import { INullResponseData } from "../models/eft/httpResponse/INullResponseData" import { SaveServer } from "../servers/SaveServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { Watermark } from "../utils/Watermark"; -declare class GameCallbacks { +declare class GameCallbacks implements OnLoad { protected httpResponse: HttpResponseUtil; protected watermark: Watermark; protected saveServer: SaveServer; protected gameController: GameController; constructor(httpResponse: HttpResponseUtil, watermark: Watermark, saveServer: SaveServer, gameController: GameController); + onLoad(): Promise; + getRoute(): string; /** * Handle client/game/version/validate * @returns INullResponseData diff --git a/TypeScript/13AddTrader/types/controllers/GameController.d.ts b/TypeScript/13AddTrader/types/controllers/GameController.d.ts index 04e3abb..e88610e 100644 --- a/TypeScript/13AddTrader/types/controllers/GameController.d.ts +++ b/TypeScript/13AddTrader/types/controllers/GameController.d.ts @@ -61,13 +61,14 @@ export declare class GameController { protected pmcConfig: IPmcConfig; protected lootConfig: ILootConfig; constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, randomUtil: RandomUtil, encodingUtil: EncodingUtil, hideoutHelper: HideoutHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, seasonalEventService: SeasonalEventService, itemBaseClassService: ItemBaseClassService, giftService: GiftService, applicationContext: ApplicationContext, configServer: ConfigServer); + load(): void; /** * Handle client/game/start */ gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; protected addCustomLooseLootPositions(): void; protected adjustLooseLootSpawnProbabilities(): void; - protected setHideoutAreasAndCraftsTo30Secs(): void; + protected setHideoutAreasAndCraftsTo40Secs(): void; /** * 3.7.0 moved AIDs to be numeric, old profiles need to be migrated * We store the old AID value in new field `sessionId` diff --git a/TypeScript/13AddTrader/types/controllers/HealthController.d.ts b/TypeScript/13AddTrader/types/controllers/HealthController.d.ts index 1938297..2d7ff09 100644 --- a/TypeScript/13AddTrader/types/controllers/HealthController.d.ts +++ b/TypeScript/13AddTrader/types/controllers/HealthController.d.ts @@ -29,34 +29,35 @@ export declare class HealthController { * stores in-raid player health * @param pmcData Player profile * @param info Request data - * @param sessionID + * @param sessionID Player id * @param addEffects Should effects found be added or removed from profile + * @param deleteExistingEffects Should all prior effects be removed before apply new ones */ saveVitality(pmcData: IPmcData, info: ISyncHealthRequestData, sessionID: string, addEffects?: boolean, deleteExistingEffects?: boolean): void; /** * When healing in menu - * @param pmcData - * @param body - * @param sessionID - * @returns + * @param pmcData Player profile + * @param request Healing request + * @param sessionID Player id + * @returns IItemEventRouterResponse */ - offraidHeal(pmcData: IPmcData, body: IOffraidHealRequestData, sessionID: string): IItemEventRouterResponse; + offraidHeal(pmcData: IPmcData, request: IOffraidHealRequestData, sessionID: string): IItemEventRouterResponse; /** * Handle Eat event * Consume food/water outside of a raid * @param pmcData Player profile - * @param body request Object + * @param request Eat request * @param sessionID Session id * @returns IItemEventRouterResponse */ - offraidEat(pmcData: IPmcData, body: IOffraidEatRequestData, sessionID: string): IItemEventRouterResponse; + offraidEat(pmcData: IPmcData, request: IOffraidEatRequestData, sessionID: string): IItemEventRouterResponse; /** * Handle RestoreHealth event * Occurs on post-raid healing page * @param pmcData player profile * @param healthTreatmentRequest Request data from client * @param sessionID Session id - * @returns + * @returns IItemEventRouterResponse */ healthTreatment(pmcData: IPmcData, healthTreatmentRequest: IHealthTreatmentRequestData, sessionID: string): IItemEventRouterResponse; /** @@ -66,12 +67,4 @@ export declare class HealthController { * @param sessionID */ applyWorkoutChanges(pmcData: IPmcData, info: IWorkoutData, sessionId: string): void; - /** - * Iterate over treatment request diff and find effects to remove from player limbs - * @param sessionId - * @param profile Profile to update - * @param treatmentRequest client request - * @param output response to send to client - */ - protected removeEffectsAfterPostRaidHeal(sessionId: string, profile: IPmcData, treatmentRequest: IHealthTreatmentRequestData, output: IItemEventRouterResponse): void; } diff --git a/TypeScript/13AddTrader/types/controllers/HideoutController.d.ts b/TypeScript/13AddTrader/types/controllers/HideoutController.d.ts index 877c076..a90a16d 100644 --- a/TypeScript/13AddTrader/types/controllers/HideoutController.d.ts +++ b/TypeScript/13AddTrader/types/controllers/HideoutController.d.ts @@ -88,11 +88,11 @@ export declare class HideoutController { * @param pmcData Profile to edit * @param output Object to send back to client * @param sessionID Session/player id - * @param profileHideoutArea Current hideout data for profile + * @param profileParentHideoutArea Current hideout area for profile * @param dbHideoutArea Hideout area being upgraded * @param hideoutStage Stage hideout area is being upgraded to */ - protected addContainerImprovementToProfile(output: IItemEventRouterResponse, sessionID: string, pmcData: IPmcData, profileHideoutArea: HideoutArea, dbHideoutArea: IHideoutArea, hideoutStage: Stage): void; + protected addContainerImprovementToProfile(output: IItemEventRouterResponse, sessionID: string, pmcData: IPmcData, profileParentHideoutArea: HideoutArea, dbHideoutArea: IHideoutArea, hideoutStage: Stage): void; /** * Add an inventory item to profile from a hideout area stage data * @param pmcData Profile to update diff --git a/TypeScript/13AddTrader/types/controllers/LocationController.d.ts b/TypeScript/13AddTrader/types/controllers/LocationController.d.ts index 94d496a..94f5fce 100644 --- a/TypeScript/13AddTrader/types/controllers/LocationController.d.ts +++ b/TypeScript/13AddTrader/types/controllers/LocationController.d.ts @@ -4,6 +4,7 @@ import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { ILocationBase } from "../models/eft/common/ILocationBase"; import { ILocationsGenerateAllResponse } from "../models/eft/common/ILocationsSourceDestinationBase"; import { IAirdropLootResult } from "../models/eft/location/IAirdropLootResult"; +import { IGetLocationRequestData } from "../models/eft/location/IGetLocationRequestData"; import { AirdropTypeEnum } from "../models/enums/AirdropType"; import { IAirdropConfig } from "../models/spt/config/IAirdropConfig"; import { ILocationConfig } from "../models/spt/config/ILocationConfig"; @@ -34,10 +35,11 @@ export declare class LocationController { /** * Handle client/location/getLocalloot * Get a location (map) with generated loot data - * @param location Map to generate loot for + * @param sessionId Player id + * @param request Map request to generate * @returns ILocationBase */ - get(location: string): ILocationBase; + get(sessionId: string, request: IGetLocationRequestData): ILocationBase; /** * Generate a maps base location with loot * @param name Map name diff --git a/TypeScript/13AddTrader/types/controllers/QuestController.d.ts b/TypeScript/13AddTrader/types/controllers/QuestController.d.ts index 7d494a6..bd8a70f 100644 --- a/TypeScript/13AddTrader/types/controllers/QuestController.d.ts +++ b/TypeScript/13AddTrader/types/controllers/QuestController.d.ts @@ -61,7 +61,7 @@ export declare class QuestController { * @param playerLevel level of player to test against quest * @returns true if quest can be seen/accepted by player of defined level */ - protected playerLevelFulfillsQuestRequrement(quest: IQuest, playerLevel: number): boolean; + protected playerLevelFulfillsQuestRequirement(quest: IQuest, playerLevel: number): boolean; /** * Should a quest be shown to the player in trader quest screen * @param questId Quest to check diff --git a/TypeScript/13AddTrader/types/controllers/RagfairController.d.ts b/TypeScript/13AddTrader/types/controllers/RagfairController.d.ts index 76c27f7..bda37cd 100644 --- a/TypeScript/13AddTrader/types/controllers/RagfairController.d.ts +++ b/TypeScript/13AddTrader/types/controllers/RagfairController.d.ts @@ -21,6 +21,7 @@ import { IGetMarketPriceRequestData } from "../models/eft/ragfair/IGetMarketPric import { IGetOffersResult } from "../models/eft/ragfair/IGetOffersResult"; import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; import { ISearchRequestData } from "../models/eft/ragfair/ISearchRequestData"; +import { IProcessBuyTradeRequestData } from "../models/eft/trade/IProcessBuyTradeRequestData"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; @@ -125,6 +126,18 @@ export declare class RagfairController { * @returns IItemEventRouterResponse */ addPlayerOffer(pmcData: IPmcData, offerRequest: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Charge player a listing fee for using flea, pulls charge from data previously sent by client + * @param sessionID Player id + * @param rootItem Base item being listed (used when client tax cost not found and must be done on server) + * @param pmcData Player profile + * @param requirementsPriceInRub Rouble cost player chose for listing (used when client tax cost not found and must be done on server) + * @param itemStackCount How many items were listed in player (used when client tax cost not found and must be done on server) + * @param offerRequest Add offer request object from client + * @param output IItemEventRouterResponse + * @returns True if charging tax to player failed + */ + protected chargePlayerTaxFee(sessionID: string, rootItem: Item, pmcData: IPmcData, requirementsPriceInRub: number, itemStackCount: number, offerRequest: IAddOfferRequestData, output: IItemEventRouterResponse): boolean; /** * Is the item to be listed on the flea valid * @param offerRequest Client offer request @@ -158,4 +171,11 @@ export declare class RagfairController { */ removeOffer(offerId: string, sessionID: string): IItemEventRouterResponse; extendOffer(info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Create a basic trader request object with price and currency type + * @param currency What currency: RUB, EURO, USD + * @param value Amount of currency + * @returns IProcessBuyTradeRequestData + */ + protected createBuyTradeRequestObject(currency: string, value: number): IProcessBuyTradeRequestData; } diff --git a/TypeScript/13AddTrader/types/generators/BotEquipmentModGenerator.d.ts b/TypeScript/13AddTrader/types/generators/BotEquipmentModGenerator.d.ts index ccbbbbf..f7abb84 100644 --- a/TypeScript/13AddTrader/types/generators/BotEquipmentModGenerator.d.ts +++ b/TypeScript/13AddTrader/types/generators/BotEquipmentModGenerator.d.ts @@ -14,7 +14,6 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; import { BotEquipmentModPoolService } from "../services/BotEquipmentModPoolService"; import { BotModLimits, BotWeaponModLimitService } from "../services/BotWeaponModLimitService"; -import { ItemBaseClassService } from "../services/ItemBaseClassService"; import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; @@ -29,7 +28,6 @@ export declare class BotEquipmentModGenerator { protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; protected botEquipmentFilterService: BotEquipmentFilterService; - protected itemBaseClassService: ItemBaseClassService; protected itemFilterService: ItemFilterService; protected profileHelper: ProfileHelper; protected botWeaponModLimitService: BotWeaponModLimitService; @@ -40,7 +38,7 @@ export declare class BotEquipmentModGenerator { protected botEquipmentModPoolService: BotEquipmentModPoolService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, itemHelper: ItemHelper, botEquipmentFilterService: BotEquipmentFilterService, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponModLimitService: BotWeaponModLimitService, botHelper: BotHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, botEquipmentModPoolService: BotEquipmentModPoolService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, itemHelper: ItemHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponModLimitService: BotWeaponModLimitService, botHelper: BotHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, botEquipmentModPoolService: BotEquipmentModPoolService, configServer: ConfigServer); /** * Check mods are compatible and add to array * @param equipment Equipment item to add mods to diff --git a/TypeScript/13AddTrader/types/generators/LocationGenerator.d.ts b/TypeScript/13AddTrader/types/generators/LocationGenerator.d.ts index b8169d3..46a514b 100644 --- a/TypeScript/13AddTrader/types/generators/LocationGenerator.d.ts +++ b/TypeScript/13AddTrader/types/generators/LocationGenerator.d.ts @@ -65,10 +65,11 @@ export declare class LocationGenerator { protected getGuaranteedContainers(staticContainersOnMap: IStaticContainerData[]): IStaticContainerData[]; /** * Choose a number of containers based on their probabilty value to fulfil the desired count in containerData.chosenCount + * @param groupId Name of the group the containers are being collected for * @param containerData Containers and probability values for a groupId * @returns List of chosen container Ids */ - protected getContainersByProbabilty(containerData: IContainerGroupCount): string[]; + protected getContainersByProbabilty(groupId: string, containerData: IContainerGroupCount): string[]; /** * Get a mapping of each groupid and the containers in that group + count of containers to spawn on map * @param containersGroups Container group values diff --git a/TypeScript/13AddTrader/types/generators/PMCLootGenerator.d.ts b/TypeScript/13AddTrader/types/generators/PMCLootGenerator.d.ts index 9acff69..abb5615 100644 --- a/TypeScript/13AddTrader/types/generators/PMCLootGenerator.d.ts +++ b/TypeScript/13AddTrader/types/generators/PMCLootGenerator.d.ts @@ -31,12 +31,12 @@ export declare class PMCLootGenerator { */ generatePMCVestLootPool(): string[]; /** - * Check if item has a width/height that lets it fit into a 1x2/2x1 slot - * 1x1 / 1x2 / 2x1 + * Check if item has a width/height that lets it fit into a 2x2 slot + * 1x1 / 1x2 / 2x1 / 2x2 * @param item Item to check size of * @returns true if it fits */ - protected itemFitsInto1By2Slot(item: ITemplateItem): boolean; + protected itemFitsInto2By2Slot(item: ITemplateItem): boolean; /** * Create an array of loot items a PMC can have in their backpack * @returns string array of tpls diff --git a/TypeScript/13AddTrader/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/13AddTrader/types/generators/RagfairOfferGenerator.d.ts index a627191..58e0b68 100644 --- a/TypeScript/13AddTrader/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/13AddTrader/types/generators/RagfairOfferGenerator.d.ts @@ -55,11 +55,10 @@ export declare class RagfairOfferGenerator { * @param items Items in the offer * @param barterScheme Cost of item (currency or barter) * @param loyalLevel Loyalty level needed to buy item - * @param price Price of offer - * @param sellInOnePiece Set StackObjectsCount to 1 + * @param sellInOnePiece Flags sellInOnePiece to be true * @returns IRagfairOffer */ - createFleaOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; + createFleaOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, sellInOnePiece?: boolean): IRagfairOffer; /** * Create an offer object ready to send to ragfairOfferService.addOffer() * @param userID Owner of the offer @@ -67,17 +66,16 @@ export declare class RagfairOfferGenerator { * @param items Items in the offer * @param barterScheme Cost of item (currency or barter) * @param loyalLevel Loyalty level needed to buy item - * @param price Price of offer * @param sellInOnePiece Set StackObjectsCount to 1 * @returns IRagfairOffer */ - protected createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; + protected createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, sellInOnePiece?: boolean): IRagfairOffer; /** * Calculate the offer price that's listed on the flea listing * @param offerRequirements barter requirements for offer * @returns rouble cost of offer */ - protected calculateOfferListingPrice(offerRequirements: OfferRequirement[]): number; + protected convertOfferRequirementsIntoRoubles(offerRequirements: OfferRequirement[]): number; /** * Get avatar url from trader table in db * @param isTrader Is user we're getting avatar for a trader @@ -137,7 +135,7 @@ export declare class RagfairOfferGenerator { * @param itemDetails raw db item details * @returns Item array */ - protected createSingleOfferForItem(items: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; + protected createSingleOfferForItem(items: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; /** * Generate trader offers on flea using the traders assort data * @param traderID Trader to generate offers for @@ -151,7 +149,7 @@ export declare class RagfairOfferGenerator { * @param itemDetails db details of first item * @returns */ - protected getItemCondition(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): Item[]; + protected randomiseItemUpdProperties(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): Item[]; /** * Get the relevant condition id if item tpl matches in ragfair.json/condition * @param tpl Item to look for matching condition object @@ -184,7 +182,7 @@ export declare class RagfairOfferGenerator { * @param offerItems Items for sale in offer * @returns Barter scheme */ - protected createBarterRequirement(offerItems: Item[]): IBarterScheme[]; + protected createBarterBarterScheme(offerItems: Item[]): IBarterScheme[]; /** * Get an array of flea prices + item tpl, cached in generator class inside `allowedFleaPriceItemsForBarter` * @returns array with tpl/price values @@ -196,7 +194,9 @@ export declare class RagfairOfferGenerator { /** * Create a random currency-based barter scheme for an array of items * @param offerItems Items on offer + * @param isPackOffer Is the barter scheme being created for a pack offer + * @param multipler What to multiply the resulting price by * @returns Barter scheme for offer */ - protected createCurrencyRequirement(offerItems: Item[]): IBarterScheme[]; + protected createCurrencyBarterScheme(offerItems: Item[], isPackOffer: boolean, multipler?: number): IBarterScheme[]; } diff --git a/TypeScript/13AddTrader/types/generators/ScavCaseRewardGenerator.d.ts b/TypeScript/13AddTrader/types/generators/ScavCaseRewardGenerator.d.ts index 4ba1888..b5935d0 100644 --- a/TypeScript/13AddTrader/types/generators/ScavCaseRewardGenerator.d.ts +++ b/TypeScript/13AddTrader/types/generators/ScavCaseRewardGenerator.d.ts @@ -25,6 +25,8 @@ export declare class ScavCaseRewardGenerator { protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected scavCaseConfig: IScavCaseConfig; + protected dbItemsCache: ITemplateItem[]; + protected dbAmmoItemsCache: ITemplateItem[]; constructor(logger: ILogger, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * Create an array of rewards that will be given to the player upon completing their scav case build @@ -33,10 +35,10 @@ export declare class ScavCaseRewardGenerator { */ generate(recipeId: string): Product[]; /** - * Get all db items that are not blacklisted in scavcase config - * @returns filtered array of db items + * Get all db items that are not blacklisted in scavcase config or global blacklist + * Store in class field */ - protected getDbItems(): ITemplateItem[]; + protected cacheDbItems(): void; /** * Pick a number of items to be rewards, the count is defined by the values in * @param items item pool to pick rewards from diff --git a/TypeScript/13AddTrader/types/generators/WeatherGenerator.d.ts b/TypeScript/13AddTrader/types/generators/WeatherGenerator.d.ts index 2e2403c..6471bb1 100644 --- a/TypeScript/13AddTrader/types/generators/WeatherGenerator.d.ts +++ b/TypeScript/13AddTrader/types/generators/WeatherGenerator.d.ts @@ -52,6 +52,7 @@ export declare class WeatherGenerator { */ protected setCurrentDateTime(weather: IWeather): void; protected getWeightedWindDirection(): WindDirection; + protected getWeightedClouds(): number; protected getWeightedWindSpeed(): number; protected getWeightedFog(): number; protected getWeightedRain(): number; diff --git a/TypeScript/13AddTrader/types/helpers/HealthHelper.d.ts b/TypeScript/13AddTrader/types/helpers/HealthHelper.d.ts index 3694a6e..e4cdcd6 100644 --- a/TypeScript/13AddTrader/types/helpers/HealthHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/HealthHelper.d.ts @@ -27,6 +27,7 @@ export declare class HealthHelper { * @param request Heal request * @param sessionID Session id * @param addEffects Should effects be added or removed (default - add) + * @param deleteExistingEffects Should all prior effects be removed before apply new ones */ saveVitality(pmcData: IPmcData, request: ISyncHealthRequestData, sessionID: string, addEffects?: boolean, deleteExistingEffects?: boolean): void; /** diff --git a/TypeScript/13AddTrader/types/helpers/InRaidHelper.d.ts b/TypeScript/13AddTrader/types/helpers/InRaidHelper.d.ts index bf584c2..b4c0c1c 100644 --- a/TypeScript/13AddTrader/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/InRaidHelper.d.ts @@ -53,7 +53,7 @@ export declare class InRaidHelper { * @param victim Who was killed by player * @returns a numerical standing gain or loss */ - protected getStandingChangeForKill(victim: Victim): number; + protected getFenceStandingChangeForKillAsScav(victim: Victim): number; /** * Reset a profile to a baseline, used post-raid * Reset points earned during session property diff --git a/TypeScript/13AddTrader/types/helpers/ItemHelper.d.ts b/TypeScript/13AddTrader/types/helpers/ItemHelper.d.ts index 99fca56..00f190f 100644 --- a/TypeScript/13AddTrader/types/helpers/ItemHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/ItemHelper.d.ts @@ -26,6 +26,7 @@ declare class ItemHelper { protected itemBaseClassService: ItemBaseClassService; protected localisationService: LocalisationService; protected localeService: LocaleService; + protected readonly defaultInvalidBaseTypes: string[]; constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, localisationService: LocalisationService, localeService: LocaleService); /** * Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash @@ -67,6 +68,11 @@ declare class ItemHelper { * @returns Price in roubles (undefined if not found) */ getDynamicItemPrice(tpl: string): number; + /** + * Update items upd.StackObjectsCount to be 1 if its upd is missing or StackObjectsCount is undefined + * @param item Item to update + * @returns Fixed item + */ fixItemStackCount(item: Item): Item; /** * AmmoBoxes contain StackSlots which need to be filled for the AmmoBox to have content. @@ -125,19 +131,19 @@ declare class ItemHelper { getItemQualityModifier(item: Item): number; /** * Get a quality value based on a repairable items (weapon/armor) current state between current and max durability - * @param itemDetails - * @param repairable repairable object - * @param item - * @returns a number between 0 and 1 + * @param itemDetails Db details for item we want quality value for + * @param repairable Repairable properties + * @param item Item quality value is for + * @returns A number between 0 and 1 */ protected getRepairableItemQualityValue(itemDetails: ITemplateItem, repairable: Repairable, item: Item): number; /** * Recursive function that looks at every item from parameter and gets their childrens Ids + includes parent item in results - * @param items - * @param itemID + * @param items Array of items (item + possible children) + * @param itemId Parent items id * @returns an array of strings */ - findAndReturnChildrenByItems(items: Item[], itemID: string): string[]; + findAndReturnChildrenByItems(items: Item[], itemId: string): string[]; /** * A variant of findAndReturnChildren where the output is list of item objects instead of their ids. * @param items @@ -164,12 +170,6 @@ declare class ItemHelper { * @returns true if it is a dogtag */ isDogtag(tpl: string): boolean; - /** - * Can the item passed in be sold to a trader because it is raw money - * @param tpl Item template id to check - * @returns true if unsellable - */ - isNotSellable(tpl: string): boolean; /** * Gets the identifier for a child using slotId, locationX and locationY. * @param item @@ -183,19 +183,19 @@ declare class ItemHelper { */ isItemTplStackable(tpl: string): boolean; /** - * split item stack if it exceeds its StackMaxSize property - * @param itemToSplit item being split into smaller stacks + * split item stack if it exceeds its items StackMaxSize property + * @param itemToSplit Item to split into smaller stacks * @returns Array of split items */ splitStack(itemToSplit: Item): Item[]; /** - * Find Barter items in the inventory + * Find Barter items from array of items * @param {string} by tpl or id - * @param {Object} pmcData + * @param {Item[]} items Array of items to iterate over * @param {string} barterItemId * @returns Array of Item objects */ - findBarterItems(by: "tpl" | "id", pmcData: IPmcData, barterItemId: string): Item[]; + findBarterItems(by: "tpl" | "id", items: Item[], barterItemId: string): Item[]; /** * Regenerate all guids with new ids, exceptions are for items that cannot be altered (e.g. stash/sorting table) * @param pmcData Player profile @@ -262,10 +262,21 @@ declare class ItemHelper { * @param minSizePercent % the magazine must be filled to */ fillMagazineWithCartridge(magazine: Item[], magTemplate: ITemplateItem, cartridgeTpl: string, minSizePercent?: number): void; + /** + * Choose a random bullet type from the list of possible a magazine has + * @param magTemplate Magazine template from Db + * @returns Tpl of cartridge + */ protected getRandomValidCaliber(magTemplate: ITemplateItem): string; + /** + * Chose a randomly weighted cartridge that fits + * @param caliber Desired caliber + * @param staticAmmoDist Cartridges and thier weights + * @returns Tpl of cartrdige + */ protected drawAmmoTpl(caliber: string, staticAmmoDist: Record): string; /** - * + * Create a basic cartrige object * @param parentId container cartridges will be placed in * @param ammoTpl Cartridge to insert * @param stackCount Count of cartridges inside parent diff --git a/TypeScript/13AddTrader/types/helpers/QuestHelper.d.ts b/TypeScript/13AddTrader/types/helpers/QuestHelper.d.ts index e04b6e0..5c749d3 100644 --- a/TypeScript/13AddTrader/types/helpers/QuestHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/QuestHelper.d.ts @@ -21,6 +21,7 @@ import { DialogueHelper } from "./DialogueHelper"; import { ItemHelper } from "./ItemHelper"; import { PaymentHelper } from "./PaymentHelper"; import { ProfileHelper } from "./ProfileHelper"; +import { QuestConditionHelper } from "./QuestConditionHelper"; import { RagfairServerHelper } from "./RagfairServerHelper"; import { TraderHelper } from "./TraderHelper"; export declare class QuestHelper { @@ -29,6 +30,7 @@ export declare class QuestHelper { protected timeUtil: TimeUtil; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; + protected questConditionHelper: QuestConditionHelper; protected eventOutputHolder: EventOutputHolder; protected databaseServer: DatabaseServer; protected localeService: LocaleService; @@ -41,7 +43,7 @@ export declare class QuestHelper { protected mailSendService: MailSendService; protected configServer: ConfigServer; 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, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, questConditionHelper: QuestConditionHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, mailSendService: MailSendService, configServer: ConfigServer); /** * Get status of a quest in player profile by its id * @param pmcData Profile to search @@ -119,7 +121,7 @@ export declare class QuestHelper { * @param sessionID Session id * @returns Quests accessible to player incuding newly unlocked quests now quest (startedQuestId) was started */ - acceptedUnlocked(startedQuestId: string, sessionID: string): IQuest[]; + getNewlyAccessibleQuestsWhenStartingQuest(startedQuestId: string, sessionID: string): IQuest[]; /** * Get quests that can be shown to player after failing a quest * @param failedQuestId Id of the quest failed by player diff --git a/TypeScript/13AddTrader/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/13AddTrader/types/helpers/RagfairOfferHelper.d.ts index de9d550..0699259 100644 --- a/TypeScript/13AddTrader/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/RagfairOfferHelper.d.ts @@ -1,4 +1,5 @@ import { IPmcData } from "../models/eft/common/IPmcData"; +import { Item } from "../models/eft/common/tables/IItem"; import { ITraderAssort } from "../models/eft/common/tables/ITrader"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; @@ -13,10 +14,10 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { LocaleService } from "../services/LocaleService"; import { LocalisationService } from "../services/LocalisationService"; +import { MailSendService } from "../services/MailSendService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { HashUtil } from "../utils/HashUtil"; import { TimeUtil } from "../utils/TimeUtil"; -import { DialogueHelper } from "./DialogueHelper"; import { ItemHelper } from "./ItemHelper"; import { PaymentHelper } from "./PaymentHelper"; import { PresetHelper } from "./PresetHelper"; @@ -33,7 +34,6 @@ export declare class RagfairOfferHelper { protected databaseServer: DatabaseServer; protected traderHelper: TraderHelper; protected saveServer: SaveServer; - protected dialogueHelper: DialogueHelper; protected itemHelper: ItemHelper; protected paymentHelper: PaymentHelper; protected presetHelper: PresetHelper; @@ -44,11 +44,12 @@ export declare class RagfairOfferHelper { protected ragfairOfferService: RagfairOfferService; protected localeService: LocaleService; protected localisationService: LocalisationService; + protected mailSendService: MailSendService; protected configServer: ConfigServer; protected static goodSoldTemplate: string; protected ragfairConfig: IRagfairConfig; 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, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, localisationService: LocalisationService, mailSendService: MailSendService, configServer: ConfigServer); /** * Passthrough to ragfairOfferService.getOffers(), get flea offers a player should see * @param searchRequest Data from client @@ -119,19 +120,26 @@ export declare class RagfairOfferHelper { */ protected getProfileOffers(sessionID: string): IRagfairOffer[]; /** - * Delete an offer from a desired profile + * Delete an offer from a desired profile and from ragfair offers * @param sessionID Session id of profile to delete offer from - * @param offerId Offer id to delete + * @param offerId Id of offer to delete */ - protected deleteOfferByOfferId(sessionID: string, offerId: string): void; + protected deleteOfferById(sessionID: string, offerId: string): void; /** * Complete the selling of players' offer * @param sessionID Session id * @param offer Sold offer details * @param boughtAmount Amount item was purchased for - * @returns Client response + * @returns IItemEventRouterResponse */ protected completeOffer(sessionID: string, offer: IRagfairOffer, boughtAmount: number): IItemEventRouterResponse; + /** + * Get a localised message for when players offer has sold on flea + * @param itemTpl Item sold + * @param boughtAmount How many were purchased + * @returns Localised message text + */ + protected getLocalisedOfferSoldMessage(itemTpl: string, boughtAmount: number): string; /** * Should a ragfair offer be visible to the player * @param searchRequest Search request @@ -142,4 +150,12 @@ export declare class RagfairOfferHelper { * @returns True = should be shown to player */ isDisplayableOffer(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, offer: IRagfairOffer, pmcProfile: IPmcData): boolean; + /** + * Is items quality value within desired range + * @param item Item to check quality of + * @param min Desired minimum quality + * @param max Desired maximum quality + * @returns True if in range + */ + protected itemQualityInRange(item: Item, min: number, max: number): boolean; } diff --git a/TypeScript/13AddTrader/types/helpers/RagfairSellHelper.d.ts b/TypeScript/13AddTrader/types/helpers/RagfairSellHelper.d.ts index 251d7ca..913b408 100644 --- a/TypeScript/13AddTrader/types/helpers/RagfairSellHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/RagfairSellHelper.d.ts @@ -13,12 +13,12 @@ export declare class RagfairSellHelper { constructor(logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, configServer: ConfigServer); /** * Get the percent chance to sell an item based on its average listed price vs player chosen listing price - * @param baseChancePercent Base chance to sell item * @param averageOfferPriceRub Price of average offer in roubles * @param playerListedPriceRub Price player listed item for in roubles + * @param qualityMultiplier Quality multipler of item being sold * @returns percent value */ - calculateSellChance(baseChancePercent: number, averageOfferPriceRub: number, playerListedPriceRub: number): number; + calculateSellChance(averageOfferPriceRub: number, playerListedPriceRub: number, qualityMultiplier: number): number; /** * Get percent chance to sell an item when price is below items average listing price * @param playerListedPriceRub Price player listed item for in roubles diff --git a/TypeScript/13AddTrader/types/helpers/TraderHelper.d.ts b/TypeScript/13AddTrader/types/helpers/TraderHelper.d.ts index c163f7a..6680ccf 100644 --- a/TypeScript/13AddTrader/types/helpers/TraderHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/TraderHelper.d.ts @@ -35,7 +35,7 @@ export declare class TraderHelper { protected highestTraderBuyPriceItems: Record; constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, handbookHelper: HandbookHelper, itemHelper: ItemHelper, playerService: PlayerService, localisationService: LocalisationService, fenceService: FenceService, timeUtil: TimeUtil, randomUtil: RandomUtil, configServer: ConfigServer); getTrader(traderID: string, sessionID: string): ITraderBase; - getTraderAssortsById(traderId: string): ITraderAssort; + getTraderAssortsByTraderId(traderId: string): ITraderAssort; /** * 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 diff --git a/TypeScript/13AddTrader/types/models/eft/common/tables/IBotBase.d.ts b/TypeScript/13AddTrader/types/models/eft/common/tables/IBotBase.d.ts index ee40958..6c7b76f 100644 --- a/TypeScript/13AddTrader/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/13AddTrader/types/models/eft/common/tables/IBotBase.d.ts @@ -281,7 +281,7 @@ export interface InsuredItem { export interface Hideout { Production: Record; Areas: HideoutArea[]; - Improvements: Record; + Improvement: Record; Seed: number; sptUpdateLastRunTimestamp: number; } diff --git a/TypeScript/13AddTrader/types/models/eft/health/IHealthTreatmentRequestData.d.ts b/TypeScript/13AddTrader/types/models/eft/health/IHealthTreatmentRequestData.d.ts index 7fb80a8..598e60c 100644 --- a/TypeScript/13AddTrader/types/models/eft/health/IHealthTreatmentRequestData.d.ts +++ b/TypeScript/13AddTrader/types/models/eft/health/IHealthTreatmentRequestData.d.ts @@ -1,12 +1,14 @@ export interface IHealthTreatmentRequestData { Action: "RestoreHealth"; trader: string; - items: Item[]; + items: Cost[]; difference: Difference; timestamp: number; } -export interface Item { +export interface Cost { + /** Id of stack to take money from */ id: string; + /** Amount of money to take off player for treatment */ count: number; } export interface Difference { @@ -25,5 +27,6 @@ export interface BodyParts { } export interface BodyPart { Health: number; + /** Effects in array are to be removed */ Effects: string[]; } diff --git a/TypeScript/13AddTrader/types/models/eft/notifier/INotifier.d.ts b/TypeScript/13AddTrader/types/models/eft/notifier/INotifier.d.ts index ce25dee..c6c6979 100644 --- a/TypeScript/13AddTrader/types/models/eft/notifier/INotifier.d.ts +++ b/TypeScript/13AddTrader/types/models/eft/notifier/INotifier.d.ts @@ -14,6 +14,11 @@ export interface INotification { } export declare enum NotificationType { RAGFAIR_OFFER_SOLD = "RagfairOfferSold", + RAGFAIR_RATING_CHANGE = "RagfairRatingChange", + /** ChatMessageReceived */ NEW_MESSAGE = "new_message", - PING = "ping" + PING = "ping", + TRADER_SUPPLY = "TraderSupply", + TRADER_STANDING = "TraderStanding", + UNLOCK_TRADER = "UnlockTrader" } diff --git a/TypeScript/13AddTrader/types/models/eft/notifier/ISelectProfileResponse.d.ts b/TypeScript/13AddTrader/types/models/eft/notifier/ISelectProfileResponse.d.ts index ecb668a..f2d6be7 100644 --- a/TypeScript/13AddTrader/types/models/eft/notifier/ISelectProfileResponse.d.ts +++ b/TypeScript/13AddTrader/types/models/eft/notifier/ISelectProfileResponse.d.ts @@ -1,6 +1,3 @@ -import { INotifierChannel } from "./INotifier"; export interface ISelectProfileResponse { status: string; - notifier: INotifierChannel; - notifierServer: string; } diff --git a/TypeScript/13AddTrader/types/models/enums/WeatherType.d.ts b/TypeScript/13AddTrader/types/models/enums/WeatherType.d.ts index d31fefe..503dc30 100644 --- a/TypeScript/13AddTrader/types/models/enums/WeatherType.d.ts +++ b/TypeScript/13AddTrader/types/models/enums/WeatherType.d.ts @@ -1,19 +1,19 @@ export declare enum WeatherType { - CLEAR_DAY = 1, - CLEAR_WIND = 2, - CLEAR_NIGHT = 3, - PARTLY_CLOUD_DAY = 4, - PARTLY_CLOUD_NIGHT = 5, - CLEAR_FOG_DAY = 6, - CLEAR_FOG_NIGHT = 7, - CLOUDFOG = 8, - FOG = 9, - MOSTLY_CLOUD = 10, - LIGHT_RAIN = 11, - RAIN = 12, - CLOUD_WIND = 13, - CLOUD_WIND_RAIN = 14, - FULL_CLOUD = 15, - THUNDER_CLOUD = 16, - NONE = 0 + CLEAR_DAY = 0, + CLEAR_WIND = 1, + CLEAR_NIGHT = 2, + PARTLY_CLOUD_DAY = 3, + PARTLY_CLOUD_NIGHT = 4, + CLEAR_FOG_DAY = 5, + CLEAR_FOG_NIGHT = 6, + CLOUD_FOG = 7, + FOG = 8, + MOSTLY_CLOUD = 9, + LIGHT_RAIN = 10, + RAIN = 11, + CLOUD_WIND = 12, + CLOUD_WIND_RAIN = 13, + FULL_CLOUD = 14, + THUNDER_CLOUD = 15, + NONE = 16 } diff --git a/TypeScript/13AddTrader/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/13AddTrader/types/models/spt/config/IRagfairConfig.d.ts index 7c04857..7aea24f 100644 --- a/TypeScript/13AddTrader/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/13AddTrader/types/models/spt/config/IRagfairConfig.d.ts @@ -41,7 +41,8 @@ export interface Dynamic { /** Use the highest trader price for an offer if its greater than the price in templates/prices.json */ useTraderPriceForOffersIfHigher: boolean; /** Barter offer specific settings */ - barter: Barter; + barter: IBarterDetails; + pack: IPackDetails; /** Dynamic offer price below handbook adjustment values */ offerAdjustment: OfferAdjustment; /** How many offers should expire before an offer regeneration occurs */ @@ -49,9 +50,7 @@ export interface Dynamic { /** How many offers should be listed */ offerItemCount: MinMax; /** How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) */ - price: MinMax; - /** How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) */ - presetPrice: MinMax; + priceRanges: IPriceRanges; /** Should default presets to listed only or should non-standard presets found in globals.json be listed too */ showDefaultPresetsOnly: boolean; endTimeSeconds: MinMax; @@ -74,7 +73,12 @@ export interface Dynamic { /** Dict of price limits keyed by item type */ unreasonableModPrices: Record; } -export interface Barter { +export interface IPriceRanges { + default: MinMax; + preset: MinMax; + pack: MinMax; +} +export interface IBarterDetails { /** Should barter offers be generated */ enable: boolean; /** Percentage change an offer is listed as a barter */ @@ -90,6 +94,18 @@ export interface Barter { /** Item Tpls to never be turned into a barter */ itemTypeBlacklist: string[]; } +export interface IPackDetails { + /** Should pack offers be generated */ + enable: boolean; + /** Percentage change an offer is listed as a pack */ + chancePercent: number; + /** Min number of required items for a pack */ + itemCountMin: number; + /** Max number of required items for a pack */ + itemCountMax: number; + /** item types to allow being a pack */ + itemTypeWhitelist: string[]; +} export interface OfferAdjustment { /** Shuld offer price be adjusted when below handbook price */ adjustPriceWhenBelowHandbookPrice: boolean; diff --git a/TypeScript/13AddTrader/types/models/spt/config/IWeatherConfig.d.ts b/TypeScript/13AddTrader/types/models/spt/config/IWeatherConfig.d.ts index 41a1c83..6ecf35b 100644 --- a/TypeScript/13AddTrader/types/models/spt/config/IWeatherConfig.d.ts +++ b/TypeScript/13AddTrader/types/models/spt/config/IWeatherConfig.d.ts @@ -7,7 +7,7 @@ export interface IWeatherConfig extends IBaseConfig { weather: Weather; } export interface Weather { - clouds: MinMax; + clouds: WeatherSettings; windSpeed: WeatherSettings; windDirection: WeatherSettings; windGustiness: MinMax; diff --git a/TypeScript/13AddTrader/types/services/HashCacheService.d.ts b/TypeScript/13AddTrader/types/services/HashCacheService.d.ts index 5320f28..9968478 100644 --- a/TypeScript/13AddTrader/types/services/HashCacheService.d.ts +++ b/TypeScript/13AddTrader/types/services/HashCacheService.d.ts @@ -11,7 +11,18 @@ export declare class HashCacheService { protected modHashes: any; protected readonly modCachePath = "./user/cache/modCache.json"; constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); + /** + * Return a stored hash by key + * @param modName Name of mod to get hash for + * @returns Mod hash + */ getStoredModHash(modName: string): string; + /** + * Does the generated hash match the stored hash + * @param modName name of mod + * @param modContent + * @returns True if they match + */ modContentMatchesStoredHash(modName: string, modContent: string): boolean; hashMatchesStoredHash(modName: string, modHash: string): boolean; storeModContent(modName: string, modContent: string): void; diff --git a/TypeScript/13AddTrader/types/services/MailSendService.d.ts b/TypeScript/13AddTrader/types/services/MailSendService.d.ts index 19397dc..fe4a7fe 100644 --- a/TypeScript/13AddTrader/types/services/MailSendService.d.ts +++ b/TypeScript/13AddTrader/types/services/MailSendService.d.ts @@ -35,7 +35,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendDirectNpcMessageToPlayer(playerId: string, sender: Traders, messageType: MessageType, message: string, items?: Item[], maxStorageTimeSeconds?: any): void; + sendDirectNpcMessageToPlayer(playerId: string, sender: Traders, messageType: MessageType, message: string, items?: Item[], maxStorageTimeSeconds?: any, systemData?: any, ragfair?: any): void; /** * Send a message from an NPC (e.g. prapor) to the player with or without items * @param playerId Players id to send message to @@ -45,7 +45,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendLocalisedNpcMessageToPlayer(playerId: string, sender: Traders, messageType: MessageType, messageLocaleId: string, items?: Item[], maxStorageTimeSeconds?: any, systemData?: any): void; + sendLocalisedNpcMessageToPlayer(playerId: string, sender: Traders, messageType: MessageType, messageLocaleId: string, items?: Item[], maxStorageTimeSeconds?: any, systemData?: any, ragfair?: any): void; /** * Send a message from SYSTEM to the player with or without items * @param playerId Players id to send message to diff --git a/TypeScript/13AddTrader/types/services/MatchBotDetailsCacheService.d.ts b/TypeScript/13AddTrader/types/services/MatchBotDetailsCacheService.d.ts index eb365dd..c1bd322 100644 --- a/TypeScript/13AddTrader/types/services/MatchBotDetailsCacheService.d.ts +++ b/TypeScript/13AddTrader/types/services/MatchBotDetailsCacheService.d.ts @@ -1,7 +1,7 @@ import { IBotBase } from "../models/eft/common/tables/IBotBase"; import { ILogger } from "../models/spt/utils/ILogger"; import { LocalisationService } from "./LocalisationService"; -/** Cache bots in a dictionary, keyed by the bots name, keying by name isnt idea as its not unique but this is used by the post-raid system which doesnt have any bot ids, only name */ +/** Cache bots in a dictionary, keyed by the bots name, keying by name isnt ideal as its not unique but this is used by the post-raid system which doesnt have any bot ids, only name */ export declare class MatchBotDetailsCacheService { protected logger: ILogger; protected localisationService: LocalisationService; @@ -17,9 +17,9 @@ export declare class MatchBotDetailsCacheService { */ clearCache(): void; /** - * Find a bot in the cache by its name + * Find a bot in the cache by its name and side * @param botName Name of bot to find * @returns Bot details */ - getBotByName(botName: string): IBotBase; + getBotByNameAndSide(botName: string, botSide: string): IBotBase; } diff --git a/TypeScript/13AddTrader/types/services/ModCompilerService.d.ts b/TypeScript/13AddTrader/types/services/ModCompilerService.d.ts index a4bf3c8..e306177 100644 --- a/TypeScript/13AddTrader/types/services/ModCompilerService.d.ts +++ b/TypeScript/13AddTrader/types/services/ModCompilerService.d.ts @@ -1,14 +1,36 @@ import { CompilerOptions } from "typescript"; import type { ILogger } from "../models/spt/utils/ILogger"; -import { HashCacheService } from "./HashCacheService"; import { VFS } from "../utils/VFS"; +import { HashCacheService } from "./HashCacheService"; export declare class ModCompilerService { protected logger: ILogger; protected hashCacheService: HashCacheService; protected vfs: VFS; constructor(logger: ILogger, hashCacheService: HashCacheService, vfs: VFS); + /** + * Convert a mods TS into JS + * @param modName Name of mod + * @param modPath Dir path to mod + * @param modTypeScriptFiles + * @returns + */ compileMod(modName: string, modPath: string, modTypeScriptFiles: string[]): Promise; + /** + * Convert a TS file into JS + * @param fileNames Paths to TS files + * @param options Compiler options + */ protected compile(fileNames: string[], options: CompilerOptions): Promise; + /** + * Do the files at the provided paths exist + * @param fileNames + * @returns + */ protected areFilesReady(fileNames: string[]): boolean; + /** + * Wait the provided number of milliseconds + * @param ms Milliseconds + * @returns + */ protected delay(ms: number): Promise; } diff --git a/TypeScript/13AddTrader/types/services/PaymentService.d.ts b/TypeScript/13AddTrader/types/services/PaymentService.d.ts index 1c9c32b..fb5f92c 100644 --- a/TypeScript/13AddTrader/types/services/PaymentService.d.ts +++ b/TypeScript/13AddTrader/types/services/PaymentService.d.ts @@ -61,23 +61,26 @@ export declare class PaymentService { * Get all money stacks in inventory and prioritse items in stash * @param pmcData * @param currencyTpl + * @param playerStashId Players stash id * @returns Sorting money items */ - protected getSortedMoneyItemsInInventory(pmcData: IPmcData, currencyTpl: string): Item[]; + protected getSortedMoneyItemsInInventory(pmcData: IPmcData, currencyTpl: string, playerStashId: string): Item[]; /** * Prioritise player stash first over player inventory * Post-raid healing would often take money out of the players pockets/secure container * @param a First money stack item * @param b Second money stack item * @param inventoryItems players inventory items + * @param playerStashId Players stash id * @returns sort order */ - protected prioritiseStashSort(a: Item, b: Item, inventoryItems: Item[]): number; + protected prioritiseStashSort(a: Item, b: Item, inventoryItems: Item[], playerStashId: string): number; /** * Recursivly check items parents to see if it is inside the players inventory, not stash * @param itemId item id to check * @param inventoryItems player inventory + * @param playerStashId Players stash id * @returns true if its in inventory */ - protected isInInventory(itemId: string, inventoryItems: Item[]): boolean; + protected isInStash(itemId: string, inventoryItems: Item[], playerStashId: string): boolean; } diff --git a/TypeScript/13AddTrader/types/services/ProfileFixerService.d.ts b/TypeScript/13AddTrader/types/services/ProfileFixerService.d.ts index c8232fc..bc1e42e 100644 --- a/TypeScript/13AddTrader/types/services/ProfileFixerService.d.ts +++ b/TypeScript/13AddTrader/types/services/ProfileFixerService.d.ts @@ -14,6 +14,7 @@ import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; import { Watermark } from "../utils/Watermark"; import { LocalisationService } from "./LocalisationService"; @@ -27,17 +28,19 @@ export declare class ProfileFixerService { protected itemHelper: ItemHelper; protected localisationService: LocalisationService; protected timeUtil: TimeUtil; + protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, profileHelper: ProfileHelper, itemHelper: ItemHelper, localisationService: LocalisationService, timeUtil: TimeUtil, databaseServer: DatabaseServer, configServer: ConfigServer); + constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, profileHelper: ProfileHelper, itemHelper: ItemHelper, localisationService: LocalisationService, timeUtil: TimeUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, configServer: ConfigServer); /** * 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; protected addMissingGunStandContainerImprovements(pmcProfile: IPmcData): void; + protected ensureGunStandLevelsMatch(pmcProfile: IPmcData): void; protected addHideoutAreaStashes(pmcProfile: IPmcData): void; protected addMissingHideoutWallAreas(pmcProfile: IPmcData): void; protected adjustUnreasonableModFleaPrices(): void; @@ -131,4 +134,9 @@ export declare class ProfileFixerService { * @param pmcProfile Profile to add missing IDs to */ addMissingIdsToBonuses(pmcProfile: IPmcData): void; + /** + * At some point the property name was changed,migrate data across to new name + * @param pmcProfile + */ + protected migrateImprovements(pmcProfile: IPmcData): void; } diff --git a/TypeScript/13AddTrader/types/services/RagfairPriceService.d.ts b/TypeScript/13AddTrader/types/services/RagfairPriceService.d.ts index e245efa..ff35327 100644 --- a/TypeScript/13AddTrader/types/services/RagfairPriceService.d.ts +++ b/TypeScript/13AddTrader/types/services/RagfairPriceService.d.ts @@ -3,6 +3,7 @@ import { HandbookHelper } from "../helpers/HandbookHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { TraderHelper } from "../helpers/TraderHelper"; +import { MinMax } from "../models/common/MinMax"; import { IPreset } from "../models/eft/common/IGlobals"; import { Item } from "../models/eft/common/tables/IItem"; import { IBarterScheme } from "../models/eft/common/tables/ITrader"; @@ -35,10 +36,6 @@ export declare class RagfairPriceService implements OnLoad { * Generate static (handbook) and dynamic (prices.json) flea prices, store inside class as dictionaries */ onLoad(): Promise; - /** - * Add placeholder values for items missing from handbook - */ - protected addMissingHandbookPrices(): void; getRoute(): string; /** * Iterate over all items of type "Item" in db and get template price, store in cache @@ -91,9 +88,17 @@ export declare class RagfairPriceService implements OnLoad { * Generate a currency cost for an item and its mods * @param items Item with mods to get price for * @param desiredCurrency Currency price desired in + * @param isPackOffer Price is for a pack type offer * @returns cost of item in desired currency */ - getDynamicOfferPrice(items: Item[], desiredCurrency: string): number; + getDynamicOfferPriceForOffer(items: Item[], desiredCurrency: string, isPackOffer: boolean): number; + /** + * Get different min/max price multipliers for different offer types (preset/pack/default) + * @param isPreset Offer is a preset + * @param isPack Offer is a pack + * @returns MinMax values + */ + protected getOfferTypeRangeValues(isPreset: boolean, isPack: boolean): MinMax; /** * Check to see if an items price is below its handbook price and adjust accoring to values set to config/ragfair.json * @param itemPrice price of item @@ -104,10 +109,10 @@ export declare class RagfairPriceService implements OnLoad { /** * Multiply the price by a randomised curve where n = 2, shift = 2 * @param existingPrice price to alter - * @param isPreset is the item we're multiplying a preset + * @param rangeValues min and max to adjust price by * @returns multiplied price */ - protected randomisePrice(existingPrice: number, isPreset: boolean): number; + protected randomiseOfferPrice(existingPrice: number, rangeValues: MinMax): number; /** * Calculate the cost of a weapon preset by adding together the price of its mods + base price of default weapon preset * @param item base weapon diff --git a/TypeScript/14AfterDBLoadHook/types/callbacks/GameCallbacks.d.ts b/TypeScript/14AfterDBLoadHook/types/callbacks/GameCallbacks.d.ts index aa80036..46f79f9 100644 --- a/TypeScript/14AfterDBLoadHook/types/callbacks/GameCallbacks.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/callbacks/GameCallbacks.d.ts @@ -1,4 +1,5 @@ import { GameController } from "../controllers/GameController"; +import { OnLoad } from "../di/OnLoad"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { ICheckVersionResponse } from "../models/eft/game/ICheckVersionResponse"; import { ICurrentGroupResponse } from "../models/eft/game/ICurrentGroupResponse"; @@ -15,12 +16,14 @@ import { INullResponseData } from "../models/eft/httpResponse/INullResponseData" import { SaveServer } from "../servers/SaveServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { Watermark } from "../utils/Watermark"; -declare class GameCallbacks { +declare class GameCallbacks implements OnLoad { protected httpResponse: HttpResponseUtil; protected watermark: Watermark; protected saveServer: SaveServer; protected gameController: GameController; constructor(httpResponse: HttpResponseUtil, watermark: Watermark, saveServer: SaveServer, gameController: GameController); + onLoad(): Promise; + getRoute(): string; /** * Handle client/game/version/validate * @returns INullResponseData diff --git a/TypeScript/14AfterDBLoadHook/types/controllers/GameController.d.ts b/TypeScript/14AfterDBLoadHook/types/controllers/GameController.d.ts index 04e3abb..e88610e 100644 --- a/TypeScript/14AfterDBLoadHook/types/controllers/GameController.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/controllers/GameController.d.ts @@ -61,13 +61,14 @@ export declare class GameController { protected pmcConfig: IPmcConfig; protected lootConfig: ILootConfig; constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, randomUtil: RandomUtil, encodingUtil: EncodingUtil, hideoutHelper: HideoutHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, seasonalEventService: SeasonalEventService, itemBaseClassService: ItemBaseClassService, giftService: GiftService, applicationContext: ApplicationContext, configServer: ConfigServer); + load(): void; /** * Handle client/game/start */ gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; protected addCustomLooseLootPositions(): void; protected adjustLooseLootSpawnProbabilities(): void; - protected setHideoutAreasAndCraftsTo30Secs(): void; + protected setHideoutAreasAndCraftsTo40Secs(): void; /** * 3.7.0 moved AIDs to be numeric, old profiles need to be migrated * We store the old AID value in new field `sessionId` diff --git a/TypeScript/14AfterDBLoadHook/types/controllers/HealthController.d.ts b/TypeScript/14AfterDBLoadHook/types/controllers/HealthController.d.ts index 1938297..2d7ff09 100644 --- a/TypeScript/14AfterDBLoadHook/types/controllers/HealthController.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/controllers/HealthController.d.ts @@ -29,34 +29,35 @@ export declare class HealthController { * stores in-raid player health * @param pmcData Player profile * @param info Request data - * @param sessionID + * @param sessionID Player id * @param addEffects Should effects found be added or removed from profile + * @param deleteExistingEffects Should all prior effects be removed before apply new ones */ saveVitality(pmcData: IPmcData, info: ISyncHealthRequestData, sessionID: string, addEffects?: boolean, deleteExistingEffects?: boolean): void; /** * When healing in menu - * @param pmcData - * @param body - * @param sessionID - * @returns + * @param pmcData Player profile + * @param request Healing request + * @param sessionID Player id + * @returns IItemEventRouterResponse */ - offraidHeal(pmcData: IPmcData, body: IOffraidHealRequestData, sessionID: string): IItemEventRouterResponse; + offraidHeal(pmcData: IPmcData, request: IOffraidHealRequestData, sessionID: string): IItemEventRouterResponse; /** * Handle Eat event * Consume food/water outside of a raid * @param pmcData Player profile - * @param body request Object + * @param request Eat request * @param sessionID Session id * @returns IItemEventRouterResponse */ - offraidEat(pmcData: IPmcData, body: IOffraidEatRequestData, sessionID: string): IItemEventRouterResponse; + offraidEat(pmcData: IPmcData, request: IOffraidEatRequestData, sessionID: string): IItemEventRouterResponse; /** * Handle RestoreHealth event * Occurs on post-raid healing page * @param pmcData player profile * @param healthTreatmentRequest Request data from client * @param sessionID Session id - * @returns + * @returns IItemEventRouterResponse */ healthTreatment(pmcData: IPmcData, healthTreatmentRequest: IHealthTreatmentRequestData, sessionID: string): IItemEventRouterResponse; /** @@ -66,12 +67,4 @@ export declare class HealthController { * @param sessionID */ applyWorkoutChanges(pmcData: IPmcData, info: IWorkoutData, sessionId: string): void; - /** - * Iterate over treatment request diff and find effects to remove from player limbs - * @param sessionId - * @param profile Profile to update - * @param treatmentRequest client request - * @param output response to send to client - */ - protected removeEffectsAfterPostRaidHeal(sessionId: string, profile: IPmcData, treatmentRequest: IHealthTreatmentRequestData, output: IItemEventRouterResponse): void; } diff --git a/TypeScript/14AfterDBLoadHook/types/controllers/HideoutController.d.ts b/TypeScript/14AfterDBLoadHook/types/controllers/HideoutController.d.ts index 877c076..a90a16d 100644 --- a/TypeScript/14AfterDBLoadHook/types/controllers/HideoutController.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/controllers/HideoutController.d.ts @@ -88,11 +88,11 @@ export declare class HideoutController { * @param pmcData Profile to edit * @param output Object to send back to client * @param sessionID Session/player id - * @param profileHideoutArea Current hideout data for profile + * @param profileParentHideoutArea Current hideout area for profile * @param dbHideoutArea Hideout area being upgraded * @param hideoutStage Stage hideout area is being upgraded to */ - protected addContainerImprovementToProfile(output: IItemEventRouterResponse, sessionID: string, pmcData: IPmcData, profileHideoutArea: HideoutArea, dbHideoutArea: IHideoutArea, hideoutStage: Stage): void; + protected addContainerImprovementToProfile(output: IItemEventRouterResponse, sessionID: string, pmcData: IPmcData, profileParentHideoutArea: HideoutArea, dbHideoutArea: IHideoutArea, hideoutStage: Stage): void; /** * Add an inventory item to profile from a hideout area stage data * @param pmcData Profile to update diff --git a/TypeScript/14AfterDBLoadHook/types/controllers/LocationController.d.ts b/TypeScript/14AfterDBLoadHook/types/controllers/LocationController.d.ts index 94d496a..94f5fce 100644 --- a/TypeScript/14AfterDBLoadHook/types/controllers/LocationController.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/controllers/LocationController.d.ts @@ -4,6 +4,7 @@ import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { ILocationBase } from "../models/eft/common/ILocationBase"; import { ILocationsGenerateAllResponse } from "../models/eft/common/ILocationsSourceDestinationBase"; import { IAirdropLootResult } from "../models/eft/location/IAirdropLootResult"; +import { IGetLocationRequestData } from "../models/eft/location/IGetLocationRequestData"; import { AirdropTypeEnum } from "../models/enums/AirdropType"; import { IAirdropConfig } from "../models/spt/config/IAirdropConfig"; import { ILocationConfig } from "../models/spt/config/ILocationConfig"; @@ -34,10 +35,11 @@ export declare class LocationController { /** * Handle client/location/getLocalloot * Get a location (map) with generated loot data - * @param location Map to generate loot for + * @param sessionId Player id + * @param request Map request to generate * @returns ILocationBase */ - get(location: string): ILocationBase; + get(sessionId: string, request: IGetLocationRequestData): ILocationBase; /** * Generate a maps base location with loot * @param name Map name diff --git a/TypeScript/14AfterDBLoadHook/types/controllers/QuestController.d.ts b/TypeScript/14AfterDBLoadHook/types/controllers/QuestController.d.ts index 7d494a6..bd8a70f 100644 --- a/TypeScript/14AfterDBLoadHook/types/controllers/QuestController.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/controllers/QuestController.d.ts @@ -61,7 +61,7 @@ export declare class QuestController { * @param playerLevel level of player to test against quest * @returns true if quest can be seen/accepted by player of defined level */ - protected playerLevelFulfillsQuestRequrement(quest: IQuest, playerLevel: number): boolean; + protected playerLevelFulfillsQuestRequirement(quest: IQuest, playerLevel: number): boolean; /** * Should a quest be shown to the player in trader quest screen * @param questId Quest to check diff --git a/TypeScript/14AfterDBLoadHook/types/controllers/RagfairController.d.ts b/TypeScript/14AfterDBLoadHook/types/controllers/RagfairController.d.ts index 76c27f7..bda37cd 100644 --- a/TypeScript/14AfterDBLoadHook/types/controllers/RagfairController.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/controllers/RagfairController.d.ts @@ -21,6 +21,7 @@ import { IGetMarketPriceRequestData } from "../models/eft/ragfair/IGetMarketPric import { IGetOffersResult } from "../models/eft/ragfair/IGetOffersResult"; import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; import { ISearchRequestData } from "../models/eft/ragfair/ISearchRequestData"; +import { IProcessBuyTradeRequestData } from "../models/eft/trade/IProcessBuyTradeRequestData"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; @@ -125,6 +126,18 @@ export declare class RagfairController { * @returns IItemEventRouterResponse */ addPlayerOffer(pmcData: IPmcData, offerRequest: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Charge player a listing fee for using flea, pulls charge from data previously sent by client + * @param sessionID Player id + * @param rootItem Base item being listed (used when client tax cost not found and must be done on server) + * @param pmcData Player profile + * @param requirementsPriceInRub Rouble cost player chose for listing (used when client tax cost not found and must be done on server) + * @param itemStackCount How many items were listed in player (used when client tax cost not found and must be done on server) + * @param offerRequest Add offer request object from client + * @param output IItemEventRouterResponse + * @returns True if charging tax to player failed + */ + protected chargePlayerTaxFee(sessionID: string, rootItem: Item, pmcData: IPmcData, requirementsPriceInRub: number, itemStackCount: number, offerRequest: IAddOfferRequestData, output: IItemEventRouterResponse): boolean; /** * Is the item to be listed on the flea valid * @param offerRequest Client offer request @@ -158,4 +171,11 @@ export declare class RagfairController { */ removeOffer(offerId: string, sessionID: string): IItemEventRouterResponse; extendOffer(info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Create a basic trader request object with price and currency type + * @param currency What currency: RUB, EURO, USD + * @param value Amount of currency + * @returns IProcessBuyTradeRequestData + */ + protected createBuyTradeRequestObject(currency: string, value: number): IProcessBuyTradeRequestData; } diff --git a/TypeScript/14AfterDBLoadHook/types/generators/BotEquipmentModGenerator.d.ts b/TypeScript/14AfterDBLoadHook/types/generators/BotEquipmentModGenerator.d.ts index ccbbbbf..f7abb84 100644 --- a/TypeScript/14AfterDBLoadHook/types/generators/BotEquipmentModGenerator.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/generators/BotEquipmentModGenerator.d.ts @@ -14,7 +14,6 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; import { BotEquipmentModPoolService } from "../services/BotEquipmentModPoolService"; import { BotModLimits, BotWeaponModLimitService } from "../services/BotWeaponModLimitService"; -import { ItemBaseClassService } from "../services/ItemBaseClassService"; import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; @@ -29,7 +28,6 @@ export declare class BotEquipmentModGenerator { protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; protected botEquipmentFilterService: BotEquipmentFilterService; - protected itemBaseClassService: ItemBaseClassService; protected itemFilterService: ItemFilterService; protected profileHelper: ProfileHelper; protected botWeaponModLimitService: BotWeaponModLimitService; @@ -40,7 +38,7 @@ export declare class BotEquipmentModGenerator { protected botEquipmentModPoolService: BotEquipmentModPoolService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, itemHelper: ItemHelper, botEquipmentFilterService: BotEquipmentFilterService, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponModLimitService: BotWeaponModLimitService, botHelper: BotHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, botEquipmentModPoolService: BotEquipmentModPoolService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, itemHelper: ItemHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponModLimitService: BotWeaponModLimitService, botHelper: BotHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, botEquipmentModPoolService: BotEquipmentModPoolService, configServer: ConfigServer); /** * Check mods are compatible and add to array * @param equipment Equipment item to add mods to diff --git a/TypeScript/14AfterDBLoadHook/types/generators/LocationGenerator.d.ts b/TypeScript/14AfterDBLoadHook/types/generators/LocationGenerator.d.ts index b8169d3..46a514b 100644 --- a/TypeScript/14AfterDBLoadHook/types/generators/LocationGenerator.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/generators/LocationGenerator.d.ts @@ -65,10 +65,11 @@ export declare class LocationGenerator { protected getGuaranteedContainers(staticContainersOnMap: IStaticContainerData[]): IStaticContainerData[]; /** * Choose a number of containers based on their probabilty value to fulfil the desired count in containerData.chosenCount + * @param groupId Name of the group the containers are being collected for * @param containerData Containers and probability values for a groupId * @returns List of chosen container Ids */ - protected getContainersByProbabilty(containerData: IContainerGroupCount): string[]; + protected getContainersByProbabilty(groupId: string, containerData: IContainerGroupCount): string[]; /** * Get a mapping of each groupid and the containers in that group + count of containers to spawn on map * @param containersGroups Container group values diff --git a/TypeScript/14AfterDBLoadHook/types/generators/PMCLootGenerator.d.ts b/TypeScript/14AfterDBLoadHook/types/generators/PMCLootGenerator.d.ts index 9acff69..abb5615 100644 --- a/TypeScript/14AfterDBLoadHook/types/generators/PMCLootGenerator.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/generators/PMCLootGenerator.d.ts @@ -31,12 +31,12 @@ export declare class PMCLootGenerator { */ generatePMCVestLootPool(): string[]; /** - * Check if item has a width/height that lets it fit into a 1x2/2x1 slot - * 1x1 / 1x2 / 2x1 + * Check if item has a width/height that lets it fit into a 2x2 slot + * 1x1 / 1x2 / 2x1 / 2x2 * @param item Item to check size of * @returns true if it fits */ - protected itemFitsInto1By2Slot(item: ITemplateItem): boolean; + protected itemFitsInto2By2Slot(item: ITemplateItem): boolean; /** * Create an array of loot items a PMC can have in their backpack * @returns string array of tpls diff --git a/TypeScript/14AfterDBLoadHook/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/14AfterDBLoadHook/types/generators/RagfairOfferGenerator.d.ts index a627191..58e0b68 100644 --- a/TypeScript/14AfterDBLoadHook/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/generators/RagfairOfferGenerator.d.ts @@ -55,11 +55,10 @@ export declare class RagfairOfferGenerator { * @param items Items in the offer * @param barterScheme Cost of item (currency or barter) * @param loyalLevel Loyalty level needed to buy item - * @param price Price of offer - * @param sellInOnePiece Set StackObjectsCount to 1 + * @param sellInOnePiece Flags sellInOnePiece to be true * @returns IRagfairOffer */ - createFleaOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; + createFleaOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, sellInOnePiece?: boolean): IRagfairOffer; /** * Create an offer object ready to send to ragfairOfferService.addOffer() * @param userID Owner of the offer @@ -67,17 +66,16 @@ export declare class RagfairOfferGenerator { * @param items Items in the offer * @param barterScheme Cost of item (currency or barter) * @param loyalLevel Loyalty level needed to buy item - * @param price Price of offer * @param sellInOnePiece Set StackObjectsCount to 1 * @returns IRagfairOffer */ - protected createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; + protected createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, sellInOnePiece?: boolean): IRagfairOffer; /** * Calculate the offer price that's listed on the flea listing * @param offerRequirements barter requirements for offer * @returns rouble cost of offer */ - protected calculateOfferListingPrice(offerRequirements: OfferRequirement[]): number; + protected convertOfferRequirementsIntoRoubles(offerRequirements: OfferRequirement[]): number; /** * Get avatar url from trader table in db * @param isTrader Is user we're getting avatar for a trader @@ -137,7 +135,7 @@ export declare class RagfairOfferGenerator { * @param itemDetails raw db item details * @returns Item array */ - protected createSingleOfferForItem(items: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; + protected createSingleOfferForItem(items: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; /** * Generate trader offers on flea using the traders assort data * @param traderID Trader to generate offers for @@ -151,7 +149,7 @@ export declare class RagfairOfferGenerator { * @param itemDetails db details of first item * @returns */ - protected getItemCondition(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): Item[]; + protected randomiseItemUpdProperties(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): Item[]; /** * Get the relevant condition id if item tpl matches in ragfair.json/condition * @param tpl Item to look for matching condition object @@ -184,7 +182,7 @@ export declare class RagfairOfferGenerator { * @param offerItems Items for sale in offer * @returns Barter scheme */ - protected createBarterRequirement(offerItems: Item[]): IBarterScheme[]; + protected createBarterBarterScheme(offerItems: Item[]): IBarterScheme[]; /** * Get an array of flea prices + item tpl, cached in generator class inside `allowedFleaPriceItemsForBarter` * @returns array with tpl/price values @@ -196,7 +194,9 @@ export declare class RagfairOfferGenerator { /** * Create a random currency-based barter scheme for an array of items * @param offerItems Items on offer + * @param isPackOffer Is the barter scheme being created for a pack offer + * @param multipler What to multiply the resulting price by * @returns Barter scheme for offer */ - protected createCurrencyRequirement(offerItems: Item[]): IBarterScheme[]; + protected createCurrencyBarterScheme(offerItems: Item[], isPackOffer: boolean, multipler?: number): IBarterScheme[]; } diff --git a/TypeScript/14AfterDBLoadHook/types/generators/ScavCaseRewardGenerator.d.ts b/TypeScript/14AfterDBLoadHook/types/generators/ScavCaseRewardGenerator.d.ts index 4ba1888..b5935d0 100644 --- a/TypeScript/14AfterDBLoadHook/types/generators/ScavCaseRewardGenerator.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/generators/ScavCaseRewardGenerator.d.ts @@ -25,6 +25,8 @@ export declare class ScavCaseRewardGenerator { protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected scavCaseConfig: IScavCaseConfig; + protected dbItemsCache: ITemplateItem[]; + protected dbAmmoItemsCache: ITemplateItem[]; constructor(logger: ILogger, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * Create an array of rewards that will be given to the player upon completing their scav case build @@ -33,10 +35,10 @@ export declare class ScavCaseRewardGenerator { */ generate(recipeId: string): Product[]; /** - * Get all db items that are not blacklisted in scavcase config - * @returns filtered array of db items + * Get all db items that are not blacklisted in scavcase config or global blacklist + * Store in class field */ - protected getDbItems(): ITemplateItem[]; + protected cacheDbItems(): void; /** * Pick a number of items to be rewards, the count is defined by the values in * @param items item pool to pick rewards from diff --git a/TypeScript/14AfterDBLoadHook/types/generators/WeatherGenerator.d.ts b/TypeScript/14AfterDBLoadHook/types/generators/WeatherGenerator.d.ts index 2e2403c..6471bb1 100644 --- a/TypeScript/14AfterDBLoadHook/types/generators/WeatherGenerator.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/generators/WeatherGenerator.d.ts @@ -52,6 +52,7 @@ export declare class WeatherGenerator { */ protected setCurrentDateTime(weather: IWeather): void; protected getWeightedWindDirection(): WindDirection; + protected getWeightedClouds(): number; protected getWeightedWindSpeed(): number; protected getWeightedFog(): number; protected getWeightedRain(): number; diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/HealthHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/HealthHelper.d.ts index 3694a6e..e4cdcd6 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/HealthHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/HealthHelper.d.ts @@ -27,6 +27,7 @@ export declare class HealthHelper { * @param request Heal request * @param sessionID Session id * @param addEffects Should effects be added or removed (default - add) + * @param deleteExistingEffects Should all prior effects be removed before apply new ones */ saveVitality(pmcData: IPmcData, request: ISyncHealthRequestData, sessionID: string, addEffects?: boolean, deleteExistingEffects?: boolean): void; /** diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/InRaidHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/InRaidHelper.d.ts index bf584c2..b4c0c1c 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/InRaidHelper.d.ts @@ -53,7 +53,7 @@ export declare class InRaidHelper { * @param victim Who was killed by player * @returns a numerical standing gain or loss */ - protected getStandingChangeForKill(victim: Victim): number; + protected getFenceStandingChangeForKillAsScav(victim: Victim): number; /** * Reset a profile to a baseline, used post-raid * Reset points earned during session property diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/ItemHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/ItemHelper.d.ts index 99fca56..00f190f 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/ItemHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/ItemHelper.d.ts @@ -26,6 +26,7 @@ declare class ItemHelper { protected itemBaseClassService: ItemBaseClassService; protected localisationService: LocalisationService; protected localeService: LocaleService; + protected readonly defaultInvalidBaseTypes: string[]; constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, localisationService: LocalisationService, localeService: LocaleService); /** * Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash @@ -67,6 +68,11 @@ declare class ItemHelper { * @returns Price in roubles (undefined if not found) */ getDynamicItemPrice(tpl: string): number; + /** + * Update items upd.StackObjectsCount to be 1 if its upd is missing or StackObjectsCount is undefined + * @param item Item to update + * @returns Fixed item + */ fixItemStackCount(item: Item): Item; /** * AmmoBoxes contain StackSlots which need to be filled for the AmmoBox to have content. @@ -125,19 +131,19 @@ declare class ItemHelper { getItemQualityModifier(item: Item): number; /** * Get a quality value based on a repairable items (weapon/armor) current state between current and max durability - * @param itemDetails - * @param repairable repairable object - * @param item - * @returns a number between 0 and 1 + * @param itemDetails Db details for item we want quality value for + * @param repairable Repairable properties + * @param item Item quality value is for + * @returns A number between 0 and 1 */ protected getRepairableItemQualityValue(itemDetails: ITemplateItem, repairable: Repairable, item: Item): number; /** * Recursive function that looks at every item from parameter and gets their childrens Ids + includes parent item in results - * @param items - * @param itemID + * @param items Array of items (item + possible children) + * @param itemId Parent items id * @returns an array of strings */ - findAndReturnChildrenByItems(items: Item[], itemID: string): string[]; + findAndReturnChildrenByItems(items: Item[], itemId: string): string[]; /** * A variant of findAndReturnChildren where the output is list of item objects instead of their ids. * @param items @@ -164,12 +170,6 @@ declare class ItemHelper { * @returns true if it is a dogtag */ isDogtag(tpl: string): boolean; - /** - * Can the item passed in be sold to a trader because it is raw money - * @param tpl Item template id to check - * @returns true if unsellable - */ - isNotSellable(tpl: string): boolean; /** * Gets the identifier for a child using slotId, locationX and locationY. * @param item @@ -183,19 +183,19 @@ declare class ItemHelper { */ isItemTplStackable(tpl: string): boolean; /** - * split item stack if it exceeds its StackMaxSize property - * @param itemToSplit item being split into smaller stacks + * split item stack if it exceeds its items StackMaxSize property + * @param itemToSplit Item to split into smaller stacks * @returns Array of split items */ splitStack(itemToSplit: Item): Item[]; /** - * Find Barter items in the inventory + * Find Barter items from array of items * @param {string} by tpl or id - * @param {Object} pmcData + * @param {Item[]} items Array of items to iterate over * @param {string} barterItemId * @returns Array of Item objects */ - findBarterItems(by: "tpl" | "id", pmcData: IPmcData, barterItemId: string): Item[]; + findBarterItems(by: "tpl" | "id", items: Item[], barterItemId: string): Item[]; /** * Regenerate all guids with new ids, exceptions are for items that cannot be altered (e.g. stash/sorting table) * @param pmcData Player profile @@ -262,10 +262,21 @@ declare class ItemHelper { * @param minSizePercent % the magazine must be filled to */ fillMagazineWithCartridge(magazine: Item[], magTemplate: ITemplateItem, cartridgeTpl: string, minSizePercent?: number): void; + /** + * Choose a random bullet type from the list of possible a magazine has + * @param magTemplate Magazine template from Db + * @returns Tpl of cartridge + */ protected getRandomValidCaliber(magTemplate: ITemplateItem): string; + /** + * Chose a randomly weighted cartridge that fits + * @param caliber Desired caliber + * @param staticAmmoDist Cartridges and thier weights + * @returns Tpl of cartrdige + */ protected drawAmmoTpl(caliber: string, staticAmmoDist: Record): string; /** - * + * Create a basic cartrige object * @param parentId container cartridges will be placed in * @param ammoTpl Cartridge to insert * @param stackCount Count of cartridges inside parent diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/QuestHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/QuestHelper.d.ts index e04b6e0..5c749d3 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/QuestHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/QuestHelper.d.ts @@ -21,6 +21,7 @@ import { DialogueHelper } from "./DialogueHelper"; import { ItemHelper } from "./ItemHelper"; import { PaymentHelper } from "./PaymentHelper"; import { ProfileHelper } from "./ProfileHelper"; +import { QuestConditionHelper } from "./QuestConditionHelper"; import { RagfairServerHelper } from "./RagfairServerHelper"; import { TraderHelper } from "./TraderHelper"; export declare class QuestHelper { @@ -29,6 +30,7 @@ export declare class QuestHelper { protected timeUtil: TimeUtil; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; + protected questConditionHelper: QuestConditionHelper; protected eventOutputHolder: EventOutputHolder; protected databaseServer: DatabaseServer; protected localeService: LocaleService; @@ -41,7 +43,7 @@ export declare class QuestHelper { protected mailSendService: MailSendService; protected configServer: ConfigServer; 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, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, questConditionHelper: QuestConditionHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, mailSendService: MailSendService, configServer: ConfigServer); /** * Get status of a quest in player profile by its id * @param pmcData Profile to search @@ -119,7 +121,7 @@ export declare class QuestHelper { * @param sessionID Session id * @returns Quests accessible to player incuding newly unlocked quests now quest (startedQuestId) was started */ - acceptedUnlocked(startedQuestId: string, sessionID: string): IQuest[]; + getNewlyAccessibleQuestsWhenStartingQuest(startedQuestId: string, sessionID: string): IQuest[]; /** * Get quests that can be shown to player after failing a quest * @param failedQuestId Id of the quest failed by player diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/RagfairOfferHelper.d.ts index de9d550..0699259 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/RagfairOfferHelper.d.ts @@ -1,4 +1,5 @@ import { IPmcData } from "../models/eft/common/IPmcData"; +import { Item } from "../models/eft/common/tables/IItem"; import { ITraderAssort } from "../models/eft/common/tables/ITrader"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; @@ -13,10 +14,10 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { LocaleService } from "../services/LocaleService"; import { LocalisationService } from "../services/LocalisationService"; +import { MailSendService } from "../services/MailSendService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { HashUtil } from "../utils/HashUtil"; import { TimeUtil } from "../utils/TimeUtil"; -import { DialogueHelper } from "./DialogueHelper"; import { ItemHelper } from "./ItemHelper"; import { PaymentHelper } from "./PaymentHelper"; import { PresetHelper } from "./PresetHelper"; @@ -33,7 +34,6 @@ export declare class RagfairOfferHelper { protected databaseServer: DatabaseServer; protected traderHelper: TraderHelper; protected saveServer: SaveServer; - protected dialogueHelper: DialogueHelper; protected itemHelper: ItemHelper; protected paymentHelper: PaymentHelper; protected presetHelper: PresetHelper; @@ -44,11 +44,12 @@ export declare class RagfairOfferHelper { protected ragfairOfferService: RagfairOfferService; protected localeService: LocaleService; protected localisationService: LocalisationService; + protected mailSendService: MailSendService; protected configServer: ConfigServer; protected static goodSoldTemplate: string; protected ragfairConfig: IRagfairConfig; 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, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, localisationService: LocalisationService, mailSendService: MailSendService, configServer: ConfigServer); /** * Passthrough to ragfairOfferService.getOffers(), get flea offers a player should see * @param searchRequest Data from client @@ -119,19 +120,26 @@ export declare class RagfairOfferHelper { */ protected getProfileOffers(sessionID: string): IRagfairOffer[]; /** - * Delete an offer from a desired profile + * Delete an offer from a desired profile and from ragfair offers * @param sessionID Session id of profile to delete offer from - * @param offerId Offer id to delete + * @param offerId Id of offer to delete */ - protected deleteOfferByOfferId(sessionID: string, offerId: string): void; + protected deleteOfferById(sessionID: string, offerId: string): void; /** * Complete the selling of players' offer * @param sessionID Session id * @param offer Sold offer details * @param boughtAmount Amount item was purchased for - * @returns Client response + * @returns IItemEventRouterResponse */ protected completeOffer(sessionID: string, offer: IRagfairOffer, boughtAmount: number): IItemEventRouterResponse; + /** + * Get a localised message for when players offer has sold on flea + * @param itemTpl Item sold + * @param boughtAmount How many were purchased + * @returns Localised message text + */ + protected getLocalisedOfferSoldMessage(itemTpl: string, boughtAmount: number): string; /** * Should a ragfair offer be visible to the player * @param searchRequest Search request @@ -142,4 +150,12 @@ export declare class RagfairOfferHelper { * @returns True = should be shown to player */ isDisplayableOffer(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, offer: IRagfairOffer, pmcProfile: IPmcData): boolean; + /** + * Is items quality value within desired range + * @param item Item to check quality of + * @param min Desired minimum quality + * @param max Desired maximum quality + * @returns True if in range + */ + protected itemQualityInRange(item: Item, min: number, max: number): boolean; } diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/RagfairSellHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/RagfairSellHelper.d.ts index 251d7ca..913b408 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/RagfairSellHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/RagfairSellHelper.d.ts @@ -13,12 +13,12 @@ export declare class RagfairSellHelper { constructor(logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, configServer: ConfigServer); /** * Get the percent chance to sell an item based on its average listed price vs player chosen listing price - * @param baseChancePercent Base chance to sell item * @param averageOfferPriceRub Price of average offer in roubles * @param playerListedPriceRub Price player listed item for in roubles + * @param qualityMultiplier Quality multipler of item being sold * @returns percent value */ - calculateSellChance(baseChancePercent: number, averageOfferPriceRub: number, playerListedPriceRub: number): number; + calculateSellChance(averageOfferPriceRub: number, playerListedPriceRub: number, qualityMultiplier: number): number; /** * Get percent chance to sell an item when price is below items average listing price * @param playerListedPriceRub Price player listed item for in roubles diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/TraderHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/TraderHelper.d.ts index c163f7a..6680ccf 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/TraderHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/TraderHelper.d.ts @@ -35,7 +35,7 @@ export declare class TraderHelper { protected highestTraderBuyPriceItems: Record; constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, handbookHelper: HandbookHelper, itemHelper: ItemHelper, playerService: PlayerService, localisationService: LocalisationService, fenceService: FenceService, timeUtil: TimeUtil, randomUtil: RandomUtil, configServer: ConfigServer); getTrader(traderID: string, sessionID: string): ITraderBase; - getTraderAssortsById(traderId: string): ITraderAssort; + getTraderAssortsByTraderId(traderId: string): ITraderAssort; /** * 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 diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/IBotBase.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/IBotBase.d.ts index ee40958..6c7b76f 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/IBotBase.d.ts @@ -281,7 +281,7 @@ export interface InsuredItem { export interface Hideout { Production: Record; Areas: HideoutArea[]; - Improvements: Record; + Improvement: Record; Seed: number; sptUpdateLastRunTimestamp: number; } diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/health/IHealthTreatmentRequestData.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/health/IHealthTreatmentRequestData.d.ts index 7fb80a8..598e60c 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/eft/health/IHealthTreatmentRequestData.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/health/IHealthTreatmentRequestData.d.ts @@ -1,12 +1,14 @@ export interface IHealthTreatmentRequestData { Action: "RestoreHealth"; trader: string; - items: Item[]; + items: Cost[]; difference: Difference; timestamp: number; } -export interface Item { +export interface Cost { + /** Id of stack to take money from */ id: string; + /** Amount of money to take off player for treatment */ count: number; } export interface Difference { @@ -25,5 +27,6 @@ export interface BodyParts { } export interface BodyPart { Health: number; + /** Effects in array are to be removed */ Effects: string[]; } diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/notifier/INotifier.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/notifier/INotifier.d.ts index ce25dee..c6c6979 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/eft/notifier/INotifier.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/notifier/INotifier.d.ts @@ -14,6 +14,11 @@ export interface INotification { } export declare enum NotificationType { RAGFAIR_OFFER_SOLD = "RagfairOfferSold", + RAGFAIR_RATING_CHANGE = "RagfairRatingChange", + /** ChatMessageReceived */ NEW_MESSAGE = "new_message", - PING = "ping" + PING = "ping", + TRADER_SUPPLY = "TraderSupply", + TRADER_STANDING = "TraderStanding", + UNLOCK_TRADER = "UnlockTrader" } diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/notifier/ISelectProfileResponse.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/notifier/ISelectProfileResponse.d.ts index ecb668a..f2d6be7 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/eft/notifier/ISelectProfileResponse.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/notifier/ISelectProfileResponse.d.ts @@ -1,6 +1,3 @@ -import { INotifierChannel } from "./INotifier"; export interface ISelectProfileResponse { status: string; - notifier: INotifierChannel; - notifierServer: string; } diff --git a/TypeScript/14AfterDBLoadHook/types/models/enums/WeatherType.d.ts b/TypeScript/14AfterDBLoadHook/types/models/enums/WeatherType.d.ts index d31fefe..503dc30 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/enums/WeatherType.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/enums/WeatherType.d.ts @@ -1,19 +1,19 @@ export declare enum WeatherType { - CLEAR_DAY = 1, - CLEAR_WIND = 2, - CLEAR_NIGHT = 3, - PARTLY_CLOUD_DAY = 4, - PARTLY_CLOUD_NIGHT = 5, - CLEAR_FOG_DAY = 6, - CLEAR_FOG_NIGHT = 7, - CLOUDFOG = 8, - FOG = 9, - MOSTLY_CLOUD = 10, - LIGHT_RAIN = 11, - RAIN = 12, - CLOUD_WIND = 13, - CLOUD_WIND_RAIN = 14, - FULL_CLOUD = 15, - THUNDER_CLOUD = 16, - NONE = 0 + CLEAR_DAY = 0, + CLEAR_WIND = 1, + CLEAR_NIGHT = 2, + PARTLY_CLOUD_DAY = 3, + PARTLY_CLOUD_NIGHT = 4, + CLEAR_FOG_DAY = 5, + CLEAR_FOG_NIGHT = 6, + CLOUD_FOG = 7, + FOG = 8, + MOSTLY_CLOUD = 9, + LIGHT_RAIN = 10, + RAIN = 11, + CLOUD_WIND = 12, + CLOUD_WIND_RAIN = 13, + FULL_CLOUD = 14, + THUNDER_CLOUD = 15, + NONE = 16 } diff --git a/TypeScript/14AfterDBLoadHook/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IRagfairConfig.d.ts index 7c04857..7aea24f 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IRagfairConfig.d.ts @@ -41,7 +41,8 @@ export interface Dynamic { /** Use the highest trader price for an offer if its greater than the price in templates/prices.json */ useTraderPriceForOffersIfHigher: boolean; /** Barter offer specific settings */ - barter: Barter; + barter: IBarterDetails; + pack: IPackDetails; /** Dynamic offer price below handbook adjustment values */ offerAdjustment: OfferAdjustment; /** How many offers should expire before an offer regeneration occurs */ @@ -49,9 +50,7 @@ export interface Dynamic { /** How many offers should be listed */ offerItemCount: MinMax; /** How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) */ - price: MinMax; - /** How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) */ - presetPrice: MinMax; + priceRanges: IPriceRanges; /** Should default presets to listed only or should non-standard presets found in globals.json be listed too */ showDefaultPresetsOnly: boolean; endTimeSeconds: MinMax; @@ -74,7 +73,12 @@ export interface Dynamic { /** Dict of price limits keyed by item type */ unreasonableModPrices: Record; } -export interface Barter { +export interface IPriceRanges { + default: MinMax; + preset: MinMax; + pack: MinMax; +} +export interface IBarterDetails { /** Should barter offers be generated */ enable: boolean; /** Percentage change an offer is listed as a barter */ @@ -90,6 +94,18 @@ export interface Barter { /** Item Tpls to never be turned into a barter */ itemTypeBlacklist: string[]; } +export interface IPackDetails { + /** Should pack offers be generated */ + enable: boolean; + /** Percentage change an offer is listed as a pack */ + chancePercent: number; + /** Min number of required items for a pack */ + itemCountMin: number; + /** Max number of required items for a pack */ + itemCountMax: number; + /** item types to allow being a pack */ + itemTypeWhitelist: string[]; +} export interface OfferAdjustment { /** Shuld offer price be adjusted when below handbook price */ adjustPriceWhenBelowHandbookPrice: boolean; diff --git a/TypeScript/14AfterDBLoadHook/types/models/spt/config/IWeatherConfig.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IWeatherConfig.d.ts index 41a1c83..6ecf35b 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/spt/config/IWeatherConfig.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IWeatherConfig.d.ts @@ -7,7 +7,7 @@ export interface IWeatherConfig extends IBaseConfig { weather: Weather; } export interface Weather { - clouds: MinMax; + clouds: WeatherSettings; windSpeed: WeatherSettings; windDirection: WeatherSettings; windGustiness: MinMax; diff --git a/TypeScript/14AfterDBLoadHook/types/services/HashCacheService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/HashCacheService.d.ts index 5320f28..9968478 100644 --- a/TypeScript/14AfterDBLoadHook/types/services/HashCacheService.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/services/HashCacheService.d.ts @@ -11,7 +11,18 @@ export declare class HashCacheService { protected modHashes: any; protected readonly modCachePath = "./user/cache/modCache.json"; constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); + /** + * Return a stored hash by key + * @param modName Name of mod to get hash for + * @returns Mod hash + */ getStoredModHash(modName: string): string; + /** + * Does the generated hash match the stored hash + * @param modName name of mod + * @param modContent + * @returns True if they match + */ modContentMatchesStoredHash(modName: string, modContent: string): boolean; hashMatchesStoredHash(modName: string, modHash: string): boolean; storeModContent(modName: string, modContent: string): void; diff --git a/TypeScript/14AfterDBLoadHook/types/services/MailSendService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/MailSendService.d.ts index 19397dc..fe4a7fe 100644 --- a/TypeScript/14AfterDBLoadHook/types/services/MailSendService.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/services/MailSendService.d.ts @@ -35,7 +35,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendDirectNpcMessageToPlayer(playerId: string, sender: Traders, messageType: MessageType, message: string, items?: Item[], maxStorageTimeSeconds?: any): void; + sendDirectNpcMessageToPlayer(playerId: string, sender: Traders, messageType: MessageType, message: string, items?: Item[], maxStorageTimeSeconds?: any, systemData?: any, ragfair?: any): void; /** * Send a message from an NPC (e.g. prapor) to the player with or without items * @param playerId Players id to send message to @@ -45,7 +45,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendLocalisedNpcMessageToPlayer(playerId: string, sender: Traders, messageType: MessageType, messageLocaleId: string, items?: Item[], maxStorageTimeSeconds?: any, systemData?: any): void; + sendLocalisedNpcMessageToPlayer(playerId: string, sender: Traders, messageType: MessageType, messageLocaleId: string, items?: Item[], maxStorageTimeSeconds?: any, systemData?: any, ragfair?: any): void; /** * Send a message from SYSTEM to the player with or without items * @param playerId Players id to send message to diff --git a/TypeScript/14AfterDBLoadHook/types/services/MatchBotDetailsCacheService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/MatchBotDetailsCacheService.d.ts index eb365dd..c1bd322 100644 --- a/TypeScript/14AfterDBLoadHook/types/services/MatchBotDetailsCacheService.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/services/MatchBotDetailsCacheService.d.ts @@ -1,7 +1,7 @@ import { IBotBase } from "../models/eft/common/tables/IBotBase"; import { ILogger } from "../models/spt/utils/ILogger"; import { LocalisationService } from "./LocalisationService"; -/** Cache bots in a dictionary, keyed by the bots name, keying by name isnt idea as its not unique but this is used by the post-raid system which doesnt have any bot ids, only name */ +/** Cache bots in a dictionary, keyed by the bots name, keying by name isnt ideal as its not unique but this is used by the post-raid system which doesnt have any bot ids, only name */ export declare class MatchBotDetailsCacheService { protected logger: ILogger; protected localisationService: LocalisationService; @@ -17,9 +17,9 @@ export declare class MatchBotDetailsCacheService { */ clearCache(): void; /** - * Find a bot in the cache by its name + * Find a bot in the cache by its name and side * @param botName Name of bot to find * @returns Bot details */ - getBotByName(botName: string): IBotBase; + getBotByNameAndSide(botName: string, botSide: string): IBotBase; } diff --git a/TypeScript/14AfterDBLoadHook/types/services/ModCompilerService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/ModCompilerService.d.ts index a4bf3c8..e306177 100644 --- a/TypeScript/14AfterDBLoadHook/types/services/ModCompilerService.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/services/ModCompilerService.d.ts @@ -1,14 +1,36 @@ import { CompilerOptions } from "typescript"; import type { ILogger } from "../models/spt/utils/ILogger"; -import { HashCacheService } from "./HashCacheService"; import { VFS } from "../utils/VFS"; +import { HashCacheService } from "./HashCacheService"; export declare class ModCompilerService { protected logger: ILogger; protected hashCacheService: HashCacheService; protected vfs: VFS; constructor(logger: ILogger, hashCacheService: HashCacheService, vfs: VFS); + /** + * Convert a mods TS into JS + * @param modName Name of mod + * @param modPath Dir path to mod + * @param modTypeScriptFiles + * @returns + */ compileMod(modName: string, modPath: string, modTypeScriptFiles: string[]): Promise; + /** + * Convert a TS file into JS + * @param fileNames Paths to TS files + * @param options Compiler options + */ protected compile(fileNames: string[], options: CompilerOptions): Promise; + /** + * Do the files at the provided paths exist + * @param fileNames + * @returns + */ protected areFilesReady(fileNames: string[]): boolean; + /** + * Wait the provided number of milliseconds + * @param ms Milliseconds + * @returns + */ protected delay(ms: number): Promise; } diff --git a/TypeScript/14AfterDBLoadHook/types/services/PaymentService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/PaymentService.d.ts index 1c9c32b..fb5f92c 100644 --- a/TypeScript/14AfterDBLoadHook/types/services/PaymentService.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/services/PaymentService.d.ts @@ -61,23 +61,26 @@ export declare class PaymentService { * Get all money stacks in inventory and prioritse items in stash * @param pmcData * @param currencyTpl + * @param playerStashId Players stash id * @returns Sorting money items */ - protected getSortedMoneyItemsInInventory(pmcData: IPmcData, currencyTpl: string): Item[]; + protected getSortedMoneyItemsInInventory(pmcData: IPmcData, currencyTpl: string, playerStashId: string): Item[]; /** * Prioritise player stash first over player inventory * Post-raid healing would often take money out of the players pockets/secure container * @param a First money stack item * @param b Second money stack item * @param inventoryItems players inventory items + * @param playerStashId Players stash id * @returns sort order */ - protected prioritiseStashSort(a: Item, b: Item, inventoryItems: Item[]): number; + protected prioritiseStashSort(a: Item, b: Item, inventoryItems: Item[], playerStashId: string): number; /** * Recursivly check items parents to see if it is inside the players inventory, not stash * @param itemId item id to check * @param inventoryItems player inventory + * @param playerStashId Players stash id * @returns true if its in inventory */ - protected isInInventory(itemId: string, inventoryItems: Item[]): boolean; + protected isInStash(itemId: string, inventoryItems: Item[], playerStashId: string): boolean; } diff --git a/TypeScript/14AfterDBLoadHook/types/services/ProfileFixerService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/ProfileFixerService.d.ts index c8232fc..bc1e42e 100644 --- a/TypeScript/14AfterDBLoadHook/types/services/ProfileFixerService.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/services/ProfileFixerService.d.ts @@ -14,6 +14,7 @@ import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; import { Watermark } from "../utils/Watermark"; import { LocalisationService } from "./LocalisationService"; @@ -27,17 +28,19 @@ export declare class ProfileFixerService { protected itemHelper: ItemHelper; protected localisationService: LocalisationService; protected timeUtil: TimeUtil; + protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, profileHelper: ProfileHelper, itemHelper: ItemHelper, localisationService: LocalisationService, timeUtil: TimeUtil, databaseServer: DatabaseServer, configServer: ConfigServer); + constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, profileHelper: ProfileHelper, itemHelper: ItemHelper, localisationService: LocalisationService, timeUtil: TimeUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, configServer: ConfigServer); /** * 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; protected addMissingGunStandContainerImprovements(pmcProfile: IPmcData): void; + protected ensureGunStandLevelsMatch(pmcProfile: IPmcData): void; protected addHideoutAreaStashes(pmcProfile: IPmcData): void; protected addMissingHideoutWallAreas(pmcProfile: IPmcData): void; protected adjustUnreasonableModFleaPrices(): void; @@ -131,4 +134,9 @@ export declare class ProfileFixerService { * @param pmcProfile Profile to add missing IDs to */ addMissingIdsToBonuses(pmcProfile: IPmcData): void; + /** + * At some point the property name was changed,migrate data across to new name + * @param pmcProfile + */ + protected migrateImprovements(pmcProfile: IPmcData): void; } diff --git a/TypeScript/14AfterDBLoadHook/types/services/RagfairPriceService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/RagfairPriceService.d.ts index e245efa..ff35327 100644 --- a/TypeScript/14AfterDBLoadHook/types/services/RagfairPriceService.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/services/RagfairPriceService.d.ts @@ -3,6 +3,7 @@ import { HandbookHelper } from "../helpers/HandbookHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { TraderHelper } from "../helpers/TraderHelper"; +import { MinMax } from "../models/common/MinMax"; import { IPreset } from "../models/eft/common/IGlobals"; import { Item } from "../models/eft/common/tables/IItem"; import { IBarterScheme } from "../models/eft/common/tables/ITrader"; @@ -35,10 +36,6 @@ export declare class RagfairPriceService implements OnLoad { * Generate static (handbook) and dynamic (prices.json) flea prices, store inside class as dictionaries */ onLoad(): Promise; - /** - * Add placeholder values for items missing from handbook - */ - protected addMissingHandbookPrices(): void; getRoute(): string; /** * Iterate over all items of type "Item" in db and get template price, store in cache @@ -91,9 +88,17 @@ export declare class RagfairPriceService implements OnLoad { * Generate a currency cost for an item and its mods * @param items Item with mods to get price for * @param desiredCurrency Currency price desired in + * @param isPackOffer Price is for a pack type offer * @returns cost of item in desired currency */ - getDynamicOfferPrice(items: Item[], desiredCurrency: string): number; + getDynamicOfferPriceForOffer(items: Item[], desiredCurrency: string, isPackOffer: boolean): number; + /** + * Get different min/max price multipliers for different offer types (preset/pack/default) + * @param isPreset Offer is a preset + * @param isPack Offer is a pack + * @returns MinMax values + */ + protected getOfferTypeRangeValues(isPreset: boolean, isPack: boolean): MinMax; /** * Check to see if an items price is below its handbook price and adjust accoring to values set to config/ragfair.json * @param itemPrice price of item @@ -104,10 +109,10 @@ export declare class RagfairPriceService implements OnLoad { /** * Multiply the price by a randomised curve where n = 2, shift = 2 * @param existingPrice price to alter - * @param isPreset is the item we're multiplying a preset + * @param rangeValues min and max to adjust price by * @returns multiplied price */ - protected randomisePrice(existingPrice: number, isPreset: boolean): number; + protected randomiseOfferPrice(existingPrice: number, rangeValues: MinMax): number; /** * Calculate the cost of a weapon preset by adding together the price of its mods + base price of default weapon preset * @param item base weapon diff --git a/TypeScript/15HttpListenerExample/types/callbacks/GameCallbacks.d.ts b/TypeScript/15HttpListenerExample/types/callbacks/GameCallbacks.d.ts index aa80036..46f79f9 100644 --- a/TypeScript/15HttpListenerExample/types/callbacks/GameCallbacks.d.ts +++ b/TypeScript/15HttpListenerExample/types/callbacks/GameCallbacks.d.ts @@ -1,4 +1,5 @@ import { GameController } from "../controllers/GameController"; +import { OnLoad } from "../di/OnLoad"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { ICheckVersionResponse } from "../models/eft/game/ICheckVersionResponse"; import { ICurrentGroupResponse } from "../models/eft/game/ICurrentGroupResponse"; @@ -15,12 +16,14 @@ import { INullResponseData } from "../models/eft/httpResponse/INullResponseData" import { SaveServer } from "../servers/SaveServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { Watermark } from "../utils/Watermark"; -declare class GameCallbacks { +declare class GameCallbacks implements OnLoad { protected httpResponse: HttpResponseUtil; protected watermark: Watermark; protected saveServer: SaveServer; protected gameController: GameController; constructor(httpResponse: HttpResponseUtil, watermark: Watermark, saveServer: SaveServer, gameController: GameController); + onLoad(): Promise; + getRoute(): string; /** * Handle client/game/version/validate * @returns INullResponseData diff --git a/TypeScript/15HttpListenerExample/types/controllers/GameController.d.ts b/TypeScript/15HttpListenerExample/types/controllers/GameController.d.ts index 04e3abb..e88610e 100644 --- a/TypeScript/15HttpListenerExample/types/controllers/GameController.d.ts +++ b/TypeScript/15HttpListenerExample/types/controllers/GameController.d.ts @@ -61,13 +61,14 @@ export declare class GameController { protected pmcConfig: IPmcConfig; protected lootConfig: ILootConfig; constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, randomUtil: RandomUtil, encodingUtil: EncodingUtil, hideoutHelper: HideoutHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, seasonalEventService: SeasonalEventService, itemBaseClassService: ItemBaseClassService, giftService: GiftService, applicationContext: ApplicationContext, configServer: ConfigServer); + load(): void; /** * Handle client/game/start */ gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; protected addCustomLooseLootPositions(): void; protected adjustLooseLootSpawnProbabilities(): void; - protected setHideoutAreasAndCraftsTo30Secs(): void; + protected setHideoutAreasAndCraftsTo40Secs(): void; /** * 3.7.0 moved AIDs to be numeric, old profiles need to be migrated * We store the old AID value in new field `sessionId` diff --git a/TypeScript/15HttpListenerExample/types/controllers/HealthController.d.ts b/TypeScript/15HttpListenerExample/types/controllers/HealthController.d.ts index 1938297..2d7ff09 100644 --- a/TypeScript/15HttpListenerExample/types/controllers/HealthController.d.ts +++ b/TypeScript/15HttpListenerExample/types/controllers/HealthController.d.ts @@ -29,34 +29,35 @@ export declare class HealthController { * stores in-raid player health * @param pmcData Player profile * @param info Request data - * @param sessionID + * @param sessionID Player id * @param addEffects Should effects found be added or removed from profile + * @param deleteExistingEffects Should all prior effects be removed before apply new ones */ saveVitality(pmcData: IPmcData, info: ISyncHealthRequestData, sessionID: string, addEffects?: boolean, deleteExistingEffects?: boolean): void; /** * When healing in menu - * @param pmcData - * @param body - * @param sessionID - * @returns + * @param pmcData Player profile + * @param request Healing request + * @param sessionID Player id + * @returns IItemEventRouterResponse */ - offraidHeal(pmcData: IPmcData, body: IOffraidHealRequestData, sessionID: string): IItemEventRouterResponse; + offraidHeal(pmcData: IPmcData, request: IOffraidHealRequestData, sessionID: string): IItemEventRouterResponse; /** * Handle Eat event * Consume food/water outside of a raid * @param pmcData Player profile - * @param body request Object + * @param request Eat request * @param sessionID Session id * @returns IItemEventRouterResponse */ - offraidEat(pmcData: IPmcData, body: IOffraidEatRequestData, sessionID: string): IItemEventRouterResponse; + offraidEat(pmcData: IPmcData, request: IOffraidEatRequestData, sessionID: string): IItemEventRouterResponse; /** * Handle RestoreHealth event * Occurs on post-raid healing page * @param pmcData player profile * @param healthTreatmentRequest Request data from client * @param sessionID Session id - * @returns + * @returns IItemEventRouterResponse */ healthTreatment(pmcData: IPmcData, healthTreatmentRequest: IHealthTreatmentRequestData, sessionID: string): IItemEventRouterResponse; /** @@ -66,12 +67,4 @@ export declare class HealthController { * @param sessionID */ applyWorkoutChanges(pmcData: IPmcData, info: IWorkoutData, sessionId: string): void; - /** - * Iterate over treatment request diff and find effects to remove from player limbs - * @param sessionId - * @param profile Profile to update - * @param treatmentRequest client request - * @param output response to send to client - */ - protected removeEffectsAfterPostRaidHeal(sessionId: string, profile: IPmcData, treatmentRequest: IHealthTreatmentRequestData, output: IItemEventRouterResponse): void; } diff --git a/TypeScript/15HttpListenerExample/types/controllers/HideoutController.d.ts b/TypeScript/15HttpListenerExample/types/controllers/HideoutController.d.ts index 877c076..a90a16d 100644 --- a/TypeScript/15HttpListenerExample/types/controllers/HideoutController.d.ts +++ b/TypeScript/15HttpListenerExample/types/controllers/HideoutController.d.ts @@ -88,11 +88,11 @@ export declare class HideoutController { * @param pmcData Profile to edit * @param output Object to send back to client * @param sessionID Session/player id - * @param profileHideoutArea Current hideout data for profile + * @param profileParentHideoutArea Current hideout area for profile * @param dbHideoutArea Hideout area being upgraded * @param hideoutStage Stage hideout area is being upgraded to */ - protected addContainerImprovementToProfile(output: IItemEventRouterResponse, sessionID: string, pmcData: IPmcData, profileHideoutArea: HideoutArea, dbHideoutArea: IHideoutArea, hideoutStage: Stage): void; + protected addContainerImprovementToProfile(output: IItemEventRouterResponse, sessionID: string, pmcData: IPmcData, profileParentHideoutArea: HideoutArea, dbHideoutArea: IHideoutArea, hideoutStage: Stage): void; /** * Add an inventory item to profile from a hideout area stage data * @param pmcData Profile to update diff --git a/TypeScript/15HttpListenerExample/types/controllers/LocationController.d.ts b/TypeScript/15HttpListenerExample/types/controllers/LocationController.d.ts index 94d496a..94f5fce 100644 --- a/TypeScript/15HttpListenerExample/types/controllers/LocationController.d.ts +++ b/TypeScript/15HttpListenerExample/types/controllers/LocationController.d.ts @@ -4,6 +4,7 @@ import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { ILocationBase } from "../models/eft/common/ILocationBase"; import { ILocationsGenerateAllResponse } from "../models/eft/common/ILocationsSourceDestinationBase"; import { IAirdropLootResult } from "../models/eft/location/IAirdropLootResult"; +import { IGetLocationRequestData } from "../models/eft/location/IGetLocationRequestData"; import { AirdropTypeEnum } from "../models/enums/AirdropType"; import { IAirdropConfig } from "../models/spt/config/IAirdropConfig"; import { ILocationConfig } from "../models/spt/config/ILocationConfig"; @@ -34,10 +35,11 @@ export declare class LocationController { /** * Handle client/location/getLocalloot * Get a location (map) with generated loot data - * @param location Map to generate loot for + * @param sessionId Player id + * @param request Map request to generate * @returns ILocationBase */ - get(location: string): ILocationBase; + get(sessionId: string, request: IGetLocationRequestData): ILocationBase; /** * Generate a maps base location with loot * @param name Map name diff --git a/TypeScript/15HttpListenerExample/types/controllers/QuestController.d.ts b/TypeScript/15HttpListenerExample/types/controllers/QuestController.d.ts index 7d494a6..bd8a70f 100644 --- a/TypeScript/15HttpListenerExample/types/controllers/QuestController.d.ts +++ b/TypeScript/15HttpListenerExample/types/controllers/QuestController.d.ts @@ -61,7 +61,7 @@ export declare class QuestController { * @param playerLevel level of player to test against quest * @returns true if quest can be seen/accepted by player of defined level */ - protected playerLevelFulfillsQuestRequrement(quest: IQuest, playerLevel: number): boolean; + protected playerLevelFulfillsQuestRequirement(quest: IQuest, playerLevel: number): boolean; /** * Should a quest be shown to the player in trader quest screen * @param questId Quest to check diff --git a/TypeScript/15HttpListenerExample/types/controllers/RagfairController.d.ts b/TypeScript/15HttpListenerExample/types/controllers/RagfairController.d.ts index 76c27f7..bda37cd 100644 --- a/TypeScript/15HttpListenerExample/types/controllers/RagfairController.d.ts +++ b/TypeScript/15HttpListenerExample/types/controllers/RagfairController.d.ts @@ -21,6 +21,7 @@ import { IGetMarketPriceRequestData } from "../models/eft/ragfair/IGetMarketPric import { IGetOffersResult } from "../models/eft/ragfair/IGetOffersResult"; import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; import { ISearchRequestData } from "../models/eft/ragfair/ISearchRequestData"; +import { IProcessBuyTradeRequestData } from "../models/eft/trade/IProcessBuyTradeRequestData"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; @@ -125,6 +126,18 @@ export declare class RagfairController { * @returns IItemEventRouterResponse */ addPlayerOffer(pmcData: IPmcData, offerRequest: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Charge player a listing fee for using flea, pulls charge from data previously sent by client + * @param sessionID Player id + * @param rootItem Base item being listed (used when client tax cost not found and must be done on server) + * @param pmcData Player profile + * @param requirementsPriceInRub Rouble cost player chose for listing (used when client tax cost not found and must be done on server) + * @param itemStackCount How many items were listed in player (used when client tax cost not found and must be done on server) + * @param offerRequest Add offer request object from client + * @param output IItemEventRouterResponse + * @returns True if charging tax to player failed + */ + protected chargePlayerTaxFee(sessionID: string, rootItem: Item, pmcData: IPmcData, requirementsPriceInRub: number, itemStackCount: number, offerRequest: IAddOfferRequestData, output: IItemEventRouterResponse): boolean; /** * Is the item to be listed on the flea valid * @param offerRequest Client offer request @@ -158,4 +171,11 @@ export declare class RagfairController { */ removeOffer(offerId: string, sessionID: string): IItemEventRouterResponse; extendOffer(info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Create a basic trader request object with price and currency type + * @param currency What currency: RUB, EURO, USD + * @param value Amount of currency + * @returns IProcessBuyTradeRequestData + */ + protected createBuyTradeRequestObject(currency: string, value: number): IProcessBuyTradeRequestData; } diff --git a/TypeScript/15HttpListenerExample/types/generators/BotEquipmentModGenerator.d.ts b/TypeScript/15HttpListenerExample/types/generators/BotEquipmentModGenerator.d.ts index ccbbbbf..f7abb84 100644 --- a/TypeScript/15HttpListenerExample/types/generators/BotEquipmentModGenerator.d.ts +++ b/TypeScript/15HttpListenerExample/types/generators/BotEquipmentModGenerator.d.ts @@ -14,7 +14,6 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; import { BotEquipmentModPoolService } from "../services/BotEquipmentModPoolService"; import { BotModLimits, BotWeaponModLimitService } from "../services/BotWeaponModLimitService"; -import { ItemBaseClassService } from "../services/ItemBaseClassService"; import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; @@ -29,7 +28,6 @@ export declare class BotEquipmentModGenerator { protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; protected botEquipmentFilterService: BotEquipmentFilterService; - protected itemBaseClassService: ItemBaseClassService; protected itemFilterService: ItemFilterService; protected profileHelper: ProfileHelper; protected botWeaponModLimitService: BotWeaponModLimitService; @@ -40,7 +38,7 @@ export declare class BotEquipmentModGenerator { protected botEquipmentModPoolService: BotEquipmentModPoolService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, itemHelper: ItemHelper, botEquipmentFilterService: BotEquipmentFilterService, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponModLimitService: BotWeaponModLimitService, botHelper: BotHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, botEquipmentModPoolService: BotEquipmentModPoolService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, itemHelper: ItemHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponModLimitService: BotWeaponModLimitService, botHelper: BotHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, botEquipmentModPoolService: BotEquipmentModPoolService, configServer: ConfigServer); /** * Check mods are compatible and add to array * @param equipment Equipment item to add mods to diff --git a/TypeScript/15HttpListenerExample/types/generators/LocationGenerator.d.ts b/TypeScript/15HttpListenerExample/types/generators/LocationGenerator.d.ts index b8169d3..46a514b 100644 --- a/TypeScript/15HttpListenerExample/types/generators/LocationGenerator.d.ts +++ b/TypeScript/15HttpListenerExample/types/generators/LocationGenerator.d.ts @@ -65,10 +65,11 @@ export declare class LocationGenerator { protected getGuaranteedContainers(staticContainersOnMap: IStaticContainerData[]): IStaticContainerData[]; /** * Choose a number of containers based on their probabilty value to fulfil the desired count in containerData.chosenCount + * @param groupId Name of the group the containers are being collected for * @param containerData Containers and probability values for a groupId * @returns List of chosen container Ids */ - protected getContainersByProbabilty(containerData: IContainerGroupCount): string[]; + protected getContainersByProbabilty(groupId: string, containerData: IContainerGroupCount): string[]; /** * Get a mapping of each groupid and the containers in that group + count of containers to spawn on map * @param containersGroups Container group values diff --git a/TypeScript/15HttpListenerExample/types/generators/PMCLootGenerator.d.ts b/TypeScript/15HttpListenerExample/types/generators/PMCLootGenerator.d.ts index 9acff69..abb5615 100644 --- a/TypeScript/15HttpListenerExample/types/generators/PMCLootGenerator.d.ts +++ b/TypeScript/15HttpListenerExample/types/generators/PMCLootGenerator.d.ts @@ -31,12 +31,12 @@ export declare class PMCLootGenerator { */ generatePMCVestLootPool(): string[]; /** - * Check if item has a width/height that lets it fit into a 1x2/2x1 slot - * 1x1 / 1x2 / 2x1 + * Check if item has a width/height that lets it fit into a 2x2 slot + * 1x1 / 1x2 / 2x1 / 2x2 * @param item Item to check size of * @returns true if it fits */ - protected itemFitsInto1By2Slot(item: ITemplateItem): boolean; + protected itemFitsInto2By2Slot(item: ITemplateItem): boolean; /** * Create an array of loot items a PMC can have in their backpack * @returns string array of tpls diff --git a/TypeScript/15HttpListenerExample/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/15HttpListenerExample/types/generators/RagfairOfferGenerator.d.ts index a627191..58e0b68 100644 --- a/TypeScript/15HttpListenerExample/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/15HttpListenerExample/types/generators/RagfairOfferGenerator.d.ts @@ -55,11 +55,10 @@ export declare class RagfairOfferGenerator { * @param items Items in the offer * @param barterScheme Cost of item (currency or barter) * @param loyalLevel Loyalty level needed to buy item - * @param price Price of offer - * @param sellInOnePiece Set StackObjectsCount to 1 + * @param sellInOnePiece Flags sellInOnePiece to be true * @returns IRagfairOffer */ - createFleaOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; + createFleaOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, sellInOnePiece?: boolean): IRagfairOffer; /** * Create an offer object ready to send to ragfairOfferService.addOffer() * @param userID Owner of the offer @@ -67,17 +66,16 @@ export declare class RagfairOfferGenerator { * @param items Items in the offer * @param barterScheme Cost of item (currency or barter) * @param loyalLevel Loyalty level needed to buy item - * @param price Price of offer * @param sellInOnePiece Set StackObjectsCount to 1 * @returns IRagfairOffer */ - protected createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; + protected createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, sellInOnePiece?: boolean): IRagfairOffer; /** * Calculate the offer price that's listed on the flea listing * @param offerRequirements barter requirements for offer * @returns rouble cost of offer */ - protected calculateOfferListingPrice(offerRequirements: OfferRequirement[]): number; + protected convertOfferRequirementsIntoRoubles(offerRequirements: OfferRequirement[]): number; /** * Get avatar url from trader table in db * @param isTrader Is user we're getting avatar for a trader @@ -137,7 +135,7 @@ export declare class RagfairOfferGenerator { * @param itemDetails raw db item details * @returns Item array */ - protected createSingleOfferForItem(items: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; + protected createSingleOfferForItem(items: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; /** * Generate trader offers on flea using the traders assort data * @param traderID Trader to generate offers for @@ -151,7 +149,7 @@ export declare class RagfairOfferGenerator { * @param itemDetails db details of first item * @returns */ - protected getItemCondition(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): Item[]; + protected randomiseItemUpdProperties(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): Item[]; /** * Get the relevant condition id if item tpl matches in ragfair.json/condition * @param tpl Item to look for matching condition object @@ -184,7 +182,7 @@ export declare class RagfairOfferGenerator { * @param offerItems Items for sale in offer * @returns Barter scheme */ - protected createBarterRequirement(offerItems: Item[]): IBarterScheme[]; + protected createBarterBarterScheme(offerItems: Item[]): IBarterScheme[]; /** * Get an array of flea prices + item tpl, cached in generator class inside `allowedFleaPriceItemsForBarter` * @returns array with tpl/price values @@ -196,7 +194,9 @@ export declare class RagfairOfferGenerator { /** * Create a random currency-based barter scheme for an array of items * @param offerItems Items on offer + * @param isPackOffer Is the barter scheme being created for a pack offer + * @param multipler What to multiply the resulting price by * @returns Barter scheme for offer */ - protected createCurrencyRequirement(offerItems: Item[]): IBarterScheme[]; + protected createCurrencyBarterScheme(offerItems: Item[], isPackOffer: boolean, multipler?: number): IBarterScheme[]; } diff --git a/TypeScript/15HttpListenerExample/types/generators/ScavCaseRewardGenerator.d.ts b/TypeScript/15HttpListenerExample/types/generators/ScavCaseRewardGenerator.d.ts index 4ba1888..b5935d0 100644 --- a/TypeScript/15HttpListenerExample/types/generators/ScavCaseRewardGenerator.d.ts +++ b/TypeScript/15HttpListenerExample/types/generators/ScavCaseRewardGenerator.d.ts @@ -25,6 +25,8 @@ export declare class ScavCaseRewardGenerator { protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected scavCaseConfig: IScavCaseConfig; + protected dbItemsCache: ITemplateItem[]; + protected dbAmmoItemsCache: ITemplateItem[]; constructor(logger: ILogger, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * Create an array of rewards that will be given to the player upon completing their scav case build @@ -33,10 +35,10 @@ export declare class ScavCaseRewardGenerator { */ generate(recipeId: string): Product[]; /** - * Get all db items that are not blacklisted in scavcase config - * @returns filtered array of db items + * Get all db items that are not blacklisted in scavcase config or global blacklist + * Store in class field */ - protected getDbItems(): ITemplateItem[]; + protected cacheDbItems(): void; /** * Pick a number of items to be rewards, the count is defined by the values in * @param items item pool to pick rewards from diff --git a/TypeScript/15HttpListenerExample/types/generators/WeatherGenerator.d.ts b/TypeScript/15HttpListenerExample/types/generators/WeatherGenerator.d.ts index 2e2403c..6471bb1 100644 --- a/TypeScript/15HttpListenerExample/types/generators/WeatherGenerator.d.ts +++ b/TypeScript/15HttpListenerExample/types/generators/WeatherGenerator.d.ts @@ -52,6 +52,7 @@ export declare class WeatherGenerator { */ protected setCurrentDateTime(weather: IWeather): void; protected getWeightedWindDirection(): WindDirection; + protected getWeightedClouds(): number; protected getWeightedWindSpeed(): number; protected getWeightedFog(): number; protected getWeightedRain(): number; diff --git a/TypeScript/15HttpListenerExample/types/helpers/HealthHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/HealthHelper.d.ts index 3694a6e..e4cdcd6 100644 --- a/TypeScript/15HttpListenerExample/types/helpers/HealthHelper.d.ts +++ b/TypeScript/15HttpListenerExample/types/helpers/HealthHelper.d.ts @@ -27,6 +27,7 @@ export declare class HealthHelper { * @param request Heal request * @param sessionID Session id * @param addEffects Should effects be added or removed (default - add) + * @param deleteExistingEffects Should all prior effects be removed before apply new ones */ saveVitality(pmcData: IPmcData, request: ISyncHealthRequestData, sessionID: string, addEffects?: boolean, deleteExistingEffects?: boolean): void; /** diff --git a/TypeScript/15HttpListenerExample/types/helpers/InRaidHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/InRaidHelper.d.ts index bf584c2..b4c0c1c 100644 --- a/TypeScript/15HttpListenerExample/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/15HttpListenerExample/types/helpers/InRaidHelper.d.ts @@ -53,7 +53,7 @@ export declare class InRaidHelper { * @param victim Who was killed by player * @returns a numerical standing gain or loss */ - protected getStandingChangeForKill(victim: Victim): number; + protected getFenceStandingChangeForKillAsScav(victim: Victim): number; /** * Reset a profile to a baseline, used post-raid * Reset points earned during session property diff --git a/TypeScript/15HttpListenerExample/types/helpers/ItemHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/ItemHelper.d.ts index 99fca56..00f190f 100644 --- a/TypeScript/15HttpListenerExample/types/helpers/ItemHelper.d.ts +++ b/TypeScript/15HttpListenerExample/types/helpers/ItemHelper.d.ts @@ -26,6 +26,7 @@ declare class ItemHelper { protected itemBaseClassService: ItemBaseClassService; protected localisationService: LocalisationService; protected localeService: LocaleService; + protected readonly defaultInvalidBaseTypes: string[]; constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, localisationService: LocalisationService, localeService: LocaleService); /** * Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash @@ -67,6 +68,11 @@ declare class ItemHelper { * @returns Price in roubles (undefined if not found) */ getDynamicItemPrice(tpl: string): number; + /** + * Update items upd.StackObjectsCount to be 1 if its upd is missing or StackObjectsCount is undefined + * @param item Item to update + * @returns Fixed item + */ fixItemStackCount(item: Item): Item; /** * AmmoBoxes contain StackSlots which need to be filled for the AmmoBox to have content. @@ -125,19 +131,19 @@ declare class ItemHelper { getItemQualityModifier(item: Item): number; /** * Get a quality value based on a repairable items (weapon/armor) current state between current and max durability - * @param itemDetails - * @param repairable repairable object - * @param item - * @returns a number between 0 and 1 + * @param itemDetails Db details for item we want quality value for + * @param repairable Repairable properties + * @param item Item quality value is for + * @returns A number between 0 and 1 */ protected getRepairableItemQualityValue(itemDetails: ITemplateItem, repairable: Repairable, item: Item): number; /** * Recursive function that looks at every item from parameter and gets their childrens Ids + includes parent item in results - * @param items - * @param itemID + * @param items Array of items (item + possible children) + * @param itemId Parent items id * @returns an array of strings */ - findAndReturnChildrenByItems(items: Item[], itemID: string): string[]; + findAndReturnChildrenByItems(items: Item[], itemId: string): string[]; /** * A variant of findAndReturnChildren where the output is list of item objects instead of their ids. * @param items @@ -164,12 +170,6 @@ declare class ItemHelper { * @returns true if it is a dogtag */ isDogtag(tpl: string): boolean; - /** - * Can the item passed in be sold to a trader because it is raw money - * @param tpl Item template id to check - * @returns true if unsellable - */ - isNotSellable(tpl: string): boolean; /** * Gets the identifier for a child using slotId, locationX and locationY. * @param item @@ -183,19 +183,19 @@ declare class ItemHelper { */ isItemTplStackable(tpl: string): boolean; /** - * split item stack if it exceeds its StackMaxSize property - * @param itemToSplit item being split into smaller stacks + * split item stack if it exceeds its items StackMaxSize property + * @param itemToSplit Item to split into smaller stacks * @returns Array of split items */ splitStack(itemToSplit: Item): Item[]; /** - * Find Barter items in the inventory + * Find Barter items from array of items * @param {string} by tpl or id - * @param {Object} pmcData + * @param {Item[]} items Array of items to iterate over * @param {string} barterItemId * @returns Array of Item objects */ - findBarterItems(by: "tpl" | "id", pmcData: IPmcData, barterItemId: string): Item[]; + findBarterItems(by: "tpl" | "id", items: Item[], barterItemId: string): Item[]; /** * Regenerate all guids with new ids, exceptions are for items that cannot be altered (e.g. stash/sorting table) * @param pmcData Player profile @@ -262,10 +262,21 @@ declare class ItemHelper { * @param minSizePercent % the magazine must be filled to */ fillMagazineWithCartridge(magazine: Item[], magTemplate: ITemplateItem, cartridgeTpl: string, minSizePercent?: number): void; + /** + * Choose a random bullet type from the list of possible a magazine has + * @param magTemplate Magazine template from Db + * @returns Tpl of cartridge + */ protected getRandomValidCaliber(magTemplate: ITemplateItem): string; + /** + * Chose a randomly weighted cartridge that fits + * @param caliber Desired caliber + * @param staticAmmoDist Cartridges and thier weights + * @returns Tpl of cartrdige + */ protected drawAmmoTpl(caliber: string, staticAmmoDist: Record): string; /** - * + * Create a basic cartrige object * @param parentId container cartridges will be placed in * @param ammoTpl Cartridge to insert * @param stackCount Count of cartridges inside parent diff --git a/TypeScript/15HttpListenerExample/types/helpers/QuestHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/QuestHelper.d.ts index e04b6e0..5c749d3 100644 --- a/TypeScript/15HttpListenerExample/types/helpers/QuestHelper.d.ts +++ b/TypeScript/15HttpListenerExample/types/helpers/QuestHelper.d.ts @@ -21,6 +21,7 @@ import { DialogueHelper } from "./DialogueHelper"; import { ItemHelper } from "./ItemHelper"; import { PaymentHelper } from "./PaymentHelper"; import { ProfileHelper } from "./ProfileHelper"; +import { QuestConditionHelper } from "./QuestConditionHelper"; import { RagfairServerHelper } from "./RagfairServerHelper"; import { TraderHelper } from "./TraderHelper"; export declare class QuestHelper { @@ -29,6 +30,7 @@ export declare class QuestHelper { protected timeUtil: TimeUtil; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; + protected questConditionHelper: QuestConditionHelper; protected eventOutputHolder: EventOutputHolder; protected databaseServer: DatabaseServer; protected localeService: LocaleService; @@ -41,7 +43,7 @@ export declare class QuestHelper { protected mailSendService: MailSendService; protected configServer: ConfigServer; 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, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, questConditionHelper: QuestConditionHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, mailSendService: MailSendService, configServer: ConfigServer); /** * Get status of a quest in player profile by its id * @param pmcData Profile to search @@ -119,7 +121,7 @@ export declare class QuestHelper { * @param sessionID Session id * @returns Quests accessible to player incuding newly unlocked quests now quest (startedQuestId) was started */ - acceptedUnlocked(startedQuestId: string, sessionID: string): IQuest[]; + getNewlyAccessibleQuestsWhenStartingQuest(startedQuestId: string, sessionID: string): IQuest[]; /** * Get quests that can be shown to player after failing a quest * @param failedQuestId Id of the quest failed by player diff --git a/TypeScript/15HttpListenerExample/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/RagfairOfferHelper.d.ts index de9d550..0699259 100644 --- a/TypeScript/15HttpListenerExample/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/15HttpListenerExample/types/helpers/RagfairOfferHelper.d.ts @@ -1,4 +1,5 @@ import { IPmcData } from "../models/eft/common/IPmcData"; +import { Item } from "../models/eft/common/tables/IItem"; import { ITraderAssort } from "../models/eft/common/tables/ITrader"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; @@ -13,10 +14,10 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { LocaleService } from "../services/LocaleService"; import { LocalisationService } from "../services/LocalisationService"; +import { MailSendService } from "../services/MailSendService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { HashUtil } from "../utils/HashUtil"; import { TimeUtil } from "../utils/TimeUtil"; -import { DialogueHelper } from "./DialogueHelper"; import { ItemHelper } from "./ItemHelper"; import { PaymentHelper } from "./PaymentHelper"; import { PresetHelper } from "./PresetHelper"; @@ -33,7 +34,6 @@ export declare class RagfairOfferHelper { protected databaseServer: DatabaseServer; protected traderHelper: TraderHelper; protected saveServer: SaveServer; - protected dialogueHelper: DialogueHelper; protected itemHelper: ItemHelper; protected paymentHelper: PaymentHelper; protected presetHelper: PresetHelper; @@ -44,11 +44,12 @@ export declare class RagfairOfferHelper { protected ragfairOfferService: RagfairOfferService; protected localeService: LocaleService; protected localisationService: LocalisationService; + protected mailSendService: MailSendService; protected configServer: ConfigServer; protected static goodSoldTemplate: string; protected ragfairConfig: IRagfairConfig; 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, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, localisationService: LocalisationService, mailSendService: MailSendService, configServer: ConfigServer); /** * Passthrough to ragfairOfferService.getOffers(), get flea offers a player should see * @param searchRequest Data from client @@ -119,19 +120,26 @@ export declare class RagfairOfferHelper { */ protected getProfileOffers(sessionID: string): IRagfairOffer[]; /** - * Delete an offer from a desired profile + * Delete an offer from a desired profile and from ragfair offers * @param sessionID Session id of profile to delete offer from - * @param offerId Offer id to delete + * @param offerId Id of offer to delete */ - protected deleteOfferByOfferId(sessionID: string, offerId: string): void; + protected deleteOfferById(sessionID: string, offerId: string): void; /** * Complete the selling of players' offer * @param sessionID Session id * @param offer Sold offer details * @param boughtAmount Amount item was purchased for - * @returns Client response + * @returns IItemEventRouterResponse */ protected completeOffer(sessionID: string, offer: IRagfairOffer, boughtAmount: number): IItemEventRouterResponse; + /** + * Get a localised message for when players offer has sold on flea + * @param itemTpl Item sold + * @param boughtAmount How many were purchased + * @returns Localised message text + */ + protected getLocalisedOfferSoldMessage(itemTpl: string, boughtAmount: number): string; /** * Should a ragfair offer be visible to the player * @param searchRequest Search request @@ -142,4 +150,12 @@ export declare class RagfairOfferHelper { * @returns True = should be shown to player */ isDisplayableOffer(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, offer: IRagfairOffer, pmcProfile: IPmcData): boolean; + /** + * Is items quality value within desired range + * @param item Item to check quality of + * @param min Desired minimum quality + * @param max Desired maximum quality + * @returns True if in range + */ + protected itemQualityInRange(item: Item, min: number, max: number): boolean; } diff --git a/TypeScript/15HttpListenerExample/types/helpers/RagfairSellHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/RagfairSellHelper.d.ts index 251d7ca..913b408 100644 --- a/TypeScript/15HttpListenerExample/types/helpers/RagfairSellHelper.d.ts +++ b/TypeScript/15HttpListenerExample/types/helpers/RagfairSellHelper.d.ts @@ -13,12 +13,12 @@ export declare class RagfairSellHelper { constructor(logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, configServer: ConfigServer); /** * Get the percent chance to sell an item based on its average listed price vs player chosen listing price - * @param baseChancePercent Base chance to sell item * @param averageOfferPriceRub Price of average offer in roubles * @param playerListedPriceRub Price player listed item for in roubles + * @param qualityMultiplier Quality multipler of item being sold * @returns percent value */ - calculateSellChance(baseChancePercent: number, averageOfferPriceRub: number, playerListedPriceRub: number): number; + calculateSellChance(averageOfferPriceRub: number, playerListedPriceRub: number, qualityMultiplier: number): number; /** * Get percent chance to sell an item when price is below items average listing price * @param playerListedPriceRub Price player listed item for in roubles diff --git a/TypeScript/15HttpListenerExample/types/helpers/TraderHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/TraderHelper.d.ts index c163f7a..6680ccf 100644 --- a/TypeScript/15HttpListenerExample/types/helpers/TraderHelper.d.ts +++ b/TypeScript/15HttpListenerExample/types/helpers/TraderHelper.d.ts @@ -35,7 +35,7 @@ export declare class TraderHelper { protected highestTraderBuyPriceItems: Record; constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, handbookHelper: HandbookHelper, itemHelper: ItemHelper, playerService: PlayerService, localisationService: LocalisationService, fenceService: FenceService, timeUtil: TimeUtil, randomUtil: RandomUtil, configServer: ConfigServer); getTrader(traderID: string, sessionID: string): ITraderBase; - getTraderAssortsById(traderId: string): ITraderAssort; + getTraderAssortsByTraderId(traderId: string): ITraderAssort; /** * 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 diff --git a/TypeScript/15HttpListenerExample/types/models/eft/common/tables/IBotBase.d.ts b/TypeScript/15HttpListenerExample/types/models/eft/common/tables/IBotBase.d.ts index ee40958..6c7b76f 100644 --- a/TypeScript/15HttpListenerExample/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/eft/common/tables/IBotBase.d.ts @@ -281,7 +281,7 @@ export interface InsuredItem { export interface Hideout { Production: Record; Areas: HideoutArea[]; - Improvements: Record; + Improvement: Record; Seed: number; sptUpdateLastRunTimestamp: number; } diff --git a/TypeScript/15HttpListenerExample/types/models/eft/health/IHealthTreatmentRequestData.d.ts b/TypeScript/15HttpListenerExample/types/models/eft/health/IHealthTreatmentRequestData.d.ts index 7fb80a8..598e60c 100644 --- a/TypeScript/15HttpListenerExample/types/models/eft/health/IHealthTreatmentRequestData.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/eft/health/IHealthTreatmentRequestData.d.ts @@ -1,12 +1,14 @@ export interface IHealthTreatmentRequestData { Action: "RestoreHealth"; trader: string; - items: Item[]; + items: Cost[]; difference: Difference; timestamp: number; } -export interface Item { +export interface Cost { + /** Id of stack to take money from */ id: string; + /** Amount of money to take off player for treatment */ count: number; } export interface Difference { @@ -25,5 +27,6 @@ export interface BodyParts { } export interface BodyPart { Health: number; + /** Effects in array are to be removed */ Effects: string[]; } diff --git a/TypeScript/15HttpListenerExample/types/models/eft/notifier/INotifier.d.ts b/TypeScript/15HttpListenerExample/types/models/eft/notifier/INotifier.d.ts index ce25dee..c6c6979 100644 --- a/TypeScript/15HttpListenerExample/types/models/eft/notifier/INotifier.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/eft/notifier/INotifier.d.ts @@ -14,6 +14,11 @@ export interface INotification { } export declare enum NotificationType { RAGFAIR_OFFER_SOLD = "RagfairOfferSold", + RAGFAIR_RATING_CHANGE = "RagfairRatingChange", + /** ChatMessageReceived */ NEW_MESSAGE = "new_message", - PING = "ping" + PING = "ping", + TRADER_SUPPLY = "TraderSupply", + TRADER_STANDING = "TraderStanding", + UNLOCK_TRADER = "UnlockTrader" } diff --git a/TypeScript/15HttpListenerExample/types/models/eft/notifier/ISelectProfileResponse.d.ts b/TypeScript/15HttpListenerExample/types/models/eft/notifier/ISelectProfileResponse.d.ts index ecb668a..f2d6be7 100644 --- a/TypeScript/15HttpListenerExample/types/models/eft/notifier/ISelectProfileResponse.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/eft/notifier/ISelectProfileResponse.d.ts @@ -1,6 +1,3 @@ -import { INotifierChannel } from "./INotifier"; export interface ISelectProfileResponse { status: string; - notifier: INotifierChannel; - notifierServer: string; } diff --git a/TypeScript/15HttpListenerExample/types/models/enums/WeatherType.d.ts b/TypeScript/15HttpListenerExample/types/models/enums/WeatherType.d.ts index d31fefe..503dc30 100644 --- a/TypeScript/15HttpListenerExample/types/models/enums/WeatherType.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/enums/WeatherType.d.ts @@ -1,19 +1,19 @@ export declare enum WeatherType { - CLEAR_DAY = 1, - CLEAR_WIND = 2, - CLEAR_NIGHT = 3, - PARTLY_CLOUD_DAY = 4, - PARTLY_CLOUD_NIGHT = 5, - CLEAR_FOG_DAY = 6, - CLEAR_FOG_NIGHT = 7, - CLOUDFOG = 8, - FOG = 9, - MOSTLY_CLOUD = 10, - LIGHT_RAIN = 11, - RAIN = 12, - CLOUD_WIND = 13, - CLOUD_WIND_RAIN = 14, - FULL_CLOUD = 15, - THUNDER_CLOUD = 16, - NONE = 0 + CLEAR_DAY = 0, + CLEAR_WIND = 1, + CLEAR_NIGHT = 2, + PARTLY_CLOUD_DAY = 3, + PARTLY_CLOUD_NIGHT = 4, + CLEAR_FOG_DAY = 5, + CLEAR_FOG_NIGHT = 6, + CLOUD_FOG = 7, + FOG = 8, + MOSTLY_CLOUD = 9, + LIGHT_RAIN = 10, + RAIN = 11, + CLOUD_WIND = 12, + CLOUD_WIND_RAIN = 13, + FULL_CLOUD = 14, + THUNDER_CLOUD = 15, + NONE = 16 } diff --git a/TypeScript/15HttpListenerExample/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/15HttpListenerExample/types/models/spt/config/IRagfairConfig.d.ts index 7c04857..7aea24f 100644 --- a/TypeScript/15HttpListenerExample/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/spt/config/IRagfairConfig.d.ts @@ -41,7 +41,8 @@ export interface Dynamic { /** Use the highest trader price for an offer if its greater than the price in templates/prices.json */ useTraderPriceForOffersIfHigher: boolean; /** Barter offer specific settings */ - barter: Barter; + barter: IBarterDetails; + pack: IPackDetails; /** Dynamic offer price below handbook adjustment values */ offerAdjustment: OfferAdjustment; /** How many offers should expire before an offer regeneration occurs */ @@ -49,9 +50,7 @@ export interface Dynamic { /** How many offers should be listed */ offerItemCount: MinMax; /** How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) */ - price: MinMax; - /** How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) */ - presetPrice: MinMax; + priceRanges: IPriceRanges; /** Should default presets to listed only or should non-standard presets found in globals.json be listed too */ showDefaultPresetsOnly: boolean; endTimeSeconds: MinMax; @@ -74,7 +73,12 @@ export interface Dynamic { /** Dict of price limits keyed by item type */ unreasonableModPrices: Record; } -export interface Barter { +export interface IPriceRanges { + default: MinMax; + preset: MinMax; + pack: MinMax; +} +export interface IBarterDetails { /** Should barter offers be generated */ enable: boolean; /** Percentage change an offer is listed as a barter */ @@ -90,6 +94,18 @@ export interface Barter { /** Item Tpls to never be turned into a barter */ itemTypeBlacklist: string[]; } +export interface IPackDetails { + /** Should pack offers be generated */ + enable: boolean; + /** Percentage change an offer is listed as a pack */ + chancePercent: number; + /** Min number of required items for a pack */ + itemCountMin: number; + /** Max number of required items for a pack */ + itemCountMax: number; + /** item types to allow being a pack */ + itemTypeWhitelist: string[]; +} export interface OfferAdjustment { /** Shuld offer price be adjusted when below handbook price */ adjustPriceWhenBelowHandbookPrice: boolean; diff --git a/TypeScript/15HttpListenerExample/types/models/spt/config/IWeatherConfig.d.ts b/TypeScript/15HttpListenerExample/types/models/spt/config/IWeatherConfig.d.ts index 41a1c83..6ecf35b 100644 --- a/TypeScript/15HttpListenerExample/types/models/spt/config/IWeatherConfig.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/spt/config/IWeatherConfig.d.ts @@ -7,7 +7,7 @@ export interface IWeatherConfig extends IBaseConfig { weather: Weather; } export interface Weather { - clouds: MinMax; + clouds: WeatherSettings; windSpeed: WeatherSettings; windDirection: WeatherSettings; windGustiness: MinMax; diff --git a/TypeScript/15HttpListenerExample/types/services/HashCacheService.d.ts b/TypeScript/15HttpListenerExample/types/services/HashCacheService.d.ts index 5320f28..9968478 100644 --- a/TypeScript/15HttpListenerExample/types/services/HashCacheService.d.ts +++ b/TypeScript/15HttpListenerExample/types/services/HashCacheService.d.ts @@ -11,7 +11,18 @@ export declare class HashCacheService { protected modHashes: any; protected readonly modCachePath = "./user/cache/modCache.json"; constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); + /** + * Return a stored hash by key + * @param modName Name of mod to get hash for + * @returns Mod hash + */ getStoredModHash(modName: string): string; + /** + * Does the generated hash match the stored hash + * @param modName name of mod + * @param modContent + * @returns True if they match + */ modContentMatchesStoredHash(modName: string, modContent: string): boolean; hashMatchesStoredHash(modName: string, modHash: string): boolean; storeModContent(modName: string, modContent: string): void; diff --git a/TypeScript/15HttpListenerExample/types/services/MailSendService.d.ts b/TypeScript/15HttpListenerExample/types/services/MailSendService.d.ts index 19397dc..fe4a7fe 100644 --- a/TypeScript/15HttpListenerExample/types/services/MailSendService.d.ts +++ b/TypeScript/15HttpListenerExample/types/services/MailSendService.d.ts @@ -35,7 +35,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendDirectNpcMessageToPlayer(playerId: string, sender: Traders, messageType: MessageType, message: string, items?: Item[], maxStorageTimeSeconds?: any): void; + sendDirectNpcMessageToPlayer(playerId: string, sender: Traders, messageType: MessageType, message: string, items?: Item[], maxStorageTimeSeconds?: any, systemData?: any, ragfair?: any): void; /** * Send a message from an NPC (e.g. prapor) to the player with or without items * @param playerId Players id to send message to @@ -45,7 +45,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendLocalisedNpcMessageToPlayer(playerId: string, sender: Traders, messageType: MessageType, messageLocaleId: string, items?: Item[], maxStorageTimeSeconds?: any, systemData?: any): void; + sendLocalisedNpcMessageToPlayer(playerId: string, sender: Traders, messageType: MessageType, messageLocaleId: string, items?: Item[], maxStorageTimeSeconds?: any, systemData?: any, ragfair?: any): void; /** * Send a message from SYSTEM to the player with or without items * @param playerId Players id to send message to diff --git a/TypeScript/15HttpListenerExample/types/services/MatchBotDetailsCacheService.d.ts b/TypeScript/15HttpListenerExample/types/services/MatchBotDetailsCacheService.d.ts index eb365dd..c1bd322 100644 --- a/TypeScript/15HttpListenerExample/types/services/MatchBotDetailsCacheService.d.ts +++ b/TypeScript/15HttpListenerExample/types/services/MatchBotDetailsCacheService.d.ts @@ -1,7 +1,7 @@ import { IBotBase } from "../models/eft/common/tables/IBotBase"; import { ILogger } from "../models/spt/utils/ILogger"; import { LocalisationService } from "./LocalisationService"; -/** Cache bots in a dictionary, keyed by the bots name, keying by name isnt idea as its not unique but this is used by the post-raid system which doesnt have any bot ids, only name */ +/** Cache bots in a dictionary, keyed by the bots name, keying by name isnt ideal as its not unique but this is used by the post-raid system which doesnt have any bot ids, only name */ export declare class MatchBotDetailsCacheService { protected logger: ILogger; protected localisationService: LocalisationService; @@ -17,9 +17,9 @@ export declare class MatchBotDetailsCacheService { */ clearCache(): void; /** - * Find a bot in the cache by its name + * Find a bot in the cache by its name and side * @param botName Name of bot to find * @returns Bot details */ - getBotByName(botName: string): IBotBase; + getBotByNameAndSide(botName: string, botSide: string): IBotBase; } diff --git a/TypeScript/15HttpListenerExample/types/services/ModCompilerService.d.ts b/TypeScript/15HttpListenerExample/types/services/ModCompilerService.d.ts index a4bf3c8..e306177 100644 --- a/TypeScript/15HttpListenerExample/types/services/ModCompilerService.d.ts +++ b/TypeScript/15HttpListenerExample/types/services/ModCompilerService.d.ts @@ -1,14 +1,36 @@ import { CompilerOptions } from "typescript"; import type { ILogger } from "../models/spt/utils/ILogger"; -import { HashCacheService } from "./HashCacheService"; import { VFS } from "../utils/VFS"; +import { HashCacheService } from "./HashCacheService"; export declare class ModCompilerService { protected logger: ILogger; protected hashCacheService: HashCacheService; protected vfs: VFS; constructor(logger: ILogger, hashCacheService: HashCacheService, vfs: VFS); + /** + * Convert a mods TS into JS + * @param modName Name of mod + * @param modPath Dir path to mod + * @param modTypeScriptFiles + * @returns + */ compileMod(modName: string, modPath: string, modTypeScriptFiles: string[]): Promise; + /** + * Convert a TS file into JS + * @param fileNames Paths to TS files + * @param options Compiler options + */ protected compile(fileNames: string[], options: CompilerOptions): Promise; + /** + * Do the files at the provided paths exist + * @param fileNames + * @returns + */ protected areFilesReady(fileNames: string[]): boolean; + /** + * Wait the provided number of milliseconds + * @param ms Milliseconds + * @returns + */ protected delay(ms: number): Promise; } diff --git a/TypeScript/15HttpListenerExample/types/services/PaymentService.d.ts b/TypeScript/15HttpListenerExample/types/services/PaymentService.d.ts index 1c9c32b..fb5f92c 100644 --- a/TypeScript/15HttpListenerExample/types/services/PaymentService.d.ts +++ b/TypeScript/15HttpListenerExample/types/services/PaymentService.d.ts @@ -61,23 +61,26 @@ export declare class PaymentService { * Get all money stacks in inventory and prioritse items in stash * @param pmcData * @param currencyTpl + * @param playerStashId Players stash id * @returns Sorting money items */ - protected getSortedMoneyItemsInInventory(pmcData: IPmcData, currencyTpl: string): Item[]; + protected getSortedMoneyItemsInInventory(pmcData: IPmcData, currencyTpl: string, playerStashId: string): Item[]; /** * Prioritise player stash first over player inventory * Post-raid healing would often take money out of the players pockets/secure container * @param a First money stack item * @param b Second money stack item * @param inventoryItems players inventory items + * @param playerStashId Players stash id * @returns sort order */ - protected prioritiseStashSort(a: Item, b: Item, inventoryItems: Item[]): number; + protected prioritiseStashSort(a: Item, b: Item, inventoryItems: Item[], playerStashId: string): number; /** * Recursivly check items parents to see if it is inside the players inventory, not stash * @param itemId item id to check * @param inventoryItems player inventory + * @param playerStashId Players stash id * @returns true if its in inventory */ - protected isInInventory(itemId: string, inventoryItems: Item[]): boolean; + protected isInStash(itemId: string, inventoryItems: Item[], playerStashId: string): boolean; } diff --git a/TypeScript/15HttpListenerExample/types/services/ProfileFixerService.d.ts b/TypeScript/15HttpListenerExample/types/services/ProfileFixerService.d.ts index c8232fc..bc1e42e 100644 --- a/TypeScript/15HttpListenerExample/types/services/ProfileFixerService.d.ts +++ b/TypeScript/15HttpListenerExample/types/services/ProfileFixerService.d.ts @@ -14,6 +14,7 @@ import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; import { Watermark } from "../utils/Watermark"; import { LocalisationService } from "./LocalisationService"; @@ -27,17 +28,19 @@ export declare class ProfileFixerService { protected itemHelper: ItemHelper; protected localisationService: LocalisationService; protected timeUtil: TimeUtil; + protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, profileHelper: ProfileHelper, itemHelper: ItemHelper, localisationService: LocalisationService, timeUtil: TimeUtil, databaseServer: DatabaseServer, configServer: ConfigServer); + constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, profileHelper: ProfileHelper, itemHelper: ItemHelper, localisationService: LocalisationService, timeUtil: TimeUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, configServer: ConfigServer); /** * 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; protected addMissingGunStandContainerImprovements(pmcProfile: IPmcData): void; + protected ensureGunStandLevelsMatch(pmcProfile: IPmcData): void; protected addHideoutAreaStashes(pmcProfile: IPmcData): void; protected addMissingHideoutWallAreas(pmcProfile: IPmcData): void; protected adjustUnreasonableModFleaPrices(): void; @@ -131,4 +134,9 @@ export declare class ProfileFixerService { * @param pmcProfile Profile to add missing IDs to */ addMissingIdsToBonuses(pmcProfile: IPmcData): void; + /** + * At some point the property name was changed,migrate data across to new name + * @param pmcProfile + */ + protected migrateImprovements(pmcProfile: IPmcData): void; } diff --git a/TypeScript/15HttpListenerExample/types/services/RagfairPriceService.d.ts b/TypeScript/15HttpListenerExample/types/services/RagfairPriceService.d.ts index e245efa..ff35327 100644 --- a/TypeScript/15HttpListenerExample/types/services/RagfairPriceService.d.ts +++ b/TypeScript/15HttpListenerExample/types/services/RagfairPriceService.d.ts @@ -3,6 +3,7 @@ import { HandbookHelper } from "../helpers/HandbookHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { TraderHelper } from "../helpers/TraderHelper"; +import { MinMax } from "../models/common/MinMax"; import { IPreset } from "../models/eft/common/IGlobals"; import { Item } from "../models/eft/common/tables/IItem"; import { IBarterScheme } from "../models/eft/common/tables/ITrader"; @@ -35,10 +36,6 @@ export declare class RagfairPriceService implements OnLoad { * Generate static (handbook) and dynamic (prices.json) flea prices, store inside class as dictionaries */ onLoad(): Promise; - /** - * Add placeholder values for items missing from handbook - */ - protected addMissingHandbookPrices(): void; getRoute(): string; /** * Iterate over all items of type "Item" in db and get template price, store in cache @@ -91,9 +88,17 @@ export declare class RagfairPriceService implements OnLoad { * Generate a currency cost for an item and its mods * @param items Item with mods to get price for * @param desiredCurrency Currency price desired in + * @param isPackOffer Price is for a pack type offer * @returns cost of item in desired currency */ - getDynamicOfferPrice(items: Item[], desiredCurrency: string): number; + getDynamicOfferPriceForOffer(items: Item[], desiredCurrency: string, isPackOffer: boolean): number; + /** + * Get different min/max price multipliers for different offer types (preset/pack/default) + * @param isPreset Offer is a preset + * @param isPack Offer is a pack + * @returns MinMax values + */ + protected getOfferTypeRangeValues(isPreset: boolean, isPack: boolean): MinMax; /** * Check to see if an items price is below its handbook price and adjust accoring to values set to config/ragfair.json * @param itemPrice price of item @@ -104,10 +109,10 @@ export declare class RagfairPriceService implements OnLoad { /** * Multiply the price by a randomised curve where n = 2, shift = 2 * @param existingPrice price to alter - * @param isPreset is the item we're multiplying a preset + * @param rangeValues min and max to adjust price by * @returns multiplied price */ - protected randomisePrice(existingPrice: number, isPreset: boolean): number; + protected randomiseOfferPrice(existingPrice: number, rangeValues: MinMax): number; /** * Calculate the cost of a weapon preset by adding together the price of its mods + base price of default weapon preset * @param item base weapon diff --git a/TypeScript/16ImporterUtil/types/callbacks/GameCallbacks.d.ts b/TypeScript/16ImporterUtil/types/callbacks/GameCallbacks.d.ts index aa80036..46f79f9 100644 --- a/TypeScript/16ImporterUtil/types/callbacks/GameCallbacks.d.ts +++ b/TypeScript/16ImporterUtil/types/callbacks/GameCallbacks.d.ts @@ -1,4 +1,5 @@ import { GameController } from "../controllers/GameController"; +import { OnLoad } from "../di/OnLoad"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { ICheckVersionResponse } from "../models/eft/game/ICheckVersionResponse"; import { ICurrentGroupResponse } from "../models/eft/game/ICurrentGroupResponse"; @@ -15,12 +16,14 @@ import { INullResponseData } from "../models/eft/httpResponse/INullResponseData" import { SaveServer } from "../servers/SaveServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { Watermark } from "../utils/Watermark"; -declare class GameCallbacks { +declare class GameCallbacks implements OnLoad { protected httpResponse: HttpResponseUtil; protected watermark: Watermark; protected saveServer: SaveServer; protected gameController: GameController; constructor(httpResponse: HttpResponseUtil, watermark: Watermark, saveServer: SaveServer, gameController: GameController); + onLoad(): Promise; + getRoute(): string; /** * Handle client/game/version/validate * @returns INullResponseData diff --git a/TypeScript/16ImporterUtil/types/controllers/GameController.d.ts b/TypeScript/16ImporterUtil/types/controllers/GameController.d.ts index 04e3abb..e88610e 100644 --- a/TypeScript/16ImporterUtil/types/controllers/GameController.d.ts +++ b/TypeScript/16ImporterUtil/types/controllers/GameController.d.ts @@ -61,13 +61,14 @@ export declare class GameController { protected pmcConfig: IPmcConfig; protected lootConfig: ILootConfig; constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, randomUtil: RandomUtil, encodingUtil: EncodingUtil, hideoutHelper: HideoutHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, seasonalEventService: SeasonalEventService, itemBaseClassService: ItemBaseClassService, giftService: GiftService, applicationContext: ApplicationContext, configServer: ConfigServer); + load(): void; /** * Handle client/game/start */ gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; protected addCustomLooseLootPositions(): void; protected adjustLooseLootSpawnProbabilities(): void; - protected setHideoutAreasAndCraftsTo30Secs(): void; + protected setHideoutAreasAndCraftsTo40Secs(): void; /** * 3.7.0 moved AIDs to be numeric, old profiles need to be migrated * We store the old AID value in new field `sessionId` diff --git a/TypeScript/16ImporterUtil/types/controllers/HealthController.d.ts b/TypeScript/16ImporterUtil/types/controllers/HealthController.d.ts index 1938297..2d7ff09 100644 --- a/TypeScript/16ImporterUtil/types/controllers/HealthController.d.ts +++ b/TypeScript/16ImporterUtil/types/controllers/HealthController.d.ts @@ -29,34 +29,35 @@ export declare class HealthController { * stores in-raid player health * @param pmcData Player profile * @param info Request data - * @param sessionID + * @param sessionID Player id * @param addEffects Should effects found be added or removed from profile + * @param deleteExistingEffects Should all prior effects be removed before apply new ones */ saveVitality(pmcData: IPmcData, info: ISyncHealthRequestData, sessionID: string, addEffects?: boolean, deleteExistingEffects?: boolean): void; /** * When healing in menu - * @param pmcData - * @param body - * @param sessionID - * @returns + * @param pmcData Player profile + * @param request Healing request + * @param sessionID Player id + * @returns IItemEventRouterResponse */ - offraidHeal(pmcData: IPmcData, body: IOffraidHealRequestData, sessionID: string): IItemEventRouterResponse; + offraidHeal(pmcData: IPmcData, request: IOffraidHealRequestData, sessionID: string): IItemEventRouterResponse; /** * Handle Eat event * Consume food/water outside of a raid * @param pmcData Player profile - * @param body request Object + * @param request Eat request * @param sessionID Session id * @returns IItemEventRouterResponse */ - offraidEat(pmcData: IPmcData, body: IOffraidEatRequestData, sessionID: string): IItemEventRouterResponse; + offraidEat(pmcData: IPmcData, request: IOffraidEatRequestData, sessionID: string): IItemEventRouterResponse; /** * Handle RestoreHealth event * Occurs on post-raid healing page * @param pmcData player profile * @param healthTreatmentRequest Request data from client * @param sessionID Session id - * @returns + * @returns IItemEventRouterResponse */ healthTreatment(pmcData: IPmcData, healthTreatmentRequest: IHealthTreatmentRequestData, sessionID: string): IItemEventRouterResponse; /** @@ -66,12 +67,4 @@ export declare class HealthController { * @param sessionID */ applyWorkoutChanges(pmcData: IPmcData, info: IWorkoutData, sessionId: string): void; - /** - * Iterate over treatment request diff and find effects to remove from player limbs - * @param sessionId - * @param profile Profile to update - * @param treatmentRequest client request - * @param output response to send to client - */ - protected removeEffectsAfterPostRaidHeal(sessionId: string, profile: IPmcData, treatmentRequest: IHealthTreatmentRequestData, output: IItemEventRouterResponse): void; } diff --git a/TypeScript/16ImporterUtil/types/controllers/HideoutController.d.ts b/TypeScript/16ImporterUtil/types/controllers/HideoutController.d.ts index 877c076..a90a16d 100644 --- a/TypeScript/16ImporterUtil/types/controllers/HideoutController.d.ts +++ b/TypeScript/16ImporterUtil/types/controllers/HideoutController.d.ts @@ -88,11 +88,11 @@ export declare class HideoutController { * @param pmcData Profile to edit * @param output Object to send back to client * @param sessionID Session/player id - * @param profileHideoutArea Current hideout data for profile + * @param profileParentHideoutArea Current hideout area for profile * @param dbHideoutArea Hideout area being upgraded * @param hideoutStage Stage hideout area is being upgraded to */ - protected addContainerImprovementToProfile(output: IItemEventRouterResponse, sessionID: string, pmcData: IPmcData, profileHideoutArea: HideoutArea, dbHideoutArea: IHideoutArea, hideoutStage: Stage): void; + protected addContainerImprovementToProfile(output: IItemEventRouterResponse, sessionID: string, pmcData: IPmcData, profileParentHideoutArea: HideoutArea, dbHideoutArea: IHideoutArea, hideoutStage: Stage): void; /** * Add an inventory item to profile from a hideout area stage data * @param pmcData Profile to update diff --git a/TypeScript/16ImporterUtil/types/controllers/LocationController.d.ts b/TypeScript/16ImporterUtil/types/controllers/LocationController.d.ts index 94d496a..94f5fce 100644 --- a/TypeScript/16ImporterUtil/types/controllers/LocationController.d.ts +++ b/TypeScript/16ImporterUtil/types/controllers/LocationController.d.ts @@ -4,6 +4,7 @@ import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { ILocationBase } from "../models/eft/common/ILocationBase"; import { ILocationsGenerateAllResponse } from "../models/eft/common/ILocationsSourceDestinationBase"; import { IAirdropLootResult } from "../models/eft/location/IAirdropLootResult"; +import { IGetLocationRequestData } from "../models/eft/location/IGetLocationRequestData"; import { AirdropTypeEnum } from "../models/enums/AirdropType"; import { IAirdropConfig } from "../models/spt/config/IAirdropConfig"; import { ILocationConfig } from "../models/spt/config/ILocationConfig"; @@ -34,10 +35,11 @@ export declare class LocationController { /** * Handle client/location/getLocalloot * Get a location (map) with generated loot data - * @param location Map to generate loot for + * @param sessionId Player id + * @param request Map request to generate * @returns ILocationBase */ - get(location: string): ILocationBase; + get(sessionId: string, request: IGetLocationRequestData): ILocationBase; /** * Generate a maps base location with loot * @param name Map name diff --git a/TypeScript/16ImporterUtil/types/controllers/QuestController.d.ts b/TypeScript/16ImporterUtil/types/controllers/QuestController.d.ts index 7d494a6..bd8a70f 100644 --- a/TypeScript/16ImporterUtil/types/controllers/QuestController.d.ts +++ b/TypeScript/16ImporterUtil/types/controllers/QuestController.d.ts @@ -61,7 +61,7 @@ export declare class QuestController { * @param playerLevel level of player to test against quest * @returns true if quest can be seen/accepted by player of defined level */ - protected playerLevelFulfillsQuestRequrement(quest: IQuest, playerLevel: number): boolean; + protected playerLevelFulfillsQuestRequirement(quest: IQuest, playerLevel: number): boolean; /** * Should a quest be shown to the player in trader quest screen * @param questId Quest to check diff --git a/TypeScript/16ImporterUtil/types/controllers/RagfairController.d.ts b/TypeScript/16ImporterUtil/types/controllers/RagfairController.d.ts index 76c27f7..bda37cd 100644 --- a/TypeScript/16ImporterUtil/types/controllers/RagfairController.d.ts +++ b/TypeScript/16ImporterUtil/types/controllers/RagfairController.d.ts @@ -21,6 +21,7 @@ import { IGetMarketPriceRequestData } from "../models/eft/ragfair/IGetMarketPric import { IGetOffersResult } from "../models/eft/ragfair/IGetOffersResult"; import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; import { ISearchRequestData } from "../models/eft/ragfair/ISearchRequestData"; +import { IProcessBuyTradeRequestData } from "../models/eft/trade/IProcessBuyTradeRequestData"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; @@ -125,6 +126,18 @@ export declare class RagfairController { * @returns IItemEventRouterResponse */ addPlayerOffer(pmcData: IPmcData, offerRequest: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Charge player a listing fee for using flea, pulls charge from data previously sent by client + * @param sessionID Player id + * @param rootItem Base item being listed (used when client tax cost not found and must be done on server) + * @param pmcData Player profile + * @param requirementsPriceInRub Rouble cost player chose for listing (used when client tax cost not found and must be done on server) + * @param itemStackCount How many items were listed in player (used when client tax cost not found and must be done on server) + * @param offerRequest Add offer request object from client + * @param output IItemEventRouterResponse + * @returns True if charging tax to player failed + */ + protected chargePlayerTaxFee(sessionID: string, rootItem: Item, pmcData: IPmcData, requirementsPriceInRub: number, itemStackCount: number, offerRequest: IAddOfferRequestData, output: IItemEventRouterResponse): boolean; /** * Is the item to be listed on the flea valid * @param offerRequest Client offer request @@ -158,4 +171,11 @@ export declare class RagfairController { */ removeOffer(offerId: string, sessionID: string): IItemEventRouterResponse; extendOffer(info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Create a basic trader request object with price and currency type + * @param currency What currency: RUB, EURO, USD + * @param value Amount of currency + * @returns IProcessBuyTradeRequestData + */ + protected createBuyTradeRequestObject(currency: string, value: number): IProcessBuyTradeRequestData; } diff --git a/TypeScript/16ImporterUtil/types/generators/BotEquipmentModGenerator.d.ts b/TypeScript/16ImporterUtil/types/generators/BotEquipmentModGenerator.d.ts index ccbbbbf..f7abb84 100644 --- a/TypeScript/16ImporterUtil/types/generators/BotEquipmentModGenerator.d.ts +++ b/TypeScript/16ImporterUtil/types/generators/BotEquipmentModGenerator.d.ts @@ -14,7 +14,6 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; import { BotEquipmentModPoolService } from "../services/BotEquipmentModPoolService"; import { BotModLimits, BotWeaponModLimitService } from "../services/BotWeaponModLimitService"; -import { ItemBaseClassService } from "../services/ItemBaseClassService"; import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; @@ -29,7 +28,6 @@ export declare class BotEquipmentModGenerator { protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; protected botEquipmentFilterService: BotEquipmentFilterService; - protected itemBaseClassService: ItemBaseClassService; protected itemFilterService: ItemFilterService; protected profileHelper: ProfileHelper; protected botWeaponModLimitService: BotWeaponModLimitService; @@ -40,7 +38,7 @@ export declare class BotEquipmentModGenerator { protected botEquipmentModPoolService: BotEquipmentModPoolService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, itemHelper: ItemHelper, botEquipmentFilterService: BotEquipmentFilterService, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponModLimitService: BotWeaponModLimitService, botHelper: BotHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, botEquipmentModPoolService: BotEquipmentModPoolService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, itemHelper: ItemHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponModLimitService: BotWeaponModLimitService, botHelper: BotHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, botEquipmentModPoolService: BotEquipmentModPoolService, configServer: ConfigServer); /** * Check mods are compatible and add to array * @param equipment Equipment item to add mods to diff --git a/TypeScript/16ImporterUtil/types/generators/LocationGenerator.d.ts b/TypeScript/16ImporterUtil/types/generators/LocationGenerator.d.ts index b8169d3..46a514b 100644 --- a/TypeScript/16ImporterUtil/types/generators/LocationGenerator.d.ts +++ b/TypeScript/16ImporterUtil/types/generators/LocationGenerator.d.ts @@ -65,10 +65,11 @@ export declare class LocationGenerator { protected getGuaranteedContainers(staticContainersOnMap: IStaticContainerData[]): IStaticContainerData[]; /** * Choose a number of containers based on their probabilty value to fulfil the desired count in containerData.chosenCount + * @param groupId Name of the group the containers are being collected for * @param containerData Containers and probability values for a groupId * @returns List of chosen container Ids */ - protected getContainersByProbabilty(containerData: IContainerGroupCount): string[]; + protected getContainersByProbabilty(groupId: string, containerData: IContainerGroupCount): string[]; /** * Get a mapping of each groupid and the containers in that group + count of containers to spawn on map * @param containersGroups Container group values diff --git a/TypeScript/16ImporterUtil/types/generators/PMCLootGenerator.d.ts b/TypeScript/16ImporterUtil/types/generators/PMCLootGenerator.d.ts index 9acff69..abb5615 100644 --- a/TypeScript/16ImporterUtil/types/generators/PMCLootGenerator.d.ts +++ b/TypeScript/16ImporterUtil/types/generators/PMCLootGenerator.d.ts @@ -31,12 +31,12 @@ export declare class PMCLootGenerator { */ generatePMCVestLootPool(): string[]; /** - * Check if item has a width/height that lets it fit into a 1x2/2x1 slot - * 1x1 / 1x2 / 2x1 + * Check if item has a width/height that lets it fit into a 2x2 slot + * 1x1 / 1x2 / 2x1 / 2x2 * @param item Item to check size of * @returns true if it fits */ - protected itemFitsInto1By2Slot(item: ITemplateItem): boolean; + protected itemFitsInto2By2Slot(item: ITemplateItem): boolean; /** * Create an array of loot items a PMC can have in their backpack * @returns string array of tpls diff --git a/TypeScript/16ImporterUtil/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/16ImporterUtil/types/generators/RagfairOfferGenerator.d.ts index a627191..58e0b68 100644 --- a/TypeScript/16ImporterUtil/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/16ImporterUtil/types/generators/RagfairOfferGenerator.d.ts @@ -55,11 +55,10 @@ export declare class RagfairOfferGenerator { * @param items Items in the offer * @param barterScheme Cost of item (currency or barter) * @param loyalLevel Loyalty level needed to buy item - * @param price Price of offer - * @param sellInOnePiece Set StackObjectsCount to 1 + * @param sellInOnePiece Flags sellInOnePiece to be true * @returns IRagfairOffer */ - createFleaOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; + createFleaOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, sellInOnePiece?: boolean): IRagfairOffer; /** * Create an offer object ready to send to ragfairOfferService.addOffer() * @param userID Owner of the offer @@ -67,17 +66,16 @@ export declare class RagfairOfferGenerator { * @param items Items in the offer * @param barterScheme Cost of item (currency or barter) * @param loyalLevel Loyalty level needed to buy item - * @param price Price of offer * @param sellInOnePiece Set StackObjectsCount to 1 * @returns IRagfairOffer */ - protected createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; + protected createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, sellInOnePiece?: boolean): IRagfairOffer; /** * Calculate the offer price that's listed on the flea listing * @param offerRequirements barter requirements for offer * @returns rouble cost of offer */ - protected calculateOfferListingPrice(offerRequirements: OfferRequirement[]): number; + protected convertOfferRequirementsIntoRoubles(offerRequirements: OfferRequirement[]): number; /** * Get avatar url from trader table in db * @param isTrader Is user we're getting avatar for a trader @@ -137,7 +135,7 @@ export declare class RagfairOfferGenerator { * @param itemDetails raw db item details * @returns Item array */ - protected createSingleOfferForItem(items: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; + protected createSingleOfferForItem(items: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; /** * Generate trader offers on flea using the traders assort data * @param traderID Trader to generate offers for @@ -151,7 +149,7 @@ export declare class RagfairOfferGenerator { * @param itemDetails db details of first item * @returns */ - protected getItemCondition(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): Item[]; + protected randomiseItemUpdProperties(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): Item[]; /** * Get the relevant condition id if item tpl matches in ragfair.json/condition * @param tpl Item to look for matching condition object @@ -184,7 +182,7 @@ export declare class RagfairOfferGenerator { * @param offerItems Items for sale in offer * @returns Barter scheme */ - protected createBarterRequirement(offerItems: Item[]): IBarterScheme[]; + protected createBarterBarterScheme(offerItems: Item[]): IBarterScheme[]; /** * Get an array of flea prices + item tpl, cached in generator class inside `allowedFleaPriceItemsForBarter` * @returns array with tpl/price values @@ -196,7 +194,9 @@ export declare class RagfairOfferGenerator { /** * Create a random currency-based barter scheme for an array of items * @param offerItems Items on offer + * @param isPackOffer Is the barter scheme being created for a pack offer + * @param multipler What to multiply the resulting price by * @returns Barter scheme for offer */ - protected createCurrencyRequirement(offerItems: Item[]): IBarterScheme[]; + protected createCurrencyBarterScheme(offerItems: Item[], isPackOffer: boolean, multipler?: number): IBarterScheme[]; } diff --git a/TypeScript/16ImporterUtil/types/generators/ScavCaseRewardGenerator.d.ts b/TypeScript/16ImporterUtil/types/generators/ScavCaseRewardGenerator.d.ts index 4ba1888..b5935d0 100644 --- a/TypeScript/16ImporterUtil/types/generators/ScavCaseRewardGenerator.d.ts +++ b/TypeScript/16ImporterUtil/types/generators/ScavCaseRewardGenerator.d.ts @@ -25,6 +25,8 @@ export declare class ScavCaseRewardGenerator { protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected scavCaseConfig: IScavCaseConfig; + protected dbItemsCache: ITemplateItem[]; + protected dbAmmoItemsCache: ITemplateItem[]; constructor(logger: ILogger, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * Create an array of rewards that will be given to the player upon completing their scav case build @@ -33,10 +35,10 @@ export declare class ScavCaseRewardGenerator { */ generate(recipeId: string): Product[]; /** - * Get all db items that are not blacklisted in scavcase config - * @returns filtered array of db items + * Get all db items that are not blacklisted in scavcase config or global blacklist + * Store in class field */ - protected getDbItems(): ITemplateItem[]; + protected cacheDbItems(): void; /** * Pick a number of items to be rewards, the count is defined by the values in * @param items item pool to pick rewards from diff --git a/TypeScript/16ImporterUtil/types/generators/WeatherGenerator.d.ts b/TypeScript/16ImporterUtil/types/generators/WeatherGenerator.d.ts index 2e2403c..6471bb1 100644 --- a/TypeScript/16ImporterUtil/types/generators/WeatherGenerator.d.ts +++ b/TypeScript/16ImporterUtil/types/generators/WeatherGenerator.d.ts @@ -52,6 +52,7 @@ export declare class WeatherGenerator { */ protected setCurrentDateTime(weather: IWeather): void; protected getWeightedWindDirection(): WindDirection; + protected getWeightedClouds(): number; protected getWeightedWindSpeed(): number; protected getWeightedFog(): number; protected getWeightedRain(): number; diff --git a/TypeScript/16ImporterUtil/types/helpers/HealthHelper.d.ts b/TypeScript/16ImporterUtil/types/helpers/HealthHelper.d.ts index 3694a6e..e4cdcd6 100644 --- a/TypeScript/16ImporterUtil/types/helpers/HealthHelper.d.ts +++ b/TypeScript/16ImporterUtil/types/helpers/HealthHelper.d.ts @@ -27,6 +27,7 @@ export declare class HealthHelper { * @param request Heal request * @param sessionID Session id * @param addEffects Should effects be added or removed (default - add) + * @param deleteExistingEffects Should all prior effects be removed before apply new ones */ saveVitality(pmcData: IPmcData, request: ISyncHealthRequestData, sessionID: string, addEffects?: boolean, deleteExistingEffects?: boolean): void; /** diff --git a/TypeScript/16ImporterUtil/types/helpers/InRaidHelper.d.ts b/TypeScript/16ImporterUtil/types/helpers/InRaidHelper.d.ts index bf584c2..b4c0c1c 100644 --- a/TypeScript/16ImporterUtil/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/16ImporterUtil/types/helpers/InRaidHelper.d.ts @@ -53,7 +53,7 @@ export declare class InRaidHelper { * @param victim Who was killed by player * @returns a numerical standing gain or loss */ - protected getStandingChangeForKill(victim: Victim): number; + protected getFenceStandingChangeForKillAsScav(victim: Victim): number; /** * Reset a profile to a baseline, used post-raid * Reset points earned during session property diff --git a/TypeScript/16ImporterUtil/types/helpers/ItemHelper.d.ts b/TypeScript/16ImporterUtil/types/helpers/ItemHelper.d.ts index 99fca56..00f190f 100644 --- a/TypeScript/16ImporterUtil/types/helpers/ItemHelper.d.ts +++ b/TypeScript/16ImporterUtil/types/helpers/ItemHelper.d.ts @@ -26,6 +26,7 @@ declare class ItemHelper { protected itemBaseClassService: ItemBaseClassService; protected localisationService: LocalisationService; protected localeService: LocaleService; + protected readonly defaultInvalidBaseTypes: string[]; constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, localisationService: LocalisationService, localeService: LocaleService); /** * Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash @@ -67,6 +68,11 @@ declare class ItemHelper { * @returns Price in roubles (undefined if not found) */ getDynamicItemPrice(tpl: string): number; + /** + * Update items upd.StackObjectsCount to be 1 if its upd is missing or StackObjectsCount is undefined + * @param item Item to update + * @returns Fixed item + */ fixItemStackCount(item: Item): Item; /** * AmmoBoxes contain StackSlots which need to be filled for the AmmoBox to have content. @@ -125,19 +131,19 @@ declare class ItemHelper { getItemQualityModifier(item: Item): number; /** * Get a quality value based on a repairable items (weapon/armor) current state between current and max durability - * @param itemDetails - * @param repairable repairable object - * @param item - * @returns a number between 0 and 1 + * @param itemDetails Db details for item we want quality value for + * @param repairable Repairable properties + * @param item Item quality value is for + * @returns A number between 0 and 1 */ protected getRepairableItemQualityValue(itemDetails: ITemplateItem, repairable: Repairable, item: Item): number; /** * Recursive function that looks at every item from parameter and gets their childrens Ids + includes parent item in results - * @param items - * @param itemID + * @param items Array of items (item + possible children) + * @param itemId Parent items id * @returns an array of strings */ - findAndReturnChildrenByItems(items: Item[], itemID: string): string[]; + findAndReturnChildrenByItems(items: Item[], itemId: string): string[]; /** * A variant of findAndReturnChildren where the output is list of item objects instead of their ids. * @param items @@ -164,12 +170,6 @@ declare class ItemHelper { * @returns true if it is a dogtag */ isDogtag(tpl: string): boolean; - /** - * Can the item passed in be sold to a trader because it is raw money - * @param tpl Item template id to check - * @returns true if unsellable - */ - isNotSellable(tpl: string): boolean; /** * Gets the identifier for a child using slotId, locationX and locationY. * @param item @@ -183,19 +183,19 @@ declare class ItemHelper { */ isItemTplStackable(tpl: string): boolean; /** - * split item stack if it exceeds its StackMaxSize property - * @param itemToSplit item being split into smaller stacks + * split item stack if it exceeds its items StackMaxSize property + * @param itemToSplit Item to split into smaller stacks * @returns Array of split items */ splitStack(itemToSplit: Item): Item[]; /** - * Find Barter items in the inventory + * Find Barter items from array of items * @param {string} by tpl or id - * @param {Object} pmcData + * @param {Item[]} items Array of items to iterate over * @param {string} barterItemId * @returns Array of Item objects */ - findBarterItems(by: "tpl" | "id", pmcData: IPmcData, barterItemId: string): Item[]; + findBarterItems(by: "tpl" | "id", items: Item[], barterItemId: string): Item[]; /** * Regenerate all guids with new ids, exceptions are for items that cannot be altered (e.g. stash/sorting table) * @param pmcData Player profile @@ -262,10 +262,21 @@ declare class ItemHelper { * @param minSizePercent % the magazine must be filled to */ fillMagazineWithCartridge(magazine: Item[], magTemplate: ITemplateItem, cartridgeTpl: string, minSizePercent?: number): void; + /** + * Choose a random bullet type from the list of possible a magazine has + * @param magTemplate Magazine template from Db + * @returns Tpl of cartridge + */ protected getRandomValidCaliber(magTemplate: ITemplateItem): string; + /** + * Chose a randomly weighted cartridge that fits + * @param caliber Desired caliber + * @param staticAmmoDist Cartridges and thier weights + * @returns Tpl of cartrdige + */ protected drawAmmoTpl(caliber: string, staticAmmoDist: Record): string; /** - * + * Create a basic cartrige object * @param parentId container cartridges will be placed in * @param ammoTpl Cartridge to insert * @param stackCount Count of cartridges inside parent diff --git a/TypeScript/16ImporterUtil/types/helpers/QuestHelper.d.ts b/TypeScript/16ImporterUtil/types/helpers/QuestHelper.d.ts index e04b6e0..5c749d3 100644 --- a/TypeScript/16ImporterUtil/types/helpers/QuestHelper.d.ts +++ b/TypeScript/16ImporterUtil/types/helpers/QuestHelper.d.ts @@ -21,6 +21,7 @@ import { DialogueHelper } from "./DialogueHelper"; import { ItemHelper } from "./ItemHelper"; import { PaymentHelper } from "./PaymentHelper"; import { ProfileHelper } from "./ProfileHelper"; +import { QuestConditionHelper } from "./QuestConditionHelper"; import { RagfairServerHelper } from "./RagfairServerHelper"; import { TraderHelper } from "./TraderHelper"; export declare class QuestHelper { @@ -29,6 +30,7 @@ export declare class QuestHelper { protected timeUtil: TimeUtil; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; + protected questConditionHelper: QuestConditionHelper; protected eventOutputHolder: EventOutputHolder; protected databaseServer: DatabaseServer; protected localeService: LocaleService; @@ -41,7 +43,7 @@ export declare class QuestHelper { protected mailSendService: MailSendService; protected configServer: ConfigServer; 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, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, questConditionHelper: QuestConditionHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, mailSendService: MailSendService, configServer: ConfigServer); /** * Get status of a quest in player profile by its id * @param pmcData Profile to search @@ -119,7 +121,7 @@ export declare class QuestHelper { * @param sessionID Session id * @returns Quests accessible to player incuding newly unlocked quests now quest (startedQuestId) was started */ - acceptedUnlocked(startedQuestId: string, sessionID: string): IQuest[]; + getNewlyAccessibleQuestsWhenStartingQuest(startedQuestId: string, sessionID: string): IQuest[]; /** * Get quests that can be shown to player after failing a quest * @param failedQuestId Id of the quest failed by player diff --git a/TypeScript/16ImporterUtil/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/16ImporterUtil/types/helpers/RagfairOfferHelper.d.ts index de9d550..0699259 100644 --- a/TypeScript/16ImporterUtil/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/16ImporterUtil/types/helpers/RagfairOfferHelper.d.ts @@ -1,4 +1,5 @@ import { IPmcData } from "../models/eft/common/IPmcData"; +import { Item } from "../models/eft/common/tables/IItem"; import { ITraderAssort } from "../models/eft/common/tables/ITrader"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; @@ -13,10 +14,10 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { LocaleService } from "../services/LocaleService"; import { LocalisationService } from "../services/LocalisationService"; +import { MailSendService } from "../services/MailSendService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { HashUtil } from "../utils/HashUtil"; import { TimeUtil } from "../utils/TimeUtil"; -import { DialogueHelper } from "./DialogueHelper"; import { ItemHelper } from "./ItemHelper"; import { PaymentHelper } from "./PaymentHelper"; import { PresetHelper } from "./PresetHelper"; @@ -33,7 +34,6 @@ export declare class RagfairOfferHelper { protected databaseServer: DatabaseServer; protected traderHelper: TraderHelper; protected saveServer: SaveServer; - protected dialogueHelper: DialogueHelper; protected itemHelper: ItemHelper; protected paymentHelper: PaymentHelper; protected presetHelper: PresetHelper; @@ -44,11 +44,12 @@ export declare class RagfairOfferHelper { protected ragfairOfferService: RagfairOfferService; protected localeService: LocaleService; protected localisationService: LocalisationService; + protected mailSendService: MailSendService; protected configServer: ConfigServer; protected static goodSoldTemplate: string; protected ragfairConfig: IRagfairConfig; 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, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, localisationService: LocalisationService, mailSendService: MailSendService, configServer: ConfigServer); /** * Passthrough to ragfairOfferService.getOffers(), get flea offers a player should see * @param searchRequest Data from client @@ -119,19 +120,26 @@ export declare class RagfairOfferHelper { */ protected getProfileOffers(sessionID: string): IRagfairOffer[]; /** - * Delete an offer from a desired profile + * Delete an offer from a desired profile and from ragfair offers * @param sessionID Session id of profile to delete offer from - * @param offerId Offer id to delete + * @param offerId Id of offer to delete */ - protected deleteOfferByOfferId(sessionID: string, offerId: string): void; + protected deleteOfferById(sessionID: string, offerId: string): void; /** * Complete the selling of players' offer * @param sessionID Session id * @param offer Sold offer details * @param boughtAmount Amount item was purchased for - * @returns Client response + * @returns IItemEventRouterResponse */ protected completeOffer(sessionID: string, offer: IRagfairOffer, boughtAmount: number): IItemEventRouterResponse; + /** + * Get a localised message for when players offer has sold on flea + * @param itemTpl Item sold + * @param boughtAmount How many were purchased + * @returns Localised message text + */ + protected getLocalisedOfferSoldMessage(itemTpl: string, boughtAmount: number): string; /** * Should a ragfair offer be visible to the player * @param searchRequest Search request @@ -142,4 +150,12 @@ export declare class RagfairOfferHelper { * @returns True = should be shown to player */ isDisplayableOffer(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, offer: IRagfairOffer, pmcProfile: IPmcData): boolean; + /** + * Is items quality value within desired range + * @param item Item to check quality of + * @param min Desired minimum quality + * @param max Desired maximum quality + * @returns True if in range + */ + protected itemQualityInRange(item: Item, min: number, max: number): boolean; } diff --git a/TypeScript/16ImporterUtil/types/helpers/RagfairSellHelper.d.ts b/TypeScript/16ImporterUtil/types/helpers/RagfairSellHelper.d.ts index 251d7ca..913b408 100644 --- a/TypeScript/16ImporterUtil/types/helpers/RagfairSellHelper.d.ts +++ b/TypeScript/16ImporterUtil/types/helpers/RagfairSellHelper.d.ts @@ -13,12 +13,12 @@ export declare class RagfairSellHelper { constructor(logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, configServer: ConfigServer); /** * Get the percent chance to sell an item based on its average listed price vs player chosen listing price - * @param baseChancePercent Base chance to sell item * @param averageOfferPriceRub Price of average offer in roubles * @param playerListedPriceRub Price player listed item for in roubles + * @param qualityMultiplier Quality multipler of item being sold * @returns percent value */ - calculateSellChance(baseChancePercent: number, averageOfferPriceRub: number, playerListedPriceRub: number): number; + calculateSellChance(averageOfferPriceRub: number, playerListedPriceRub: number, qualityMultiplier: number): number; /** * Get percent chance to sell an item when price is below items average listing price * @param playerListedPriceRub Price player listed item for in roubles diff --git a/TypeScript/16ImporterUtil/types/helpers/TraderHelper.d.ts b/TypeScript/16ImporterUtil/types/helpers/TraderHelper.d.ts index c163f7a..6680ccf 100644 --- a/TypeScript/16ImporterUtil/types/helpers/TraderHelper.d.ts +++ b/TypeScript/16ImporterUtil/types/helpers/TraderHelper.d.ts @@ -35,7 +35,7 @@ export declare class TraderHelper { protected highestTraderBuyPriceItems: Record; constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, handbookHelper: HandbookHelper, itemHelper: ItemHelper, playerService: PlayerService, localisationService: LocalisationService, fenceService: FenceService, timeUtil: TimeUtil, randomUtil: RandomUtil, configServer: ConfigServer); getTrader(traderID: string, sessionID: string): ITraderBase; - getTraderAssortsById(traderId: string): ITraderAssort; + getTraderAssortsByTraderId(traderId: string): ITraderAssort; /** * 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 diff --git a/TypeScript/16ImporterUtil/types/models/eft/common/tables/IBotBase.d.ts b/TypeScript/16ImporterUtil/types/models/eft/common/tables/IBotBase.d.ts index ee40958..6c7b76f 100644 --- a/TypeScript/16ImporterUtil/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/16ImporterUtil/types/models/eft/common/tables/IBotBase.d.ts @@ -281,7 +281,7 @@ export interface InsuredItem { export interface Hideout { Production: Record; Areas: HideoutArea[]; - Improvements: Record; + Improvement: Record; Seed: number; sptUpdateLastRunTimestamp: number; } diff --git a/TypeScript/16ImporterUtil/types/models/eft/health/IHealthTreatmentRequestData.d.ts b/TypeScript/16ImporterUtil/types/models/eft/health/IHealthTreatmentRequestData.d.ts index 7fb80a8..598e60c 100644 --- a/TypeScript/16ImporterUtil/types/models/eft/health/IHealthTreatmentRequestData.d.ts +++ b/TypeScript/16ImporterUtil/types/models/eft/health/IHealthTreatmentRequestData.d.ts @@ -1,12 +1,14 @@ export interface IHealthTreatmentRequestData { Action: "RestoreHealth"; trader: string; - items: Item[]; + items: Cost[]; difference: Difference; timestamp: number; } -export interface Item { +export interface Cost { + /** Id of stack to take money from */ id: string; + /** Amount of money to take off player for treatment */ count: number; } export interface Difference { @@ -25,5 +27,6 @@ export interface BodyParts { } export interface BodyPart { Health: number; + /** Effects in array are to be removed */ Effects: string[]; } diff --git a/TypeScript/16ImporterUtil/types/models/eft/notifier/INotifier.d.ts b/TypeScript/16ImporterUtil/types/models/eft/notifier/INotifier.d.ts index ce25dee..c6c6979 100644 --- a/TypeScript/16ImporterUtil/types/models/eft/notifier/INotifier.d.ts +++ b/TypeScript/16ImporterUtil/types/models/eft/notifier/INotifier.d.ts @@ -14,6 +14,11 @@ export interface INotification { } export declare enum NotificationType { RAGFAIR_OFFER_SOLD = "RagfairOfferSold", + RAGFAIR_RATING_CHANGE = "RagfairRatingChange", + /** ChatMessageReceived */ NEW_MESSAGE = "new_message", - PING = "ping" + PING = "ping", + TRADER_SUPPLY = "TraderSupply", + TRADER_STANDING = "TraderStanding", + UNLOCK_TRADER = "UnlockTrader" } diff --git a/TypeScript/16ImporterUtil/types/models/eft/notifier/ISelectProfileResponse.d.ts b/TypeScript/16ImporterUtil/types/models/eft/notifier/ISelectProfileResponse.d.ts index ecb668a..f2d6be7 100644 --- a/TypeScript/16ImporterUtil/types/models/eft/notifier/ISelectProfileResponse.d.ts +++ b/TypeScript/16ImporterUtil/types/models/eft/notifier/ISelectProfileResponse.d.ts @@ -1,6 +1,3 @@ -import { INotifierChannel } from "./INotifier"; export interface ISelectProfileResponse { status: string; - notifier: INotifierChannel; - notifierServer: string; } diff --git a/TypeScript/16ImporterUtil/types/models/enums/WeatherType.d.ts b/TypeScript/16ImporterUtil/types/models/enums/WeatherType.d.ts index d31fefe..503dc30 100644 --- a/TypeScript/16ImporterUtil/types/models/enums/WeatherType.d.ts +++ b/TypeScript/16ImporterUtil/types/models/enums/WeatherType.d.ts @@ -1,19 +1,19 @@ export declare enum WeatherType { - CLEAR_DAY = 1, - CLEAR_WIND = 2, - CLEAR_NIGHT = 3, - PARTLY_CLOUD_DAY = 4, - PARTLY_CLOUD_NIGHT = 5, - CLEAR_FOG_DAY = 6, - CLEAR_FOG_NIGHT = 7, - CLOUDFOG = 8, - FOG = 9, - MOSTLY_CLOUD = 10, - LIGHT_RAIN = 11, - RAIN = 12, - CLOUD_WIND = 13, - CLOUD_WIND_RAIN = 14, - FULL_CLOUD = 15, - THUNDER_CLOUD = 16, - NONE = 0 + CLEAR_DAY = 0, + CLEAR_WIND = 1, + CLEAR_NIGHT = 2, + PARTLY_CLOUD_DAY = 3, + PARTLY_CLOUD_NIGHT = 4, + CLEAR_FOG_DAY = 5, + CLEAR_FOG_NIGHT = 6, + CLOUD_FOG = 7, + FOG = 8, + MOSTLY_CLOUD = 9, + LIGHT_RAIN = 10, + RAIN = 11, + CLOUD_WIND = 12, + CLOUD_WIND_RAIN = 13, + FULL_CLOUD = 14, + THUNDER_CLOUD = 15, + NONE = 16 } diff --git a/TypeScript/16ImporterUtil/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/16ImporterUtil/types/models/spt/config/IRagfairConfig.d.ts index 7c04857..7aea24f 100644 --- a/TypeScript/16ImporterUtil/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/16ImporterUtil/types/models/spt/config/IRagfairConfig.d.ts @@ -41,7 +41,8 @@ export interface Dynamic { /** Use the highest trader price for an offer if its greater than the price in templates/prices.json */ useTraderPriceForOffersIfHigher: boolean; /** Barter offer specific settings */ - barter: Barter; + barter: IBarterDetails; + pack: IPackDetails; /** Dynamic offer price below handbook adjustment values */ offerAdjustment: OfferAdjustment; /** How many offers should expire before an offer regeneration occurs */ @@ -49,9 +50,7 @@ export interface Dynamic { /** How many offers should be listed */ offerItemCount: MinMax; /** How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) */ - price: MinMax; - /** How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) */ - presetPrice: MinMax; + priceRanges: IPriceRanges; /** Should default presets to listed only or should non-standard presets found in globals.json be listed too */ showDefaultPresetsOnly: boolean; endTimeSeconds: MinMax; @@ -74,7 +73,12 @@ export interface Dynamic { /** Dict of price limits keyed by item type */ unreasonableModPrices: Record; } -export interface Barter { +export interface IPriceRanges { + default: MinMax; + preset: MinMax; + pack: MinMax; +} +export interface IBarterDetails { /** Should barter offers be generated */ enable: boolean; /** Percentage change an offer is listed as a barter */ @@ -90,6 +94,18 @@ export interface Barter { /** Item Tpls to never be turned into a barter */ itemTypeBlacklist: string[]; } +export interface IPackDetails { + /** Should pack offers be generated */ + enable: boolean; + /** Percentage change an offer is listed as a pack */ + chancePercent: number; + /** Min number of required items for a pack */ + itemCountMin: number; + /** Max number of required items for a pack */ + itemCountMax: number; + /** item types to allow being a pack */ + itemTypeWhitelist: string[]; +} export interface OfferAdjustment { /** Shuld offer price be adjusted when below handbook price */ adjustPriceWhenBelowHandbookPrice: boolean; diff --git a/TypeScript/16ImporterUtil/types/models/spt/config/IWeatherConfig.d.ts b/TypeScript/16ImporterUtil/types/models/spt/config/IWeatherConfig.d.ts index 41a1c83..6ecf35b 100644 --- a/TypeScript/16ImporterUtil/types/models/spt/config/IWeatherConfig.d.ts +++ b/TypeScript/16ImporterUtil/types/models/spt/config/IWeatherConfig.d.ts @@ -7,7 +7,7 @@ export interface IWeatherConfig extends IBaseConfig { weather: Weather; } export interface Weather { - clouds: MinMax; + clouds: WeatherSettings; windSpeed: WeatherSettings; windDirection: WeatherSettings; windGustiness: MinMax; diff --git a/TypeScript/16ImporterUtil/types/services/HashCacheService.d.ts b/TypeScript/16ImporterUtil/types/services/HashCacheService.d.ts index 5320f28..9968478 100644 --- a/TypeScript/16ImporterUtil/types/services/HashCacheService.d.ts +++ b/TypeScript/16ImporterUtil/types/services/HashCacheService.d.ts @@ -11,7 +11,18 @@ export declare class HashCacheService { protected modHashes: any; protected readonly modCachePath = "./user/cache/modCache.json"; constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); + /** + * Return a stored hash by key + * @param modName Name of mod to get hash for + * @returns Mod hash + */ getStoredModHash(modName: string): string; + /** + * Does the generated hash match the stored hash + * @param modName name of mod + * @param modContent + * @returns True if they match + */ modContentMatchesStoredHash(modName: string, modContent: string): boolean; hashMatchesStoredHash(modName: string, modHash: string): boolean; storeModContent(modName: string, modContent: string): void; diff --git a/TypeScript/16ImporterUtil/types/services/MailSendService.d.ts b/TypeScript/16ImporterUtil/types/services/MailSendService.d.ts index 19397dc..fe4a7fe 100644 --- a/TypeScript/16ImporterUtil/types/services/MailSendService.d.ts +++ b/TypeScript/16ImporterUtil/types/services/MailSendService.d.ts @@ -35,7 +35,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendDirectNpcMessageToPlayer(playerId: string, sender: Traders, messageType: MessageType, message: string, items?: Item[], maxStorageTimeSeconds?: any): void; + sendDirectNpcMessageToPlayer(playerId: string, sender: Traders, messageType: MessageType, message: string, items?: Item[], maxStorageTimeSeconds?: any, systemData?: any, ragfair?: any): void; /** * Send a message from an NPC (e.g. prapor) to the player with or without items * @param playerId Players id to send message to @@ -45,7 +45,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendLocalisedNpcMessageToPlayer(playerId: string, sender: Traders, messageType: MessageType, messageLocaleId: string, items?: Item[], maxStorageTimeSeconds?: any, systemData?: any): void; + sendLocalisedNpcMessageToPlayer(playerId: string, sender: Traders, messageType: MessageType, messageLocaleId: string, items?: Item[], maxStorageTimeSeconds?: any, systemData?: any, ragfair?: any): void; /** * Send a message from SYSTEM to the player with or without items * @param playerId Players id to send message to diff --git a/TypeScript/16ImporterUtil/types/services/MatchBotDetailsCacheService.d.ts b/TypeScript/16ImporterUtil/types/services/MatchBotDetailsCacheService.d.ts index eb365dd..c1bd322 100644 --- a/TypeScript/16ImporterUtil/types/services/MatchBotDetailsCacheService.d.ts +++ b/TypeScript/16ImporterUtil/types/services/MatchBotDetailsCacheService.d.ts @@ -1,7 +1,7 @@ import { IBotBase } from "../models/eft/common/tables/IBotBase"; import { ILogger } from "../models/spt/utils/ILogger"; import { LocalisationService } from "./LocalisationService"; -/** Cache bots in a dictionary, keyed by the bots name, keying by name isnt idea as its not unique but this is used by the post-raid system which doesnt have any bot ids, only name */ +/** Cache bots in a dictionary, keyed by the bots name, keying by name isnt ideal as its not unique but this is used by the post-raid system which doesnt have any bot ids, only name */ export declare class MatchBotDetailsCacheService { protected logger: ILogger; protected localisationService: LocalisationService; @@ -17,9 +17,9 @@ export declare class MatchBotDetailsCacheService { */ clearCache(): void; /** - * Find a bot in the cache by its name + * Find a bot in the cache by its name and side * @param botName Name of bot to find * @returns Bot details */ - getBotByName(botName: string): IBotBase; + getBotByNameAndSide(botName: string, botSide: string): IBotBase; } diff --git a/TypeScript/16ImporterUtil/types/services/ModCompilerService.d.ts b/TypeScript/16ImporterUtil/types/services/ModCompilerService.d.ts index a4bf3c8..e306177 100644 --- a/TypeScript/16ImporterUtil/types/services/ModCompilerService.d.ts +++ b/TypeScript/16ImporterUtil/types/services/ModCompilerService.d.ts @@ -1,14 +1,36 @@ import { CompilerOptions } from "typescript"; import type { ILogger } from "../models/spt/utils/ILogger"; -import { HashCacheService } from "./HashCacheService"; import { VFS } from "../utils/VFS"; +import { HashCacheService } from "./HashCacheService"; export declare class ModCompilerService { protected logger: ILogger; protected hashCacheService: HashCacheService; protected vfs: VFS; constructor(logger: ILogger, hashCacheService: HashCacheService, vfs: VFS); + /** + * Convert a mods TS into JS + * @param modName Name of mod + * @param modPath Dir path to mod + * @param modTypeScriptFiles + * @returns + */ compileMod(modName: string, modPath: string, modTypeScriptFiles: string[]): Promise; + /** + * Convert a TS file into JS + * @param fileNames Paths to TS files + * @param options Compiler options + */ protected compile(fileNames: string[], options: CompilerOptions): Promise; + /** + * Do the files at the provided paths exist + * @param fileNames + * @returns + */ protected areFilesReady(fileNames: string[]): boolean; + /** + * Wait the provided number of milliseconds + * @param ms Milliseconds + * @returns + */ protected delay(ms: number): Promise; } diff --git a/TypeScript/16ImporterUtil/types/services/PaymentService.d.ts b/TypeScript/16ImporterUtil/types/services/PaymentService.d.ts index 1c9c32b..fb5f92c 100644 --- a/TypeScript/16ImporterUtil/types/services/PaymentService.d.ts +++ b/TypeScript/16ImporterUtil/types/services/PaymentService.d.ts @@ -61,23 +61,26 @@ export declare class PaymentService { * Get all money stacks in inventory and prioritse items in stash * @param pmcData * @param currencyTpl + * @param playerStashId Players stash id * @returns Sorting money items */ - protected getSortedMoneyItemsInInventory(pmcData: IPmcData, currencyTpl: string): Item[]; + protected getSortedMoneyItemsInInventory(pmcData: IPmcData, currencyTpl: string, playerStashId: string): Item[]; /** * Prioritise player stash first over player inventory * Post-raid healing would often take money out of the players pockets/secure container * @param a First money stack item * @param b Second money stack item * @param inventoryItems players inventory items + * @param playerStashId Players stash id * @returns sort order */ - protected prioritiseStashSort(a: Item, b: Item, inventoryItems: Item[]): number; + protected prioritiseStashSort(a: Item, b: Item, inventoryItems: Item[], playerStashId: string): number; /** * Recursivly check items parents to see if it is inside the players inventory, not stash * @param itemId item id to check * @param inventoryItems player inventory + * @param playerStashId Players stash id * @returns true if its in inventory */ - protected isInInventory(itemId: string, inventoryItems: Item[]): boolean; + protected isInStash(itemId: string, inventoryItems: Item[], playerStashId: string): boolean; } diff --git a/TypeScript/16ImporterUtil/types/services/ProfileFixerService.d.ts b/TypeScript/16ImporterUtil/types/services/ProfileFixerService.d.ts index c8232fc..bc1e42e 100644 --- a/TypeScript/16ImporterUtil/types/services/ProfileFixerService.d.ts +++ b/TypeScript/16ImporterUtil/types/services/ProfileFixerService.d.ts @@ -14,6 +14,7 @@ import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; import { Watermark } from "../utils/Watermark"; import { LocalisationService } from "./LocalisationService"; @@ -27,17 +28,19 @@ export declare class ProfileFixerService { protected itemHelper: ItemHelper; protected localisationService: LocalisationService; protected timeUtil: TimeUtil; + protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, profileHelper: ProfileHelper, itemHelper: ItemHelper, localisationService: LocalisationService, timeUtil: TimeUtil, databaseServer: DatabaseServer, configServer: ConfigServer); + constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, profileHelper: ProfileHelper, itemHelper: ItemHelper, localisationService: LocalisationService, timeUtil: TimeUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, configServer: ConfigServer); /** * 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; protected addMissingGunStandContainerImprovements(pmcProfile: IPmcData): void; + protected ensureGunStandLevelsMatch(pmcProfile: IPmcData): void; protected addHideoutAreaStashes(pmcProfile: IPmcData): void; protected addMissingHideoutWallAreas(pmcProfile: IPmcData): void; protected adjustUnreasonableModFleaPrices(): void; @@ -131,4 +134,9 @@ export declare class ProfileFixerService { * @param pmcProfile Profile to add missing IDs to */ addMissingIdsToBonuses(pmcProfile: IPmcData): void; + /** + * At some point the property name was changed,migrate data across to new name + * @param pmcProfile + */ + protected migrateImprovements(pmcProfile: IPmcData): void; } diff --git a/TypeScript/16ImporterUtil/types/services/RagfairPriceService.d.ts b/TypeScript/16ImporterUtil/types/services/RagfairPriceService.d.ts index e245efa..ff35327 100644 --- a/TypeScript/16ImporterUtil/types/services/RagfairPriceService.d.ts +++ b/TypeScript/16ImporterUtil/types/services/RagfairPriceService.d.ts @@ -3,6 +3,7 @@ import { HandbookHelper } from "../helpers/HandbookHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { TraderHelper } from "../helpers/TraderHelper"; +import { MinMax } from "../models/common/MinMax"; import { IPreset } from "../models/eft/common/IGlobals"; import { Item } from "../models/eft/common/tables/IItem"; import { IBarterScheme } from "../models/eft/common/tables/ITrader"; @@ -35,10 +36,6 @@ export declare class RagfairPriceService implements OnLoad { * Generate static (handbook) and dynamic (prices.json) flea prices, store inside class as dictionaries */ onLoad(): Promise; - /** - * Add placeholder values for items missing from handbook - */ - protected addMissingHandbookPrices(): void; getRoute(): string; /** * Iterate over all items of type "Item" in db and get template price, store in cache @@ -91,9 +88,17 @@ export declare class RagfairPriceService implements OnLoad { * Generate a currency cost for an item and its mods * @param items Item with mods to get price for * @param desiredCurrency Currency price desired in + * @param isPackOffer Price is for a pack type offer * @returns cost of item in desired currency */ - getDynamicOfferPrice(items: Item[], desiredCurrency: string): number; + getDynamicOfferPriceForOffer(items: Item[], desiredCurrency: string, isPackOffer: boolean): number; + /** + * Get different min/max price multipliers for different offer types (preset/pack/default) + * @param isPreset Offer is a preset + * @param isPack Offer is a pack + * @returns MinMax values + */ + protected getOfferTypeRangeValues(isPreset: boolean, isPack: boolean): MinMax; /** * Check to see if an items price is below its handbook price and adjust accoring to values set to config/ragfair.json * @param itemPrice price of item @@ -104,10 +109,10 @@ export declare class RagfairPriceService implements OnLoad { /** * Multiply the price by a randomised curve where n = 2, shift = 2 * @param existingPrice price to alter - * @param isPreset is the item we're multiplying a preset + * @param rangeValues min and max to adjust price by * @returns multiplied price */ - protected randomisePrice(existingPrice: number, isPreset: boolean): number; + protected randomiseOfferPrice(existingPrice: number, rangeValues: MinMax): number; /** * Calculate the cost of a weapon preset by adding together the price of its mods + base price of default weapon preset * @param item base weapon diff --git a/TypeScript/17AsyncImporterWithDependency1/types/callbacks/GameCallbacks.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/callbacks/GameCallbacks.d.ts index aa80036..46f79f9 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/callbacks/GameCallbacks.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/callbacks/GameCallbacks.d.ts @@ -1,4 +1,5 @@ import { GameController } from "../controllers/GameController"; +import { OnLoad } from "../di/OnLoad"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { ICheckVersionResponse } from "../models/eft/game/ICheckVersionResponse"; import { ICurrentGroupResponse } from "../models/eft/game/ICurrentGroupResponse"; @@ -15,12 +16,14 @@ import { INullResponseData } from "../models/eft/httpResponse/INullResponseData" import { SaveServer } from "../servers/SaveServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { Watermark } from "../utils/Watermark"; -declare class GameCallbacks { +declare class GameCallbacks implements OnLoad { protected httpResponse: HttpResponseUtil; protected watermark: Watermark; protected saveServer: SaveServer; protected gameController: GameController; constructor(httpResponse: HttpResponseUtil, watermark: Watermark, saveServer: SaveServer, gameController: GameController); + onLoad(): Promise; + getRoute(): string; /** * Handle client/game/version/validate * @returns INullResponseData diff --git a/TypeScript/17AsyncImporterWithDependency1/types/controllers/GameController.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/controllers/GameController.d.ts index 04e3abb..e88610e 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/controllers/GameController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/controllers/GameController.d.ts @@ -61,13 +61,14 @@ export declare class GameController { protected pmcConfig: IPmcConfig; protected lootConfig: ILootConfig; constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, randomUtil: RandomUtil, encodingUtil: EncodingUtil, hideoutHelper: HideoutHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, seasonalEventService: SeasonalEventService, itemBaseClassService: ItemBaseClassService, giftService: GiftService, applicationContext: ApplicationContext, configServer: ConfigServer); + load(): void; /** * Handle client/game/start */ gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; protected addCustomLooseLootPositions(): void; protected adjustLooseLootSpawnProbabilities(): void; - protected setHideoutAreasAndCraftsTo30Secs(): void; + protected setHideoutAreasAndCraftsTo40Secs(): void; /** * 3.7.0 moved AIDs to be numeric, old profiles need to be migrated * We store the old AID value in new field `sessionId` diff --git a/TypeScript/17AsyncImporterWithDependency1/types/controllers/HealthController.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/controllers/HealthController.d.ts index 1938297..2d7ff09 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/controllers/HealthController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/controllers/HealthController.d.ts @@ -29,34 +29,35 @@ export declare class HealthController { * stores in-raid player health * @param pmcData Player profile * @param info Request data - * @param sessionID + * @param sessionID Player id * @param addEffects Should effects found be added or removed from profile + * @param deleteExistingEffects Should all prior effects be removed before apply new ones */ saveVitality(pmcData: IPmcData, info: ISyncHealthRequestData, sessionID: string, addEffects?: boolean, deleteExistingEffects?: boolean): void; /** * When healing in menu - * @param pmcData - * @param body - * @param sessionID - * @returns + * @param pmcData Player profile + * @param request Healing request + * @param sessionID Player id + * @returns IItemEventRouterResponse */ - offraidHeal(pmcData: IPmcData, body: IOffraidHealRequestData, sessionID: string): IItemEventRouterResponse; + offraidHeal(pmcData: IPmcData, request: IOffraidHealRequestData, sessionID: string): IItemEventRouterResponse; /** * Handle Eat event * Consume food/water outside of a raid * @param pmcData Player profile - * @param body request Object + * @param request Eat request * @param sessionID Session id * @returns IItemEventRouterResponse */ - offraidEat(pmcData: IPmcData, body: IOffraidEatRequestData, sessionID: string): IItemEventRouterResponse; + offraidEat(pmcData: IPmcData, request: IOffraidEatRequestData, sessionID: string): IItemEventRouterResponse; /** * Handle RestoreHealth event * Occurs on post-raid healing page * @param pmcData player profile * @param healthTreatmentRequest Request data from client * @param sessionID Session id - * @returns + * @returns IItemEventRouterResponse */ healthTreatment(pmcData: IPmcData, healthTreatmentRequest: IHealthTreatmentRequestData, sessionID: string): IItemEventRouterResponse; /** @@ -66,12 +67,4 @@ export declare class HealthController { * @param sessionID */ applyWorkoutChanges(pmcData: IPmcData, info: IWorkoutData, sessionId: string): void; - /** - * Iterate over treatment request diff and find effects to remove from player limbs - * @param sessionId - * @param profile Profile to update - * @param treatmentRequest client request - * @param output response to send to client - */ - protected removeEffectsAfterPostRaidHeal(sessionId: string, profile: IPmcData, treatmentRequest: IHealthTreatmentRequestData, output: IItemEventRouterResponse): void; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/controllers/HideoutController.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/controllers/HideoutController.d.ts index 877c076..a90a16d 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/controllers/HideoutController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/controllers/HideoutController.d.ts @@ -88,11 +88,11 @@ export declare class HideoutController { * @param pmcData Profile to edit * @param output Object to send back to client * @param sessionID Session/player id - * @param profileHideoutArea Current hideout data for profile + * @param profileParentHideoutArea Current hideout area for profile * @param dbHideoutArea Hideout area being upgraded * @param hideoutStage Stage hideout area is being upgraded to */ - protected addContainerImprovementToProfile(output: IItemEventRouterResponse, sessionID: string, pmcData: IPmcData, profileHideoutArea: HideoutArea, dbHideoutArea: IHideoutArea, hideoutStage: Stage): void; + protected addContainerImprovementToProfile(output: IItemEventRouterResponse, sessionID: string, pmcData: IPmcData, profileParentHideoutArea: HideoutArea, dbHideoutArea: IHideoutArea, hideoutStage: Stage): void; /** * Add an inventory item to profile from a hideout area stage data * @param pmcData Profile to update diff --git a/TypeScript/17AsyncImporterWithDependency1/types/controllers/LocationController.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/controllers/LocationController.d.ts index 94d496a..94f5fce 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/controllers/LocationController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/controllers/LocationController.d.ts @@ -4,6 +4,7 @@ import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { ILocationBase } from "../models/eft/common/ILocationBase"; import { ILocationsGenerateAllResponse } from "../models/eft/common/ILocationsSourceDestinationBase"; import { IAirdropLootResult } from "../models/eft/location/IAirdropLootResult"; +import { IGetLocationRequestData } from "../models/eft/location/IGetLocationRequestData"; import { AirdropTypeEnum } from "../models/enums/AirdropType"; import { IAirdropConfig } from "../models/spt/config/IAirdropConfig"; import { ILocationConfig } from "../models/spt/config/ILocationConfig"; @@ -34,10 +35,11 @@ export declare class LocationController { /** * Handle client/location/getLocalloot * Get a location (map) with generated loot data - * @param location Map to generate loot for + * @param sessionId Player id + * @param request Map request to generate * @returns ILocationBase */ - get(location: string): ILocationBase; + get(sessionId: string, request: IGetLocationRequestData): ILocationBase; /** * Generate a maps base location with loot * @param name Map name diff --git a/TypeScript/17AsyncImporterWithDependency1/types/controllers/QuestController.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/controllers/QuestController.d.ts index 7d494a6..bd8a70f 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/controllers/QuestController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/controllers/QuestController.d.ts @@ -61,7 +61,7 @@ export declare class QuestController { * @param playerLevel level of player to test against quest * @returns true if quest can be seen/accepted by player of defined level */ - protected playerLevelFulfillsQuestRequrement(quest: IQuest, playerLevel: number): boolean; + protected playerLevelFulfillsQuestRequirement(quest: IQuest, playerLevel: number): boolean; /** * Should a quest be shown to the player in trader quest screen * @param questId Quest to check diff --git a/TypeScript/17AsyncImporterWithDependency1/types/controllers/RagfairController.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/controllers/RagfairController.d.ts index 76c27f7..bda37cd 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/controllers/RagfairController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/controllers/RagfairController.d.ts @@ -21,6 +21,7 @@ import { IGetMarketPriceRequestData } from "../models/eft/ragfair/IGetMarketPric import { IGetOffersResult } from "../models/eft/ragfair/IGetOffersResult"; import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; import { ISearchRequestData } from "../models/eft/ragfair/ISearchRequestData"; +import { IProcessBuyTradeRequestData } from "../models/eft/trade/IProcessBuyTradeRequestData"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; @@ -125,6 +126,18 @@ export declare class RagfairController { * @returns IItemEventRouterResponse */ addPlayerOffer(pmcData: IPmcData, offerRequest: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Charge player a listing fee for using flea, pulls charge from data previously sent by client + * @param sessionID Player id + * @param rootItem Base item being listed (used when client tax cost not found and must be done on server) + * @param pmcData Player profile + * @param requirementsPriceInRub Rouble cost player chose for listing (used when client tax cost not found and must be done on server) + * @param itemStackCount How many items were listed in player (used when client tax cost not found and must be done on server) + * @param offerRequest Add offer request object from client + * @param output IItemEventRouterResponse + * @returns True if charging tax to player failed + */ + protected chargePlayerTaxFee(sessionID: string, rootItem: Item, pmcData: IPmcData, requirementsPriceInRub: number, itemStackCount: number, offerRequest: IAddOfferRequestData, output: IItemEventRouterResponse): boolean; /** * Is the item to be listed on the flea valid * @param offerRequest Client offer request @@ -158,4 +171,11 @@ export declare class RagfairController { */ removeOffer(offerId: string, sessionID: string): IItemEventRouterResponse; extendOffer(info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Create a basic trader request object with price and currency type + * @param currency What currency: RUB, EURO, USD + * @param value Amount of currency + * @returns IProcessBuyTradeRequestData + */ + protected createBuyTradeRequestObject(currency: string, value: number): IProcessBuyTradeRequestData; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/generators/BotEquipmentModGenerator.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/generators/BotEquipmentModGenerator.d.ts index ccbbbbf..f7abb84 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/generators/BotEquipmentModGenerator.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/generators/BotEquipmentModGenerator.d.ts @@ -14,7 +14,6 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; import { BotEquipmentModPoolService } from "../services/BotEquipmentModPoolService"; import { BotModLimits, BotWeaponModLimitService } from "../services/BotWeaponModLimitService"; -import { ItemBaseClassService } from "../services/ItemBaseClassService"; import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; @@ -29,7 +28,6 @@ export declare class BotEquipmentModGenerator { protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; protected botEquipmentFilterService: BotEquipmentFilterService; - protected itemBaseClassService: ItemBaseClassService; protected itemFilterService: ItemFilterService; protected profileHelper: ProfileHelper; protected botWeaponModLimitService: BotWeaponModLimitService; @@ -40,7 +38,7 @@ export declare class BotEquipmentModGenerator { protected botEquipmentModPoolService: BotEquipmentModPoolService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, itemHelper: ItemHelper, botEquipmentFilterService: BotEquipmentFilterService, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponModLimitService: BotWeaponModLimitService, botHelper: BotHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, botEquipmentModPoolService: BotEquipmentModPoolService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, itemHelper: ItemHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponModLimitService: BotWeaponModLimitService, botHelper: BotHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, botEquipmentModPoolService: BotEquipmentModPoolService, configServer: ConfigServer); /** * Check mods are compatible and add to array * @param equipment Equipment item to add mods to diff --git a/TypeScript/17AsyncImporterWithDependency1/types/generators/LocationGenerator.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/generators/LocationGenerator.d.ts index b8169d3..46a514b 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/generators/LocationGenerator.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/generators/LocationGenerator.d.ts @@ -65,10 +65,11 @@ export declare class LocationGenerator { protected getGuaranteedContainers(staticContainersOnMap: IStaticContainerData[]): IStaticContainerData[]; /** * Choose a number of containers based on their probabilty value to fulfil the desired count in containerData.chosenCount + * @param groupId Name of the group the containers are being collected for * @param containerData Containers and probability values for a groupId * @returns List of chosen container Ids */ - protected getContainersByProbabilty(containerData: IContainerGroupCount): string[]; + protected getContainersByProbabilty(groupId: string, containerData: IContainerGroupCount): string[]; /** * Get a mapping of each groupid and the containers in that group + count of containers to spawn on map * @param containersGroups Container group values diff --git a/TypeScript/17AsyncImporterWithDependency1/types/generators/PMCLootGenerator.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/generators/PMCLootGenerator.d.ts index 9acff69..abb5615 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/generators/PMCLootGenerator.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/generators/PMCLootGenerator.d.ts @@ -31,12 +31,12 @@ export declare class PMCLootGenerator { */ generatePMCVestLootPool(): string[]; /** - * Check if item has a width/height that lets it fit into a 1x2/2x1 slot - * 1x1 / 1x2 / 2x1 + * Check if item has a width/height that lets it fit into a 2x2 slot + * 1x1 / 1x2 / 2x1 / 2x2 * @param item Item to check size of * @returns true if it fits */ - protected itemFitsInto1By2Slot(item: ITemplateItem): boolean; + protected itemFitsInto2By2Slot(item: ITemplateItem): boolean; /** * Create an array of loot items a PMC can have in their backpack * @returns string array of tpls diff --git a/TypeScript/17AsyncImporterWithDependency1/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/generators/RagfairOfferGenerator.d.ts index a627191..58e0b68 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/generators/RagfairOfferGenerator.d.ts @@ -55,11 +55,10 @@ export declare class RagfairOfferGenerator { * @param items Items in the offer * @param barterScheme Cost of item (currency or barter) * @param loyalLevel Loyalty level needed to buy item - * @param price Price of offer - * @param sellInOnePiece Set StackObjectsCount to 1 + * @param sellInOnePiece Flags sellInOnePiece to be true * @returns IRagfairOffer */ - createFleaOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; + createFleaOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, sellInOnePiece?: boolean): IRagfairOffer; /** * Create an offer object ready to send to ragfairOfferService.addOffer() * @param userID Owner of the offer @@ -67,17 +66,16 @@ export declare class RagfairOfferGenerator { * @param items Items in the offer * @param barterScheme Cost of item (currency or barter) * @param loyalLevel Loyalty level needed to buy item - * @param price Price of offer * @param sellInOnePiece Set StackObjectsCount to 1 * @returns IRagfairOffer */ - protected createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; + protected createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, sellInOnePiece?: boolean): IRagfairOffer; /** * Calculate the offer price that's listed on the flea listing * @param offerRequirements barter requirements for offer * @returns rouble cost of offer */ - protected calculateOfferListingPrice(offerRequirements: OfferRequirement[]): number; + protected convertOfferRequirementsIntoRoubles(offerRequirements: OfferRequirement[]): number; /** * Get avatar url from trader table in db * @param isTrader Is user we're getting avatar for a trader @@ -137,7 +135,7 @@ export declare class RagfairOfferGenerator { * @param itemDetails raw db item details * @returns Item array */ - protected createSingleOfferForItem(items: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; + protected createSingleOfferForItem(items: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; /** * Generate trader offers on flea using the traders assort data * @param traderID Trader to generate offers for @@ -151,7 +149,7 @@ export declare class RagfairOfferGenerator { * @param itemDetails db details of first item * @returns */ - protected getItemCondition(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): Item[]; + protected randomiseItemUpdProperties(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): Item[]; /** * Get the relevant condition id if item tpl matches in ragfair.json/condition * @param tpl Item to look for matching condition object @@ -184,7 +182,7 @@ export declare class RagfairOfferGenerator { * @param offerItems Items for sale in offer * @returns Barter scheme */ - protected createBarterRequirement(offerItems: Item[]): IBarterScheme[]; + protected createBarterBarterScheme(offerItems: Item[]): IBarterScheme[]; /** * Get an array of flea prices + item tpl, cached in generator class inside `allowedFleaPriceItemsForBarter` * @returns array with tpl/price values @@ -196,7 +194,9 @@ export declare class RagfairOfferGenerator { /** * Create a random currency-based barter scheme for an array of items * @param offerItems Items on offer + * @param isPackOffer Is the barter scheme being created for a pack offer + * @param multipler What to multiply the resulting price by * @returns Barter scheme for offer */ - protected createCurrencyRequirement(offerItems: Item[]): IBarterScheme[]; + protected createCurrencyBarterScheme(offerItems: Item[], isPackOffer: boolean, multipler?: number): IBarterScheme[]; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/generators/ScavCaseRewardGenerator.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/generators/ScavCaseRewardGenerator.d.ts index 4ba1888..b5935d0 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/generators/ScavCaseRewardGenerator.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/generators/ScavCaseRewardGenerator.d.ts @@ -25,6 +25,8 @@ export declare class ScavCaseRewardGenerator { protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected scavCaseConfig: IScavCaseConfig; + protected dbItemsCache: ITemplateItem[]; + protected dbAmmoItemsCache: ITemplateItem[]; constructor(logger: ILogger, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * Create an array of rewards that will be given to the player upon completing their scav case build @@ -33,10 +35,10 @@ export declare class ScavCaseRewardGenerator { */ generate(recipeId: string): Product[]; /** - * Get all db items that are not blacklisted in scavcase config - * @returns filtered array of db items + * Get all db items that are not blacklisted in scavcase config or global blacklist + * Store in class field */ - protected getDbItems(): ITemplateItem[]; + protected cacheDbItems(): void; /** * Pick a number of items to be rewards, the count is defined by the values in * @param items item pool to pick rewards from diff --git a/TypeScript/17AsyncImporterWithDependency1/types/generators/WeatherGenerator.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/generators/WeatherGenerator.d.ts index 2e2403c..6471bb1 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/generators/WeatherGenerator.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/generators/WeatherGenerator.d.ts @@ -52,6 +52,7 @@ export declare class WeatherGenerator { */ protected setCurrentDateTime(weather: IWeather): void; protected getWeightedWindDirection(): WindDirection; + protected getWeightedClouds(): number; protected getWeightedWindSpeed(): number; protected getWeightedFog(): number; protected getWeightedRain(): number; diff --git a/TypeScript/17AsyncImporterWithDependency1/types/helpers/HealthHelper.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/helpers/HealthHelper.d.ts index 3694a6e..e4cdcd6 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/helpers/HealthHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/helpers/HealthHelper.d.ts @@ -27,6 +27,7 @@ export declare class HealthHelper { * @param request Heal request * @param sessionID Session id * @param addEffects Should effects be added or removed (default - add) + * @param deleteExistingEffects Should all prior effects be removed before apply new ones */ saveVitality(pmcData: IPmcData, request: ISyncHealthRequestData, sessionID: string, addEffects?: boolean, deleteExistingEffects?: boolean): void; /** diff --git a/TypeScript/17AsyncImporterWithDependency1/types/helpers/InRaidHelper.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/helpers/InRaidHelper.d.ts index bf584c2..b4c0c1c 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/helpers/InRaidHelper.d.ts @@ -53,7 +53,7 @@ export declare class InRaidHelper { * @param victim Who was killed by player * @returns a numerical standing gain or loss */ - protected getStandingChangeForKill(victim: Victim): number; + protected getFenceStandingChangeForKillAsScav(victim: Victim): number; /** * Reset a profile to a baseline, used post-raid * Reset points earned during session property diff --git a/TypeScript/17AsyncImporterWithDependency1/types/helpers/ItemHelper.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/helpers/ItemHelper.d.ts index 99fca56..00f190f 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/helpers/ItemHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/helpers/ItemHelper.d.ts @@ -26,6 +26,7 @@ declare class ItemHelper { protected itemBaseClassService: ItemBaseClassService; protected localisationService: LocalisationService; protected localeService: LocaleService; + protected readonly defaultInvalidBaseTypes: string[]; constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, localisationService: LocalisationService, localeService: LocaleService); /** * Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash @@ -67,6 +68,11 @@ declare class ItemHelper { * @returns Price in roubles (undefined if not found) */ getDynamicItemPrice(tpl: string): number; + /** + * Update items upd.StackObjectsCount to be 1 if its upd is missing or StackObjectsCount is undefined + * @param item Item to update + * @returns Fixed item + */ fixItemStackCount(item: Item): Item; /** * AmmoBoxes contain StackSlots which need to be filled for the AmmoBox to have content. @@ -125,19 +131,19 @@ declare class ItemHelper { getItemQualityModifier(item: Item): number; /** * Get a quality value based on a repairable items (weapon/armor) current state between current and max durability - * @param itemDetails - * @param repairable repairable object - * @param item - * @returns a number between 0 and 1 + * @param itemDetails Db details for item we want quality value for + * @param repairable Repairable properties + * @param item Item quality value is for + * @returns A number between 0 and 1 */ protected getRepairableItemQualityValue(itemDetails: ITemplateItem, repairable: Repairable, item: Item): number; /** * Recursive function that looks at every item from parameter and gets their childrens Ids + includes parent item in results - * @param items - * @param itemID + * @param items Array of items (item + possible children) + * @param itemId Parent items id * @returns an array of strings */ - findAndReturnChildrenByItems(items: Item[], itemID: string): string[]; + findAndReturnChildrenByItems(items: Item[], itemId: string): string[]; /** * A variant of findAndReturnChildren where the output is list of item objects instead of their ids. * @param items @@ -164,12 +170,6 @@ declare class ItemHelper { * @returns true if it is a dogtag */ isDogtag(tpl: string): boolean; - /** - * Can the item passed in be sold to a trader because it is raw money - * @param tpl Item template id to check - * @returns true if unsellable - */ - isNotSellable(tpl: string): boolean; /** * Gets the identifier for a child using slotId, locationX and locationY. * @param item @@ -183,19 +183,19 @@ declare class ItemHelper { */ isItemTplStackable(tpl: string): boolean; /** - * split item stack if it exceeds its StackMaxSize property - * @param itemToSplit item being split into smaller stacks + * split item stack if it exceeds its items StackMaxSize property + * @param itemToSplit Item to split into smaller stacks * @returns Array of split items */ splitStack(itemToSplit: Item): Item[]; /** - * Find Barter items in the inventory + * Find Barter items from array of items * @param {string} by tpl or id - * @param {Object} pmcData + * @param {Item[]} items Array of items to iterate over * @param {string} barterItemId * @returns Array of Item objects */ - findBarterItems(by: "tpl" | "id", pmcData: IPmcData, barterItemId: string): Item[]; + findBarterItems(by: "tpl" | "id", items: Item[], barterItemId: string): Item[]; /** * Regenerate all guids with new ids, exceptions are for items that cannot be altered (e.g. stash/sorting table) * @param pmcData Player profile @@ -262,10 +262,21 @@ declare class ItemHelper { * @param minSizePercent % the magazine must be filled to */ fillMagazineWithCartridge(magazine: Item[], magTemplate: ITemplateItem, cartridgeTpl: string, minSizePercent?: number): void; + /** + * Choose a random bullet type from the list of possible a magazine has + * @param magTemplate Magazine template from Db + * @returns Tpl of cartridge + */ protected getRandomValidCaliber(magTemplate: ITemplateItem): string; + /** + * Chose a randomly weighted cartridge that fits + * @param caliber Desired caliber + * @param staticAmmoDist Cartridges and thier weights + * @returns Tpl of cartrdige + */ protected drawAmmoTpl(caliber: string, staticAmmoDist: Record): string; /** - * + * Create a basic cartrige object * @param parentId container cartridges will be placed in * @param ammoTpl Cartridge to insert * @param stackCount Count of cartridges inside parent diff --git a/TypeScript/17AsyncImporterWithDependency1/types/helpers/QuestHelper.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/helpers/QuestHelper.d.ts index e04b6e0..5c749d3 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/helpers/QuestHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/helpers/QuestHelper.d.ts @@ -21,6 +21,7 @@ import { DialogueHelper } from "./DialogueHelper"; import { ItemHelper } from "./ItemHelper"; import { PaymentHelper } from "./PaymentHelper"; import { ProfileHelper } from "./ProfileHelper"; +import { QuestConditionHelper } from "./QuestConditionHelper"; import { RagfairServerHelper } from "./RagfairServerHelper"; import { TraderHelper } from "./TraderHelper"; export declare class QuestHelper { @@ -29,6 +30,7 @@ export declare class QuestHelper { protected timeUtil: TimeUtil; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; + protected questConditionHelper: QuestConditionHelper; protected eventOutputHolder: EventOutputHolder; protected databaseServer: DatabaseServer; protected localeService: LocaleService; @@ -41,7 +43,7 @@ export declare class QuestHelper { protected mailSendService: MailSendService; protected configServer: ConfigServer; 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, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, questConditionHelper: QuestConditionHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, mailSendService: MailSendService, configServer: ConfigServer); /** * Get status of a quest in player profile by its id * @param pmcData Profile to search @@ -119,7 +121,7 @@ export declare class QuestHelper { * @param sessionID Session id * @returns Quests accessible to player incuding newly unlocked quests now quest (startedQuestId) was started */ - acceptedUnlocked(startedQuestId: string, sessionID: string): IQuest[]; + getNewlyAccessibleQuestsWhenStartingQuest(startedQuestId: string, sessionID: string): IQuest[]; /** * Get quests that can be shown to player after failing a quest * @param failedQuestId Id of the quest failed by player diff --git a/TypeScript/17AsyncImporterWithDependency1/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/helpers/RagfairOfferHelper.d.ts index de9d550..0699259 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/helpers/RagfairOfferHelper.d.ts @@ -1,4 +1,5 @@ import { IPmcData } from "../models/eft/common/IPmcData"; +import { Item } from "../models/eft/common/tables/IItem"; import { ITraderAssort } from "../models/eft/common/tables/ITrader"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; @@ -13,10 +14,10 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { LocaleService } from "../services/LocaleService"; import { LocalisationService } from "../services/LocalisationService"; +import { MailSendService } from "../services/MailSendService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { HashUtil } from "../utils/HashUtil"; import { TimeUtil } from "../utils/TimeUtil"; -import { DialogueHelper } from "./DialogueHelper"; import { ItemHelper } from "./ItemHelper"; import { PaymentHelper } from "./PaymentHelper"; import { PresetHelper } from "./PresetHelper"; @@ -33,7 +34,6 @@ export declare class RagfairOfferHelper { protected databaseServer: DatabaseServer; protected traderHelper: TraderHelper; protected saveServer: SaveServer; - protected dialogueHelper: DialogueHelper; protected itemHelper: ItemHelper; protected paymentHelper: PaymentHelper; protected presetHelper: PresetHelper; @@ -44,11 +44,12 @@ export declare class RagfairOfferHelper { protected ragfairOfferService: RagfairOfferService; protected localeService: LocaleService; protected localisationService: LocalisationService; + protected mailSendService: MailSendService; protected configServer: ConfigServer; protected static goodSoldTemplate: string; protected ragfairConfig: IRagfairConfig; 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, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, localisationService: LocalisationService, mailSendService: MailSendService, configServer: ConfigServer); /** * Passthrough to ragfairOfferService.getOffers(), get flea offers a player should see * @param searchRequest Data from client @@ -119,19 +120,26 @@ export declare class RagfairOfferHelper { */ protected getProfileOffers(sessionID: string): IRagfairOffer[]; /** - * Delete an offer from a desired profile + * Delete an offer from a desired profile and from ragfair offers * @param sessionID Session id of profile to delete offer from - * @param offerId Offer id to delete + * @param offerId Id of offer to delete */ - protected deleteOfferByOfferId(sessionID: string, offerId: string): void; + protected deleteOfferById(sessionID: string, offerId: string): void; /** * Complete the selling of players' offer * @param sessionID Session id * @param offer Sold offer details * @param boughtAmount Amount item was purchased for - * @returns Client response + * @returns IItemEventRouterResponse */ protected completeOffer(sessionID: string, offer: IRagfairOffer, boughtAmount: number): IItemEventRouterResponse; + /** + * Get a localised message for when players offer has sold on flea + * @param itemTpl Item sold + * @param boughtAmount How many were purchased + * @returns Localised message text + */ + protected getLocalisedOfferSoldMessage(itemTpl: string, boughtAmount: number): string; /** * Should a ragfair offer be visible to the player * @param searchRequest Search request @@ -142,4 +150,12 @@ export declare class RagfairOfferHelper { * @returns True = should be shown to player */ isDisplayableOffer(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, offer: IRagfairOffer, pmcProfile: IPmcData): boolean; + /** + * Is items quality value within desired range + * @param item Item to check quality of + * @param min Desired minimum quality + * @param max Desired maximum quality + * @returns True if in range + */ + protected itemQualityInRange(item: Item, min: number, max: number): boolean; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/helpers/RagfairSellHelper.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/helpers/RagfairSellHelper.d.ts index 251d7ca..913b408 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/helpers/RagfairSellHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/helpers/RagfairSellHelper.d.ts @@ -13,12 +13,12 @@ export declare class RagfairSellHelper { constructor(logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, configServer: ConfigServer); /** * Get the percent chance to sell an item based on its average listed price vs player chosen listing price - * @param baseChancePercent Base chance to sell item * @param averageOfferPriceRub Price of average offer in roubles * @param playerListedPriceRub Price player listed item for in roubles + * @param qualityMultiplier Quality multipler of item being sold * @returns percent value */ - calculateSellChance(baseChancePercent: number, averageOfferPriceRub: number, playerListedPriceRub: number): number; + calculateSellChance(averageOfferPriceRub: number, playerListedPriceRub: number, qualityMultiplier: number): number; /** * Get percent chance to sell an item when price is below items average listing price * @param playerListedPriceRub Price player listed item for in roubles diff --git a/TypeScript/17AsyncImporterWithDependency1/types/helpers/TraderHelper.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/helpers/TraderHelper.d.ts index c163f7a..6680ccf 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/helpers/TraderHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/helpers/TraderHelper.d.ts @@ -35,7 +35,7 @@ export declare class TraderHelper { protected highestTraderBuyPriceItems: Record; constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, handbookHelper: HandbookHelper, itemHelper: ItemHelper, playerService: PlayerService, localisationService: LocalisationService, fenceService: FenceService, timeUtil: TimeUtil, randomUtil: RandomUtil, configServer: ConfigServer); getTrader(traderID: string, sessionID: string): ITraderBase; - getTraderAssortsById(traderId: string): ITraderAssort; + getTraderAssortsByTraderId(traderId: string): ITraderAssort; /** * 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 diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/common/tables/IBotBase.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/common/tables/IBotBase.d.ts index ee40958..6c7b76f 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/common/tables/IBotBase.d.ts @@ -281,7 +281,7 @@ export interface InsuredItem { export interface Hideout { Production: Record; Areas: HideoutArea[]; - Improvements: Record; + Improvement: Record; Seed: number; sptUpdateLastRunTimestamp: number; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/health/IHealthTreatmentRequestData.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/health/IHealthTreatmentRequestData.d.ts index 7fb80a8..598e60c 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/health/IHealthTreatmentRequestData.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/health/IHealthTreatmentRequestData.d.ts @@ -1,12 +1,14 @@ export interface IHealthTreatmentRequestData { Action: "RestoreHealth"; trader: string; - items: Item[]; + items: Cost[]; difference: Difference; timestamp: number; } -export interface Item { +export interface Cost { + /** Id of stack to take money from */ id: string; + /** Amount of money to take off player for treatment */ count: number; } export interface Difference { @@ -25,5 +27,6 @@ export interface BodyParts { } export interface BodyPart { Health: number; + /** Effects in array are to be removed */ Effects: string[]; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/notifier/INotifier.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/notifier/INotifier.d.ts index ce25dee..c6c6979 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/notifier/INotifier.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/notifier/INotifier.d.ts @@ -14,6 +14,11 @@ export interface INotification { } export declare enum NotificationType { RAGFAIR_OFFER_SOLD = "RagfairOfferSold", + RAGFAIR_RATING_CHANGE = "RagfairRatingChange", + /** ChatMessageReceived */ NEW_MESSAGE = "new_message", - PING = "ping" + PING = "ping", + TRADER_SUPPLY = "TraderSupply", + TRADER_STANDING = "TraderStanding", + UNLOCK_TRADER = "UnlockTrader" } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/notifier/ISelectProfileResponse.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/notifier/ISelectProfileResponse.d.ts index ecb668a..f2d6be7 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/eft/notifier/ISelectProfileResponse.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/eft/notifier/ISelectProfileResponse.d.ts @@ -1,6 +1,3 @@ -import { INotifierChannel } from "./INotifier"; export interface ISelectProfileResponse { status: string; - notifier: INotifierChannel; - notifierServer: string; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/enums/WeatherType.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/enums/WeatherType.d.ts index d31fefe..503dc30 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/enums/WeatherType.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/enums/WeatherType.d.ts @@ -1,19 +1,19 @@ export declare enum WeatherType { - CLEAR_DAY = 1, - CLEAR_WIND = 2, - CLEAR_NIGHT = 3, - PARTLY_CLOUD_DAY = 4, - PARTLY_CLOUD_NIGHT = 5, - CLEAR_FOG_DAY = 6, - CLEAR_FOG_NIGHT = 7, - CLOUDFOG = 8, - FOG = 9, - MOSTLY_CLOUD = 10, - LIGHT_RAIN = 11, - RAIN = 12, - CLOUD_WIND = 13, - CLOUD_WIND_RAIN = 14, - FULL_CLOUD = 15, - THUNDER_CLOUD = 16, - NONE = 0 + CLEAR_DAY = 0, + CLEAR_WIND = 1, + CLEAR_NIGHT = 2, + PARTLY_CLOUD_DAY = 3, + PARTLY_CLOUD_NIGHT = 4, + CLEAR_FOG_DAY = 5, + CLEAR_FOG_NIGHT = 6, + CLOUD_FOG = 7, + FOG = 8, + MOSTLY_CLOUD = 9, + LIGHT_RAIN = 10, + RAIN = 11, + CLOUD_WIND = 12, + CLOUD_WIND_RAIN = 13, + FULL_CLOUD = 14, + THUNDER_CLOUD = 15, + NONE = 16 } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IRagfairConfig.d.ts index 7c04857..7aea24f 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IRagfairConfig.d.ts @@ -41,7 +41,8 @@ export interface Dynamic { /** Use the highest trader price for an offer if its greater than the price in templates/prices.json */ useTraderPriceForOffersIfHigher: boolean; /** Barter offer specific settings */ - barter: Barter; + barter: IBarterDetails; + pack: IPackDetails; /** Dynamic offer price below handbook adjustment values */ offerAdjustment: OfferAdjustment; /** How many offers should expire before an offer regeneration occurs */ @@ -49,9 +50,7 @@ export interface Dynamic { /** How many offers should be listed */ offerItemCount: MinMax; /** How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) */ - price: MinMax; - /** How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) */ - presetPrice: MinMax; + priceRanges: IPriceRanges; /** Should default presets to listed only or should non-standard presets found in globals.json be listed too */ showDefaultPresetsOnly: boolean; endTimeSeconds: MinMax; @@ -74,7 +73,12 @@ export interface Dynamic { /** Dict of price limits keyed by item type */ unreasonableModPrices: Record; } -export interface Barter { +export interface IPriceRanges { + default: MinMax; + preset: MinMax; + pack: MinMax; +} +export interface IBarterDetails { /** Should barter offers be generated */ enable: boolean; /** Percentage change an offer is listed as a barter */ @@ -90,6 +94,18 @@ export interface Barter { /** Item Tpls to never be turned into a barter */ itemTypeBlacklist: string[]; } +export interface IPackDetails { + /** Should pack offers be generated */ + enable: boolean; + /** Percentage change an offer is listed as a pack */ + chancePercent: number; + /** Min number of required items for a pack */ + itemCountMin: number; + /** Max number of required items for a pack */ + itemCountMax: number; + /** item types to allow being a pack */ + itemTypeWhitelist: string[]; +} export interface OfferAdjustment { /** Shuld offer price be adjusted when below handbook price */ adjustPriceWhenBelowHandbookPrice: boolean; diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IWeatherConfig.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IWeatherConfig.d.ts index 41a1c83..6ecf35b 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IWeatherConfig.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IWeatherConfig.d.ts @@ -7,7 +7,7 @@ export interface IWeatherConfig extends IBaseConfig { weather: Weather; } export interface Weather { - clouds: MinMax; + clouds: WeatherSettings; windSpeed: WeatherSettings; windDirection: WeatherSettings; windGustiness: MinMax; diff --git a/TypeScript/17AsyncImporterWithDependency1/types/services/HashCacheService.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/services/HashCacheService.d.ts index 5320f28..9968478 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/services/HashCacheService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/services/HashCacheService.d.ts @@ -11,7 +11,18 @@ export declare class HashCacheService { protected modHashes: any; protected readonly modCachePath = "./user/cache/modCache.json"; constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); + /** + * Return a stored hash by key + * @param modName Name of mod to get hash for + * @returns Mod hash + */ getStoredModHash(modName: string): string; + /** + * Does the generated hash match the stored hash + * @param modName name of mod + * @param modContent + * @returns True if they match + */ modContentMatchesStoredHash(modName: string, modContent: string): boolean; hashMatchesStoredHash(modName: string, modHash: string): boolean; storeModContent(modName: string, modContent: string): void; diff --git a/TypeScript/17AsyncImporterWithDependency1/types/services/MailSendService.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/services/MailSendService.d.ts index 19397dc..fe4a7fe 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/services/MailSendService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/services/MailSendService.d.ts @@ -35,7 +35,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendDirectNpcMessageToPlayer(playerId: string, sender: Traders, messageType: MessageType, message: string, items?: Item[], maxStorageTimeSeconds?: any): void; + sendDirectNpcMessageToPlayer(playerId: string, sender: Traders, messageType: MessageType, message: string, items?: Item[], maxStorageTimeSeconds?: any, systemData?: any, ragfair?: any): void; /** * Send a message from an NPC (e.g. prapor) to the player with or without items * @param playerId Players id to send message to @@ -45,7 +45,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendLocalisedNpcMessageToPlayer(playerId: string, sender: Traders, messageType: MessageType, messageLocaleId: string, items?: Item[], maxStorageTimeSeconds?: any, systemData?: any): void; + sendLocalisedNpcMessageToPlayer(playerId: string, sender: Traders, messageType: MessageType, messageLocaleId: string, items?: Item[], maxStorageTimeSeconds?: any, systemData?: any, ragfair?: any): void; /** * Send a message from SYSTEM to the player with or without items * @param playerId Players id to send message to diff --git a/TypeScript/17AsyncImporterWithDependency1/types/services/MatchBotDetailsCacheService.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/services/MatchBotDetailsCacheService.d.ts index eb365dd..c1bd322 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/services/MatchBotDetailsCacheService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/services/MatchBotDetailsCacheService.d.ts @@ -1,7 +1,7 @@ import { IBotBase } from "../models/eft/common/tables/IBotBase"; import { ILogger } from "../models/spt/utils/ILogger"; import { LocalisationService } from "./LocalisationService"; -/** Cache bots in a dictionary, keyed by the bots name, keying by name isnt idea as its not unique but this is used by the post-raid system which doesnt have any bot ids, only name */ +/** Cache bots in a dictionary, keyed by the bots name, keying by name isnt ideal as its not unique but this is used by the post-raid system which doesnt have any bot ids, only name */ export declare class MatchBotDetailsCacheService { protected logger: ILogger; protected localisationService: LocalisationService; @@ -17,9 +17,9 @@ export declare class MatchBotDetailsCacheService { */ clearCache(): void; /** - * Find a bot in the cache by its name + * Find a bot in the cache by its name and side * @param botName Name of bot to find * @returns Bot details */ - getBotByName(botName: string): IBotBase; + getBotByNameAndSide(botName: string, botSide: string): IBotBase; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/services/ModCompilerService.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/services/ModCompilerService.d.ts index a4bf3c8..e306177 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/services/ModCompilerService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/services/ModCompilerService.d.ts @@ -1,14 +1,36 @@ import { CompilerOptions } from "typescript"; import type { ILogger } from "../models/spt/utils/ILogger"; -import { HashCacheService } from "./HashCacheService"; import { VFS } from "../utils/VFS"; +import { HashCacheService } from "./HashCacheService"; export declare class ModCompilerService { protected logger: ILogger; protected hashCacheService: HashCacheService; protected vfs: VFS; constructor(logger: ILogger, hashCacheService: HashCacheService, vfs: VFS); + /** + * Convert a mods TS into JS + * @param modName Name of mod + * @param modPath Dir path to mod + * @param modTypeScriptFiles + * @returns + */ compileMod(modName: string, modPath: string, modTypeScriptFiles: string[]): Promise; + /** + * Convert a TS file into JS + * @param fileNames Paths to TS files + * @param options Compiler options + */ protected compile(fileNames: string[], options: CompilerOptions): Promise; + /** + * Do the files at the provided paths exist + * @param fileNames + * @returns + */ protected areFilesReady(fileNames: string[]): boolean; + /** + * Wait the provided number of milliseconds + * @param ms Milliseconds + * @returns + */ protected delay(ms: number): Promise; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/services/PaymentService.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/services/PaymentService.d.ts index 1c9c32b..fb5f92c 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/services/PaymentService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/services/PaymentService.d.ts @@ -61,23 +61,26 @@ export declare class PaymentService { * Get all money stacks in inventory and prioritse items in stash * @param pmcData * @param currencyTpl + * @param playerStashId Players stash id * @returns Sorting money items */ - protected getSortedMoneyItemsInInventory(pmcData: IPmcData, currencyTpl: string): Item[]; + protected getSortedMoneyItemsInInventory(pmcData: IPmcData, currencyTpl: string, playerStashId: string): Item[]; /** * Prioritise player stash first over player inventory * Post-raid healing would often take money out of the players pockets/secure container * @param a First money stack item * @param b Second money stack item * @param inventoryItems players inventory items + * @param playerStashId Players stash id * @returns sort order */ - protected prioritiseStashSort(a: Item, b: Item, inventoryItems: Item[]): number; + protected prioritiseStashSort(a: Item, b: Item, inventoryItems: Item[], playerStashId: string): number; /** * Recursivly check items parents to see if it is inside the players inventory, not stash * @param itemId item id to check * @param inventoryItems player inventory + * @param playerStashId Players stash id * @returns true if its in inventory */ - protected isInInventory(itemId: string, inventoryItems: Item[]): boolean; + protected isInStash(itemId: string, inventoryItems: Item[], playerStashId: string): boolean; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/services/ProfileFixerService.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/services/ProfileFixerService.d.ts index c8232fc..bc1e42e 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/services/ProfileFixerService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/services/ProfileFixerService.d.ts @@ -14,6 +14,7 @@ import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; import { Watermark } from "../utils/Watermark"; import { LocalisationService } from "./LocalisationService"; @@ -27,17 +28,19 @@ export declare class ProfileFixerService { protected itemHelper: ItemHelper; protected localisationService: LocalisationService; protected timeUtil: TimeUtil; + protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, profileHelper: ProfileHelper, itemHelper: ItemHelper, localisationService: LocalisationService, timeUtil: TimeUtil, databaseServer: DatabaseServer, configServer: ConfigServer); + constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, profileHelper: ProfileHelper, itemHelper: ItemHelper, localisationService: LocalisationService, timeUtil: TimeUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, configServer: ConfigServer); /** * 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; protected addMissingGunStandContainerImprovements(pmcProfile: IPmcData): void; + protected ensureGunStandLevelsMatch(pmcProfile: IPmcData): void; protected addHideoutAreaStashes(pmcProfile: IPmcData): void; protected addMissingHideoutWallAreas(pmcProfile: IPmcData): void; protected adjustUnreasonableModFleaPrices(): void; @@ -131,4 +134,9 @@ export declare class ProfileFixerService { * @param pmcProfile Profile to add missing IDs to */ addMissingIdsToBonuses(pmcProfile: IPmcData): void; + /** + * At some point the property name was changed,migrate data across to new name + * @param pmcProfile + */ + protected migrateImprovements(pmcProfile: IPmcData): void; } diff --git a/TypeScript/17AsyncImporterWithDependency1/types/services/RagfairPriceService.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/services/RagfairPriceService.d.ts index e245efa..ff35327 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/services/RagfairPriceService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/services/RagfairPriceService.d.ts @@ -3,6 +3,7 @@ import { HandbookHelper } from "../helpers/HandbookHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { TraderHelper } from "../helpers/TraderHelper"; +import { MinMax } from "../models/common/MinMax"; import { IPreset } from "../models/eft/common/IGlobals"; import { Item } from "../models/eft/common/tables/IItem"; import { IBarterScheme } from "../models/eft/common/tables/ITrader"; @@ -35,10 +36,6 @@ export declare class RagfairPriceService implements OnLoad { * Generate static (handbook) and dynamic (prices.json) flea prices, store inside class as dictionaries */ onLoad(): Promise; - /** - * Add placeholder values for items missing from handbook - */ - protected addMissingHandbookPrices(): void; getRoute(): string; /** * Iterate over all items of type "Item" in db and get template price, store in cache @@ -91,9 +88,17 @@ export declare class RagfairPriceService implements OnLoad { * Generate a currency cost for an item and its mods * @param items Item with mods to get price for * @param desiredCurrency Currency price desired in + * @param isPackOffer Price is for a pack type offer * @returns cost of item in desired currency */ - getDynamicOfferPrice(items: Item[], desiredCurrency: string): number; + getDynamicOfferPriceForOffer(items: Item[], desiredCurrency: string, isPackOffer: boolean): number; + /** + * Get different min/max price multipliers for different offer types (preset/pack/default) + * @param isPreset Offer is a preset + * @param isPack Offer is a pack + * @returns MinMax values + */ + protected getOfferTypeRangeValues(isPreset: boolean, isPack: boolean): MinMax; /** * Check to see if an items price is below its handbook price and adjust accoring to values set to config/ragfair.json * @param itemPrice price of item @@ -104,10 +109,10 @@ export declare class RagfairPriceService implements OnLoad { /** * Multiply the price by a randomised curve where n = 2, shift = 2 * @param existingPrice price to alter - * @param isPreset is the item we're multiplying a preset + * @param rangeValues min and max to adjust price by * @returns multiplied price */ - protected randomisePrice(existingPrice: number, isPreset: boolean): number; + protected randomiseOfferPrice(existingPrice: number, rangeValues: MinMax): number; /** * Calculate the cost of a weapon preset by adding together the price of its mods + base price of default weapon preset * @param item base weapon diff --git a/TypeScript/17AsyncImporterWithDependency2/types/callbacks/GameCallbacks.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/callbacks/GameCallbacks.d.ts index aa80036..46f79f9 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/callbacks/GameCallbacks.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/callbacks/GameCallbacks.d.ts @@ -1,4 +1,5 @@ import { GameController } from "../controllers/GameController"; +import { OnLoad } from "../di/OnLoad"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { ICheckVersionResponse } from "../models/eft/game/ICheckVersionResponse"; import { ICurrentGroupResponse } from "../models/eft/game/ICurrentGroupResponse"; @@ -15,12 +16,14 @@ import { INullResponseData } from "../models/eft/httpResponse/INullResponseData" import { SaveServer } from "../servers/SaveServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { Watermark } from "../utils/Watermark"; -declare class GameCallbacks { +declare class GameCallbacks implements OnLoad { protected httpResponse: HttpResponseUtil; protected watermark: Watermark; protected saveServer: SaveServer; protected gameController: GameController; constructor(httpResponse: HttpResponseUtil, watermark: Watermark, saveServer: SaveServer, gameController: GameController); + onLoad(): Promise; + getRoute(): string; /** * Handle client/game/version/validate * @returns INullResponseData diff --git a/TypeScript/17AsyncImporterWithDependency2/types/controllers/GameController.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/controllers/GameController.d.ts index 04e3abb..e88610e 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/controllers/GameController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/controllers/GameController.d.ts @@ -61,13 +61,14 @@ export declare class GameController { protected pmcConfig: IPmcConfig; protected lootConfig: ILootConfig; constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, randomUtil: RandomUtil, encodingUtil: EncodingUtil, hideoutHelper: HideoutHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, seasonalEventService: SeasonalEventService, itemBaseClassService: ItemBaseClassService, giftService: GiftService, applicationContext: ApplicationContext, configServer: ConfigServer); + load(): void; /** * Handle client/game/start */ gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; protected addCustomLooseLootPositions(): void; protected adjustLooseLootSpawnProbabilities(): void; - protected setHideoutAreasAndCraftsTo30Secs(): void; + protected setHideoutAreasAndCraftsTo40Secs(): void; /** * 3.7.0 moved AIDs to be numeric, old profiles need to be migrated * We store the old AID value in new field `sessionId` diff --git a/TypeScript/17AsyncImporterWithDependency2/types/controllers/HealthController.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/controllers/HealthController.d.ts index 1938297..2d7ff09 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/controllers/HealthController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/controllers/HealthController.d.ts @@ -29,34 +29,35 @@ export declare class HealthController { * stores in-raid player health * @param pmcData Player profile * @param info Request data - * @param sessionID + * @param sessionID Player id * @param addEffects Should effects found be added or removed from profile + * @param deleteExistingEffects Should all prior effects be removed before apply new ones */ saveVitality(pmcData: IPmcData, info: ISyncHealthRequestData, sessionID: string, addEffects?: boolean, deleteExistingEffects?: boolean): void; /** * When healing in menu - * @param pmcData - * @param body - * @param sessionID - * @returns + * @param pmcData Player profile + * @param request Healing request + * @param sessionID Player id + * @returns IItemEventRouterResponse */ - offraidHeal(pmcData: IPmcData, body: IOffraidHealRequestData, sessionID: string): IItemEventRouterResponse; + offraidHeal(pmcData: IPmcData, request: IOffraidHealRequestData, sessionID: string): IItemEventRouterResponse; /** * Handle Eat event * Consume food/water outside of a raid * @param pmcData Player profile - * @param body request Object + * @param request Eat request * @param sessionID Session id * @returns IItemEventRouterResponse */ - offraidEat(pmcData: IPmcData, body: IOffraidEatRequestData, sessionID: string): IItemEventRouterResponse; + offraidEat(pmcData: IPmcData, request: IOffraidEatRequestData, sessionID: string): IItemEventRouterResponse; /** * Handle RestoreHealth event * Occurs on post-raid healing page * @param pmcData player profile * @param healthTreatmentRequest Request data from client * @param sessionID Session id - * @returns + * @returns IItemEventRouterResponse */ healthTreatment(pmcData: IPmcData, healthTreatmentRequest: IHealthTreatmentRequestData, sessionID: string): IItemEventRouterResponse; /** @@ -66,12 +67,4 @@ export declare class HealthController { * @param sessionID */ applyWorkoutChanges(pmcData: IPmcData, info: IWorkoutData, sessionId: string): void; - /** - * Iterate over treatment request diff and find effects to remove from player limbs - * @param sessionId - * @param profile Profile to update - * @param treatmentRequest client request - * @param output response to send to client - */ - protected removeEffectsAfterPostRaidHeal(sessionId: string, profile: IPmcData, treatmentRequest: IHealthTreatmentRequestData, output: IItemEventRouterResponse): void; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/controllers/HideoutController.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/controllers/HideoutController.d.ts index 877c076..a90a16d 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/controllers/HideoutController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/controllers/HideoutController.d.ts @@ -88,11 +88,11 @@ export declare class HideoutController { * @param pmcData Profile to edit * @param output Object to send back to client * @param sessionID Session/player id - * @param profileHideoutArea Current hideout data for profile + * @param profileParentHideoutArea Current hideout area for profile * @param dbHideoutArea Hideout area being upgraded * @param hideoutStage Stage hideout area is being upgraded to */ - protected addContainerImprovementToProfile(output: IItemEventRouterResponse, sessionID: string, pmcData: IPmcData, profileHideoutArea: HideoutArea, dbHideoutArea: IHideoutArea, hideoutStage: Stage): void; + protected addContainerImprovementToProfile(output: IItemEventRouterResponse, sessionID: string, pmcData: IPmcData, profileParentHideoutArea: HideoutArea, dbHideoutArea: IHideoutArea, hideoutStage: Stage): void; /** * Add an inventory item to profile from a hideout area stage data * @param pmcData Profile to update diff --git a/TypeScript/17AsyncImporterWithDependency2/types/controllers/LocationController.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/controllers/LocationController.d.ts index 94d496a..94f5fce 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/controllers/LocationController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/controllers/LocationController.d.ts @@ -4,6 +4,7 @@ import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { ILocationBase } from "../models/eft/common/ILocationBase"; import { ILocationsGenerateAllResponse } from "../models/eft/common/ILocationsSourceDestinationBase"; import { IAirdropLootResult } from "../models/eft/location/IAirdropLootResult"; +import { IGetLocationRequestData } from "../models/eft/location/IGetLocationRequestData"; import { AirdropTypeEnum } from "../models/enums/AirdropType"; import { IAirdropConfig } from "../models/spt/config/IAirdropConfig"; import { ILocationConfig } from "../models/spt/config/ILocationConfig"; @@ -34,10 +35,11 @@ export declare class LocationController { /** * Handle client/location/getLocalloot * Get a location (map) with generated loot data - * @param location Map to generate loot for + * @param sessionId Player id + * @param request Map request to generate * @returns ILocationBase */ - get(location: string): ILocationBase; + get(sessionId: string, request: IGetLocationRequestData): ILocationBase; /** * Generate a maps base location with loot * @param name Map name diff --git a/TypeScript/17AsyncImporterWithDependency2/types/controllers/QuestController.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/controllers/QuestController.d.ts index 7d494a6..bd8a70f 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/controllers/QuestController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/controllers/QuestController.d.ts @@ -61,7 +61,7 @@ export declare class QuestController { * @param playerLevel level of player to test against quest * @returns true if quest can be seen/accepted by player of defined level */ - protected playerLevelFulfillsQuestRequrement(quest: IQuest, playerLevel: number): boolean; + protected playerLevelFulfillsQuestRequirement(quest: IQuest, playerLevel: number): boolean; /** * Should a quest be shown to the player in trader quest screen * @param questId Quest to check diff --git a/TypeScript/17AsyncImporterWithDependency2/types/controllers/RagfairController.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/controllers/RagfairController.d.ts index 76c27f7..bda37cd 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/controllers/RagfairController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/controllers/RagfairController.d.ts @@ -21,6 +21,7 @@ import { IGetMarketPriceRequestData } from "../models/eft/ragfair/IGetMarketPric import { IGetOffersResult } from "../models/eft/ragfair/IGetOffersResult"; import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; import { ISearchRequestData } from "../models/eft/ragfair/ISearchRequestData"; +import { IProcessBuyTradeRequestData } from "../models/eft/trade/IProcessBuyTradeRequestData"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; @@ -125,6 +126,18 @@ export declare class RagfairController { * @returns IItemEventRouterResponse */ addPlayerOffer(pmcData: IPmcData, offerRequest: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Charge player a listing fee for using flea, pulls charge from data previously sent by client + * @param sessionID Player id + * @param rootItem Base item being listed (used when client tax cost not found and must be done on server) + * @param pmcData Player profile + * @param requirementsPriceInRub Rouble cost player chose for listing (used when client tax cost not found and must be done on server) + * @param itemStackCount How many items were listed in player (used when client tax cost not found and must be done on server) + * @param offerRequest Add offer request object from client + * @param output IItemEventRouterResponse + * @returns True if charging tax to player failed + */ + protected chargePlayerTaxFee(sessionID: string, rootItem: Item, pmcData: IPmcData, requirementsPriceInRub: number, itemStackCount: number, offerRequest: IAddOfferRequestData, output: IItemEventRouterResponse): boolean; /** * Is the item to be listed on the flea valid * @param offerRequest Client offer request @@ -158,4 +171,11 @@ export declare class RagfairController { */ removeOffer(offerId: string, sessionID: string): IItemEventRouterResponse; extendOffer(info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Create a basic trader request object with price and currency type + * @param currency What currency: RUB, EURO, USD + * @param value Amount of currency + * @returns IProcessBuyTradeRequestData + */ + protected createBuyTradeRequestObject(currency: string, value: number): IProcessBuyTradeRequestData; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/generators/BotEquipmentModGenerator.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/generators/BotEquipmentModGenerator.d.ts index ccbbbbf..f7abb84 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/generators/BotEquipmentModGenerator.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/generators/BotEquipmentModGenerator.d.ts @@ -14,7 +14,6 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; import { BotEquipmentModPoolService } from "../services/BotEquipmentModPoolService"; import { BotModLimits, BotWeaponModLimitService } from "../services/BotWeaponModLimitService"; -import { ItemBaseClassService } from "../services/ItemBaseClassService"; import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; @@ -29,7 +28,6 @@ export declare class BotEquipmentModGenerator { protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; protected botEquipmentFilterService: BotEquipmentFilterService; - protected itemBaseClassService: ItemBaseClassService; protected itemFilterService: ItemFilterService; protected profileHelper: ProfileHelper; protected botWeaponModLimitService: BotWeaponModLimitService; @@ -40,7 +38,7 @@ export declare class BotEquipmentModGenerator { protected botEquipmentModPoolService: BotEquipmentModPoolService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, itemHelper: ItemHelper, botEquipmentFilterService: BotEquipmentFilterService, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponModLimitService: BotWeaponModLimitService, botHelper: BotHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, botEquipmentModPoolService: BotEquipmentModPoolService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, itemHelper: ItemHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponModLimitService: BotWeaponModLimitService, botHelper: BotHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, botEquipmentModPoolService: BotEquipmentModPoolService, configServer: ConfigServer); /** * Check mods are compatible and add to array * @param equipment Equipment item to add mods to diff --git a/TypeScript/17AsyncImporterWithDependency2/types/generators/LocationGenerator.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/generators/LocationGenerator.d.ts index b8169d3..46a514b 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/generators/LocationGenerator.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/generators/LocationGenerator.d.ts @@ -65,10 +65,11 @@ export declare class LocationGenerator { protected getGuaranteedContainers(staticContainersOnMap: IStaticContainerData[]): IStaticContainerData[]; /** * Choose a number of containers based on their probabilty value to fulfil the desired count in containerData.chosenCount + * @param groupId Name of the group the containers are being collected for * @param containerData Containers and probability values for a groupId * @returns List of chosen container Ids */ - protected getContainersByProbabilty(containerData: IContainerGroupCount): string[]; + protected getContainersByProbabilty(groupId: string, containerData: IContainerGroupCount): string[]; /** * Get a mapping of each groupid and the containers in that group + count of containers to spawn on map * @param containersGroups Container group values diff --git a/TypeScript/17AsyncImporterWithDependency2/types/generators/PMCLootGenerator.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/generators/PMCLootGenerator.d.ts index 9acff69..abb5615 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/generators/PMCLootGenerator.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/generators/PMCLootGenerator.d.ts @@ -31,12 +31,12 @@ export declare class PMCLootGenerator { */ generatePMCVestLootPool(): string[]; /** - * Check if item has a width/height that lets it fit into a 1x2/2x1 slot - * 1x1 / 1x2 / 2x1 + * Check if item has a width/height that lets it fit into a 2x2 slot + * 1x1 / 1x2 / 2x1 / 2x2 * @param item Item to check size of * @returns true if it fits */ - protected itemFitsInto1By2Slot(item: ITemplateItem): boolean; + protected itemFitsInto2By2Slot(item: ITemplateItem): boolean; /** * Create an array of loot items a PMC can have in their backpack * @returns string array of tpls diff --git a/TypeScript/17AsyncImporterWithDependency2/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/generators/RagfairOfferGenerator.d.ts index a627191..58e0b68 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/generators/RagfairOfferGenerator.d.ts @@ -55,11 +55,10 @@ export declare class RagfairOfferGenerator { * @param items Items in the offer * @param barterScheme Cost of item (currency or barter) * @param loyalLevel Loyalty level needed to buy item - * @param price Price of offer - * @param sellInOnePiece Set StackObjectsCount to 1 + * @param sellInOnePiece Flags sellInOnePiece to be true * @returns IRagfairOffer */ - createFleaOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; + createFleaOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, sellInOnePiece?: boolean): IRagfairOffer; /** * Create an offer object ready to send to ragfairOfferService.addOffer() * @param userID Owner of the offer @@ -67,17 +66,16 @@ export declare class RagfairOfferGenerator { * @param items Items in the offer * @param barterScheme Cost of item (currency or barter) * @param loyalLevel Loyalty level needed to buy item - * @param price Price of offer * @param sellInOnePiece Set StackObjectsCount to 1 * @returns IRagfairOffer */ - protected createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; + protected createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, sellInOnePiece?: boolean): IRagfairOffer; /** * Calculate the offer price that's listed on the flea listing * @param offerRequirements barter requirements for offer * @returns rouble cost of offer */ - protected calculateOfferListingPrice(offerRequirements: OfferRequirement[]): number; + protected convertOfferRequirementsIntoRoubles(offerRequirements: OfferRequirement[]): number; /** * Get avatar url from trader table in db * @param isTrader Is user we're getting avatar for a trader @@ -137,7 +135,7 @@ export declare class RagfairOfferGenerator { * @param itemDetails raw db item details * @returns Item array */ - protected createSingleOfferForItem(items: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; + protected createSingleOfferForItem(items: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; /** * Generate trader offers on flea using the traders assort data * @param traderID Trader to generate offers for @@ -151,7 +149,7 @@ export declare class RagfairOfferGenerator { * @param itemDetails db details of first item * @returns */ - protected getItemCondition(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): Item[]; + protected randomiseItemUpdProperties(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): Item[]; /** * Get the relevant condition id if item tpl matches in ragfair.json/condition * @param tpl Item to look for matching condition object @@ -184,7 +182,7 @@ export declare class RagfairOfferGenerator { * @param offerItems Items for sale in offer * @returns Barter scheme */ - protected createBarterRequirement(offerItems: Item[]): IBarterScheme[]; + protected createBarterBarterScheme(offerItems: Item[]): IBarterScheme[]; /** * Get an array of flea prices + item tpl, cached in generator class inside `allowedFleaPriceItemsForBarter` * @returns array with tpl/price values @@ -196,7 +194,9 @@ export declare class RagfairOfferGenerator { /** * Create a random currency-based barter scheme for an array of items * @param offerItems Items on offer + * @param isPackOffer Is the barter scheme being created for a pack offer + * @param multipler What to multiply the resulting price by * @returns Barter scheme for offer */ - protected createCurrencyRequirement(offerItems: Item[]): IBarterScheme[]; + protected createCurrencyBarterScheme(offerItems: Item[], isPackOffer: boolean, multipler?: number): IBarterScheme[]; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/generators/ScavCaseRewardGenerator.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/generators/ScavCaseRewardGenerator.d.ts index 4ba1888..b5935d0 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/generators/ScavCaseRewardGenerator.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/generators/ScavCaseRewardGenerator.d.ts @@ -25,6 +25,8 @@ export declare class ScavCaseRewardGenerator { protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected scavCaseConfig: IScavCaseConfig; + protected dbItemsCache: ITemplateItem[]; + protected dbAmmoItemsCache: ITemplateItem[]; constructor(logger: ILogger, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * Create an array of rewards that will be given to the player upon completing their scav case build @@ -33,10 +35,10 @@ export declare class ScavCaseRewardGenerator { */ generate(recipeId: string): Product[]; /** - * Get all db items that are not blacklisted in scavcase config - * @returns filtered array of db items + * Get all db items that are not blacklisted in scavcase config or global blacklist + * Store in class field */ - protected getDbItems(): ITemplateItem[]; + protected cacheDbItems(): void; /** * Pick a number of items to be rewards, the count is defined by the values in * @param items item pool to pick rewards from diff --git a/TypeScript/17AsyncImporterWithDependency2/types/generators/WeatherGenerator.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/generators/WeatherGenerator.d.ts index 2e2403c..6471bb1 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/generators/WeatherGenerator.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/generators/WeatherGenerator.d.ts @@ -52,6 +52,7 @@ export declare class WeatherGenerator { */ protected setCurrentDateTime(weather: IWeather): void; protected getWeightedWindDirection(): WindDirection; + protected getWeightedClouds(): number; protected getWeightedWindSpeed(): number; protected getWeightedFog(): number; protected getWeightedRain(): number; diff --git a/TypeScript/17AsyncImporterWithDependency2/types/helpers/HealthHelper.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/helpers/HealthHelper.d.ts index 3694a6e..e4cdcd6 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/helpers/HealthHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/helpers/HealthHelper.d.ts @@ -27,6 +27,7 @@ export declare class HealthHelper { * @param request Heal request * @param sessionID Session id * @param addEffects Should effects be added or removed (default - add) + * @param deleteExistingEffects Should all prior effects be removed before apply new ones */ saveVitality(pmcData: IPmcData, request: ISyncHealthRequestData, sessionID: string, addEffects?: boolean, deleteExistingEffects?: boolean): void; /** diff --git a/TypeScript/17AsyncImporterWithDependency2/types/helpers/InRaidHelper.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/helpers/InRaidHelper.d.ts index bf584c2..b4c0c1c 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/helpers/InRaidHelper.d.ts @@ -53,7 +53,7 @@ export declare class InRaidHelper { * @param victim Who was killed by player * @returns a numerical standing gain or loss */ - protected getStandingChangeForKill(victim: Victim): number; + protected getFenceStandingChangeForKillAsScav(victim: Victim): number; /** * Reset a profile to a baseline, used post-raid * Reset points earned during session property diff --git a/TypeScript/17AsyncImporterWithDependency2/types/helpers/ItemHelper.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/helpers/ItemHelper.d.ts index 99fca56..00f190f 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/helpers/ItemHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/helpers/ItemHelper.d.ts @@ -26,6 +26,7 @@ declare class ItemHelper { protected itemBaseClassService: ItemBaseClassService; protected localisationService: LocalisationService; protected localeService: LocaleService; + protected readonly defaultInvalidBaseTypes: string[]; constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, localisationService: LocalisationService, localeService: LocaleService); /** * Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash @@ -67,6 +68,11 @@ declare class ItemHelper { * @returns Price in roubles (undefined if not found) */ getDynamicItemPrice(tpl: string): number; + /** + * Update items upd.StackObjectsCount to be 1 if its upd is missing or StackObjectsCount is undefined + * @param item Item to update + * @returns Fixed item + */ fixItemStackCount(item: Item): Item; /** * AmmoBoxes contain StackSlots which need to be filled for the AmmoBox to have content. @@ -125,19 +131,19 @@ declare class ItemHelper { getItemQualityModifier(item: Item): number; /** * Get a quality value based on a repairable items (weapon/armor) current state between current and max durability - * @param itemDetails - * @param repairable repairable object - * @param item - * @returns a number between 0 and 1 + * @param itemDetails Db details for item we want quality value for + * @param repairable Repairable properties + * @param item Item quality value is for + * @returns A number between 0 and 1 */ protected getRepairableItemQualityValue(itemDetails: ITemplateItem, repairable: Repairable, item: Item): number; /** * Recursive function that looks at every item from parameter and gets their childrens Ids + includes parent item in results - * @param items - * @param itemID + * @param items Array of items (item + possible children) + * @param itemId Parent items id * @returns an array of strings */ - findAndReturnChildrenByItems(items: Item[], itemID: string): string[]; + findAndReturnChildrenByItems(items: Item[], itemId: string): string[]; /** * A variant of findAndReturnChildren where the output is list of item objects instead of their ids. * @param items @@ -164,12 +170,6 @@ declare class ItemHelper { * @returns true if it is a dogtag */ isDogtag(tpl: string): boolean; - /** - * Can the item passed in be sold to a trader because it is raw money - * @param tpl Item template id to check - * @returns true if unsellable - */ - isNotSellable(tpl: string): boolean; /** * Gets the identifier for a child using slotId, locationX and locationY. * @param item @@ -183,19 +183,19 @@ declare class ItemHelper { */ isItemTplStackable(tpl: string): boolean; /** - * split item stack if it exceeds its StackMaxSize property - * @param itemToSplit item being split into smaller stacks + * split item stack if it exceeds its items StackMaxSize property + * @param itemToSplit Item to split into smaller stacks * @returns Array of split items */ splitStack(itemToSplit: Item): Item[]; /** - * Find Barter items in the inventory + * Find Barter items from array of items * @param {string} by tpl or id - * @param {Object} pmcData + * @param {Item[]} items Array of items to iterate over * @param {string} barterItemId * @returns Array of Item objects */ - findBarterItems(by: "tpl" | "id", pmcData: IPmcData, barterItemId: string): Item[]; + findBarterItems(by: "tpl" | "id", items: Item[], barterItemId: string): Item[]; /** * Regenerate all guids with new ids, exceptions are for items that cannot be altered (e.g. stash/sorting table) * @param pmcData Player profile @@ -262,10 +262,21 @@ declare class ItemHelper { * @param minSizePercent % the magazine must be filled to */ fillMagazineWithCartridge(magazine: Item[], magTemplate: ITemplateItem, cartridgeTpl: string, minSizePercent?: number): void; + /** + * Choose a random bullet type from the list of possible a magazine has + * @param magTemplate Magazine template from Db + * @returns Tpl of cartridge + */ protected getRandomValidCaliber(magTemplate: ITemplateItem): string; + /** + * Chose a randomly weighted cartridge that fits + * @param caliber Desired caliber + * @param staticAmmoDist Cartridges and thier weights + * @returns Tpl of cartrdige + */ protected drawAmmoTpl(caliber: string, staticAmmoDist: Record): string; /** - * + * Create a basic cartrige object * @param parentId container cartridges will be placed in * @param ammoTpl Cartridge to insert * @param stackCount Count of cartridges inside parent diff --git a/TypeScript/17AsyncImporterWithDependency2/types/helpers/QuestHelper.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/helpers/QuestHelper.d.ts index e04b6e0..5c749d3 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/helpers/QuestHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/helpers/QuestHelper.d.ts @@ -21,6 +21,7 @@ import { DialogueHelper } from "./DialogueHelper"; import { ItemHelper } from "./ItemHelper"; import { PaymentHelper } from "./PaymentHelper"; import { ProfileHelper } from "./ProfileHelper"; +import { QuestConditionHelper } from "./QuestConditionHelper"; import { RagfairServerHelper } from "./RagfairServerHelper"; import { TraderHelper } from "./TraderHelper"; export declare class QuestHelper { @@ -29,6 +30,7 @@ export declare class QuestHelper { protected timeUtil: TimeUtil; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; + protected questConditionHelper: QuestConditionHelper; protected eventOutputHolder: EventOutputHolder; protected databaseServer: DatabaseServer; protected localeService: LocaleService; @@ -41,7 +43,7 @@ export declare class QuestHelper { protected mailSendService: MailSendService; protected configServer: ConfigServer; 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, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, questConditionHelper: QuestConditionHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, mailSendService: MailSendService, configServer: ConfigServer); /** * Get status of a quest in player profile by its id * @param pmcData Profile to search @@ -119,7 +121,7 @@ export declare class QuestHelper { * @param sessionID Session id * @returns Quests accessible to player incuding newly unlocked quests now quest (startedQuestId) was started */ - acceptedUnlocked(startedQuestId: string, sessionID: string): IQuest[]; + getNewlyAccessibleQuestsWhenStartingQuest(startedQuestId: string, sessionID: string): IQuest[]; /** * Get quests that can be shown to player after failing a quest * @param failedQuestId Id of the quest failed by player diff --git a/TypeScript/17AsyncImporterWithDependency2/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/helpers/RagfairOfferHelper.d.ts index de9d550..0699259 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/helpers/RagfairOfferHelper.d.ts @@ -1,4 +1,5 @@ import { IPmcData } from "../models/eft/common/IPmcData"; +import { Item } from "../models/eft/common/tables/IItem"; import { ITraderAssort } from "../models/eft/common/tables/ITrader"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; @@ -13,10 +14,10 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { LocaleService } from "../services/LocaleService"; import { LocalisationService } from "../services/LocalisationService"; +import { MailSendService } from "../services/MailSendService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { HashUtil } from "../utils/HashUtil"; import { TimeUtil } from "../utils/TimeUtil"; -import { DialogueHelper } from "./DialogueHelper"; import { ItemHelper } from "./ItemHelper"; import { PaymentHelper } from "./PaymentHelper"; import { PresetHelper } from "./PresetHelper"; @@ -33,7 +34,6 @@ export declare class RagfairOfferHelper { protected databaseServer: DatabaseServer; protected traderHelper: TraderHelper; protected saveServer: SaveServer; - protected dialogueHelper: DialogueHelper; protected itemHelper: ItemHelper; protected paymentHelper: PaymentHelper; protected presetHelper: PresetHelper; @@ -44,11 +44,12 @@ export declare class RagfairOfferHelper { protected ragfairOfferService: RagfairOfferService; protected localeService: LocaleService; protected localisationService: LocalisationService; + protected mailSendService: MailSendService; protected configServer: ConfigServer; protected static goodSoldTemplate: string; protected ragfairConfig: IRagfairConfig; 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, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, localisationService: LocalisationService, mailSendService: MailSendService, configServer: ConfigServer); /** * Passthrough to ragfairOfferService.getOffers(), get flea offers a player should see * @param searchRequest Data from client @@ -119,19 +120,26 @@ export declare class RagfairOfferHelper { */ protected getProfileOffers(sessionID: string): IRagfairOffer[]; /** - * Delete an offer from a desired profile + * Delete an offer from a desired profile and from ragfair offers * @param sessionID Session id of profile to delete offer from - * @param offerId Offer id to delete + * @param offerId Id of offer to delete */ - protected deleteOfferByOfferId(sessionID: string, offerId: string): void; + protected deleteOfferById(sessionID: string, offerId: string): void; /** * Complete the selling of players' offer * @param sessionID Session id * @param offer Sold offer details * @param boughtAmount Amount item was purchased for - * @returns Client response + * @returns IItemEventRouterResponse */ protected completeOffer(sessionID: string, offer: IRagfairOffer, boughtAmount: number): IItemEventRouterResponse; + /** + * Get a localised message for when players offer has sold on flea + * @param itemTpl Item sold + * @param boughtAmount How many were purchased + * @returns Localised message text + */ + protected getLocalisedOfferSoldMessage(itemTpl: string, boughtAmount: number): string; /** * Should a ragfair offer be visible to the player * @param searchRequest Search request @@ -142,4 +150,12 @@ export declare class RagfairOfferHelper { * @returns True = should be shown to player */ isDisplayableOffer(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, offer: IRagfairOffer, pmcProfile: IPmcData): boolean; + /** + * Is items quality value within desired range + * @param item Item to check quality of + * @param min Desired minimum quality + * @param max Desired maximum quality + * @returns True if in range + */ + protected itemQualityInRange(item: Item, min: number, max: number): boolean; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/helpers/RagfairSellHelper.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/helpers/RagfairSellHelper.d.ts index 251d7ca..913b408 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/helpers/RagfairSellHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/helpers/RagfairSellHelper.d.ts @@ -13,12 +13,12 @@ export declare class RagfairSellHelper { constructor(logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, configServer: ConfigServer); /** * Get the percent chance to sell an item based on its average listed price vs player chosen listing price - * @param baseChancePercent Base chance to sell item * @param averageOfferPriceRub Price of average offer in roubles * @param playerListedPriceRub Price player listed item for in roubles + * @param qualityMultiplier Quality multipler of item being sold * @returns percent value */ - calculateSellChance(baseChancePercent: number, averageOfferPriceRub: number, playerListedPriceRub: number): number; + calculateSellChance(averageOfferPriceRub: number, playerListedPriceRub: number, qualityMultiplier: number): number; /** * Get percent chance to sell an item when price is below items average listing price * @param playerListedPriceRub Price player listed item for in roubles diff --git a/TypeScript/17AsyncImporterWithDependency2/types/helpers/TraderHelper.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/helpers/TraderHelper.d.ts index c163f7a..6680ccf 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/helpers/TraderHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/helpers/TraderHelper.d.ts @@ -35,7 +35,7 @@ export declare class TraderHelper { protected highestTraderBuyPriceItems: Record; constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, handbookHelper: HandbookHelper, itemHelper: ItemHelper, playerService: PlayerService, localisationService: LocalisationService, fenceService: FenceService, timeUtil: TimeUtil, randomUtil: RandomUtil, configServer: ConfigServer); getTrader(traderID: string, sessionID: string): ITraderBase; - getTraderAssortsById(traderId: string): ITraderAssort; + getTraderAssortsByTraderId(traderId: string): ITraderAssort; /** * 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 diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/common/tables/IBotBase.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/common/tables/IBotBase.d.ts index ee40958..6c7b76f 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/common/tables/IBotBase.d.ts @@ -281,7 +281,7 @@ export interface InsuredItem { export interface Hideout { Production: Record; Areas: HideoutArea[]; - Improvements: Record; + Improvement: Record; Seed: number; sptUpdateLastRunTimestamp: number; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/health/IHealthTreatmentRequestData.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/health/IHealthTreatmentRequestData.d.ts index 7fb80a8..598e60c 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/health/IHealthTreatmentRequestData.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/health/IHealthTreatmentRequestData.d.ts @@ -1,12 +1,14 @@ export interface IHealthTreatmentRequestData { Action: "RestoreHealth"; trader: string; - items: Item[]; + items: Cost[]; difference: Difference; timestamp: number; } -export interface Item { +export interface Cost { + /** Id of stack to take money from */ id: string; + /** Amount of money to take off player for treatment */ count: number; } export interface Difference { @@ -25,5 +27,6 @@ export interface BodyParts { } export interface BodyPart { Health: number; + /** Effects in array are to be removed */ Effects: string[]; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/notifier/INotifier.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/notifier/INotifier.d.ts index ce25dee..c6c6979 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/notifier/INotifier.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/notifier/INotifier.d.ts @@ -14,6 +14,11 @@ export interface INotification { } export declare enum NotificationType { RAGFAIR_OFFER_SOLD = "RagfairOfferSold", + RAGFAIR_RATING_CHANGE = "RagfairRatingChange", + /** ChatMessageReceived */ NEW_MESSAGE = "new_message", - PING = "ping" + PING = "ping", + TRADER_SUPPLY = "TraderSupply", + TRADER_STANDING = "TraderStanding", + UNLOCK_TRADER = "UnlockTrader" } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/notifier/ISelectProfileResponse.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/notifier/ISelectProfileResponse.d.ts index ecb668a..f2d6be7 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/eft/notifier/ISelectProfileResponse.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/eft/notifier/ISelectProfileResponse.d.ts @@ -1,6 +1,3 @@ -import { INotifierChannel } from "./INotifier"; export interface ISelectProfileResponse { status: string; - notifier: INotifierChannel; - notifierServer: string; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/enums/WeatherType.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/enums/WeatherType.d.ts index d31fefe..503dc30 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/enums/WeatherType.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/enums/WeatherType.d.ts @@ -1,19 +1,19 @@ export declare enum WeatherType { - CLEAR_DAY = 1, - CLEAR_WIND = 2, - CLEAR_NIGHT = 3, - PARTLY_CLOUD_DAY = 4, - PARTLY_CLOUD_NIGHT = 5, - CLEAR_FOG_DAY = 6, - CLEAR_FOG_NIGHT = 7, - CLOUDFOG = 8, - FOG = 9, - MOSTLY_CLOUD = 10, - LIGHT_RAIN = 11, - RAIN = 12, - CLOUD_WIND = 13, - CLOUD_WIND_RAIN = 14, - FULL_CLOUD = 15, - THUNDER_CLOUD = 16, - NONE = 0 + CLEAR_DAY = 0, + CLEAR_WIND = 1, + CLEAR_NIGHT = 2, + PARTLY_CLOUD_DAY = 3, + PARTLY_CLOUD_NIGHT = 4, + CLEAR_FOG_DAY = 5, + CLEAR_FOG_NIGHT = 6, + CLOUD_FOG = 7, + FOG = 8, + MOSTLY_CLOUD = 9, + LIGHT_RAIN = 10, + RAIN = 11, + CLOUD_WIND = 12, + CLOUD_WIND_RAIN = 13, + FULL_CLOUD = 14, + THUNDER_CLOUD = 15, + NONE = 16 } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IRagfairConfig.d.ts index 7c04857..7aea24f 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IRagfairConfig.d.ts @@ -41,7 +41,8 @@ export interface Dynamic { /** Use the highest trader price for an offer if its greater than the price in templates/prices.json */ useTraderPriceForOffersIfHigher: boolean; /** Barter offer specific settings */ - barter: Barter; + barter: IBarterDetails; + pack: IPackDetails; /** Dynamic offer price below handbook adjustment values */ offerAdjustment: OfferAdjustment; /** How many offers should expire before an offer regeneration occurs */ @@ -49,9 +50,7 @@ export interface Dynamic { /** How many offers should be listed */ offerItemCount: MinMax; /** How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) */ - price: MinMax; - /** How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) */ - presetPrice: MinMax; + priceRanges: IPriceRanges; /** Should default presets to listed only or should non-standard presets found in globals.json be listed too */ showDefaultPresetsOnly: boolean; endTimeSeconds: MinMax; @@ -74,7 +73,12 @@ export interface Dynamic { /** Dict of price limits keyed by item type */ unreasonableModPrices: Record; } -export interface Barter { +export interface IPriceRanges { + default: MinMax; + preset: MinMax; + pack: MinMax; +} +export interface IBarterDetails { /** Should barter offers be generated */ enable: boolean; /** Percentage change an offer is listed as a barter */ @@ -90,6 +94,18 @@ export interface Barter { /** Item Tpls to never be turned into a barter */ itemTypeBlacklist: string[]; } +export interface IPackDetails { + /** Should pack offers be generated */ + enable: boolean; + /** Percentage change an offer is listed as a pack */ + chancePercent: number; + /** Min number of required items for a pack */ + itemCountMin: number; + /** Max number of required items for a pack */ + itemCountMax: number; + /** item types to allow being a pack */ + itemTypeWhitelist: string[]; +} export interface OfferAdjustment { /** Shuld offer price be adjusted when below handbook price */ adjustPriceWhenBelowHandbookPrice: boolean; diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IWeatherConfig.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IWeatherConfig.d.ts index 41a1c83..6ecf35b 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IWeatherConfig.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IWeatherConfig.d.ts @@ -7,7 +7,7 @@ export interface IWeatherConfig extends IBaseConfig { weather: Weather; } export interface Weather { - clouds: MinMax; + clouds: WeatherSettings; windSpeed: WeatherSettings; windDirection: WeatherSettings; windGustiness: MinMax; diff --git a/TypeScript/17AsyncImporterWithDependency2/types/services/HashCacheService.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/services/HashCacheService.d.ts index 5320f28..9968478 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/services/HashCacheService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/services/HashCacheService.d.ts @@ -11,7 +11,18 @@ export declare class HashCacheService { protected modHashes: any; protected readonly modCachePath = "./user/cache/modCache.json"; constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); + /** + * Return a stored hash by key + * @param modName Name of mod to get hash for + * @returns Mod hash + */ getStoredModHash(modName: string): string; + /** + * Does the generated hash match the stored hash + * @param modName name of mod + * @param modContent + * @returns True if they match + */ modContentMatchesStoredHash(modName: string, modContent: string): boolean; hashMatchesStoredHash(modName: string, modHash: string): boolean; storeModContent(modName: string, modContent: string): void; diff --git a/TypeScript/17AsyncImporterWithDependency2/types/services/MailSendService.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/services/MailSendService.d.ts index 19397dc..fe4a7fe 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/services/MailSendService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/services/MailSendService.d.ts @@ -35,7 +35,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendDirectNpcMessageToPlayer(playerId: string, sender: Traders, messageType: MessageType, message: string, items?: Item[], maxStorageTimeSeconds?: any): void; + sendDirectNpcMessageToPlayer(playerId: string, sender: Traders, messageType: MessageType, message: string, items?: Item[], maxStorageTimeSeconds?: any, systemData?: any, ragfair?: any): void; /** * Send a message from an NPC (e.g. prapor) to the player with or without items * @param playerId Players id to send message to @@ -45,7 +45,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendLocalisedNpcMessageToPlayer(playerId: string, sender: Traders, messageType: MessageType, messageLocaleId: string, items?: Item[], maxStorageTimeSeconds?: any, systemData?: any): void; + sendLocalisedNpcMessageToPlayer(playerId: string, sender: Traders, messageType: MessageType, messageLocaleId: string, items?: Item[], maxStorageTimeSeconds?: any, systemData?: any, ragfair?: any): void; /** * Send a message from SYSTEM to the player with or without items * @param playerId Players id to send message to diff --git a/TypeScript/17AsyncImporterWithDependency2/types/services/MatchBotDetailsCacheService.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/services/MatchBotDetailsCacheService.d.ts index eb365dd..c1bd322 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/services/MatchBotDetailsCacheService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/services/MatchBotDetailsCacheService.d.ts @@ -1,7 +1,7 @@ import { IBotBase } from "../models/eft/common/tables/IBotBase"; import { ILogger } from "../models/spt/utils/ILogger"; import { LocalisationService } from "./LocalisationService"; -/** Cache bots in a dictionary, keyed by the bots name, keying by name isnt idea as its not unique but this is used by the post-raid system which doesnt have any bot ids, only name */ +/** Cache bots in a dictionary, keyed by the bots name, keying by name isnt ideal as its not unique but this is used by the post-raid system which doesnt have any bot ids, only name */ export declare class MatchBotDetailsCacheService { protected logger: ILogger; protected localisationService: LocalisationService; @@ -17,9 +17,9 @@ export declare class MatchBotDetailsCacheService { */ clearCache(): void; /** - * Find a bot in the cache by its name + * Find a bot in the cache by its name and side * @param botName Name of bot to find * @returns Bot details */ - getBotByName(botName: string): IBotBase; + getBotByNameAndSide(botName: string, botSide: string): IBotBase; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/services/ModCompilerService.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/services/ModCompilerService.d.ts index a4bf3c8..e306177 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/services/ModCompilerService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/services/ModCompilerService.d.ts @@ -1,14 +1,36 @@ import { CompilerOptions } from "typescript"; import type { ILogger } from "../models/spt/utils/ILogger"; -import { HashCacheService } from "./HashCacheService"; import { VFS } from "../utils/VFS"; +import { HashCacheService } from "./HashCacheService"; export declare class ModCompilerService { protected logger: ILogger; protected hashCacheService: HashCacheService; protected vfs: VFS; constructor(logger: ILogger, hashCacheService: HashCacheService, vfs: VFS); + /** + * Convert a mods TS into JS + * @param modName Name of mod + * @param modPath Dir path to mod + * @param modTypeScriptFiles + * @returns + */ compileMod(modName: string, modPath: string, modTypeScriptFiles: string[]): Promise; + /** + * Convert a TS file into JS + * @param fileNames Paths to TS files + * @param options Compiler options + */ protected compile(fileNames: string[], options: CompilerOptions): Promise; + /** + * Do the files at the provided paths exist + * @param fileNames + * @returns + */ protected areFilesReady(fileNames: string[]): boolean; + /** + * Wait the provided number of milliseconds + * @param ms Milliseconds + * @returns + */ protected delay(ms: number): Promise; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/services/PaymentService.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/services/PaymentService.d.ts index 1c9c32b..fb5f92c 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/services/PaymentService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/services/PaymentService.d.ts @@ -61,23 +61,26 @@ export declare class PaymentService { * Get all money stacks in inventory and prioritse items in stash * @param pmcData * @param currencyTpl + * @param playerStashId Players stash id * @returns Sorting money items */ - protected getSortedMoneyItemsInInventory(pmcData: IPmcData, currencyTpl: string): Item[]; + protected getSortedMoneyItemsInInventory(pmcData: IPmcData, currencyTpl: string, playerStashId: string): Item[]; /** * Prioritise player stash first over player inventory * Post-raid healing would often take money out of the players pockets/secure container * @param a First money stack item * @param b Second money stack item * @param inventoryItems players inventory items + * @param playerStashId Players stash id * @returns sort order */ - protected prioritiseStashSort(a: Item, b: Item, inventoryItems: Item[]): number; + protected prioritiseStashSort(a: Item, b: Item, inventoryItems: Item[], playerStashId: string): number; /** * Recursivly check items parents to see if it is inside the players inventory, not stash * @param itemId item id to check * @param inventoryItems player inventory + * @param playerStashId Players stash id * @returns true if its in inventory */ - protected isInInventory(itemId: string, inventoryItems: Item[]): boolean; + protected isInStash(itemId: string, inventoryItems: Item[], playerStashId: string): boolean; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/services/ProfileFixerService.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/services/ProfileFixerService.d.ts index c8232fc..bc1e42e 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/services/ProfileFixerService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/services/ProfileFixerService.d.ts @@ -14,6 +14,7 @@ import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; import { Watermark } from "../utils/Watermark"; import { LocalisationService } from "./LocalisationService"; @@ -27,17 +28,19 @@ export declare class ProfileFixerService { protected itemHelper: ItemHelper; protected localisationService: LocalisationService; protected timeUtil: TimeUtil; + protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, profileHelper: ProfileHelper, itemHelper: ItemHelper, localisationService: LocalisationService, timeUtil: TimeUtil, databaseServer: DatabaseServer, configServer: ConfigServer); + constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, profileHelper: ProfileHelper, itemHelper: ItemHelper, localisationService: LocalisationService, timeUtil: TimeUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, configServer: ConfigServer); /** * 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; protected addMissingGunStandContainerImprovements(pmcProfile: IPmcData): void; + protected ensureGunStandLevelsMatch(pmcProfile: IPmcData): void; protected addHideoutAreaStashes(pmcProfile: IPmcData): void; protected addMissingHideoutWallAreas(pmcProfile: IPmcData): void; protected adjustUnreasonableModFleaPrices(): void; @@ -131,4 +134,9 @@ export declare class ProfileFixerService { * @param pmcProfile Profile to add missing IDs to */ addMissingIdsToBonuses(pmcProfile: IPmcData): void; + /** + * At some point the property name was changed,migrate data across to new name + * @param pmcProfile + */ + protected migrateImprovements(pmcProfile: IPmcData): void; } diff --git a/TypeScript/17AsyncImporterWithDependency2/types/services/RagfairPriceService.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/services/RagfairPriceService.d.ts index e245efa..ff35327 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/services/RagfairPriceService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/services/RagfairPriceService.d.ts @@ -3,6 +3,7 @@ import { HandbookHelper } from "../helpers/HandbookHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { TraderHelper } from "../helpers/TraderHelper"; +import { MinMax } from "../models/common/MinMax"; import { IPreset } from "../models/eft/common/IGlobals"; import { Item } from "../models/eft/common/tables/IItem"; import { IBarterScheme } from "../models/eft/common/tables/ITrader"; @@ -35,10 +36,6 @@ export declare class RagfairPriceService implements OnLoad { * Generate static (handbook) and dynamic (prices.json) flea prices, store inside class as dictionaries */ onLoad(): Promise; - /** - * Add placeholder values for items missing from handbook - */ - protected addMissingHandbookPrices(): void; getRoute(): string; /** * Iterate over all items of type "Item" in db and get template price, store in cache @@ -91,9 +88,17 @@ export declare class RagfairPriceService implements OnLoad { * Generate a currency cost for an item and its mods * @param items Item with mods to get price for * @param desiredCurrency Currency price desired in + * @param isPackOffer Price is for a pack type offer * @returns cost of item in desired currency */ - getDynamicOfferPrice(items: Item[], desiredCurrency: string): number; + getDynamicOfferPriceForOffer(items: Item[], desiredCurrency: string, isPackOffer: boolean): number; + /** + * Get different min/max price multipliers for different offer types (preset/pack/default) + * @param isPreset Offer is a preset + * @param isPack Offer is a pack + * @returns MinMax values + */ + protected getOfferTypeRangeValues(isPreset: boolean, isPack: boolean): MinMax; /** * Check to see if an items price is below its handbook price and adjust accoring to values set to config/ragfair.json * @param itemPrice price of item @@ -104,10 +109,10 @@ export declare class RagfairPriceService implements OnLoad { /** * Multiply the price by a randomised curve where n = 2, shift = 2 * @param existingPrice price to alter - * @param isPreset is the item we're multiplying a preset + * @param rangeValues min and max to adjust price by * @returns multiplied price */ - protected randomisePrice(existingPrice: number, isPreset: boolean): number; + protected randomiseOfferPrice(existingPrice: number, rangeValues: MinMax): number; /** * Calculate the cost of a weapon preset by adding together the price of its mods + base price of default weapon preset * @param item base weapon diff --git a/TypeScript/18CustomItemService/types/callbacks/GameCallbacks.d.ts b/TypeScript/18CustomItemService/types/callbacks/GameCallbacks.d.ts index aa80036..46f79f9 100644 --- a/TypeScript/18CustomItemService/types/callbacks/GameCallbacks.d.ts +++ b/TypeScript/18CustomItemService/types/callbacks/GameCallbacks.d.ts @@ -1,4 +1,5 @@ import { GameController } from "../controllers/GameController"; +import { OnLoad } from "../di/OnLoad"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { ICheckVersionResponse } from "../models/eft/game/ICheckVersionResponse"; import { ICurrentGroupResponse } from "../models/eft/game/ICurrentGroupResponse"; @@ -15,12 +16,14 @@ import { INullResponseData } from "../models/eft/httpResponse/INullResponseData" import { SaveServer } from "../servers/SaveServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { Watermark } from "../utils/Watermark"; -declare class GameCallbacks { +declare class GameCallbacks implements OnLoad { protected httpResponse: HttpResponseUtil; protected watermark: Watermark; protected saveServer: SaveServer; protected gameController: GameController; constructor(httpResponse: HttpResponseUtil, watermark: Watermark, saveServer: SaveServer, gameController: GameController); + onLoad(): Promise; + getRoute(): string; /** * Handle client/game/version/validate * @returns INullResponseData diff --git a/TypeScript/18CustomItemService/types/controllers/GameController.d.ts b/TypeScript/18CustomItemService/types/controllers/GameController.d.ts index 04e3abb..e88610e 100644 --- a/TypeScript/18CustomItemService/types/controllers/GameController.d.ts +++ b/TypeScript/18CustomItemService/types/controllers/GameController.d.ts @@ -61,13 +61,14 @@ export declare class GameController { protected pmcConfig: IPmcConfig; protected lootConfig: ILootConfig; constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, randomUtil: RandomUtil, encodingUtil: EncodingUtil, hideoutHelper: HideoutHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, seasonalEventService: SeasonalEventService, itemBaseClassService: ItemBaseClassService, giftService: GiftService, applicationContext: ApplicationContext, configServer: ConfigServer); + load(): void; /** * Handle client/game/start */ gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; protected addCustomLooseLootPositions(): void; protected adjustLooseLootSpawnProbabilities(): void; - protected setHideoutAreasAndCraftsTo30Secs(): void; + protected setHideoutAreasAndCraftsTo40Secs(): void; /** * 3.7.0 moved AIDs to be numeric, old profiles need to be migrated * We store the old AID value in new field `sessionId` diff --git a/TypeScript/18CustomItemService/types/controllers/HealthController.d.ts b/TypeScript/18CustomItemService/types/controllers/HealthController.d.ts index 1938297..2d7ff09 100644 --- a/TypeScript/18CustomItemService/types/controllers/HealthController.d.ts +++ b/TypeScript/18CustomItemService/types/controllers/HealthController.d.ts @@ -29,34 +29,35 @@ export declare class HealthController { * stores in-raid player health * @param pmcData Player profile * @param info Request data - * @param sessionID + * @param sessionID Player id * @param addEffects Should effects found be added or removed from profile + * @param deleteExistingEffects Should all prior effects be removed before apply new ones */ saveVitality(pmcData: IPmcData, info: ISyncHealthRequestData, sessionID: string, addEffects?: boolean, deleteExistingEffects?: boolean): void; /** * When healing in menu - * @param pmcData - * @param body - * @param sessionID - * @returns + * @param pmcData Player profile + * @param request Healing request + * @param sessionID Player id + * @returns IItemEventRouterResponse */ - offraidHeal(pmcData: IPmcData, body: IOffraidHealRequestData, sessionID: string): IItemEventRouterResponse; + offraidHeal(pmcData: IPmcData, request: IOffraidHealRequestData, sessionID: string): IItemEventRouterResponse; /** * Handle Eat event * Consume food/water outside of a raid * @param pmcData Player profile - * @param body request Object + * @param request Eat request * @param sessionID Session id * @returns IItemEventRouterResponse */ - offraidEat(pmcData: IPmcData, body: IOffraidEatRequestData, sessionID: string): IItemEventRouterResponse; + offraidEat(pmcData: IPmcData, request: IOffraidEatRequestData, sessionID: string): IItemEventRouterResponse; /** * Handle RestoreHealth event * Occurs on post-raid healing page * @param pmcData player profile * @param healthTreatmentRequest Request data from client * @param sessionID Session id - * @returns + * @returns IItemEventRouterResponse */ healthTreatment(pmcData: IPmcData, healthTreatmentRequest: IHealthTreatmentRequestData, sessionID: string): IItemEventRouterResponse; /** @@ -66,12 +67,4 @@ export declare class HealthController { * @param sessionID */ applyWorkoutChanges(pmcData: IPmcData, info: IWorkoutData, sessionId: string): void; - /** - * Iterate over treatment request diff and find effects to remove from player limbs - * @param sessionId - * @param profile Profile to update - * @param treatmentRequest client request - * @param output response to send to client - */ - protected removeEffectsAfterPostRaidHeal(sessionId: string, profile: IPmcData, treatmentRequest: IHealthTreatmentRequestData, output: IItemEventRouterResponse): void; } diff --git a/TypeScript/18CustomItemService/types/controllers/HideoutController.d.ts b/TypeScript/18CustomItemService/types/controllers/HideoutController.d.ts index 877c076..a90a16d 100644 --- a/TypeScript/18CustomItemService/types/controllers/HideoutController.d.ts +++ b/TypeScript/18CustomItemService/types/controllers/HideoutController.d.ts @@ -88,11 +88,11 @@ export declare class HideoutController { * @param pmcData Profile to edit * @param output Object to send back to client * @param sessionID Session/player id - * @param profileHideoutArea Current hideout data for profile + * @param profileParentHideoutArea Current hideout area for profile * @param dbHideoutArea Hideout area being upgraded * @param hideoutStage Stage hideout area is being upgraded to */ - protected addContainerImprovementToProfile(output: IItemEventRouterResponse, sessionID: string, pmcData: IPmcData, profileHideoutArea: HideoutArea, dbHideoutArea: IHideoutArea, hideoutStage: Stage): void; + protected addContainerImprovementToProfile(output: IItemEventRouterResponse, sessionID: string, pmcData: IPmcData, profileParentHideoutArea: HideoutArea, dbHideoutArea: IHideoutArea, hideoutStage: Stage): void; /** * Add an inventory item to profile from a hideout area stage data * @param pmcData Profile to update diff --git a/TypeScript/18CustomItemService/types/controllers/LocationController.d.ts b/TypeScript/18CustomItemService/types/controllers/LocationController.d.ts index 94d496a..94f5fce 100644 --- a/TypeScript/18CustomItemService/types/controllers/LocationController.d.ts +++ b/TypeScript/18CustomItemService/types/controllers/LocationController.d.ts @@ -4,6 +4,7 @@ import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { ILocationBase } from "../models/eft/common/ILocationBase"; import { ILocationsGenerateAllResponse } from "../models/eft/common/ILocationsSourceDestinationBase"; import { IAirdropLootResult } from "../models/eft/location/IAirdropLootResult"; +import { IGetLocationRequestData } from "../models/eft/location/IGetLocationRequestData"; import { AirdropTypeEnum } from "../models/enums/AirdropType"; import { IAirdropConfig } from "../models/spt/config/IAirdropConfig"; import { ILocationConfig } from "../models/spt/config/ILocationConfig"; @@ -34,10 +35,11 @@ export declare class LocationController { /** * Handle client/location/getLocalloot * Get a location (map) with generated loot data - * @param location Map to generate loot for + * @param sessionId Player id + * @param request Map request to generate * @returns ILocationBase */ - get(location: string): ILocationBase; + get(sessionId: string, request: IGetLocationRequestData): ILocationBase; /** * Generate a maps base location with loot * @param name Map name diff --git a/TypeScript/18CustomItemService/types/controllers/QuestController.d.ts b/TypeScript/18CustomItemService/types/controllers/QuestController.d.ts index 7d494a6..bd8a70f 100644 --- a/TypeScript/18CustomItemService/types/controllers/QuestController.d.ts +++ b/TypeScript/18CustomItemService/types/controllers/QuestController.d.ts @@ -61,7 +61,7 @@ export declare class QuestController { * @param playerLevel level of player to test against quest * @returns true if quest can be seen/accepted by player of defined level */ - protected playerLevelFulfillsQuestRequrement(quest: IQuest, playerLevel: number): boolean; + protected playerLevelFulfillsQuestRequirement(quest: IQuest, playerLevel: number): boolean; /** * Should a quest be shown to the player in trader quest screen * @param questId Quest to check diff --git a/TypeScript/18CustomItemService/types/controllers/RagfairController.d.ts b/TypeScript/18CustomItemService/types/controllers/RagfairController.d.ts index 76c27f7..bda37cd 100644 --- a/TypeScript/18CustomItemService/types/controllers/RagfairController.d.ts +++ b/TypeScript/18CustomItemService/types/controllers/RagfairController.d.ts @@ -21,6 +21,7 @@ import { IGetMarketPriceRequestData } from "../models/eft/ragfair/IGetMarketPric import { IGetOffersResult } from "../models/eft/ragfair/IGetOffersResult"; import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; import { ISearchRequestData } from "../models/eft/ragfair/ISearchRequestData"; +import { IProcessBuyTradeRequestData } from "../models/eft/trade/IProcessBuyTradeRequestData"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; @@ -125,6 +126,18 @@ export declare class RagfairController { * @returns IItemEventRouterResponse */ addPlayerOffer(pmcData: IPmcData, offerRequest: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Charge player a listing fee for using flea, pulls charge from data previously sent by client + * @param sessionID Player id + * @param rootItem Base item being listed (used when client tax cost not found and must be done on server) + * @param pmcData Player profile + * @param requirementsPriceInRub Rouble cost player chose for listing (used when client tax cost not found and must be done on server) + * @param itemStackCount How many items were listed in player (used when client tax cost not found and must be done on server) + * @param offerRequest Add offer request object from client + * @param output IItemEventRouterResponse + * @returns True if charging tax to player failed + */ + protected chargePlayerTaxFee(sessionID: string, rootItem: Item, pmcData: IPmcData, requirementsPriceInRub: number, itemStackCount: number, offerRequest: IAddOfferRequestData, output: IItemEventRouterResponse): boolean; /** * Is the item to be listed on the flea valid * @param offerRequest Client offer request @@ -158,4 +171,11 @@ export declare class RagfairController { */ removeOffer(offerId: string, sessionID: string): IItemEventRouterResponse; extendOffer(info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Create a basic trader request object with price and currency type + * @param currency What currency: RUB, EURO, USD + * @param value Amount of currency + * @returns IProcessBuyTradeRequestData + */ + protected createBuyTradeRequestObject(currency: string, value: number): IProcessBuyTradeRequestData; } diff --git a/TypeScript/18CustomItemService/types/generators/BotEquipmentModGenerator.d.ts b/TypeScript/18CustomItemService/types/generators/BotEquipmentModGenerator.d.ts index ccbbbbf..f7abb84 100644 --- a/TypeScript/18CustomItemService/types/generators/BotEquipmentModGenerator.d.ts +++ b/TypeScript/18CustomItemService/types/generators/BotEquipmentModGenerator.d.ts @@ -14,7 +14,6 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; import { BotEquipmentModPoolService } from "../services/BotEquipmentModPoolService"; import { BotModLimits, BotWeaponModLimitService } from "../services/BotWeaponModLimitService"; -import { ItemBaseClassService } from "../services/ItemBaseClassService"; import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; @@ -29,7 +28,6 @@ export declare class BotEquipmentModGenerator { protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; protected botEquipmentFilterService: BotEquipmentFilterService; - protected itemBaseClassService: ItemBaseClassService; protected itemFilterService: ItemFilterService; protected profileHelper: ProfileHelper; protected botWeaponModLimitService: BotWeaponModLimitService; @@ -40,7 +38,7 @@ export declare class BotEquipmentModGenerator { protected botEquipmentModPoolService: BotEquipmentModPoolService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, itemHelper: ItemHelper, botEquipmentFilterService: BotEquipmentFilterService, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponModLimitService: BotWeaponModLimitService, botHelper: BotHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, botEquipmentModPoolService: BotEquipmentModPoolService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, itemHelper: ItemHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponModLimitService: BotWeaponModLimitService, botHelper: BotHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, botEquipmentModPoolService: BotEquipmentModPoolService, configServer: ConfigServer); /** * Check mods are compatible and add to array * @param equipment Equipment item to add mods to diff --git a/TypeScript/18CustomItemService/types/generators/LocationGenerator.d.ts b/TypeScript/18CustomItemService/types/generators/LocationGenerator.d.ts index b8169d3..46a514b 100644 --- a/TypeScript/18CustomItemService/types/generators/LocationGenerator.d.ts +++ b/TypeScript/18CustomItemService/types/generators/LocationGenerator.d.ts @@ -65,10 +65,11 @@ export declare class LocationGenerator { protected getGuaranteedContainers(staticContainersOnMap: IStaticContainerData[]): IStaticContainerData[]; /** * Choose a number of containers based on their probabilty value to fulfil the desired count in containerData.chosenCount + * @param groupId Name of the group the containers are being collected for * @param containerData Containers and probability values for a groupId * @returns List of chosen container Ids */ - protected getContainersByProbabilty(containerData: IContainerGroupCount): string[]; + protected getContainersByProbabilty(groupId: string, containerData: IContainerGroupCount): string[]; /** * Get a mapping of each groupid and the containers in that group + count of containers to spawn on map * @param containersGroups Container group values diff --git a/TypeScript/18CustomItemService/types/generators/PMCLootGenerator.d.ts b/TypeScript/18CustomItemService/types/generators/PMCLootGenerator.d.ts index 9acff69..abb5615 100644 --- a/TypeScript/18CustomItemService/types/generators/PMCLootGenerator.d.ts +++ b/TypeScript/18CustomItemService/types/generators/PMCLootGenerator.d.ts @@ -31,12 +31,12 @@ export declare class PMCLootGenerator { */ generatePMCVestLootPool(): string[]; /** - * Check if item has a width/height that lets it fit into a 1x2/2x1 slot - * 1x1 / 1x2 / 2x1 + * Check if item has a width/height that lets it fit into a 2x2 slot + * 1x1 / 1x2 / 2x1 / 2x2 * @param item Item to check size of * @returns true if it fits */ - protected itemFitsInto1By2Slot(item: ITemplateItem): boolean; + protected itemFitsInto2By2Slot(item: ITemplateItem): boolean; /** * Create an array of loot items a PMC can have in their backpack * @returns string array of tpls diff --git a/TypeScript/18CustomItemService/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/18CustomItemService/types/generators/RagfairOfferGenerator.d.ts index a627191..58e0b68 100644 --- a/TypeScript/18CustomItemService/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/18CustomItemService/types/generators/RagfairOfferGenerator.d.ts @@ -55,11 +55,10 @@ export declare class RagfairOfferGenerator { * @param items Items in the offer * @param barterScheme Cost of item (currency or barter) * @param loyalLevel Loyalty level needed to buy item - * @param price Price of offer - * @param sellInOnePiece Set StackObjectsCount to 1 + * @param sellInOnePiece Flags sellInOnePiece to be true * @returns IRagfairOffer */ - createFleaOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; + createFleaOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, sellInOnePiece?: boolean): IRagfairOffer; /** * Create an offer object ready to send to ragfairOfferService.addOffer() * @param userID Owner of the offer @@ -67,17 +66,16 @@ export declare class RagfairOfferGenerator { * @param items Items in the offer * @param barterScheme Cost of item (currency or barter) * @param loyalLevel Loyalty level needed to buy item - * @param price Price of offer * @param sellInOnePiece Set StackObjectsCount to 1 * @returns IRagfairOffer */ - protected createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; + protected createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, sellInOnePiece?: boolean): IRagfairOffer; /** * Calculate the offer price that's listed on the flea listing * @param offerRequirements barter requirements for offer * @returns rouble cost of offer */ - protected calculateOfferListingPrice(offerRequirements: OfferRequirement[]): number; + protected convertOfferRequirementsIntoRoubles(offerRequirements: OfferRequirement[]): number; /** * Get avatar url from trader table in db * @param isTrader Is user we're getting avatar for a trader @@ -137,7 +135,7 @@ export declare class RagfairOfferGenerator { * @param itemDetails raw db item details * @returns Item array */ - protected createSingleOfferForItem(items: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; + protected createSingleOfferForItem(items: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; /** * Generate trader offers on flea using the traders assort data * @param traderID Trader to generate offers for @@ -151,7 +149,7 @@ export declare class RagfairOfferGenerator { * @param itemDetails db details of first item * @returns */ - protected getItemCondition(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): Item[]; + protected randomiseItemUpdProperties(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): Item[]; /** * Get the relevant condition id if item tpl matches in ragfair.json/condition * @param tpl Item to look for matching condition object @@ -184,7 +182,7 @@ export declare class RagfairOfferGenerator { * @param offerItems Items for sale in offer * @returns Barter scheme */ - protected createBarterRequirement(offerItems: Item[]): IBarterScheme[]; + protected createBarterBarterScheme(offerItems: Item[]): IBarterScheme[]; /** * Get an array of flea prices + item tpl, cached in generator class inside `allowedFleaPriceItemsForBarter` * @returns array with tpl/price values @@ -196,7 +194,9 @@ export declare class RagfairOfferGenerator { /** * Create a random currency-based barter scheme for an array of items * @param offerItems Items on offer + * @param isPackOffer Is the barter scheme being created for a pack offer + * @param multipler What to multiply the resulting price by * @returns Barter scheme for offer */ - protected createCurrencyRequirement(offerItems: Item[]): IBarterScheme[]; + protected createCurrencyBarterScheme(offerItems: Item[], isPackOffer: boolean, multipler?: number): IBarterScheme[]; } diff --git a/TypeScript/18CustomItemService/types/generators/ScavCaseRewardGenerator.d.ts b/TypeScript/18CustomItemService/types/generators/ScavCaseRewardGenerator.d.ts index 4ba1888..b5935d0 100644 --- a/TypeScript/18CustomItemService/types/generators/ScavCaseRewardGenerator.d.ts +++ b/TypeScript/18CustomItemService/types/generators/ScavCaseRewardGenerator.d.ts @@ -25,6 +25,8 @@ export declare class ScavCaseRewardGenerator { protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected scavCaseConfig: IScavCaseConfig; + protected dbItemsCache: ITemplateItem[]; + protected dbAmmoItemsCache: ITemplateItem[]; constructor(logger: ILogger, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * Create an array of rewards that will be given to the player upon completing their scav case build @@ -33,10 +35,10 @@ export declare class ScavCaseRewardGenerator { */ generate(recipeId: string): Product[]; /** - * Get all db items that are not blacklisted in scavcase config - * @returns filtered array of db items + * Get all db items that are not blacklisted in scavcase config or global blacklist + * Store in class field */ - protected getDbItems(): ITemplateItem[]; + protected cacheDbItems(): void; /** * Pick a number of items to be rewards, the count is defined by the values in * @param items item pool to pick rewards from diff --git a/TypeScript/18CustomItemService/types/generators/WeatherGenerator.d.ts b/TypeScript/18CustomItemService/types/generators/WeatherGenerator.d.ts index 2e2403c..6471bb1 100644 --- a/TypeScript/18CustomItemService/types/generators/WeatherGenerator.d.ts +++ b/TypeScript/18CustomItemService/types/generators/WeatherGenerator.d.ts @@ -52,6 +52,7 @@ export declare class WeatherGenerator { */ protected setCurrentDateTime(weather: IWeather): void; protected getWeightedWindDirection(): WindDirection; + protected getWeightedClouds(): number; protected getWeightedWindSpeed(): number; protected getWeightedFog(): number; protected getWeightedRain(): number; diff --git a/TypeScript/18CustomItemService/types/helpers/HealthHelper.d.ts b/TypeScript/18CustomItemService/types/helpers/HealthHelper.d.ts index 3694a6e..e4cdcd6 100644 --- a/TypeScript/18CustomItemService/types/helpers/HealthHelper.d.ts +++ b/TypeScript/18CustomItemService/types/helpers/HealthHelper.d.ts @@ -27,6 +27,7 @@ export declare class HealthHelper { * @param request Heal request * @param sessionID Session id * @param addEffects Should effects be added or removed (default - add) + * @param deleteExistingEffects Should all prior effects be removed before apply new ones */ saveVitality(pmcData: IPmcData, request: ISyncHealthRequestData, sessionID: string, addEffects?: boolean, deleteExistingEffects?: boolean): void; /** diff --git a/TypeScript/18CustomItemService/types/helpers/InRaidHelper.d.ts b/TypeScript/18CustomItemService/types/helpers/InRaidHelper.d.ts index bf584c2..b4c0c1c 100644 --- a/TypeScript/18CustomItemService/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/18CustomItemService/types/helpers/InRaidHelper.d.ts @@ -53,7 +53,7 @@ export declare class InRaidHelper { * @param victim Who was killed by player * @returns a numerical standing gain or loss */ - protected getStandingChangeForKill(victim: Victim): number; + protected getFenceStandingChangeForKillAsScav(victim: Victim): number; /** * Reset a profile to a baseline, used post-raid * Reset points earned during session property diff --git a/TypeScript/18CustomItemService/types/helpers/ItemHelper.d.ts b/TypeScript/18CustomItemService/types/helpers/ItemHelper.d.ts index 99fca56..00f190f 100644 --- a/TypeScript/18CustomItemService/types/helpers/ItemHelper.d.ts +++ b/TypeScript/18CustomItemService/types/helpers/ItemHelper.d.ts @@ -26,6 +26,7 @@ declare class ItemHelper { protected itemBaseClassService: ItemBaseClassService; protected localisationService: LocalisationService; protected localeService: LocaleService; + protected readonly defaultInvalidBaseTypes: string[]; constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, localisationService: LocalisationService, localeService: LocaleService); /** * Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash @@ -67,6 +68,11 @@ declare class ItemHelper { * @returns Price in roubles (undefined if not found) */ getDynamicItemPrice(tpl: string): number; + /** + * Update items upd.StackObjectsCount to be 1 if its upd is missing or StackObjectsCount is undefined + * @param item Item to update + * @returns Fixed item + */ fixItemStackCount(item: Item): Item; /** * AmmoBoxes contain StackSlots which need to be filled for the AmmoBox to have content. @@ -125,19 +131,19 @@ declare class ItemHelper { getItemQualityModifier(item: Item): number; /** * Get a quality value based on a repairable items (weapon/armor) current state between current and max durability - * @param itemDetails - * @param repairable repairable object - * @param item - * @returns a number between 0 and 1 + * @param itemDetails Db details for item we want quality value for + * @param repairable Repairable properties + * @param item Item quality value is for + * @returns A number between 0 and 1 */ protected getRepairableItemQualityValue(itemDetails: ITemplateItem, repairable: Repairable, item: Item): number; /** * Recursive function that looks at every item from parameter and gets their childrens Ids + includes parent item in results - * @param items - * @param itemID + * @param items Array of items (item + possible children) + * @param itemId Parent items id * @returns an array of strings */ - findAndReturnChildrenByItems(items: Item[], itemID: string): string[]; + findAndReturnChildrenByItems(items: Item[], itemId: string): string[]; /** * A variant of findAndReturnChildren where the output is list of item objects instead of their ids. * @param items @@ -164,12 +170,6 @@ declare class ItemHelper { * @returns true if it is a dogtag */ isDogtag(tpl: string): boolean; - /** - * Can the item passed in be sold to a trader because it is raw money - * @param tpl Item template id to check - * @returns true if unsellable - */ - isNotSellable(tpl: string): boolean; /** * Gets the identifier for a child using slotId, locationX and locationY. * @param item @@ -183,19 +183,19 @@ declare class ItemHelper { */ isItemTplStackable(tpl: string): boolean; /** - * split item stack if it exceeds its StackMaxSize property - * @param itemToSplit item being split into smaller stacks + * split item stack if it exceeds its items StackMaxSize property + * @param itemToSplit Item to split into smaller stacks * @returns Array of split items */ splitStack(itemToSplit: Item): Item[]; /** - * Find Barter items in the inventory + * Find Barter items from array of items * @param {string} by tpl or id - * @param {Object} pmcData + * @param {Item[]} items Array of items to iterate over * @param {string} barterItemId * @returns Array of Item objects */ - findBarterItems(by: "tpl" | "id", pmcData: IPmcData, barterItemId: string): Item[]; + findBarterItems(by: "tpl" | "id", items: Item[], barterItemId: string): Item[]; /** * Regenerate all guids with new ids, exceptions are for items that cannot be altered (e.g. stash/sorting table) * @param pmcData Player profile @@ -262,10 +262,21 @@ declare class ItemHelper { * @param minSizePercent % the magazine must be filled to */ fillMagazineWithCartridge(magazine: Item[], magTemplate: ITemplateItem, cartridgeTpl: string, minSizePercent?: number): void; + /** + * Choose a random bullet type from the list of possible a magazine has + * @param magTemplate Magazine template from Db + * @returns Tpl of cartridge + */ protected getRandomValidCaliber(magTemplate: ITemplateItem): string; + /** + * Chose a randomly weighted cartridge that fits + * @param caliber Desired caliber + * @param staticAmmoDist Cartridges and thier weights + * @returns Tpl of cartrdige + */ protected drawAmmoTpl(caliber: string, staticAmmoDist: Record): string; /** - * + * Create a basic cartrige object * @param parentId container cartridges will be placed in * @param ammoTpl Cartridge to insert * @param stackCount Count of cartridges inside parent diff --git a/TypeScript/18CustomItemService/types/helpers/QuestHelper.d.ts b/TypeScript/18CustomItemService/types/helpers/QuestHelper.d.ts index e04b6e0..5c749d3 100644 --- a/TypeScript/18CustomItemService/types/helpers/QuestHelper.d.ts +++ b/TypeScript/18CustomItemService/types/helpers/QuestHelper.d.ts @@ -21,6 +21,7 @@ import { DialogueHelper } from "./DialogueHelper"; import { ItemHelper } from "./ItemHelper"; import { PaymentHelper } from "./PaymentHelper"; import { ProfileHelper } from "./ProfileHelper"; +import { QuestConditionHelper } from "./QuestConditionHelper"; import { RagfairServerHelper } from "./RagfairServerHelper"; import { TraderHelper } from "./TraderHelper"; export declare class QuestHelper { @@ -29,6 +30,7 @@ export declare class QuestHelper { protected timeUtil: TimeUtil; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; + protected questConditionHelper: QuestConditionHelper; protected eventOutputHolder: EventOutputHolder; protected databaseServer: DatabaseServer; protected localeService: LocaleService; @@ -41,7 +43,7 @@ export declare class QuestHelper { protected mailSendService: MailSendService; protected configServer: ConfigServer; 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, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, questConditionHelper: QuestConditionHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, mailSendService: MailSendService, configServer: ConfigServer); /** * Get status of a quest in player profile by its id * @param pmcData Profile to search @@ -119,7 +121,7 @@ export declare class QuestHelper { * @param sessionID Session id * @returns Quests accessible to player incuding newly unlocked quests now quest (startedQuestId) was started */ - acceptedUnlocked(startedQuestId: string, sessionID: string): IQuest[]; + getNewlyAccessibleQuestsWhenStartingQuest(startedQuestId: string, sessionID: string): IQuest[]; /** * Get quests that can be shown to player after failing a quest * @param failedQuestId Id of the quest failed by player diff --git a/TypeScript/18CustomItemService/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/18CustomItemService/types/helpers/RagfairOfferHelper.d.ts index de9d550..0699259 100644 --- a/TypeScript/18CustomItemService/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/18CustomItemService/types/helpers/RagfairOfferHelper.d.ts @@ -1,4 +1,5 @@ import { IPmcData } from "../models/eft/common/IPmcData"; +import { Item } from "../models/eft/common/tables/IItem"; import { ITraderAssort } from "../models/eft/common/tables/ITrader"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; @@ -13,10 +14,10 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { LocaleService } from "../services/LocaleService"; import { LocalisationService } from "../services/LocalisationService"; +import { MailSendService } from "../services/MailSendService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { HashUtil } from "../utils/HashUtil"; import { TimeUtil } from "../utils/TimeUtil"; -import { DialogueHelper } from "./DialogueHelper"; import { ItemHelper } from "./ItemHelper"; import { PaymentHelper } from "./PaymentHelper"; import { PresetHelper } from "./PresetHelper"; @@ -33,7 +34,6 @@ export declare class RagfairOfferHelper { protected databaseServer: DatabaseServer; protected traderHelper: TraderHelper; protected saveServer: SaveServer; - protected dialogueHelper: DialogueHelper; protected itemHelper: ItemHelper; protected paymentHelper: PaymentHelper; protected presetHelper: PresetHelper; @@ -44,11 +44,12 @@ export declare class RagfairOfferHelper { protected ragfairOfferService: RagfairOfferService; protected localeService: LocaleService; protected localisationService: LocalisationService; + protected mailSendService: MailSendService; protected configServer: ConfigServer; protected static goodSoldTemplate: string; protected ragfairConfig: IRagfairConfig; 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, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, localisationService: LocalisationService, mailSendService: MailSendService, configServer: ConfigServer); /** * Passthrough to ragfairOfferService.getOffers(), get flea offers a player should see * @param searchRequest Data from client @@ -119,19 +120,26 @@ export declare class RagfairOfferHelper { */ protected getProfileOffers(sessionID: string): IRagfairOffer[]; /** - * Delete an offer from a desired profile + * Delete an offer from a desired profile and from ragfair offers * @param sessionID Session id of profile to delete offer from - * @param offerId Offer id to delete + * @param offerId Id of offer to delete */ - protected deleteOfferByOfferId(sessionID: string, offerId: string): void; + protected deleteOfferById(sessionID: string, offerId: string): void; /** * Complete the selling of players' offer * @param sessionID Session id * @param offer Sold offer details * @param boughtAmount Amount item was purchased for - * @returns Client response + * @returns IItemEventRouterResponse */ protected completeOffer(sessionID: string, offer: IRagfairOffer, boughtAmount: number): IItemEventRouterResponse; + /** + * Get a localised message for when players offer has sold on flea + * @param itemTpl Item sold + * @param boughtAmount How many were purchased + * @returns Localised message text + */ + protected getLocalisedOfferSoldMessage(itemTpl: string, boughtAmount: number): string; /** * Should a ragfair offer be visible to the player * @param searchRequest Search request @@ -142,4 +150,12 @@ export declare class RagfairOfferHelper { * @returns True = should be shown to player */ isDisplayableOffer(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, offer: IRagfairOffer, pmcProfile: IPmcData): boolean; + /** + * Is items quality value within desired range + * @param item Item to check quality of + * @param min Desired minimum quality + * @param max Desired maximum quality + * @returns True if in range + */ + protected itemQualityInRange(item: Item, min: number, max: number): boolean; } diff --git a/TypeScript/18CustomItemService/types/helpers/RagfairSellHelper.d.ts b/TypeScript/18CustomItemService/types/helpers/RagfairSellHelper.d.ts index 251d7ca..913b408 100644 --- a/TypeScript/18CustomItemService/types/helpers/RagfairSellHelper.d.ts +++ b/TypeScript/18CustomItemService/types/helpers/RagfairSellHelper.d.ts @@ -13,12 +13,12 @@ export declare class RagfairSellHelper { constructor(logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, configServer: ConfigServer); /** * Get the percent chance to sell an item based on its average listed price vs player chosen listing price - * @param baseChancePercent Base chance to sell item * @param averageOfferPriceRub Price of average offer in roubles * @param playerListedPriceRub Price player listed item for in roubles + * @param qualityMultiplier Quality multipler of item being sold * @returns percent value */ - calculateSellChance(baseChancePercent: number, averageOfferPriceRub: number, playerListedPriceRub: number): number; + calculateSellChance(averageOfferPriceRub: number, playerListedPriceRub: number, qualityMultiplier: number): number; /** * Get percent chance to sell an item when price is below items average listing price * @param playerListedPriceRub Price player listed item for in roubles diff --git a/TypeScript/18CustomItemService/types/helpers/TraderHelper.d.ts b/TypeScript/18CustomItemService/types/helpers/TraderHelper.d.ts index c163f7a..6680ccf 100644 --- a/TypeScript/18CustomItemService/types/helpers/TraderHelper.d.ts +++ b/TypeScript/18CustomItemService/types/helpers/TraderHelper.d.ts @@ -35,7 +35,7 @@ export declare class TraderHelper { protected highestTraderBuyPriceItems: Record; constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, handbookHelper: HandbookHelper, itemHelper: ItemHelper, playerService: PlayerService, localisationService: LocalisationService, fenceService: FenceService, timeUtil: TimeUtil, randomUtil: RandomUtil, configServer: ConfigServer); getTrader(traderID: string, sessionID: string): ITraderBase; - getTraderAssortsById(traderId: string): ITraderAssort; + getTraderAssortsByTraderId(traderId: string): ITraderAssort; /** * 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 diff --git a/TypeScript/18CustomItemService/types/models/eft/common/tables/IBotBase.d.ts b/TypeScript/18CustomItemService/types/models/eft/common/tables/IBotBase.d.ts index ee40958..6c7b76f 100644 --- a/TypeScript/18CustomItemService/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/18CustomItemService/types/models/eft/common/tables/IBotBase.d.ts @@ -281,7 +281,7 @@ export interface InsuredItem { export interface Hideout { Production: Record; Areas: HideoutArea[]; - Improvements: Record; + Improvement: Record; Seed: number; sptUpdateLastRunTimestamp: number; } diff --git a/TypeScript/18CustomItemService/types/models/eft/health/IHealthTreatmentRequestData.d.ts b/TypeScript/18CustomItemService/types/models/eft/health/IHealthTreatmentRequestData.d.ts index 7fb80a8..598e60c 100644 --- a/TypeScript/18CustomItemService/types/models/eft/health/IHealthTreatmentRequestData.d.ts +++ b/TypeScript/18CustomItemService/types/models/eft/health/IHealthTreatmentRequestData.d.ts @@ -1,12 +1,14 @@ export interface IHealthTreatmentRequestData { Action: "RestoreHealth"; trader: string; - items: Item[]; + items: Cost[]; difference: Difference; timestamp: number; } -export interface Item { +export interface Cost { + /** Id of stack to take money from */ id: string; + /** Amount of money to take off player for treatment */ count: number; } export interface Difference { @@ -25,5 +27,6 @@ export interface BodyParts { } export interface BodyPart { Health: number; + /** Effects in array are to be removed */ Effects: string[]; } diff --git a/TypeScript/18CustomItemService/types/models/eft/notifier/INotifier.d.ts b/TypeScript/18CustomItemService/types/models/eft/notifier/INotifier.d.ts index ce25dee..c6c6979 100644 --- a/TypeScript/18CustomItemService/types/models/eft/notifier/INotifier.d.ts +++ b/TypeScript/18CustomItemService/types/models/eft/notifier/INotifier.d.ts @@ -14,6 +14,11 @@ export interface INotification { } export declare enum NotificationType { RAGFAIR_OFFER_SOLD = "RagfairOfferSold", + RAGFAIR_RATING_CHANGE = "RagfairRatingChange", + /** ChatMessageReceived */ NEW_MESSAGE = "new_message", - PING = "ping" + PING = "ping", + TRADER_SUPPLY = "TraderSupply", + TRADER_STANDING = "TraderStanding", + UNLOCK_TRADER = "UnlockTrader" } diff --git a/TypeScript/18CustomItemService/types/models/eft/notifier/ISelectProfileResponse.d.ts b/TypeScript/18CustomItemService/types/models/eft/notifier/ISelectProfileResponse.d.ts index ecb668a..f2d6be7 100644 --- a/TypeScript/18CustomItemService/types/models/eft/notifier/ISelectProfileResponse.d.ts +++ b/TypeScript/18CustomItemService/types/models/eft/notifier/ISelectProfileResponse.d.ts @@ -1,6 +1,3 @@ -import { INotifierChannel } from "./INotifier"; export interface ISelectProfileResponse { status: string; - notifier: INotifierChannel; - notifierServer: string; } diff --git a/TypeScript/18CustomItemService/types/models/enums/WeatherType.d.ts b/TypeScript/18CustomItemService/types/models/enums/WeatherType.d.ts index d31fefe..503dc30 100644 --- a/TypeScript/18CustomItemService/types/models/enums/WeatherType.d.ts +++ b/TypeScript/18CustomItemService/types/models/enums/WeatherType.d.ts @@ -1,19 +1,19 @@ export declare enum WeatherType { - CLEAR_DAY = 1, - CLEAR_WIND = 2, - CLEAR_NIGHT = 3, - PARTLY_CLOUD_DAY = 4, - PARTLY_CLOUD_NIGHT = 5, - CLEAR_FOG_DAY = 6, - CLEAR_FOG_NIGHT = 7, - CLOUDFOG = 8, - FOG = 9, - MOSTLY_CLOUD = 10, - LIGHT_RAIN = 11, - RAIN = 12, - CLOUD_WIND = 13, - CLOUD_WIND_RAIN = 14, - FULL_CLOUD = 15, - THUNDER_CLOUD = 16, - NONE = 0 + CLEAR_DAY = 0, + CLEAR_WIND = 1, + CLEAR_NIGHT = 2, + PARTLY_CLOUD_DAY = 3, + PARTLY_CLOUD_NIGHT = 4, + CLEAR_FOG_DAY = 5, + CLEAR_FOG_NIGHT = 6, + CLOUD_FOG = 7, + FOG = 8, + MOSTLY_CLOUD = 9, + LIGHT_RAIN = 10, + RAIN = 11, + CLOUD_WIND = 12, + CLOUD_WIND_RAIN = 13, + FULL_CLOUD = 14, + THUNDER_CLOUD = 15, + NONE = 16 } diff --git a/TypeScript/18CustomItemService/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/18CustomItemService/types/models/spt/config/IRagfairConfig.d.ts index 7c04857..7aea24f 100644 --- a/TypeScript/18CustomItemService/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/18CustomItemService/types/models/spt/config/IRagfairConfig.d.ts @@ -41,7 +41,8 @@ export interface Dynamic { /** Use the highest trader price for an offer if its greater than the price in templates/prices.json */ useTraderPriceForOffersIfHigher: boolean; /** Barter offer specific settings */ - barter: Barter; + barter: IBarterDetails; + pack: IPackDetails; /** Dynamic offer price below handbook adjustment values */ offerAdjustment: OfferAdjustment; /** How many offers should expire before an offer regeneration occurs */ @@ -49,9 +50,7 @@ export interface Dynamic { /** How many offers should be listed */ offerItemCount: MinMax; /** How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) */ - price: MinMax; - /** How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) */ - presetPrice: MinMax; + priceRanges: IPriceRanges; /** Should default presets to listed only or should non-standard presets found in globals.json be listed too */ showDefaultPresetsOnly: boolean; endTimeSeconds: MinMax; @@ -74,7 +73,12 @@ export interface Dynamic { /** Dict of price limits keyed by item type */ unreasonableModPrices: Record; } -export interface Barter { +export interface IPriceRanges { + default: MinMax; + preset: MinMax; + pack: MinMax; +} +export interface IBarterDetails { /** Should barter offers be generated */ enable: boolean; /** Percentage change an offer is listed as a barter */ @@ -90,6 +94,18 @@ export interface Barter { /** Item Tpls to never be turned into a barter */ itemTypeBlacklist: string[]; } +export interface IPackDetails { + /** Should pack offers be generated */ + enable: boolean; + /** Percentage change an offer is listed as a pack */ + chancePercent: number; + /** Min number of required items for a pack */ + itemCountMin: number; + /** Max number of required items for a pack */ + itemCountMax: number; + /** item types to allow being a pack */ + itemTypeWhitelist: string[]; +} export interface OfferAdjustment { /** Shuld offer price be adjusted when below handbook price */ adjustPriceWhenBelowHandbookPrice: boolean; diff --git a/TypeScript/18CustomItemService/types/models/spt/config/IWeatherConfig.d.ts b/TypeScript/18CustomItemService/types/models/spt/config/IWeatherConfig.d.ts index 41a1c83..6ecf35b 100644 --- a/TypeScript/18CustomItemService/types/models/spt/config/IWeatherConfig.d.ts +++ b/TypeScript/18CustomItemService/types/models/spt/config/IWeatherConfig.d.ts @@ -7,7 +7,7 @@ export interface IWeatherConfig extends IBaseConfig { weather: Weather; } export interface Weather { - clouds: MinMax; + clouds: WeatherSettings; windSpeed: WeatherSettings; windDirection: WeatherSettings; windGustiness: MinMax; diff --git a/TypeScript/18CustomItemService/types/services/HashCacheService.d.ts b/TypeScript/18CustomItemService/types/services/HashCacheService.d.ts index 5320f28..9968478 100644 --- a/TypeScript/18CustomItemService/types/services/HashCacheService.d.ts +++ b/TypeScript/18CustomItemService/types/services/HashCacheService.d.ts @@ -11,7 +11,18 @@ export declare class HashCacheService { protected modHashes: any; protected readonly modCachePath = "./user/cache/modCache.json"; constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); + /** + * Return a stored hash by key + * @param modName Name of mod to get hash for + * @returns Mod hash + */ getStoredModHash(modName: string): string; + /** + * Does the generated hash match the stored hash + * @param modName name of mod + * @param modContent + * @returns True if they match + */ modContentMatchesStoredHash(modName: string, modContent: string): boolean; hashMatchesStoredHash(modName: string, modHash: string): boolean; storeModContent(modName: string, modContent: string): void; diff --git a/TypeScript/18CustomItemService/types/services/MailSendService.d.ts b/TypeScript/18CustomItemService/types/services/MailSendService.d.ts index 19397dc..fe4a7fe 100644 --- a/TypeScript/18CustomItemService/types/services/MailSendService.d.ts +++ b/TypeScript/18CustomItemService/types/services/MailSendService.d.ts @@ -35,7 +35,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendDirectNpcMessageToPlayer(playerId: string, sender: Traders, messageType: MessageType, message: string, items?: Item[], maxStorageTimeSeconds?: any): void; + sendDirectNpcMessageToPlayer(playerId: string, sender: Traders, messageType: MessageType, message: string, items?: Item[], maxStorageTimeSeconds?: any, systemData?: any, ragfair?: any): void; /** * Send a message from an NPC (e.g. prapor) to the player with or without items * @param playerId Players id to send message to @@ -45,7 +45,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendLocalisedNpcMessageToPlayer(playerId: string, sender: Traders, messageType: MessageType, messageLocaleId: string, items?: Item[], maxStorageTimeSeconds?: any, systemData?: any): void; + sendLocalisedNpcMessageToPlayer(playerId: string, sender: Traders, messageType: MessageType, messageLocaleId: string, items?: Item[], maxStorageTimeSeconds?: any, systemData?: any, ragfair?: any): void; /** * Send a message from SYSTEM to the player with or without items * @param playerId Players id to send message to diff --git a/TypeScript/18CustomItemService/types/services/MatchBotDetailsCacheService.d.ts b/TypeScript/18CustomItemService/types/services/MatchBotDetailsCacheService.d.ts index eb365dd..c1bd322 100644 --- a/TypeScript/18CustomItemService/types/services/MatchBotDetailsCacheService.d.ts +++ b/TypeScript/18CustomItemService/types/services/MatchBotDetailsCacheService.d.ts @@ -1,7 +1,7 @@ import { IBotBase } from "../models/eft/common/tables/IBotBase"; import { ILogger } from "../models/spt/utils/ILogger"; import { LocalisationService } from "./LocalisationService"; -/** Cache bots in a dictionary, keyed by the bots name, keying by name isnt idea as its not unique but this is used by the post-raid system which doesnt have any bot ids, only name */ +/** Cache bots in a dictionary, keyed by the bots name, keying by name isnt ideal as its not unique but this is used by the post-raid system which doesnt have any bot ids, only name */ export declare class MatchBotDetailsCacheService { protected logger: ILogger; protected localisationService: LocalisationService; @@ -17,9 +17,9 @@ export declare class MatchBotDetailsCacheService { */ clearCache(): void; /** - * Find a bot in the cache by its name + * Find a bot in the cache by its name and side * @param botName Name of bot to find * @returns Bot details */ - getBotByName(botName: string): IBotBase; + getBotByNameAndSide(botName: string, botSide: string): IBotBase; } diff --git a/TypeScript/18CustomItemService/types/services/ModCompilerService.d.ts b/TypeScript/18CustomItemService/types/services/ModCompilerService.d.ts index a4bf3c8..e306177 100644 --- a/TypeScript/18CustomItemService/types/services/ModCompilerService.d.ts +++ b/TypeScript/18CustomItemService/types/services/ModCompilerService.d.ts @@ -1,14 +1,36 @@ import { CompilerOptions } from "typescript"; import type { ILogger } from "../models/spt/utils/ILogger"; -import { HashCacheService } from "./HashCacheService"; import { VFS } from "../utils/VFS"; +import { HashCacheService } from "./HashCacheService"; export declare class ModCompilerService { protected logger: ILogger; protected hashCacheService: HashCacheService; protected vfs: VFS; constructor(logger: ILogger, hashCacheService: HashCacheService, vfs: VFS); + /** + * Convert a mods TS into JS + * @param modName Name of mod + * @param modPath Dir path to mod + * @param modTypeScriptFiles + * @returns + */ compileMod(modName: string, modPath: string, modTypeScriptFiles: string[]): Promise; + /** + * Convert a TS file into JS + * @param fileNames Paths to TS files + * @param options Compiler options + */ protected compile(fileNames: string[], options: CompilerOptions): Promise; + /** + * Do the files at the provided paths exist + * @param fileNames + * @returns + */ protected areFilesReady(fileNames: string[]): boolean; + /** + * Wait the provided number of milliseconds + * @param ms Milliseconds + * @returns + */ protected delay(ms: number): Promise; } diff --git a/TypeScript/18CustomItemService/types/services/PaymentService.d.ts b/TypeScript/18CustomItemService/types/services/PaymentService.d.ts index 1c9c32b..fb5f92c 100644 --- a/TypeScript/18CustomItemService/types/services/PaymentService.d.ts +++ b/TypeScript/18CustomItemService/types/services/PaymentService.d.ts @@ -61,23 +61,26 @@ export declare class PaymentService { * Get all money stacks in inventory and prioritse items in stash * @param pmcData * @param currencyTpl + * @param playerStashId Players stash id * @returns Sorting money items */ - protected getSortedMoneyItemsInInventory(pmcData: IPmcData, currencyTpl: string): Item[]; + protected getSortedMoneyItemsInInventory(pmcData: IPmcData, currencyTpl: string, playerStashId: string): Item[]; /** * Prioritise player stash first over player inventory * Post-raid healing would often take money out of the players pockets/secure container * @param a First money stack item * @param b Second money stack item * @param inventoryItems players inventory items + * @param playerStashId Players stash id * @returns sort order */ - protected prioritiseStashSort(a: Item, b: Item, inventoryItems: Item[]): number; + protected prioritiseStashSort(a: Item, b: Item, inventoryItems: Item[], playerStashId: string): number; /** * Recursivly check items parents to see if it is inside the players inventory, not stash * @param itemId item id to check * @param inventoryItems player inventory + * @param playerStashId Players stash id * @returns true if its in inventory */ - protected isInInventory(itemId: string, inventoryItems: Item[]): boolean; + protected isInStash(itemId: string, inventoryItems: Item[], playerStashId: string): boolean; } diff --git a/TypeScript/18CustomItemService/types/services/ProfileFixerService.d.ts b/TypeScript/18CustomItemService/types/services/ProfileFixerService.d.ts index c8232fc..bc1e42e 100644 --- a/TypeScript/18CustomItemService/types/services/ProfileFixerService.d.ts +++ b/TypeScript/18CustomItemService/types/services/ProfileFixerService.d.ts @@ -14,6 +14,7 @@ import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; import { Watermark } from "../utils/Watermark"; import { LocalisationService } from "./LocalisationService"; @@ -27,17 +28,19 @@ export declare class ProfileFixerService { protected itemHelper: ItemHelper; protected localisationService: LocalisationService; protected timeUtil: TimeUtil; + protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, profileHelper: ProfileHelper, itemHelper: ItemHelper, localisationService: LocalisationService, timeUtil: TimeUtil, databaseServer: DatabaseServer, configServer: ConfigServer); + constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, profileHelper: ProfileHelper, itemHelper: ItemHelper, localisationService: LocalisationService, timeUtil: TimeUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, configServer: ConfigServer); /** * 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; protected addMissingGunStandContainerImprovements(pmcProfile: IPmcData): void; + protected ensureGunStandLevelsMatch(pmcProfile: IPmcData): void; protected addHideoutAreaStashes(pmcProfile: IPmcData): void; protected addMissingHideoutWallAreas(pmcProfile: IPmcData): void; protected adjustUnreasonableModFleaPrices(): void; @@ -131,4 +134,9 @@ export declare class ProfileFixerService { * @param pmcProfile Profile to add missing IDs to */ addMissingIdsToBonuses(pmcProfile: IPmcData): void; + /** + * At some point the property name was changed,migrate data across to new name + * @param pmcProfile + */ + protected migrateImprovements(pmcProfile: IPmcData): void; } diff --git a/TypeScript/18CustomItemService/types/services/RagfairPriceService.d.ts b/TypeScript/18CustomItemService/types/services/RagfairPriceService.d.ts index e245efa..ff35327 100644 --- a/TypeScript/18CustomItemService/types/services/RagfairPriceService.d.ts +++ b/TypeScript/18CustomItemService/types/services/RagfairPriceService.d.ts @@ -3,6 +3,7 @@ import { HandbookHelper } from "../helpers/HandbookHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { TraderHelper } from "../helpers/TraderHelper"; +import { MinMax } from "../models/common/MinMax"; import { IPreset } from "../models/eft/common/IGlobals"; import { Item } from "../models/eft/common/tables/IItem"; import { IBarterScheme } from "../models/eft/common/tables/ITrader"; @@ -35,10 +36,6 @@ export declare class RagfairPriceService implements OnLoad { * Generate static (handbook) and dynamic (prices.json) flea prices, store inside class as dictionaries */ onLoad(): Promise; - /** - * Add placeholder values for items missing from handbook - */ - protected addMissingHandbookPrices(): void; getRoute(): string; /** * Iterate over all items of type "Item" in db and get template price, store in cache @@ -91,9 +88,17 @@ export declare class RagfairPriceService implements OnLoad { * Generate a currency cost for an item and its mods * @param items Item with mods to get price for * @param desiredCurrency Currency price desired in + * @param isPackOffer Price is for a pack type offer * @returns cost of item in desired currency */ - getDynamicOfferPrice(items: Item[], desiredCurrency: string): number; + getDynamicOfferPriceForOffer(items: Item[], desiredCurrency: string, isPackOffer: boolean): number; + /** + * Get different min/max price multipliers for different offer types (preset/pack/default) + * @param isPreset Offer is a preset + * @param isPack Offer is a pack + * @returns MinMax values + */ + protected getOfferTypeRangeValues(isPreset: boolean, isPack: boolean): MinMax; /** * Check to see if an items price is below its handbook price and adjust accoring to values set to config/ragfair.json * @param itemPrice price of item @@ -104,10 +109,10 @@ export declare class RagfairPriceService implements OnLoad { /** * Multiply the price by a randomised curve where n = 2, shift = 2 * @param existingPrice price to alter - * @param isPreset is the item we're multiplying a preset + * @param rangeValues min and max to adjust price by * @returns multiplied price */ - protected randomisePrice(existingPrice: number, isPreset: boolean): number; + protected randomiseOfferPrice(existingPrice: number, rangeValues: MinMax): number; /** * Calculate the cost of a weapon preset by adding together the price of its mods + base price of default weapon preset * @param item base weapon diff --git a/TypeScript/1LogToConsole/types/callbacks/GameCallbacks.d.ts b/TypeScript/1LogToConsole/types/callbacks/GameCallbacks.d.ts index aa80036..46f79f9 100644 --- a/TypeScript/1LogToConsole/types/callbacks/GameCallbacks.d.ts +++ b/TypeScript/1LogToConsole/types/callbacks/GameCallbacks.d.ts @@ -1,4 +1,5 @@ import { GameController } from "../controllers/GameController"; +import { OnLoad } from "../di/OnLoad"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { ICheckVersionResponse } from "../models/eft/game/ICheckVersionResponse"; import { ICurrentGroupResponse } from "../models/eft/game/ICurrentGroupResponse"; @@ -15,12 +16,14 @@ import { INullResponseData } from "../models/eft/httpResponse/INullResponseData" import { SaveServer } from "../servers/SaveServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { Watermark } from "../utils/Watermark"; -declare class GameCallbacks { +declare class GameCallbacks implements OnLoad { protected httpResponse: HttpResponseUtil; protected watermark: Watermark; protected saveServer: SaveServer; protected gameController: GameController; constructor(httpResponse: HttpResponseUtil, watermark: Watermark, saveServer: SaveServer, gameController: GameController); + onLoad(): Promise; + getRoute(): string; /** * Handle client/game/version/validate * @returns INullResponseData diff --git a/TypeScript/1LogToConsole/types/controllers/GameController.d.ts b/TypeScript/1LogToConsole/types/controllers/GameController.d.ts index 04e3abb..e88610e 100644 --- a/TypeScript/1LogToConsole/types/controllers/GameController.d.ts +++ b/TypeScript/1LogToConsole/types/controllers/GameController.d.ts @@ -61,13 +61,14 @@ export declare class GameController { protected pmcConfig: IPmcConfig; protected lootConfig: ILootConfig; constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, randomUtil: RandomUtil, encodingUtil: EncodingUtil, hideoutHelper: HideoutHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, seasonalEventService: SeasonalEventService, itemBaseClassService: ItemBaseClassService, giftService: GiftService, applicationContext: ApplicationContext, configServer: ConfigServer); + load(): void; /** * Handle client/game/start */ gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; protected addCustomLooseLootPositions(): void; protected adjustLooseLootSpawnProbabilities(): void; - protected setHideoutAreasAndCraftsTo30Secs(): void; + protected setHideoutAreasAndCraftsTo40Secs(): void; /** * 3.7.0 moved AIDs to be numeric, old profiles need to be migrated * We store the old AID value in new field `sessionId` diff --git a/TypeScript/1LogToConsole/types/controllers/HealthController.d.ts b/TypeScript/1LogToConsole/types/controllers/HealthController.d.ts index 1938297..2d7ff09 100644 --- a/TypeScript/1LogToConsole/types/controllers/HealthController.d.ts +++ b/TypeScript/1LogToConsole/types/controllers/HealthController.d.ts @@ -29,34 +29,35 @@ export declare class HealthController { * stores in-raid player health * @param pmcData Player profile * @param info Request data - * @param sessionID + * @param sessionID Player id * @param addEffects Should effects found be added or removed from profile + * @param deleteExistingEffects Should all prior effects be removed before apply new ones */ saveVitality(pmcData: IPmcData, info: ISyncHealthRequestData, sessionID: string, addEffects?: boolean, deleteExistingEffects?: boolean): void; /** * When healing in menu - * @param pmcData - * @param body - * @param sessionID - * @returns + * @param pmcData Player profile + * @param request Healing request + * @param sessionID Player id + * @returns IItemEventRouterResponse */ - offraidHeal(pmcData: IPmcData, body: IOffraidHealRequestData, sessionID: string): IItemEventRouterResponse; + offraidHeal(pmcData: IPmcData, request: IOffraidHealRequestData, sessionID: string): IItemEventRouterResponse; /** * Handle Eat event * Consume food/water outside of a raid * @param pmcData Player profile - * @param body request Object + * @param request Eat request * @param sessionID Session id * @returns IItemEventRouterResponse */ - offraidEat(pmcData: IPmcData, body: IOffraidEatRequestData, sessionID: string): IItemEventRouterResponse; + offraidEat(pmcData: IPmcData, request: IOffraidEatRequestData, sessionID: string): IItemEventRouterResponse; /** * Handle RestoreHealth event * Occurs on post-raid healing page * @param pmcData player profile * @param healthTreatmentRequest Request data from client * @param sessionID Session id - * @returns + * @returns IItemEventRouterResponse */ healthTreatment(pmcData: IPmcData, healthTreatmentRequest: IHealthTreatmentRequestData, sessionID: string): IItemEventRouterResponse; /** @@ -66,12 +67,4 @@ export declare class HealthController { * @param sessionID */ applyWorkoutChanges(pmcData: IPmcData, info: IWorkoutData, sessionId: string): void; - /** - * Iterate over treatment request diff and find effects to remove from player limbs - * @param sessionId - * @param profile Profile to update - * @param treatmentRequest client request - * @param output response to send to client - */ - protected removeEffectsAfterPostRaidHeal(sessionId: string, profile: IPmcData, treatmentRequest: IHealthTreatmentRequestData, output: IItemEventRouterResponse): void; } diff --git a/TypeScript/1LogToConsole/types/controllers/HideoutController.d.ts b/TypeScript/1LogToConsole/types/controllers/HideoutController.d.ts index 877c076..a90a16d 100644 --- a/TypeScript/1LogToConsole/types/controllers/HideoutController.d.ts +++ b/TypeScript/1LogToConsole/types/controllers/HideoutController.d.ts @@ -88,11 +88,11 @@ export declare class HideoutController { * @param pmcData Profile to edit * @param output Object to send back to client * @param sessionID Session/player id - * @param profileHideoutArea Current hideout data for profile + * @param profileParentHideoutArea Current hideout area for profile * @param dbHideoutArea Hideout area being upgraded * @param hideoutStage Stage hideout area is being upgraded to */ - protected addContainerImprovementToProfile(output: IItemEventRouterResponse, sessionID: string, pmcData: IPmcData, profileHideoutArea: HideoutArea, dbHideoutArea: IHideoutArea, hideoutStage: Stage): void; + protected addContainerImprovementToProfile(output: IItemEventRouterResponse, sessionID: string, pmcData: IPmcData, profileParentHideoutArea: HideoutArea, dbHideoutArea: IHideoutArea, hideoutStage: Stage): void; /** * Add an inventory item to profile from a hideout area stage data * @param pmcData Profile to update diff --git a/TypeScript/1LogToConsole/types/controllers/LocationController.d.ts b/TypeScript/1LogToConsole/types/controllers/LocationController.d.ts index 94d496a..94f5fce 100644 --- a/TypeScript/1LogToConsole/types/controllers/LocationController.d.ts +++ b/TypeScript/1LogToConsole/types/controllers/LocationController.d.ts @@ -4,6 +4,7 @@ import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { ILocationBase } from "../models/eft/common/ILocationBase"; import { ILocationsGenerateAllResponse } from "../models/eft/common/ILocationsSourceDestinationBase"; import { IAirdropLootResult } from "../models/eft/location/IAirdropLootResult"; +import { IGetLocationRequestData } from "../models/eft/location/IGetLocationRequestData"; import { AirdropTypeEnum } from "../models/enums/AirdropType"; import { IAirdropConfig } from "../models/spt/config/IAirdropConfig"; import { ILocationConfig } from "../models/spt/config/ILocationConfig"; @@ -34,10 +35,11 @@ export declare class LocationController { /** * Handle client/location/getLocalloot * Get a location (map) with generated loot data - * @param location Map to generate loot for + * @param sessionId Player id + * @param request Map request to generate * @returns ILocationBase */ - get(location: string): ILocationBase; + get(sessionId: string, request: IGetLocationRequestData): ILocationBase; /** * Generate a maps base location with loot * @param name Map name diff --git a/TypeScript/1LogToConsole/types/controllers/QuestController.d.ts b/TypeScript/1LogToConsole/types/controllers/QuestController.d.ts index 7d494a6..bd8a70f 100644 --- a/TypeScript/1LogToConsole/types/controllers/QuestController.d.ts +++ b/TypeScript/1LogToConsole/types/controllers/QuestController.d.ts @@ -61,7 +61,7 @@ export declare class QuestController { * @param playerLevel level of player to test against quest * @returns true if quest can be seen/accepted by player of defined level */ - protected playerLevelFulfillsQuestRequrement(quest: IQuest, playerLevel: number): boolean; + protected playerLevelFulfillsQuestRequirement(quest: IQuest, playerLevel: number): boolean; /** * Should a quest be shown to the player in trader quest screen * @param questId Quest to check diff --git a/TypeScript/1LogToConsole/types/controllers/RagfairController.d.ts b/TypeScript/1LogToConsole/types/controllers/RagfairController.d.ts index 76c27f7..bda37cd 100644 --- a/TypeScript/1LogToConsole/types/controllers/RagfairController.d.ts +++ b/TypeScript/1LogToConsole/types/controllers/RagfairController.d.ts @@ -21,6 +21,7 @@ import { IGetMarketPriceRequestData } from "../models/eft/ragfair/IGetMarketPric import { IGetOffersResult } from "../models/eft/ragfair/IGetOffersResult"; import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; import { ISearchRequestData } from "../models/eft/ragfair/ISearchRequestData"; +import { IProcessBuyTradeRequestData } from "../models/eft/trade/IProcessBuyTradeRequestData"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; @@ -125,6 +126,18 @@ export declare class RagfairController { * @returns IItemEventRouterResponse */ addPlayerOffer(pmcData: IPmcData, offerRequest: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Charge player a listing fee for using flea, pulls charge from data previously sent by client + * @param sessionID Player id + * @param rootItem Base item being listed (used when client tax cost not found and must be done on server) + * @param pmcData Player profile + * @param requirementsPriceInRub Rouble cost player chose for listing (used when client tax cost not found and must be done on server) + * @param itemStackCount How many items were listed in player (used when client tax cost not found and must be done on server) + * @param offerRequest Add offer request object from client + * @param output IItemEventRouterResponse + * @returns True if charging tax to player failed + */ + protected chargePlayerTaxFee(sessionID: string, rootItem: Item, pmcData: IPmcData, requirementsPriceInRub: number, itemStackCount: number, offerRequest: IAddOfferRequestData, output: IItemEventRouterResponse): boolean; /** * Is the item to be listed on the flea valid * @param offerRequest Client offer request @@ -158,4 +171,11 @@ export declare class RagfairController { */ removeOffer(offerId: string, sessionID: string): IItemEventRouterResponse; extendOffer(info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Create a basic trader request object with price and currency type + * @param currency What currency: RUB, EURO, USD + * @param value Amount of currency + * @returns IProcessBuyTradeRequestData + */ + protected createBuyTradeRequestObject(currency: string, value: number): IProcessBuyTradeRequestData; } diff --git a/TypeScript/1LogToConsole/types/generators/BotEquipmentModGenerator.d.ts b/TypeScript/1LogToConsole/types/generators/BotEquipmentModGenerator.d.ts index ccbbbbf..f7abb84 100644 --- a/TypeScript/1LogToConsole/types/generators/BotEquipmentModGenerator.d.ts +++ b/TypeScript/1LogToConsole/types/generators/BotEquipmentModGenerator.d.ts @@ -14,7 +14,6 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; import { BotEquipmentModPoolService } from "../services/BotEquipmentModPoolService"; import { BotModLimits, BotWeaponModLimitService } from "../services/BotWeaponModLimitService"; -import { ItemBaseClassService } from "../services/ItemBaseClassService"; import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; @@ -29,7 +28,6 @@ export declare class BotEquipmentModGenerator { protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; protected botEquipmentFilterService: BotEquipmentFilterService; - protected itemBaseClassService: ItemBaseClassService; protected itemFilterService: ItemFilterService; protected profileHelper: ProfileHelper; protected botWeaponModLimitService: BotWeaponModLimitService; @@ -40,7 +38,7 @@ export declare class BotEquipmentModGenerator { protected botEquipmentModPoolService: BotEquipmentModPoolService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, itemHelper: ItemHelper, botEquipmentFilterService: BotEquipmentFilterService, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponModLimitService: BotWeaponModLimitService, botHelper: BotHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, botEquipmentModPoolService: BotEquipmentModPoolService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, itemHelper: ItemHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponModLimitService: BotWeaponModLimitService, botHelper: BotHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, botEquipmentModPoolService: BotEquipmentModPoolService, configServer: ConfigServer); /** * Check mods are compatible and add to array * @param equipment Equipment item to add mods to diff --git a/TypeScript/1LogToConsole/types/generators/LocationGenerator.d.ts b/TypeScript/1LogToConsole/types/generators/LocationGenerator.d.ts index b8169d3..46a514b 100644 --- a/TypeScript/1LogToConsole/types/generators/LocationGenerator.d.ts +++ b/TypeScript/1LogToConsole/types/generators/LocationGenerator.d.ts @@ -65,10 +65,11 @@ export declare class LocationGenerator { protected getGuaranteedContainers(staticContainersOnMap: IStaticContainerData[]): IStaticContainerData[]; /** * Choose a number of containers based on their probabilty value to fulfil the desired count in containerData.chosenCount + * @param groupId Name of the group the containers are being collected for * @param containerData Containers and probability values for a groupId * @returns List of chosen container Ids */ - protected getContainersByProbabilty(containerData: IContainerGroupCount): string[]; + protected getContainersByProbabilty(groupId: string, containerData: IContainerGroupCount): string[]; /** * Get a mapping of each groupid and the containers in that group + count of containers to spawn on map * @param containersGroups Container group values diff --git a/TypeScript/1LogToConsole/types/generators/PMCLootGenerator.d.ts b/TypeScript/1LogToConsole/types/generators/PMCLootGenerator.d.ts index 9acff69..abb5615 100644 --- a/TypeScript/1LogToConsole/types/generators/PMCLootGenerator.d.ts +++ b/TypeScript/1LogToConsole/types/generators/PMCLootGenerator.d.ts @@ -31,12 +31,12 @@ export declare class PMCLootGenerator { */ generatePMCVestLootPool(): string[]; /** - * Check if item has a width/height that lets it fit into a 1x2/2x1 slot - * 1x1 / 1x2 / 2x1 + * Check if item has a width/height that lets it fit into a 2x2 slot + * 1x1 / 1x2 / 2x1 / 2x2 * @param item Item to check size of * @returns true if it fits */ - protected itemFitsInto1By2Slot(item: ITemplateItem): boolean; + protected itemFitsInto2By2Slot(item: ITemplateItem): boolean; /** * Create an array of loot items a PMC can have in their backpack * @returns string array of tpls diff --git a/TypeScript/1LogToConsole/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/1LogToConsole/types/generators/RagfairOfferGenerator.d.ts index a627191..58e0b68 100644 --- a/TypeScript/1LogToConsole/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/1LogToConsole/types/generators/RagfairOfferGenerator.d.ts @@ -55,11 +55,10 @@ export declare class RagfairOfferGenerator { * @param items Items in the offer * @param barterScheme Cost of item (currency or barter) * @param loyalLevel Loyalty level needed to buy item - * @param price Price of offer - * @param sellInOnePiece Set StackObjectsCount to 1 + * @param sellInOnePiece Flags sellInOnePiece to be true * @returns IRagfairOffer */ - createFleaOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; + createFleaOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, sellInOnePiece?: boolean): IRagfairOffer; /** * Create an offer object ready to send to ragfairOfferService.addOffer() * @param userID Owner of the offer @@ -67,17 +66,16 @@ export declare class RagfairOfferGenerator { * @param items Items in the offer * @param barterScheme Cost of item (currency or barter) * @param loyalLevel Loyalty level needed to buy item - * @param price Price of offer * @param sellInOnePiece Set StackObjectsCount to 1 * @returns IRagfairOffer */ - protected createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; + protected createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, sellInOnePiece?: boolean): IRagfairOffer; /** * Calculate the offer price that's listed on the flea listing * @param offerRequirements barter requirements for offer * @returns rouble cost of offer */ - protected calculateOfferListingPrice(offerRequirements: OfferRequirement[]): number; + protected convertOfferRequirementsIntoRoubles(offerRequirements: OfferRequirement[]): number; /** * Get avatar url from trader table in db * @param isTrader Is user we're getting avatar for a trader @@ -137,7 +135,7 @@ export declare class RagfairOfferGenerator { * @param itemDetails raw db item details * @returns Item array */ - protected createSingleOfferForItem(items: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; + protected createSingleOfferForItem(items: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; /** * Generate trader offers on flea using the traders assort data * @param traderID Trader to generate offers for @@ -151,7 +149,7 @@ export declare class RagfairOfferGenerator { * @param itemDetails db details of first item * @returns */ - protected getItemCondition(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): Item[]; + protected randomiseItemUpdProperties(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): Item[]; /** * Get the relevant condition id if item tpl matches in ragfair.json/condition * @param tpl Item to look for matching condition object @@ -184,7 +182,7 @@ export declare class RagfairOfferGenerator { * @param offerItems Items for sale in offer * @returns Barter scheme */ - protected createBarterRequirement(offerItems: Item[]): IBarterScheme[]; + protected createBarterBarterScheme(offerItems: Item[]): IBarterScheme[]; /** * Get an array of flea prices + item tpl, cached in generator class inside `allowedFleaPriceItemsForBarter` * @returns array with tpl/price values @@ -196,7 +194,9 @@ export declare class RagfairOfferGenerator { /** * Create a random currency-based barter scheme for an array of items * @param offerItems Items on offer + * @param isPackOffer Is the barter scheme being created for a pack offer + * @param multipler What to multiply the resulting price by * @returns Barter scheme for offer */ - protected createCurrencyRequirement(offerItems: Item[]): IBarterScheme[]; + protected createCurrencyBarterScheme(offerItems: Item[], isPackOffer: boolean, multipler?: number): IBarterScheme[]; } diff --git a/TypeScript/1LogToConsole/types/generators/ScavCaseRewardGenerator.d.ts b/TypeScript/1LogToConsole/types/generators/ScavCaseRewardGenerator.d.ts index 4ba1888..b5935d0 100644 --- a/TypeScript/1LogToConsole/types/generators/ScavCaseRewardGenerator.d.ts +++ b/TypeScript/1LogToConsole/types/generators/ScavCaseRewardGenerator.d.ts @@ -25,6 +25,8 @@ export declare class ScavCaseRewardGenerator { protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected scavCaseConfig: IScavCaseConfig; + protected dbItemsCache: ITemplateItem[]; + protected dbAmmoItemsCache: ITemplateItem[]; constructor(logger: ILogger, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * Create an array of rewards that will be given to the player upon completing their scav case build @@ -33,10 +35,10 @@ export declare class ScavCaseRewardGenerator { */ generate(recipeId: string): Product[]; /** - * Get all db items that are not blacklisted in scavcase config - * @returns filtered array of db items + * Get all db items that are not blacklisted in scavcase config or global blacklist + * Store in class field */ - protected getDbItems(): ITemplateItem[]; + protected cacheDbItems(): void; /** * Pick a number of items to be rewards, the count is defined by the values in * @param items item pool to pick rewards from diff --git a/TypeScript/1LogToConsole/types/generators/WeatherGenerator.d.ts b/TypeScript/1LogToConsole/types/generators/WeatherGenerator.d.ts index 2e2403c..6471bb1 100644 --- a/TypeScript/1LogToConsole/types/generators/WeatherGenerator.d.ts +++ b/TypeScript/1LogToConsole/types/generators/WeatherGenerator.d.ts @@ -52,6 +52,7 @@ export declare class WeatherGenerator { */ protected setCurrentDateTime(weather: IWeather): void; protected getWeightedWindDirection(): WindDirection; + protected getWeightedClouds(): number; protected getWeightedWindSpeed(): number; protected getWeightedFog(): number; protected getWeightedRain(): number; diff --git a/TypeScript/1LogToConsole/types/helpers/HealthHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/HealthHelper.d.ts index 3694a6e..e4cdcd6 100644 --- a/TypeScript/1LogToConsole/types/helpers/HealthHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/HealthHelper.d.ts @@ -27,6 +27,7 @@ export declare class HealthHelper { * @param request Heal request * @param sessionID Session id * @param addEffects Should effects be added or removed (default - add) + * @param deleteExistingEffects Should all prior effects be removed before apply new ones */ saveVitality(pmcData: IPmcData, request: ISyncHealthRequestData, sessionID: string, addEffects?: boolean, deleteExistingEffects?: boolean): void; /** diff --git a/TypeScript/1LogToConsole/types/helpers/InRaidHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/InRaidHelper.d.ts index bf584c2..b4c0c1c 100644 --- a/TypeScript/1LogToConsole/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/InRaidHelper.d.ts @@ -53,7 +53,7 @@ export declare class InRaidHelper { * @param victim Who was killed by player * @returns a numerical standing gain or loss */ - protected getStandingChangeForKill(victim: Victim): number; + protected getFenceStandingChangeForKillAsScav(victim: Victim): number; /** * Reset a profile to a baseline, used post-raid * Reset points earned during session property diff --git a/TypeScript/1LogToConsole/types/helpers/ItemHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/ItemHelper.d.ts index 99fca56..00f190f 100644 --- a/TypeScript/1LogToConsole/types/helpers/ItemHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/ItemHelper.d.ts @@ -26,6 +26,7 @@ declare class ItemHelper { protected itemBaseClassService: ItemBaseClassService; protected localisationService: LocalisationService; protected localeService: LocaleService; + protected readonly defaultInvalidBaseTypes: string[]; constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, localisationService: LocalisationService, localeService: LocaleService); /** * Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash @@ -67,6 +68,11 @@ declare class ItemHelper { * @returns Price in roubles (undefined if not found) */ getDynamicItemPrice(tpl: string): number; + /** + * Update items upd.StackObjectsCount to be 1 if its upd is missing or StackObjectsCount is undefined + * @param item Item to update + * @returns Fixed item + */ fixItemStackCount(item: Item): Item; /** * AmmoBoxes contain StackSlots which need to be filled for the AmmoBox to have content. @@ -125,19 +131,19 @@ declare class ItemHelper { getItemQualityModifier(item: Item): number; /** * Get a quality value based on a repairable items (weapon/armor) current state between current and max durability - * @param itemDetails - * @param repairable repairable object - * @param item - * @returns a number between 0 and 1 + * @param itemDetails Db details for item we want quality value for + * @param repairable Repairable properties + * @param item Item quality value is for + * @returns A number between 0 and 1 */ protected getRepairableItemQualityValue(itemDetails: ITemplateItem, repairable: Repairable, item: Item): number; /** * Recursive function that looks at every item from parameter and gets their childrens Ids + includes parent item in results - * @param items - * @param itemID + * @param items Array of items (item + possible children) + * @param itemId Parent items id * @returns an array of strings */ - findAndReturnChildrenByItems(items: Item[], itemID: string): string[]; + findAndReturnChildrenByItems(items: Item[], itemId: string): string[]; /** * A variant of findAndReturnChildren where the output is list of item objects instead of their ids. * @param items @@ -164,12 +170,6 @@ declare class ItemHelper { * @returns true if it is a dogtag */ isDogtag(tpl: string): boolean; - /** - * Can the item passed in be sold to a trader because it is raw money - * @param tpl Item template id to check - * @returns true if unsellable - */ - isNotSellable(tpl: string): boolean; /** * Gets the identifier for a child using slotId, locationX and locationY. * @param item @@ -183,19 +183,19 @@ declare class ItemHelper { */ isItemTplStackable(tpl: string): boolean; /** - * split item stack if it exceeds its StackMaxSize property - * @param itemToSplit item being split into smaller stacks + * split item stack if it exceeds its items StackMaxSize property + * @param itemToSplit Item to split into smaller stacks * @returns Array of split items */ splitStack(itemToSplit: Item): Item[]; /** - * Find Barter items in the inventory + * Find Barter items from array of items * @param {string} by tpl or id - * @param {Object} pmcData + * @param {Item[]} items Array of items to iterate over * @param {string} barterItemId * @returns Array of Item objects */ - findBarterItems(by: "tpl" | "id", pmcData: IPmcData, barterItemId: string): Item[]; + findBarterItems(by: "tpl" | "id", items: Item[], barterItemId: string): Item[]; /** * Regenerate all guids with new ids, exceptions are for items that cannot be altered (e.g. stash/sorting table) * @param pmcData Player profile @@ -262,10 +262,21 @@ declare class ItemHelper { * @param minSizePercent % the magazine must be filled to */ fillMagazineWithCartridge(magazine: Item[], magTemplate: ITemplateItem, cartridgeTpl: string, minSizePercent?: number): void; + /** + * Choose a random bullet type from the list of possible a magazine has + * @param magTemplate Magazine template from Db + * @returns Tpl of cartridge + */ protected getRandomValidCaliber(magTemplate: ITemplateItem): string; + /** + * Chose a randomly weighted cartridge that fits + * @param caliber Desired caliber + * @param staticAmmoDist Cartridges and thier weights + * @returns Tpl of cartrdige + */ protected drawAmmoTpl(caliber: string, staticAmmoDist: Record): string; /** - * + * Create a basic cartrige object * @param parentId container cartridges will be placed in * @param ammoTpl Cartridge to insert * @param stackCount Count of cartridges inside parent diff --git a/TypeScript/1LogToConsole/types/helpers/QuestHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/QuestHelper.d.ts index e04b6e0..5c749d3 100644 --- a/TypeScript/1LogToConsole/types/helpers/QuestHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/QuestHelper.d.ts @@ -21,6 +21,7 @@ import { DialogueHelper } from "./DialogueHelper"; import { ItemHelper } from "./ItemHelper"; import { PaymentHelper } from "./PaymentHelper"; import { ProfileHelper } from "./ProfileHelper"; +import { QuestConditionHelper } from "./QuestConditionHelper"; import { RagfairServerHelper } from "./RagfairServerHelper"; import { TraderHelper } from "./TraderHelper"; export declare class QuestHelper { @@ -29,6 +30,7 @@ export declare class QuestHelper { protected timeUtil: TimeUtil; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; + protected questConditionHelper: QuestConditionHelper; protected eventOutputHolder: EventOutputHolder; protected databaseServer: DatabaseServer; protected localeService: LocaleService; @@ -41,7 +43,7 @@ export declare class QuestHelper { protected mailSendService: MailSendService; protected configServer: ConfigServer; 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, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, questConditionHelper: QuestConditionHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, mailSendService: MailSendService, configServer: ConfigServer); /** * Get status of a quest in player profile by its id * @param pmcData Profile to search @@ -119,7 +121,7 @@ export declare class QuestHelper { * @param sessionID Session id * @returns Quests accessible to player incuding newly unlocked quests now quest (startedQuestId) was started */ - acceptedUnlocked(startedQuestId: string, sessionID: string): IQuest[]; + getNewlyAccessibleQuestsWhenStartingQuest(startedQuestId: string, sessionID: string): IQuest[]; /** * Get quests that can be shown to player after failing a quest * @param failedQuestId Id of the quest failed by player diff --git a/TypeScript/1LogToConsole/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/RagfairOfferHelper.d.ts index de9d550..0699259 100644 --- a/TypeScript/1LogToConsole/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/RagfairOfferHelper.d.ts @@ -1,4 +1,5 @@ import { IPmcData } from "../models/eft/common/IPmcData"; +import { Item } from "../models/eft/common/tables/IItem"; import { ITraderAssort } from "../models/eft/common/tables/ITrader"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; @@ -13,10 +14,10 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { LocaleService } from "../services/LocaleService"; import { LocalisationService } from "../services/LocalisationService"; +import { MailSendService } from "../services/MailSendService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { HashUtil } from "../utils/HashUtil"; import { TimeUtil } from "../utils/TimeUtil"; -import { DialogueHelper } from "./DialogueHelper"; import { ItemHelper } from "./ItemHelper"; import { PaymentHelper } from "./PaymentHelper"; import { PresetHelper } from "./PresetHelper"; @@ -33,7 +34,6 @@ export declare class RagfairOfferHelper { protected databaseServer: DatabaseServer; protected traderHelper: TraderHelper; protected saveServer: SaveServer; - protected dialogueHelper: DialogueHelper; protected itemHelper: ItemHelper; protected paymentHelper: PaymentHelper; protected presetHelper: PresetHelper; @@ -44,11 +44,12 @@ export declare class RagfairOfferHelper { protected ragfairOfferService: RagfairOfferService; protected localeService: LocaleService; protected localisationService: LocalisationService; + protected mailSendService: MailSendService; protected configServer: ConfigServer; protected static goodSoldTemplate: string; protected ragfairConfig: IRagfairConfig; 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, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, localisationService: LocalisationService, mailSendService: MailSendService, configServer: ConfigServer); /** * Passthrough to ragfairOfferService.getOffers(), get flea offers a player should see * @param searchRequest Data from client @@ -119,19 +120,26 @@ export declare class RagfairOfferHelper { */ protected getProfileOffers(sessionID: string): IRagfairOffer[]; /** - * Delete an offer from a desired profile + * Delete an offer from a desired profile and from ragfair offers * @param sessionID Session id of profile to delete offer from - * @param offerId Offer id to delete + * @param offerId Id of offer to delete */ - protected deleteOfferByOfferId(sessionID: string, offerId: string): void; + protected deleteOfferById(sessionID: string, offerId: string): void; /** * Complete the selling of players' offer * @param sessionID Session id * @param offer Sold offer details * @param boughtAmount Amount item was purchased for - * @returns Client response + * @returns IItemEventRouterResponse */ protected completeOffer(sessionID: string, offer: IRagfairOffer, boughtAmount: number): IItemEventRouterResponse; + /** + * Get a localised message for when players offer has sold on flea + * @param itemTpl Item sold + * @param boughtAmount How many were purchased + * @returns Localised message text + */ + protected getLocalisedOfferSoldMessage(itemTpl: string, boughtAmount: number): string; /** * Should a ragfair offer be visible to the player * @param searchRequest Search request @@ -142,4 +150,12 @@ export declare class RagfairOfferHelper { * @returns True = should be shown to player */ isDisplayableOffer(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, offer: IRagfairOffer, pmcProfile: IPmcData): boolean; + /** + * Is items quality value within desired range + * @param item Item to check quality of + * @param min Desired minimum quality + * @param max Desired maximum quality + * @returns True if in range + */ + protected itemQualityInRange(item: Item, min: number, max: number): boolean; } diff --git a/TypeScript/1LogToConsole/types/helpers/RagfairSellHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/RagfairSellHelper.d.ts index 251d7ca..913b408 100644 --- a/TypeScript/1LogToConsole/types/helpers/RagfairSellHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/RagfairSellHelper.d.ts @@ -13,12 +13,12 @@ export declare class RagfairSellHelper { constructor(logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, configServer: ConfigServer); /** * Get the percent chance to sell an item based on its average listed price vs player chosen listing price - * @param baseChancePercent Base chance to sell item * @param averageOfferPriceRub Price of average offer in roubles * @param playerListedPriceRub Price player listed item for in roubles + * @param qualityMultiplier Quality multipler of item being sold * @returns percent value */ - calculateSellChance(baseChancePercent: number, averageOfferPriceRub: number, playerListedPriceRub: number): number; + calculateSellChance(averageOfferPriceRub: number, playerListedPriceRub: number, qualityMultiplier: number): number; /** * Get percent chance to sell an item when price is below items average listing price * @param playerListedPriceRub Price player listed item for in roubles diff --git a/TypeScript/1LogToConsole/types/helpers/TraderHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/TraderHelper.d.ts index c163f7a..6680ccf 100644 --- a/TypeScript/1LogToConsole/types/helpers/TraderHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/TraderHelper.d.ts @@ -35,7 +35,7 @@ export declare class TraderHelper { protected highestTraderBuyPriceItems: Record; constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, handbookHelper: HandbookHelper, itemHelper: ItemHelper, playerService: PlayerService, localisationService: LocalisationService, fenceService: FenceService, timeUtil: TimeUtil, randomUtil: RandomUtil, configServer: ConfigServer); getTrader(traderID: string, sessionID: string): ITraderBase; - getTraderAssortsById(traderId: string): ITraderAssort; + getTraderAssortsByTraderId(traderId: string): ITraderAssort; /** * 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 diff --git a/TypeScript/1LogToConsole/types/models/eft/common/tables/IBotBase.d.ts b/TypeScript/1LogToConsole/types/models/eft/common/tables/IBotBase.d.ts index ee40958..6c7b76f 100644 --- a/TypeScript/1LogToConsole/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/1LogToConsole/types/models/eft/common/tables/IBotBase.d.ts @@ -281,7 +281,7 @@ export interface InsuredItem { export interface Hideout { Production: Record; Areas: HideoutArea[]; - Improvements: Record; + Improvement: Record; Seed: number; sptUpdateLastRunTimestamp: number; } diff --git a/TypeScript/1LogToConsole/types/models/eft/health/IHealthTreatmentRequestData.d.ts b/TypeScript/1LogToConsole/types/models/eft/health/IHealthTreatmentRequestData.d.ts index 7fb80a8..598e60c 100644 --- a/TypeScript/1LogToConsole/types/models/eft/health/IHealthTreatmentRequestData.d.ts +++ b/TypeScript/1LogToConsole/types/models/eft/health/IHealthTreatmentRequestData.d.ts @@ -1,12 +1,14 @@ export interface IHealthTreatmentRequestData { Action: "RestoreHealth"; trader: string; - items: Item[]; + items: Cost[]; difference: Difference; timestamp: number; } -export interface Item { +export interface Cost { + /** Id of stack to take money from */ id: string; + /** Amount of money to take off player for treatment */ count: number; } export interface Difference { @@ -25,5 +27,6 @@ export interface BodyParts { } export interface BodyPart { Health: number; + /** Effects in array are to be removed */ Effects: string[]; } diff --git a/TypeScript/1LogToConsole/types/models/eft/notifier/INotifier.d.ts b/TypeScript/1LogToConsole/types/models/eft/notifier/INotifier.d.ts index ce25dee..c6c6979 100644 --- a/TypeScript/1LogToConsole/types/models/eft/notifier/INotifier.d.ts +++ b/TypeScript/1LogToConsole/types/models/eft/notifier/INotifier.d.ts @@ -14,6 +14,11 @@ export interface INotification { } export declare enum NotificationType { RAGFAIR_OFFER_SOLD = "RagfairOfferSold", + RAGFAIR_RATING_CHANGE = "RagfairRatingChange", + /** ChatMessageReceived */ NEW_MESSAGE = "new_message", - PING = "ping" + PING = "ping", + TRADER_SUPPLY = "TraderSupply", + TRADER_STANDING = "TraderStanding", + UNLOCK_TRADER = "UnlockTrader" } diff --git a/TypeScript/1LogToConsole/types/models/eft/notifier/ISelectProfileResponse.d.ts b/TypeScript/1LogToConsole/types/models/eft/notifier/ISelectProfileResponse.d.ts index ecb668a..f2d6be7 100644 --- a/TypeScript/1LogToConsole/types/models/eft/notifier/ISelectProfileResponse.d.ts +++ b/TypeScript/1LogToConsole/types/models/eft/notifier/ISelectProfileResponse.d.ts @@ -1,6 +1,3 @@ -import { INotifierChannel } from "./INotifier"; export interface ISelectProfileResponse { status: string; - notifier: INotifierChannel; - notifierServer: string; } diff --git a/TypeScript/1LogToConsole/types/models/enums/WeatherType.d.ts b/TypeScript/1LogToConsole/types/models/enums/WeatherType.d.ts index d31fefe..503dc30 100644 --- a/TypeScript/1LogToConsole/types/models/enums/WeatherType.d.ts +++ b/TypeScript/1LogToConsole/types/models/enums/WeatherType.d.ts @@ -1,19 +1,19 @@ export declare enum WeatherType { - CLEAR_DAY = 1, - CLEAR_WIND = 2, - CLEAR_NIGHT = 3, - PARTLY_CLOUD_DAY = 4, - PARTLY_CLOUD_NIGHT = 5, - CLEAR_FOG_DAY = 6, - CLEAR_FOG_NIGHT = 7, - CLOUDFOG = 8, - FOG = 9, - MOSTLY_CLOUD = 10, - LIGHT_RAIN = 11, - RAIN = 12, - CLOUD_WIND = 13, - CLOUD_WIND_RAIN = 14, - FULL_CLOUD = 15, - THUNDER_CLOUD = 16, - NONE = 0 + CLEAR_DAY = 0, + CLEAR_WIND = 1, + CLEAR_NIGHT = 2, + PARTLY_CLOUD_DAY = 3, + PARTLY_CLOUD_NIGHT = 4, + CLEAR_FOG_DAY = 5, + CLEAR_FOG_NIGHT = 6, + CLOUD_FOG = 7, + FOG = 8, + MOSTLY_CLOUD = 9, + LIGHT_RAIN = 10, + RAIN = 11, + CLOUD_WIND = 12, + CLOUD_WIND_RAIN = 13, + FULL_CLOUD = 14, + THUNDER_CLOUD = 15, + NONE = 16 } diff --git a/TypeScript/1LogToConsole/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/1LogToConsole/types/models/spt/config/IRagfairConfig.d.ts index 7c04857..7aea24f 100644 --- a/TypeScript/1LogToConsole/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/1LogToConsole/types/models/spt/config/IRagfairConfig.d.ts @@ -41,7 +41,8 @@ export interface Dynamic { /** Use the highest trader price for an offer if its greater than the price in templates/prices.json */ useTraderPriceForOffersIfHigher: boolean; /** Barter offer specific settings */ - barter: Barter; + barter: IBarterDetails; + pack: IPackDetails; /** Dynamic offer price below handbook adjustment values */ offerAdjustment: OfferAdjustment; /** How many offers should expire before an offer regeneration occurs */ @@ -49,9 +50,7 @@ export interface Dynamic { /** How many offers should be listed */ offerItemCount: MinMax; /** How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) */ - price: MinMax; - /** How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) */ - presetPrice: MinMax; + priceRanges: IPriceRanges; /** Should default presets to listed only or should non-standard presets found in globals.json be listed too */ showDefaultPresetsOnly: boolean; endTimeSeconds: MinMax; @@ -74,7 +73,12 @@ export interface Dynamic { /** Dict of price limits keyed by item type */ unreasonableModPrices: Record; } -export interface Barter { +export interface IPriceRanges { + default: MinMax; + preset: MinMax; + pack: MinMax; +} +export interface IBarterDetails { /** Should barter offers be generated */ enable: boolean; /** Percentage change an offer is listed as a barter */ @@ -90,6 +94,18 @@ export interface Barter { /** Item Tpls to never be turned into a barter */ itemTypeBlacklist: string[]; } +export interface IPackDetails { + /** Should pack offers be generated */ + enable: boolean; + /** Percentage change an offer is listed as a pack */ + chancePercent: number; + /** Min number of required items for a pack */ + itemCountMin: number; + /** Max number of required items for a pack */ + itemCountMax: number; + /** item types to allow being a pack */ + itemTypeWhitelist: string[]; +} export interface OfferAdjustment { /** Shuld offer price be adjusted when below handbook price */ adjustPriceWhenBelowHandbookPrice: boolean; diff --git a/TypeScript/1LogToConsole/types/models/spt/config/IWeatherConfig.d.ts b/TypeScript/1LogToConsole/types/models/spt/config/IWeatherConfig.d.ts index 41a1c83..6ecf35b 100644 --- a/TypeScript/1LogToConsole/types/models/spt/config/IWeatherConfig.d.ts +++ b/TypeScript/1LogToConsole/types/models/spt/config/IWeatherConfig.d.ts @@ -7,7 +7,7 @@ export interface IWeatherConfig extends IBaseConfig { weather: Weather; } export interface Weather { - clouds: MinMax; + clouds: WeatherSettings; windSpeed: WeatherSettings; windDirection: WeatherSettings; windGustiness: MinMax; diff --git a/TypeScript/1LogToConsole/types/services/HashCacheService.d.ts b/TypeScript/1LogToConsole/types/services/HashCacheService.d.ts index 5320f28..9968478 100644 --- a/TypeScript/1LogToConsole/types/services/HashCacheService.d.ts +++ b/TypeScript/1LogToConsole/types/services/HashCacheService.d.ts @@ -11,7 +11,18 @@ export declare class HashCacheService { protected modHashes: any; protected readonly modCachePath = "./user/cache/modCache.json"; constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); + /** + * Return a stored hash by key + * @param modName Name of mod to get hash for + * @returns Mod hash + */ getStoredModHash(modName: string): string; + /** + * Does the generated hash match the stored hash + * @param modName name of mod + * @param modContent + * @returns True if they match + */ modContentMatchesStoredHash(modName: string, modContent: string): boolean; hashMatchesStoredHash(modName: string, modHash: string): boolean; storeModContent(modName: string, modContent: string): void; diff --git a/TypeScript/1LogToConsole/types/services/MailSendService.d.ts b/TypeScript/1LogToConsole/types/services/MailSendService.d.ts index 19397dc..fe4a7fe 100644 --- a/TypeScript/1LogToConsole/types/services/MailSendService.d.ts +++ b/TypeScript/1LogToConsole/types/services/MailSendService.d.ts @@ -35,7 +35,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendDirectNpcMessageToPlayer(playerId: string, sender: Traders, messageType: MessageType, message: string, items?: Item[], maxStorageTimeSeconds?: any): void; + sendDirectNpcMessageToPlayer(playerId: string, sender: Traders, messageType: MessageType, message: string, items?: Item[], maxStorageTimeSeconds?: any, systemData?: any, ragfair?: any): void; /** * Send a message from an NPC (e.g. prapor) to the player with or without items * @param playerId Players id to send message to @@ -45,7 +45,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendLocalisedNpcMessageToPlayer(playerId: string, sender: Traders, messageType: MessageType, messageLocaleId: string, items?: Item[], maxStorageTimeSeconds?: any, systemData?: any): void; + sendLocalisedNpcMessageToPlayer(playerId: string, sender: Traders, messageType: MessageType, messageLocaleId: string, items?: Item[], maxStorageTimeSeconds?: any, systemData?: any, ragfair?: any): void; /** * Send a message from SYSTEM to the player with or without items * @param playerId Players id to send message to diff --git a/TypeScript/1LogToConsole/types/services/MatchBotDetailsCacheService.d.ts b/TypeScript/1LogToConsole/types/services/MatchBotDetailsCacheService.d.ts index eb365dd..c1bd322 100644 --- a/TypeScript/1LogToConsole/types/services/MatchBotDetailsCacheService.d.ts +++ b/TypeScript/1LogToConsole/types/services/MatchBotDetailsCacheService.d.ts @@ -1,7 +1,7 @@ import { IBotBase } from "../models/eft/common/tables/IBotBase"; import { ILogger } from "../models/spt/utils/ILogger"; import { LocalisationService } from "./LocalisationService"; -/** Cache bots in a dictionary, keyed by the bots name, keying by name isnt idea as its not unique but this is used by the post-raid system which doesnt have any bot ids, only name */ +/** Cache bots in a dictionary, keyed by the bots name, keying by name isnt ideal as its not unique but this is used by the post-raid system which doesnt have any bot ids, only name */ export declare class MatchBotDetailsCacheService { protected logger: ILogger; protected localisationService: LocalisationService; @@ -17,9 +17,9 @@ export declare class MatchBotDetailsCacheService { */ clearCache(): void; /** - * Find a bot in the cache by its name + * Find a bot in the cache by its name and side * @param botName Name of bot to find * @returns Bot details */ - getBotByName(botName: string): IBotBase; + getBotByNameAndSide(botName: string, botSide: string): IBotBase; } diff --git a/TypeScript/1LogToConsole/types/services/ModCompilerService.d.ts b/TypeScript/1LogToConsole/types/services/ModCompilerService.d.ts index a4bf3c8..e306177 100644 --- a/TypeScript/1LogToConsole/types/services/ModCompilerService.d.ts +++ b/TypeScript/1LogToConsole/types/services/ModCompilerService.d.ts @@ -1,14 +1,36 @@ import { CompilerOptions } from "typescript"; import type { ILogger } from "../models/spt/utils/ILogger"; -import { HashCacheService } from "./HashCacheService"; import { VFS } from "../utils/VFS"; +import { HashCacheService } from "./HashCacheService"; export declare class ModCompilerService { protected logger: ILogger; protected hashCacheService: HashCacheService; protected vfs: VFS; constructor(logger: ILogger, hashCacheService: HashCacheService, vfs: VFS); + /** + * Convert a mods TS into JS + * @param modName Name of mod + * @param modPath Dir path to mod + * @param modTypeScriptFiles + * @returns + */ compileMod(modName: string, modPath: string, modTypeScriptFiles: string[]): Promise; + /** + * Convert a TS file into JS + * @param fileNames Paths to TS files + * @param options Compiler options + */ protected compile(fileNames: string[], options: CompilerOptions): Promise; + /** + * Do the files at the provided paths exist + * @param fileNames + * @returns + */ protected areFilesReady(fileNames: string[]): boolean; + /** + * Wait the provided number of milliseconds + * @param ms Milliseconds + * @returns + */ protected delay(ms: number): Promise; } diff --git a/TypeScript/1LogToConsole/types/services/PaymentService.d.ts b/TypeScript/1LogToConsole/types/services/PaymentService.d.ts index 1c9c32b..fb5f92c 100644 --- a/TypeScript/1LogToConsole/types/services/PaymentService.d.ts +++ b/TypeScript/1LogToConsole/types/services/PaymentService.d.ts @@ -61,23 +61,26 @@ export declare class PaymentService { * Get all money stacks in inventory and prioritse items in stash * @param pmcData * @param currencyTpl + * @param playerStashId Players stash id * @returns Sorting money items */ - protected getSortedMoneyItemsInInventory(pmcData: IPmcData, currencyTpl: string): Item[]; + protected getSortedMoneyItemsInInventory(pmcData: IPmcData, currencyTpl: string, playerStashId: string): Item[]; /** * Prioritise player stash first over player inventory * Post-raid healing would often take money out of the players pockets/secure container * @param a First money stack item * @param b Second money stack item * @param inventoryItems players inventory items + * @param playerStashId Players stash id * @returns sort order */ - protected prioritiseStashSort(a: Item, b: Item, inventoryItems: Item[]): number; + protected prioritiseStashSort(a: Item, b: Item, inventoryItems: Item[], playerStashId: string): number; /** * Recursivly check items parents to see if it is inside the players inventory, not stash * @param itemId item id to check * @param inventoryItems player inventory + * @param playerStashId Players stash id * @returns true if its in inventory */ - protected isInInventory(itemId: string, inventoryItems: Item[]): boolean; + protected isInStash(itemId: string, inventoryItems: Item[], playerStashId: string): boolean; } diff --git a/TypeScript/1LogToConsole/types/services/ProfileFixerService.d.ts b/TypeScript/1LogToConsole/types/services/ProfileFixerService.d.ts index c8232fc..bc1e42e 100644 --- a/TypeScript/1LogToConsole/types/services/ProfileFixerService.d.ts +++ b/TypeScript/1LogToConsole/types/services/ProfileFixerService.d.ts @@ -14,6 +14,7 @@ import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; import { Watermark } from "../utils/Watermark"; import { LocalisationService } from "./LocalisationService"; @@ -27,17 +28,19 @@ export declare class ProfileFixerService { protected itemHelper: ItemHelper; protected localisationService: LocalisationService; protected timeUtil: TimeUtil; + protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, profileHelper: ProfileHelper, itemHelper: ItemHelper, localisationService: LocalisationService, timeUtil: TimeUtil, databaseServer: DatabaseServer, configServer: ConfigServer); + constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, profileHelper: ProfileHelper, itemHelper: ItemHelper, localisationService: LocalisationService, timeUtil: TimeUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, configServer: ConfigServer); /** * 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; protected addMissingGunStandContainerImprovements(pmcProfile: IPmcData): void; + protected ensureGunStandLevelsMatch(pmcProfile: IPmcData): void; protected addHideoutAreaStashes(pmcProfile: IPmcData): void; protected addMissingHideoutWallAreas(pmcProfile: IPmcData): void; protected adjustUnreasonableModFleaPrices(): void; @@ -131,4 +134,9 @@ export declare class ProfileFixerService { * @param pmcProfile Profile to add missing IDs to */ addMissingIdsToBonuses(pmcProfile: IPmcData): void; + /** + * At some point the property name was changed,migrate data across to new name + * @param pmcProfile + */ + protected migrateImprovements(pmcProfile: IPmcData): void; } diff --git a/TypeScript/1LogToConsole/types/services/RagfairPriceService.d.ts b/TypeScript/1LogToConsole/types/services/RagfairPriceService.d.ts index e245efa..ff35327 100644 --- a/TypeScript/1LogToConsole/types/services/RagfairPriceService.d.ts +++ b/TypeScript/1LogToConsole/types/services/RagfairPriceService.d.ts @@ -3,6 +3,7 @@ import { HandbookHelper } from "../helpers/HandbookHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { TraderHelper } from "../helpers/TraderHelper"; +import { MinMax } from "../models/common/MinMax"; import { IPreset } from "../models/eft/common/IGlobals"; import { Item } from "../models/eft/common/tables/IItem"; import { IBarterScheme } from "../models/eft/common/tables/ITrader"; @@ -35,10 +36,6 @@ export declare class RagfairPriceService implements OnLoad { * Generate static (handbook) and dynamic (prices.json) flea prices, store inside class as dictionaries */ onLoad(): Promise; - /** - * Add placeholder values for items missing from handbook - */ - protected addMissingHandbookPrices(): void; getRoute(): string; /** * Iterate over all items of type "Item" in db and get template price, store in cache @@ -91,9 +88,17 @@ export declare class RagfairPriceService implements OnLoad { * Generate a currency cost for an item and its mods * @param items Item with mods to get price for * @param desiredCurrency Currency price desired in + * @param isPackOffer Price is for a pack type offer * @returns cost of item in desired currency */ - getDynamicOfferPrice(items: Item[], desiredCurrency: string): number; + getDynamicOfferPriceForOffer(items: Item[], desiredCurrency: string, isPackOffer: boolean): number; + /** + * Get different min/max price multipliers for different offer types (preset/pack/default) + * @param isPreset Offer is a preset + * @param isPack Offer is a pack + * @returns MinMax values + */ + protected getOfferTypeRangeValues(isPreset: boolean, isPack: boolean): MinMax; /** * Check to see if an items price is below its handbook price and adjust accoring to values set to config/ragfair.json * @param itemPrice price of item @@ -104,10 +109,10 @@ export declare class RagfairPriceService implements OnLoad { /** * Multiply the price by a randomised curve where n = 2, shift = 2 * @param existingPrice price to alter - * @param isPreset is the item we're multiplying a preset + * @param rangeValues min and max to adjust price by * @returns multiplied price */ - protected randomisePrice(existingPrice: number, isPreset: boolean): number; + protected randomiseOfferPrice(existingPrice: number, rangeValues: MinMax): number; /** * Calculate the cost of a weapon preset by adding together the price of its mods + base price of default weapon preset * @param item base weapon diff --git a/TypeScript/2EditDatabase/types/callbacks/GameCallbacks.d.ts b/TypeScript/2EditDatabase/types/callbacks/GameCallbacks.d.ts index aa80036..46f79f9 100644 --- a/TypeScript/2EditDatabase/types/callbacks/GameCallbacks.d.ts +++ b/TypeScript/2EditDatabase/types/callbacks/GameCallbacks.d.ts @@ -1,4 +1,5 @@ import { GameController } from "../controllers/GameController"; +import { OnLoad } from "../di/OnLoad"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { ICheckVersionResponse } from "../models/eft/game/ICheckVersionResponse"; import { ICurrentGroupResponse } from "../models/eft/game/ICurrentGroupResponse"; @@ -15,12 +16,14 @@ import { INullResponseData } from "../models/eft/httpResponse/INullResponseData" import { SaveServer } from "../servers/SaveServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { Watermark } from "../utils/Watermark"; -declare class GameCallbacks { +declare class GameCallbacks implements OnLoad { protected httpResponse: HttpResponseUtil; protected watermark: Watermark; protected saveServer: SaveServer; protected gameController: GameController; constructor(httpResponse: HttpResponseUtil, watermark: Watermark, saveServer: SaveServer, gameController: GameController); + onLoad(): Promise; + getRoute(): string; /** * Handle client/game/version/validate * @returns INullResponseData diff --git a/TypeScript/2EditDatabase/types/controllers/GameController.d.ts b/TypeScript/2EditDatabase/types/controllers/GameController.d.ts index 04e3abb..e88610e 100644 --- a/TypeScript/2EditDatabase/types/controllers/GameController.d.ts +++ b/TypeScript/2EditDatabase/types/controllers/GameController.d.ts @@ -61,13 +61,14 @@ export declare class GameController { protected pmcConfig: IPmcConfig; protected lootConfig: ILootConfig; constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, randomUtil: RandomUtil, encodingUtil: EncodingUtil, hideoutHelper: HideoutHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, seasonalEventService: SeasonalEventService, itemBaseClassService: ItemBaseClassService, giftService: GiftService, applicationContext: ApplicationContext, configServer: ConfigServer); + load(): void; /** * Handle client/game/start */ gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; protected addCustomLooseLootPositions(): void; protected adjustLooseLootSpawnProbabilities(): void; - protected setHideoutAreasAndCraftsTo30Secs(): void; + protected setHideoutAreasAndCraftsTo40Secs(): void; /** * 3.7.0 moved AIDs to be numeric, old profiles need to be migrated * We store the old AID value in new field `sessionId` diff --git a/TypeScript/2EditDatabase/types/controllers/HealthController.d.ts b/TypeScript/2EditDatabase/types/controllers/HealthController.d.ts index 1938297..2d7ff09 100644 --- a/TypeScript/2EditDatabase/types/controllers/HealthController.d.ts +++ b/TypeScript/2EditDatabase/types/controllers/HealthController.d.ts @@ -29,34 +29,35 @@ export declare class HealthController { * stores in-raid player health * @param pmcData Player profile * @param info Request data - * @param sessionID + * @param sessionID Player id * @param addEffects Should effects found be added or removed from profile + * @param deleteExistingEffects Should all prior effects be removed before apply new ones */ saveVitality(pmcData: IPmcData, info: ISyncHealthRequestData, sessionID: string, addEffects?: boolean, deleteExistingEffects?: boolean): void; /** * When healing in menu - * @param pmcData - * @param body - * @param sessionID - * @returns + * @param pmcData Player profile + * @param request Healing request + * @param sessionID Player id + * @returns IItemEventRouterResponse */ - offraidHeal(pmcData: IPmcData, body: IOffraidHealRequestData, sessionID: string): IItemEventRouterResponse; + offraidHeal(pmcData: IPmcData, request: IOffraidHealRequestData, sessionID: string): IItemEventRouterResponse; /** * Handle Eat event * Consume food/water outside of a raid * @param pmcData Player profile - * @param body request Object + * @param request Eat request * @param sessionID Session id * @returns IItemEventRouterResponse */ - offraidEat(pmcData: IPmcData, body: IOffraidEatRequestData, sessionID: string): IItemEventRouterResponse; + offraidEat(pmcData: IPmcData, request: IOffraidEatRequestData, sessionID: string): IItemEventRouterResponse; /** * Handle RestoreHealth event * Occurs on post-raid healing page * @param pmcData player profile * @param healthTreatmentRequest Request data from client * @param sessionID Session id - * @returns + * @returns IItemEventRouterResponse */ healthTreatment(pmcData: IPmcData, healthTreatmentRequest: IHealthTreatmentRequestData, sessionID: string): IItemEventRouterResponse; /** @@ -66,12 +67,4 @@ export declare class HealthController { * @param sessionID */ applyWorkoutChanges(pmcData: IPmcData, info: IWorkoutData, sessionId: string): void; - /** - * Iterate over treatment request diff and find effects to remove from player limbs - * @param sessionId - * @param profile Profile to update - * @param treatmentRequest client request - * @param output response to send to client - */ - protected removeEffectsAfterPostRaidHeal(sessionId: string, profile: IPmcData, treatmentRequest: IHealthTreatmentRequestData, output: IItemEventRouterResponse): void; } diff --git a/TypeScript/2EditDatabase/types/controllers/HideoutController.d.ts b/TypeScript/2EditDatabase/types/controllers/HideoutController.d.ts index 877c076..a90a16d 100644 --- a/TypeScript/2EditDatabase/types/controllers/HideoutController.d.ts +++ b/TypeScript/2EditDatabase/types/controllers/HideoutController.d.ts @@ -88,11 +88,11 @@ export declare class HideoutController { * @param pmcData Profile to edit * @param output Object to send back to client * @param sessionID Session/player id - * @param profileHideoutArea Current hideout data for profile + * @param profileParentHideoutArea Current hideout area for profile * @param dbHideoutArea Hideout area being upgraded * @param hideoutStage Stage hideout area is being upgraded to */ - protected addContainerImprovementToProfile(output: IItemEventRouterResponse, sessionID: string, pmcData: IPmcData, profileHideoutArea: HideoutArea, dbHideoutArea: IHideoutArea, hideoutStage: Stage): void; + protected addContainerImprovementToProfile(output: IItemEventRouterResponse, sessionID: string, pmcData: IPmcData, profileParentHideoutArea: HideoutArea, dbHideoutArea: IHideoutArea, hideoutStage: Stage): void; /** * Add an inventory item to profile from a hideout area stage data * @param pmcData Profile to update diff --git a/TypeScript/2EditDatabase/types/controllers/LocationController.d.ts b/TypeScript/2EditDatabase/types/controllers/LocationController.d.ts index 94d496a..94f5fce 100644 --- a/TypeScript/2EditDatabase/types/controllers/LocationController.d.ts +++ b/TypeScript/2EditDatabase/types/controllers/LocationController.d.ts @@ -4,6 +4,7 @@ import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { ILocationBase } from "../models/eft/common/ILocationBase"; import { ILocationsGenerateAllResponse } from "../models/eft/common/ILocationsSourceDestinationBase"; import { IAirdropLootResult } from "../models/eft/location/IAirdropLootResult"; +import { IGetLocationRequestData } from "../models/eft/location/IGetLocationRequestData"; import { AirdropTypeEnum } from "../models/enums/AirdropType"; import { IAirdropConfig } from "../models/spt/config/IAirdropConfig"; import { ILocationConfig } from "../models/spt/config/ILocationConfig"; @@ -34,10 +35,11 @@ export declare class LocationController { /** * Handle client/location/getLocalloot * Get a location (map) with generated loot data - * @param location Map to generate loot for + * @param sessionId Player id + * @param request Map request to generate * @returns ILocationBase */ - get(location: string): ILocationBase; + get(sessionId: string, request: IGetLocationRequestData): ILocationBase; /** * Generate a maps base location with loot * @param name Map name diff --git a/TypeScript/2EditDatabase/types/controllers/QuestController.d.ts b/TypeScript/2EditDatabase/types/controllers/QuestController.d.ts index 7d494a6..bd8a70f 100644 --- a/TypeScript/2EditDatabase/types/controllers/QuestController.d.ts +++ b/TypeScript/2EditDatabase/types/controllers/QuestController.d.ts @@ -61,7 +61,7 @@ export declare class QuestController { * @param playerLevel level of player to test against quest * @returns true if quest can be seen/accepted by player of defined level */ - protected playerLevelFulfillsQuestRequrement(quest: IQuest, playerLevel: number): boolean; + protected playerLevelFulfillsQuestRequirement(quest: IQuest, playerLevel: number): boolean; /** * Should a quest be shown to the player in trader quest screen * @param questId Quest to check diff --git a/TypeScript/2EditDatabase/types/controllers/RagfairController.d.ts b/TypeScript/2EditDatabase/types/controllers/RagfairController.d.ts index 76c27f7..bda37cd 100644 --- a/TypeScript/2EditDatabase/types/controllers/RagfairController.d.ts +++ b/TypeScript/2EditDatabase/types/controllers/RagfairController.d.ts @@ -21,6 +21,7 @@ import { IGetMarketPriceRequestData } from "../models/eft/ragfair/IGetMarketPric import { IGetOffersResult } from "../models/eft/ragfair/IGetOffersResult"; import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; import { ISearchRequestData } from "../models/eft/ragfair/ISearchRequestData"; +import { IProcessBuyTradeRequestData } from "../models/eft/trade/IProcessBuyTradeRequestData"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; @@ -125,6 +126,18 @@ export declare class RagfairController { * @returns IItemEventRouterResponse */ addPlayerOffer(pmcData: IPmcData, offerRequest: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Charge player a listing fee for using flea, pulls charge from data previously sent by client + * @param sessionID Player id + * @param rootItem Base item being listed (used when client tax cost not found and must be done on server) + * @param pmcData Player profile + * @param requirementsPriceInRub Rouble cost player chose for listing (used when client tax cost not found and must be done on server) + * @param itemStackCount How many items were listed in player (used when client tax cost not found and must be done on server) + * @param offerRequest Add offer request object from client + * @param output IItemEventRouterResponse + * @returns True if charging tax to player failed + */ + protected chargePlayerTaxFee(sessionID: string, rootItem: Item, pmcData: IPmcData, requirementsPriceInRub: number, itemStackCount: number, offerRequest: IAddOfferRequestData, output: IItemEventRouterResponse): boolean; /** * Is the item to be listed on the flea valid * @param offerRequest Client offer request @@ -158,4 +171,11 @@ export declare class RagfairController { */ removeOffer(offerId: string, sessionID: string): IItemEventRouterResponse; extendOffer(info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Create a basic trader request object with price and currency type + * @param currency What currency: RUB, EURO, USD + * @param value Amount of currency + * @returns IProcessBuyTradeRequestData + */ + protected createBuyTradeRequestObject(currency: string, value: number): IProcessBuyTradeRequestData; } diff --git a/TypeScript/2EditDatabase/types/generators/BotEquipmentModGenerator.d.ts b/TypeScript/2EditDatabase/types/generators/BotEquipmentModGenerator.d.ts index ccbbbbf..f7abb84 100644 --- a/TypeScript/2EditDatabase/types/generators/BotEquipmentModGenerator.d.ts +++ b/TypeScript/2EditDatabase/types/generators/BotEquipmentModGenerator.d.ts @@ -14,7 +14,6 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; import { BotEquipmentModPoolService } from "../services/BotEquipmentModPoolService"; import { BotModLimits, BotWeaponModLimitService } from "../services/BotWeaponModLimitService"; -import { ItemBaseClassService } from "../services/ItemBaseClassService"; import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; @@ -29,7 +28,6 @@ export declare class BotEquipmentModGenerator { protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; protected botEquipmentFilterService: BotEquipmentFilterService; - protected itemBaseClassService: ItemBaseClassService; protected itemFilterService: ItemFilterService; protected profileHelper: ProfileHelper; protected botWeaponModLimitService: BotWeaponModLimitService; @@ -40,7 +38,7 @@ export declare class BotEquipmentModGenerator { protected botEquipmentModPoolService: BotEquipmentModPoolService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, itemHelper: ItemHelper, botEquipmentFilterService: BotEquipmentFilterService, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponModLimitService: BotWeaponModLimitService, botHelper: BotHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, botEquipmentModPoolService: BotEquipmentModPoolService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, itemHelper: ItemHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponModLimitService: BotWeaponModLimitService, botHelper: BotHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, botEquipmentModPoolService: BotEquipmentModPoolService, configServer: ConfigServer); /** * Check mods are compatible and add to array * @param equipment Equipment item to add mods to diff --git a/TypeScript/2EditDatabase/types/generators/LocationGenerator.d.ts b/TypeScript/2EditDatabase/types/generators/LocationGenerator.d.ts index b8169d3..46a514b 100644 --- a/TypeScript/2EditDatabase/types/generators/LocationGenerator.d.ts +++ b/TypeScript/2EditDatabase/types/generators/LocationGenerator.d.ts @@ -65,10 +65,11 @@ export declare class LocationGenerator { protected getGuaranteedContainers(staticContainersOnMap: IStaticContainerData[]): IStaticContainerData[]; /** * Choose a number of containers based on their probabilty value to fulfil the desired count in containerData.chosenCount + * @param groupId Name of the group the containers are being collected for * @param containerData Containers and probability values for a groupId * @returns List of chosen container Ids */ - protected getContainersByProbabilty(containerData: IContainerGroupCount): string[]; + protected getContainersByProbabilty(groupId: string, containerData: IContainerGroupCount): string[]; /** * Get a mapping of each groupid and the containers in that group + count of containers to spawn on map * @param containersGroups Container group values diff --git a/TypeScript/2EditDatabase/types/generators/PMCLootGenerator.d.ts b/TypeScript/2EditDatabase/types/generators/PMCLootGenerator.d.ts index 9acff69..abb5615 100644 --- a/TypeScript/2EditDatabase/types/generators/PMCLootGenerator.d.ts +++ b/TypeScript/2EditDatabase/types/generators/PMCLootGenerator.d.ts @@ -31,12 +31,12 @@ export declare class PMCLootGenerator { */ generatePMCVestLootPool(): string[]; /** - * Check if item has a width/height that lets it fit into a 1x2/2x1 slot - * 1x1 / 1x2 / 2x1 + * Check if item has a width/height that lets it fit into a 2x2 slot + * 1x1 / 1x2 / 2x1 / 2x2 * @param item Item to check size of * @returns true if it fits */ - protected itemFitsInto1By2Slot(item: ITemplateItem): boolean; + protected itemFitsInto2By2Slot(item: ITemplateItem): boolean; /** * Create an array of loot items a PMC can have in their backpack * @returns string array of tpls diff --git a/TypeScript/2EditDatabase/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/2EditDatabase/types/generators/RagfairOfferGenerator.d.ts index a627191..58e0b68 100644 --- a/TypeScript/2EditDatabase/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/2EditDatabase/types/generators/RagfairOfferGenerator.d.ts @@ -55,11 +55,10 @@ export declare class RagfairOfferGenerator { * @param items Items in the offer * @param barterScheme Cost of item (currency or barter) * @param loyalLevel Loyalty level needed to buy item - * @param price Price of offer - * @param sellInOnePiece Set StackObjectsCount to 1 + * @param sellInOnePiece Flags sellInOnePiece to be true * @returns IRagfairOffer */ - createFleaOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; + createFleaOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, sellInOnePiece?: boolean): IRagfairOffer; /** * Create an offer object ready to send to ragfairOfferService.addOffer() * @param userID Owner of the offer @@ -67,17 +66,16 @@ export declare class RagfairOfferGenerator { * @param items Items in the offer * @param barterScheme Cost of item (currency or barter) * @param loyalLevel Loyalty level needed to buy item - * @param price Price of offer * @param sellInOnePiece Set StackObjectsCount to 1 * @returns IRagfairOffer */ - protected createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; + protected createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, sellInOnePiece?: boolean): IRagfairOffer; /** * Calculate the offer price that's listed on the flea listing * @param offerRequirements barter requirements for offer * @returns rouble cost of offer */ - protected calculateOfferListingPrice(offerRequirements: OfferRequirement[]): number; + protected convertOfferRequirementsIntoRoubles(offerRequirements: OfferRequirement[]): number; /** * Get avatar url from trader table in db * @param isTrader Is user we're getting avatar for a trader @@ -137,7 +135,7 @@ export declare class RagfairOfferGenerator { * @param itemDetails raw db item details * @returns Item array */ - protected createSingleOfferForItem(items: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; + protected createSingleOfferForItem(items: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; /** * Generate trader offers on flea using the traders assort data * @param traderID Trader to generate offers for @@ -151,7 +149,7 @@ export declare class RagfairOfferGenerator { * @param itemDetails db details of first item * @returns */ - protected getItemCondition(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): Item[]; + protected randomiseItemUpdProperties(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): Item[]; /** * Get the relevant condition id if item tpl matches in ragfair.json/condition * @param tpl Item to look for matching condition object @@ -184,7 +182,7 @@ export declare class RagfairOfferGenerator { * @param offerItems Items for sale in offer * @returns Barter scheme */ - protected createBarterRequirement(offerItems: Item[]): IBarterScheme[]; + protected createBarterBarterScheme(offerItems: Item[]): IBarterScheme[]; /** * Get an array of flea prices + item tpl, cached in generator class inside `allowedFleaPriceItemsForBarter` * @returns array with tpl/price values @@ -196,7 +194,9 @@ export declare class RagfairOfferGenerator { /** * Create a random currency-based barter scheme for an array of items * @param offerItems Items on offer + * @param isPackOffer Is the barter scheme being created for a pack offer + * @param multipler What to multiply the resulting price by * @returns Barter scheme for offer */ - protected createCurrencyRequirement(offerItems: Item[]): IBarterScheme[]; + protected createCurrencyBarterScheme(offerItems: Item[], isPackOffer: boolean, multipler?: number): IBarterScheme[]; } diff --git a/TypeScript/2EditDatabase/types/generators/ScavCaseRewardGenerator.d.ts b/TypeScript/2EditDatabase/types/generators/ScavCaseRewardGenerator.d.ts index 4ba1888..b5935d0 100644 --- a/TypeScript/2EditDatabase/types/generators/ScavCaseRewardGenerator.d.ts +++ b/TypeScript/2EditDatabase/types/generators/ScavCaseRewardGenerator.d.ts @@ -25,6 +25,8 @@ export declare class ScavCaseRewardGenerator { protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected scavCaseConfig: IScavCaseConfig; + protected dbItemsCache: ITemplateItem[]; + protected dbAmmoItemsCache: ITemplateItem[]; constructor(logger: ILogger, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * Create an array of rewards that will be given to the player upon completing their scav case build @@ -33,10 +35,10 @@ export declare class ScavCaseRewardGenerator { */ generate(recipeId: string): Product[]; /** - * Get all db items that are not blacklisted in scavcase config - * @returns filtered array of db items + * Get all db items that are not blacklisted in scavcase config or global blacklist + * Store in class field */ - protected getDbItems(): ITemplateItem[]; + protected cacheDbItems(): void; /** * Pick a number of items to be rewards, the count is defined by the values in * @param items item pool to pick rewards from diff --git a/TypeScript/2EditDatabase/types/generators/WeatherGenerator.d.ts b/TypeScript/2EditDatabase/types/generators/WeatherGenerator.d.ts index 2e2403c..6471bb1 100644 --- a/TypeScript/2EditDatabase/types/generators/WeatherGenerator.d.ts +++ b/TypeScript/2EditDatabase/types/generators/WeatherGenerator.d.ts @@ -52,6 +52,7 @@ export declare class WeatherGenerator { */ protected setCurrentDateTime(weather: IWeather): void; protected getWeightedWindDirection(): WindDirection; + protected getWeightedClouds(): number; protected getWeightedWindSpeed(): number; protected getWeightedFog(): number; protected getWeightedRain(): number; diff --git a/TypeScript/2EditDatabase/types/helpers/HealthHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/HealthHelper.d.ts index 3694a6e..e4cdcd6 100644 --- a/TypeScript/2EditDatabase/types/helpers/HealthHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/HealthHelper.d.ts @@ -27,6 +27,7 @@ export declare class HealthHelper { * @param request Heal request * @param sessionID Session id * @param addEffects Should effects be added or removed (default - add) + * @param deleteExistingEffects Should all prior effects be removed before apply new ones */ saveVitality(pmcData: IPmcData, request: ISyncHealthRequestData, sessionID: string, addEffects?: boolean, deleteExistingEffects?: boolean): void; /** diff --git a/TypeScript/2EditDatabase/types/helpers/InRaidHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/InRaidHelper.d.ts index bf584c2..b4c0c1c 100644 --- a/TypeScript/2EditDatabase/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/InRaidHelper.d.ts @@ -53,7 +53,7 @@ export declare class InRaidHelper { * @param victim Who was killed by player * @returns a numerical standing gain or loss */ - protected getStandingChangeForKill(victim: Victim): number; + protected getFenceStandingChangeForKillAsScav(victim: Victim): number; /** * Reset a profile to a baseline, used post-raid * Reset points earned during session property diff --git a/TypeScript/2EditDatabase/types/helpers/ItemHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/ItemHelper.d.ts index 99fca56..00f190f 100644 --- a/TypeScript/2EditDatabase/types/helpers/ItemHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/ItemHelper.d.ts @@ -26,6 +26,7 @@ declare class ItemHelper { protected itemBaseClassService: ItemBaseClassService; protected localisationService: LocalisationService; protected localeService: LocaleService; + protected readonly defaultInvalidBaseTypes: string[]; constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, localisationService: LocalisationService, localeService: LocaleService); /** * Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash @@ -67,6 +68,11 @@ declare class ItemHelper { * @returns Price in roubles (undefined if not found) */ getDynamicItemPrice(tpl: string): number; + /** + * Update items upd.StackObjectsCount to be 1 if its upd is missing or StackObjectsCount is undefined + * @param item Item to update + * @returns Fixed item + */ fixItemStackCount(item: Item): Item; /** * AmmoBoxes contain StackSlots which need to be filled for the AmmoBox to have content. @@ -125,19 +131,19 @@ declare class ItemHelper { getItemQualityModifier(item: Item): number; /** * Get a quality value based on a repairable items (weapon/armor) current state between current and max durability - * @param itemDetails - * @param repairable repairable object - * @param item - * @returns a number between 0 and 1 + * @param itemDetails Db details for item we want quality value for + * @param repairable Repairable properties + * @param item Item quality value is for + * @returns A number between 0 and 1 */ protected getRepairableItemQualityValue(itemDetails: ITemplateItem, repairable: Repairable, item: Item): number; /** * Recursive function that looks at every item from parameter and gets their childrens Ids + includes parent item in results - * @param items - * @param itemID + * @param items Array of items (item + possible children) + * @param itemId Parent items id * @returns an array of strings */ - findAndReturnChildrenByItems(items: Item[], itemID: string): string[]; + findAndReturnChildrenByItems(items: Item[], itemId: string): string[]; /** * A variant of findAndReturnChildren where the output is list of item objects instead of their ids. * @param items @@ -164,12 +170,6 @@ declare class ItemHelper { * @returns true if it is a dogtag */ isDogtag(tpl: string): boolean; - /** - * Can the item passed in be sold to a trader because it is raw money - * @param tpl Item template id to check - * @returns true if unsellable - */ - isNotSellable(tpl: string): boolean; /** * Gets the identifier for a child using slotId, locationX and locationY. * @param item @@ -183,19 +183,19 @@ declare class ItemHelper { */ isItemTplStackable(tpl: string): boolean; /** - * split item stack if it exceeds its StackMaxSize property - * @param itemToSplit item being split into smaller stacks + * split item stack if it exceeds its items StackMaxSize property + * @param itemToSplit Item to split into smaller stacks * @returns Array of split items */ splitStack(itemToSplit: Item): Item[]; /** - * Find Barter items in the inventory + * Find Barter items from array of items * @param {string} by tpl or id - * @param {Object} pmcData + * @param {Item[]} items Array of items to iterate over * @param {string} barterItemId * @returns Array of Item objects */ - findBarterItems(by: "tpl" | "id", pmcData: IPmcData, barterItemId: string): Item[]; + findBarterItems(by: "tpl" | "id", items: Item[], barterItemId: string): Item[]; /** * Regenerate all guids with new ids, exceptions are for items that cannot be altered (e.g. stash/sorting table) * @param pmcData Player profile @@ -262,10 +262,21 @@ declare class ItemHelper { * @param minSizePercent % the magazine must be filled to */ fillMagazineWithCartridge(magazine: Item[], magTemplate: ITemplateItem, cartridgeTpl: string, minSizePercent?: number): void; + /** + * Choose a random bullet type from the list of possible a magazine has + * @param magTemplate Magazine template from Db + * @returns Tpl of cartridge + */ protected getRandomValidCaliber(magTemplate: ITemplateItem): string; + /** + * Chose a randomly weighted cartridge that fits + * @param caliber Desired caliber + * @param staticAmmoDist Cartridges and thier weights + * @returns Tpl of cartrdige + */ protected drawAmmoTpl(caliber: string, staticAmmoDist: Record): string; /** - * + * Create a basic cartrige object * @param parentId container cartridges will be placed in * @param ammoTpl Cartridge to insert * @param stackCount Count of cartridges inside parent diff --git a/TypeScript/2EditDatabase/types/helpers/QuestHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/QuestHelper.d.ts index e04b6e0..5c749d3 100644 --- a/TypeScript/2EditDatabase/types/helpers/QuestHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/QuestHelper.d.ts @@ -21,6 +21,7 @@ import { DialogueHelper } from "./DialogueHelper"; import { ItemHelper } from "./ItemHelper"; import { PaymentHelper } from "./PaymentHelper"; import { ProfileHelper } from "./ProfileHelper"; +import { QuestConditionHelper } from "./QuestConditionHelper"; import { RagfairServerHelper } from "./RagfairServerHelper"; import { TraderHelper } from "./TraderHelper"; export declare class QuestHelper { @@ -29,6 +30,7 @@ export declare class QuestHelper { protected timeUtil: TimeUtil; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; + protected questConditionHelper: QuestConditionHelper; protected eventOutputHolder: EventOutputHolder; protected databaseServer: DatabaseServer; protected localeService: LocaleService; @@ -41,7 +43,7 @@ export declare class QuestHelper { protected mailSendService: MailSendService; protected configServer: ConfigServer; 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, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, questConditionHelper: QuestConditionHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, mailSendService: MailSendService, configServer: ConfigServer); /** * Get status of a quest in player profile by its id * @param pmcData Profile to search @@ -119,7 +121,7 @@ export declare class QuestHelper { * @param sessionID Session id * @returns Quests accessible to player incuding newly unlocked quests now quest (startedQuestId) was started */ - acceptedUnlocked(startedQuestId: string, sessionID: string): IQuest[]; + getNewlyAccessibleQuestsWhenStartingQuest(startedQuestId: string, sessionID: string): IQuest[]; /** * Get quests that can be shown to player after failing a quest * @param failedQuestId Id of the quest failed by player diff --git a/TypeScript/2EditDatabase/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/RagfairOfferHelper.d.ts index de9d550..0699259 100644 --- a/TypeScript/2EditDatabase/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/RagfairOfferHelper.d.ts @@ -1,4 +1,5 @@ import { IPmcData } from "../models/eft/common/IPmcData"; +import { Item } from "../models/eft/common/tables/IItem"; import { ITraderAssort } from "../models/eft/common/tables/ITrader"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; @@ -13,10 +14,10 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { LocaleService } from "../services/LocaleService"; import { LocalisationService } from "../services/LocalisationService"; +import { MailSendService } from "../services/MailSendService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { HashUtil } from "../utils/HashUtil"; import { TimeUtil } from "../utils/TimeUtil"; -import { DialogueHelper } from "./DialogueHelper"; import { ItemHelper } from "./ItemHelper"; import { PaymentHelper } from "./PaymentHelper"; import { PresetHelper } from "./PresetHelper"; @@ -33,7 +34,6 @@ export declare class RagfairOfferHelper { protected databaseServer: DatabaseServer; protected traderHelper: TraderHelper; protected saveServer: SaveServer; - protected dialogueHelper: DialogueHelper; protected itemHelper: ItemHelper; protected paymentHelper: PaymentHelper; protected presetHelper: PresetHelper; @@ -44,11 +44,12 @@ export declare class RagfairOfferHelper { protected ragfairOfferService: RagfairOfferService; protected localeService: LocaleService; protected localisationService: LocalisationService; + protected mailSendService: MailSendService; protected configServer: ConfigServer; protected static goodSoldTemplate: string; protected ragfairConfig: IRagfairConfig; 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, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, localisationService: LocalisationService, mailSendService: MailSendService, configServer: ConfigServer); /** * Passthrough to ragfairOfferService.getOffers(), get flea offers a player should see * @param searchRequest Data from client @@ -119,19 +120,26 @@ export declare class RagfairOfferHelper { */ protected getProfileOffers(sessionID: string): IRagfairOffer[]; /** - * Delete an offer from a desired profile + * Delete an offer from a desired profile and from ragfair offers * @param sessionID Session id of profile to delete offer from - * @param offerId Offer id to delete + * @param offerId Id of offer to delete */ - protected deleteOfferByOfferId(sessionID: string, offerId: string): void; + protected deleteOfferById(sessionID: string, offerId: string): void; /** * Complete the selling of players' offer * @param sessionID Session id * @param offer Sold offer details * @param boughtAmount Amount item was purchased for - * @returns Client response + * @returns IItemEventRouterResponse */ protected completeOffer(sessionID: string, offer: IRagfairOffer, boughtAmount: number): IItemEventRouterResponse; + /** + * Get a localised message for when players offer has sold on flea + * @param itemTpl Item sold + * @param boughtAmount How many were purchased + * @returns Localised message text + */ + protected getLocalisedOfferSoldMessage(itemTpl: string, boughtAmount: number): string; /** * Should a ragfair offer be visible to the player * @param searchRequest Search request @@ -142,4 +150,12 @@ export declare class RagfairOfferHelper { * @returns True = should be shown to player */ isDisplayableOffer(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, offer: IRagfairOffer, pmcProfile: IPmcData): boolean; + /** + * Is items quality value within desired range + * @param item Item to check quality of + * @param min Desired minimum quality + * @param max Desired maximum quality + * @returns True if in range + */ + protected itemQualityInRange(item: Item, min: number, max: number): boolean; } diff --git a/TypeScript/2EditDatabase/types/helpers/RagfairSellHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/RagfairSellHelper.d.ts index 251d7ca..913b408 100644 --- a/TypeScript/2EditDatabase/types/helpers/RagfairSellHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/RagfairSellHelper.d.ts @@ -13,12 +13,12 @@ export declare class RagfairSellHelper { constructor(logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, configServer: ConfigServer); /** * Get the percent chance to sell an item based on its average listed price vs player chosen listing price - * @param baseChancePercent Base chance to sell item * @param averageOfferPriceRub Price of average offer in roubles * @param playerListedPriceRub Price player listed item for in roubles + * @param qualityMultiplier Quality multipler of item being sold * @returns percent value */ - calculateSellChance(baseChancePercent: number, averageOfferPriceRub: number, playerListedPriceRub: number): number; + calculateSellChance(averageOfferPriceRub: number, playerListedPriceRub: number, qualityMultiplier: number): number; /** * Get percent chance to sell an item when price is below items average listing price * @param playerListedPriceRub Price player listed item for in roubles diff --git a/TypeScript/2EditDatabase/types/helpers/TraderHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/TraderHelper.d.ts index c163f7a..6680ccf 100644 --- a/TypeScript/2EditDatabase/types/helpers/TraderHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/TraderHelper.d.ts @@ -35,7 +35,7 @@ export declare class TraderHelper { protected highestTraderBuyPriceItems: Record; constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, handbookHelper: HandbookHelper, itemHelper: ItemHelper, playerService: PlayerService, localisationService: LocalisationService, fenceService: FenceService, timeUtil: TimeUtil, randomUtil: RandomUtil, configServer: ConfigServer); getTrader(traderID: string, sessionID: string): ITraderBase; - getTraderAssortsById(traderId: string): ITraderAssort; + getTraderAssortsByTraderId(traderId: string): ITraderAssort; /** * 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 diff --git a/TypeScript/2EditDatabase/types/models/eft/common/tables/IBotBase.d.ts b/TypeScript/2EditDatabase/types/models/eft/common/tables/IBotBase.d.ts index ee40958..6c7b76f 100644 --- a/TypeScript/2EditDatabase/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/2EditDatabase/types/models/eft/common/tables/IBotBase.d.ts @@ -281,7 +281,7 @@ export interface InsuredItem { export interface Hideout { Production: Record; Areas: HideoutArea[]; - Improvements: Record; + Improvement: Record; Seed: number; sptUpdateLastRunTimestamp: number; } diff --git a/TypeScript/2EditDatabase/types/models/eft/health/IHealthTreatmentRequestData.d.ts b/TypeScript/2EditDatabase/types/models/eft/health/IHealthTreatmentRequestData.d.ts index 7fb80a8..598e60c 100644 --- a/TypeScript/2EditDatabase/types/models/eft/health/IHealthTreatmentRequestData.d.ts +++ b/TypeScript/2EditDatabase/types/models/eft/health/IHealthTreatmentRequestData.d.ts @@ -1,12 +1,14 @@ export interface IHealthTreatmentRequestData { Action: "RestoreHealth"; trader: string; - items: Item[]; + items: Cost[]; difference: Difference; timestamp: number; } -export interface Item { +export interface Cost { + /** Id of stack to take money from */ id: string; + /** Amount of money to take off player for treatment */ count: number; } export interface Difference { @@ -25,5 +27,6 @@ export interface BodyParts { } export interface BodyPart { Health: number; + /** Effects in array are to be removed */ Effects: string[]; } diff --git a/TypeScript/2EditDatabase/types/models/eft/notifier/INotifier.d.ts b/TypeScript/2EditDatabase/types/models/eft/notifier/INotifier.d.ts index ce25dee..c6c6979 100644 --- a/TypeScript/2EditDatabase/types/models/eft/notifier/INotifier.d.ts +++ b/TypeScript/2EditDatabase/types/models/eft/notifier/INotifier.d.ts @@ -14,6 +14,11 @@ export interface INotification { } export declare enum NotificationType { RAGFAIR_OFFER_SOLD = "RagfairOfferSold", + RAGFAIR_RATING_CHANGE = "RagfairRatingChange", + /** ChatMessageReceived */ NEW_MESSAGE = "new_message", - PING = "ping" + PING = "ping", + TRADER_SUPPLY = "TraderSupply", + TRADER_STANDING = "TraderStanding", + UNLOCK_TRADER = "UnlockTrader" } diff --git a/TypeScript/2EditDatabase/types/models/eft/notifier/ISelectProfileResponse.d.ts b/TypeScript/2EditDatabase/types/models/eft/notifier/ISelectProfileResponse.d.ts index ecb668a..f2d6be7 100644 --- a/TypeScript/2EditDatabase/types/models/eft/notifier/ISelectProfileResponse.d.ts +++ b/TypeScript/2EditDatabase/types/models/eft/notifier/ISelectProfileResponse.d.ts @@ -1,6 +1,3 @@ -import { INotifierChannel } from "./INotifier"; export interface ISelectProfileResponse { status: string; - notifier: INotifierChannel; - notifierServer: string; } diff --git a/TypeScript/2EditDatabase/types/models/enums/WeatherType.d.ts b/TypeScript/2EditDatabase/types/models/enums/WeatherType.d.ts index d31fefe..503dc30 100644 --- a/TypeScript/2EditDatabase/types/models/enums/WeatherType.d.ts +++ b/TypeScript/2EditDatabase/types/models/enums/WeatherType.d.ts @@ -1,19 +1,19 @@ export declare enum WeatherType { - CLEAR_DAY = 1, - CLEAR_WIND = 2, - CLEAR_NIGHT = 3, - PARTLY_CLOUD_DAY = 4, - PARTLY_CLOUD_NIGHT = 5, - CLEAR_FOG_DAY = 6, - CLEAR_FOG_NIGHT = 7, - CLOUDFOG = 8, - FOG = 9, - MOSTLY_CLOUD = 10, - LIGHT_RAIN = 11, - RAIN = 12, - CLOUD_WIND = 13, - CLOUD_WIND_RAIN = 14, - FULL_CLOUD = 15, - THUNDER_CLOUD = 16, - NONE = 0 + CLEAR_DAY = 0, + CLEAR_WIND = 1, + CLEAR_NIGHT = 2, + PARTLY_CLOUD_DAY = 3, + PARTLY_CLOUD_NIGHT = 4, + CLEAR_FOG_DAY = 5, + CLEAR_FOG_NIGHT = 6, + CLOUD_FOG = 7, + FOG = 8, + MOSTLY_CLOUD = 9, + LIGHT_RAIN = 10, + RAIN = 11, + CLOUD_WIND = 12, + CLOUD_WIND_RAIN = 13, + FULL_CLOUD = 14, + THUNDER_CLOUD = 15, + NONE = 16 } diff --git a/TypeScript/2EditDatabase/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/2EditDatabase/types/models/spt/config/IRagfairConfig.d.ts index 7c04857..7aea24f 100644 --- a/TypeScript/2EditDatabase/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/2EditDatabase/types/models/spt/config/IRagfairConfig.d.ts @@ -41,7 +41,8 @@ export interface Dynamic { /** Use the highest trader price for an offer if its greater than the price in templates/prices.json */ useTraderPriceForOffersIfHigher: boolean; /** Barter offer specific settings */ - barter: Barter; + barter: IBarterDetails; + pack: IPackDetails; /** Dynamic offer price below handbook adjustment values */ offerAdjustment: OfferAdjustment; /** How many offers should expire before an offer regeneration occurs */ @@ -49,9 +50,7 @@ export interface Dynamic { /** How many offers should be listed */ offerItemCount: MinMax; /** How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) */ - price: MinMax; - /** How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) */ - presetPrice: MinMax; + priceRanges: IPriceRanges; /** Should default presets to listed only or should non-standard presets found in globals.json be listed too */ showDefaultPresetsOnly: boolean; endTimeSeconds: MinMax; @@ -74,7 +73,12 @@ export interface Dynamic { /** Dict of price limits keyed by item type */ unreasonableModPrices: Record; } -export interface Barter { +export interface IPriceRanges { + default: MinMax; + preset: MinMax; + pack: MinMax; +} +export interface IBarterDetails { /** Should barter offers be generated */ enable: boolean; /** Percentage change an offer is listed as a barter */ @@ -90,6 +94,18 @@ export interface Barter { /** Item Tpls to never be turned into a barter */ itemTypeBlacklist: string[]; } +export interface IPackDetails { + /** Should pack offers be generated */ + enable: boolean; + /** Percentage change an offer is listed as a pack */ + chancePercent: number; + /** Min number of required items for a pack */ + itemCountMin: number; + /** Max number of required items for a pack */ + itemCountMax: number; + /** item types to allow being a pack */ + itemTypeWhitelist: string[]; +} export interface OfferAdjustment { /** Shuld offer price be adjusted when below handbook price */ adjustPriceWhenBelowHandbookPrice: boolean; diff --git a/TypeScript/2EditDatabase/types/models/spt/config/IWeatherConfig.d.ts b/TypeScript/2EditDatabase/types/models/spt/config/IWeatherConfig.d.ts index 41a1c83..6ecf35b 100644 --- a/TypeScript/2EditDatabase/types/models/spt/config/IWeatherConfig.d.ts +++ b/TypeScript/2EditDatabase/types/models/spt/config/IWeatherConfig.d.ts @@ -7,7 +7,7 @@ export interface IWeatherConfig extends IBaseConfig { weather: Weather; } export interface Weather { - clouds: MinMax; + clouds: WeatherSettings; windSpeed: WeatherSettings; windDirection: WeatherSettings; windGustiness: MinMax; diff --git a/TypeScript/2EditDatabase/types/services/HashCacheService.d.ts b/TypeScript/2EditDatabase/types/services/HashCacheService.d.ts index 5320f28..9968478 100644 --- a/TypeScript/2EditDatabase/types/services/HashCacheService.d.ts +++ b/TypeScript/2EditDatabase/types/services/HashCacheService.d.ts @@ -11,7 +11,18 @@ export declare class HashCacheService { protected modHashes: any; protected readonly modCachePath = "./user/cache/modCache.json"; constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); + /** + * Return a stored hash by key + * @param modName Name of mod to get hash for + * @returns Mod hash + */ getStoredModHash(modName: string): string; + /** + * Does the generated hash match the stored hash + * @param modName name of mod + * @param modContent + * @returns True if they match + */ modContentMatchesStoredHash(modName: string, modContent: string): boolean; hashMatchesStoredHash(modName: string, modHash: string): boolean; storeModContent(modName: string, modContent: string): void; diff --git a/TypeScript/2EditDatabase/types/services/MailSendService.d.ts b/TypeScript/2EditDatabase/types/services/MailSendService.d.ts index 19397dc..fe4a7fe 100644 --- a/TypeScript/2EditDatabase/types/services/MailSendService.d.ts +++ b/TypeScript/2EditDatabase/types/services/MailSendService.d.ts @@ -35,7 +35,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendDirectNpcMessageToPlayer(playerId: string, sender: Traders, messageType: MessageType, message: string, items?: Item[], maxStorageTimeSeconds?: any): void; + sendDirectNpcMessageToPlayer(playerId: string, sender: Traders, messageType: MessageType, message: string, items?: Item[], maxStorageTimeSeconds?: any, systemData?: any, ragfair?: any): void; /** * Send a message from an NPC (e.g. prapor) to the player with or without items * @param playerId Players id to send message to @@ -45,7 +45,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendLocalisedNpcMessageToPlayer(playerId: string, sender: Traders, messageType: MessageType, messageLocaleId: string, items?: Item[], maxStorageTimeSeconds?: any, systemData?: any): void; + sendLocalisedNpcMessageToPlayer(playerId: string, sender: Traders, messageType: MessageType, messageLocaleId: string, items?: Item[], maxStorageTimeSeconds?: any, systemData?: any, ragfair?: any): void; /** * Send a message from SYSTEM to the player with or without items * @param playerId Players id to send message to diff --git a/TypeScript/2EditDatabase/types/services/MatchBotDetailsCacheService.d.ts b/TypeScript/2EditDatabase/types/services/MatchBotDetailsCacheService.d.ts index eb365dd..c1bd322 100644 --- a/TypeScript/2EditDatabase/types/services/MatchBotDetailsCacheService.d.ts +++ b/TypeScript/2EditDatabase/types/services/MatchBotDetailsCacheService.d.ts @@ -1,7 +1,7 @@ import { IBotBase } from "../models/eft/common/tables/IBotBase"; import { ILogger } from "../models/spt/utils/ILogger"; import { LocalisationService } from "./LocalisationService"; -/** Cache bots in a dictionary, keyed by the bots name, keying by name isnt idea as its not unique but this is used by the post-raid system which doesnt have any bot ids, only name */ +/** Cache bots in a dictionary, keyed by the bots name, keying by name isnt ideal as its not unique but this is used by the post-raid system which doesnt have any bot ids, only name */ export declare class MatchBotDetailsCacheService { protected logger: ILogger; protected localisationService: LocalisationService; @@ -17,9 +17,9 @@ export declare class MatchBotDetailsCacheService { */ clearCache(): void; /** - * Find a bot in the cache by its name + * Find a bot in the cache by its name and side * @param botName Name of bot to find * @returns Bot details */ - getBotByName(botName: string): IBotBase; + getBotByNameAndSide(botName: string, botSide: string): IBotBase; } diff --git a/TypeScript/2EditDatabase/types/services/ModCompilerService.d.ts b/TypeScript/2EditDatabase/types/services/ModCompilerService.d.ts index a4bf3c8..e306177 100644 --- a/TypeScript/2EditDatabase/types/services/ModCompilerService.d.ts +++ b/TypeScript/2EditDatabase/types/services/ModCompilerService.d.ts @@ -1,14 +1,36 @@ import { CompilerOptions } from "typescript"; import type { ILogger } from "../models/spt/utils/ILogger"; -import { HashCacheService } from "./HashCacheService"; import { VFS } from "../utils/VFS"; +import { HashCacheService } from "./HashCacheService"; export declare class ModCompilerService { protected logger: ILogger; protected hashCacheService: HashCacheService; protected vfs: VFS; constructor(logger: ILogger, hashCacheService: HashCacheService, vfs: VFS); + /** + * Convert a mods TS into JS + * @param modName Name of mod + * @param modPath Dir path to mod + * @param modTypeScriptFiles + * @returns + */ compileMod(modName: string, modPath: string, modTypeScriptFiles: string[]): Promise; + /** + * Convert a TS file into JS + * @param fileNames Paths to TS files + * @param options Compiler options + */ protected compile(fileNames: string[], options: CompilerOptions): Promise; + /** + * Do the files at the provided paths exist + * @param fileNames + * @returns + */ protected areFilesReady(fileNames: string[]): boolean; + /** + * Wait the provided number of milliseconds + * @param ms Milliseconds + * @returns + */ protected delay(ms: number): Promise; } diff --git a/TypeScript/2EditDatabase/types/services/PaymentService.d.ts b/TypeScript/2EditDatabase/types/services/PaymentService.d.ts index 1c9c32b..fb5f92c 100644 --- a/TypeScript/2EditDatabase/types/services/PaymentService.d.ts +++ b/TypeScript/2EditDatabase/types/services/PaymentService.d.ts @@ -61,23 +61,26 @@ export declare class PaymentService { * Get all money stacks in inventory and prioritse items in stash * @param pmcData * @param currencyTpl + * @param playerStashId Players stash id * @returns Sorting money items */ - protected getSortedMoneyItemsInInventory(pmcData: IPmcData, currencyTpl: string): Item[]; + protected getSortedMoneyItemsInInventory(pmcData: IPmcData, currencyTpl: string, playerStashId: string): Item[]; /** * Prioritise player stash first over player inventory * Post-raid healing would often take money out of the players pockets/secure container * @param a First money stack item * @param b Second money stack item * @param inventoryItems players inventory items + * @param playerStashId Players stash id * @returns sort order */ - protected prioritiseStashSort(a: Item, b: Item, inventoryItems: Item[]): number; + protected prioritiseStashSort(a: Item, b: Item, inventoryItems: Item[], playerStashId: string): number; /** * Recursivly check items parents to see if it is inside the players inventory, not stash * @param itemId item id to check * @param inventoryItems player inventory + * @param playerStashId Players stash id * @returns true if its in inventory */ - protected isInInventory(itemId: string, inventoryItems: Item[]): boolean; + protected isInStash(itemId: string, inventoryItems: Item[], playerStashId: string): boolean; } diff --git a/TypeScript/2EditDatabase/types/services/ProfileFixerService.d.ts b/TypeScript/2EditDatabase/types/services/ProfileFixerService.d.ts index c8232fc..bc1e42e 100644 --- a/TypeScript/2EditDatabase/types/services/ProfileFixerService.d.ts +++ b/TypeScript/2EditDatabase/types/services/ProfileFixerService.d.ts @@ -14,6 +14,7 @@ import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; import { Watermark } from "../utils/Watermark"; import { LocalisationService } from "./LocalisationService"; @@ -27,17 +28,19 @@ export declare class ProfileFixerService { protected itemHelper: ItemHelper; protected localisationService: LocalisationService; protected timeUtil: TimeUtil; + protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, profileHelper: ProfileHelper, itemHelper: ItemHelper, localisationService: LocalisationService, timeUtil: TimeUtil, databaseServer: DatabaseServer, configServer: ConfigServer); + constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, profileHelper: ProfileHelper, itemHelper: ItemHelper, localisationService: LocalisationService, timeUtil: TimeUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, configServer: ConfigServer); /** * 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; protected addMissingGunStandContainerImprovements(pmcProfile: IPmcData): void; + protected ensureGunStandLevelsMatch(pmcProfile: IPmcData): void; protected addHideoutAreaStashes(pmcProfile: IPmcData): void; protected addMissingHideoutWallAreas(pmcProfile: IPmcData): void; protected adjustUnreasonableModFleaPrices(): void; @@ -131,4 +134,9 @@ export declare class ProfileFixerService { * @param pmcProfile Profile to add missing IDs to */ addMissingIdsToBonuses(pmcProfile: IPmcData): void; + /** + * At some point the property name was changed,migrate data across to new name + * @param pmcProfile + */ + protected migrateImprovements(pmcProfile: IPmcData): void; } diff --git a/TypeScript/2EditDatabase/types/services/RagfairPriceService.d.ts b/TypeScript/2EditDatabase/types/services/RagfairPriceService.d.ts index e245efa..ff35327 100644 --- a/TypeScript/2EditDatabase/types/services/RagfairPriceService.d.ts +++ b/TypeScript/2EditDatabase/types/services/RagfairPriceService.d.ts @@ -3,6 +3,7 @@ import { HandbookHelper } from "../helpers/HandbookHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { TraderHelper } from "../helpers/TraderHelper"; +import { MinMax } from "../models/common/MinMax"; import { IPreset } from "../models/eft/common/IGlobals"; import { Item } from "../models/eft/common/tables/IItem"; import { IBarterScheme } from "../models/eft/common/tables/ITrader"; @@ -35,10 +36,6 @@ export declare class RagfairPriceService implements OnLoad { * Generate static (handbook) and dynamic (prices.json) flea prices, store inside class as dictionaries */ onLoad(): Promise; - /** - * Add placeholder values for items missing from handbook - */ - protected addMissingHandbookPrices(): void; getRoute(): string; /** * Iterate over all items of type "Item" in db and get template price, store in cache @@ -91,9 +88,17 @@ export declare class RagfairPriceService implements OnLoad { * Generate a currency cost for an item and its mods * @param items Item with mods to get price for * @param desiredCurrency Currency price desired in + * @param isPackOffer Price is for a pack type offer * @returns cost of item in desired currency */ - getDynamicOfferPrice(items: Item[], desiredCurrency: string): number; + getDynamicOfferPriceForOffer(items: Item[], desiredCurrency: string, isPackOffer: boolean): number; + /** + * Get different min/max price multipliers for different offer types (preset/pack/default) + * @param isPreset Offer is a preset + * @param isPack Offer is a pack + * @returns MinMax values + */ + protected getOfferTypeRangeValues(isPreset: boolean, isPack: boolean): MinMax; /** * Check to see if an items price is below its handbook price and adjust accoring to values set to config/ragfair.json * @param itemPrice price of item @@ -104,10 +109,10 @@ export declare class RagfairPriceService implements OnLoad { /** * Multiply the price by a randomised curve where n = 2, shift = 2 * @param existingPrice price to alter - * @param isPreset is the item we're multiplying a preset + * @param rangeValues min and max to adjust price by * @returns multiplied price */ - protected randomisePrice(existingPrice: number, isPreset: boolean): number; + protected randomiseOfferPrice(existingPrice: number, rangeValues: MinMax): number; /** * Calculate the cost of a weapon preset by adding together the price of its mods + base price of default weapon preset * @param item base weapon diff --git a/TypeScript/3GetSptConfigFile/types/callbacks/GameCallbacks.d.ts b/TypeScript/3GetSptConfigFile/types/callbacks/GameCallbacks.d.ts index aa80036..46f79f9 100644 --- a/TypeScript/3GetSptConfigFile/types/callbacks/GameCallbacks.d.ts +++ b/TypeScript/3GetSptConfigFile/types/callbacks/GameCallbacks.d.ts @@ -1,4 +1,5 @@ import { GameController } from "../controllers/GameController"; +import { OnLoad } from "../di/OnLoad"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { ICheckVersionResponse } from "../models/eft/game/ICheckVersionResponse"; import { ICurrentGroupResponse } from "../models/eft/game/ICurrentGroupResponse"; @@ -15,12 +16,14 @@ import { INullResponseData } from "../models/eft/httpResponse/INullResponseData" import { SaveServer } from "../servers/SaveServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { Watermark } from "../utils/Watermark"; -declare class GameCallbacks { +declare class GameCallbacks implements OnLoad { protected httpResponse: HttpResponseUtil; protected watermark: Watermark; protected saveServer: SaveServer; protected gameController: GameController; constructor(httpResponse: HttpResponseUtil, watermark: Watermark, saveServer: SaveServer, gameController: GameController); + onLoad(): Promise; + getRoute(): string; /** * Handle client/game/version/validate * @returns INullResponseData diff --git a/TypeScript/3GetSptConfigFile/types/controllers/GameController.d.ts b/TypeScript/3GetSptConfigFile/types/controllers/GameController.d.ts index 04e3abb..e88610e 100644 --- a/TypeScript/3GetSptConfigFile/types/controllers/GameController.d.ts +++ b/TypeScript/3GetSptConfigFile/types/controllers/GameController.d.ts @@ -61,13 +61,14 @@ export declare class GameController { protected pmcConfig: IPmcConfig; protected lootConfig: ILootConfig; constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, randomUtil: RandomUtil, encodingUtil: EncodingUtil, hideoutHelper: HideoutHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, seasonalEventService: SeasonalEventService, itemBaseClassService: ItemBaseClassService, giftService: GiftService, applicationContext: ApplicationContext, configServer: ConfigServer); + load(): void; /** * Handle client/game/start */ gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; protected addCustomLooseLootPositions(): void; protected adjustLooseLootSpawnProbabilities(): void; - protected setHideoutAreasAndCraftsTo30Secs(): void; + protected setHideoutAreasAndCraftsTo40Secs(): void; /** * 3.7.0 moved AIDs to be numeric, old profiles need to be migrated * We store the old AID value in new field `sessionId` diff --git a/TypeScript/3GetSptConfigFile/types/controllers/HealthController.d.ts b/TypeScript/3GetSptConfigFile/types/controllers/HealthController.d.ts index 1938297..2d7ff09 100644 --- a/TypeScript/3GetSptConfigFile/types/controllers/HealthController.d.ts +++ b/TypeScript/3GetSptConfigFile/types/controllers/HealthController.d.ts @@ -29,34 +29,35 @@ export declare class HealthController { * stores in-raid player health * @param pmcData Player profile * @param info Request data - * @param sessionID + * @param sessionID Player id * @param addEffects Should effects found be added or removed from profile + * @param deleteExistingEffects Should all prior effects be removed before apply new ones */ saveVitality(pmcData: IPmcData, info: ISyncHealthRequestData, sessionID: string, addEffects?: boolean, deleteExistingEffects?: boolean): void; /** * When healing in menu - * @param pmcData - * @param body - * @param sessionID - * @returns + * @param pmcData Player profile + * @param request Healing request + * @param sessionID Player id + * @returns IItemEventRouterResponse */ - offraidHeal(pmcData: IPmcData, body: IOffraidHealRequestData, sessionID: string): IItemEventRouterResponse; + offraidHeal(pmcData: IPmcData, request: IOffraidHealRequestData, sessionID: string): IItemEventRouterResponse; /** * Handle Eat event * Consume food/water outside of a raid * @param pmcData Player profile - * @param body request Object + * @param request Eat request * @param sessionID Session id * @returns IItemEventRouterResponse */ - offraidEat(pmcData: IPmcData, body: IOffraidEatRequestData, sessionID: string): IItemEventRouterResponse; + offraidEat(pmcData: IPmcData, request: IOffraidEatRequestData, sessionID: string): IItemEventRouterResponse; /** * Handle RestoreHealth event * Occurs on post-raid healing page * @param pmcData player profile * @param healthTreatmentRequest Request data from client * @param sessionID Session id - * @returns + * @returns IItemEventRouterResponse */ healthTreatment(pmcData: IPmcData, healthTreatmentRequest: IHealthTreatmentRequestData, sessionID: string): IItemEventRouterResponse; /** @@ -66,12 +67,4 @@ export declare class HealthController { * @param sessionID */ applyWorkoutChanges(pmcData: IPmcData, info: IWorkoutData, sessionId: string): void; - /** - * Iterate over treatment request diff and find effects to remove from player limbs - * @param sessionId - * @param profile Profile to update - * @param treatmentRequest client request - * @param output response to send to client - */ - protected removeEffectsAfterPostRaidHeal(sessionId: string, profile: IPmcData, treatmentRequest: IHealthTreatmentRequestData, output: IItemEventRouterResponse): void; } diff --git a/TypeScript/3GetSptConfigFile/types/controllers/HideoutController.d.ts b/TypeScript/3GetSptConfigFile/types/controllers/HideoutController.d.ts index 877c076..a90a16d 100644 --- a/TypeScript/3GetSptConfigFile/types/controllers/HideoutController.d.ts +++ b/TypeScript/3GetSptConfigFile/types/controllers/HideoutController.d.ts @@ -88,11 +88,11 @@ export declare class HideoutController { * @param pmcData Profile to edit * @param output Object to send back to client * @param sessionID Session/player id - * @param profileHideoutArea Current hideout data for profile + * @param profileParentHideoutArea Current hideout area for profile * @param dbHideoutArea Hideout area being upgraded * @param hideoutStage Stage hideout area is being upgraded to */ - protected addContainerImprovementToProfile(output: IItemEventRouterResponse, sessionID: string, pmcData: IPmcData, profileHideoutArea: HideoutArea, dbHideoutArea: IHideoutArea, hideoutStage: Stage): void; + protected addContainerImprovementToProfile(output: IItemEventRouterResponse, sessionID: string, pmcData: IPmcData, profileParentHideoutArea: HideoutArea, dbHideoutArea: IHideoutArea, hideoutStage: Stage): void; /** * Add an inventory item to profile from a hideout area stage data * @param pmcData Profile to update diff --git a/TypeScript/3GetSptConfigFile/types/controllers/LocationController.d.ts b/TypeScript/3GetSptConfigFile/types/controllers/LocationController.d.ts index 94d496a..94f5fce 100644 --- a/TypeScript/3GetSptConfigFile/types/controllers/LocationController.d.ts +++ b/TypeScript/3GetSptConfigFile/types/controllers/LocationController.d.ts @@ -4,6 +4,7 @@ import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { ILocationBase } from "../models/eft/common/ILocationBase"; import { ILocationsGenerateAllResponse } from "../models/eft/common/ILocationsSourceDestinationBase"; import { IAirdropLootResult } from "../models/eft/location/IAirdropLootResult"; +import { IGetLocationRequestData } from "../models/eft/location/IGetLocationRequestData"; import { AirdropTypeEnum } from "../models/enums/AirdropType"; import { IAirdropConfig } from "../models/spt/config/IAirdropConfig"; import { ILocationConfig } from "../models/spt/config/ILocationConfig"; @@ -34,10 +35,11 @@ export declare class LocationController { /** * Handle client/location/getLocalloot * Get a location (map) with generated loot data - * @param location Map to generate loot for + * @param sessionId Player id + * @param request Map request to generate * @returns ILocationBase */ - get(location: string): ILocationBase; + get(sessionId: string, request: IGetLocationRequestData): ILocationBase; /** * Generate a maps base location with loot * @param name Map name diff --git a/TypeScript/3GetSptConfigFile/types/controllers/QuestController.d.ts b/TypeScript/3GetSptConfigFile/types/controllers/QuestController.d.ts index 7d494a6..bd8a70f 100644 --- a/TypeScript/3GetSptConfigFile/types/controllers/QuestController.d.ts +++ b/TypeScript/3GetSptConfigFile/types/controllers/QuestController.d.ts @@ -61,7 +61,7 @@ export declare class QuestController { * @param playerLevel level of player to test against quest * @returns true if quest can be seen/accepted by player of defined level */ - protected playerLevelFulfillsQuestRequrement(quest: IQuest, playerLevel: number): boolean; + protected playerLevelFulfillsQuestRequirement(quest: IQuest, playerLevel: number): boolean; /** * Should a quest be shown to the player in trader quest screen * @param questId Quest to check diff --git a/TypeScript/3GetSptConfigFile/types/controllers/RagfairController.d.ts b/TypeScript/3GetSptConfigFile/types/controllers/RagfairController.d.ts index 76c27f7..bda37cd 100644 --- a/TypeScript/3GetSptConfigFile/types/controllers/RagfairController.d.ts +++ b/TypeScript/3GetSptConfigFile/types/controllers/RagfairController.d.ts @@ -21,6 +21,7 @@ import { IGetMarketPriceRequestData } from "../models/eft/ragfair/IGetMarketPric import { IGetOffersResult } from "../models/eft/ragfair/IGetOffersResult"; import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; import { ISearchRequestData } from "../models/eft/ragfair/ISearchRequestData"; +import { IProcessBuyTradeRequestData } from "../models/eft/trade/IProcessBuyTradeRequestData"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; @@ -125,6 +126,18 @@ export declare class RagfairController { * @returns IItemEventRouterResponse */ addPlayerOffer(pmcData: IPmcData, offerRequest: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Charge player a listing fee for using flea, pulls charge from data previously sent by client + * @param sessionID Player id + * @param rootItem Base item being listed (used when client tax cost not found and must be done on server) + * @param pmcData Player profile + * @param requirementsPriceInRub Rouble cost player chose for listing (used when client tax cost not found and must be done on server) + * @param itemStackCount How many items were listed in player (used when client tax cost not found and must be done on server) + * @param offerRequest Add offer request object from client + * @param output IItemEventRouterResponse + * @returns True if charging tax to player failed + */ + protected chargePlayerTaxFee(sessionID: string, rootItem: Item, pmcData: IPmcData, requirementsPriceInRub: number, itemStackCount: number, offerRequest: IAddOfferRequestData, output: IItemEventRouterResponse): boolean; /** * Is the item to be listed on the flea valid * @param offerRequest Client offer request @@ -158,4 +171,11 @@ export declare class RagfairController { */ removeOffer(offerId: string, sessionID: string): IItemEventRouterResponse; extendOffer(info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Create a basic trader request object with price and currency type + * @param currency What currency: RUB, EURO, USD + * @param value Amount of currency + * @returns IProcessBuyTradeRequestData + */ + protected createBuyTradeRequestObject(currency: string, value: number): IProcessBuyTradeRequestData; } diff --git a/TypeScript/3GetSptConfigFile/types/generators/BotEquipmentModGenerator.d.ts b/TypeScript/3GetSptConfigFile/types/generators/BotEquipmentModGenerator.d.ts index ccbbbbf..f7abb84 100644 --- a/TypeScript/3GetSptConfigFile/types/generators/BotEquipmentModGenerator.d.ts +++ b/TypeScript/3GetSptConfigFile/types/generators/BotEquipmentModGenerator.d.ts @@ -14,7 +14,6 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; import { BotEquipmentModPoolService } from "../services/BotEquipmentModPoolService"; import { BotModLimits, BotWeaponModLimitService } from "../services/BotWeaponModLimitService"; -import { ItemBaseClassService } from "../services/ItemBaseClassService"; import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; @@ -29,7 +28,6 @@ export declare class BotEquipmentModGenerator { protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; protected botEquipmentFilterService: BotEquipmentFilterService; - protected itemBaseClassService: ItemBaseClassService; protected itemFilterService: ItemFilterService; protected profileHelper: ProfileHelper; protected botWeaponModLimitService: BotWeaponModLimitService; @@ -40,7 +38,7 @@ export declare class BotEquipmentModGenerator { protected botEquipmentModPoolService: BotEquipmentModPoolService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, itemHelper: ItemHelper, botEquipmentFilterService: BotEquipmentFilterService, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponModLimitService: BotWeaponModLimitService, botHelper: BotHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, botEquipmentModPoolService: BotEquipmentModPoolService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, itemHelper: ItemHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponModLimitService: BotWeaponModLimitService, botHelper: BotHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, botEquipmentModPoolService: BotEquipmentModPoolService, configServer: ConfigServer); /** * Check mods are compatible and add to array * @param equipment Equipment item to add mods to diff --git a/TypeScript/3GetSptConfigFile/types/generators/LocationGenerator.d.ts b/TypeScript/3GetSptConfigFile/types/generators/LocationGenerator.d.ts index b8169d3..46a514b 100644 --- a/TypeScript/3GetSptConfigFile/types/generators/LocationGenerator.d.ts +++ b/TypeScript/3GetSptConfigFile/types/generators/LocationGenerator.d.ts @@ -65,10 +65,11 @@ export declare class LocationGenerator { protected getGuaranteedContainers(staticContainersOnMap: IStaticContainerData[]): IStaticContainerData[]; /** * Choose a number of containers based on their probabilty value to fulfil the desired count in containerData.chosenCount + * @param groupId Name of the group the containers are being collected for * @param containerData Containers and probability values for a groupId * @returns List of chosen container Ids */ - protected getContainersByProbabilty(containerData: IContainerGroupCount): string[]; + protected getContainersByProbabilty(groupId: string, containerData: IContainerGroupCount): string[]; /** * Get a mapping of each groupid and the containers in that group + count of containers to spawn on map * @param containersGroups Container group values diff --git a/TypeScript/3GetSptConfigFile/types/generators/PMCLootGenerator.d.ts b/TypeScript/3GetSptConfigFile/types/generators/PMCLootGenerator.d.ts index 9acff69..abb5615 100644 --- a/TypeScript/3GetSptConfigFile/types/generators/PMCLootGenerator.d.ts +++ b/TypeScript/3GetSptConfigFile/types/generators/PMCLootGenerator.d.ts @@ -31,12 +31,12 @@ export declare class PMCLootGenerator { */ generatePMCVestLootPool(): string[]; /** - * Check if item has a width/height that lets it fit into a 1x2/2x1 slot - * 1x1 / 1x2 / 2x1 + * Check if item has a width/height that lets it fit into a 2x2 slot + * 1x1 / 1x2 / 2x1 / 2x2 * @param item Item to check size of * @returns true if it fits */ - protected itemFitsInto1By2Slot(item: ITemplateItem): boolean; + protected itemFitsInto2By2Slot(item: ITemplateItem): boolean; /** * Create an array of loot items a PMC can have in their backpack * @returns string array of tpls diff --git a/TypeScript/3GetSptConfigFile/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/3GetSptConfigFile/types/generators/RagfairOfferGenerator.d.ts index a627191..58e0b68 100644 --- a/TypeScript/3GetSptConfigFile/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/3GetSptConfigFile/types/generators/RagfairOfferGenerator.d.ts @@ -55,11 +55,10 @@ export declare class RagfairOfferGenerator { * @param items Items in the offer * @param barterScheme Cost of item (currency or barter) * @param loyalLevel Loyalty level needed to buy item - * @param price Price of offer - * @param sellInOnePiece Set StackObjectsCount to 1 + * @param sellInOnePiece Flags sellInOnePiece to be true * @returns IRagfairOffer */ - createFleaOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; + createFleaOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, sellInOnePiece?: boolean): IRagfairOffer; /** * Create an offer object ready to send to ragfairOfferService.addOffer() * @param userID Owner of the offer @@ -67,17 +66,16 @@ export declare class RagfairOfferGenerator { * @param items Items in the offer * @param barterScheme Cost of item (currency or barter) * @param loyalLevel Loyalty level needed to buy item - * @param price Price of offer * @param sellInOnePiece Set StackObjectsCount to 1 * @returns IRagfairOffer */ - protected createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; + protected createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, sellInOnePiece?: boolean): IRagfairOffer; /** * Calculate the offer price that's listed on the flea listing * @param offerRequirements barter requirements for offer * @returns rouble cost of offer */ - protected calculateOfferListingPrice(offerRequirements: OfferRequirement[]): number; + protected convertOfferRequirementsIntoRoubles(offerRequirements: OfferRequirement[]): number; /** * Get avatar url from trader table in db * @param isTrader Is user we're getting avatar for a trader @@ -137,7 +135,7 @@ export declare class RagfairOfferGenerator { * @param itemDetails raw db item details * @returns Item array */ - protected createSingleOfferForItem(items: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; + protected createSingleOfferForItem(items: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; /** * Generate trader offers on flea using the traders assort data * @param traderID Trader to generate offers for @@ -151,7 +149,7 @@ export declare class RagfairOfferGenerator { * @param itemDetails db details of first item * @returns */ - protected getItemCondition(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): Item[]; + protected randomiseItemUpdProperties(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): Item[]; /** * Get the relevant condition id if item tpl matches in ragfair.json/condition * @param tpl Item to look for matching condition object @@ -184,7 +182,7 @@ export declare class RagfairOfferGenerator { * @param offerItems Items for sale in offer * @returns Barter scheme */ - protected createBarterRequirement(offerItems: Item[]): IBarterScheme[]; + protected createBarterBarterScheme(offerItems: Item[]): IBarterScheme[]; /** * Get an array of flea prices + item tpl, cached in generator class inside `allowedFleaPriceItemsForBarter` * @returns array with tpl/price values @@ -196,7 +194,9 @@ export declare class RagfairOfferGenerator { /** * Create a random currency-based barter scheme for an array of items * @param offerItems Items on offer + * @param isPackOffer Is the barter scheme being created for a pack offer + * @param multipler What to multiply the resulting price by * @returns Barter scheme for offer */ - protected createCurrencyRequirement(offerItems: Item[]): IBarterScheme[]; + protected createCurrencyBarterScheme(offerItems: Item[], isPackOffer: boolean, multipler?: number): IBarterScheme[]; } diff --git a/TypeScript/3GetSptConfigFile/types/generators/ScavCaseRewardGenerator.d.ts b/TypeScript/3GetSptConfigFile/types/generators/ScavCaseRewardGenerator.d.ts index 4ba1888..b5935d0 100644 --- a/TypeScript/3GetSptConfigFile/types/generators/ScavCaseRewardGenerator.d.ts +++ b/TypeScript/3GetSptConfigFile/types/generators/ScavCaseRewardGenerator.d.ts @@ -25,6 +25,8 @@ export declare class ScavCaseRewardGenerator { protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected scavCaseConfig: IScavCaseConfig; + protected dbItemsCache: ITemplateItem[]; + protected dbAmmoItemsCache: ITemplateItem[]; constructor(logger: ILogger, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * Create an array of rewards that will be given to the player upon completing their scav case build @@ -33,10 +35,10 @@ export declare class ScavCaseRewardGenerator { */ generate(recipeId: string): Product[]; /** - * Get all db items that are not blacklisted in scavcase config - * @returns filtered array of db items + * Get all db items that are not blacklisted in scavcase config or global blacklist + * Store in class field */ - protected getDbItems(): ITemplateItem[]; + protected cacheDbItems(): void; /** * Pick a number of items to be rewards, the count is defined by the values in * @param items item pool to pick rewards from diff --git a/TypeScript/3GetSptConfigFile/types/generators/WeatherGenerator.d.ts b/TypeScript/3GetSptConfigFile/types/generators/WeatherGenerator.d.ts index 2e2403c..6471bb1 100644 --- a/TypeScript/3GetSptConfigFile/types/generators/WeatherGenerator.d.ts +++ b/TypeScript/3GetSptConfigFile/types/generators/WeatherGenerator.d.ts @@ -52,6 +52,7 @@ export declare class WeatherGenerator { */ protected setCurrentDateTime(weather: IWeather): void; protected getWeightedWindDirection(): WindDirection; + protected getWeightedClouds(): number; protected getWeightedWindSpeed(): number; protected getWeightedFog(): number; protected getWeightedRain(): number; diff --git a/TypeScript/3GetSptConfigFile/types/helpers/HealthHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/HealthHelper.d.ts index 3694a6e..e4cdcd6 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/HealthHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/HealthHelper.d.ts @@ -27,6 +27,7 @@ export declare class HealthHelper { * @param request Heal request * @param sessionID Session id * @param addEffects Should effects be added or removed (default - add) + * @param deleteExistingEffects Should all prior effects be removed before apply new ones */ saveVitality(pmcData: IPmcData, request: ISyncHealthRequestData, sessionID: string, addEffects?: boolean, deleteExistingEffects?: boolean): void; /** diff --git a/TypeScript/3GetSptConfigFile/types/helpers/InRaidHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/InRaidHelper.d.ts index bf584c2..b4c0c1c 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/InRaidHelper.d.ts @@ -53,7 +53,7 @@ export declare class InRaidHelper { * @param victim Who was killed by player * @returns a numerical standing gain or loss */ - protected getStandingChangeForKill(victim: Victim): number; + protected getFenceStandingChangeForKillAsScav(victim: Victim): number; /** * Reset a profile to a baseline, used post-raid * Reset points earned during session property diff --git a/TypeScript/3GetSptConfigFile/types/helpers/ItemHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/ItemHelper.d.ts index 99fca56..00f190f 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/ItemHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/ItemHelper.d.ts @@ -26,6 +26,7 @@ declare class ItemHelper { protected itemBaseClassService: ItemBaseClassService; protected localisationService: LocalisationService; protected localeService: LocaleService; + protected readonly defaultInvalidBaseTypes: string[]; constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, localisationService: LocalisationService, localeService: LocaleService); /** * Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash @@ -67,6 +68,11 @@ declare class ItemHelper { * @returns Price in roubles (undefined if not found) */ getDynamicItemPrice(tpl: string): number; + /** + * Update items upd.StackObjectsCount to be 1 if its upd is missing or StackObjectsCount is undefined + * @param item Item to update + * @returns Fixed item + */ fixItemStackCount(item: Item): Item; /** * AmmoBoxes contain StackSlots which need to be filled for the AmmoBox to have content. @@ -125,19 +131,19 @@ declare class ItemHelper { getItemQualityModifier(item: Item): number; /** * Get a quality value based on a repairable items (weapon/armor) current state between current and max durability - * @param itemDetails - * @param repairable repairable object - * @param item - * @returns a number between 0 and 1 + * @param itemDetails Db details for item we want quality value for + * @param repairable Repairable properties + * @param item Item quality value is for + * @returns A number between 0 and 1 */ protected getRepairableItemQualityValue(itemDetails: ITemplateItem, repairable: Repairable, item: Item): number; /** * Recursive function that looks at every item from parameter and gets their childrens Ids + includes parent item in results - * @param items - * @param itemID + * @param items Array of items (item + possible children) + * @param itemId Parent items id * @returns an array of strings */ - findAndReturnChildrenByItems(items: Item[], itemID: string): string[]; + findAndReturnChildrenByItems(items: Item[], itemId: string): string[]; /** * A variant of findAndReturnChildren where the output is list of item objects instead of their ids. * @param items @@ -164,12 +170,6 @@ declare class ItemHelper { * @returns true if it is a dogtag */ isDogtag(tpl: string): boolean; - /** - * Can the item passed in be sold to a trader because it is raw money - * @param tpl Item template id to check - * @returns true if unsellable - */ - isNotSellable(tpl: string): boolean; /** * Gets the identifier for a child using slotId, locationX and locationY. * @param item @@ -183,19 +183,19 @@ declare class ItemHelper { */ isItemTplStackable(tpl: string): boolean; /** - * split item stack if it exceeds its StackMaxSize property - * @param itemToSplit item being split into smaller stacks + * split item stack if it exceeds its items StackMaxSize property + * @param itemToSplit Item to split into smaller stacks * @returns Array of split items */ splitStack(itemToSplit: Item): Item[]; /** - * Find Barter items in the inventory + * Find Barter items from array of items * @param {string} by tpl or id - * @param {Object} pmcData + * @param {Item[]} items Array of items to iterate over * @param {string} barterItemId * @returns Array of Item objects */ - findBarterItems(by: "tpl" | "id", pmcData: IPmcData, barterItemId: string): Item[]; + findBarterItems(by: "tpl" | "id", items: Item[], barterItemId: string): Item[]; /** * Regenerate all guids with new ids, exceptions are for items that cannot be altered (e.g. stash/sorting table) * @param pmcData Player profile @@ -262,10 +262,21 @@ declare class ItemHelper { * @param minSizePercent % the magazine must be filled to */ fillMagazineWithCartridge(magazine: Item[], magTemplate: ITemplateItem, cartridgeTpl: string, minSizePercent?: number): void; + /** + * Choose a random bullet type from the list of possible a magazine has + * @param magTemplate Magazine template from Db + * @returns Tpl of cartridge + */ protected getRandomValidCaliber(magTemplate: ITemplateItem): string; + /** + * Chose a randomly weighted cartridge that fits + * @param caliber Desired caliber + * @param staticAmmoDist Cartridges and thier weights + * @returns Tpl of cartrdige + */ protected drawAmmoTpl(caliber: string, staticAmmoDist: Record): string; /** - * + * Create a basic cartrige object * @param parentId container cartridges will be placed in * @param ammoTpl Cartridge to insert * @param stackCount Count of cartridges inside parent diff --git a/TypeScript/3GetSptConfigFile/types/helpers/QuestHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/QuestHelper.d.ts index e04b6e0..5c749d3 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/QuestHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/QuestHelper.d.ts @@ -21,6 +21,7 @@ import { DialogueHelper } from "./DialogueHelper"; import { ItemHelper } from "./ItemHelper"; import { PaymentHelper } from "./PaymentHelper"; import { ProfileHelper } from "./ProfileHelper"; +import { QuestConditionHelper } from "./QuestConditionHelper"; import { RagfairServerHelper } from "./RagfairServerHelper"; import { TraderHelper } from "./TraderHelper"; export declare class QuestHelper { @@ -29,6 +30,7 @@ export declare class QuestHelper { protected timeUtil: TimeUtil; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; + protected questConditionHelper: QuestConditionHelper; protected eventOutputHolder: EventOutputHolder; protected databaseServer: DatabaseServer; protected localeService: LocaleService; @@ -41,7 +43,7 @@ export declare class QuestHelper { protected mailSendService: MailSendService; protected configServer: ConfigServer; 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, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, questConditionHelper: QuestConditionHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, mailSendService: MailSendService, configServer: ConfigServer); /** * Get status of a quest in player profile by its id * @param pmcData Profile to search @@ -119,7 +121,7 @@ export declare class QuestHelper { * @param sessionID Session id * @returns Quests accessible to player incuding newly unlocked quests now quest (startedQuestId) was started */ - acceptedUnlocked(startedQuestId: string, sessionID: string): IQuest[]; + getNewlyAccessibleQuestsWhenStartingQuest(startedQuestId: string, sessionID: string): IQuest[]; /** * Get quests that can be shown to player after failing a quest * @param failedQuestId Id of the quest failed by player diff --git a/TypeScript/3GetSptConfigFile/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/RagfairOfferHelper.d.ts index de9d550..0699259 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/RagfairOfferHelper.d.ts @@ -1,4 +1,5 @@ import { IPmcData } from "../models/eft/common/IPmcData"; +import { Item } from "../models/eft/common/tables/IItem"; import { ITraderAssort } from "../models/eft/common/tables/ITrader"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; @@ -13,10 +14,10 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { LocaleService } from "../services/LocaleService"; import { LocalisationService } from "../services/LocalisationService"; +import { MailSendService } from "../services/MailSendService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { HashUtil } from "../utils/HashUtil"; import { TimeUtil } from "../utils/TimeUtil"; -import { DialogueHelper } from "./DialogueHelper"; import { ItemHelper } from "./ItemHelper"; import { PaymentHelper } from "./PaymentHelper"; import { PresetHelper } from "./PresetHelper"; @@ -33,7 +34,6 @@ export declare class RagfairOfferHelper { protected databaseServer: DatabaseServer; protected traderHelper: TraderHelper; protected saveServer: SaveServer; - protected dialogueHelper: DialogueHelper; protected itemHelper: ItemHelper; protected paymentHelper: PaymentHelper; protected presetHelper: PresetHelper; @@ -44,11 +44,12 @@ export declare class RagfairOfferHelper { protected ragfairOfferService: RagfairOfferService; protected localeService: LocaleService; protected localisationService: LocalisationService; + protected mailSendService: MailSendService; protected configServer: ConfigServer; protected static goodSoldTemplate: string; protected ragfairConfig: IRagfairConfig; 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, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, localisationService: LocalisationService, mailSendService: MailSendService, configServer: ConfigServer); /** * Passthrough to ragfairOfferService.getOffers(), get flea offers a player should see * @param searchRequest Data from client @@ -119,19 +120,26 @@ export declare class RagfairOfferHelper { */ protected getProfileOffers(sessionID: string): IRagfairOffer[]; /** - * Delete an offer from a desired profile + * Delete an offer from a desired profile and from ragfair offers * @param sessionID Session id of profile to delete offer from - * @param offerId Offer id to delete + * @param offerId Id of offer to delete */ - protected deleteOfferByOfferId(sessionID: string, offerId: string): void; + protected deleteOfferById(sessionID: string, offerId: string): void; /** * Complete the selling of players' offer * @param sessionID Session id * @param offer Sold offer details * @param boughtAmount Amount item was purchased for - * @returns Client response + * @returns IItemEventRouterResponse */ protected completeOffer(sessionID: string, offer: IRagfairOffer, boughtAmount: number): IItemEventRouterResponse; + /** + * Get a localised message for when players offer has sold on flea + * @param itemTpl Item sold + * @param boughtAmount How many were purchased + * @returns Localised message text + */ + protected getLocalisedOfferSoldMessage(itemTpl: string, boughtAmount: number): string; /** * Should a ragfair offer be visible to the player * @param searchRequest Search request @@ -142,4 +150,12 @@ export declare class RagfairOfferHelper { * @returns True = should be shown to player */ isDisplayableOffer(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, offer: IRagfairOffer, pmcProfile: IPmcData): boolean; + /** + * Is items quality value within desired range + * @param item Item to check quality of + * @param min Desired minimum quality + * @param max Desired maximum quality + * @returns True if in range + */ + protected itemQualityInRange(item: Item, min: number, max: number): boolean; } diff --git a/TypeScript/3GetSptConfigFile/types/helpers/RagfairSellHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/RagfairSellHelper.d.ts index 251d7ca..913b408 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/RagfairSellHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/RagfairSellHelper.d.ts @@ -13,12 +13,12 @@ export declare class RagfairSellHelper { constructor(logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, configServer: ConfigServer); /** * Get the percent chance to sell an item based on its average listed price vs player chosen listing price - * @param baseChancePercent Base chance to sell item * @param averageOfferPriceRub Price of average offer in roubles * @param playerListedPriceRub Price player listed item for in roubles + * @param qualityMultiplier Quality multipler of item being sold * @returns percent value */ - calculateSellChance(baseChancePercent: number, averageOfferPriceRub: number, playerListedPriceRub: number): number; + calculateSellChance(averageOfferPriceRub: number, playerListedPriceRub: number, qualityMultiplier: number): number; /** * Get percent chance to sell an item when price is below items average listing price * @param playerListedPriceRub Price player listed item for in roubles diff --git a/TypeScript/3GetSptConfigFile/types/helpers/TraderHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/TraderHelper.d.ts index c163f7a..6680ccf 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/TraderHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/TraderHelper.d.ts @@ -35,7 +35,7 @@ export declare class TraderHelper { protected highestTraderBuyPriceItems: Record; constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, handbookHelper: HandbookHelper, itemHelper: ItemHelper, playerService: PlayerService, localisationService: LocalisationService, fenceService: FenceService, timeUtil: TimeUtil, randomUtil: RandomUtil, configServer: ConfigServer); getTrader(traderID: string, sessionID: string): ITraderBase; - getTraderAssortsById(traderId: string): ITraderAssort; + getTraderAssortsByTraderId(traderId: string): ITraderAssort; /** * 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 diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/IBotBase.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/IBotBase.d.ts index ee40958..6c7b76f 100644 --- a/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/IBotBase.d.ts @@ -281,7 +281,7 @@ export interface InsuredItem { export interface Hideout { Production: Record; Areas: HideoutArea[]; - Improvements: Record; + Improvement: Record; Seed: number; sptUpdateLastRunTimestamp: number; } diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/health/IHealthTreatmentRequestData.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/health/IHealthTreatmentRequestData.d.ts index 7fb80a8..598e60c 100644 --- a/TypeScript/3GetSptConfigFile/types/models/eft/health/IHealthTreatmentRequestData.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/eft/health/IHealthTreatmentRequestData.d.ts @@ -1,12 +1,14 @@ export interface IHealthTreatmentRequestData { Action: "RestoreHealth"; trader: string; - items: Item[]; + items: Cost[]; difference: Difference; timestamp: number; } -export interface Item { +export interface Cost { + /** Id of stack to take money from */ id: string; + /** Amount of money to take off player for treatment */ count: number; } export interface Difference { @@ -25,5 +27,6 @@ export interface BodyParts { } export interface BodyPart { Health: number; + /** Effects in array are to be removed */ Effects: string[]; } diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/notifier/INotifier.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/notifier/INotifier.d.ts index ce25dee..c6c6979 100644 --- a/TypeScript/3GetSptConfigFile/types/models/eft/notifier/INotifier.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/eft/notifier/INotifier.d.ts @@ -14,6 +14,11 @@ export interface INotification { } export declare enum NotificationType { RAGFAIR_OFFER_SOLD = "RagfairOfferSold", + RAGFAIR_RATING_CHANGE = "RagfairRatingChange", + /** ChatMessageReceived */ NEW_MESSAGE = "new_message", - PING = "ping" + PING = "ping", + TRADER_SUPPLY = "TraderSupply", + TRADER_STANDING = "TraderStanding", + UNLOCK_TRADER = "UnlockTrader" } diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/notifier/ISelectProfileResponse.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/notifier/ISelectProfileResponse.d.ts index ecb668a..f2d6be7 100644 --- a/TypeScript/3GetSptConfigFile/types/models/eft/notifier/ISelectProfileResponse.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/eft/notifier/ISelectProfileResponse.d.ts @@ -1,6 +1,3 @@ -import { INotifierChannel } from "./INotifier"; export interface ISelectProfileResponse { status: string; - notifier: INotifierChannel; - notifierServer: string; } diff --git a/TypeScript/3GetSptConfigFile/types/models/enums/WeatherType.d.ts b/TypeScript/3GetSptConfigFile/types/models/enums/WeatherType.d.ts index d31fefe..503dc30 100644 --- a/TypeScript/3GetSptConfigFile/types/models/enums/WeatherType.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/enums/WeatherType.d.ts @@ -1,19 +1,19 @@ export declare enum WeatherType { - CLEAR_DAY = 1, - CLEAR_WIND = 2, - CLEAR_NIGHT = 3, - PARTLY_CLOUD_DAY = 4, - PARTLY_CLOUD_NIGHT = 5, - CLEAR_FOG_DAY = 6, - CLEAR_FOG_NIGHT = 7, - CLOUDFOG = 8, - FOG = 9, - MOSTLY_CLOUD = 10, - LIGHT_RAIN = 11, - RAIN = 12, - CLOUD_WIND = 13, - CLOUD_WIND_RAIN = 14, - FULL_CLOUD = 15, - THUNDER_CLOUD = 16, - NONE = 0 + CLEAR_DAY = 0, + CLEAR_WIND = 1, + CLEAR_NIGHT = 2, + PARTLY_CLOUD_DAY = 3, + PARTLY_CLOUD_NIGHT = 4, + CLEAR_FOG_DAY = 5, + CLEAR_FOG_NIGHT = 6, + CLOUD_FOG = 7, + FOG = 8, + MOSTLY_CLOUD = 9, + LIGHT_RAIN = 10, + RAIN = 11, + CLOUD_WIND = 12, + CLOUD_WIND_RAIN = 13, + FULL_CLOUD = 14, + THUNDER_CLOUD = 15, + NONE = 16 } diff --git a/TypeScript/3GetSptConfigFile/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/config/IRagfairConfig.d.ts index 7c04857..7aea24f 100644 --- a/TypeScript/3GetSptConfigFile/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/spt/config/IRagfairConfig.d.ts @@ -41,7 +41,8 @@ export interface Dynamic { /** Use the highest trader price for an offer if its greater than the price in templates/prices.json */ useTraderPriceForOffersIfHigher: boolean; /** Barter offer specific settings */ - barter: Barter; + barter: IBarterDetails; + pack: IPackDetails; /** Dynamic offer price below handbook adjustment values */ offerAdjustment: OfferAdjustment; /** How many offers should expire before an offer regeneration occurs */ @@ -49,9 +50,7 @@ export interface Dynamic { /** How many offers should be listed */ offerItemCount: MinMax; /** How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) */ - price: MinMax; - /** How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) */ - presetPrice: MinMax; + priceRanges: IPriceRanges; /** Should default presets to listed only or should non-standard presets found in globals.json be listed too */ showDefaultPresetsOnly: boolean; endTimeSeconds: MinMax; @@ -74,7 +73,12 @@ export interface Dynamic { /** Dict of price limits keyed by item type */ unreasonableModPrices: Record; } -export interface Barter { +export interface IPriceRanges { + default: MinMax; + preset: MinMax; + pack: MinMax; +} +export interface IBarterDetails { /** Should barter offers be generated */ enable: boolean; /** Percentage change an offer is listed as a barter */ @@ -90,6 +94,18 @@ export interface Barter { /** Item Tpls to never be turned into a barter */ itemTypeBlacklist: string[]; } +export interface IPackDetails { + /** Should pack offers be generated */ + enable: boolean; + /** Percentage change an offer is listed as a pack */ + chancePercent: number; + /** Min number of required items for a pack */ + itemCountMin: number; + /** Max number of required items for a pack */ + itemCountMax: number; + /** item types to allow being a pack */ + itemTypeWhitelist: string[]; +} export interface OfferAdjustment { /** Shuld offer price be adjusted when below handbook price */ adjustPriceWhenBelowHandbookPrice: boolean; diff --git a/TypeScript/3GetSptConfigFile/types/models/spt/config/IWeatherConfig.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/config/IWeatherConfig.d.ts index 41a1c83..6ecf35b 100644 --- a/TypeScript/3GetSptConfigFile/types/models/spt/config/IWeatherConfig.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/spt/config/IWeatherConfig.d.ts @@ -7,7 +7,7 @@ export interface IWeatherConfig extends IBaseConfig { weather: Weather; } export interface Weather { - clouds: MinMax; + clouds: WeatherSettings; windSpeed: WeatherSettings; windDirection: WeatherSettings; windGustiness: MinMax; diff --git a/TypeScript/3GetSptConfigFile/types/services/HashCacheService.d.ts b/TypeScript/3GetSptConfigFile/types/services/HashCacheService.d.ts index 5320f28..9968478 100644 --- a/TypeScript/3GetSptConfigFile/types/services/HashCacheService.d.ts +++ b/TypeScript/3GetSptConfigFile/types/services/HashCacheService.d.ts @@ -11,7 +11,18 @@ export declare class HashCacheService { protected modHashes: any; protected readonly modCachePath = "./user/cache/modCache.json"; constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); + /** + * Return a stored hash by key + * @param modName Name of mod to get hash for + * @returns Mod hash + */ getStoredModHash(modName: string): string; + /** + * Does the generated hash match the stored hash + * @param modName name of mod + * @param modContent + * @returns True if they match + */ modContentMatchesStoredHash(modName: string, modContent: string): boolean; hashMatchesStoredHash(modName: string, modHash: string): boolean; storeModContent(modName: string, modContent: string): void; diff --git a/TypeScript/3GetSptConfigFile/types/services/MailSendService.d.ts b/TypeScript/3GetSptConfigFile/types/services/MailSendService.d.ts index 19397dc..fe4a7fe 100644 --- a/TypeScript/3GetSptConfigFile/types/services/MailSendService.d.ts +++ b/TypeScript/3GetSptConfigFile/types/services/MailSendService.d.ts @@ -35,7 +35,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendDirectNpcMessageToPlayer(playerId: string, sender: Traders, messageType: MessageType, message: string, items?: Item[], maxStorageTimeSeconds?: any): void; + sendDirectNpcMessageToPlayer(playerId: string, sender: Traders, messageType: MessageType, message: string, items?: Item[], maxStorageTimeSeconds?: any, systemData?: any, ragfair?: any): void; /** * Send a message from an NPC (e.g. prapor) to the player with or without items * @param playerId Players id to send message to @@ -45,7 +45,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendLocalisedNpcMessageToPlayer(playerId: string, sender: Traders, messageType: MessageType, messageLocaleId: string, items?: Item[], maxStorageTimeSeconds?: any, systemData?: any): void; + sendLocalisedNpcMessageToPlayer(playerId: string, sender: Traders, messageType: MessageType, messageLocaleId: string, items?: Item[], maxStorageTimeSeconds?: any, systemData?: any, ragfair?: any): void; /** * Send a message from SYSTEM to the player with or without items * @param playerId Players id to send message to diff --git a/TypeScript/3GetSptConfigFile/types/services/MatchBotDetailsCacheService.d.ts b/TypeScript/3GetSptConfigFile/types/services/MatchBotDetailsCacheService.d.ts index eb365dd..c1bd322 100644 --- a/TypeScript/3GetSptConfigFile/types/services/MatchBotDetailsCacheService.d.ts +++ b/TypeScript/3GetSptConfigFile/types/services/MatchBotDetailsCacheService.d.ts @@ -1,7 +1,7 @@ import { IBotBase } from "../models/eft/common/tables/IBotBase"; import { ILogger } from "../models/spt/utils/ILogger"; import { LocalisationService } from "./LocalisationService"; -/** Cache bots in a dictionary, keyed by the bots name, keying by name isnt idea as its not unique but this is used by the post-raid system which doesnt have any bot ids, only name */ +/** Cache bots in a dictionary, keyed by the bots name, keying by name isnt ideal as its not unique but this is used by the post-raid system which doesnt have any bot ids, only name */ export declare class MatchBotDetailsCacheService { protected logger: ILogger; protected localisationService: LocalisationService; @@ -17,9 +17,9 @@ export declare class MatchBotDetailsCacheService { */ clearCache(): void; /** - * Find a bot in the cache by its name + * Find a bot in the cache by its name and side * @param botName Name of bot to find * @returns Bot details */ - getBotByName(botName: string): IBotBase; + getBotByNameAndSide(botName: string, botSide: string): IBotBase; } diff --git a/TypeScript/3GetSptConfigFile/types/services/ModCompilerService.d.ts b/TypeScript/3GetSptConfigFile/types/services/ModCompilerService.d.ts index a4bf3c8..e306177 100644 --- a/TypeScript/3GetSptConfigFile/types/services/ModCompilerService.d.ts +++ b/TypeScript/3GetSptConfigFile/types/services/ModCompilerService.d.ts @@ -1,14 +1,36 @@ import { CompilerOptions } from "typescript"; import type { ILogger } from "../models/spt/utils/ILogger"; -import { HashCacheService } from "./HashCacheService"; import { VFS } from "../utils/VFS"; +import { HashCacheService } from "./HashCacheService"; export declare class ModCompilerService { protected logger: ILogger; protected hashCacheService: HashCacheService; protected vfs: VFS; constructor(logger: ILogger, hashCacheService: HashCacheService, vfs: VFS); + /** + * Convert a mods TS into JS + * @param modName Name of mod + * @param modPath Dir path to mod + * @param modTypeScriptFiles + * @returns + */ compileMod(modName: string, modPath: string, modTypeScriptFiles: string[]): Promise; + /** + * Convert a TS file into JS + * @param fileNames Paths to TS files + * @param options Compiler options + */ protected compile(fileNames: string[], options: CompilerOptions): Promise; + /** + * Do the files at the provided paths exist + * @param fileNames + * @returns + */ protected areFilesReady(fileNames: string[]): boolean; + /** + * Wait the provided number of milliseconds + * @param ms Milliseconds + * @returns + */ protected delay(ms: number): Promise; } diff --git a/TypeScript/3GetSptConfigFile/types/services/PaymentService.d.ts b/TypeScript/3GetSptConfigFile/types/services/PaymentService.d.ts index 1c9c32b..fb5f92c 100644 --- a/TypeScript/3GetSptConfigFile/types/services/PaymentService.d.ts +++ b/TypeScript/3GetSptConfigFile/types/services/PaymentService.d.ts @@ -61,23 +61,26 @@ export declare class PaymentService { * Get all money stacks in inventory and prioritse items in stash * @param pmcData * @param currencyTpl + * @param playerStashId Players stash id * @returns Sorting money items */ - protected getSortedMoneyItemsInInventory(pmcData: IPmcData, currencyTpl: string): Item[]; + protected getSortedMoneyItemsInInventory(pmcData: IPmcData, currencyTpl: string, playerStashId: string): Item[]; /** * Prioritise player stash first over player inventory * Post-raid healing would often take money out of the players pockets/secure container * @param a First money stack item * @param b Second money stack item * @param inventoryItems players inventory items + * @param playerStashId Players stash id * @returns sort order */ - protected prioritiseStashSort(a: Item, b: Item, inventoryItems: Item[]): number; + protected prioritiseStashSort(a: Item, b: Item, inventoryItems: Item[], playerStashId: string): number; /** * Recursivly check items parents to see if it is inside the players inventory, not stash * @param itemId item id to check * @param inventoryItems player inventory + * @param playerStashId Players stash id * @returns true if its in inventory */ - protected isInInventory(itemId: string, inventoryItems: Item[]): boolean; + protected isInStash(itemId: string, inventoryItems: Item[], playerStashId: string): boolean; } diff --git a/TypeScript/3GetSptConfigFile/types/services/ProfileFixerService.d.ts b/TypeScript/3GetSptConfigFile/types/services/ProfileFixerService.d.ts index c8232fc..bc1e42e 100644 --- a/TypeScript/3GetSptConfigFile/types/services/ProfileFixerService.d.ts +++ b/TypeScript/3GetSptConfigFile/types/services/ProfileFixerService.d.ts @@ -14,6 +14,7 @@ import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; import { Watermark } from "../utils/Watermark"; import { LocalisationService } from "./LocalisationService"; @@ -27,17 +28,19 @@ export declare class ProfileFixerService { protected itemHelper: ItemHelper; protected localisationService: LocalisationService; protected timeUtil: TimeUtil; + protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, profileHelper: ProfileHelper, itemHelper: ItemHelper, localisationService: LocalisationService, timeUtil: TimeUtil, databaseServer: DatabaseServer, configServer: ConfigServer); + constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, profileHelper: ProfileHelper, itemHelper: ItemHelper, localisationService: LocalisationService, timeUtil: TimeUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, configServer: ConfigServer); /** * 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; protected addMissingGunStandContainerImprovements(pmcProfile: IPmcData): void; + protected ensureGunStandLevelsMatch(pmcProfile: IPmcData): void; protected addHideoutAreaStashes(pmcProfile: IPmcData): void; protected addMissingHideoutWallAreas(pmcProfile: IPmcData): void; protected adjustUnreasonableModFleaPrices(): void; @@ -131,4 +134,9 @@ export declare class ProfileFixerService { * @param pmcProfile Profile to add missing IDs to */ addMissingIdsToBonuses(pmcProfile: IPmcData): void; + /** + * At some point the property name was changed,migrate data across to new name + * @param pmcProfile + */ + protected migrateImprovements(pmcProfile: IPmcData): void; } diff --git a/TypeScript/3GetSptConfigFile/types/services/RagfairPriceService.d.ts b/TypeScript/3GetSptConfigFile/types/services/RagfairPriceService.d.ts index e245efa..ff35327 100644 --- a/TypeScript/3GetSptConfigFile/types/services/RagfairPriceService.d.ts +++ b/TypeScript/3GetSptConfigFile/types/services/RagfairPriceService.d.ts @@ -3,6 +3,7 @@ import { HandbookHelper } from "../helpers/HandbookHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { TraderHelper } from "../helpers/TraderHelper"; +import { MinMax } from "../models/common/MinMax"; import { IPreset } from "../models/eft/common/IGlobals"; import { Item } from "../models/eft/common/tables/IItem"; import { IBarterScheme } from "../models/eft/common/tables/ITrader"; @@ -35,10 +36,6 @@ export declare class RagfairPriceService implements OnLoad { * Generate static (handbook) and dynamic (prices.json) flea prices, store inside class as dictionaries */ onLoad(): Promise; - /** - * Add placeholder values for items missing from handbook - */ - protected addMissingHandbookPrices(): void; getRoute(): string; /** * Iterate over all items of type "Item" in db and get template price, store in cache @@ -91,9 +88,17 @@ export declare class RagfairPriceService implements OnLoad { * Generate a currency cost for an item and its mods * @param items Item with mods to get price for * @param desiredCurrency Currency price desired in + * @param isPackOffer Price is for a pack type offer * @returns cost of item in desired currency */ - getDynamicOfferPrice(items: Item[], desiredCurrency: string): number; + getDynamicOfferPriceForOffer(items: Item[], desiredCurrency: string, isPackOffer: boolean): number; + /** + * Get different min/max price multipliers for different offer types (preset/pack/default) + * @param isPreset Offer is a preset + * @param isPack Offer is a pack + * @returns MinMax values + */ + protected getOfferTypeRangeValues(isPreset: boolean, isPack: boolean): MinMax; /** * Check to see if an items price is below its handbook price and adjust accoring to values set to config/ragfair.json * @param itemPrice price of item @@ -104,10 +109,10 @@ export declare class RagfairPriceService implements OnLoad { /** * Multiply the price by a randomised curve where n = 2, shift = 2 * @param existingPrice price to alter - * @param isPreset is the item we're multiplying a preset + * @param rangeValues min and max to adjust price by * @returns multiplied price */ - protected randomisePrice(existingPrice: number, isPreset: boolean): number; + protected randomiseOfferPrice(existingPrice: number, rangeValues: MinMax): number; /** * Calculate the cost of a weapon preset by adding together the price of its mods + base price of default weapon preset * @param item base weapon diff --git a/TypeScript/4UseACustomConfigFile/types/callbacks/GameCallbacks.d.ts b/TypeScript/4UseACustomConfigFile/types/callbacks/GameCallbacks.d.ts index aa80036..46f79f9 100644 --- a/TypeScript/4UseACustomConfigFile/types/callbacks/GameCallbacks.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/callbacks/GameCallbacks.d.ts @@ -1,4 +1,5 @@ import { GameController } from "../controllers/GameController"; +import { OnLoad } from "../di/OnLoad"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { ICheckVersionResponse } from "../models/eft/game/ICheckVersionResponse"; import { ICurrentGroupResponse } from "../models/eft/game/ICurrentGroupResponse"; @@ -15,12 +16,14 @@ import { INullResponseData } from "../models/eft/httpResponse/INullResponseData" import { SaveServer } from "../servers/SaveServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { Watermark } from "../utils/Watermark"; -declare class GameCallbacks { +declare class GameCallbacks implements OnLoad { protected httpResponse: HttpResponseUtil; protected watermark: Watermark; protected saveServer: SaveServer; protected gameController: GameController; constructor(httpResponse: HttpResponseUtil, watermark: Watermark, saveServer: SaveServer, gameController: GameController); + onLoad(): Promise; + getRoute(): string; /** * Handle client/game/version/validate * @returns INullResponseData diff --git a/TypeScript/4UseACustomConfigFile/types/controllers/GameController.d.ts b/TypeScript/4UseACustomConfigFile/types/controllers/GameController.d.ts index 04e3abb..e88610e 100644 --- a/TypeScript/4UseACustomConfigFile/types/controllers/GameController.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/controllers/GameController.d.ts @@ -61,13 +61,14 @@ export declare class GameController { protected pmcConfig: IPmcConfig; protected lootConfig: ILootConfig; constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, randomUtil: RandomUtil, encodingUtil: EncodingUtil, hideoutHelper: HideoutHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, seasonalEventService: SeasonalEventService, itemBaseClassService: ItemBaseClassService, giftService: GiftService, applicationContext: ApplicationContext, configServer: ConfigServer); + load(): void; /** * Handle client/game/start */ gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; protected addCustomLooseLootPositions(): void; protected adjustLooseLootSpawnProbabilities(): void; - protected setHideoutAreasAndCraftsTo30Secs(): void; + protected setHideoutAreasAndCraftsTo40Secs(): void; /** * 3.7.0 moved AIDs to be numeric, old profiles need to be migrated * We store the old AID value in new field `sessionId` diff --git a/TypeScript/4UseACustomConfigFile/types/controllers/HealthController.d.ts b/TypeScript/4UseACustomConfigFile/types/controllers/HealthController.d.ts index 1938297..2d7ff09 100644 --- a/TypeScript/4UseACustomConfigFile/types/controllers/HealthController.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/controllers/HealthController.d.ts @@ -29,34 +29,35 @@ export declare class HealthController { * stores in-raid player health * @param pmcData Player profile * @param info Request data - * @param sessionID + * @param sessionID Player id * @param addEffects Should effects found be added or removed from profile + * @param deleteExistingEffects Should all prior effects be removed before apply new ones */ saveVitality(pmcData: IPmcData, info: ISyncHealthRequestData, sessionID: string, addEffects?: boolean, deleteExistingEffects?: boolean): void; /** * When healing in menu - * @param pmcData - * @param body - * @param sessionID - * @returns + * @param pmcData Player profile + * @param request Healing request + * @param sessionID Player id + * @returns IItemEventRouterResponse */ - offraidHeal(pmcData: IPmcData, body: IOffraidHealRequestData, sessionID: string): IItemEventRouterResponse; + offraidHeal(pmcData: IPmcData, request: IOffraidHealRequestData, sessionID: string): IItemEventRouterResponse; /** * Handle Eat event * Consume food/water outside of a raid * @param pmcData Player profile - * @param body request Object + * @param request Eat request * @param sessionID Session id * @returns IItemEventRouterResponse */ - offraidEat(pmcData: IPmcData, body: IOffraidEatRequestData, sessionID: string): IItemEventRouterResponse; + offraidEat(pmcData: IPmcData, request: IOffraidEatRequestData, sessionID: string): IItemEventRouterResponse; /** * Handle RestoreHealth event * Occurs on post-raid healing page * @param pmcData player profile * @param healthTreatmentRequest Request data from client * @param sessionID Session id - * @returns + * @returns IItemEventRouterResponse */ healthTreatment(pmcData: IPmcData, healthTreatmentRequest: IHealthTreatmentRequestData, sessionID: string): IItemEventRouterResponse; /** @@ -66,12 +67,4 @@ export declare class HealthController { * @param sessionID */ applyWorkoutChanges(pmcData: IPmcData, info: IWorkoutData, sessionId: string): void; - /** - * Iterate over treatment request diff and find effects to remove from player limbs - * @param sessionId - * @param profile Profile to update - * @param treatmentRequest client request - * @param output response to send to client - */ - protected removeEffectsAfterPostRaidHeal(sessionId: string, profile: IPmcData, treatmentRequest: IHealthTreatmentRequestData, output: IItemEventRouterResponse): void; } diff --git a/TypeScript/4UseACustomConfigFile/types/controllers/HideoutController.d.ts b/TypeScript/4UseACustomConfigFile/types/controllers/HideoutController.d.ts index 877c076..a90a16d 100644 --- a/TypeScript/4UseACustomConfigFile/types/controllers/HideoutController.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/controllers/HideoutController.d.ts @@ -88,11 +88,11 @@ export declare class HideoutController { * @param pmcData Profile to edit * @param output Object to send back to client * @param sessionID Session/player id - * @param profileHideoutArea Current hideout data for profile + * @param profileParentHideoutArea Current hideout area for profile * @param dbHideoutArea Hideout area being upgraded * @param hideoutStage Stage hideout area is being upgraded to */ - protected addContainerImprovementToProfile(output: IItemEventRouterResponse, sessionID: string, pmcData: IPmcData, profileHideoutArea: HideoutArea, dbHideoutArea: IHideoutArea, hideoutStage: Stage): void; + protected addContainerImprovementToProfile(output: IItemEventRouterResponse, sessionID: string, pmcData: IPmcData, profileParentHideoutArea: HideoutArea, dbHideoutArea: IHideoutArea, hideoutStage: Stage): void; /** * Add an inventory item to profile from a hideout area stage data * @param pmcData Profile to update diff --git a/TypeScript/4UseACustomConfigFile/types/controllers/LocationController.d.ts b/TypeScript/4UseACustomConfigFile/types/controllers/LocationController.d.ts index 94d496a..94f5fce 100644 --- a/TypeScript/4UseACustomConfigFile/types/controllers/LocationController.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/controllers/LocationController.d.ts @@ -4,6 +4,7 @@ import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { ILocationBase } from "../models/eft/common/ILocationBase"; import { ILocationsGenerateAllResponse } from "../models/eft/common/ILocationsSourceDestinationBase"; import { IAirdropLootResult } from "../models/eft/location/IAirdropLootResult"; +import { IGetLocationRequestData } from "../models/eft/location/IGetLocationRequestData"; import { AirdropTypeEnum } from "../models/enums/AirdropType"; import { IAirdropConfig } from "../models/spt/config/IAirdropConfig"; import { ILocationConfig } from "../models/spt/config/ILocationConfig"; @@ -34,10 +35,11 @@ export declare class LocationController { /** * Handle client/location/getLocalloot * Get a location (map) with generated loot data - * @param location Map to generate loot for + * @param sessionId Player id + * @param request Map request to generate * @returns ILocationBase */ - get(location: string): ILocationBase; + get(sessionId: string, request: IGetLocationRequestData): ILocationBase; /** * Generate a maps base location with loot * @param name Map name diff --git a/TypeScript/4UseACustomConfigFile/types/controllers/QuestController.d.ts b/TypeScript/4UseACustomConfigFile/types/controllers/QuestController.d.ts index 7d494a6..bd8a70f 100644 --- a/TypeScript/4UseACustomConfigFile/types/controllers/QuestController.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/controllers/QuestController.d.ts @@ -61,7 +61,7 @@ export declare class QuestController { * @param playerLevel level of player to test against quest * @returns true if quest can be seen/accepted by player of defined level */ - protected playerLevelFulfillsQuestRequrement(quest: IQuest, playerLevel: number): boolean; + protected playerLevelFulfillsQuestRequirement(quest: IQuest, playerLevel: number): boolean; /** * Should a quest be shown to the player in trader quest screen * @param questId Quest to check diff --git a/TypeScript/4UseACustomConfigFile/types/controllers/RagfairController.d.ts b/TypeScript/4UseACustomConfigFile/types/controllers/RagfairController.d.ts index 76c27f7..bda37cd 100644 --- a/TypeScript/4UseACustomConfigFile/types/controllers/RagfairController.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/controllers/RagfairController.d.ts @@ -21,6 +21,7 @@ import { IGetMarketPriceRequestData } from "../models/eft/ragfair/IGetMarketPric import { IGetOffersResult } from "../models/eft/ragfair/IGetOffersResult"; import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; import { ISearchRequestData } from "../models/eft/ragfair/ISearchRequestData"; +import { IProcessBuyTradeRequestData } from "../models/eft/trade/IProcessBuyTradeRequestData"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; @@ -125,6 +126,18 @@ export declare class RagfairController { * @returns IItemEventRouterResponse */ addPlayerOffer(pmcData: IPmcData, offerRequest: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Charge player a listing fee for using flea, pulls charge from data previously sent by client + * @param sessionID Player id + * @param rootItem Base item being listed (used when client tax cost not found and must be done on server) + * @param pmcData Player profile + * @param requirementsPriceInRub Rouble cost player chose for listing (used when client tax cost not found and must be done on server) + * @param itemStackCount How many items were listed in player (used when client tax cost not found and must be done on server) + * @param offerRequest Add offer request object from client + * @param output IItemEventRouterResponse + * @returns True if charging tax to player failed + */ + protected chargePlayerTaxFee(sessionID: string, rootItem: Item, pmcData: IPmcData, requirementsPriceInRub: number, itemStackCount: number, offerRequest: IAddOfferRequestData, output: IItemEventRouterResponse): boolean; /** * Is the item to be listed on the flea valid * @param offerRequest Client offer request @@ -158,4 +171,11 @@ export declare class RagfairController { */ removeOffer(offerId: string, sessionID: string): IItemEventRouterResponse; extendOffer(info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Create a basic trader request object with price and currency type + * @param currency What currency: RUB, EURO, USD + * @param value Amount of currency + * @returns IProcessBuyTradeRequestData + */ + protected createBuyTradeRequestObject(currency: string, value: number): IProcessBuyTradeRequestData; } diff --git a/TypeScript/4UseACustomConfigFile/types/generators/BotEquipmentModGenerator.d.ts b/TypeScript/4UseACustomConfigFile/types/generators/BotEquipmentModGenerator.d.ts index ccbbbbf..f7abb84 100644 --- a/TypeScript/4UseACustomConfigFile/types/generators/BotEquipmentModGenerator.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/generators/BotEquipmentModGenerator.d.ts @@ -14,7 +14,6 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; import { BotEquipmentModPoolService } from "../services/BotEquipmentModPoolService"; import { BotModLimits, BotWeaponModLimitService } from "../services/BotWeaponModLimitService"; -import { ItemBaseClassService } from "../services/ItemBaseClassService"; import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; @@ -29,7 +28,6 @@ export declare class BotEquipmentModGenerator { protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; protected botEquipmentFilterService: BotEquipmentFilterService; - protected itemBaseClassService: ItemBaseClassService; protected itemFilterService: ItemFilterService; protected profileHelper: ProfileHelper; protected botWeaponModLimitService: BotWeaponModLimitService; @@ -40,7 +38,7 @@ export declare class BotEquipmentModGenerator { protected botEquipmentModPoolService: BotEquipmentModPoolService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, itemHelper: ItemHelper, botEquipmentFilterService: BotEquipmentFilterService, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponModLimitService: BotWeaponModLimitService, botHelper: BotHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, botEquipmentModPoolService: BotEquipmentModPoolService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, itemHelper: ItemHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponModLimitService: BotWeaponModLimitService, botHelper: BotHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, botEquipmentModPoolService: BotEquipmentModPoolService, configServer: ConfigServer); /** * Check mods are compatible and add to array * @param equipment Equipment item to add mods to diff --git a/TypeScript/4UseACustomConfigFile/types/generators/LocationGenerator.d.ts b/TypeScript/4UseACustomConfigFile/types/generators/LocationGenerator.d.ts index b8169d3..46a514b 100644 --- a/TypeScript/4UseACustomConfigFile/types/generators/LocationGenerator.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/generators/LocationGenerator.d.ts @@ -65,10 +65,11 @@ export declare class LocationGenerator { protected getGuaranteedContainers(staticContainersOnMap: IStaticContainerData[]): IStaticContainerData[]; /** * Choose a number of containers based on their probabilty value to fulfil the desired count in containerData.chosenCount + * @param groupId Name of the group the containers are being collected for * @param containerData Containers and probability values for a groupId * @returns List of chosen container Ids */ - protected getContainersByProbabilty(containerData: IContainerGroupCount): string[]; + protected getContainersByProbabilty(groupId: string, containerData: IContainerGroupCount): string[]; /** * Get a mapping of each groupid and the containers in that group + count of containers to spawn on map * @param containersGroups Container group values diff --git a/TypeScript/4UseACustomConfigFile/types/generators/PMCLootGenerator.d.ts b/TypeScript/4UseACustomConfigFile/types/generators/PMCLootGenerator.d.ts index 9acff69..abb5615 100644 --- a/TypeScript/4UseACustomConfigFile/types/generators/PMCLootGenerator.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/generators/PMCLootGenerator.d.ts @@ -31,12 +31,12 @@ export declare class PMCLootGenerator { */ generatePMCVestLootPool(): string[]; /** - * Check if item has a width/height that lets it fit into a 1x2/2x1 slot - * 1x1 / 1x2 / 2x1 + * Check if item has a width/height that lets it fit into a 2x2 slot + * 1x1 / 1x2 / 2x1 / 2x2 * @param item Item to check size of * @returns true if it fits */ - protected itemFitsInto1By2Slot(item: ITemplateItem): boolean; + protected itemFitsInto2By2Slot(item: ITemplateItem): boolean; /** * Create an array of loot items a PMC can have in their backpack * @returns string array of tpls diff --git a/TypeScript/4UseACustomConfigFile/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/4UseACustomConfigFile/types/generators/RagfairOfferGenerator.d.ts index a627191..58e0b68 100644 --- a/TypeScript/4UseACustomConfigFile/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/generators/RagfairOfferGenerator.d.ts @@ -55,11 +55,10 @@ export declare class RagfairOfferGenerator { * @param items Items in the offer * @param barterScheme Cost of item (currency or barter) * @param loyalLevel Loyalty level needed to buy item - * @param price Price of offer - * @param sellInOnePiece Set StackObjectsCount to 1 + * @param sellInOnePiece Flags sellInOnePiece to be true * @returns IRagfairOffer */ - createFleaOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; + createFleaOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, sellInOnePiece?: boolean): IRagfairOffer; /** * Create an offer object ready to send to ragfairOfferService.addOffer() * @param userID Owner of the offer @@ -67,17 +66,16 @@ export declare class RagfairOfferGenerator { * @param items Items in the offer * @param barterScheme Cost of item (currency or barter) * @param loyalLevel Loyalty level needed to buy item - * @param price Price of offer * @param sellInOnePiece Set StackObjectsCount to 1 * @returns IRagfairOffer */ - protected createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; + protected createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, sellInOnePiece?: boolean): IRagfairOffer; /** * Calculate the offer price that's listed on the flea listing * @param offerRequirements barter requirements for offer * @returns rouble cost of offer */ - protected calculateOfferListingPrice(offerRequirements: OfferRequirement[]): number; + protected convertOfferRequirementsIntoRoubles(offerRequirements: OfferRequirement[]): number; /** * Get avatar url from trader table in db * @param isTrader Is user we're getting avatar for a trader @@ -137,7 +135,7 @@ export declare class RagfairOfferGenerator { * @param itemDetails raw db item details * @returns Item array */ - protected createSingleOfferForItem(items: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; + protected createSingleOfferForItem(items: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; /** * Generate trader offers on flea using the traders assort data * @param traderID Trader to generate offers for @@ -151,7 +149,7 @@ export declare class RagfairOfferGenerator { * @param itemDetails db details of first item * @returns */ - protected getItemCondition(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): Item[]; + protected randomiseItemUpdProperties(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): Item[]; /** * Get the relevant condition id if item tpl matches in ragfair.json/condition * @param tpl Item to look for matching condition object @@ -184,7 +182,7 @@ export declare class RagfairOfferGenerator { * @param offerItems Items for sale in offer * @returns Barter scheme */ - protected createBarterRequirement(offerItems: Item[]): IBarterScheme[]; + protected createBarterBarterScheme(offerItems: Item[]): IBarterScheme[]; /** * Get an array of flea prices + item tpl, cached in generator class inside `allowedFleaPriceItemsForBarter` * @returns array with tpl/price values @@ -196,7 +194,9 @@ export declare class RagfairOfferGenerator { /** * Create a random currency-based barter scheme for an array of items * @param offerItems Items on offer + * @param isPackOffer Is the barter scheme being created for a pack offer + * @param multipler What to multiply the resulting price by * @returns Barter scheme for offer */ - protected createCurrencyRequirement(offerItems: Item[]): IBarterScheme[]; + protected createCurrencyBarterScheme(offerItems: Item[], isPackOffer: boolean, multipler?: number): IBarterScheme[]; } diff --git a/TypeScript/4UseACustomConfigFile/types/generators/ScavCaseRewardGenerator.d.ts b/TypeScript/4UseACustomConfigFile/types/generators/ScavCaseRewardGenerator.d.ts index 4ba1888..b5935d0 100644 --- a/TypeScript/4UseACustomConfigFile/types/generators/ScavCaseRewardGenerator.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/generators/ScavCaseRewardGenerator.d.ts @@ -25,6 +25,8 @@ export declare class ScavCaseRewardGenerator { protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected scavCaseConfig: IScavCaseConfig; + protected dbItemsCache: ITemplateItem[]; + protected dbAmmoItemsCache: ITemplateItem[]; constructor(logger: ILogger, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * Create an array of rewards that will be given to the player upon completing their scav case build @@ -33,10 +35,10 @@ export declare class ScavCaseRewardGenerator { */ generate(recipeId: string): Product[]; /** - * Get all db items that are not blacklisted in scavcase config - * @returns filtered array of db items + * Get all db items that are not blacklisted in scavcase config or global blacklist + * Store in class field */ - protected getDbItems(): ITemplateItem[]; + protected cacheDbItems(): void; /** * Pick a number of items to be rewards, the count is defined by the values in * @param items item pool to pick rewards from diff --git a/TypeScript/4UseACustomConfigFile/types/generators/WeatherGenerator.d.ts b/TypeScript/4UseACustomConfigFile/types/generators/WeatherGenerator.d.ts index 2e2403c..6471bb1 100644 --- a/TypeScript/4UseACustomConfigFile/types/generators/WeatherGenerator.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/generators/WeatherGenerator.d.ts @@ -52,6 +52,7 @@ export declare class WeatherGenerator { */ protected setCurrentDateTime(weather: IWeather): void; protected getWeightedWindDirection(): WindDirection; + protected getWeightedClouds(): number; protected getWeightedWindSpeed(): number; protected getWeightedFog(): number; protected getWeightedRain(): number; diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/HealthHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/HealthHelper.d.ts index 3694a6e..e4cdcd6 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/HealthHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/HealthHelper.d.ts @@ -27,6 +27,7 @@ export declare class HealthHelper { * @param request Heal request * @param sessionID Session id * @param addEffects Should effects be added or removed (default - add) + * @param deleteExistingEffects Should all prior effects be removed before apply new ones */ saveVitality(pmcData: IPmcData, request: ISyncHealthRequestData, sessionID: string, addEffects?: boolean, deleteExistingEffects?: boolean): void; /** diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/InRaidHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/InRaidHelper.d.ts index bf584c2..b4c0c1c 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/InRaidHelper.d.ts @@ -53,7 +53,7 @@ export declare class InRaidHelper { * @param victim Who was killed by player * @returns a numerical standing gain or loss */ - protected getStandingChangeForKill(victim: Victim): number; + protected getFenceStandingChangeForKillAsScav(victim: Victim): number; /** * Reset a profile to a baseline, used post-raid * Reset points earned during session property diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/ItemHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/ItemHelper.d.ts index 99fca56..00f190f 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/ItemHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/ItemHelper.d.ts @@ -26,6 +26,7 @@ declare class ItemHelper { protected itemBaseClassService: ItemBaseClassService; protected localisationService: LocalisationService; protected localeService: LocaleService; + protected readonly defaultInvalidBaseTypes: string[]; constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, localisationService: LocalisationService, localeService: LocaleService); /** * Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash @@ -67,6 +68,11 @@ declare class ItemHelper { * @returns Price in roubles (undefined if not found) */ getDynamicItemPrice(tpl: string): number; + /** + * Update items upd.StackObjectsCount to be 1 if its upd is missing or StackObjectsCount is undefined + * @param item Item to update + * @returns Fixed item + */ fixItemStackCount(item: Item): Item; /** * AmmoBoxes contain StackSlots which need to be filled for the AmmoBox to have content. @@ -125,19 +131,19 @@ declare class ItemHelper { getItemQualityModifier(item: Item): number; /** * Get a quality value based on a repairable items (weapon/armor) current state between current and max durability - * @param itemDetails - * @param repairable repairable object - * @param item - * @returns a number between 0 and 1 + * @param itemDetails Db details for item we want quality value for + * @param repairable Repairable properties + * @param item Item quality value is for + * @returns A number between 0 and 1 */ protected getRepairableItemQualityValue(itemDetails: ITemplateItem, repairable: Repairable, item: Item): number; /** * Recursive function that looks at every item from parameter and gets their childrens Ids + includes parent item in results - * @param items - * @param itemID + * @param items Array of items (item + possible children) + * @param itemId Parent items id * @returns an array of strings */ - findAndReturnChildrenByItems(items: Item[], itemID: string): string[]; + findAndReturnChildrenByItems(items: Item[], itemId: string): string[]; /** * A variant of findAndReturnChildren where the output is list of item objects instead of their ids. * @param items @@ -164,12 +170,6 @@ declare class ItemHelper { * @returns true if it is a dogtag */ isDogtag(tpl: string): boolean; - /** - * Can the item passed in be sold to a trader because it is raw money - * @param tpl Item template id to check - * @returns true if unsellable - */ - isNotSellable(tpl: string): boolean; /** * Gets the identifier for a child using slotId, locationX and locationY. * @param item @@ -183,19 +183,19 @@ declare class ItemHelper { */ isItemTplStackable(tpl: string): boolean; /** - * split item stack if it exceeds its StackMaxSize property - * @param itemToSplit item being split into smaller stacks + * split item stack if it exceeds its items StackMaxSize property + * @param itemToSplit Item to split into smaller stacks * @returns Array of split items */ splitStack(itemToSplit: Item): Item[]; /** - * Find Barter items in the inventory + * Find Barter items from array of items * @param {string} by tpl or id - * @param {Object} pmcData + * @param {Item[]} items Array of items to iterate over * @param {string} barterItemId * @returns Array of Item objects */ - findBarterItems(by: "tpl" | "id", pmcData: IPmcData, barterItemId: string): Item[]; + findBarterItems(by: "tpl" | "id", items: Item[], barterItemId: string): Item[]; /** * Regenerate all guids with new ids, exceptions are for items that cannot be altered (e.g. stash/sorting table) * @param pmcData Player profile @@ -262,10 +262,21 @@ declare class ItemHelper { * @param minSizePercent % the magazine must be filled to */ fillMagazineWithCartridge(magazine: Item[], magTemplate: ITemplateItem, cartridgeTpl: string, minSizePercent?: number): void; + /** + * Choose a random bullet type from the list of possible a magazine has + * @param magTemplate Magazine template from Db + * @returns Tpl of cartridge + */ protected getRandomValidCaliber(magTemplate: ITemplateItem): string; + /** + * Chose a randomly weighted cartridge that fits + * @param caliber Desired caliber + * @param staticAmmoDist Cartridges and thier weights + * @returns Tpl of cartrdige + */ protected drawAmmoTpl(caliber: string, staticAmmoDist: Record): string; /** - * + * Create a basic cartrige object * @param parentId container cartridges will be placed in * @param ammoTpl Cartridge to insert * @param stackCount Count of cartridges inside parent diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/QuestHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/QuestHelper.d.ts index e04b6e0..5c749d3 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/QuestHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/QuestHelper.d.ts @@ -21,6 +21,7 @@ import { DialogueHelper } from "./DialogueHelper"; import { ItemHelper } from "./ItemHelper"; import { PaymentHelper } from "./PaymentHelper"; import { ProfileHelper } from "./ProfileHelper"; +import { QuestConditionHelper } from "./QuestConditionHelper"; import { RagfairServerHelper } from "./RagfairServerHelper"; import { TraderHelper } from "./TraderHelper"; export declare class QuestHelper { @@ -29,6 +30,7 @@ export declare class QuestHelper { protected timeUtil: TimeUtil; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; + protected questConditionHelper: QuestConditionHelper; protected eventOutputHolder: EventOutputHolder; protected databaseServer: DatabaseServer; protected localeService: LocaleService; @@ -41,7 +43,7 @@ export declare class QuestHelper { protected mailSendService: MailSendService; protected configServer: ConfigServer; 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, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, questConditionHelper: QuestConditionHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, mailSendService: MailSendService, configServer: ConfigServer); /** * Get status of a quest in player profile by its id * @param pmcData Profile to search @@ -119,7 +121,7 @@ export declare class QuestHelper { * @param sessionID Session id * @returns Quests accessible to player incuding newly unlocked quests now quest (startedQuestId) was started */ - acceptedUnlocked(startedQuestId: string, sessionID: string): IQuest[]; + getNewlyAccessibleQuestsWhenStartingQuest(startedQuestId: string, sessionID: string): IQuest[]; /** * Get quests that can be shown to player after failing a quest * @param failedQuestId Id of the quest failed by player diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/RagfairOfferHelper.d.ts index de9d550..0699259 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/RagfairOfferHelper.d.ts @@ -1,4 +1,5 @@ import { IPmcData } from "../models/eft/common/IPmcData"; +import { Item } from "../models/eft/common/tables/IItem"; import { ITraderAssort } from "../models/eft/common/tables/ITrader"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; @@ -13,10 +14,10 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { LocaleService } from "../services/LocaleService"; import { LocalisationService } from "../services/LocalisationService"; +import { MailSendService } from "../services/MailSendService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { HashUtil } from "../utils/HashUtil"; import { TimeUtil } from "../utils/TimeUtil"; -import { DialogueHelper } from "./DialogueHelper"; import { ItemHelper } from "./ItemHelper"; import { PaymentHelper } from "./PaymentHelper"; import { PresetHelper } from "./PresetHelper"; @@ -33,7 +34,6 @@ export declare class RagfairOfferHelper { protected databaseServer: DatabaseServer; protected traderHelper: TraderHelper; protected saveServer: SaveServer; - protected dialogueHelper: DialogueHelper; protected itemHelper: ItemHelper; protected paymentHelper: PaymentHelper; protected presetHelper: PresetHelper; @@ -44,11 +44,12 @@ export declare class RagfairOfferHelper { protected ragfairOfferService: RagfairOfferService; protected localeService: LocaleService; protected localisationService: LocalisationService; + protected mailSendService: MailSendService; protected configServer: ConfigServer; protected static goodSoldTemplate: string; protected ragfairConfig: IRagfairConfig; 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, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, localisationService: LocalisationService, mailSendService: MailSendService, configServer: ConfigServer); /** * Passthrough to ragfairOfferService.getOffers(), get flea offers a player should see * @param searchRequest Data from client @@ -119,19 +120,26 @@ export declare class RagfairOfferHelper { */ protected getProfileOffers(sessionID: string): IRagfairOffer[]; /** - * Delete an offer from a desired profile + * Delete an offer from a desired profile and from ragfair offers * @param sessionID Session id of profile to delete offer from - * @param offerId Offer id to delete + * @param offerId Id of offer to delete */ - protected deleteOfferByOfferId(sessionID: string, offerId: string): void; + protected deleteOfferById(sessionID: string, offerId: string): void; /** * Complete the selling of players' offer * @param sessionID Session id * @param offer Sold offer details * @param boughtAmount Amount item was purchased for - * @returns Client response + * @returns IItemEventRouterResponse */ protected completeOffer(sessionID: string, offer: IRagfairOffer, boughtAmount: number): IItemEventRouterResponse; + /** + * Get a localised message for when players offer has sold on flea + * @param itemTpl Item sold + * @param boughtAmount How many were purchased + * @returns Localised message text + */ + protected getLocalisedOfferSoldMessage(itemTpl: string, boughtAmount: number): string; /** * Should a ragfair offer be visible to the player * @param searchRequest Search request @@ -142,4 +150,12 @@ export declare class RagfairOfferHelper { * @returns True = should be shown to player */ isDisplayableOffer(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, offer: IRagfairOffer, pmcProfile: IPmcData): boolean; + /** + * Is items quality value within desired range + * @param item Item to check quality of + * @param min Desired minimum quality + * @param max Desired maximum quality + * @returns True if in range + */ + protected itemQualityInRange(item: Item, min: number, max: number): boolean; } diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/RagfairSellHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/RagfairSellHelper.d.ts index 251d7ca..913b408 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/RagfairSellHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/RagfairSellHelper.d.ts @@ -13,12 +13,12 @@ export declare class RagfairSellHelper { constructor(logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, configServer: ConfigServer); /** * Get the percent chance to sell an item based on its average listed price vs player chosen listing price - * @param baseChancePercent Base chance to sell item * @param averageOfferPriceRub Price of average offer in roubles * @param playerListedPriceRub Price player listed item for in roubles + * @param qualityMultiplier Quality multipler of item being sold * @returns percent value */ - calculateSellChance(baseChancePercent: number, averageOfferPriceRub: number, playerListedPriceRub: number): number; + calculateSellChance(averageOfferPriceRub: number, playerListedPriceRub: number, qualityMultiplier: number): number; /** * Get percent chance to sell an item when price is below items average listing price * @param playerListedPriceRub Price player listed item for in roubles diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/TraderHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/TraderHelper.d.ts index c163f7a..6680ccf 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/TraderHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/TraderHelper.d.ts @@ -35,7 +35,7 @@ export declare class TraderHelper { protected highestTraderBuyPriceItems: Record; constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, handbookHelper: HandbookHelper, itemHelper: ItemHelper, playerService: PlayerService, localisationService: LocalisationService, fenceService: FenceService, timeUtil: TimeUtil, randomUtil: RandomUtil, configServer: ConfigServer); getTrader(traderID: string, sessionID: string): ITraderBase; - getTraderAssortsById(traderId: string): ITraderAssort; + getTraderAssortsByTraderId(traderId: string): ITraderAssort; /** * 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 diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/IBotBase.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/IBotBase.d.ts index ee40958..6c7b76f 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/IBotBase.d.ts @@ -281,7 +281,7 @@ export interface InsuredItem { export interface Hideout { Production: Record; Areas: HideoutArea[]; - Improvements: Record; + Improvement: Record; Seed: number; sptUpdateLastRunTimestamp: number; } diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/health/IHealthTreatmentRequestData.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/health/IHealthTreatmentRequestData.d.ts index 7fb80a8..598e60c 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/eft/health/IHealthTreatmentRequestData.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/health/IHealthTreatmentRequestData.d.ts @@ -1,12 +1,14 @@ export interface IHealthTreatmentRequestData { Action: "RestoreHealth"; trader: string; - items: Item[]; + items: Cost[]; difference: Difference; timestamp: number; } -export interface Item { +export interface Cost { + /** Id of stack to take money from */ id: string; + /** Amount of money to take off player for treatment */ count: number; } export interface Difference { @@ -25,5 +27,6 @@ export interface BodyParts { } export interface BodyPart { Health: number; + /** Effects in array are to be removed */ Effects: string[]; } diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/notifier/INotifier.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/notifier/INotifier.d.ts index ce25dee..c6c6979 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/eft/notifier/INotifier.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/notifier/INotifier.d.ts @@ -14,6 +14,11 @@ export interface INotification { } export declare enum NotificationType { RAGFAIR_OFFER_SOLD = "RagfairOfferSold", + RAGFAIR_RATING_CHANGE = "RagfairRatingChange", + /** ChatMessageReceived */ NEW_MESSAGE = "new_message", - PING = "ping" + PING = "ping", + TRADER_SUPPLY = "TraderSupply", + TRADER_STANDING = "TraderStanding", + UNLOCK_TRADER = "UnlockTrader" } diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/notifier/ISelectProfileResponse.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/notifier/ISelectProfileResponse.d.ts index ecb668a..f2d6be7 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/eft/notifier/ISelectProfileResponse.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/notifier/ISelectProfileResponse.d.ts @@ -1,6 +1,3 @@ -import { INotifierChannel } from "./INotifier"; export interface ISelectProfileResponse { status: string; - notifier: INotifierChannel; - notifierServer: string; } diff --git a/TypeScript/4UseACustomConfigFile/types/models/enums/WeatherType.d.ts b/TypeScript/4UseACustomConfigFile/types/models/enums/WeatherType.d.ts index d31fefe..503dc30 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/enums/WeatherType.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/enums/WeatherType.d.ts @@ -1,19 +1,19 @@ export declare enum WeatherType { - CLEAR_DAY = 1, - CLEAR_WIND = 2, - CLEAR_NIGHT = 3, - PARTLY_CLOUD_DAY = 4, - PARTLY_CLOUD_NIGHT = 5, - CLEAR_FOG_DAY = 6, - CLEAR_FOG_NIGHT = 7, - CLOUDFOG = 8, - FOG = 9, - MOSTLY_CLOUD = 10, - LIGHT_RAIN = 11, - RAIN = 12, - CLOUD_WIND = 13, - CLOUD_WIND_RAIN = 14, - FULL_CLOUD = 15, - THUNDER_CLOUD = 16, - NONE = 0 + CLEAR_DAY = 0, + CLEAR_WIND = 1, + CLEAR_NIGHT = 2, + PARTLY_CLOUD_DAY = 3, + PARTLY_CLOUD_NIGHT = 4, + CLEAR_FOG_DAY = 5, + CLEAR_FOG_NIGHT = 6, + CLOUD_FOG = 7, + FOG = 8, + MOSTLY_CLOUD = 9, + LIGHT_RAIN = 10, + RAIN = 11, + CLOUD_WIND = 12, + CLOUD_WIND_RAIN = 13, + FULL_CLOUD = 14, + THUNDER_CLOUD = 15, + NONE = 16 } diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IRagfairConfig.d.ts index 7c04857..7aea24f 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IRagfairConfig.d.ts @@ -41,7 +41,8 @@ export interface Dynamic { /** Use the highest trader price for an offer if its greater than the price in templates/prices.json */ useTraderPriceForOffersIfHigher: boolean; /** Barter offer specific settings */ - barter: Barter; + barter: IBarterDetails; + pack: IPackDetails; /** Dynamic offer price below handbook adjustment values */ offerAdjustment: OfferAdjustment; /** How many offers should expire before an offer regeneration occurs */ @@ -49,9 +50,7 @@ export interface Dynamic { /** How many offers should be listed */ offerItemCount: MinMax; /** How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) */ - price: MinMax; - /** How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) */ - presetPrice: MinMax; + priceRanges: IPriceRanges; /** Should default presets to listed only or should non-standard presets found in globals.json be listed too */ showDefaultPresetsOnly: boolean; endTimeSeconds: MinMax; @@ -74,7 +73,12 @@ export interface Dynamic { /** Dict of price limits keyed by item type */ unreasonableModPrices: Record; } -export interface Barter { +export interface IPriceRanges { + default: MinMax; + preset: MinMax; + pack: MinMax; +} +export interface IBarterDetails { /** Should barter offers be generated */ enable: boolean; /** Percentage change an offer is listed as a barter */ @@ -90,6 +94,18 @@ export interface Barter { /** Item Tpls to never be turned into a barter */ itemTypeBlacklist: string[]; } +export interface IPackDetails { + /** Should pack offers be generated */ + enable: boolean; + /** Percentage change an offer is listed as a pack */ + chancePercent: number; + /** Min number of required items for a pack */ + itemCountMin: number; + /** Max number of required items for a pack */ + itemCountMax: number; + /** item types to allow being a pack */ + itemTypeWhitelist: string[]; +} export interface OfferAdjustment { /** Shuld offer price be adjusted when below handbook price */ adjustPriceWhenBelowHandbookPrice: boolean; diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/config/IWeatherConfig.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IWeatherConfig.d.ts index 41a1c83..6ecf35b 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/spt/config/IWeatherConfig.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IWeatherConfig.d.ts @@ -7,7 +7,7 @@ export interface IWeatherConfig extends IBaseConfig { weather: Weather; } export interface Weather { - clouds: MinMax; + clouds: WeatherSettings; windSpeed: WeatherSettings; windDirection: WeatherSettings; windGustiness: MinMax; diff --git a/TypeScript/4UseACustomConfigFile/types/services/HashCacheService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/HashCacheService.d.ts index 5320f28..9968478 100644 --- a/TypeScript/4UseACustomConfigFile/types/services/HashCacheService.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/services/HashCacheService.d.ts @@ -11,7 +11,18 @@ export declare class HashCacheService { protected modHashes: any; protected readonly modCachePath = "./user/cache/modCache.json"; constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); + /** + * Return a stored hash by key + * @param modName Name of mod to get hash for + * @returns Mod hash + */ getStoredModHash(modName: string): string; + /** + * Does the generated hash match the stored hash + * @param modName name of mod + * @param modContent + * @returns True if they match + */ modContentMatchesStoredHash(modName: string, modContent: string): boolean; hashMatchesStoredHash(modName: string, modHash: string): boolean; storeModContent(modName: string, modContent: string): void; diff --git a/TypeScript/4UseACustomConfigFile/types/services/MailSendService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/MailSendService.d.ts index 19397dc..fe4a7fe 100644 --- a/TypeScript/4UseACustomConfigFile/types/services/MailSendService.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/services/MailSendService.d.ts @@ -35,7 +35,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendDirectNpcMessageToPlayer(playerId: string, sender: Traders, messageType: MessageType, message: string, items?: Item[], maxStorageTimeSeconds?: any): void; + sendDirectNpcMessageToPlayer(playerId: string, sender: Traders, messageType: MessageType, message: string, items?: Item[], maxStorageTimeSeconds?: any, systemData?: any, ragfair?: any): void; /** * Send a message from an NPC (e.g. prapor) to the player with or without items * @param playerId Players id to send message to @@ -45,7 +45,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendLocalisedNpcMessageToPlayer(playerId: string, sender: Traders, messageType: MessageType, messageLocaleId: string, items?: Item[], maxStorageTimeSeconds?: any, systemData?: any): void; + sendLocalisedNpcMessageToPlayer(playerId: string, sender: Traders, messageType: MessageType, messageLocaleId: string, items?: Item[], maxStorageTimeSeconds?: any, systemData?: any, ragfair?: any): void; /** * Send a message from SYSTEM to the player with or without items * @param playerId Players id to send message to diff --git a/TypeScript/4UseACustomConfigFile/types/services/MatchBotDetailsCacheService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/MatchBotDetailsCacheService.d.ts index eb365dd..c1bd322 100644 --- a/TypeScript/4UseACustomConfigFile/types/services/MatchBotDetailsCacheService.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/services/MatchBotDetailsCacheService.d.ts @@ -1,7 +1,7 @@ import { IBotBase } from "../models/eft/common/tables/IBotBase"; import { ILogger } from "../models/spt/utils/ILogger"; import { LocalisationService } from "./LocalisationService"; -/** Cache bots in a dictionary, keyed by the bots name, keying by name isnt idea as its not unique but this is used by the post-raid system which doesnt have any bot ids, only name */ +/** Cache bots in a dictionary, keyed by the bots name, keying by name isnt ideal as its not unique but this is used by the post-raid system which doesnt have any bot ids, only name */ export declare class MatchBotDetailsCacheService { protected logger: ILogger; protected localisationService: LocalisationService; @@ -17,9 +17,9 @@ export declare class MatchBotDetailsCacheService { */ clearCache(): void; /** - * Find a bot in the cache by its name + * Find a bot in the cache by its name and side * @param botName Name of bot to find * @returns Bot details */ - getBotByName(botName: string): IBotBase; + getBotByNameAndSide(botName: string, botSide: string): IBotBase; } diff --git a/TypeScript/4UseACustomConfigFile/types/services/ModCompilerService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/ModCompilerService.d.ts index a4bf3c8..e306177 100644 --- a/TypeScript/4UseACustomConfigFile/types/services/ModCompilerService.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/services/ModCompilerService.d.ts @@ -1,14 +1,36 @@ import { CompilerOptions } from "typescript"; import type { ILogger } from "../models/spt/utils/ILogger"; -import { HashCacheService } from "./HashCacheService"; import { VFS } from "../utils/VFS"; +import { HashCacheService } from "./HashCacheService"; export declare class ModCompilerService { protected logger: ILogger; protected hashCacheService: HashCacheService; protected vfs: VFS; constructor(logger: ILogger, hashCacheService: HashCacheService, vfs: VFS); + /** + * Convert a mods TS into JS + * @param modName Name of mod + * @param modPath Dir path to mod + * @param modTypeScriptFiles + * @returns + */ compileMod(modName: string, modPath: string, modTypeScriptFiles: string[]): Promise; + /** + * Convert a TS file into JS + * @param fileNames Paths to TS files + * @param options Compiler options + */ protected compile(fileNames: string[], options: CompilerOptions): Promise; + /** + * Do the files at the provided paths exist + * @param fileNames + * @returns + */ protected areFilesReady(fileNames: string[]): boolean; + /** + * Wait the provided number of milliseconds + * @param ms Milliseconds + * @returns + */ protected delay(ms: number): Promise; } diff --git a/TypeScript/4UseACustomConfigFile/types/services/PaymentService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/PaymentService.d.ts index 1c9c32b..fb5f92c 100644 --- a/TypeScript/4UseACustomConfigFile/types/services/PaymentService.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/services/PaymentService.d.ts @@ -61,23 +61,26 @@ export declare class PaymentService { * Get all money stacks in inventory and prioritse items in stash * @param pmcData * @param currencyTpl + * @param playerStashId Players stash id * @returns Sorting money items */ - protected getSortedMoneyItemsInInventory(pmcData: IPmcData, currencyTpl: string): Item[]; + protected getSortedMoneyItemsInInventory(pmcData: IPmcData, currencyTpl: string, playerStashId: string): Item[]; /** * Prioritise player stash first over player inventory * Post-raid healing would often take money out of the players pockets/secure container * @param a First money stack item * @param b Second money stack item * @param inventoryItems players inventory items + * @param playerStashId Players stash id * @returns sort order */ - protected prioritiseStashSort(a: Item, b: Item, inventoryItems: Item[]): number; + protected prioritiseStashSort(a: Item, b: Item, inventoryItems: Item[], playerStashId: string): number; /** * Recursivly check items parents to see if it is inside the players inventory, not stash * @param itemId item id to check * @param inventoryItems player inventory + * @param playerStashId Players stash id * @returns true if its in inventory */ - protected isInInventory(itemId: string, inventoryItems: Item[]): boolean; + protected isInStash(itemId: string, inventoryItems: Item[], playerStashId: string): boolean; } diff --git a/TypeScript/4UseACustomConfigFile/types/services/ProfileFixerService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/ProfileFixerService.d.ts index c8232fc..bc1e42e 100644 --- a/TypeScript/4UseACustomConfigFile/types/services/ProfileFixerService.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/services/ProfileFixerService.d.ts @@ -14,6 +14,7 @@ import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; import { Watermark } from "../utils/Watermark"; import { LocalisationService } from "./LocalisationService"; @@ -27,17 +28,19 @@ export declare class ProfileFixerService { protected itemHelper: ItemHelper; protected localisationService: LocalisationService; protected timeUtil: TimeUtil; + protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, profileHelper: ProfileHelper, itemHelper: ItemHelper, localisationService: LocalisationService, timeUtil: TimeUtil, databaseServer: DatabaseServer, configServer: ConfigServer); + constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, profileHelper: ProfileHelper, itemHelper: ItemHelper, localisationService: LocalisationService, timeUtil: TimeUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, configServer: ConfigServer); /** * 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; protected addMissingGunStandContainerImprovements(pmcProfile: IPmcData): void; + protected ensureGunStandLevelsMatch(pmcProfile: IPmcData): void; protected addHideoutAreaStashes(pmcProfile: IPmcData): void; protected addMissingHideoutWallAreas(pmcProfile: IPmcData): void; protected adjustUnreasonableModFleaPrices(): void; @@ -131,4 +134,9 @@ export declare class ProfileFixerService { * @param pmcProfile Profile to add missing IDs to */ addMissingIdsToBonuses(pmcProfile: IPmcData): void; + /** + * At some point the property name was changed,migrate data across to new name + * @param pmcProfile + */ + protected migrateImprovements(pmcProfile: IPmcData): void; } diff --git a/TypeScript/4UseACustomConfigFile/types/services/RagfairPriceService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/RagfairPriceService.d.ts index e245efa..ff35327 100644 --- a/TypeScript/4UseACustomConfigFile/types/services/RagfairPriceService.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/services/RagfairPriceService.d.ts @@ -3,6 +3,7 @@ import { HandbookHelper } from "../helpers/HandbookHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { TraderHelper } from "../helpers/TraderHelper"; +import { MinMax } from "../models/common/MinMax"; import { IPreset } from "../models/eft/common/IGlobals"; import { Item } from "../models/eft/common/tables/IItem"; import { IBarterScheme } from "../models/eft/common/tables/ITrader"; @@ -35,10 +36,6 @@ export declare class RagfairPriceService implements OnLoad { * Generate static (handbook) and dynamic (prices.json) flea prices, store inside class as dictionaries */ onLoad(): Promise; - /** - * Add placeholder values for items missing from handbook - */ - protected addMissingHandbookPrices(): void; getRoute(): string; /** * Iterate over all items of type "Item" in db and get template price, store in cache @@ -91,9 +88,17 @@ export declare class RagfairPriceService implements OnLoad { * Generate a currency cost for an item and its mods * @param items Item with mods to get price for * @param desiredCurrency Currency price desired in + * @param isPackOffer Price is for a pack type offer * @returns cost of item in desired currency */ - getDynamicOfferPrice(items: Item[], desiredCurrency: string): number; + getDynamicOfferPriceForOffer(items: Item[], desiredCurrency: string, isPackOffer: boolean): number; + /** + * Get different min/max price multipliers for different offer types (preset/pack/default) + * @param isPreset Offer is a preset + * @param isPack Offer is a pack + * @returns MinMax values + */ + protected getOfferTypeRangeValues(isPreset: boolean, isPack: boolean): MinMax; /** * Check to see if an items price is below its handbook price and adjust accoring to values set to config/ragfair.json * @param itemPrice price of item @@ -104,10 +109,10 @@ export declare class RagfairPriceService implements OnLoad { /** * Multiply the price by a randomised curve where n = 2, shift = 2 * @param existingPrice price to alter - * @param isPreset is the item we're multiplying a preset + * @param rangeValues min and max to adjust price by * @returns multiplied price */ - protected randomisePrice(existingPrice: number, isPreset: boolean): number; + protected randomiseOfferPrice(existingPrice: number, rangeValues: MinMax): number; /** * Calculate the cost of a weapon preset by adding together the price of its mods + base price of default weapon preset * @param item base weapon diff --git a/TypeScript/5ReplaceMethod/types/callbacks/GameCallbacks.d.ts b/TypeScript/5ReplaceMethod/types/callbacks/GameCallbacks.d.ts index aa80036..46f79f9 100644 --- a/TypeScript/5ReplaceMethod/types/callbacks/GameCallbacks.d.ts +++ b/TypeScript/5ReplaceMethod/types/callbacks/GameCallbacks.d.ts @@ -1,4 +1,5 @@ import { GameController } from "../controllers/GameController"; +import { OnLoad } from "../di/OnLoad"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { ICheckVersionResponse } from "../models/eft/game/ICheckVersionResponse"; import { ICurrentGroupResponse } from "../models/eft/game/ICurrentGroupResponse"; @@ -15,12 +16,14 @@ import { INullResponseData } from "../models/eft/httpResponse/INullResponseData" import { SaveServer } from "../servers/SaveServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { Watermark } from "../utils/Watermark"; -declare class GameCallbacks { +declare class GameCallbacks implements OnLoad { protected httpResponse: HttpResponseUtil; protected watermark: Watermark; protected saveServer: SaveServer; protected gameController: GameController; constructor(httpResponse: HttpResponseUtil, watermark: Watermark, saveServer: SaveServer, gameController: GameController); + onLoad(): Promise; + getRoute(): string; /** * Handle client/game/version/validate * @returns INullResponseData diff --git a/TypeScript/5ReplaceMethod/types/controllers/GameController.d.ts b/TypeScript/5ReplaceMethod/types/controllers/GameController.d.ts index 04e3abb..e88610e 100644 --- a/TypeScript/5ReplaceMethod/types/controllers/GameController.d.ts +++ b/TypeScript/5ReplaceMethod/types/controllers/GameController.d.ts @@ -61,13 +61,14 @@ export declare class GameController { protected pmcConfig: IPmcConfig; protected lootConfig: ILootConfig; constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, randomUtil: RandomUtil, encodingUtil: EncodingUtil, hideoutHelper: HideoutHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, seasonalEventService: SeasonalEventService, itemBaseClassService: ItemBaseClassService, giftService: GiftService, applicationContext: ApplicationContext, configServer: ConfigServer); + load(): void; /** * Handle client/game/start */ gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; protected addCustomLooseLootPositions(): void; protected adjustLooseLootSpawnProbabilities(): void; - protected setHideoutAreasAndCraftsTo30Secs(): void; + protected setHideoutAreasAndCraftsTo40Secs(): void; /** * 3.7.0 moved AIDs to be numeric, old profiles need to be migrated * We store the old AID value in new field `sessionId` diff --git a/TypeScript/5ReplaceMethod/types/controllers/HealthController.d.ts b/TypeScript/5ReplaceMethod/types/controllers/HealthController.d.ts index 1938297..2d7ff09 100644 --- a/TypeScript/5ReplaceMethod/types/controllers/HealthController.d.ts +++ b/TypeScript/5ReplaceMethod/types/controllers/HealthController.d.ts @@ -29,34 +29,35 @@ export declare class HealthController { * stores in-raid player health * @param pmcData Player profile * @param info Request data - * @param sessionID + * @param sessionID Player id * @param addEffects Should effects found be added or removed from profile + * @param deleteExistingEffects Should all prior effects be removed before apply new ones */ saveVitality(pmcData: IPmcData, info: ISyncHealthRequestData, sessionID: string, addEffects?: boolean, deleteExistingEffects?: boolean): void; /** * When healing in menu - * @param pmcData - * @param body - * @param sessionID - * @returns + * @param pmcData Player profile + * @param request Healing request + * @param sessionID Player id + * @returns IItemEventRouterResponse */ - offraidHeal(pmcData: IPmcData, body: IOffraidHealRequestData, sessionID: string): IItemEventRouterResponse; + offraidHeal(pmcData: IPmcData, request: IOffraidHealRequestData, sessionID: string): IItemEventRouterResponse; /** * Handle Eat event * Consume food/water outside of a raid * @param pmcData Player profile - * @param body request Object + * @param request Eat request * @param sessionID Session id * @returns IItemEventRouterResponse */ - offraidEat(pmcData: IPmcData, body: IOffraidEatRequestData, sessionID: string): IItemEventRouterResponse; + offraidEat(pmcData: IPmcData, request: IOffraidEatRequestData, sessionID: string): IItemEventRouterResponse; /** * Handle RestoreHealth event * Occurs on post-raid healing page * @param pmcData player profile * @param healthTreatmentRequest Request data from client * @param sessionID Session id - * @returns + * @returns IItemEventRouterResponse */ healthTreatment(pmcData: IPmcData, healthTreatmentRequest: IHealthTreatmentRequestData, sessionID: string): IItemEventRouterResponse; /** @@ -66,12 +67,4 @@ export declare class HealthController { * @param sessionID */ applyWorkoutChanges(pmcData: IPmcData, info: IWorkoutData, sessionId: string): void; - /** - * Iterate over treatment request diff and find effects to remove from player limbs - * @param sessionId - * @param profile Profile to update - * @param treatmentRequest client request - * @param output response to send to client - */ - protected removeEffectsAfterPostRaidHeal(sessionId: string, profile: IPmcData, treatmentRequest: IHealthTreatmentRequestData, output: IItemEventRouterResponse): void; } diff --git a/TypeScript/5ReplaceMethod/types/controllers/HideoutController.d.ts b/TypeScript/5ReplaceMethod/types/controllers/HideoutController.d.ts index 877c076..a90a16d 100644 --- a/TypeScript/5ReplaceMethod/types/controllers/HideoutController.d.ts +++ b/TypeScript/5ReplaceMethod/types/controllers/HideoutController.d.ts @@ -88,11 +88,11 @@ export declare class HideoutController { * @param pmcData Profile to edit * @param output Object to send back to client * @param sessionID Session/player id - * @param profileHideoutArea Current hideout data for profile + * @param profileParentHideoutArea Current hideout area for profile * @param dbHideoutArea Hideout area being upgraded * @param hideoutStage Stage hideout area is being upgraded to */ - protected addContainerImprovementToProfile(output: IItemEventRouterResponse, sessionID: string, pmcData: IPmcData, profileHideoutArea: HideoutArea, dbHideoutArea: IHideoutArea, hideoutStage: Stage): void; + protected addContainerImprovementToProfile(output: IItemEventRouterResponse, sessionID: string, pmcData: IPmcData, profileParentHideoutArea: HideoutArea, dbHideoutArea: IHideoutArea, hideoutStage: Stage): void; /** * Add an inventory item to profile from a hideout area stage data * @param pmcData Profile to update diff --git a/TypeScript/5ReplaceMethod/types/controllers/LocationController.d.ts b/TypeScript/5ReplaceMethod/types/controllers/LocationController.d.ts index 94d496a..94f5fce 100644 --- a/TypeScript/5ReplaceMethod/types/controllers/LocationController.d.ts +++ b/TypeScript/5ReplaceMethod/types/controllers/LocationController.d.ts @@ -4,6 +4,7 @@ import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { ILocationBase } from "../models/eft/common/ILocationBase"; import { ILocationsGenerateAllResponse } from "../models/eft/common/ILocationsSourceDestinationBase"; import { IAirdropLootResult } from "../models/eft/location/IAirdropLootResult"; +import { IGetLocationRequestData } from "../models/eft/location/IGetLocationRequestData"; import { AirdropTypeEnum } from "../models/enums/AirdropType"; import { IAirdropConfig } from "../models/spt/config/IAirdropConfig"; import { ILocationConfig } from "../models/spt/config/ILocationConfig"; @@ -34,10 +35,11 @@ export declare class LocationController { /** * Handle client/location/getLocalloot * Get a location (map) with generated loot data - * @param location Map to generate loot for + * @param sessionId Player id + * @param request Map request to generate * @returns ILocationBase */ - get(location: string): ILocationBase; + get(sessionId: string, request: IGetLocationRequestData): ILocationBase; /** * Generate a maps base location with loot * @param name Map name diff --git a/TypeScript/5ReplaceMethod/types/controllers/QuestController.d.ts b/TypeScript/5ReplaceMethod/types/controllers/QuestController.d.ts index 7d494a6..bd8a70f 100644 --- a/TypeScript/5ReplaceMethod/types/controllers/QuestController.d.ts +++ b/TypeScript/5ReplaceMethod/types/controllers/QuestController.d.ts @@ -61,7 +61,7 @@ export declare class QuestController { * @param playerLevel level of player to test against quest * @returns true if quest can be seen/accepted by player of defined level */ - protected playerLevelFulfillsQuestRequrement(quest: IQuest, playerLevel: number): boolean; + protected playerLevelFulfillsQuestRequirement(quest: IQuest, playerLevel: number): boolean; /** * Should a quest be shown to the player in trader quest screen * @param questId Quest to check diff --git a/TypeScript/5ReplaceMethod/types/controllers/RagfairController.d.ts b/TypeScript/5ReplaceMethod/types/controllers/RagfairController.d.ts index 76c27f7..bda37cd 100644 --- a/TypeScript/5ReplaceMethod/types/controllers/RagfairController.d.ts +++ b/TypeScript/5ReplaceMethod/types/controllers/RagfairController.d.ts @@ -21,6 +21,7 @@ import { IGetMarketPriceRequestData } from "../models/eft/ragfair/IGetMarketPric import { IGetOffersResult } from "../models/eft/ragfair/IGetOffersResult"; import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; import { ISearchRequestData } from "../models/eft/ragfair/ISearchRequestData"; +import { IProcessBuyTradeRequestData } from "../models/eft/trade/IProcessBuyTradeRequestData"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; @@ -125,6 +126,18 @@ export declare class RagfairController { * @returns IItemEventRouterResponse */ addPlayerOffer(pmcData: IPmcData, offerRequest: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Charge player a listing fee for using flea, pulls charge from data previously sent by client + * @param sessionID Player id + * @param rootItem Base item being listed (used when client tax cost not found and must be done on server) + * @param pmcData Player profile + * @param requirementsPriceInRub Rouble cost player chose for listing (used when client tax cost not found and must be done on server) + * @param itemStackCount How many items were listed in player (used when client tax cost not found and must be done on server) + * @param offerRequest Add offer request object from client + * @param output IItemEventRouterResponse + * @returns True if charging tax to player failed + */ + protected chargePlayerTaxFee(sessionID: string, rootItem: Item, pmcData: IPmcData, requirementsPriceInRub: number, itemStackCount: number, offerRequest: IAddOfferRequestData, output: IItemEventRouterResponse): boolean; /** * Is the item to be listed on the flea valid * @param offerRequest Client offer request @@ -158,4 +171,11 @@ export declare class RagfairController { */ removeOffer(offerId: string, sessionID: string): IItemEventRouterResponse; extendOffer(info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Create a basic trader request object with price and currency type + * @param currency What currency: RUB, EURO, USD + * @param value Amount of currency + * @returns IProcessBuyTradeRequestData + */ + protected createBuyTradeRequestObject(currency: string, value: number): IProcessBuyTradeRequestData; } diff --git a/TypeScript/5ReplaceMethod/types/generators/BotEquipmentModGenerator.d.ts b/TypeScript/5ReplaceMethod/types/generators/BotEquipmentModGenerator.d.ts index ccbbbbf..f7abb84 100644 --- a/TypeScript/5ReplaceMethod/types/generators/BotEquipmentModGenerator.d.ts +++ b/TypeScript/5ReplaceMethod/types/generators/BotEquipmentModGenerator.d.ts @@ -14,7 +14,6 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; import { BotEquipmentModPoolService } from "../services/BotEquipmentModPoolService"; import { BotModLimits, BotWeaponModLimitService } from "../services/BotWeaponModLimitService"; -import { ItemBaseClassService } from "../services/ItemBaseClassService"; import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; @@ -29,7 +28,6 @@ export declare class BotEquipmentModGenerator { protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; protected botEquipmentFilterService: BotEquipmentFilterService; - protected itemBaseClassService: ItemBaseClassService; protected itemFilterService: ItemFilterService; protected profileHelper: ProfileHelper; protected botWeaponModLimitService: BotWeaponModLimitService; @@ -40,7 +38,7 @@ export declare class BotEquipmentModGenerator { protected botEquipmentModPoolService: BotEquipmentModPoolService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, itemHelper: ItemHelper, botEquipmentFilterService: BotEquipmentFilterService, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponModLimitService: BotWeaponModLimitService, botHelper: BotHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, botEquipmentModPoolService: BotEquipmentModPoolService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, itemHelper: ItemHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponModLimitService: BotWeaponModLimitService, botHelper: BotHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, botEquipmentModPoolService: BotEquipmentModPoolService, configServer: ConfigServer); /** * Check mods are compatible and add to array * @param equipment Equipment item to add mods to diff --git a/TypeScript/5ReplaceMethod/types/generators/LocationGenerator.d.ts b/TypeScript/5ReplaceMethod/types/generators/LocationGenerator.d.ts index b8169d3..46a514b 100644 --- a/TypeScript/5ReplaceMethod/types/generators/LocationGenerator.d.ts +++ b/TypeScript/5ReplaceMethod/types/generators/LocationGenerator.d.ts @@ -65,10 +65,11 @@ export declare class LocationGenerator { protected getGuaranteedContainers(staticContainersOnMap: IStaticContainerData[]): IStaticContainerData[]; /** * Choose a number of containers based on their probabilty value to fulfil the desired count in containerData.chosenCount + * @param groupId Name of the group the containers are being collected for * @param containerData Containers and probability values for a groupId * @returns List of chosen container Ids */ - protected getContainersByProbabilty(containerData: IContainerGroupCount): string[]; + protected getContainersByProbabilty(groupId: string, containerData: IContainerGroupCount): string[]; /** * Get a mapping of each groupid and the containers in that group + count of containers to spawn on map * @param containersGroups Container group values diff --git a/TypeScript/5ReplaceMethod/types/generators/PMCLootGenerator.d.ts b/TypeScript/5ReplaceMethod/types/generators/PMCLootGenerator.d.ts index 9acff69..abb5615 100644 --- a/TypeScript/5ReplaceMethod/types/generators/PMCLootGenerator.d.ts +++ b/TypeScript/5ReplaceMethod/types/generators/PMCLootGenerator.d.ts @@ -31,12 +31,12 @@ export declare class PMCLootGenerator { */ generatePMCVestLootPool(): string[]; /** - * Check if item has a width/height that lets it fit into a 1x2/2x1 slot - * 1x1 / 1x2 / 2x1 + * Check if item has a width/height that lets it fit into a 2x2 slot + * 1x1 / 1x2 / 2x1 / 2x2 * @param item Item to check size of * @returns true if it fits */ - protected itemFitsInto1By2Slot(item: ITemplateItem): boolean; + protected itemFitsInto2By2Slot(item: ITemplateItem): boolean; /** * Create an array of loot items a PMC can have in their backpack * @returns string array of tpls diff --git a/TypeScript/5ReplaceMethod/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/5ReplaceMethod/types/generators/RagfairOfferGenerator.d.ts index a627191..58e0b68 100644 --- a/TypeScript/5ReplaceMethod/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/5ReplaceMethod/types/generators/RagfairOfferGenerator.d.ts @@ -55,11 +55,10 @@ export declare class RagfairOfferGenerator { * @param items Items in the offer * @param barterScheme Cost of item (currency or barter) * @param loyalLevel Loyalty level needed to buy item - * @param price Price of offer - * @param sellInOnePiece Set StackObjectsCount to 1 + * @param sellInOnePiece Flags sellInOnePiece to be true * @returns IRagfairOffer */ - createFleaOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; + createFleaOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, sellInOnePiece?: boolean): IRagfairOffer; /** * Create an offer object ready to send to ragfairOfferService.addOffer() * @param userID Owner of the offer @@ -67,17 +66,16 @@ export declare class RagfairOfferGenerator { * @param items Items in the offer * @param barterScheme Cost of item (currency or barter) * @param loyalLevel Loyalty level needed to buy item - * @param price Price of offer * @param sellInOnePiece Set StackObjectsCount to 1 * @returns IRagfairOffer */ - protected createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; + protected createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, sellInOnePiece?: boolean): IRagfairOffer; /** * Calculate the offer price that's listed on the flea listing * @param offerRequirements barter requirements for offer * @returns rouble cost of offer */ - protected calculateOfferListingPrice(offerRequirements: OfferRequirement[]): number; + protected convertOfferRequirementsIntoRoubles(offerRequirements: OfferRequirement[]): number; /** * Get avatar url from trader table in db * @param isTrader Is user we're getting avatar for a trader @@ -137,7 +135,7 @@ export declare class RagfairOfferGenerator { * @param itemDetails raw db item details * @returns Item array */ - protected createSingleOfferForItem(items: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; + protected createSingleOfferForItem(items: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; /** * Generate trader offers on flea using the traders assort data * @param traderID Trader to generate offers for @@ -151,7 +149,7 @@ export declare class RagfairOfferGenerator { * @param itemDetails db details of first item * @returns */ - protected getItemCondition(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): Item[]; + protected randomiseItemUpdProperties(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): Item[]; /** * Get the relevant condition id if item tpl matches in ragfair.json/condition * @param tpl Item to look for matching condition object @@ -184,7 +182,7 @@ export declare class RagfairOfferGenerator { * @param offerItems Items for sale in offer * @returns Barter scheme */ - protected createBarterRequirement(offerItems: Item[]): IBarterScheme[]; + protected createBarterBarterScheme(offerItems: Item[]): IBarterScheme[]; /** * Get an array of flea prices + item tpl, cached in generator class inside `allowedFleaPriceItemsForBarter` * @returns array with tpl/price values @@ -196,7 +194,9 @@ export declare class RagfairOfferGenerator { /** * Create a random currency-based barter scheme for an array of items * @param offerItems Items on offer + * @param isPackOffer Is the barter scheme being created for a pack offer + * @param multipler What to multiply the resulting price by * @returns Barter scheme for offer */ - protected createCurrencyRequirement(offerItems: Item[]): IBarterScheme[]; + protected createCurrencyBarterScheme(offerItems: Item[], isPackOffer: boolean, multipler?: number): IBarterScheme[]; } diff --git a/TypeScript/5ReplaceMethod/types/generators/ScavCaseRewardGenerator.d.ts b/TypeScript/5ReplaceMethod/types/generators/ScavCaseRewardGenerator.d.ts index 4ba1888..b5935d0 100644 --- a/TypeScript/5ReplaceMethod/types/generators/ScavCaseRewardGenerator.d.ts +++ b/TypeScript/5ReplaceMethod/types/generators/ScavCaseRewardGenerator.d.ts @@ -25,6 +25,8 @@ export declare class ScavCaseRewardGenerator { protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected scavCaseConfig: IScavCaseConfig; + protected dbItemsCache: ITemplateItem[]; + protected dbAmmoItemsCache: ITemplateItem[]; constructor(logger: ILogger, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * Create an array of rewards that will be given to the player upon completing their scav case build @@ -33,10 +35,10 @@ export declare class ScavCaseRewardGenerator { */ generate(recipeId: string): Product[]; /** - * Get all db items that are not blacklisted in scavcase config - * @returns filtered array of db items + * Get all db items that are not blacklisted in scavcase config or global blacklist + * Store in class field */ - protected getDbItems(): ITemplateItem[]; + protected cacheDbItems(): void; /** * Pick a number of items to be rewards, the count is defined by the values in * @param items item pool to pick rewards from diff --git a/TypeScript/5ReplaceMethod/types/generators/WeatherGenerator.d.ts b/TypeScript/5ReplaceMethod/types/generators/WeatherGenerator.d.ts index 2e2403c..6471bb1 100644 --- a/TypeScript/5ReplaceMethod/types/generators/WeatherGenerator.d.ts +++ b/TypeScript/5ReplaceMethod/types/generators/WeatherGenerator.d.ts @@ -52,6 +52,7 @@ export declare class WeatherGenerator { */ protected setCurrentDateTime(weather: IWeather): void; protected getWeightedWindDirection(): WindDirection; + protected getWeightedClouds(): number; protected getWeightedWindSpeed(): number; protected getWeightedFog(): number; protected getWeightedRain(): number; diff --git a/TypeScript/5ReplaceMethod/types/helpers/HealthHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/HealthHelper.d.ts index 3694a6e..e4cdcd6 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/HealthHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/HealthHelper.d.ts @@ -27,6 +27,7 @@ export declare class HealthHelper { * @param request Heal request * @param sessionID Session id * @param addEffects Should effects be added or removed (default - add) + * @param deleteExistingEffects Should all prior effects be removed before apply new ones */ saveVitality(pmcData: IPmcData, request: ISyncHealthRequestData, sessionID: string, addEffects?: boolean, deleteExistingEffects?: boolean): void; /** diff --git a/TypeScript/5ReplaceMethod/types/helpers/InRaidHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/InRaidHelper.d.ts index bf584c2..b4c0c1c 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/InRaidHelper.d.ts @@ -53,7 +53,7 @@ export declare class InRaidHelper { * @param victim Who was killed by player * @returns a numerical standing gain or loss */ - protected getStandingChangeForKill(victim: Victim): number; + protected getFenceStandingChangeForKillAsScav(victim: Victim): number; /** * Reset a profile to a baseline, used post-raid * Reset points earned during session property diff --git a/TypeScript/5ReplaceMethod/types/helpers/ItemHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/ItemHelper.d.ts index 99fca56..00f190f 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/ItemHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/ItemHelper.d.ts @@ -26,6 +26,7 @@ declare class ItemHelper { protected itemBaseClassService: ItemBaseClassService; protected localisationService: LocalisationService; protected localeService: LocaleService; + protected readonly defaultInvalidBaseTypes: string[]; constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, localisationService: LocalisationService, localeService: LocaleService); /** * Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash @@ -67,6 +68,11 @@ declare class ItemHelper { * @returns Price in roubles (undefined if not found) */ getDynamicItemPrice(tpl: string): number; + /** + * Update items upd.StackObjectsCount to be 1 if its upd is missing or StackObjectsCount is undefined + * @param item Item to update + * @returns Fixed item + */ fixItemStackCount(item: Item): Item; /** * AmmoBoxes contain StackSlots which need to be filled for the AmmoBox to have content. @@ -125,19 +131,19 @@ declare class ItemHelper { getItemQualityModifier(item: Item): number; /** * Get a quality value based on a repairable items (weapon/armor) current state between current and max durability - * @param itemDetails - * @param repairable repairable object - * @param item - * @returns a number between 0 and 1 + * @param itemDetails Db details for item we want quality value for + * @param repairable Repairable properties + * @param item Item quality value is for + * @returns A number between 0 and 1 */ protected getRepairableItemQualityValue(itemDetails: ITemplateItem, repairable: Repairable, item: Item): number; /** * Recursive function that looks at every item from parameter and gets their childrens Ids + includes parent item in results - * @param items - * @param itemID + * @param items Array of items (item + possible children) + * @param itemId Parent items id * @returns an array of strings */ - findAndReturnChildrenByItems(items: Item[], itemID: string): string[]; + findAndReturnChildrenByItems(items: Item[], itemId: string): string[]; /** * A variant of findAndReturnChildren where the output is list of item objects instead of their ids. * @param items @@ -164,12 +170,6 @@ declare class ItemHelper { * @returns true if it is a dogtag */ isDogtag(tpl: string): boolean; - /** - * Can the item passed in be sold to a trader because it is raw money - * @param tpl Item template id to check - * @returns true if unsellable - */ - isNotSellable(tpl: string): boolean; /** * Gets the identifier for a child using slotId, locationX and locationY. * @param item @@ -183,19 +183,19 @@ declare class ItemHelper { */ isItemTplStackable(tpl: string): boolean; /** - * split item stack if it exceeds its StackMaxSize property - * @param itemToSplit item being split into smaller stacks + * split item stack if it exceeds its items StackMaxSize property + * @param itemToSplit Item to split into smaller stacks * @returns Array of split items */ splitStack(itemToSplit: Item): Item[]; /** - * Find Barter items in the inventory + * Find Barter items from array of items * @param {string} by tpl or id - * @param {Object} pmcData + * @param {Item[]} items Array of items to iterate over * @param {string} barterItemId * @returns Array of Item objects */ - findBarterItems(by: "tpl" | "id", pmcData: IPmcData, barterItemId: string): Item[]; + findBarterItems(by: "tpl" | "id", items: Item[], barterItemId: string): Item[]; /** * Regenerate all guids with new ids, exceptions are for items that cannot be altered (e.g. stash/sorting table) * @param pmcData Player profile @@ -262,10 +262,21 @@ declare class ItemHelper { * @param minSizePercent % the magazine must be filled to */ fillMagazineWithCartridge(magazine: Item[], magTemplate: ITemplateItem, cartridgeTpl: string, minSizePercent?: number): void; + /** + * Choose a random bullet type from the list of possible a magazine has + * @param magTemplate Magazine template from Db + * @returns Tpl of cartridge + */ protected getRandomValidCaliber(magTemplate: ITemplateItem): string; + /** + * Chose a randomly weighted cartridge that fits + * @param caliber Desired caliber + * @param staticAmmoDist Cartridges and thier weights + * @returns Tpl of cartrdige + */ protected drawAmmoTpl(caliber: string, staticAmmoDist: Record): string; /** - * + * Create a basic cartrige object * @param parentId container cartridges will be placed in * @param ammoTpl Cartridge to insert * @param stackCount Count of cartridges inside parent diff --git a/TypeScript/5ReplaceMethod/types/helpers/QuestHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/QuestHelper.d.ts index e04b6e0..5c749d3 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/QuestHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/QuestHelper.d.ts @@ -21,6 +21,7 @@ import { DialogueHelper } from "./DialogueHelper"; import { ItemHelper } from "./ItemHelper"; import { PaymentHelper } from "./PaymentHelper"; import { ProfileHelper } from "./ProfileHelper"; +import { QuestConditionHelper } from "./QuestConditionHelper"; import { RagfairServerHelper } from "./RagfairServerHelper"; import { TraderHelper } from "./TraderHelper"; export declare class QuestHelper { @@ -29,6 +30,7 @@ export declare class QuestHelper { protected timeUtil: TimeUtil; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; + protected questConditionHelper: QuestConditionHelper; protected eventOutputHolder: EventOutputHolder; protected databaseServer: DatabaseServer; protected localeService: LocaleService; @@ -41,7 +43,7 @@ export declare class QuestHelper { protected mailSendService: MailSendService; protected configServer: ConfigServer; 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, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, questConditionHelper: QuestConditionHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, mailSendService: MailSendService, configServer: ConfigServer); /** * Get status of a quest in player profile by its id * @param pmcData Profile to search @@ -119,7 +121,7 @@ export declare class QuestHelper { * @param sessionID Session id * @returns Quests accessible to player incuding newly unlocked quests now quest (startedQuestId) was started */ - acceptedUnlocked(startedQuestId: string, sessionID: string): IQuest[]; + getNewlyAccessibleQuestsWhenStartingQuest(startedQuestId: string, sessionID: string): IQuest[]; /** * Get quests that can be shown to player after failing a quest * @param failedQuestId Id of the quest failed by player diff --git a/TypeScript/5ReplaceMethod/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/RagfairOfferHelper.d.ts index de9d550..0699259 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/RagfairOfferHelper.d.ts @@ -1,4 +1,5 @@ import { IPmcData } from "../models/eft/common/IPmcData"; +import { Item } from "../models/eft/common/tables/IItem"; import { ITraderAssort } from "../models/eft/common/tables/ITrader"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; @@ -13,10 +14,10 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { LocaleService } from "../services/LocaleService"; import { LocalisationService } from "../services/LocalisationService"; +import { MailSendService } from "../services/MailSendService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { HashUtil } from "../utils/HashUtil"; import { TimeUtil } from "../utils/TimeUtil"; -import { DialogueHelper } from "./DialogueHelper"; import { ItemHelper } from "./ItemHelper"; import { PaymentHelper } from "./PaymentHelper"; import { PresetHelper } from "./PresetHelper"; @@ -33,7 +34,6 @@ export declare class RagfairOfferHelper { protected databaseServer: DatabaseServer; protected traderHelper: TraderHelper; protected saveServer: SaveServer; - protected dialogueHelper: DialogueHelper; protected itemHelper: ItemHelper; protected paymentHelper: PaymentHelper; protected presetHelper: PresetHelper; @@ -44,11 +44,12 @@ export declare class RagfairOfferHelper { protected ragfairOfferService: RagfairOfferService; protected localeService: LocaleService; protected localisationService: LocalisationService; + protected mailSendService: MailSendService; protected configServer: ConfigServer; protected static goodSoldTemplate: string; protected ragfairConfig: IRagfairConfig; 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, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, localisationService: LocalisationService, mailSendService: MailSendService, configServer: ConfigServer); /** * Passthrough to ragfairOfferService.getOffers(), get flea offers a player should see * @param searchRequest Data from client @@ -119,19 +120,26 @@ export declare class RagfairOfferHelper { */ protected getProfileOffers(sessionID: string): IRagfairOffer[]; /** - * Delete an offer from a desired profile + * Delete an offer from a desired profile and from ragfair offers * @param sessionID Session id of profile to delete offer from - * @param offerId Offer id to delete + * @param offerId Id of offer to delete */ - protected deleteOfferByOfferId(sessionID: string, offerId: string): void; + protected deleteOfferById(sessionID: string, offerId: string): void; /** * Complete the selling of players' offer * @param sessionID Session id * @param offer Sold offer details * @param boughtAmount Amount item was purchased for - * @returns Client response + * @returns IItemEventRouterResponse */ protected completeOffer(sessionID: string, offer: IRagfairOffer, boughtAmount: number): IItemEventRouterResponse; + /** + * Get a localised message for when players offer has sold on flea + * @param itemTpl Item sold + * @param boughtAmount How many were purchased + * @returns Localised message text + */ + protected getLocalisedOfferSoldMessage(itemTpl: string, boughtAmount: number): string; /** * Should a ragfair offer be visible to the player * @param searchRequest Search request @@ -142,4 +150,12 @@ export declare class RagfairOfferHelper { * @returns True = should be shown to player */ isDisplayableOffer(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, offer: IRagfairOffer, pmcProfile: IPmcData): boolean; + /** + * Is items quality value within desired range + * @param item Item to check quality of + * @param min Desired minimum quality + * @param max Desired maximum quality + * @returns True if in range + */ + protected itemQualityInRange(item: Item, min: number, max: number): boolean; } diff --git a/TypeScript/5ReplaceMethod/types/helpers/RagfairSellHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/RagfairSellHelper.d.ts index 251d7ca..913b408 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/RagfairSellHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/RagfairSellHelper.d.ts @@ -13,12 +13,12 @@ export declare class RagfairSellHelper { constructor(logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, configServer: ConfigServer); /** * Get the percent chance to sell an item based on its average listed price vs player chosen listing price - * @param baseChancePercent Base chance to sell item * @param averageOfferPriceRub Price of average offer in roubles * @param playerListedPriceRub Price player listed item for in roubles + * @param qualityMultiplier Quality multipler of item being sold * @returns percent value */ - calculateSellChance(baseChancePercent: number, averageOfferPriceRub: number, playerListedPriceRub: number): number; + calculateSellChance(averageOfferPriceRub: number, playerListedPriceRub: number, qualityMultiplier: number): number; /** * Get percent chance to sell an item when price is below items average listing price * @param playerListedPriceRub Price player listed item for in roubles diff --git a/TypeScript/5ReplaceMethod/types/helpers/TraderHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/TraderHelper.d.ts index c163f7a..6680ccf 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/TraderHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/TraderHelper.d.ts @@ -35,7 +35,7 @@ export declare class TraderHelper { protected highestTraderBuyPriceItems: Record; constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, handbookHelper: HandbookHelper, itemHelper: ItemHelper, playerService: PlayerService, localisationService: LocalisationService, fenceService: FenceService, timeUtil: TimeUtil, randomUtil: RandomUtil, configServer: ConfigServer); getTrader(traderID: string, sessionID: string): ITraderBase; - getTraderAssortsById(traderId: string): ITraderAssort; + getTraderAssortsByTraderId(traderId: string): ITraderAssort; /** * 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 diff --git a/TypeScript/5ReplaceMethod/types/models/eft/common/tables/IBotBase.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/common/tables/IBotBase.d.ts index ee40958..6c7b76f 100644 --- a/TypeScript/5ReplaceMethod/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/eft/common/tables/IBotBase.d.ts @@ -281,7 +281,7 @@ export interface InsuredItem { export interface Hideout { Production: Record; Areas: HideoutArea[]; - Improvements: Record; + Improvement: Record; Seed: number; sptUpdateLastRunTimestamp: number; } diff --git a/TypeScript/5ReplaceMethod/types/models/eft/health/IHealthTreatmentRequestData.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/health/IHealthTreatmentRequestData.d.ts index 7fb80a8..598e60c 100644 --- a/TypeScript/5ReplaceMethod/types/models/eft/health/IHealthTreatmentRequestData.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/eft/health/IHealthTreatmentRequestData.d.ts @@ -1,12 +1,14 @@ export interface IHealthTreatmentRequestData { Action: "RestoreHealth"; trader: string; - items: Item[]; + items: Cost[]; difference: Difference; timestamp: number; } -export interface Item { +export interface Cost { + /** Id of stack to take money from */ id: string; + /** Amount of money to take off player for treatment */ count: number; } export interface Difference { @@ -25,5 +27,6 @@ export interface BodyParts { } export interface BodyPart { Health: number; + /** Effects in array are to be removed */ Effects: string[]; } diff --git a/TypeScript/5ReplaceMethod/types/models/eft/notifier/INotifier.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/notifier/INotifier.d.ts index ce25dee..c6c6979 100644 --- a/TypeScript/5ReplaceMethod/types/models/eft/notifier/INotifier.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/eft/notifier/INotifier.d.ts @@ -14,6 +14,11 @@ export interface INotification { } export declare enum NotificationType { RAGFAIR_OFFER_SOLD = "RagfairOfferSold", + RAGFAIR_RATING_CHANGE = "RagfairRatingChange", + /** ChatMessageReceived */ NEW_MESSAGE = "new_message", - PING = "ping" + PING = "ping", + TRADER_SUPPLY = "TraderSupply", + TRADER_STANDING = "TraderStanding", + UNLOCK_TRADER = "UnlockTrader" } diff --git a/TypeScript/5ReplaceMethod/types/models/eft/notifier/ISelectProfileResponse.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/notifier/ISelectProfileResponse.d.ts index ecb668a..f2d6be7 100644 --- a/TypeScript/5ReplaceMethod/types/models/eft/notifier/ISelectProfileResponse.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/eft/notifier/ISelectProfileResponse.d.ts @@ -1,6 +1,3 @@ -import { INotifierChannel } from "./INotifier"; export interface ISelectProfileResponse { status: string; - notifier: INotifierChannel; - notifierServer: string; } diff --git a/TypeScript/5ReplaceMethod/types/models/enums/WeatherType.d.ts b/TypeScript/5ReplaceMethod/types/models/enums/WeatherType.d.ts index d31fefe..503dc30 100644 --- a/TypeScript/5ReplaceMethod/types/models/enums/WeatherType.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/enums/WeatherType.d.ts @@ -1,19 +1,19 @@ export declare enum WeatherType { - CLEAR_DAY = 1, - CLEAR_WIND = 2, - CLEAR_NIGHT = 3, - PARTLY_CLOUD_DAY = 4, - PARTLY_CLOUD_NIGHT = 5, - CLEAR_FOG_DAY = 6, - CLEAR_FOG_NIGHT = 7, - CLOUDFOG = 8, - FOG = 9, - MOSTLY_CLOUD = 10, - LIGHT_RAIN = 11, - RAIN = 12, - CLOUD_WIND = 13, - CLOUD_WIND_RAIN = 14, - FULL_CLOUD = 15, - THUNDER_CLOUD = 16, - NONE = 0 + CLEAR_DAY = 0, + CLEAR_WIND = 1, + CLEAR_NIGHT = 2, + PARTLY_CLOUD_DAY = 3, + PARTLY_CLOUD_NIGHT = 4, + CLEAR_FOG_DAY = 5, + CLEAR_FOG_NIGHT = 6, + CLOUD_FOG = 7, + FOG = 8, + MOSTLY_CLOUD = 9, + LIGHT_RAIN = 10, + RAIN = 11, + CLOUD_WIND = 12, + CLOUD_WIND_RAIN = 13, + FULL_CLOUD = 14, + THUNDER_CLOUD = 15, + NONE = 16 } diff --git a/TypeScript/5ReplaceMethod/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/config/IRagfairConfig.d.ts index 7c04857..7aea24f 100644 --- a/TypeScript/5ReplaceMethod/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/spt/config/IRagfairConfig.d.ts @@ -41,7 +41,8 @@ export interface Dynamic { /** Use the highest trader price for an offer if its greater than the price in templates/prices.json */ useTraderPriceForOffersIfHigher: boolean; /** Barter offer specific settings */ - barter: Barter; + barter: IBarterDetails; + pack: IPackDetails; /** Dynamic offer price below handbook adjustment values */ offerAdjustment: OfferAdjustment; /** How many offers should expire before an offer regeneration occurs */ @@ -49,9 +50,7 @@ export interface Dynamic { /** How many offers should be listed */ offerItemCount: MinMax; /** How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) */ - price: MinMax; - /** How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) */ - presetPrice: MinMax; + priceRanges: IPriceRanges; /** Should default presets to listed only or should non-standard presets found in globals.json be listed too */ showDefaultPresetsOnly: boolean; endTimeSeconds: MinMax; @@ -74,7 +73,12 @@ export interface Dynamic { /** Dict of price limits keyed by item type */ unreasonableModPrices: Record; } -export interface Barter { +export interface IPriceRanges { + default: MinMax; + preset: MinMax; + pack: MinMax; +} +export interface IBarterDetails { /** Should barter offers be generated */ enable: boolean; /** Percentage change an offer is listed as a barter */ @@ -90,6 +94,18 @@ export interface Barter { /** Item Tpls to never be turned into a barter */ itemTypeBlacklist: string[]; } +export interface IPackDetails { + /** Should pack offers be generated */ + enable: boolean; + /** Percentage change an offer is listed as a pack */ + chancePercent: number; + /** Min number of required items for a pack */ + itemCountMin: number; + /** Max number of required items for a pack */ + itemCountMax: number; + /** item types to allow being a pack */ + itemTypeWhitelist: string[]; +} export interface OfferAdjustment { /** Shuld offer price be adjusted when below handbook price */ adjustPriceWhenBelowHandbookPrice: boolean; diff --git a/TypeScript/5ReplaceMethod/types/models/spt/config/IWeatherConfig.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/config/IWeatherConfig.d.ts index 41a1c83..6ecf35b 100644 --- a/TypeScript/5ReplaceMethod/types/models/spt/config/IWeatherConfig.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/spt/config/IWeatherConfig.d.ts @@ -7,7 +7,7 @@ export interface IWeatherConfig extends IBaseConfig { weather: Weather; } export interface Weather { - clouds: MinMax; + clouds: WeatherSettings; windSpeed: WeatherSettings; windDirection: WeatherSettings; windGustiness: MinMax; diff --git a/TypeScript/5ReplaceMethod/types/services/HashCacheService.d.ts b/TypeScript/5ReplaceMethod/types/services/HashCacheService.d.ts index 5320f28..9968478 100644 --- a/TypeScript/5ReplaceMethod/types/services/HashCacheService.d.ts +++ b/TypeScript/5ReplaceMethod/types/services/HashCacheService.d.ts @@ -11,7 +11,18 @@ export declare class HashCacheService { protected modHashes: any; protected readonly modCachePath = "./user/cache/modCache.json"; constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); + /** + * Return a stored hash by key + * @param modName Name of mod to get hash for + * @returns Mod hash + */ getStoredModHash(modName: string): string; + /** + * Does the generated hash match the stored hash + * @param modName name of mod + * @param modContent + * @returns True if they match + */ modContentMatchesStoredHash(modName: string, modContent: string): boolean; hashMatchesStoredHash(modName: string, modHash: string): boolean; storeModContent(modName: string, modContent: string): void; diff --git a/TypeScript/5ReplaceMethod/types/services/MailSendService.d.ts b/TypeScript/5ReplaceMethod/types/services/MailSendService.d.ts index 19397dc..fe4a7fe 100644 --- a/TypeScript/5ReplaceMethod/types/services/MailSendService.d.ts +++ b/TypeScript/5ReplaceMethod/types/services/MailSendService.d.ts @@ -35,7 +35,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendDirectNpcMessageToPlayer(playerId: string, sender: Traders, messageType: MessageType, message: string, items?: Item[], maxStorageTimeSeconds?: any): void; + sendDirectNpcMessageToPlayer(playerId: string, sender: Traders, messageType: MessageType, message: string, items?: Item[], maxStorageTimeSeconds?: any, systemData?: any, ragfair?: any): void; /** * Send a message from an NPC (e.g. prapor) to the player with or without items * @param playerId Players id to send message to @@ -45,7 +45,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendLocalisedNpcMessageToPlayer(playerId: string, sender: Traders, messageType: MessageType, messageLocaleId: string, items?: Item[], maxStorageTimeSeconds?: any, systemData?: any): void; + sendLocalisedNpcMessageToPlayer(playerId: string, sender: Traders, messageType: MessageType, messageLocaleId: string, items?: Item[], maxStorageTimeSeconds?: any, systemData?: any, ragfair?: any): void; /** * Send a message from SYSTEM to the player with or without items * @param playerId Players id to send message to diff --git a/TypeScript/5ReplaceMethod/types/services/MatchBotDetailsCacheService.d.ts b/TypeScript/5ReplaceMethod/types/services/MatchBotDetailsCacheService.d.ts index eb365dd..c1bd322 100644 --- a/TypeScript/5ReplaceMethod/types/services/MatchBotDetailsCacheService.d.ts +++ b/TypeScript/5ReplaceMethod/types/services/MatchBotDetailsCacheService.d.ts @@ -1,7 +1,7 @@ import { IBotBase } from "../models/eft/common/tables/IBotBase"; import { ILogger } from "../models/spt/utils/ILogger"; import { LocalisationService } from "./LocalisationService"; -/** Cache bots in a dictionary, keyed by the bots name, keying by name isnt idea as its not unique but this is used by the post-raid system which doesnt have any bot ids, only name */ +/** Cache bots in a dictionary, keyed by the bots name, keying by name isnt ideal as its not unique but this is used by the post-raid system which doesnt have any bot ids, only name */ export declare class MatchBotDetailsCacheService { protected logger: ILogger; protected localisationService: LocalisationService; @@ -17,9 +17,9 @@ export declare class MatchBotDetailsCacheService { */ clearCache(): void; /** - * Find a bot in the cache by its name + * Find a bot in the cache by its name and side * @param botName Name of bot to find * @returns Bot details */ - getBotByName(botName: string): IBotBase; + getBotByNameAndSide(botName: string, botSide: string): IBotBase; } diff --git a/TypeScript/5ReplaceMethod/types/services/ModCompilerService.d.ts b/TypeScript/5ReplaceMethod/types/services/ModCompilerService.d.ts index a4bf3c8..e306177 100644 --- a/TypeScript/5ReplaceMethod/types/services/ModCompilerService.d.ts +++ b/TypeScript/5ReplaceMethod/types/services/ModCompilerService.d.ts @@ -1,14 +1,36 @@ import { CompilerOptions } from "typescript"; import type { ILogger } from "../models/spt/utils/ILogger"; -import { HashCacheService } from "./HashCacheService"; import { VFS } from "../utils/VFS"; +import { HashCacheService } from "./HashCacheService"; export declare class ModCompilerService { protected logger: ILogger; protected hashCacheService: HashCacheService; protected vfs: VFS; constructor(logger: ILogger, hashCacheService: HashCacheService, vfs: VFS); + /** + * Convert a mods TS into JS + * @param modName Name of mod + * @param modPath Dir path to mod + * @param modTypeScriptFiles + * @returns + */ compileMod(modName: string, modPath: string, modTypeScriptFiles: string[]): Promise; + /** + * Convert a TS file into JS + * @param fileNames Paths to TS files + * @param options Compiler options + */ protected compile(fileNames: string[], options: CompilerOptions): Promise; + /** + * Do the files at the provided paths exist + * @param fileNames + * @returns + */ protected areFilesReady(fileNames: string[]): boolean; + /** + * Wait the provided number of milliseconds + * @param ms Milliseconds + * @returns + */ protected delay(ms: number): Promise; } diff --git a/TypeScript/5ReplaceMethod/types/services/PaymentService.d.ts b/TypeScript/5ReplaceMethod/types/services/PaymentService.d.ts index 1c9c32b..fb5f92c 100644 --- a/TypeScript/5ReplaceMethod/types/services/PaymentService.d.ts +++ b/TypeScript/5ReplaceMethod/types/services/PaymentService.d.ts @@ -61,23 +61,26 @@ export declare class PaymentService { * Get all money stacks in inventory and prioritse items in stash * @param pmcData * @param currencyTpl + * @param playerStashId Players stash id * @returns Sorting money items */ - protected getSortedMoneyItemsInInventory(pmcData: IPmcData, currencyTpl: string): Item[]; + protected getSortedMoneyItemsInInventory(pmcData: IPmcData, currencyTpl: string, playerStashId: string): Item[]; /** * Prioritise player stash first over player inventory * Post-raid healing would often take money out of the players pockets/secure container * @param a First money stack item * @param b Second money stack item * @param inventoryItems players inventory items + * @param playerStashId Players stash id * @returns sort order */ - protected prioritiseStashSort(a: Item, b: Item, inventoryItems: Item[]): number; + protected prioritiseStashSort(a: Item, b: Item, inventoryItems: Item[], playerStashId: string): number; /** * Recursivly check items parents to see if it is inside the players inventory, not stash * @param itemId item id to check * @param inventoryItems player inventory + * @param playerStashId Players stash id * @returns true if its in inventory */ - protected isInInventory(itemId: string, inventoryItems: Item[]): boolean; + protected isInStash(itemId: string, inventoryItems: Item[], playerStashId: string): boolean; } diff --git a/TypeScript/5ReplaceMethod/types/services/ProfileFixerService.d.ts b/TypeScript/5ReplaceMethod/types/services/ProfileFixerService.d.ts index c8232fc..bc1e42e 100644 --- a/TypeScript/5ReplaceMethod/types/services/ProfileFixerService.d.ts +++ b/TypeScript/5ReplaceMethod/types/services/ProfileFixerService.d.ts @@ -14,6 +14,7 @@ import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; import { Watermark } from "../utils/Watermark"; import { LocalisationService } from "./LocalisationService"; @@ -27,17 +28,19 @@ export declare class ProfileFixerService { protected itemHelper: ItemHelper; protected localisationService: LocalisationService; protected timeUtil: TimeUtil; + protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, profileHelper: ProfileHelper, itemHelper: ItemHelper, localisationService: LocalisationService, timeUtil: TimeUtil, databaseServer: DatabaseServer, configServer: ConfigServer); + constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, profileHelper: ProfileHelper, itemHelper: ItemHelper, localisationService: LocalisationService, timeUtil: TimeUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, configServer: ConfigServer); /** * 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; protected addMissingGunStandContainerImprovements(pmcProfile: IPmcData): void; + protected ensureGunStandLevelsMatch(pmcProfile: IPmcData): void; protected addHideoutAreaStashes(pmcProfile: IPmcData): void; protected addMissingHideoutWallAreas(pmcProfile: IPmcData): void; protected adjustUnreasonableModFleaPrices(): void; @@ -131,4 +134,9 @@ export declare class ProfileFixerService { * @param pmcProfile Profile to add missing IDs to */ addMissingIdsToBonuses(pmcProfile: IPmcData): void; + /** + * At some point the property name was changed,migrate data across to new name + * @param pmcProfile + */ + protected migrateImprovements(pmcProfile: IPmcData): void; } diff --git a/TypeScript/5ReplaceMethod/types/services/RagfairPriceService.d.ts b/TypeScript/5ReplaceMethod/types/services/RagfairPriceService.d.ts index e245efa..ff35327 100644 --- a/TypeScript/5ReplaceMethod/types/services/RagfairPriceService.d.ts +++ b/TypeScript/5ReplaceMethod/types/services/RagfairPriceService.d.ts @@ -3,6 +3,7 @@ import { HandbookHelper } from "../helpers/HandbookHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { TraderHelper } from "../helpers/TraderHelper"; +import { MinMax } from "../models/common/MinMax"; import { IPreset } from "../models/eft/common/IGlobals"; import { Item } from "../models/eft/common/tables/IItem"; import { IBarterScheme } from "../models/eft/common/tables/ITrader"; @@ -35,10 +36,6 @@ export declare class RagfairPriceService implements OnLoad { * Generate static (handbook) and dynamic (prices.json) flea prices, store inside class as dictionaries */ onLoad(): Promise; - /** - * Add placeholder values for items missing from handbook - */ - protected addMissingHandbookPrices(): void; getRoute(): string; /** * Iterate over all items of type "Item" in db and get template price, store in cache @@ -91,9 +88,17 @@ export declare class RagfairPriceService implements OnLoad { * Generate a currency cost for an item and its mods * @param items Item with mods to get price for * @param desiredCurrency Currency price desired in + * @param isPackOffer Price is for a pack type offer * @returns cost of item in desired currency */ - getDynamicOfferPrice(items: Item[], desiredCurrency: string): number; + getDynamicOfferPriceForOffer(items: Item[], desiredCurrency: string, isPackOffer: boolean): number; + /** + * Get different min/max price multipliers for different offer types (preset/pack/default) + * @param isPreset Offer is a preset + * @param isPack Offer is a pack + * @returns MinMax values + */ + protected getOfferTypeRangeValues(isPreset: boolean, isPack: boolean): MinMax; /** * Check to see if an items price is below its handbook price and adjust accoring to values set to config/ragfair.json * @param itemPrice price of item @@ -104,10 +109,10 @@ export declare class RagfairPriceService implements OnLoad { /** * Multiply the price by a randomised curve where n = 2, shift = 2 * @param existingPrice price to alter - * @param isPreset is the item we're multiplying a preset + * @param rangeValues min and max to adjust price by * @returns multiplied price */ - protected randomisePrice(existingPrice: number, isPreset: boolean): number; + protected randomiseOfferPrice(existingPrice: number, rangeValues: MinMax): number; /** * Calculate the cost of a weapon preset by adding together the price of its mods + base price of default weapon preset * @param item base weapon diff --git a/TypeScript/6ReferenceAnotherClass/types/callbacks/GameCallbacks.d.ts b/TypeScript/6ReferenceAnotherClass/types/callbacks/GameCallbacks.d.ts index aa80036..46f79f9 100644 --- a/TypeScript/6ReferenceAnotherClass/types/callbacks/GameCallbacks.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/callbacks/GameCallbacks.d.ts @@ -1,4 +1,5 @@ import { GameController } from "../controllers/GameController"; +import { OnLoad } from "../di/OnLoad"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { ICheckVersionResponse } from "../models/eft/game/ICheckVersionResponse"; import { ICurrentGroupResponse } from "../models/eft/game/ICurrentGroupResponse"; @@ -15,12 +16,14 @@ import { INullResponseData } from "../models/eft/httpResponse/INullResponseData" import { SaveServer } from "../servers/SaveServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { Watermark } from "../utils/Watermark"; -declare class GameCallbacks { +declare class GameCallbacks implements OnLoad { protected httpResponse: HttpResponseUtil; protected watermark: Watermark; protected saveServer: SaveServer; protected gameController: GameController; constructor(httpResponse: HttpResponseUtil, watermark: Watermark, saveServer: SaveServer, gameController: GameController); + onLoad(): Promise; + getRoute(): string; /** * Handle client/game/version/validate * @returns INullResponseData diff --git a/TypeScript/6ReferenceAnotherClass/types/controllers/GameController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/GameController.d.ts index 04e3abb..e88610e 100644 --- a/TypeScript/6ReferenceAnotherClass/types/controllers/GameController.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/controllers/GameController.d.ts @@ -61,13 +61,14 @@ export declare class GameController { protected pmcConfig: IPmcConfig; protected lootConfig: ILootConfig; constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, randomUtil: RandomUtil, encodingUtil: EncodingUtil, hideoutHelper: HideoutHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, seasonalEventService: SeasonalEventService, itemBaseClassService: ItemBaseClassService, giftService: GiftService, applicationContext: ApplicationContext, configServer: ConfigServer); + load(): void; /** * Handle client/game/start */ gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; protected addCustomLooseLootPositions(): void; protected adjustLooseLootSpawnProbabilities(): void; - protected setHideoutAreasAndCraftsTo30Secs(): void; + protected setHideoutAreasAndCraftsTo40Secs(): void; /** * 3.7.0 moved AIDs to be numeric, old profiles need to be migrated * We store the old AID value in new field `sessionId` diff --git a/TypeScript/6ReferenceAnotherClass/types/controllers/HealthController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/HealthController.d.ts index 1938297..2d7ff09 100644 --- a/TypeScript/6ReferenceAnotherClass/types/controllers/HealthController.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/controllers/HealthController.d.ts @@ -29,34 +29,35 @@ export declare class HealthController { * stores in-raid player health * @param pmcData Player profile * @param info Request data - * @param sessionID + * @param sessionID Player id * @param addEffects Should effects found be added or removed from profile + * @param deleteExistingEffects Should all prior effects be removed before apply new ones */ saveVitality(pmcData: IPmcData, info: ISyncHealthRequestData, sessionID: string, addEffects?: boolean, deleteExistingEffects?: boolean): void; /** * When healing in menu - * @param pmcData - * @param body - * @param sessionID - * @returns + * @param pmcData Player profile + * @param request Healing request + * @param sessionID Player id + * @returns IItemEventRouterResponse */ - offraidHeal(pmcData: IPmcData, body: IOffraidHealRequestData, sessionID: string): IItemEventRouterResponse; + offraidHeal(pmcData: IPmcData, request: IOffraidHealRequestData, sessionID: string): IItemEventRouterResponse; /** * Handle Eat event * Consume food/water outside of a raid * @param pmcData Player profile - * @param body request Object + * @param request Eat request * @param sessionID Session id * @returns IItemEventRouterResponse */ - offraidEat(pmcData: IPmcData, body: IOffraidEatRequestData, sessionID: string): IItemEventRouterResponse; + offraidEat(pmcData: IPmcData, request: IOffraidEatRequestData, sessionID: string): IItemEventRouterResponse; /** * Handle RestoreHealth event * Occurs on post-raid healing page * @param pmcData player profile * @param healthTreatmentRequest Request data from client * @param sessionID Session id - * @returns + * @returns IItemEventRouterResponse */ healthTreatment(pmcData: IPmcData, healthTreatmentRequest: IHealthTreatmentRequestData, sessionID: string): IItemEventRouterResponse; /** @@ -66,12 +67,4 @@ export declare class HealthController { * @param sessionID */ applyWorkoutChanges(pmcData: IPmcData, info: IWorkoutData, sessionId: string): void; - /** - * Iterate over treatment request diff and find effects to remove from player limbs - * @param sessionId - * @param profile Profile to update - * @param treatmentRequest client request - * @param output response to send to client - */ - protected removeEffectsAfterPostRaidHeal(sessionId: string, profile: IPmcData, treatmentRequest: IHealthTreatmentRequestData, output: IItemEventRouterResponse): void; } diff --git a/TypeScript/6ReferenceAnotherClass/types/controllers/HideoutController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/HideoutController.d.ts index 877c076..a90a16d 100644 --- a/TypeScript/6ReferenceAnotherClass/types/controllers/HideoutController.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/controllers/HideoutController.d.ts @@ -88,11 +88,11 @@ export declare class HideoutController { * @param pmcData Profile to edit * @param output Object to send back to client * @param sessionID Session/player id - * @param profileHideoutArea Current hideout data for profile + * @param profileParentHideoutArea Current hideout area for profile * @param dbHideoutArea Hideout area being upgraded * @param hideoutStage Stage hideout area is being upgraded to */ - protected addContainerImprovementToProfile(output: IItemEventRouterResponse, sessionID: string, pmcData: IPmcData, profileHideoutArea: HideoutArea, dbHideoutArea: IHideoutArea, hideoutStage: Stage): void; + protected addContainerImprovementToProfile(output: IItemEventRouterResponse, sessionID: string, pmcData: IPmcData, profileParentHideoutArea: HideoutArea, dbHideoutArea: IHideoutArea, hideoutStage: Stage): void; /** * Add an inventory item to profile from a hideout area stage data * @param pmcData Profile to update diff --git a/TypeScript/6ReferenceAnotherClass/types/controllers/LocationController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/LocationController.d.ts index 94d496a..94f5fce 100644 --- a/TypeScript/6ReferenceAnotherClass/types/controllers/LocationController.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/controllers/LocationController.d.ts @@ -4,6 +4,7 @@ import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { ILocationBase } from "../models/eft/common/ILocationBase"; import { ILocationsGenerateAllResponse } from "../models/eft/common/ILocationsSourceDestinationBase"; import { IAirdropLootResult } from "../models/eft/location/IAirdropLootResult"; +import { IGetLocationRequestData } from "../models/eft/location/IGetLocationRequestData"; import { AirdropTypeEnum } from "../models/enums/AirdropType"; import { IAirdropConfig } from "../models/spt/config/IAirdropConfig"; import { ILocationConfig } from "../models/spt/config/ILocationConfig"; @@ -34,10 +35,11 @@ export declare class LocationController { /** * Handle client/location/getLocalloot * Get a location (map) with generated loot data - * @param location Map to generate loot for + * @param sessionId Player id + * @param request Map request to generate * @returns ILocationBase */ - get(location: string): ILocationBase; + get(sessionId: string, request: IGetLocationRequestData): ILocationBase; /** * Generate a maps base location with loot * @param name Map name diff --git a/TypeScript/6ReferenceAnotherClass/types/controllers/QuestController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/QuestController.d.ts index 7d494a6..bd8a70f 100644 --- a/TypeScript/6ReferenceAnotherClass/types/controllers/QuestController.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/controllers/QuestController.d.ts @@ -61,7 +61,7 @@ export declare class QuestController { * @param playerLevel level of player to test against quest * @returns true if quest can be seen/accepted by player of defined level */ - protected playerLevelFulfillsQuestRequrement(quest: IQuest, playerLevel: number): boolean; + protected playerLevelFulfillsQuestRequirement(quest: IQuest, playerLevel: number): boolean; /** * Should a quest be shown to the player in trader quest screen * @param questId Quest to check diff --git a/TypeScript/6ReferenceAnotherClass/types/controllers/RagfairController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/RagfairController.d.ts index 76c27f7..bda37cd 100644 --- a/TypeScript/6ReferenceAnotherClass/types/controllers/RagfairController.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/controllers/RagfairController.d.ts @@ -21,6 +21,7 @@ import { IGetMarketPriceRequestData } from "../models/eft/ragfair/IGetMarketPric import { IGetOffersResult } from "../models/eft/ragfair/IGetOffersResult"; import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; import { ISearchRequestData } from "../models/eft/ragfair/ISearchRequestData"; +import { IProcessBuyTradeRequestData } from "../models/eft/trade/IProcessBuyTradeRequestData"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; @@ -125,6 +126,18 @@ export declare class RagfairController { * @returns IItemEventRouterResponse */ addPlayerOffer(pmcData: IPmcData, offerRequest: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Charge player a listing fee for using flea, pulls charge from data previously sent by client + * @param sessionID Player id + * @param rootItem Base item being listed (used when client tax cost not found and must be done on server) + * @param pmcData Player profile + * @param requirementsPriceInRub Rouble cost player chose for listing (used when client tax cost not found and must be done on server) + * @param itemStackCount How many items were listed in player (used when client tax cost not found and must be done on server) + * @param offerRequest Add offer request object from client + * @param output IItemEventRouterResponse + * @returns True if charging tax to player failed + */ + protected chargePlayerTaxFee(sessionID: string, rootItem: Item, pmcData: IPmcData, requirementsPriceInRub: number, itemStackCount: number, offerRequest: IAddOfferRequestData, output: IItemEventRouterResponse): boolean; /** * Is the item to be listed on the flea valid * @param offerRequest Client offer request @@ -158,4 +171,11 @@ export declare class RagfairController { */ removeOffer(offerId: string, sessionID: string): IItemEventRouterResponse; extendOffer(info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Create a basic trader request object with price and currency type + * @param currency What currency: RUB, EURO, USD + * @param value Amount of currency + * @returns IProcessBuyTradeRequestData + */ + protected createBuyTradeRequestObject(currency: string, value: number): IProcessBuyTradeRequestData; } diff --git a/TypeScript/6ReferenceAnotherClass/types/generators/BotEquipmentModGenerator.d.ts b/TypeScript/6ReferenceAnotherClass/types/generators/BotEquipmentModGenerator.d.ts index ccbbbbf..f7abb84 100644 --- a/TypeScript/6ReferenceAnotherClass/types/generators/BotEquipmentModGenerator.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/generators/BotEquipmentModGenerator.d.ts @@ -14,7 +14,6 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; import { BotEquipmentModPoolService } from "../services/BotEquipmentModPoolService"; import { BotModLimits, BotWeaponModLimitService } from "../services/BotWeaponModLimitService"; -import { ItemBaseClassService } from "../services/ItemBaseClassService"; import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; @@ -29,7 +28,6 @@ export declare class BotEquipmentModGenerator { protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; protected botEquipmentFilterService: BotEquipmentFilterService; - protected itemBaseClassService: ItemBaseClassService; protected itemFilterService: ItemFilterService; protected profileHelper: ProfileHelper; protected botWeaponModLimitService: BotWeaponModLimitService; @@ -40,7 +38,7 @@ export declare class BotEquipmentModGenerator { protected botEquipmentModPoolService: BotEquipmentModPoolService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, itemHelper: ItemHelper, botEquipmentFilterService: BotEquipmentFilterService, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponModLimitService: BotWeaponModLimitService, botHelper: BotHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, botEquipmentModPoolService: BotEquipmentModPoolService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, itemHelper: ItemHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponModLimitService: BotWeaponModLimitService, botHelper: BotHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, botEquipmentModPoolService: BotEquipmentModPoolService, configServer: ConfigServer); /** * Check mods are compatible and add to array * @param equipment Equipment item to add mods to diff --git a/TypeScript/6ReferenceAnotherClass/types/generators/LocationGenerator.d.ts b/TypeScript/6ReferenceAnotherClass/types/generators/LocationGenerator.d.ts index b8169d3..46a514b 100644 --- a/TypeScript/6ReferenceAnotherClass/types/generators/LocationGenerator.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/generators/LocationGenerator.d.ts @@ -65,10 +65,11 @@ export declare class LocationGenerator { protected getGuaranteedContainers(staticContainersOnMap: IStaticContainerData[]): IStaticContainerData[]; /** * Choose a number of containers based on their probabilty value to fulfil the desired count in containerData.chosenCount + * @param groupId Name of the group the containers are being collected for * @param containerData Containers and probability values for a groupId * @returns List of chosen container Ids */ - protected getContainersByProbabilty(containerData: IContainerGroupCount): string[]; + protected getContainersByProbabilty(groupId: string, containerData: IContainerGroupCount): string[]; /** * Get a mapping of each groupid and the containers in that group + count of containers to spawn on map * @param containersGroups Container group values diff --git a/TypeScript/6ReferenceAnotherClass/types/generators/PMCLootGenerator.d.ts b/TypeScript/6ReferenceAnotherClass/types/generators/PMCLootGenerator.d.ts index 9acff69..abb5615 100644 --- a/TypeScript/6ReferenceAnotherClass/types/generators/PMCLootGenerator.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/generators/PMCLootGenerator.d.ts @@ -31,12 +31,12 @@ export declare class PMCLootGenerator { */ generatePMCVestLootPool(): string[]; /** - * Check if item has a width/height that lets it fit into a 1x2/2x1 slot - * 1x1 / 1x2 / 2x1 + * Check if item has a width/height that lets it fit into a 2x2 slot + * 1x1 / 1x2 / 2x1 / 2x2 * @param item Item to check size of * @returns true if it fits */ - protected itemFitsInto1By2Slot(item: ITemplateItem): boolean; + protected itemFitsInto2By2Slot(item: ITemplateItem): boolean; /** * Create an array of loot items a PMC can have in their backpack * @returns string array of tpls diff --git a/TypeScript/6ReferenceAnotherClass/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/6ReferenceAnotherClass/types/generators/RagfairOfferGenerator.d.ts index a627191..58e0b68 100644 --- a/TypeScript/6ReferenceAnotherClass/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/generators/RagfairOfferGenerator.d.ts @@ -55,11 +55,10 @@ export declare class RagfairOfferGenerator { * @param items Items in the offer * @param barterScheme Cost of item (currency or barter) * @param loyalLevel Loyalty level needed to buy item - * @param price Price of offer - * @param sellInOnePiece Set StackObjectsCount to 1 + * @param sellInOnePiece Flags sellInOnePiece to be true * @returns IRagfairOffer */ - createFleaOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; + createFleaOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, sellInOnePiece?: boolean): IRagfairOffer; /** * Create an offer object ready to send to ragfairOfferService.addOffer() * @param userID Owner of the offer @@ -67,17 +66,16 @@ export declare class RagfairOfferGenerator { * @param items Items in the offer * @param barterScheme Cost of item (currency or barter) * @param loyalLevel Loyalty level needed to buy item - * @param price Price of offer * @param sellInOnePiece Set StackObjectsCount to 1 * @returns IRagfairOffer */ - protected createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; + protected createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, sellInOnePiece?: boolean): IRagfairOffer; /** * Calculate the offer price that's listed on the flea listing * @param offerRequirements barter requirements for offer * @returns rouble cost of offer */ - protected calculateOfferListingPrice(offerRequirements: OfferRequirement[]): number; + protected convertOfferRequirementsIntoRoubles(offerRequirements: OfferRequirement[]): number; /** * Get avatar url from trader table in db * @param isTrader Is user we're getting avatar for a trader @@ -137,7 +135,7 @@ export declare class RagfairOfferGenerator { * @param itemDetails raw db item details * @returns Item array */ - protected createSingleOfferForItem(items: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; + protected createSingleOfferForItem(items: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; /** * Generate trader offers on flea using the traders assort data * @param traderID Trader to generate offers for @@ -151,7 +149,7 @@ export declare class RagfairOfferGenerator { * @param itemDetails db details of first item * @returns */ - protected getItemCondition(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): Item[]; + protected randomiseItemUpdProperties(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): Item[]; /** * Get the relevant condition id if item tpl matches in ragfair.json/condition * @param tpl Item to look for matching condition object @@ -184,7 +182,7 @@ export declare class RagfairOfferGenerator { * @param offerItems Items for sale in offer * @returns Barter scheme */ - protected createBarterRequirement(offerItems: Item[]): IBarterScheme[]; + protected createBarterBarterScheme(offerItems: Item[]): IBarterScheme[]; /** * Get an array of flea prices + item tpl, cached in generator class inside `allowedFleaPriceItemsForBarter` * @returns array with tpl/price values @@ -196,7 +194,9 @@ export declare class RagfairOfferGenerator { /** * Create a random currency-based barter scheme for an array of items * @param offerItems Items on offer + * @param isPackOffer Is the barter scheme being created for a pack offer + * @param multipler What to multiply the resulting price by * @returns Barter scheme for offer */ - protected createCurrencyRequirement(offerItems: Item[]): IBarterScheme[]; + protected createCurrencyBarterScheme(offerItems: Item[], isPackOffer: boolean, multipler?: number): IBarterScheme[]; } diff --git a/TypeScript/6ReferenceAnotherClass/types/generators/ScavCaseRewardGenerator.d.ts b/TypeScript/6ReferenceAnotherClass/types/generators/ScavCaseRewardGenerator.d.ts index 4ba1888..b5935d0 100644 --- a/TypeScript/6ReferenceAnotherClass/types/generators/ScavCaseRewardGenerator.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/generators/ScavCaseRewardGenerator.d.ts @@ -25,6 +25,8 @@ export declare class ScavCaseRewardGenerator { protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected scavCaseConfig: IScavCaseConfig; + protected dbItemsCache: ITemplateItem[]; + protected dbAmmoItemsCache: ITemplateItem[]; constructor(logger: ILogger, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * Create an array of rewards that will be given to the player upon completing their scav case build @@ -33,10 +35,10 @@ export declare class ScavCaseRewardGenerator { */ generate(recipeId: string): Product[]; /** - * Get all db items that are not blacklisted in scavcase config - * @returns filtered array of db items + * Get all db items that are not blacklisted in scavcase config or global blacklist + * Store in class field */ - protected getDbItems(): ITemplateItem[]; + protected cacheDbItems(): void; /** * Pick a number of items to be rewards, the count is defined by the values in * @param items item pool to pick rewards from diff --git a/TypeScript/6ReferenceAnotherClass/types/generators/WeatherGenerator.d.ts b/TypeScript/6ReferenceAnotherClass/types/generators/WeatherGenerator.d.ts index 2e2403c..6471bb1 100644 --- a/TypeScript/6ReferenceAnotherClass/types/generators/WeatherGenerator.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/generators/WeatherGenerator.d.ts @@ -52,6 +52,7 @@ export declare class WeatherGenerator { */ protected setCurrentDateTime(weather: IWeather): void; protected getWeightedWindDirection(): WindDirection; + protected getWeightedClouds(): number; protected getWeightedWindSpeed(): number; protected getWeightedFog(): number; protected getWeightedRain(): number; diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/HealthHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/HealthHelper.d.ts index 3694a6e..e4cdcd6 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/HealthHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/HealthHelper.d.ts @@ -27,6 +27,7 @@ export declare class HealthHelper { * @param request Heal request * @param sessionID Session id * @param addEffects Should effects be added or removed (default - add) + * @param deleteExistingEffects Should all prior effects be removed before apply new ones */ saveVitality(pmcData: IPmcData, request: ISyncHealthRequestData, sessionID: string, addEffects?: boolean, deleteExistingEffects?: boolean): void; /** diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/InRaidHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/InRaidHelper.d.ts index bf584c2..b4c0c1c 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/InRaidHelper.d.ts @@ -53,7 +53,7 @@ export declare class InRaidHelper { * @param victim Who was killed by player * @returns a numerical standing gain or loss */ - protected getStandingChangeForKill(victim: Victim): number; + protected getFenceStandingChangeForKillAsScav(victim: Victim): number; /** * Reset a profile to a baseline, used post-raid * Reset points earned during session property diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/ItemHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/ItemHelper.d.ts index 99fca56..00f190f 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/ItemHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/ItemHelper.d.ts @@ -26,6 +26,7 @@ declare class ItemHelper { protected itemBaseClassService: ItemBaseClassService; protected localisationService: LocalisationService; protected localeService: LocaleService; + protected readonly defaultInvalidBaseTypes: string[]; constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, localisationService: LocalisationService, localeService: LocaleService); /** * Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash @@ -67,6 +68,11 @@ declare class ItemHelper { * @returns Price in roubles (undefined if not found) */ getDynamicItemPrice(tpl: string): number; + /** + * Update items upd.StackObjectsCount to be 1 if its upd is missing or StackObjectsCount is undefined + * @param item Item to update + * @returns Fixed item + */ fixItemStackCount(item: Item): Item; /** * AmmoBoxes contain StackSlots which need to be filled for the AmmoBox to have content. @@ -125,19 +131,19 @@ declare class ItemHelper { getItemQualityModifier(item: Item): number; /** * Get a quality value based on a repairable items (weapon/armor) current state between current and max durability - * @param itemDetails - * @param repairable repairable object - * @param item - * @returns a number between 0 and 1 + * @param itemDetails Db details for item we want quality value for + * @param repairable Repairable properties + * @param item Item quality value is for + * @returns A number between 0 and 1 */ protected getRepairableItemQualityValue(itemDetails: ITemplateItem, repairable: Repairable, item: Item): number; /** * Recursive function that looks at every item from parameter and gets their childrens Ids + includes parent item in results - * @param items - * @param itemID + * @param items Array of items (item + possible children) + * @param itemId Parent items id * @returns an array of strings */ - findAndReturnChildrenByItems(items: Item[], itemID: string): string[]; + findAndReturnChildrenByItems(items: Item[], itemId: string): string[]; /** * A variant of findAndReturnChildren where the output is list of item objects instead of their ids. * @param items @@ -164,12 +170,6 @@ declare class ItemHelper { * @returns true if it is a dogtag */ isDogtag(tpl: string): boolean; - /** - * Can the item passed in be sold to a trader because it is raw money - * @param tpl Item template id to check - * @returns true if unsellable - */ - isNotSellable(tpl: string): boolean; /** * Gets the identifier for a child using slotId, locationX and locationY. * @param item @@ -183,19 +183,19 @@ declare class ItemHelper { */ isItemTplStackable(tpl: string): boolean; /** - * split item stack if it exceeds its StackMaxSize property - * @param itemToSplit item being split into smaller stacks + * split item stack if it exceeds its items StackMaxSize property + * @param itemToSplit Item to split into smaller stacks * @returns Array of split items */ splitStack(itemToSplit: Item): Item[]; /** - * Find Barter items in the inventory + * Find Barter items from array of items * @param {string} by tpl or id - * @param {Object} pmcData + * @param {Item[]} items Array of items to iterate over * @param {string} barterItemId * @returns Array of Item objects */ - findBarterItems(by: "tpl" | "id", pmcData: IPmcData, barterItemId: string): Item[]; + findBarterItems(by: "tpl" | "id", items: Item[], barterItemId: string): Item[]; /** * Regenerate all guids with new ids, exceptions are for items that cannot be altered (e.g. stash/sorting table) * @param pmcData Player profile @@ -262,10 +262,21 @@ declare class ItemHelper { * @param minSizePercent % the magazine must be filled to */ fillMagazineWithCartridge(magazine: Item[], magTemplate: ITemplateItem, cartridgeTpl: string, minSizePercent?: number): void; + /** + * Choose a random bullet type from the list of possible a magazine has + * @param magTemplate Magazine template from Db + * @returns Tpl of cartridge + */ protected getRandomValidCaliber(magTemplate: ITemplateItem): string; + /** + * Chose a randomly weighted cartridge that fits + * @param caliber Desired caliber + * @param staticAmmoDist Cartridges and thier weights + * @returns Tpl of cartrdige + */ protected drawAmmoTpl(caliber: string, staticAmmoDist: Record): string; /** - * + * Create a basic cartrige object * @param parentId container cartridges will be placed in * @param ammoTpl Cartridge to insert * @param stackCount Count of cartridges inside parent diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/QuestHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/QuestHelper.d.ts index e04b6e0..5c749d3 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/QuestHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/QuestHelper.d.ts @@ -21,6 +21,7 @@ import { DialogueHelper } from "./DialogueHelper"; import { ItemHelper } from "./ItemHelper"; import { PaymentHelper } from "./PaymentHelper"; import { ProfileHelper } from "./ProfileHelper"; +import { QuestConditionHelper } from "./QuestConditionHelper"; import { RagfairServerHelper } from "./RagfairServerHelper"; import { TraderHelper } from "./TraderHelper"; export declare class QuestHelper { @@ -29,6 +30,7 @@ export declare class QuestHelper { protected timeUtil: TimeUtil; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; + protected questConditionHelper: QuestConditionHelper; protected eventOutputHolder: EventOutputHolder; protected databaseServer: DatabaseServer; protected localeService: LocaleService; @@ -41,7 +43,7 @@ export declare class QuestHelper { protected mailSendService: MailSendService; protected configServer: ConfigServer; 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, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, questConditionHelper: QuestConditionHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, mailSendService: MailSendService, configServer: ConfigServer); /** * Get status of a quest in player profile by its id * @param pmcData Profile to search @@ -119,7 +121,7 @@ export declare class QuestHelper { * @param sessionID Session id * @returns Quests accessible to player incuding newly unlocked quests now quest (startedQuestId) was started */ - acceptedUnlocked(startedQuestId: string, sessionID: string): IQuest[]; + getNewlyAccessibleQuestsWhenStartingQuest(startedQuestId: string, sessionID: string): IQuest[]; /** * Get quests that can be shown to player after failing a quest * @param failedQuestId Id of the quest failed by player diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/RagfairOfferHelper.d.ts index de9d550..0699259 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/RagfairOfferHelper.d.ts @@ -1,4 +1,5 @@ import { IPmcData } from "../models/eft/common/IPmcData"; +import { Item } from "../models/eft/common/tables/IItem"; import { ITraderAssort } from "../models/eft/common/tables/ITrader"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; @@ -13,10 +14,10 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { LocaleService } from "../services/LocaleService"; import { LocalisationService } from "../services/LocalisationService"; +import { MailSendService } from "../services/MailSendService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { HashUtil } from "../utils/HashUtil"; import { TimeUtil } from "../utils/TimeUtil"; -import { DialogueHelper } from "./DialogueHelper"; import { ItemHelper } from "./ItemHelper"; import { PaymentHelper } from "./PaymentHelper"; import { PresetHelper } from "./PresetHelper"; @@ -33,7 +34,6 @@ export declare class RagfairOfferHelper { protected databaseServer: DatabaseServer; protected traderHelper: TraderHelper; protected saveServer: SaveServer; - protected dialogueHelper: DialogueHelper; protected itemHelper: ItemHelper; protected paymentHelper: PaymentHelper; protected presetHelper: PresetHelper; @@ -44,11 +44,12 @@ export declare class RagfairOfferHelper { protected ragfairOfferService: RagfairOfferService; protected localeService: LocaleService; protected localisationService: LocalisationService; + protected mailSendService: MailSendService; protected configServer: ConfigServer; protected static goodSoldTemplate: string; protected ragfairConfig: IRagfairConfig; 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, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, localisationService: LocalisationService, mailSendService: MailSendService, configServer: ConfigServer); /** * Passthrough to ragfairOfferService.getOffers(), get flea offers a player should see * @param searchRequest Data from client @@ -119,19 +120,26 @@ export declare class RagfairOfferHelper { */ protected getProfileOffers(sessionID: string): IRagfairOffer[]; /** - * Delete an offer from a desired profile + * Delete an offer from a desired profile and from ragfair offers * @param sessionID Session id of profile to delete offer from - * @param offerId Offer id to delete + * @param offerId Id of offer to delete */ - protected deleteOfferByOfferId(sessionID: string, offerId: string): void; + protected deleteOfferById(sessionID: string, offerId: string): void; /** * Complete the selling of players' offer * @param sessionID Session id * @param offer Sold offer details * @param boughtAmount Amount item was purchased for - * @returns Client response + * @returns IItemEventRouterResponse */ protected completeOffer(sessionID: string, offer: IRagfairOffer, boughtAmount: number): IItemEventRouterResponse; + /** + * Get a localised message for when players offer has sold on flea + * @param itemTpl Item sold + * @param boughtAmount How many were purchased + * @returns Localised message text + */ + protected getLocalisedOfferSoldMessage(itemTpl: string, boughtAmount: number): string; /** * Should a ragfair offer be visible to the player * @param searchRequest Search request @@ -142,4 +150,12 @@ export declare class RagfairOfferHelper { * @returns True = should be shown to player */ isDisplayableOffer(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, offer: IRagfairOffer, pmcProfile: IPmcData): boolean; + /** + * Is items quality value within desired range + * @param item Item to check quality of + * @param min Desired minimum quality + * @param max Desired maximum quality + * @returns True if in range + */ + protected itemQualityInRange(item: Item, min: number, max: number): boolean; } diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/RagfairSellHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/RagfairSellHelper.d.ts index 251d7ca..913b408 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/RagfairSellHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/RagfairSellHelper.d.ts @@ -13,12 +13,12 @@ export declare class RagfairSellHelper { constructor(logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, configServer: ConfigServer); /** * Get the percent chance to sell an item based on its average listed price vs player chosen listing price - * @param baseChancePercent Base chance to sell item * @param averageOfferPriceRub Price of average offer in roubles * @param playerListedPriceRub Price player listed item for in roubles + * @param qualityMultiplier Quality multipler of item being sold * @returns percent value */ - calculateSellChance(baseChancePercent: number, averageOfferPriceRub: number, playerListedPriceRub: number): number; + calculateSellChance(averageOfferPriceRub: number, playerListedPriceRub: number, qualityMultiplier: number): number; /** * Get percent chance to sell an item when price is below items average listing price * @param playerListedPriceRub Price player listed item for in roubles diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/TraderHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/TraderHelper.d.ts index c163f7a..6680ccf 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/TraderHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/TraderHelper.d.ts @@ -35,7 +35,7 @@ export declare class TraderHelper { protected highestTraderBuyPriceItems: Record; constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, handbookHelper: HandbookHelper, itemHelper: ItemHelper, playerService: PlayerService, localisationService: LocalisationService, fenceService: FenceService, timeUtil: TimeUtil, randomUtil: RandomUtil, configServer: ConfigServer); getTrader(traderID: string, sessionID: string): ITraderBase; - getTraderAssortsById(traderId: string): ITraderAssort; + getTraderAssortsByTraderId(traderId: string): ITraderAssort; /** * 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 diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/IBotBase.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/IBotBase.d.ts index ee40958..6c7b76f 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/IBotBase.d.ts @@ -281,7 +281,7 @@ export interface InsuredItem { export interface Hideout { Production: Record; Areas: HideoutArea[]; - Improvements: Record; + Improvement: Record; Seed: number; sptUpdateLastRunTimestamp: number; } diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/health/IHealthTreatmentRequestData.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/health/IHealthTreatmentRequestData.d.ts index 7fb80a8..598e60c 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/eft/health/IHealthTreatmentRequestData.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/health/IHealthTreatmentRequestData.d.ts @@ -1,12 +1,14 @@ export interface IHealthTreatmentRequestData { Action: "RestoreHealth"; trader: string; - items: Item[]; + items: Cost[]; difference: Difference; timestamp: number; } -export interface Item { +export interface Cost { + /** Id of stack to take money from */ id: string; + /** Amount of money to take off player for treatment */ count: number; } export interface Difference { @@ -25,5 +27,6 @@ export interface BodyParts { } export interface BodyPart { Health: number; + /** Effects in array are to be removed */ Effects: string[]; } diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/notifier/INotifier.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/notifier/INotifier.d.ts index ce25dee..c6c6979 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/eft/notifier/INotifier.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/notifier/INotifier.d.ts @@ -14,6 +14,11 @@ export interface INotification { } export declare enum NotificationType { RAGFAIR_OFFER_SOLD = "RagfairOfferSold", + RAGFAIR_RATING_CHANGE = "RagfairRatingChange", + /** ChatMessageReceived */ NEW_MESSAGE = "new_message", - PING = "ping" + PING = "ping", + TRADER_SUPPLY = "TraderSupply", + TRADER_STANDING = "TraderStanding", + UNLOCK_TRADER = "UnlockTrader" } diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/notifier/ISelectProfileResponse.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/notifier/ISelectProfileResponse.d.ts index ecb668a..f2d6be7 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/eft/notifier/ISelectProfileResponse.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/notifier/ISelectProfileResponse.d.ts @@ -1,6 +1,3 @@ -import { INotifierChannel } from "./INotifier"; export interface ISelectProfileResponse { status: string; - notifier: INotifierChannel; - notifierServer: string; } diff --git a/TypeScript/6ReferenceAnotherClass/types/models/enums/WeatherType.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/enums/WeatherType.d.ts index d31fefe..503dc30 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/enums/WeatherType.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/enums/WeatherType.d.ts @@ -1,19 +1,19 @@ export declare enum WeatherType { - CLEAR_DAY = 1, - CLEAR_WIND = 2, - CLEAR_NIGHT = 3, - PARTLY_CLOUD_DAY = 4, - PARTLY_CLOUD_NIGHT = 5, - CLEAR_FOG_DAY = 6, - CLEAR_FOG_NIGHT = 7, - CLOUDFOG = 8, - FOG = 9, - MOSTLY_CLOUD = 10, - LIGHT_RAIN = 11, - RAIN = 12, - CLOUD_WIND = 13, - CLOUD_WIND_RAIN = 14, - FULL_CLOUD = 15, - THUNDER_CLOUD = 16, - NONE = 0 + CLEAR_DAY = 0, + CLEAR_WIND = 1, + CLEAR_NIGHT = 2, + PARTLY_CLOUD_DAY = 3, + PARTLY_CLOUD_NIGHT = 4, + CLEAR_FOG_DAY = 5, + CLEAR_FOG_NIGHT = 6, + CLOUD_FOG = 7, + FOG = 8, + MOSTLY_CLOUD = 9, + LIGHT_RAIN = 10, + RAIN = 11, + CLOUD_WIND = 12, + CLOUD_WIND_RAIN = 13, + FULL_CLOUD = 14, + THUNDER_CLOUD = 15, + NONE = 16 } diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IRagfairConfig.d.ts index 7c04857..7aea24f 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IRagfairConfig.d.ts @@ -41,7 +41,8 @@ export interface Dynamic { /** Use the highest trader price for an offer if its greater than the price in templates/prices.json */ useTraderPriceForOffersIfHigher: boolean; /** Barter offer specific settings */ - barter: Barter; + barter: IBarterDetails; + pack: IPackDetails; /** Dynamic offer price below handbook adjustment values */ offerAdjustment: OfferAdjustment; /** How many offers should expire before an offer regeneration occurs */ @@ -49,9 +50,7 @@ export interface Dynamic { /** How many offers should be listed */ offerItemCount: MinMax; /** How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) */ - price: MinMax; - /** How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) */ - presetPrice: MinMax; + priceRanges: IPriceRanges; /** Should default presets to listed only or should non-standard presets found in globals.json be listed too */ showDefaultPresetsOnly: boolean; endTimeSeconds: MinMax; @@ -74,7 +73,12 @@ export interface Dynamic { /** Dict of price limits keyed by item type */ unreasonableModPrices: Record; } -export interface Barter { +export interface IPriceRanges { + default: MinMax; + preset: MinMax; + pack: MinMax; +} +export interface IBarterDetails { /** Should barter offers be generated */ enable: boolean; /** Percentage change an offer is listed as a barter */ @@ -90,6 +94,18 @@ export interface Barter { /** Item Tpls to never be turned into a barter */ itemTypeBlacklist: string[]; } +export interface IPackDetails { + /** Should pack offers be generated */ + enable: boolean; + /** Percentage change an offer is listed as a pack */ + chancePercent: number; + /** Min number of required items for a pack */ + itemCountMin: number; + /** Max number of required items for a pack */ + itemCountMax: number; + /** item types to allow being a pack */ + itemTypeWhitelist: string[]; +} export interface OfferAdjustment { /** Shuld offer price be adjusted when below handbook price */ adjustPriceWhenBelowHandbookPrice: boolean; diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IWeatherConfig.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IWeatherConfig.d.ts index 41a1c83..6ecf35b 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IWeatherConfig.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IWeatherConfig.d.ts @@ -7,7 +7,7 @@ export interface IWeatherConfig extends IBaseConfig { weather: Weather; } export interface Weather { - clouds: MinMax; + clouds: WeatherSettings; windSpeed: WeatherSettings; windDirection: WeatherSettings; windGustiness: MinMax; diff --git a/TypeScript/6ReferenceAnotherClass/types/services/HashCacheService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/HashCacheService.d.ts index 5320f28..9968478 100644 --- a/TypeScript/6ReferenceAnotherClass/types/services/HashCacheService.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/services/HashCacheService.d.ts @@ -11,7 +11,18 @@ export declare class HashCacheService { protected modHashes: any; protected readonly modCachePath = "./user/cache/modCache.json"; constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); + /** + * Return a stored hash by key + * @param modName Name of mod to get hash for + * @returns Mod hash + */ getStoredModHash(modName: string): string; + /** + * Does the generated hash match the stored hash + * @param modName name of mod + * @param modContent + * @returns True if they match + */ modContentMatchesStoredHash(modName: string, modContent: string): boolean; hashMatchesStoredHash(modName: string, modHash: string): boolean; storeModContent(modName: string, modContent: string): void; diff --git a/TypeScript/6ReferenceAnotherClass/types/services/MailSendService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/MailSendService.d.ts index 19397dc..fe4a7fe 100644 --- a/TypeScript/6ReferenceAnotherClass/types/services/MailSendService.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/services/MailSendService.d.ts @@ -35,7 +35,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendDirectNpcMessageToPlayer(playerId: string, sender: Traders, messageType: MessageType, message: string, items?: Item[], maxStorageTimeSeconds?: any): void; + sendDirectNpcMessageToPlayer(playerId: string, sender: Traders, messageType: MessageType, message: string, items?: Item[], maxStorageTimeSeconds?: any, systemData?: any, ragfair?: any): void; /** * Send a message from an NPC (e.g. prapor) to the player with or without items * @param playerId Players id to send message to @@ -45,7 +45,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendLocalisedNpcMessageToPlayer(playerId: string, sender: Traders, messageType: MessageType, messageLocaleId: string, items?: Item[], maxStorageTimeSeconds?: any, systemData?: any): void; + sendLocalisedNpcMessageToPlayer(playerId: string, sender: Traders, messageType: MessageType, messageLocaleId: string, items?: Item[], maxStorageTimeSeconds?: any, systemData?: any, ragfair?: any): void; /** * Send a message from SYSTEM to the player with or without items * @param playerId Players id to send message to diff --git a/TypeScript/6ReferenceAnotherClass/types/services/MatchBotDetailsCacheService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/MatchBotDetailsCacheService.d.ts index eb365dd..c1bd322 100644 --- a/TypeScript/6ReferenceAnotherClass/types/services/MatchBotDetailsCacheService.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/services/MatchBotDetailsCacheService.d.ts @@ -1,7 +1,7 @@ import { IBotBase } from "../models/eft/common/tables/IBotBase"; import { ILogger } from "../models/spt/utils/ILogger"; import { LocalisationService } from "./LocalisationService"; -/** Cache bots in a dictionary, keyed by the bots name, keying by name isnt idea as its not unique but this is used by the post-raid system which doesnt have any bot ids, only name */ +/** Cache bots in a dictionary, keyed by the bots name, keying by name isnt ideal as its not unique but this is used by the post-raid system which doesnt have any bot ids, only name */ export declare class MatchBotDetailsCacheService { protected logger: ILogger; protected localisationService: LocalisationService; @@ -17,9 +17,9 @@ export declare class MatchBotDetailsCacheService { */ clearCache(): void; /** - * Find a bot in the cache by its name + * Find a bot in the cache by its name and side * @param botName Name of bot to find * @returns Bot details */ - getBotByName(botName: string): IBotBase; + getBotByNameAndSide(botName: string, botSide: string): IBotBase; } diff --git a/TypeScript/6ReferenceAnotherClass/types/services/ModCompilerService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/ModCompilerService.d.ts index a4bf3c8..e306177 100644 --- a/TypeScript/6ReferenceAnotherClass/types/services/ModCompilerService.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/services/ModCompilerService.d.ts @@ -1,14 +1,36 @@ import { CompilerOptions } from "typescript"; import type { ILogger } from "../models/spt/utils/ILogger"; -import { HashCacheService } from "./HashCacheService"; import { VFS } from "../utils/VFS"; +import { HashCacheService } from "./HashCacheService"; export declare class ModCompilerService { protected logger: ILogger; protected hashCacheService: HashCacheService; protected vfs: VFS; constructor(logger: ILogger, hashCacheService: HashCacheService, vfs: VFS); + /** + * Convert a mods TS into JS + * @param modName Name of mod + * @param modPath Dir path to mod + * @param modTypeScriptFiles + * @returns + */ compileMod(modName: string, modPath: string, modTypeScriptFiles: string[]): Promise; + /** + * Convert a TS file into JS + * @param fileNames Paths to TS files + * @param options Compiler options + */ protected compile(fileNames: string[], options: CompilerOptions): Promise; + /** + * Do the files at the provided paths exist + * @param fileNames + * @returns + */ protected areFilesReady(fileNames: string[]): boolean; + /** + * Wait the provided number of milliseconds + * @param ms Milliseconds + * @returns + */ protected delay(ms: number): Promise; } diff --git a/TypeScript/6ReferenceAnotherClass/types/services/PaymentService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/PaymentService.d.ts index 1c9c32b..fb5f92c 100644 --- a/TypeScript/6ReferenceAnotherClass/types/services/PaymentService.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/services/PaymentService.d.ts @@ -61,23 +61,26 @@ export declare class PaymentService { * Get all money stacks in inventory and prioritse items in stash * @param pmcData * @param currencyTpl + * @param playerStashId Players stash id * @returns Sorting money items */ - protected getSortedMoneyItemsInInventory(pmcData: IPmcData, currencyTpl: string): Item[]; + protected getSortedMoneyItemsInInventory(pmcData: IPmcData, currencyTpl: string, playerStashId: string): Item[]; /** * Prioritise player stash first over player inventory * Post-raid healing would often take money out of the players pockets/secure container * @param a First money stack item * @param b Second money stack item * @param inventoryItems players inventory items + * @param playerStashId Players stash id * @returns sort order */ - protected prioritiseStashSort(a: Item, b: Item, inventoryItems: Item[]): number; + protected prioritiseStashSort(a: Item, b: Item, inventoryItems: Item[], playerStashId: string): number; /** * Recursivly check items parents to see if it is inside the players inventory, not stash * @param itemId item id to check * @param inventoryItems player inventory + * @param playerStashId Players stash id * @returns true if its in inventory */ - protected isInInventory(itemId: string, inventoryItems: Item[]): boolean; + protected isInStash(itemId: string, inventoryItems: Item[], playerStashId: string): boolean; } diff --git a/TypeScript/6ReferenceAnotherClass/types/services/ProfileFixerService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/ProfileFixerService.d.ts index c8232fc..bc1e42e 100644 --- a/TypeScript/6ReferenceAnotherClass/types/services/ProfileFixerService.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/services/ProfileFixerService.d.ts @@ -14,6 +14,7 @@ import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; import { Watermark } from "../utils/Watermark"; import { LocalisationService } from "./LocalisationService"; @@ -27,17 +28,19 @@ export declare class ProfileFixerService { protected itemHelper: ItemHelper; protected localisationService: LocalisationService; protected timeUtil: TimeUtil; + protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, profileHelper: ProfileHelper, itemHelper: ItemHelper, localisationService: LocalisationService, timeUtil: TimeUtil, databaseServer: DatabaseServer, configServer: ConfigServer); + constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, profileHelper: ProfileHelper, itemHelper: ItemHelper, localisationService: LocalisationService, timeUtil: TimeUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, configServer: ConfigServer); /** * 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; protected addMissingGunStandContainerImprovements(pmcProfile: IPmcData): void; + protected ensureGunStandLevelsMatch(pmcProfile: IPmcData): void; protected addHideoutAreaStashes(pmcProfile: IPmcData): void; protected addMissingHideoutWallAreas(pmcProfile: IPmcData): void; protected adjustUnreasonableModFleaPrices(): void; @@ -131,4 +134,9 @@ export declare class ProfileFixerService { * @param pmcProfile Profile to add missing IDs to */ addMissingIdsToBonuses(pmcProfile: IPmcData): void; + /** + * At some point the property name was changed,migrate data across to new name + * @param pmcProfile + */ + protected migrateImprovements(pmcProfile: IPmcData): void; } diff --git a/TypeScript/6ReferenceAnotherClass/types/services/RagfairPriceService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/RagfairPriceService.d.ts index e245efa..ff35327 100644 --- a/TypeScript/6ReferenceAnotherClass/types/services/RagfairPriceService.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/services/RagfairPriceService.d.ts @@ -3,6 +3,7 @@ import { HandbookHelper } from "../helpers/HandbookHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { TraderHelper } from "../helpers/TraderHelper"; +import { MinMax } from "../models/common/MinMax"; import { IPreset } from "../models/eft/common/IGlobals"; import { Item } from "../models/eft/common/tables/IItem"; import { IBarterScheme } from "../models/eft/common/tables/ITrader"; @@ -35,10 +36,6 @@ export declare class RagfairPriceService implements OnLoad { * Generate static (handbook) and dynamic (prices.json) flea prices, store inside class as dictionaries */ onLoad(): Promise; - /** - * Add placeholder values for items missing from handbook - */ - protected addMissingHandbookPrices(): void; getRoute(): string; /** * Iterate over all items of type "Item" in db and get template price, store in cache @@ -91,9 +88,17 @@ export declare class RagfairPriceService implements OnLoad { * Generate a currency cost for an item and its mods * @param items Item with mods to get price for * @param desiredCurrency Currency price desired in + * @param isPackOffer Price is for a pack type offer * @returns cost of item in desired currency */ - getDynamicOfferPrice(items: Item[], desiredCurrency: string): number; + getDynamicOfferPriceForOffer(items: Item[], desiredCurrency: string, isPackOffer: boolean): number; + /** + * Get different min/max price multipliers for different offer types (preset/pack/default) + * @param isPreset Offer is a preset + * @param isPack Offer is a pack + * @returns MinMax values + */ + protected getOfferTypeRangeValues(isPreset: boolean, isPack: boolean): MinMax; /** * Check to see if an items price is below its handbook price and adjust accoring to values set to config/ragfair.json * @param itemPrice price of item @@ -104,10 +109,10 @@ export declare class RagfairPriceService implements OnLoad { /** * Multiply the price by a randomised curve where n = 2, shift = 2 * @param existingPrice price to alter - * @param isPreset is the item we're multiplying a preset + * @param rangeValues min and max to adjust price by * @returns multiplied price */ - protected randomisePrice(existingPrice: number, isPreset: boolean): number; + protected randomiseOfferPrice(existingPrice: number, rangeValues: MinMax): number; /** * Calculate the cost of a weapon preset by adding together the price of its mods + base price of default weapon preset * @param item base weapon diff --git a/TypeScript/7OnLoadHook/types/callbacks/GameCallbacks.d.ts b/TypeScript/7OnLoadHook/types/callbacks/GameCallbacks.d.ts index aa80036..46f79f9 100644 --- a/TypeScript/7OnLoadHook/types/callbacks/GameCallbacks.d.ts +++ b/TypeScript/7OnLoadHook/types/callbacks/GameCallbacks.d.ts @@ -1,4 +1,5 @@ import { GameController } from "../controllers/GameController"; +import { OnLoad } from "../di/OnLoad"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { ICheckVersionResponse } from "../models/eft/game/ICheckVersionResponse"; import { ICurrentGroupResponse } from "../models/eft/game/ICurrentGroupResponse"; @@ -15,12 +16,14 @@ import { INullResponseData } from "../models/eft/httpResponse/INullResponseData" import { SaveServer } from "../servers/SaveServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { Watermark } from "../utils/Watermark"; -declare class GameCallbacks { +declare class GameCallbacks implements OnLoad { protected httpResponse: HttpResponseUtil; protected watermark: Watermark; protected saveServer: SaveServer; protected gameController: GameController; constructor(httpResponse: HttpResponseUtil, watermark: Watermark, saveServer: SaveServer, gameController: GameController); + onLoad(): Promise; + getRoute(): string; /** * Handle client/game/version/validate * @returns INullResponseData diff --git a/TypeScript/7OnLoadHook/types/controllers/GameController.d.ts b/TypeScript/7OnLoadHook/types/controllers/GameController.d.ts index 04e3abb..e88610e 100644 --- a/TypeScript/7OnLoadHook/types/controllers/GameController.d.ts +++ b/TypeScript/7OnLoadHook/types/controllers/GameController.d.ts @@ -61,13 +61,14 @@ export declare class GameController { protected pmcConfig: IPmcConfig; protected lootConfig: ILootConfig; constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, randomUtil: RandomUtil, encodingUtil: EncodingUtil, hideoutHelper: HideoutHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, seasonalEventService: SeasonalEventService, itemBaseClassService: ItemBaseClassService, giftService: GiftService, applicationContext: ApplicationContext, configServer: ConfigServer); + load(): void; /** * Handle client/game/start */ gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; protected addCustomLooseLootPositions(): void; protected adjustLooseLootSpawnProbabilities(): void; - protected setHideoutAreasAndCraftsTo30Secs(): void; + protected setHideoutAreasAndCraftsTo40Secs(): void; /** * 3.7.0 moved AIDs to be numeric, old profiles need to be migrated * We store the old AID value in new field `sessionId` diff --git a/TypeScript/7OnLoadHook/types/controllers/HealthController.d.ts b/TypeScript/7OnLoadHook/types/controllers/HealthController.d.ts index 1938297..2d7ff09 100644 --- a/TypeScript/7OnLoadHook/types/controllers/HealthController.d.ts +++ b/TypeScript/7OnLoadHook/types/controllers/HealthController.d.ts @@ -29,34 +29,35 @@ export declare class HealthController { * stores in-raid player health * @param pmcData Player profile * @param info Request data - * @param sessionID + * @param sessionID Player id * @param addEffects Should effects found be added or removed from profile + * @param deleteExistingEffects Should all prior effects be removed before apply new ones */ saveVitality(pmcData: IPmcData, info: ISyncHealthRequestData, sessionID: string, addEffects?: boolean, deleteExistingEffects?: boolean): void; /** * When healing in menu - * @param pmcData - * @param body - * @param sessionID - * @returns + * @param pmcData Player profile + * @param request Healing request + * @param sessionID Player id + * @returns IItemEventRouterResponse */ - offraidHeal(pmcData: IPmcData, body: IOffraidHealRequestData, sessionID: string): IItemEventRouterResponse; + offraidHeal(pmcData: IPmcData, request: IOffraidHealRequestData, sessionID: string): IItemEventRouterResponse; /** * Handle Eat event * Consume food/water outside of a raid * @param pmcData Player profile - * @param body request Object + * @param request Eat request * @param sessionID Session id * @returns IItemEventRouterResponse */ - offraidEat(pmcData: IPmcData, body: IOffraidEatRequestData, sessionID: string): IItemEventRouterResponse; + offraidEat(pmcData: IPmcData, request: IOffraidEatRequestData, sessionID: string): IItemEventRouterResponse; /** * Handle RestoreHealth event * Occurs on post-raid healing page * @param pmcData player profile * @param healthTreatmentRequest Request data from client * @param sessionID Session id - * @returns + * @returns IItemEventRouterResponse */ healthTreatment(pmcData: IPmcData, healthTreatmentRequest: IHealthTreatmentRequestData, sessionID: string): IItemEventRouterResponse; /** @@ -66,12 +67,4 @@ export declare class HealthController { * @param sessionID */ applyWorkoutChanges(pmcData: IPmcData, info: IWorkoutData, sessionId: string): void; - /** - * Iterate over treatment request diff and find effects to remove from player limbs - * @param sessionId - * @param profile Profile to update - * @param treatmentRequest client request - * @param output response to send to client - */ - protected removeEffectsAfterPostRaidHeal(sessionId: string, profile: IPmcData, treatmentRequest: IHealthTreatmentRequestData, output: IItemEventRouterResponse): void; } diff --git a/TypeScript/7OnLoadHook/types/controllers/HideoutController.d.ts b/TypeScript/7OnLoadHook/types/controllers/HideoutController.d.ts index 877c076..a90a16d 100644 --- a/TypeScript/7OnLoadHook/types/controllers/HideoutController.d.ts +++ b/TypeScript/7OnLoadHook/types/controllers/HideoutController.d.ts @@ -88,11 +88,11 @@ export declare class HideoutController { * @param pmcData Profile to edit * @param output Object to send back to client * @param sessionID Session/player id - * @param profileHideoutArea Current hideout data for profile + * @param profileParentHideoutArea Current hideout area for profile * @param dbHideoutArea Hideout area being upgraded * @param hideoutStage Stage hideout area is being upgraded to */ - protected addContainerImprovementToProfile(output: IItemEventRouterResponse, sessionID: string, pmcData: IPmcData, profileHideoutArea: HideoutArea, dbHideoutArea: IHideoutArea, hideoutStage: Stage): void; + protected addContainerImprovementToProfile(output: IItemEventRouterResponse, sessionID: string, pmcData: IPmcData, profileParentHideoutArea: HideoutArea, dbHideoutArea: IHideoutArea, hideoutStage: Stage): void; /** * Add an inventory item to profile from a hideout area stage data * @param pmcData Profile to update diff --git a/TypeScript/7OnLoadHook/types/controllers/LocationController.d.ts b/TypeScript/7OnLoadHook/types/controllers/LocationController.d.ts index 94d496a..94f5fce 100644 --- a/TypeScript/7OnLoadHook/types/controllers/LocationController.d.ts +++ b/TypeScript/7OnLoadHook/types/controllers/LocationController.d.ts @@ -4,6 +4,7 @@ import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { ILocationBase } from "../models/eft/common/ILocationBase"; import { ILocationsGenerateAllResponse } from "../models/eft/common/ILocationsSourceDestinationBase"; import { IAirdropLootResult } from "../models/eft/location/IAirdropLootResult"; +import { IGetLocationRequestData } from "../models/eft/location/IGetLocationRequestData"; import { AirdropTypeEnum } from "../models/enums/AirdropType"; import { IAirdropConfig } from "../models/spt/config/IAirdropConfig"; import { ILocationConfig } from "../models/spt/config/ILocationConfig"; @@ -34,10 +35,11 @@ export declare class LocationController { /** * Handle client/location/getLocalloot * Get a location (map) with generated loot data - * @param location Map to generate loot for + * @param sessionId Player id + * @param request Map request to generate * @returns ILocationBase */ - get(location: string): ILocationBase; + get(sessionId: string, request: IGetLocationRequestData): ILocationBase; /** * Generate a maps base location with loot * @param name Map name diff --git a/TypeScript/7OnLoadHook/types/controllers/QuestController.d.ts b/TypeScript/7OnLoadHook/types/controllers/QuestController.d.ts index 7d494a6..bd8a70f 100644 --- a/TypeScript/7OnLoadHook/types/controllers/QuestController.d.ts +++ b/TypeScript/7OnLoadHook/types/controllers/QuestController.d.ts @@ -61,7 +61,7 @@ export declare class QuestController { * @param playerLevel level of player to test against quest * @returns true if quest can be seen/accepted by player of defined level */ - protected playerLevelFulfillsQuestRequrement(quest: IQuest, playerLevel: number): boolean; + protected playerLevelFulfillsQuestRequirement(quest: IQuest, playerLevel: number): boolean; /** * Should a quest be shown to the player in trader quest screen * @param questId Quest to check diff --git a/TypeScript/7OnLoadHook/types/controllers/RagfairController.d.ts b/TypeScript/7OnLoadHook/types/controllers/RagfairController.d.ts index 76c27f7..bda37cd 100644 --- a/TypeScript/7OnLoadHook/types/controllers/RagfairController.d.ts +++ b/TypeScript/7OnLoadHook/types/controllers/RagfairController.d.ts @@ -21,6 +21,7 @@ import { IGetMarketPriceRequestData } from "../models/eft/ragfair/IGetMarketPric import { IGetOffersResult } from "../models/eft/ragfair/IGetOffersResult"; import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; import { ISearchRequestData } from "../models/eft/ragfair/ISearchRequestData"; +import { IProcessBuyTradeRequestData } from "../models/eft/trade/IProcessBuyTradeRequestData"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; @@ -125,6 +126,18 @@ export declare class RagfairController { * @returns IItemEventRouterResponse */ addPlayerOffer(pmcData: IPmcData, offerRequest: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Charge player a listing fee for using flea, pulls charge from data previously sent by client + * @param sessionID Player id + * @param rootItem Base item being listed (used when client tax cost not found and must be done on server) + * @param pmcData Player profile + * @param requirementsPriceInRub Rouble cost player chose for listing (used when client tax cost not found and must be done on server) + * @param itemStackCount How many items were listed in player (used when client tax cost not found and must be done on server) + * @param offerRequest Add offer request object from client + * @param output IItemEventRouterResponse + * @returns True if charging tax to player failed + */ + protected chargePlayerTaxFee(sessionID: string, rootItem: Item, pmcData: IPmcData, requirementsPriceInRub: number, itemStackCount: number, offerRequest: IAddOfferRequestData, output: IItemEventRouterResponse): boolean; /** * Is the item to be listed on the flea valid * @param offerRequest Client offer request @@ -158,4 +171,11 @@ export declare class RagfairController { */ removeOffer(offerId: string, sessionID: string): IItemEventRouterResponse; extendOffer(info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Create a basic trader request object with price and currency type + * @param currency What currency: RUB, EURO, USD + * @param value Amount of currency + * @returns IProcessBuyTradeRequestData + */ + protected createBuyTradeRequestObject(currency: string, value: number): IProcessBuyTradeRequestData; } diff --git a/TypeScript/7OnLoadHook/types/generators/BotEquipmentModGenerator.d.ts b/TypeScript/7OnLoadHook/types/generators/BotEquipmentModGenerator.d.ts index ccbbbbf..f7abb84 100644 --- a/TypeScript/7OnLoadHook/types/generators/BotEquipmentModGenerator.d.ts +++ b/TypeScript/7OnLoadHook/types/generators/BotEquipmentModGenerator.d.ts @@ -14,7 +14,6 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; import { BotEquipmentModPoolService } from "../services/BotEquipmentModPoolService"; import { BotModLimits, BotWeaponModLimitService } from "../services/BotWeaponModLimitService"; -import { ItemBaseClassService } from "../services/ItemBaseClassService"; import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; @@ -29,7 +28,6 @@ export declare class BotEquipmentModGenerator { protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; protected botEquipmentFilterService: BotEquipmentFilterService; - protected itemBaseClassService: ItemBaseClassService; protected itemFilterService: ItemFilterService; protected profileHelper: ProfileHelper; protected botWeaponModLimitService: BotWeaponModLimitService; @@ -40,7 +38,7 @@ export declare class BotEquipmentModGenerator { protected botEquipmentModPoolService: BotEquipmentModPoolService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, itemHelper: ItemHelper, botEquipmentFilterService: BotEquipmentFilterService, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponModLimitService: BotWeaponModLimitService, botHelper: BotHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, botEquipmentModPoolService: BotEquipmentModPoolService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, itemHelper: ItemHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponModLimitService: BotWeaponModLimitService, botHelper: BotHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, botEquipmentModPoolService: BotEquipmentModPoolService, configServer: ConfigServer); /** * Check mods are compatible and add to array * @param equipment Equipment item to add mods to diff --git a/TypeScript/7OnLoadHook/types/generators/LocationGenerator.d.ts b/TypeScript/7OnLoadHook/types/generators/LocationGenerator.d.ts index b8169d3..46a514b 100644 --- a/TypeScript/7OnLoadHook/types/generators/LocationGenerator.d.ts +++ b/TypeScript/7OnLoadHook/types/generators/LocationGenerator.d.ts @@ -65,10 +65,11 @@ export declare class LocationGenerator { protected getGuaranteedContainers(staticContainersOnMap: IStaticContainerData[]): IStaticContainerData[]; /** * Choose a number of containers based on their probabilty value to fulfil the desired count in containerData.chosenCount + * @param groupId Name of the group the containers are being collected for * @param containerData Containers and probability values for a groupId * @returns List of chosen container Ids */ - protected getContainersByProbabilty(containerData: IContainerGroupCount): string[]; + protected getContainersByProbabilty(groupId: string, containerData: IContainerGroupCount): string[]; /** * Get a mapping of each groupid and the containers in that group + count of containers to spawn on map * @param containersGroups Container group values diff --git a/TypeScript/7OnLoadHook/types/generators/PMCLootGenerator.d.ts b/TypeScript/7OnLoadHook/types/generators/PMCLootGenerator.d.ts index 9acff69..abb5615 100644 --- a/TypeScript/7OnLoadHook/types/generators/PMCLootGenerator.d.ts +++ b/TypeScript/7OnLoadHook/types/generators/PMCLootGenerator.d.ts @@ -31,12 +31,12 @@ export declare class PMCLootGenerator { */ generatePMCVestLootPool(): string[]; /** - * Check if item has a width/height that lets it fit into a 1x2/2x1 slot - * 1x1 / 1x2 / 2x1 + * Check if item has a width/height that lets it fit into a 2x2 slot + * 1x1 / 1x2 / 2x1 / 2x2 * @param item Item to check size of * @returns true if it fits */ - protected itemFitsInto1By2Slot(item: ITemplateItem): boolean; + protected itemFitsInto2By2Slot(item: ITemplateItem): boolean; /** * Create an array of loot items a PMC can have in their backpack * @returns string array of tpls diff --git a/TypeScript/7OnLoadHook/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/7OnLoadHook/types/generators/RagfairOfferGenerator.d.ts index a627191..58e0b68 100644 --- a/TypeScript/7OnLoadHook/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/7OnLoadHook/types/generators/RagfairOfferGenerator.d.ts @@ -55,11 +55,10 @@ export declare class RagfairOfferGenerator { * @param items Items in the offer * @param barterScheme Cost of item (currency or barter) * @param loyalLevel Loyalty level needed to buy item - * @param price Price of offer - * @param sellInOnePiece Set StackObjectsCount to 1 + * @param sellInOnePiece Flags sellInOnePiece to be true * @returns IRagfairOffer */ - createFleaOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; + createFleaOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, sellInOnePiece?: boolean): IRagfairOffer; /** * Create an offer object ready to send to ragfairOfferService.addOffer() * @param userID Owner of the offer @@ -67,17 +66,16 @@ export declare class RagfairOfferGenerator { * @param items Items in the offer * @param barterScheme Cost of item (currency or barter) * @param loyalLevel Loyalty level needed to buy item - * @param price Price of offer * @param sellInOnePiece Set StackObjectsCount to 1 * @returns IRagfairOffer */ - protected createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; + protected createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, sellInOnePiece?: boolean): IRagfairOffer; /** * Calculate the offer price that's listed on the flea listing * @param offerRequirements barter requirements for offer * @returns rouble cost of offer */ - protected calculateOfferListingPrice(offerRequirements: OfferRequirement[]): number; + protected convertOfferRequirementsIntoRoubles(offerRequirements: OfferRequirement[]): number; /** * Get avatar url from trader table in db * @param isTrader Is user we're getting avatar for a trader @@ -137,7 +135,7 @@ export declare class RagfairOfferGenerator { * @param itemDetails raw db item details * @returns Item array */ - protected createSingleOfferForItem(items: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; + protected createSingleOfferForItem(items: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; /** * Generate trader offers on flea using the traders assort data * @param traderID Trader to generate offers for @@ -151,7 +149,7 @@ export declare class RagfairOfferGenerator { * @param itemDetails db details of first item * @returns */ - protected getItemCondition(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): Item[]; + protected randomiseItemUpdProperties(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): Item[]; /** * Get the relevant condition id if item tpl matches in ragfair.json/condition * @param tpl Item to look for matching condition object @@ -184,7 +182,7 @@ export declare class RagfairOfferGenerator { * @param offerItems Items for sale in offer * @returns Barter scheme */ - protected createBarterRequirement(offerItems: Item[]): IBarterScheme[]; + protected createBarterBarterScheme(offerItems: Item[]): IBarterScheme[]; /** * Get an array of flea prices + item tpl, cached in generator class inside `allowedFleaPriceItemsForBarter` * @returns array with tpl/price values @@ -196,7 +194,9 @@ export declare class RagfairOfferGenerator { /** * Create a random currency-based barter scheme for an array of items * @param offerItems Items on offer + * @param isPackOffer Is the barter scheme being created for a pack offer + * @param multipler What to multiply the resulting price by * @returns Barter scheme for offer */ - protected createCurrencyRequirement(offerItems: Item[]): IBarterScheme[]; + protected createCurrencyBarterScheme(offerItems: Item[], isPackOffer: boolean, multipler?: number): IBarterScheme[]; } diff --git a/TypeScript/7OnLoadHook/types/generators/ScavCaseRewardGenerator.d.ts b/TypeScript/7OnLoadHook/types/generators/ScavCaseRewardGenerator.d.ts index 4ba1888..b5935d0 100644 --- a/TypeScript/7OnLoadHook/types/generators/ScavCaseRewardGenerator.d.ts +++ b/TypeScript/7OnLoadHook/types/generators/ScavCaseRewardGenerator.d.ts @@ -25,6 +25,8 @@ export declare class ScavCaseRewardGenerator { protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected scavCaseConfig: IScavCaseConfig; + protected dbItemsCache: ITemplateItem[]; + protected dbAmmoItemsCache: ITemplateItem[]; constructor(logger: ILogger, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * Create an array of rewards that will be given to the player upon completing their scav case build @@ -33,10 +35,10 @@ export declare class ScavCaseRewardGenerator { */ generate(recipeId: string): Product[]; /** - * Get all db items that are not blacklisted in scavcase config - * @returns filtered array of db items + * Get all db items that are not blacklisted in scavcase config or global blacklist + * Store in class field */ - protected getDbItems(): ITemplateItem[]; + protected cacheDbItems(): void; /** * Pick a number of items to be rewards, the count is defined by the values in * @param items item pool to pick rewards from diff --git a/TypeScript/7OnLoadHook/types/generators/WeatherGenerator.d.ts b/TypeScript/7OnLoadHook/types/generators/WeatherGenerator.d.ts index 2e2403c..6471bb1 100644 --- a/TypeScript/7OnLoadHook/types/generators/WeatherGenerator.d.ts +++ b/TypeScript/7OnLoadHook/types/generators/WeatherGenerator.d.ts @@ -52,6 +52,7 @@ export declare class WeatherGenerator { */ protected setCurrentDateTime(weather: IWeather): void; protected getWeightedWindDirection(): WindDirection; + protected getWeightedClouds(): number; protected getWeightedWindSpeed(): number; protected getWeightedFog(): number; protected getWeightedRain(): number; diff --git a/TypeScript/7OnLoadHook/types/helpers/HealthHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/HealthHelper.d.ts index 3694a6e..e4cdcd6 100644 --- a/TypeScript/7OnLoadHook/types/helpers/HealthHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/HealthHelper.d.ts @@ -27,6 +27,7 @@ export declare class HealthHelper { * @param request Heal request * @param sessionID Session id * @param addEffects Should effects be added or removed (default - add) + * @param deleteExistingEffects Should all prior effects be removed before apply new ones */ saveVitality(pmcData: IPmcData, request: ISyncHealthRequestData, sessionID: string, addEffects?: boolean, deleteExistingEffects?: boolean): void; /** diff --git a/TypeScript/7OnLoadHook/types/helpers/InRaidHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/InRaidHelper.d.ts index bf584c2..b4c0c1c 100644 --- a/TypeScript/7OnLoadHook/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/InRaidHelper.d.ts @@ -53,7 +53,7 @@ export declare class InRaidHelper { * @param victim Who was killed by player * @returns a numerical standing gain or loss */ - protected getStandingChangeForKill(victim: Victim): number; + protected getFenceStandingChangeForKillAsScav(victim: Victim): number; /** * Reset a profile to a baseline, used post-raid * Reset points earned during session property diff --git a/TypeScript/7OnLoadHook/types/helpers/ItemHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/ItemHelper.d.ts index 99fca56..00f190f 100644 --- a/TypeScript/7OnLoadHook/types/helpers/ItemHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/ItemHelper.d.ts @@ -26,6 +26,7 @@ declare class ItemHelper { protected itemBaseClassService: ItemBaseClassService; protected localisationService: LocalisationService; protected localeService: LocaleService; + protected readonly defaultInvalidBaseTypes: string[]; constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, localisationService: LocalisationService, localeService: LocaleService); /** * Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash @@ -67,6 +68,11 @@ declare class ItemHelper { * @returns Price in roubles (undefined if not found) */ getDynamicItemPrice(tpl: string): number; + /** + * Update items upd.StackObjectsCount to be 1 if its upd is missing or StackObjectsCount is undefined + * @param item Item to update + * @returns Fixed item + */ fixItemStackCount(item: Item): Item; /** * AmmoBoxes contain StackSlots which need to be filled for the AmmoBox to have content. @@ -125,19 +131,19 @@ declare class ItemHelper { getItemQualityModifier(item: Item): number; /** * Get a quality value based on a repairable items (weapon/armor) current state between current and max durability - * @param itemDetails - * @param repairable repairable object - * @param item - * @returns a number between 0 and 1 + * @param itemDetails Db details for item we want quality value for + * @param repairable Repairable properties + * @param item Item quality value is for + * @returns A number between 0 and 1 */ protected getRepairableItemQualityValue(itemDetails: ITemplateItem, repairable: Repairable, item: Item): number; /** * Recursive function that looks at every item from parameter and gets their childrens Ids + includes parent item in results - * @param items - * @param itemID + * @param items Array of items (item + possible children) + * @param itemId Parent items id * @returns an array of strings */ - findAndReturnChildrenByItems(items: Item[], itemID: string): string[]; + findAndReturnChildrenByItems(items: Item[], itemId: string): string[]; /** * A variant of findAndReturnChildren where the output is list of item objects instead of their ids. * @param items @@ -164,12 +170,6 @@ declare class ItemHelper { * @returns true if it is a dogtag */ isDogtag(tpl: string): boolean; - /** - * Can the item passed in be sold to a trader because it is raw money - * @param tpl Item template id to check - * @returns true if unsellable - */ - isNotSellable(tpl: string): boolean; /** * Gets the identifier for a child using slotId, locationX and locationY. * @param item @@ -183,19 +183,19 @@ declare class ItemHelper { */ isItemTplStackable(tpl: string): boolean; /** - * split item stack if it exceeds its StackMaxSize property - * @param itemToSplit item being split into smaller stacks + * split item stack if it exceeds its items StackMaxSize property + * @param itemToSplit Item to split into smaller stacks * @returns Array of split items */ splitStack(itemToSplit: Item): Item[]; /** - * Find Barter items in the inventory + * Find Barter items from array of items * @param {string} by tpl or id - * @param {Object} pmcData + * @param {Item[]} items Array of items to iterate over * @param {string} barterItemId * @returns Array of Item objects */ - findBarterItems(by: "tpl" | "id", pmcData: IPmcData, barterItemId: string): Item[]; + findBarterItems(by: "tpl" | "id", items: Item[], barterItemId: string): Item[]; /** * Regenerate all guids with new ids, exceptions are for items that cannot be altered (e.g. stash/sorting table) * @param pmcData Player profile @@ -262,10 +262,21 @@ declare class ItemHelper { * @param minSizePercent % the magazine must be filled to */ fillMagazineWithCartridge(magazine: Item[], magTemplate: ITemplateItem, cartridgeTpl: string, minSizePercent?: number): void; + /** + * Choose a random bullet type from the list of possible a magazine has + * @param magTemplate Magazine template from Db + * @returns Tpl of cartridge + */ protected getRandomValidCaliber(magTemplate: ITemplateItem): string; + /** + * Chose a randomly weighted cartridge that fits + * @param caliber Desired caliber + * @param staticAmmoDist Cartridges and thier weights + * @returns Tpl of cartrdige + */ protected drawAmmoTpl(caliber: string, staticAmmoDist: Record): string; /** - * + * Create a basic cartrige object * @param parentId container cartridges will be placed in * @param ammoTpl Cartridge to insert * @param stackCount Count of cartridges inside parent diff --git a/TypeScript/7OnLoadHook/types/helpers/QuestHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/QuestHelper.d.ts index e04b6e0..5c749d3 100644 --- a/TypeScript/7OnLoadHook/types/helpers/QuestHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/QuestHelper.d.ts @@ -21,6 +21,7 @@ import { DialogueHelper } from "./DialogueHelper"; import { ItemHelper } from "./ItemHelper"; import { PaymentHelper } from "./PaymentHelper"; import { ProfileHelper } from "./ProfileHelper"; +import { QuestConditionHelper } from "./QuestConditionHelper"; import { RagfairServerHelper } from "./RagfairServerHelper"; import { TraderHelper } from "./TraderHelper"; export declare class QuestHelper { @@ -29,6 +30,7 @@ export declare class QuestHelper { protected timeUtil: TimeUtil; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; + protected questConditionHelper: QuestConditionHelper; protected eventOutputHolder: EventOutputHolder; protected databaseServer: DatabaseServer; protected localeService: LocaleService; @@ -41,7 +43,7 @@ export declare class QuestHelper { protected mailSendService: MailSendService; protected configServer: ConfigServer; 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, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, questConditionHelper: QuestConditionHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, mailSendService: MailSendService, configServer: ConfigServer); /** * Get status of a quest in player profile by its id * @param pmcData Profile to search @@ -119,7 +121,7 @@ export declare class QuestHelper { * @param sessionID Session id * @returns Quests accessible to player incuding newly unlocked quests now quest (startedQuestId) was started */ - acceptedUnlocked(startedQuestId: string, sessionID: string): IQuest[]; + getNewlyAccessibleQuestsWhenStartingQuest(startedQuestId: string, sessionID: string): IQuest[]; /** * Get quests that can be shown to player after failing a quest * @param failedQuestId Id of the quest failed by player diff --git a/TypeScript/7OnLoadHook/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/RagfairOfferHelper.d.ts index de9d550..0699259 100644 --- a/TypeScript/7OnLoadHook/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/RagfairOfferHelper.d.ts @@ -1,4 +1,5 @@ import { IPmcData } from "../models/eft/common/IPmcData"; +import { Item } from "../models/eft/common/tables/IItem"; import { ITraderAssort } from "../models/eft/common/tables/ITrader"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; @@ -13,10 +14,10 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { LocaleService } from "../services/LocaleService"; import { LocalisationService } from "../services/LocalisationService"; +import { MailSendService } from "../services/MailSendService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { HashUtil } from "../utils/HashUtil"; import { TimeUtil } from "../utils/TimeUtil"; -import { DialogueHelper } from "./DialogueHelper"; import { ItemHelper } from "./ItemHelper"; import { PaymentHelper } from "./PaymentHelper"; import { PresetHelper } from "./PresetHelper"; @@ -33,7 +34,6 @@ export declare class RagfairOfferHelper { protected databaseServer: DatabaseServer; protected traderHelper: TraderHelper; protected saveServer: SaveServer; - protected dialogueHelper: DialogueHelper; protected itemHelper: ItemHelper; protected paymentHelper: PaymentHelper; protected presetHelper: PresetHelper; @@ -44,11 +44,12 @@ export declare class RagfairOfferHelper { protected ragfairOfferService: RagfairOfferService; protected localeService: LocaleService; protected localisationService: LocalisationService; + protected mailSendService: MailSendService; protected configServer: ConfigServer; protected static goodSoldTemplate: string; protected ragfairConfig: IRagfairConfig; 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, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, localisationService: LocalisationService, mailSendService: MailSendService, configServer: ConfigServer); /** * Passthrough to ragfairOfferService.getOffers(), get flea offers a player should see * @param searchRequest Data from client @@ -119,19 +120,26 @@ export declare class RagfairOfferHelper { */ protected getProfileOffers(sessionID: string): IRagfairOffer[]; /** - * Delete an offer from a desired profile + * Delete an offer from a desired profile and from ragfair offers * @param sessionID Session id of profile to delete offer from - * @param offerId Offer id to delete + * @param offerId Id of offer to delete */ - protected deleteOfferByOfferId(sessionID: string, offerId: string): void; + protected deleteOfferById(sessionID: string, offerId: string): void; /** * Complete the selling of players' offer * @param sessionID Session id * @param offer Sold offer details * @param boughtAmount Amount item was purchased for - * @returns Client response + * @returns IItemEventRouterResponse */ protected completeOffer(sessionID: string, offer: IRagfairOffer, boughtAmount: number): IItemEventRouterResponse; + /** + * Get a localised message for when players offer has sold on flea + * @param itemTpl Item sold + * @param boughtAmount How many were purchased + * @returns Localised message text + */ + protected getLocalisedOfferSoldMessage(itemTpl: string, boughtAmount: number): string; /** * Should a ragfair offer be visible to the player * @param searchRequest Search request @@ -142,4 +150,12 @@ export declare class RagfairOfferHelper { * @returns True = should be shown to player */ isDisplayableOffer(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, offer: IRagfairOffer, pmcProfile: IPmcData): boolean; + /** + * Is items quality value within desired range + * @param item Item to check quality of + * @param min Desired minimum quality + * @param max Desired maximum quality + * @returns True if in range + */ + protected itemQualityInRange(item: Item, min: number, max: number): boolean; } diff --git a/TypeScript/7OnLoadHook/types/helpers/RagfairSellHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/RagfairSellHelper.d.ts index 251d7ca..913b408 100644 --- a/TypeScript/7OnLoadHook/types/helpers/RagfairSellHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/RagfairSellHelper.d.ts @@ -13,12 +13,12 @@ export declare class RagfairSellHelper { constructor(logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, configServer: ConfigServer); /** * Get the percent chance to sell an item based on its average listed price vs player chosen listing price - * @param baseChancePercent Base chance to sell item * @param averageOfferPriceRub Price of average offer in roubles * @param playerListedPriceRub Price player listed item for in roubles + * @param qualityMultiplier Quality multipler of item being sold * @returns percent value */ - calculateSellChance(baseChancePercent: number, averageOfferPriceRub: number, playerListedPriceRub: number): number; + calculateSellChance(averageOfferPriceRub: number, playerListedPriceRub: number, qualityMultiplier: number): number; /** * Get percent chance to sell an item when price is below items average listing price * @param playerListedPriceRub Price player listed item for in roubles diff --git a/TypeScript/7OnLoadHook/types/helpers/TraderHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/TraderHelper.d.ts index c163f7a..6680ccf 100644 --- a/TypeScript/7OnLoadHook/types/helpers/TraderHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/TraderHelper.d.ts @@ -35,7 +35,7 @@ export declare class TraderHelper { protected highestTraderBuyPriceItems: Record; constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, handbookHelper: HandbookHelper, itemHelper: ItemHelper, playerService: PlayerService, localisationService: LocalisationService, fenceService: FenceService, timeUtil: TimeUtil, randomUtil: RandomUtil, configServer: ConfigServer); getTrader(traderID: string, sessionID: string): ITraderBase; - getTraderAssortsById(traderId: string): ITraderAssort; + getTraderAssortsByTraderId(traderId: string): ITraderAssort; /** * 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 diff --git a/TypeScript/7OnLoadHook/types/models/eft/common/tables/IBotBase.d.ts b/TypeScript/7OnLoadHook/types/models/eft/common/tables/IBotBase.d.ts index ee40958..6c7b76f 100644 --- a/TypeScript/7OnLoadHook/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/7OnLoadHook/types/models/eft/common/tables/IBotBase.d.ts @@ -281,7 +281,7 @@ export interface InsuredItem { export interface Hideout { Production: Record; Areas: HideoutArea[]; - Improvements: Record; + Improvement: Record; Seed: number; sptUpdateLastRunTimestamp: number; } diff --git a/TypeScript/7OnLoadHook/types/models/eft/health/IHealthTreatmentRequestData.d.ts b/TypeScript/7OnLoadHook/types/models/eft/health/IHealthTreatmentRequestData.d.ts index 7fb80a8..598e60c 100644 --- a/TypeScript/7OnLoadHook/types/models/eft/health/IHealthTreatmentRequestData.d.ts +++ b/TypeScript/7OnLoadHook/types/models/eft/health/IHealthTreatmentRequestData.d.ts @@ -1,12 +1,14 @@ export interface IHealthTreatmentRequestData { Action: "RestoreHealth"; trader: string; - items: Item[]; + items: Cost[]; difference: Difference; timestamp: number; } -export interface Item { +export interface Cost { + /** Id of stack to take money from */ id: string; + /** Amount of money to take off player for treatment */ count: number; } export interface Difference { @@ -25,5 +27,6 @@ export interface BodyParts { } export interface BodyPart { Health: number; + /** Effects in array are to be removed */ Effects: string[]; } diff --git a/TypeScript/7OnLoadHook/types/models/eft/notifier/INotifier.d.ts b/TypeScript/7OnLoadHook/types/models/eft/notifier/INotifier.d.ts index ce25dee..c6c6979 100644 --- a/TypeScript/7OnLoadHook/types/models/eft/notifier/INotifier.d.ts +++ b/TypeScript/7OnLoadHook/types/models/eft/notifier/INotifier.d.ts @@ -14,6 +14,11 @@ export interface INotification { } export declare enum NotificationType { RAGFAIR_OFFER_SOLD = "RagfairOfferSold", + RAGFAIR_RATING_CHANGE = "RagfairRatingChange", + /** ChatMessageReceived */ NEW_MESSAGE = "new_message", - PING = "ping" + PING = "ping", + TRADER_SUPPLY = "TraderSupply", + TRADER_STANDING = "TraderStanding", + UNLOCK_TRADER = "UnlockTrader" } diff --git a/TypeScript/7OnLoadHook/types/models/eft/notifier/ISelectProfileResponse.d.ts b/TypeScript/7OnLoadHook/types/models/eft/notifier/ISelectProfileResponse.d.ts index ecb668a..f2d6be7 100644 --- a/TypeScript/7OnLoadHook/types/models/eft/notifier/ISelectProfileResponse.d.ts +++ b/TypeScript/7OnLoadHook/types/models/eft/notifier/ISelectProfileResponse.d.ts @@ -1,6 +1,3 @@ -import { INotifierChannel } from "./INotifier"; export interface ISelectProfileResponse { status: string; - notifier: INotifierChannel; - notifierServer: string; } diff --git a/TypeScript/7OnLoadHook/types/models/enums/WeatherType.d.ts b/TypeScript/7OnLoadHook/types/models/enums/WeatherType.d.ts index d31fefe..503dc30 100644 --- a/TypeScript/7OnLoadHook/types/models/enums/WeatherType.d.ts +++ b/TypeScript/7OnLoadHook/types/models/enums/WeatherType.d.ts @@ -1,19 +1,19 @@ export declare enum WeatherType { - CLEAR_DAY = 1, - CLEAR_WIND = 2, - CLEAR_NIGHT = 3, - PARTLY_CLOUD_DAY = 4, - PARTLY_CLOUD_NIGHT = 5, - CLEAR_FOG_DAY = 6, - CLEAR_FOG_NIGHT = 7, - CLOUDFOG = 8, - FOG = 9, - MOSTLY_CLOUD = 10, - LIGHT_RAIN = 11, - RAIN = 12, - CLOUD_WIND = 13, - CLOUD_WIND_RAIN = 14, - FULL_CLOUD = 15, - THUNDER_CLOUD = 16, - NONE = 0 + CLEAR_DAY = 0, + CLEAR_WIND = 1, + CLEAR_NIGHT = 2, + PARTLY_CLOUD_DAY = 3, + PARTLY_CLOUD_NIGHT = 4, + CLEAR_FOG_DAY = 5, + CLEAR_FOG_NIGHT = 6, + CLOUD_FOG = 7, + FOG = 8, + MOSTLY_CLOUD = 9, + LIGHT_RAIN = 10, + RAIN = 11, + CLOUD_WIND = 12, + CLOUD_WIND_RAIN = 13, + FULL_CLOUD = 14, + THUNDER_CLOUD = 15, + NONE = 16 } diff --git a/TypeScript/7OnLoadHook/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/7OnLoadHook/types/models/spt/config/IRagfairConfig.d.ts index 7c04857..7aea24f 100644 --- a/TypeScript/7OnLoadHook/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/7OnLoadHook/types/models/spt/config/IRagfairConfig.d.ts @@ -41,7 +41,8 @@ export interface Dynamic { /** Use the highest trader price for an offer if its greater than the price in templates/prices.json */ useTraderPriceForOffersIfHigher: boolean; /** Barter offer specific settings */ - barter: Barter; + barter: IBarterDetails; + pack: IPackDetails; /** Dynamic offer price below handbook adjustment values */ offerAdjustment: OfferAdjustment; /** How many offers should expire before an offer regeneration occurs */ @@ -49,9 +50,7 @@ export interface Dynamic { /** How many offers should be listed */ offerItemCount: MinMax; /** How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) */ - price: MinMax; - /** How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) */ - presetPrice: MinMax; + priceRanges: IPriceRanges; /** Should default presets to listed only or should non-standard presets found in globals.json be listed too */ showDefaultPresetsOnly: boolean; endTimeSeconds: MinMax; @@ -74,7 +73,12 @@ export interface Dynamic { /** Dict of price limits keyed by item type */ unreasonableModPrices: Record; } -export interface Barter { +export interface IPriceRanges { + default: MinMax; + preset: MinMax; + pack: MinMax; +} +export interface IBarterDetails { /** Should barter offers be generated */ enable: boolean; /** Percentage change an offer is listed as a barter */ @@ -90,6 +94,18 @@ export interface Barter { /** Item Tpls to never be turned into a barter */ itemTypeBlacklist: string[]; } +export interface IPackDetails { + /** Should pack offers be generated */ + enable: boolean; + /** Percentage change an offer is listed as a pack */ + chancePercent: number; + /** Min number of required items for a pack */ + itemCountMin: number; + /** Max number of required items for a pack */ + itemCountMax: number; + /** item types to allow being a pack */ + itemTypeWhitelist: string[]; +} export interface OfferAdjustment { /** Shuld offer price be adjusted when below handbook price */ adjustPriceWhenBelowHandbookPrice: boolean; diff --git a/TypeScript/7OnLoadHook/types/models/spt/config/IWeatherConfig.d.ts b/TypeScript/7OnLoadHook/types/models/spt/config/IWeatherConfig.d.ts index 41a1c83..6ecf35b 100644 --- a/TypeScript/7OnLoadHook/types/models/spt/config/IWeatherConfig.d.ts +++ b/TypeScript/7OnLoadHook/types/models/spt/config/IWeatherConfig.d.ts @@ -7,7 +7,7 @@ export interface IWeatherConfig extends IBaseConfig { weather: Weather; } export interface Weather { - clouds: MinMax; + clouds: WeatherSettings; windSpeed: WeatherSettings; windDirection: WeatherSettings; windGustiness: MinMax; diff --git a/TypeScript/7OnLoadHook/types/services/HashCacheService.d.ts b/TypeScript/7OnLoadHook/types/services/HashCacheService.d.ts index 5320f28..9968478 100644 --- a/TypeScript/7OnLoadHook/types/services/HashCacheService.d.ts +++ b/TypeScript/7OnLoadHook/types/services/HashCacheService.d.ts @@ -11,7 +11,18 @@ export declare class HashCacheService { protected modHashes: any; protected readonly modCachePath = "./user/cache/modCache.json"; constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); + /** + * Return a stored hash by key + * @param modName Name of mod to get hash for + * @returns Mod hash + */ getStoredModHash(modName: string): string; + /** + * Does the generated hash match the stored hash + * @param modName name of mod + * @param modContent + * @returns True if they match + */ modContentMatchesStoredHash(modName: string, modContent: string): boolean; hashMatchesStoredHash(modName: string, modHash: string): boolean; storeModContent(modName: string, modContent: string): void; diff --git a/TypeScript/7OnLoadHook/types/services/MailSendService.d.ts b/TypeScript/7OnLoadHook/types/services/MailSendService.d.ts index 19397dc..fe4a7fe 100644 --- a/TypeScript/7OnLoadHook/types/services/MailSendService.d.ts +++ b/TypeScript/7OnLoadHook/types/services/MailSendService.d.ts @@ -35,7 +35,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendDirectNpcMessageToPlayer(playerId: string, sender: Traders, messageType: MessageType, message: string, items?: Item[], maxStorageTimeSeconds?: any): void; + sendDirectNpcMessageToPlayer(playerId: string, sender: Traders, messageType: MessageType, message: string, items?: Item[], maxStorageTimeSeconds?: any, systemData?: any, ragfair?: any): void; /** * Send a message from an NPC (e.g. prapor) to the player with or without items * @param playerId Players id to send message to @@ -45,7 +45,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendLocalisedNpcMessageToPlayer(playerId: string, sender: Traders, messageType: MessageType, messageLocaleId: string, items?: Item[], maxStorageTimeSeconds?: any, systemData?: any): void; + sendLocalisedNpcMessageToPlayer(playerId: string, sender: Traders, messageType: MessageType, messageLocaleId: string, items?: Item[], maxStorageTimeSeconds?: any, systemData?: any, ragfair?: any): void; /** * Send a message from SYSTEM to the player with or without items * @param playerId Players id to send message to diff --git a/TypeScript/7OnLoadHook/types/services/MatchBotDetailsCacheService.d.ts b/TypeScript/7OnLoadHook/types/services/MatchBotDetailsCacheService.d.ts index eb365dd..c1bd322 100644 --- a/TypeScript/7OnLoadHook/types/services/MatchBotDetailsCacheService.d.ts +++ b/TypeScript/7OnLoadHook/types/services/MatchBotDetailsCacheService.d.ts @@ -1,7 +1,7 @@ import { IBotBase } from "../models/eft/common/tables/IBotBase"; import { ILogger } from "../models/spt/utils/ILogger"; import { LocalisationService } from "./LocalisationService"; -/** Cache bots in a dictionary, keyed by the bots name, keying by name isnt idea as its not unique but this is used by the post-raid system which doesnt have any bot ids, only name */ +/** Cache bots in a dictionary, keyed by the bots name, keying by name isnt ideal as its not unique but this is used by the post-raid system which doesnt have any bot ids, only name */ export declare class MatchBotDetailsCacheService { protected logger: ILogger; protected localisationService: LocalisationService; @@ -17,9 +17,9 @@ export declare class MatchBotDetailsCacheService { */ clearCache(): void; /** - * Find a bot in the cache by its name + * Find a bot in the cache by its name and side * @param botName Name of bot to find * @returns Bot details */ - getBotByName(botName: string): IBotBase; + getBotByNameAndSide(botName: string, botSide: string): IBotBase; } diff --git a/TypeScript/7OnLoadHook/types/services/ModCompilerService.d.ts b/TypeScript/7OnLoadHook/types/services/ModCompilerService.d.ts index a4bf3c8..e306177 100644 --- a/TypeScript/7OnLoadHook/types/services/ModCompilerService.d.ts +++ b/TypeScript/7OnLoadHook/types/services/ModCompilerService.d.ts @@ -1,14 +1,36 @@ import { CompilerOptions } from "typescript"; import type { ILogger } from "../models/spt/utils/ILogger"; -import { HashCacheService } from "./HashCacheService"; import { VFS } from "../utils/VFS"; +import { HashCacheService } from "./HashCacheService"; export declare class ModCompilerService { protected logger: ILogger; protected hashCacheService: HashCacheService; protected vfs: VFS; constructor(logger: ILogger, hashCacheService: HashCacheService, vfs: VFS); + /** + * Convert a mods TS into JS + * @param modName Name of mod + * @param modPath Dir path to mod + * @param modTypeScriptFiles + * @returns + */ compileMod(modName: string, modPath: string, modTypeScriptFiles: string[]): Promise; + /** + * Convert a TS file into JS + * @param fileNames Paths to TS files + * @param options Compiler options + */ protected compile(fileNames: string[], options: CompilerOptions): Promise; + /** + * Do the files at the provided paths exist + * @param fileNames + * @returns + */ protected areFilesReady(fileNames: string[]): boolean; + /** + * Wait the provided number of milliseconds + * @param ms Milliseconds + * @returns + */ protected delay(ms: number): Promise; } diff --git a/TypeScript/7OnLoadHook/types/services/PaymentService.d.ts b/TypeScript/7OnLoadHook/types/services/PaymentService.d.ts index 1c9c32b..fb5f92c 100644 --- a/TypeScript/7OnLoadHook/types/services/PaymentService.d.ts +++ b/TypeScript/7OnLoadHook/types/services/PaymentService.d.ts @@ -61,23 +61,26 @@ export declare class PaymentService { * Get all money stacks in inventory and prioritse items in stash * @param pmcData * @param currencyTpl + * @param playerStashId Players stash id * @returns Sorting money items */ - protected getSortedMoneyItemsInInventory(pmcData: IPmcData, currencyTpl: string): Item[]; + protected getSortedMoneyItemsInInventory(pmcData: IPmcData, currencyTpl: string, playerStashId: string): Item[]; /** * Prioritise player stash first over player inventory * Post-raid healing would often take money out of the players pockets/secure container * @param a First money stack item * @param b Second money stack item * @param inventoryItems players inventory items + * @param playerStashId Players stash id * @returns sort order */ - protected prioritiseStashSort(a: Item, b: Item, inventoryItems: Item[]): number; + protected prioritiseStashSort(a: Item, b: Item, inventoryItems: Item[], playerStashId: string): number; /** * Recursivly check items parents to see if it is inside the players inventory, not stash * @param itemId item id to check * @param inventoryItems player inventory + * @param playerStashId Players stash id * @returns true if its in inventory */ - protected isInInventory(itemId: string, inventoryItems: Item[]): boolean; + protected isInStash(itemId: string, inventoryItems: Item[], playerStashId: string): boolean; } diff --git a/TypeScript/7OnLoadHook/types/services/ProfileFixerService.d.ts b/TypeScript/7OnLoadHook/types/services/ProfileFixerService.d.ts index c8232fc..bc1e42e 100644 --- a/TypeScript/7OnLoadHook/types/services/ProfileFixerService.d.ts +++ b/TypeScript/7OnLoadHook/types/services/ProfileFixerService.d.ts @@ -14,6 +14,7 @@ import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; import { Watermark } from "../utils/Watermark"; import { LocalisationService } from "./LocalisationService"; @@ -27,17 +28,19 @@ export declare class ProfileFixerService { protected itemHelper: ItemHelper; protected localisationService: LocalisationService; protected timeUtil: TimeUtil; + protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, profileHelper: ProfileHelper, itemHelper: ItemHelper, localisationService: LocalisationService, timeUtil: TimeUtil, databaseServer: DatabaseServer, configServer: ConfigServer); + constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, profileHelper: ProfileHelper, itemHelper: ItemHelper, localisationService: LocalisationService, timeUtil: TimeUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, configServer: ConfigServer); /** * 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; protected addMissingGunStandContainerImprovements(pmcProfile: IPmcData): void; + protected ensureGunStandLevelsMatch(pmcProfile: IPmcData): void; protected addHideoutAreaStashes(pmcProfile: IPmcData): void; protected addMissingHideoutWallAreas(pmcProfile: IPmcData): void; protected adjustUnreasonableModFleaPrices(): void; @@ -131,4 +134,9 @@ export declare class ProfileFixerService { * @param pmcProfile Profile to add missing IDs to */ addMissingIdsToBonuses(pmcProfile: IPmcData): void; + /** + * At some point the property name was changed,migrate data across to new name + * @param pmcProfile + */ + protected migrateImprovements(pmcProfile: IPmcData): void; } diff --git a/TypeScript/7OnLoadHook/types/services/RagfairPriceService.d.ts b/TypeScript/7OnLoadHook/types/services/RagfairPriceService.d.ts index e245efa..ff35327 100644 --- a/TypeScript/7OnLoadHook/types/services/RagfairPriceService.d.ts +++ b/TypeScript/7OnLoadHook/types/services/RagfairPriceService.d.ts @@ -3,6 +3,7 @@ import { HandbookHelper } from "../helpers/HandbookHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { TraderHelper } from "../helpers/TraderHelper"; +import { MinMax } from "../models/common/MinMax"; import { IPreset } from "../models/eft/common/IGlobals"; import { Item } from "../models/eft/common/tables/IItem"; import { IBarterScheme } from "../models/eft/common/tables/ITrader"; @@ -35,10 +36,6 @@ export declare class RagfairPriceService implements OnLoad { * Generate static (handbook) and dynamic (prices.json) flea prices, store inside class as dictionaries */ onLoad(): Promise; - /** - * Add placeholder values for items missing from handbook - */ - protected addMissingHandbookPrices(): void; getRoute(): string; /** * Iterate over all items of type "Item" in db and get template price, store in cache @@ -91,9 +88,17 @@ export declare class RagfairPriceService implements OnLoad { * Generate a currency cost for an item and its mods * @param items Item with mods to get price for * @param desiredCurrency Currency price desired in + * @param isPackOffer Price is for a pack type offer * @returns cost of item in desired currency */ - getDynamicOfferPrice(items: Item[], desiredCurrency: string): number; + getDynamicOfferPriceForOffer(items: Item[], desiredCurrency: string, isPackOffer: boolean): number; + /** + * Get different min/max price multipliers for different offer types (preset/pack/default) + * @param isPreset Offer is a preset + * @param isPack Offer is a pack + * @returns MinMax values + */ + protected getOfferTypeRangeValues(isPreset: boolean, isPack: boolean): MinMax; /** * Check to see if an items price is below its handbook price and adjust accoring to values set to config/ragfair.json * @param itemPrice price of item @@ -104,10 +109,10 @@ export declare class RagfairPriceService implements OnLoad { /** * Multiply the price by a randomised curve where n = 2, shift = 2 * @param existingPrice price to alter - * @param isPreset is the item we're multiplying a preset + * @param rangeValues min and max to adjust price by * @returns multiplied price */ - protected randomisePrice(existingPrice: number, isPreset: boolean): number; + protected randomiseOfferPrice(existingPrice: number, rangeValues: MinMax): number; /** * Calculate the cost of a weapon preset by adding together the price of its mods + base price of default weapon preset * @param item base weapon diff --git a/TypeScript/8OnUpdateHook/types/callbacks/GameCallbacks.d.ts b/TypeScript/8OnUpdateHook/types/callbacks/GameCallbacks.d.ts index aa80036..46f79f9 100644 --- a/TypeScript/8OnUpdateHook/types/callbacks/GameCallbacks.d.ts +++ b/TypeScript/8OnUpdateHook/types/callbacks/GameCallbacks.d.ts @@ -1,4 +1,5 @@ import { GameController } from "../controllers/GameController"; +import { OnLoad } from "../di/OnLoad"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { ICheckVersionResponse } from "../models/eft/game/ICheckVersionResponse"; import { ICurrentGroupResponse } from "../models/eft/game/ICurrentGroupResponse"; @@ -15,12 +16,14 @@ import { INullResponseData } from "../models/eft/httpResponse/INullResponseData" import { SaveServer } from "../servers/SaveServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { Watermark } from "../utils/Watermark"; -declare class GameCallbacks { +declare class GameCallbacks implements OnLoad { protected httpResponse: HttpResponseUtil; protected watermark: Watermark; protected saveServer: SaveServer; protected gameController: GameController; constructor(httpResponse: HttpResponseUtil, watermark: Watermark, saveServer: SaveServer, gameController: GameController); + onLoad(): Promise; + getRoute(): string; /** * Handle client/game/version/validate * @returns INullResponseData diff --git a/TypeScript/8OnUpdateHook/types/controllers/GameController.d.ts b/TypeScript/8OnUpdateHook/types/controllers/GameController.d.ts index 04e3abb..e88610e 100644 --- a/TypeScript/8OnUpdateHook/types/controllers/GameController.d.ts +++ b/TypeScript/8OnUpdateHook/types/controllers/GameController.d.ts @@ -61,13 +61,14 @@ export declare class GameController { protected pmcConfig: IPmcConfig; protected lootConfig: ILootConfig; constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, randomUtil: RandomUtil, encodingUtil: EncodingUtil, hideoutHelper: HideoutHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, seasonalEventService: SeasonalEventService, itemBaseClassService: ItemBaseClassService, giftService: GiftService, applicationContext: ApplicationContext, configServer: ConfigServer); + load(): void; /** * Handle client/game/start */ gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; protected addCustomLooseLootPositions(): void; protected adjustLooseLootSpawnProbabilities(): void; - protected setHideoutAreasAndCraftsTo30Secs(): void; + protected setHideoutAreasAndCraftsTo40Secs(): void; /** * 3.7.0 moved AIDs to be numeric, old profiles need to be migrated * We store the old AID value in new field `sessionId` diff --git a/TypeScript/8OnUpdateHook/types/controllers/HealthController.d.ts b/TypeScript/8OnUpdateHook/types/controllers/HealthController.d.ts index 1938297..2d7ff09 100644 --- a/TypeScript/8OnUpdateHook/types/controllers/HealthController.d.ts +++ b/TypeScript/8OnUpdateHook/types/controllers/HealthController.d.ts @@ -29,34 +29,35 @@ export declare class HealthController { * stores in-raid player health * @param pmcData Player profile * @param info Request data - * @param sessionID + * @param sessionID Player id * @param addEffects Should effects found be added or removed from profile + * @param deleteExistingEffects Should all prior effects be removed before apply new ones */ saveVitality(pmcData: IPmcData, info: ISyncHealthRequestData, sessionID: string, addEffects?: boolean, deleteExistingEffects?: boolean): void; /** * When healing in menu - * @param pmcData - * @param body - * @param sessionID - * @returns + * @param pmcData Player profile + * @param request Healing request + * @param sessionID Player id + * @returns IItemEventRouterResponse */ - offraidHeal(pmcData: IPmcData, body: IOffraidHealRequestData, sessionID: string): IItemEventRouterResponse; + offraidHeal(pmcData: IPmcData, request: IOffraidHealRequestData, sessionID: string): IItemEventRouterResponse; /** * Handle Eat event * Consume food/water outside of a raid * @param pmcData Player profile - * @param body request Object + * @param request Eat request * @param sessionID Session id * @returns IItemEventRouterResponse */ - offraidEat(pmcData: IPmcData, body: IOffraidEatRequestData, sessionID: string): IItemEventRouterResponse; + offraidEat(pmcData: IPmcData, request: IOffraidEatRequestData, sessionID: string): IItemEventRouterResponse; /** * Handle RestoreHealth event * Occurs on post-raid healing page * @param pmcData player profile * @param healthTreatmentRequest Request data from client * @param sessionID Session id - * @returns + * @returns IItemEventRouterResponse */ healthTreatment(pmcData: IPmcData, healthTreatmentRequest: IHealthTreatmentRequestData, sessionID: string): IItemEventRouterResponse; /** @@ -66,12 +67,4 @@ export declare class HealthController { * @param sessionID */ applyWorkoutChanges(pmcData: IPmcData, info: IWorkoutData, sessionId: string): void; - /** - * Iterate over treatment request diff and find effects to remove from player limbs - * @param sessionId - * @param profile Profile to update - * @param treatmentRequest client request - * @param output response to send to client - */ - protected removeEffectsAfterPostRaidHeal(sessionId: string, profile: IPmcData, treatmentRequest: IHealthTreatmentRequestData, output: IItemEventRouterResponse): void; } diff --git a/TypeScript/8OnUpdateHook/types/controllers/HideoutController.d.ts b/TypeScript/8OnUpdateHook/types/controllers/HideoutController.d.ts index 877c076..a90a16d 100644 --- a/TypeScript/8OnUpdateHook/types/controllers/HideoutController.d.ts +++ b/TypeScript/8OnUpdateHook/types/controllers/HideoutController.d.ts @@ -88,11 +88,11 @@ export declare class HideoutController { * @param pmcData Profile to edit * @param output Object to send back to client * @param sessionID Session/player id - * @param profileHideoutArea Current hideout data for profile + * @param profileParentHideoutArea Current hideout area for profile * @param dbHideoutArea Hideout area being upgraded * @param hideoutStage Stage hideout area is being upgraded to */ - protected addContainerImprovementToProfile(output: IItemEventRouterResponse, sessionID: string, pmcData: IPmcData, profileHideoutArea: HideoutArea, dbHideoutArea: IHideoutArea, hideoutStage: Stage): void; + protected addContainerImprovementToProfile(output: IItemEventRouterResponse, sessionID: string, pmcData: IPmcData, profileParentHideoutArea: HideoutArea, dbHideoutArea: IHideoutArea, hideoutStage: Stage): void; /** * Add an inventory item to profile from a hideout area stage data * @param pmcData Profile to update diff --git a/TypeScript/8OnUpdateHook/types/controllers/LocationController.d.ts b/TypeScript/8OnUpdateHook/types/controllers/LocationController.d.ts index 94d496a..94f5fce 100644 --- a/TypeScript/8OnUpdateHook/types/controllers/LocationController.d.ts +++ b/TypeScript/8OnUpdateHook/types/controllers/LocationController.d.ts @@ -4,6 +4,7 @@ import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { ILocationBase } from "../models/eft/common/ILocationBase"; import { ILocationsGenerateAllResponse } from "../models/eft/common/ILocationsSourceDestinationBase"; import { IAirdropLootResult } from "../models/eft/location/IAirdropLootResult"; +import { IGetLocationRequestData } from "../models/eft/location/IGetLocationRequestData"; import { AirdropTypeEnum } from "../models/enums/AirdropType"; import { IAirdropConfig } from "../models/spt/config/IAirdropConfig"; import { ILocationConfig } from "../models/spt/config/ILocationConfig"; @@ -34,10 +35,11 @@ export declare class LocationController { /** * Handle client/location/getLocalloot * Get a location (map) with generated loot data - * @param location Map to generate loot for + * @param sessionId Player id + * @param request Map request to generate * @returns ILocationBase */ - get(location: string): ILocationBase; + get(sessionId: string, request: IGetLocationRequestData): ILocationBase; /** * Generate a maps base location with loot * @param name Map name diff --git a/TypeScript/8OnUpdateHook/types/controllers/QuestController.d.ts b/TypeScript/8OnUpdateHook/types/controllers/QuestController.d.ts index 7d494a6..bd8a70f 100644 --- a/TypeScript/8OnUpdateHook/types/controllers/QuestController.d.ts +++ b/TypeScript/8OnUpdateHook/types/controllers/QuestController.d.ts @@ -61,7 +61,7 @@ export declare class QuestController { * @param playerLevel level of player to test against quest * @returns true if quest can be seen/accepted by player of defined level */ - protected playerLevelFulfillsQuestRequrement(quest: IQuest, playerLevel: number): boolean; + protected playerLevelFulfillsQuestRequirement(quest: IQuest, playerLevel: number): boolean; /** * Should a quest be shown to the player in trader quest screen * @param questId Quest to check diff --git a/TypeScript/8OnUpdateHook/types/controllers/RagfairController.d.ts b/TypeScript/8OnUpdateHook/types/controllers/RagfairController.d.ts index 76c27f7..bda37cd 100644 --- a/TypeScript/8OnUpdateHook/types/controllers/RagfairController.d.ts +++ b/TypeScript/8OnUpdateHook/types/controllers/RagfairController.d.ts @@ -21,6 +21,7 @@ import { IGetMarketPriceRequestData } from "../models/eft/ragfair/IGetMarketPric import { IGetOffersResult } from "../models/eft/ragfair/IGetOffersResult"; import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; import { ISearchRequestData } from "../models/eft/ragfair/ISearchRequestData"; +import { IProcessBuyTradeRequestData } from "../models/eft/trade/IProcessBuyTradeRequestData"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; @@ -125,6 +126,18 @@ export declare class RagfairController { * @returns IItemEventRouterResponse */ addPlayerOffer(pmcData: IPmcData, offerRequest: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Charge player a listing fee for using flea, pulls charge from data previously sent by client + * @param sessionID Player id + * @param rootItem Base item being listed (used when client tax cost not found and must be done on server) + * @param pmcData Player profile + * @param requirementsPriceInRub Rouble cost player chose for listing (used when client tax cost not found and must be done on server) + * @param itemStackCount How many items were listed in player (used when client tax cost not found and must be done on server) + * @param offerRequest Add offer request object from client + * @param output IItemEventRouterResponse + * @returns True if charging tax to player failed + */ + protected chargePlayerTaxFee(sessionID: string, rootItem: Item, pmcData: IPmcData, requirementsPriceInRub: number, itemStackCount: number, offerRequest: IAddOfferRequestData, output: IItemEventRouterResponse): boolean; /** * Is the item to be listed on the flea valid * @param offerRequest Client offer request @@ -158,4 +171,11 @@ export declare class RagfairController { */ removeOffer(offerId: string, sessionID: string): IItemEventRouterResponse; extendOffer(info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Create a basic trader request object with price and currency type + * @param currency What currency: RUB, EURO, USD + * @param value Amount of currency + * @returns IProcessBuyTradeRequestData + */ + protected createBuyTradeRequestObject(currency: string, value: number): IProcessBuyTradeRequestData; } diff --git a/TypeScript/8OnUpdateHook/types/generators/BotEquipmentModGenerator.d.ts b/TypeScript/8OnUpdateHook/types/generators/BotEquipmentModGenerator.d.ts index ccbbbbf..f7abb84 100644 --- a/TypeScript/8OnUpdateHook/types/generators/BotEquipmentModGenerator.d.ts +++ b/TypeScript/8OnUpdateHook/types/generators/BotEquipmentModGenerator.d.ts @@ -14,7 +14,6 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; import { BotEquipmentModPoolService } from "../services/BotEquipmentModPoolService"; import { BotModLimits, BotWeaponModLimitService } from "../services/BotWeaponModLimitService"; -import { ItemBaseClassService } from "../services/ItemBaseClassService"; import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; @@ -29,7 +28,6 @@ export declare class BotEquipmentModGenerator { protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; protected botEquipmentFilterService: BotEquipmentFilterService; - protected itemBaseClassService: ItemBaseClassService; protected itemFilterService: ItemFilterService; protected profileHelper: ProfileHelper; protected botWeaponModLimitService: BotWeaponModLimitService; @@ -40,7 +38,7 @@ export declare class BotEquipmentModGenerator { protected botEquipmentModPoolService: BotEquipmentModPoolService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, itemHelper: ItemHelper, botEquipmentFilterService: BotEquipmentFilterService, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponModLimitService: BotWeaponModLimitService, botHelper: BotHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, botEquipmentModPoolService: BotEquipmentModPoolService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, itemHelper: ItemHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponModLimitService: BotWeaponModLimitService, botHelper: BotHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, botEquipmentModPoolService: BotEquipmentModPoolService, configServer: ConfigServer); /** * Check mods are compatible and add to array * @param equipment Equipment item to add mods to diff --git a/TypeScript/8OnUpdateHook/types/generators/LocationGenerator.d.ts b/TypeScript/8OnUpdateHook/types/generators/LocationGenerator.d.ts index b8169d3..46a514b 100644 --- a/TypeScript/8OnUpdateHook/types/generators/LocationGenerator.d.ts +++ b/TypeScript/8OnUpdateHook/types/generators/LocationGenerator.d.ts @@ -65,10 +65,11 @@ export declare class LocationGenerator { protected getGuaranteedContainers(staticContainersOnMap: IStaticContainerData[]): IStaticContainerData[]; /** * Choose a number of containers based on their probabilty value to fulfil the desired count in containerData.chosenCount + * @param groupId Name of the group the containers are being collected for * @param containerData Containers and probability values for a groupId * @returns List of chosen container Ids */ - protected getContainersByProbabilty(containerData: IContainerGroupCount): string[]; + protected getContainersByProbabilty(groupId: string, containerData: IContainerGroupCount): string[]; /** * Get a mapping of each groupid and the containers in that group + count of containers to spawn on map * @param containersGroups Container group values diff --git a/TypeScript/8OnUpdateHook/types/generators/PMCLootGenerator.d.ts b/TypeScript/8OnUpdateHook/types/generators/PMCLootGenerator.d.ts index 9acff69..abb5615 100644 --- a/TypeScript/8OnUpdateHook/types/generators/PMCLootGenerator.d.ts +++ b/TypeScript/8OnUpdateHook/types/generators/PMCLootGenerator.d.ts @@ -31,12 +31,12 @@ export declare class PMCLootGenerator { */ generatePMCVestLootPool(): string[]; /** - * Check if item has a width/height that lets it fit into a 1x2/2x1 slot - * 1x1 / 1x2 / 2x1 + * Check if item has a width/height that lets it fit into a 2x2 slot + * 1x1 / 1x2 / 2x1 / 2x2 * @param item Item to check size of * @returns true if it fits */ - protected itemFitsInto1By2Slot(item: ITemplateItem): boolean; + protected itemFitsInto2By2Slot(item: ITemplateItem): boolean; /** * Create an array of loot items a PMC can have in their backpack * @returns string array of tpls diff --git a/TypeScript/8OnUpdateHook/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/8OnUpdateHook/types/generators/RagfairOfferGenerator.d.ts index a627191..58e0b68 100644 --- a/TypeScript/8OnUpdateHook/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/8OnUpdateHook/types/generators/RagfairOfferGenerator.d.ts @@ -55,11 +55,10 @@ export declare class RagfairOfferGenerator { * @param items Items in the offer * @param barterScheme Cost of item (currency or barter) * @param loyalLevel Loyalty level needed to buy item - * @param price Price of offer - * @param sellInOnePiece Set StackObjectsCount to 1 + * @param sellInOnePiece Flags sellInOnePiece to be true * @returns IRagfairOffer */ - createFleaOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; + createFleaOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, sellInOnePiece?: boolean): IRagfairOffer; /** * Create an offer object ready to send to ragfairOfferService.addOffer() * @param userID Owner of the offer @@ -67,17 +66,16 @@ export declare class RagfairOfferGenerator { * @param items Items in the offer * @param barterScheme Cost of item (currency or barter) * @param loyalLevel Loyalty level needed to buy item - * @param price Price of offer * @param sellInOnePiece Set StackObjectsCount to 1 * @returns IRagfairOffer */ - protected createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; + protected createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, sellInOnePiece?: boolean): IRagfairOffer; /** * Calculate the offer price that's listed on the flea listing * @param offerRequirements barter requirements for offer * @returns rouble cost of offer */ - protected calculateOfferListingPrice(offerRequirements: OfferRequirement[]): number; + protected convertOfferRequirementsIntoRoubles(offerRequirements: OfferRequirement[]): number; /** * Get avatar url from trader table in db * @param isTrader Is user we're getting avatar for a trader @@ -137,7 +135,7 @@ export declare class RagfairOfferGenerator { * @param itemDetails raw db item details * @returns Item array */ - protected createSingleOfferForItem(items: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; + protected createSingleOfferForItem(items: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; /** * Generate trader offers on flea using the traders assort data * @param traderID Trader to generate offers for @@ -151,7 +149,7 @@ export declare class RagfairOfferGenerator { * @param itemDetails db details of first item * @returns */ - protected getItemCondition(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): Item[]; + protected randomiseItemUpdProperties(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): Item[]; /** * Get the relevant condition id if item tpl matches in ragfair.json/condition * @param tpl Item to look for matching condition object @@ -184,7 +182,7 @@ export declare class RagfairOfferGenerator { * @param offerItems Items for sale in offer * @returns Barter scheme */ - protected createBarterRequirement(offerItems: Item[]): IBarterScheme[]; + protected createBarterBarterScheme(offerItems: Item[]): IBarterScheme[]; /** * Get an array of flea prices + item tpl, cached in generator class inside `allowedFleaPriceItemsForBarter` * @returns array with tpl/price values @@ -196,7 +194,9 @@ export declare class RagfairOfferGenerator { /** * Create a random currency-based barter scheme for an array of items * @param offerItems Items on offer + * @param isPackOffer Is the barter scheme being created for a pack offer + * @param multipler What to multiply the resulting price by * @returns Barter scheme for offer */ - protected createCurrencyRequirement(offerItems: Item[]): IBarterScheme[]; + protected createCurrencyBarterScheme(offerItems: Item[], isPackOffer: boolean, multipler?: number): IBarterScheme[]; } diff --git a/TypeScript/8OnUpdateHook/types/generators/ScavCaseRewardGenerator.d.ts b/TypeScript/8OnUpdateHook/types/generators/ScavCaseRewardGenerator.d.ts index 4ba1888..b5935d0 100644 --- a/TypeScript/8OnUpdateHook/types/generators/ScavCaseRewardGenerator.d.ts +++ b/TypeScript/8OnUpdateHook/types/generators/ScavCaseRewardGenerator.d.ts @@ -25,6 +25,8 @@ export declare class ScavCaseRewardGenerator { protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected scavCaseConfig: IScavCaseConfig; + protected dbItemsCache: ITemplateItem[]; + protected dbAmmoItemsCache: ITemplateItem[]; constructor(logger: ILogger, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * Create an array of rewards that will be given to the player upon completing their scav case build @@ -33,10 +35,10 @@ export declare class ScavCaseRewardGenerator { */ generate(recipeId: string): Product[]; /** - * Get all db items that are not blacklisted in scavcase config - * @returns filtered array of db items + * Get all db items that are not blacklisted in scavcase config or global blacklist + * Store in class field */ - protected getDbItems(): ITemplateItem[]; + protected cacheDbItems(): void; /** * Pick a number of items to be rewards, the count is defined by the values in * @param items item pool to pick rewards from diff --git a/TypeScript/8OnUpdateHook/types/generators/WeatherGenerator.d.ts b/TypeScript/8OnUpdateHook/types/generators/WeatherGenerator.d.ts index 2e2403c..6471bb1 100644 --- a/TypeScript/8OnUpdateHook/types/generators/WeatherGenerator.d.ts +++ b/TypeScript/8OnUpdateHook/types/generators/WeatherGenerator.d.ts @@ -52,6 +52,7 @@ export declare class WeatherGenerator { */ protected setCurrentDateTime(weather: IWeather): void; protected getWeightedWindDirection(): WindDirection; + protected getWeightedClouds(): number; protected getWeightedWindSpeed(): number; protected getWeightedFog(): number; protected getWeightedRain(): number; diff --git a/TypeScript/8OnUpdateHook/types/helpers/HealthHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/HealthHelper.d.ts index 3694a6e..e4cdcd6 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/HealthHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/HealthHelper.d.ts @@ -27,6 +27,7 @@ export declare class HealthHelper { * @param request Heal request * @param sessionID Session id * @param addEffects Should effects be added or removed (default - add) + * @param deleteExistingEffects Should all prior effects be removed before apply new ones */ saveVitality(pmcData: IPmcData, request: ISyncHealthRequestData, sessionID: string, addEffects?: boolean, deleteExistingEffects?: boolean): void; /** diff --git a/TypeScript/8OnUpdateHook/types/helpers/InRaidHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/InRaidHelper.d.ts index bf584c2..b4c0c1c 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/InRaidHelper.d.ts @@ -53,7 +53,7 @@ export declare class InRaidHelper { * @param victim Who was killed by player * @returns a numerical standing gain or loss */ - protected getStandingChangeForKill(victim: Victim): number; + protected getFenceStandingChangeForKillAsScav(victim: Victim): number; /** * Reset a profile to a baseline, used post-raid * Reset points earned during session property diff --git a/TypeScript/8OnUpdateHook/types/helpers/ItemHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/ItemHelper.d.ts index 99fca56..00f190f 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/ItemHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/ItemHelper.d.ts @@ -26,6 +26,7 @@ declare class ItemHelper { protected itemBaseClassService: ItemBaseClassService; protected localisationService: LocalisationService; protected localeService: LocaleService; + protected readonly defaultInvalidBaseTypes: string[]; constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, localisationService: LocalisationService, localeService: LocaleService); /** * Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash @@ -67,6 +68,11 @@ declare class ItemHelper { * @returns Price in roubles (undefined if not found) */ getDynamicItemPrice(tpl: string): number; + /** + * Update items upd.StackObjectsCount to be 1 if its upd is missing or StackObjectsCount is undefined + * @param item Item to update + * @returns Fixed item + */ fixItemStackCount(item: Item): Item; /** * AmmoBoxes contain StackSlots which need to be filled for the AmmoBox to have content. @@ -125,19 +131,19 @@ declare class ItemHelper { getItemQualityModifier(item: Item): number; /** * Get a quality value based on a repairable items (weapon/armor) current state between current and max durability - * @param itemDetails - * @param repairable repairable object - * @param item - * @returns a number between 0 and 1 + * @param itemDetails Db details for item we want quality value for + * @param repairable Repairable properties + * @param item Item quality value is for + * @returns A number between 0 and 1 */ protected getRepairableItemQualityValue(itemDetails: ITemplateItem, repairable: Repairable, item: Item): number; /** * Recursive function that looks at every item from parameter and gets their childrens Ids + includes parent item in results - * @param items - * @param itemID + * @param items Array of items (item + possible children) + * @param itemId Parent items id * @returns an array of strings */ - findAndReturnChildrenByItems(items: Item[], itemID: string): string[]; + findAndReturnChildrenByItems(items: Item[], itemId: string): string[]; /** * A variant of findAndReturnChildren where the output is list of item objects instead of their ids. * @param items @@ -164,12 +170,6 @@ declare class ItemHelper { * @returns true if it is a dogtag */ isDogtag(tpl: string): boolean; - /** - * Can the item passed in be sold to a trader because it is raw money - * @param tpl Item template id to check - * @returns true if unsellable - */ - isNotSellable(tpl: string): boolean; /** * Gets the identifier for a child using slotId, locationX and locationY. * @param item @@ -183,19 +183,19 @@ declare class ItemHelper { */ isItemTplStackable(tpl: string): boolean; /** - * split item stack if it exceeds its StackMaxSize property - * @param itemToSplit item being split into smaller stacks + * split item stack if it exceeds its items StackMaxSize property + * @param itemToSplit Item to split into smaller stacks * @returns Array of split items */ splitStack(itemToSplit: Item): Item[]; /** - * Find Barter items in the inventory + * Find Barter items from array of items * @param {string} by tpl or id - * @param {Object} pmcData + * @param {Item[]} items Array of items to iterate over * @param {string} barterItemId * @returns Array of Item objects */ - findBarterItems(by: "tpl" | "id", pmcData: IPmcData, barterItemId: string): Item[]; + findBarterItems(by: "tpl" | "id", items: Item[], barterItemId: string): Item[]; /** * Regenerate all guids with new ids, exceptions are for items that cannot be altered (e.g. stash/sorting table) * @param pmcData Player profile @@ -262,10 +262,21 @@ declare class ItemHelper { * @param minSizePercent % the magazine must be filled to */ fillMagazineWithCartridge(magazine: Item[], magTemplate: ITemplateItem, cartridgeTpl: string, minSizePercent?: number): void; + /** + * Choose a random bullet type from the list of possible a magazine has + * @param magTemplate Magazine template from Db + * @returns Tpl of cartridge + */ protected getRandomValidCaliber(magTemplate: ITemplateItem): string; + /** + * Chose a randomly weighted cartridge that fits + * @param caliber Desired caliber + * @param staticAmmoDist Cartridges and thier weights + * @returns Tpl of cartrdige + */ protected drawAmmoTpl(caliber: string, staticAmmoDist: Record): string; /** - * + * Create a basic cartrige object * @param parentId container cartridges will be placed in * @param ammoTpl Cartridge to insert * @param stackCount Count of cartridges inside parent diff --git a/TypeScript/8OnUpdateHook/types/helpers/QuestHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/QuestHelper.d.ts index e04b6e0..5c749d3 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/QuestHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/QuestHelper.d.ts @@ -21,6 +21,7 @@ import { DialogueHelper } from "./DialogueHelper"; import { ItemHelper } from "./ItemHelper"; import { PaymentHelper } from "./PaymentHelper"; import { ProfileHelper } from "./ProfileHelper"; +import { QuestConditionHelper } from "./QuestConditionHelper"; import { RagfairServerHelper } from "./RagfairServerHelper"; import { TraderHelper } from "./TraderHelper"; export declare class QuestHelper { @@ -29,6 +30,7 @@ export declare class QuestHelper { protected timeUtil: TimeUtil; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; + protected questConditionHelper: QuestConditionHelper; protected eventOutputHolder: EventOutputHolder; protected databaseServer: DatabaseServer; protected localeService: LocaleService; @@ -41,7 +43,7 @@ export declare class QuestHelper { protected mailSendService: MailSendService; protected configServer: ConfigServer; 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, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, questConditionHelper: QuestConditionHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, mailSendService: MailSendService, configServer: ConfigServer); /** * Get status of a quest in player profile by its id * @param pmcData Profile to search @@ -119,7 +121,7 @@ export declare class QuestHelper { * @param sessionID Session id * @returns Quests accessible to player incuding newly unlocked quests now quest (startedQuestId) was started */ - acceptedUnlocked(startedQuestId: string, sessionID: string): IQuest[]; + getNewlyAccessibleQuestsWhenStartingQuest(startedQuestId: string, sessionID: string): IQuest[]; /** * Get quests that can be shown to player after failing a quest * @param failedQuestId Id of the quest failed by player diff --git a/TypeScript/8OnUpdateHook/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/RagfairOfferHelper.d.ts index de9d550..0699259 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/RagfairOfferHelper.d.ts @@ -1,4 +1,5 @@ import { IPmcData } from "../models/eft/common/IPmcData"; +import { Item } from "../models/eft/common/tables/IItem"; import { ITraderAssort } from "../models/eft/common/tables/ITrader"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; @@ -13,10 +14,10 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { LocaleService } from "../services/LocaleService"; import { LocalisationService } from "../services/LocalisationService"; +import { MailSendService } from "../services/MailSendService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { HashUtil } from "../utils/HashUtil"; import { TimeUtil } from "../utils/TimeUtil"; -import { DialogueHelper } from "./DialogueHelper"; import { ItemHelper } from "./ItemHelper"; import { PaymentHelper } from "./PaymentHelper"; import { PresetHelper } from "./PresetHelper"; @@ -33,7 +34,6 @@ export declare class RagfairOfferHelper { protected databaseServer: DatabaseServer; protected traderHelper: TraderHelper; protected saveServer: SaveServer; - protected dialogueHelper: DialogueHelper; protected itemHelper: ItemHelper; protected paymentHelper: PaymentHelper; protected presetHelper: PresetHelper; @@ -44,11 +44,12 @@ export declare class RagfairOfferHelper { protected ragfairOfferService: RagfairOfferService; protected localeService: LocaleService; protected localisationService: LocalisationService; + protected mailSendService: MailSendService; protected configServer: ConfigServer; protected static goodSoldTemplate: string; protected ragfairConfig: IRagfairConfig; 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, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, localisationService: LocalisationService, mailSendService: MailSendService, configServer: ConfigServer); /** * Passthrough to ragfairOfferService.getOffers(), get flea offers a player should see * @param searchRequest Data from client @@ -119,19 +120,26 @@ export declare class RagfairOfferHelper { */ protected getProfileOffers(sessionID: string): IRagfairOffer[]; /** - * Delete an offer from a desired profile + * Delete an offer from a desired profile and from ragfair offers * @param sessionID Session id of profile to delete offer from - * @param offerId Offer id to delete + * @param offerId Id of offer to delete */ - protected deleteOfferByOfferId(sessionID: string, offerId: string): void; + protected deleteOfferById(sessionID: string, offerId: string): void; /** * Complete the selling of players' offer * @param sessionID Session id * @param offer Sold offer details * @param boughtAmount Amount item was purchased for - * @returns Client response + * @returns IItemEventRouterResponse */ protected completeOffer(sessionID: string, offer: IRagfairOffer, boughtAmount: number): IItemEventRouterResponse; + /** + * Get a localised message for when players offer has sold on flea + * @param itemTpl Item sold + * @param boughtAmount How many were purchased + * @returns Localised message text + */ + protected getLocalisedOfferSoldMessage(itemTpl: string, boughtAmount: number): string; /** * Should a ragfair offer be visible to the player * @param searchRequest Search request @@ -142,4 +150,12 @@ export declare class RagfairOfferHelper { * @returns True = should be shown to player */ isDisplayableOffer(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, offer: IRagfairOffer, pmcProfile: IPmcData): boolean; + /** + * Is items quality value within desired range + * @param item Item to check quality of + * @param min Desired minimum quality + * @param max Desired maximum quality + * @returns True if in range + */ + protected itemQualityInRange(item: Item, min: number, max: number): boolean; } diff --git a/TypeScript/8OnUpdateHook/types/helpers/RagfairSellHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/RagfairSellHelper.d.ts index 251d7ca..913b408 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/RagfairSellHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/RagfairSellHelper.d.ts @@ -13,12 +13,12 @@ export declare class RagfairSellHelper { constructor(logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, configServer: ConfigServer); /** * Get the percent chance to sell an item based on its average listed price vs player chosen listing price - * @param baseChancePercent Base chance to sell item * @param averageOfferPriceRub Price of average offer in roubles * @param playerListedPriceRub Price player listed item for in roubles + * @param qualityMultiplier Quality multipler of item being sold * @returns percent value */ - calculateSellChance(baseChancePercent: number, averageOfferPriceRub: number, playerListedPriceRub: number): number; + calculateSellChance(averageOfferPriceRub: number, playerListedPriceRub: number, qualityMultiplier: number): number; /** * Get percent chance to sell an item when price is below items average listing price * @param playerListedPriceRub Price player listed item for in roubles diff --git a/TypeScript/8OnUpdateHook/types/helpers/TraderHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/TraderHelper.d.ts index c163f7a..6680ccf 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/TraderHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/TraderHelper.d.ts @@ -35,7 +35,7 @@ export declare class TraderHelper { protected highestTraderBuyPriceItems: Record; constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, handbookHelper: HandbookHelper, itemHelper: ItemHelper, playerService: PlayerService, localisationService: LocalisationService, fenceService: FenceService, timeUtil: TimeUtil, randomUtil: RandomUtil, configServer: ConfigServer); getTrader(traderID: string, sessionID: string): ITraderBase; - getTraderAssortsById(traderId: string): ITraderAssort; + getTraderAssortsByTraderId(traderId: string): ITraderAssort; /** * 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 diff --git a/TypeScript/8OnUpdateHook/types/models/eft/common/tables/IBotBase.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/common/tables/IBotBase.d.ts index ee40958..6c7b76f 100644 --- a/TypeScript/8OnUpdateHook/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/eft/common/tables/IBotBase.d.ts @@ -281,7 +281,7 @@ export interface InsuredItem { export interface Hideout { Production: Record; Areas: HideoutArea[]; - Improvements: Record; + Improvement: Record; Seed: number; sptUpdateLastRunTimestamp: number; } diff --git a/TypeScript/8OnUpdateHook/types/models/eft/health/IHealthTreatmentRequestData.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/health/IHealthTreatmentRequestData.d.ts index 7fb80a8..598e60c 100644 --- a/TypeScript/8OnUpdateHook/types/models/eft/health/IHealthTreatmentRequestData.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/eft/health/IHealthTreatmentRequestData.d.ts @@ -1,12 +1,14 @@ export interface IHealthTreatmentRequestData { Action: "RestoreHealth"; trader: string; - items: Item[]; + items: Cost[]; difference: Difference; timestamp: number; } -export interface Item { +export interface Cost { + /** Id of stack to take money from */ id: string; + /** Amount of money to take off player for treatment */ count: number; } export interface Difference { @@ -25,5 +27,6 @@ export interface BodyParts { } export interface BodyPart { Health: number; + /** Effects in array are to be removed */ Effects: string[]; } diff --git a/TypeScript/8OnUpdateHook/types/models/eft/notifier/INotifier.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/notifier/INotifier.d.ts index ce25dee..c6c6979 100644 --- a/TypeScript/8OnUpdateHook/types/models/eft/notifier/INotifier.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/eft/notifier/INotifier.d.ts @@ -14,6 +14,11 @@ export interface INotification { } export declare enum NotificationType { RAGFAIR_OFFER_SOLD = "RagfairOfferSold", + RAGFAIR_RATING_CHANGE = "RagfairRatingChange", + /** ChatMessageReceived */ NEW_MESSAGE = "new_message", - PING = "ping" + PING = "ping", + TRADER_SUPPLY = "TraderSupply", + TRADER_STANDING = "TraderStanding", + UNLOCK_TRADER = "UnlockTrader" } diff --git a/TypeScript/8OnUpdateHook/types/models/eft/notifier/ISelectProfileResponse.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/notifier/ISelectProfileResponse.d.ts index ecb668a..f2d6be7 100644 --- a/TypeScript/8OnUpdateHook/types/models/eft/notifier/ISelectProfileResponse.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/eft/notifier/ISelectProfileResponse.d.ts @@ -1,6 +1,3 @@ -import { INotifierChannel } from "./INotifier"; export interface ISelectProfileResponse { status: string; - notifier: INotifierChannel; - notifierServer: string; } diff --git a/TypeScript/8OnUpdateHook/types/models/enums/WeatherType.d.ts b/TypeScript/8OnUpdateHook/types/models/enums/WeatherType.d.ts index d31fefe..503dc30 100644 --- a/TypeScript/8OnUpdateHook/types/models/enums/WeatherType.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/enums/WeatherType.d.ts @@ -1,19 +1,19 @@ export declare enum WeatherType { - CLEAR_DAY = 1, - CLEAR_WIND = 2, - CLEAR_NIGHT = 3, - PARTLY_CLOUD_DAY = 4, - PARTLY_CLOUD_NIGHT = 5, - CLEAR_FOG_DAY = 6, - CLEAR_FOG_NIGHT = 7, - CLOUDFOG = 8, - FOG = 9, - MOSTLY_CLOUD = 10, - LIGHT_RAIN = 11, - RAIN = 12, - CLOUD_WIND = 13, - CLOUD_WIND_RAIN = 14, - FULL_CLOUD = 15, - THUNDER_CLOUD = 16, - NONE = 0 + CLEAR_DAY = 0, + CLEAR_WIND = 1, + CLEAR_NIGHT = 2, + PARTLY_CLOUD_DAY = 3, + PARTLY_CLOUD_NIGHT = 4, + CLEAR_FOG_DAY = 5, + CLEAR_FOG_NIGHT = 6, + CLOUD_FOG = 7, + FOG = 8, + MOSTLY_CLOUD = 9, + LIGHT_RAIN = 10, + RAIN = 11, + CLOUD_WIND = 12, + CLOUD_WIND_RAIN = 13, + FULL_CLOUD = 14, + THUNDER_CLOUD = 15, + NONE = 16 } diff --git a/TypeScript/8OnUpdateHook/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/config/IRagfairConfig.d.ts index 7c04857..7aea24f 100644 --- a/TypeScript/8OnUpdateHook/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/spt/config/IRagfairConfig.d.ts @@ -41,7 +41,8 @@ export interface Dynamic { /** Use the highest trader price for an offer if its greater than the price in templates/prices.json */ useTraderPriceForOffersIfHigher: boolean; /** Barter offer specific settings */ - barter: Barter; + barter: IBarterDetails; + pack: IPackDetails; /** Dynamic offer price below handbook adjustment values */ offerAdjustment: OfferAdjustment; /** How many offers should expire before an offer regeneration occurs */ @@ -49,9 +50,7 @@ export interface Dynamic { /** How many offers should be listed */ offerItemCount: MinMax; /** How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) */ - price: MinMax; - /** How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) */ - presetPrice: MinMax; + priceRanges: IPriceRanges; /** Should default presets to listed only or should non-standard presets found in globals.json be listed too */ showDefaultPresetsOnly: boolean; endTimeSeconds: MinMax; @@ -74,7 +73,12 @@ export interface Dynamic { /** Dict of price limits keyed by item type */ unreasonableModPrices: Record; } -export interface Barter { +export interface IPriceRanges { + default: MinMax; + preset: MinMax; + pack: MinMax; +} +export interface IBarterDetails { /** Should barter offers be generated */ enable: boolean; /** Percentage change an offer is listed as a barter */ @@ -90,6 +94,18 @@ export interface Barter { /** Item Tpls to never be turned into a barter */ itemTypeBlacklist: string[]; } +export interface IPackDetails { + /** Should pack offers be generated */ + enable: boolean; + /** Percentage change an offer is listed as a pack */ + chancePercent: number; + /** Min number of required items for a pack */ + itemCountMin: number; + /** Max number of required items for a pack */ + itemCountMax: number; + /** item types to allow being a pack */ + itemTypeWhitelist: string[]; +} export interface OfferAdjustment { /** Shuld offer price be adjusted when below handbook price */ adjustPriceWhenBelowHandbookPrice: boolean; diff --git a/TypeScript/8OnUpdateHook/types/models/spt/config/IWeatherConfig.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/config/IWeatherConfig.d.ts index 41a1c83..6ecf35b 100644 --- a/TypeScript/8OnUpdateHook/types/models/spt/config/IWeatherConfig.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/spt/config/IWeatherConfig.d.ts @@ -7,7 +7,7 @@ export interface IWeatherConfig extends IBaseConfig { weather: Weather; } export interface Weather { - clouds: MinMax; + clouds: WeatherSettings; windSpeed: WeatherSettings; windDirection: WeatherSettings; windGustiness: MinMax; diff --git a/TypeScript/8OnUpdateHook/types/services/HashCacheService.d.ts b/TypeScript/8OnUpdateHook/types/services/HashCacheService.d.ts index 5320f28..9968478 100644 --- a/TypeScript/8OnUpdateHook/types/services/HashCacheService.d.ts +++ b/TypeScript/8OnUpdateHook/types/services/HashCacheService.d.ts @@ -11,7 +11,18 @@ export declare class HashCacheService { protected modHashes: any; protected readonly modCachePath = "./user/cache/modCache.json"; constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); + /** + * Return a stored hash by key + * @param modName Name of mod to get hash for + * @returns Mod hash + */ getStoredModHash(modName: string): string; + /** + * Does the generated hash match the stored hash + * @param modName name of mod + * @param modContent + * @returns True if they match + */ modContentMatchesStoredHash(modName: string, modContent: string): boolean; hashMatchesStoredHash(modName: string, modHash: string): boolean; storeModContent(modName: string, modContent: string): void; diff --git a/TypeScript/8OnUpdateHook/types/services/MailSendService.d.ts b/TypeScript/8OnUpdateHook/types/services/MailSendService.d.ts index 19397dc..fe4a7fe 100644 --- a/TypeScript/8OnUpdateHook/types/services/MailSendService.d.ts +++ b/TypeScript/8OnUpdateHook/types/services/MailSendService.d.ts @@ -35,7 +35,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendDirectNpcMessageToPlayer(playerId: string, sender: Traders, messageType: MessageType, message: string, items?: Item[], maxStorageTimeSeconds?: any): void; + sendDirectNpcMessageToPlayer(playerId: string, sender: Traders, messageType: MessageType, message: string, items?: Item[], maxStorageTimeSeconds?: any, systemData?: any, ragfair?: any): void; /** * Send a message from an NPC (e.g. prapor) to the player with or without items * @param playerId Players id to send message to @@ -45,7 +45,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendLocalisedNpcMessageToPlayer(playerId: string, sender: Traders, messageType: MessageType, messageLocaleId: string, items?: Item[], maxStorageTimeSeconds?: any, systemData?: any): void; + sendLocalisedNpcMessageToPlayer(playerId: string, sender: Traders, messageType: MessageType, messageLocaleId: string, items?: Item[], maxStorageTimeSeconds?: any, systemData?: any, ragfair?: any): void; /** * Send a message from SYSTEM to the player with or without items * @param playerId Players id to send message to diff --git a/TypeScript/8OnUpdateHook/types/services/MatchBotDetailsCacheService.d.ts b/TypeScript/8OnUpdateHook/types/services/MatchBotDetailsCacheService.d.ts index eb365dd..c1bd322 100644 --- a/TypeScript/8OnUpdateHook/types/services/MatchBotDetailsCacheService.d.ts +++ b/TypeScript/8OnUpdateHook/types/services/MatchBotDetailsCacheService.d.ts @@ -1,7 +1,7 @@ import { IBotBase } from "../models/eft/common/tables/IBotBase"; import { ILogger } from "../models/spt/utils/ILogger"; import { LocalisationService } from "./LocalisationService"; -/** Cache bots in a dictionary, keyed by the bots name, keying by name isnt idea as its not unique but this is used by the post-raid system which doesnt have any bot ids, only name */ +/** Cache bots in a dictionary, keyed by the bots name, keying by name isnt ideal as its not unique but this is used by the post-raid system which doesnt have any bot ids, only name */ export declare class MatchBotDetailsCacheService { protected logger: ILogger; protected localisationService: LocalisationService; @@ -17,9 +17,9 @@ export declare class MatchBotDetailsCacheService { */ clearCache(): void; /** - * Find a bot in the cache by its name + * Find a bot in the cache by its name and side * @param botName Name of bot to find * @returns Bot details */ - getBotByName(botName: string): IBotBase; + getBotByNameAndSide(botName: string, botSide: string): IBotBase; } diff --git a/TypeScript/8OnUpdateHook/types/services/ModCompilerService.d.ts b/TypeScript/8OnUpdateHook/types/services/ModCompilerService.d.ts index a4bf3c8..e306177 100644 --- a/TypeScript/8OnUpdateHook/types/services/ModCompilerService.d.ts +++ b/TypeScript/8OnUpdateHook/types/services/ModCompilerService.d.ts @@ -1,14 +1,36 @@ import { CompilerOptions } from "typescript"; import type { ILogger } from "../models/spt/utils/ILogger"; -import { HashCacheService } from "./HashCacheService"; import { VFS } from "../utils/VFS"; +import { HashCacheService } from "./HashCacheService"; export declare class ModCompilerService { protected logger: ILogger; protected hashCacheService: HashCacheService; protected vfs: VFS; constructor(logger: ILogger, hashCacheService: HashCacheService, vfs: VFS); + /** + * Convert a mods TS into JS + * @param modName Name of mod + * @param modPath Dir path to mod + * @param modTypeScriptFiles + * @returns + */ compileMod(modName: string, modPath: string, modTypeScriptFiles: string[]): Promise; + /** + * Convert a TS file into JS + * @param fileNames Paths to TS files + * @param options Compiler options + */ protected compile(fileNames: string[], options: CompilerOptions): Promise; + /** + * Do the files at the provided paths exist + * @param fileNames + * @returns + */ protected areFilesReady(fileNames: string[]): boolean; + /** + * Wait the provided number of milliseconds + * @param ms Milliseconds + * @returns + */ protected delay(ms: number): Promise; } diff --git a/TypeScript/8OnUpdateHook/types/services/PaymentService.d.ts b/TypeScript/8OnUpdateHook/types/services/PaymentService.d.ts index 1c9c32b..fb5f92c 100644 --- a/TypeScript/8OnUpdateHook/types/services/PaymentService.d.ts +++ b/TypeScript/8OnUpdateHook/types/services/PaymentService.d.ts @@ -61,23 +61,26 @@ export declare class PaymentService { * Get all money stacks in inventory and prioritse items in stash * @param pmcData * @param currencyTpl + * @param playerStashId Players stash id * @returns Sorting money items */ - protected getSortedMoneyItemsInInventory(pmcData: IPmcData, currencyTpl: string): Item[]; + protected getSortedMoneyItemsInInventory(pmcData: IPmcData, currencyTpl: string, playerStashId: string): Item[]; /** * Prioritise player stash first over player inventory * Post-raid healing would often take money out of the players pockets/secure container * @param a First money stack item * @param b Second money stack item * @param inventoryItems players inventory items + * @param playerStashId Players stash id * @returns sort order */ - protected prioritiseStashSort(a: Item, b: Item, inventoryItems: Item[]): number; + protected prioritiseStashSort(a: Item, b: Item, inventoryItems: Item[], playerStashId: string): number; /** * Recursivly check items parents to see if it is inside the players inventory, not stash * @param itemId item id to check * @param inventoryItems player inventory + * @param playerStashId Players stash id * @returns true if its in inventory */ - protected isInInventory(itemId: string, inventoryItems: Item[]): boolean; + protected isInStash(itemId: string, inventoryItems: Item[], playerStashId: string): boolean; } diff --git a/TypeScript/8OnUpdateHook/types/services/ProfileFixerService.d.ts b/TypeScript/8OnUpdateHook/types/services/ProfileFixerService.d.ts index c8232fc..bc1e42e 100644 --- a/TypeScript/8OnUpdateHook/types/services/ProfileFixerService.d.ts +++ b/TypeScript/8OnUpdateHook/types/services/ProfileFixerService.d.ts @@ -14,6 +14,7 @@ import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; import { Watermark } from "../utils/Watermark"; import { LocalisationService } from "./LocalisationService"; @@ -27,17 +28,19 @@ export declare class ProfileFixerService { protected itemHelper: ItemHelper; protected localisationService: LocalisationService; protected timeUtil: TimeUtil; + protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, profileHelper: ProfileHelper, itemHelper: ItemHelper, localisationService: LocalisationService, timeUtil: TimeUtil, databaseServer: DatabaseServer, configServer: ConfigServer); + constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, profileHelper: ProfileHelper, itemHelper: ItemHelper, localisationService: LocalisationService, timeUtil: TimeUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, configServer: ConfigServer); /** * 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; protected addMissingGunStandContainerImprovements(pmcProfile: IPmcData): void; + protected ensureGunStandLevelsMatch(pmcProfile: IPmcData): void; protected addHideoutAreaStashes(pmcProfile: IPmcData): void; protected addMissingHideoutWallAreas(pmcProfile: IPmcData): void; protected adjustUnreasonableModFleaPrices(): void; @@ -131,4 +134,9 @@ export declare class ProfileFixerService { * @param pmcProfile Profile to add missing IDs to */ addMissingIdsToBonuses(pmcProfile: IPmcData): void; + /** + * At some point the property name was changed,migrate data across to new name + * @param pmcProfile + */ + protected migrateImprovements(pmcProfile: IPmcData): void; } diff --git a/TypeScript/8OnUpdateHook/types/services/RagfairPriceService.d.ts b/TypeScript/8OnUpdateHook/types/services/RagfairPriceService.d.ts index e245efa..ff35327 100644 --- a/TypeScript/8OnUpdateHook/types/services/RagfairPriceService.d.ts +++ b/TypeScript/8OnUpdateHook/types/services/RagfairPriceService.d.ts @@ -3,6 +3,7 @@ import { HandbookHelper } from "../helpers/HandbookHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { TraderHelper } from "../helpers/TraderHelper"; +import { MinMax } from "../models/common/MinMax"; import { IPreset } from "../models/eft/common/IGlobals"; import { Item } from "../models/eft/common/tables/IItem"; import { IBarterScheme } from "../models/eft/common/tables/ITrader"; @@ -35,10 +36,6 @@ export declare class RagfairPriceService implements OnLoad { * Generate static (handbook) and dynamic (prices.json) flea prices, store inside class as dictionaries */ onLoad(): Promise; - /** - * Add placeholder values for items missing from handbook - */ - protected addMissingHandbookPrices(): void; getRoute(): string; /** * Iterate over all items of type "Item" in db and get template price, store in cache @@ -91,9 +88,17 @@ export declare class RagfairPriceService implements OnLoad { * Generate a currency cost for an item and its mods * @param items Item with mods to get price for * @param desiredCurrency Currency price desired in + * @param isPackOffer Price is for a pack type offer * @returns cost of item in desired currency */ - getDynamicOfferPrice(items: Item[], desiredCurrency: string): number; + getDynamicOfferPriceForOffer(items: Item[], desiredCurrency: string, isPackOffer: boolean): number; + /** + * Get different min/max price multipliers for different offer types (preset/pack/default) + * @param isPreset Offer is a preset + * @param isPack Offer is a pack + * @returns MinMax values + */ + protected getOfferTypeRangeValues(isPreset: boolean, isPack: boolean): MinMax; /** * Check to see if an items price is below its handbook price and adjust accoring to values set to config/ragfair.json * @param itemPrice price of item @@ -104,10 +109,10 @@ export declare class RagfairPriceService implements OnLoad { /** * Multiply the price by a randomised curve where n = 2, shift = 2 * @param existingPrice price to alter - * @param isPreset is the item we're multiplying a preset + * @param rangeValues min and max to adjust price by * @returns multiplied price */ - protected randomisePrice(existingPrice: number, isPreset: boolean): number; + protected randomiseOfferPrice(existingPrice: number, rangeValues: MinMax): number; /** * Calculate the cost of a weapon preset by adding together the price of its mods + base price of default weapon preset * @param item base weapon diff --git a/TypeScript/9RouterHooks/types/callbacks/GameCallbacks.d.ts b/TypeScript/9RouterHooks/types/callbacks/GameCallbacks.d.ts index aa80036..46f79f9 100644 --- a/TypeScript/9RouterHooks/types/callbacks/GameCallbacks.d.ts +++ b/TypeScript/9RouterHooks/types/callbacks/GameCallbacks.d.ts @@ -1,4 +1,5 @@ import { GameController } from "../controllers/GameController"; +import { OnLoad } from "../di/OnLoad"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { ICheckVersionResponse } from "../models/eft/game/ICheckVersionResponse"; import { ICurrentGroupResponse } from "../models/eft/game/ICurrentGroupResponse"; @@ -15,12 +16,14 @@ import { INullResponseData } from "../models/eft/httpResponse/INullResponseData" import { SaveServer } from "../servers/SaveServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { Watermark } from "../utils/Watermark"; -declare class GameCallbacks { +declare class GameCallbacks implements OnLoad { protected httpResponse: HttpResponseUtil; protected watermark: Watermark; protected saveServer: SaveServer; protected gameController: GameController; constructor(httpResponse: HttpResponseUtil, watermark: Watermark, saveServer: SaveServer, gameController: GameController); + onLoad(): Promise; + getRoute(): string; /** * Handle client/game/version/validate * @returns INullResponseData diff --git a/TypeScript/9RouterHooks/types/controllers/GameController.d.ts b/TypeScript/9RouterHooks/types/controllers/GameController.d.ts index 04e3abb..e88610e 100644 --- a/TypeScript/9RouterHooks/types/controllers/GameController.d.ts +++ b/TypeScript/9RouterHooks/types/controllers/GameController.d.ts @@ -61,13 +61,14 @@ export declare class GameController { protected pmcConfig: IPmcConfig; protected lootConfig: ILootConfig; constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, randomUtil: RandomUtil, encodingUtil: EncodingUtil, hideoutHelper: HideoutHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, seasonalEventService: SeasonalEventService, itemBaseClassService: ItemBaseClassService, giftService: GiftService, applicationContext: ApplicationContext, configServer: ConfigServer); + load(): void; /** * Handle client/game/start */ gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; protected addCustomLooseLootPositions(): void; protected adjustLooseLootSpawnProbabilities(): void; - protected setHideoutAreasAndCraftsTo30Secs(): void; + protected setHideoutAreasAndCraftsTo40Secs(): void; /** * 3.7.0 moved AIDs to be numeric, old profiles need to be migrated * We store the old AID value in new field `sessionId` diff --git a/TypeScript/9RouterHooks/types/controllers/HealthController.d.ts b/TypeScript/9RouterHooks/types/controllers/HealthController.d.ts index 1938297..2d7ff09 100644 --- a/TypeScript/9RouterHooks/types/controllers/HealthController.d.ts +++ b/TypeScript/9RouterHooks/types/controllers/HealthController.d.ts @@ -29,34 +29,35 @@ export declare class HealthController { * stores in-raid player health * @param pmcData Player profile * @param info Request data - * @param sessionID + * @param sessionID Player id * @param addEffects Should effects found be added or removed from profile + * @param deleteExistingEffects Should all prior effects be removed before apply new ones */ saveVitality(pmcData: IPmcData, info: ISyncHealthRequestData, sessionID: string, addEffects?: boolean, deleteExistingEffects?: boolean): void; /** * When healing in menu - * @param pmcData - * @param body - * @param sessionID - * @returns + * @param pmcData Player profile + * @param request Healing request + * @param sessionID Player id + * @returns IItemEventRouterResponse */ - offraidHeal(pmcData: IPmcData, body: IOffraidHealRequestData, sessionID: string): IItemEventRouterResponse; + offraidHeal(pmcData: IPmcData, request: IOffraidHealRequestData, sessionID: string): IItemEventRouterResponse; /** * Handle Eat event * Consume food/water outside of a raid * @param pmcData Player profile - * @param body request Object + * @param request Eat request * @param sessionID Session id * @returns IItemEventRouterResponse */ - offraidEat(pmcData: IPmcData, body: IOffraidEatRequestData, sessionID: string): IItemEventRouterResponse; + offraidEat(pmcData: IPmcData, request: IOffraidEatRequestData, sessionID: string): IItemEventRouterResponse; /** * Handle RestoreHealth event * Occurs on post-raid healing page * @param pmcData player profile * @param healthTreatmentRequest Request data from client * @param sessionID Session id - * @returns + * @returns IItemEventRouterResponse */ healthTreatment(pmcData: IPmcData, healthTreatmentRequest: IHealthTreatmentRequestData, sessionID: string): IItemEventRouterResponse; /** @@ -66,12 +67,4 @@ export declare class HealthController { * @param sessionID */ applyWorkoutChanges(pmcData: IPmcData, info: IWorkoutData, sessionId: string): void; - /** - * Iterate over treatment request diff and find effects to remove from player limbs - * @param sessionId - * @param profile Profile to update - * @param treatmentRequest client request - * @param output response to send to client - */ - protected removeEffectsAfterPostRaidHeal(sessionId: string, profile: IPmcData, treatmentRequest: IHealthTreatmentRequestData, output: IItemEventRouterResponse): void; } diff --git a/TypeScript/9RouterHooks/types/controllers/HideoutController.d.ts b/TypeScript/9RouterHooks/types/controllers/HideoutController.d.ts index 877c076..a90a16d 100644 --- a/TypeScript/9RouterHooks/types/controllers/HideoutController.d.ts +++ b/TypeScript/9RouterHooks/types/controllers/HideoutController.d.ts @@ -88,11 +88,11 @@ export declare class HideoutController { * @param pmcData Profile to edit * @param output Object to send back to client * @param sessionID Session/player id - * @param profileHideoutArea Current hideout data for profile + * @param profileParentHideoutArea Current hideout area for profile * @param dbHideoutArea Hideout area being upgraded * @param hideoutStage Stage hideout area is being upgraded to */ - protected addContainerImprovementToProfile(output: IItemEventRouterResponse, sessionID: string, pmcData: IPmcData, profileHideoutArea: HideoutArea, dbHideoutArea: IHideoutArea, hideoutStage: Stage): void; + protected addContainerImprovementToProfile(output: IItemEventRouterResponse, sessionID: string, pmcData: IPmcData, profileParentHideoutArea: HideoutArea, dbHideoutArea: IHideoutArea, hideoutStage: Stage): void; /** * Add an inventory item to profile from a hideout area stage data * @param pmcData Profile to update diff --git a/TypeScript/9RouterHooks/types/controllers/LocationController.d.ts b/TypeScript/9RouterHooks/types/controllers/LocationController.d.ts index 94d496a..94f5fce 100644 --- a/TypeScript/9RouterHooks/types/controllers/LocationController.d.ts +++ b/TypeScript/9RouterHooks/types/controllers/LocationController.d.ts @@ -4,6 +4,7 @@ import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { ILocationBase } from "../models/eft/common/ILocationBase"; import { ILocationsGenerateAllResponse } from "../models/eft/common/ILocationsSourceDestinationBase"; import { IAirdropLootResult } from "../models/eft/location/IAirdropLootResult"; +import { IGetLocationRequestData } from "../models/eft/location/IGetLocationRequestData"; import { AirdropTypeEnum } from "../models/enums/AirdropType"; import { IAirdropConfig } from "../models/spt/config/IAirdropConfig"; import { ILocationConfig } from "../models/spt/config/ILocationConfig"; @@ -34,10 +35,11 @@ export declare class LocationController { /** * Handle client/location/getLocalloot * Get a location (map) with generated loot data - * @param location Map to generate loot for + * @param sessionId Player id + * @param request Map request to generate * @returns ILocationBase */ - get(location: string): ILocationBase; + get(sessionId: string, request: IGetLocationRequestData): ILocationBase; /** * Generate a maps base location with loot * @param name Map name diff --git a/TypeScript/9RouterHooks/types/controllers/QuestController.d.ts b/TypeScript/9RouterHooks/types/controllers/QuestController.d.ts index 7d494a6..bd8a70f 100644 --- a/TypeScript/9RouterHooks/types/controllers/QuestController.d.ts +++ b/TypeScript/9RouterHooks/types/controllers/QuestController.d.ts @@ -61,7 +61,7 @@ export declare class QuestController { * @param playerLevel level of player to test against quest * @returns true if quest can be seen/accepted by player of defined level */ - protected playerLevelFulfillsQuestRequrement(quest: IQuest, playerLevel: number): boolean; + protected playerLevelFulfillsQuestRequirement(quest: IQuest, playerLevel: number): boolean; /** * Should a quest be shown to the player in trader quest screen * @param questId Quest to check diff --git a/TypeScript/9RouterHooks/types/controllers/RagfairController.d.ts b/TypeScript/9RouterHooks/types/controllers/RagfairController.d.ts index 76c27f7..bda37cd 100644 --- a/TypeScript/9RouterHooks/types/controllers/RagfairController.d.ts +++ b/TypeScript/9RouterHooks/types/controllers/RagfairController.d.ts @@ -21,6 +21,7 @@ import { IGetMarketPriceRequestData } from "../models/eft/ragfair/IGetMarketPric import { IGetOffersResult } from "../models/eft/ragfair/IGetOffersResult"; import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; import { ISearchRequestData } from "../models/eft/ragfair/ISearchRequestData"; +import { IProcessBuyTradeRequestData } from "../models/eft/trade/IProcessBuyTradeRequestData"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; @@ -125,6 +126,18 @@ export declare class RagfairController { * @returns IItemEventRouterResponse */ addPlayerOffer(pmcData: IPmcData, offerRequest: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Charge player a listing fee for using flea, pulls charge from data previously sent by client + * @param sessionID Player id + * @param rootItem Base item being listed (used when client tax cost not found and must be done on server) + * @param pmcData Player profile + * @param requirementsPriceInRub Rouble cost player chose for listing (used when client tax cost not found and must be done on server) + * @param itemStackCount How many items were listed in player (used when client tax cost not found and must be done on server) + * @param offerRequest Add offer request object from client + * @param output IItemEventRouterResponse + * @returns True if charging tax to player failed + */ + protected chargePlayerTaxFee(sessionID: string, rootItem: Item, pmcData: IPmcData, requirementsPriceInRub: number, itemStackCount: number, offerRequest: IAddOfferRequestData, output: IItemEventRouterResponse): boolean; /** * Is the item to be listed on the flea valid * @param offerRequest Client offer request @@ -158,4 +171,11 @@ export declare class RagfairController { */ removeOffer(offerId: string, sessionID: string): IItemEventRouterResponse; extendOffer(info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Create a basic trader request object with price and currency type + * @param currency What currency: RUB, EURO, USD + * @param value Amount of currency + * @returns IProcessBuyTradeRequestData + */ + protected createBuyTradeRequestObject(currency: string, value: number): IProcessBuyTradeRequestData; } diff --git a/TypeScript/9RouterHooks/types/generators/BotEquipmentModGenerator.d.ts b/TypeScript/9RouterHooks/types/generators/BotEquipmentModGenerator.d.ts index ccbbbbf..f7abb84 100644 --- a/TypeScript/9RouterHooks/types/generators/BotEquipmentModGenerator.d.ts +++ b/TypeScript/9RouterHooks/types/generators/BotEquipmentModGenerator.d.ts @@ -14,7 +14,6 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; import { BotEquipmentModPoolService } from "../services/BotEquipmentModPoolService"; import { BotModLimits, BotWeaponModLimitService } from "../services/BotWeaponModLimitService"; -import { ItemBaseClassService } from "../services/ItemBaseClassService"; import { ItemFilterService } from "../services/ItemFilterService"; import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; @@ -29,7 +28,6 @@ export declare class BotEquipmentModGenerator { protected databaseServer: DatabaseServer; protected itemHelper: ItemHelper; protected botEquipmentFilterService: BotEquipmentFilterService; - protected itemBaseClassService: ItemBaseClassService; protected itemFilterService: ItemFilterService; protected profileHelper: ProfileHelper; protected botWeaponModLimitService: BotWeaponModLimitService; @@ -40,7 +38,7 @@ export declare class BotEquipmentModGenerator { protected botEquipmentModPoolService: BotEquipmentModPoolService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, itemHelper: ItemHelper, botEquipmentFilterService: BotEquipmentFilterService, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponModLimitService: BotWeaponModLimitService, botHelper: BotHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, botEquipmentModPoolService: BotEquipmentModPoolService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, itemHelper: ItemHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponModLimitService: BotWeaponModLimitService, botHelper: BotHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, botEquipmentModPoolService: BotEquipmentModPoolService, configServer: ConfigServer); /** * Check mods are compatible and add to array * @param equipment Equipment item to add mods to diff --git a/TypeScript/9RouterHooks/types/generators/LocationGenerator.d.ts b/TypeScript/9RouterHooks/types/generators/LocationGenerator.d.ts index b8169d3..46a514b 100644 --- a/TypeScript/9RouterHooks/types/generators/LocationGenerator.d.ts +++ b/TypeScript/9RouterHooks/types/generators/LocationGenerator.d.ts @@ -65,10 +65,11 @@ export declare class LocationGenerator { protected getGuaranteedContainers(staticContainersOnMap: IStaticContainerData[]): IStaticContainerData[]; /** * Choose a number of containers based on their probabilty value to fulfil the desired count in containerData.chosenCount + * @param groupId Name of the group the containers are being collected for * @param containerData Containers and probability values for a groupId * @returns List of chosen container Ids */ - protected getContainersByProbabilty(containerData: IContainerGroupCount): string[]; + protected getContainersByProbabilty(groupId: string, containerData: IContainerGroupCount): string[]; /** * Get a mapping of each groupid and the containers in that group + count of containers to spawn on map * @param containersGroups Container group values diff --git a/TypeScript/9RouterHooks/types/generators/PMCLootGenerator.d.ts b/TypeScript/9RouterHooks/types/generators/PMCLootGenerator.d.ts index 9acff69..abb5615 100644 --- a/TypeScript/9RouterHooks/types/generators/PMCLootGenerator.d.ts +++ b/TypeScript/9RouterHooks/types/generators/PMCLootGenerator.d.ts @@ -31,12 +31,12 @@ export declare class PMCLootGenerator { */ generatePMCVestLootPool(): string[]; /** - * Check if item has a width/height that lets it fit into a 1x2/2x1 slot - * 1x1 / 1x2 / 2x1 + * Check if item has a width/height that lets it fit into a 2x2 slot + * 1x1 / 1x2 / 2x1 / 2x2 * @param item Item to check size of * @returns true if it fits */ - protected itemFitsInto1By2Slot(item: ITemplateItem): boolean; + protected itemFitsInto2By2Slot(item: ITemplateItem): boolean; /** * Create an array of loot items a PMC can have in their backpack * @returns string array of tpls diff --git a/TypeScript/9RouterHooks/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/9RouterHooks/types/generators/RagfairOfferGenerator.d.ts index a627191..58e0b68 100644 --- a/TypeScript/9RouterHooks/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/9RouterHooks/types/generators/RagfairOfferGenerator.d.ts @@ -55,11 +55,10 @@ export declare class RagfairOfferGenerator { * @param items Items in the offer * @param barterScheme Cost of item (currency or barter) * @param loyalLevel Loyalty level needed to buy item - * @param price Price of offer - * @param sellInOnePiece Set StackObjectsCount to 1 + * @param sellInOnePiece Flags sellInOnePiece to be true * @returns IRagfairOffer */ - createFleaOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; + createFleaOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, sellInOnePiece?: boolean): IRagfairOffer; /** * Create an offer object ready to send to ragfairOfferService.addOffer() * @param userID Owner of the offer @@ -67,17 +66,16 @@ export declare class RagfairOfferGenerator { * @param items Items in the offer * @param barterScheme Cost of item (currency or barter) * @param loyalLevel Loyalty level needed to buy item - * @param price Price of offer * @param sellInOnePiece Set StackObjectsCount to 1 * @returns IRagfairOffer */ - protected createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; + protected createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, sellInOnePiece?: boolean): IRagfairOffer; /** * Calculate the offer price that's listed on the flea listing * @param offerRequirements barter requirements for offer * @returns rouble cost of offer */ - protected calculateOfferListingPrice(offerRequirements: OfferRequirement[]): number; + protected convertOfferRequirementsIntoRoubles(offerRequirements: OfferRequirement[]): number; /** * Get avatar url from trader table in db * @param isTrader Is user we're getting avatar for a trader @@ -137,7 +135,7 @@ export declare class RagfairOfferGenerator { * @param itemDetails raw db item details * @returns Item array */ - protected createSingleOfferForItem(items: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; + protected createSingleOfferForItem(items: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise; /** * Generate trader offers on flea using the traders assort data * @param traderID Trader to generate offers for @@ -151,7 +149,7 @@ export declare class RagfairOfferGenerator { * @param itemDetails db details of first item * @returns */ - protected getItemCondition(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): Item[]; + protected randomiseItemUpdProperties(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): Item[]; /** * Get the relevant condition id if item tpl matches in ragfair.json/condition * @param tpl Item to look for matching condition object @@ -184,7 +182,7 @@ export declare class RagfairOfferGenerator { * @param offerItems Items for sale in offer * @returns Barter scheme */ - protected createBarterRequirement(offerItems: Item[]): IBarterScheme[]; + protected createBarterBarterScheme(offerItems: Item[]): IBarterScheme[]; /** * Get an array of flea prices + item tpl, cached in generator class inside `allowedFleaPriceItemsForBarter` * @returns array with tpl/price values @@ -196,7 +194,9 @@ export declare class RagfairOfferGenerator { /** * Create a random currency-based barter scheme for an array of items * @param offerItems Items on offer + * @param isPackOffer Is the barter scheme being created for a pack offer + * @param multipler What to multiply the resulting price by * @returns Barter scheme for offer */ - protected createCurrencyRequirement(offerItems: Item[]): IBarterScheme[]; + protected createCurrencyBarterScheme(offerItems: Item[], isPackOffer: boolean, multipler?: number): IBarterScheme[]; } diff --git a/TypeScript/9RouterHooks/types/generators/ScavCaseRewardGenerator.d.ts b/TypeScript/9RouterHooks/types/generators/ScavCaseRewardGenerator.d.ts index 4ba1888..b5935d0 100644 --- a/TypeScript/9RouterHooks/types/generators/ScavCaseRewardGenerator.d.ts +++ b/TypeScript/9RouterHooks/types/generators/ScavCaseRewardGenerator.d.ts @@ -25,6 +25,8 @@ export declare class ScavCaseRewardGenerator { protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected scavCaseConfig: IScavCaseConfig; + protected dbItemsCache: ITemplateItem[]; + protected dbAmmoItemsCache: ITemplateItem[]; constructor(logger: ILogger, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * Create an array of rewards that will be given to the player upon completing their scav case build @@ -33,10 +35,10 @@ export declare class ScavCaseRewardGenerator { */ generate(recipeId: string): Product[]; /** - * Get all db items that are not blacklisted in scavcase config - * @returns filtered array of db items + * Get all db items that are not blacklisted in scavcase config or global blacklist + * Store in class field */ - protected getDbItems(): ITemplateItem[]; + protected cacheDbItems(): void; /** * Pick a number of items to be rewards, the count is defined by the values in * @param items item pool to pick rewards from diff --git a/TypeScript/9RouterHooks/types/generators/WeatherGenerator.d.ts b/TypeScript/9RouterHooks/types/generators/WeatherGenerator.d.ts index 2e2403c..6471bb1 100644 --- a/TypeScript/9RouterHooks/types/generators/WeatherGenerator.d.ts +++ b/TypeScript/9RouterHooks/types/generators/WeatherGenerator.d.ts @@ -52,6 +52,7 @@ export declare class WeatherGenerator { */ protected setCurrentDateTime(weather: IWeather): void; protected getWeightedWindDirection(): WindDirection; + protected getWeightedClouds(): number; protected getWeightedWindSpeed(): number; protected getWeightedFog(): number; protected getWeightedRain(): number; diff --git a/TypeScript/9RouterHooks/types/helpers/HealthHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/HealthHelper.d.ts index 3694a6e..e4cdcd6 100644 --- a/TypeScript/9RouterHooks/types/helpers/HealthHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/HealthHelper.d.ts @@ -27,6 +27,7 @@ export declare class HealthHelper { * @param request Heal request * @param sessionID Session id * @param addEffects Should effects be added or removed (default - add) + * @param deleteExistingEffects Should all prior effects be removed before apply new ones */ saveVitality(pmcData: IPmcData, request: ISyncHealthRequestData, sessionID: string, addEffects?: boolean, deleteExistingEffects?: boolean): void; /** diff --git a/TypeScript/9RouterHooks/types/helpers/InRaidHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/InRaidHelper.d.ts index bf584c2..b4c0c1c 100644 --- a/TypeScript/9RouterHooks/types/helpers/InRaidHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/InRaidHelper.d.ts @@ -53,7 +53,7 @@ export declare class InRaidHelper { * @param victim Who was killed by player * @returns a numerical standing gain or loss */ - protected getStandingChangeForKill(victim: Victim): number; + protected getFenceStandingChangeForKillAsScav(victim: Victim): number; /** * Reset a profile to a baseline, used post-raid * Reset points earned during session property diff --git a/TypeScript/9RouterHooks/types/helpers/ItemHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/ItemHelper.d.ts index 99fca56..00f190f 100644 --- a/TypeScript/9RouterHooks/types/helpers/ItemHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/ItemHelper.d.ts @@ -26,6 +26,7 @@ declare class ItemHelper { protected itemBaseClassService: ItemBaseClassService; protected localisationService: LocalisationService; protected localeService: LocaleService; + protected readonly defaultInvalidBaseTypes: string[]; constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, localisationService: LocalisationService, localeService: LocaleService); /** * Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash @@ -67,6 +68,11 @@ declare class ItemHelper { * @returns Price in roubles (undefined if not found) */ getDynamicItemPrice(tpl: string): number; + /** + * Update items upd.StackObjectsCount to be 1 if its upd is missing or StackObjectsCount is undefined + * @param item Item to update + * @returns Fixed item + */ fixItemStackCount(item: Item): Item; /** * AmmoBoxes contain StackSlots which need to be filled for the AmmoBox to have content. @@ -125,19 +131,19 @@ declare class ItemHelper { getItemQualityModifier(item: Item): number; /** * Get a quality value based on a repairable items (weapon/armor) current state between current and max durability - * @param itemDetails - * @param repairable repairable object - * @param item - * @returns a number between 0 and 1 + * @param itemDetails Db details for item we want quality value for + * @param repairable Repairable properties + * @param item Item quality value is for + * @returns A number between 0 and 1 */ protected getRepairableItemQualityValue(itemDetails: ITemplateItem, repairable: Repairable, item: Item): number; /** * Recursive function that looks at every item from parameter and gets their childrens Ids + includes parent item in results - * @param items - * @param itemID + * @param items Array of items (item + possible children) + * @param itemId Parent items id * @returns an array of strings */ - findAndReturnChildrenByItems(items: Item[], itemID: string): string[]; + findAndReturnChildrenByItems(items: Item[], itemId: string): string[]; /** * A variant of findAndReturnChildren where the output is list of item objects instead of their ids. * @param items @@ -164,12 +170,6 @@ declare class ItemHelper { * @returns true if it is a dogtag */ isDogtag(tpl: string): boolean; - /** - * Can the item passed in be sold to a trader because it is raw money - * @param tpl Item template id to check - * @returns true if unsellable - */ - isNotSellable(tpl: string): boolean; /** * Gets the identifier for a child using slotId, locationX and locationY. * @param item @@ -183,19 +183,19 @@ declare class ItemHelper { */ isItemTplStackable(tpl: string): boolean; /** - * split item stack if it exceeds its StackMaxSize property - * @param itemToSplit item being split into smaller stacks + * split item stack if it exceeds its items StackMaxSize property + * @param itemToSplit Item to split into smaller stacks * @returns Array of split items */ splitStack(itemToSplit: Item): Item[]; /** - * Find Barter items in the inventory + * Find Barter items from array of items * @param {string} by tpl or id - * @param {Object} pmcData + * @param {Item[]} items Array of items to iterate over * @param {string} barterItemId * @returns Array of Item objects */ - findBarterItems(by: "tpl" | "id", pmcData: IPmcData, barterItemId: string): Item[]; + findBarterItems(by: "tpl" | "id", items: Item[], barterItemId: string): Item[]; /** * Regenerate all guids with new ids, exceptions are for items that cannot be altered (e.g. stash/sorting table) * @param pmcData Player profile @@ -262,10 +262,21 @@ declare class ItemHelper { * @param minSizePercent % the magazine must be filled to */ fillMagazineWithCartridge(magazine: Item[], magTemplate: ITemplateItem, cartridgeTpl: string, minSizePercent?: number): void; + /** + * Choose a random bullet type from the list of possible a magazine has + * @param magTemplate Magazine template from Db + * @returns Tpl of cartridge + */ protected getRandomValidCaliber(magTemplate: ITemplateItem): string; + /** + * Chose a randomly weighted cartridge that fits + * @param caliber Desired caliber + * @param staticAmmoDist Cartridges and thier weights + * @returns Tpl of cartrdige + */ protected drawAmmoTpl(caliber: string, staticAmmoDist: Record): string; /** - * + * Create a basic cartrige object * @param parentId container cartridges will be placed in * @param ammoTpl Cartridge to insert * @param stackCount Count of cartridges inside parent diff --git a/TypeScript/9RouterHooks/types/helpers/QuestHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/QuestHelper.d.ts index e04b6e0..5c749d3 100644 --- a/TypeScript/9RouterHooks/types/helpers/QuestHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/QuestHelper.d.ts @@ -21,6 +21,7 @@ import { DialogueHelper } from "./DialogueHelper"; import { ItemHelper } from "./ItemHelper"; import { PaymentHelper } from "./PaymentHelper"; import { ProfileHelper } from "./ProfileHelper"; +import { QuestConditionHelper } from "./QuestConditionHelper"; import { RagfairServerHelper } from "./RagfairServerHelper"; import { TraderHelper } from "./TraderHelper"; export declare class QuestHelper { @@ -29,6 +30,7 @@ export declare class QuestHelper { protected timeUtil: TimeUtil; protected hashUtil: HashUtil; protected itemHelper: ItemHelper; + protected questConditionHelper: QuestConditionHelper; protected eventOutputHolder: EventOutputHolder; protected databaseServer: DatabaseServer; protected localeService: LocaleService; @@ -41,7 +43,7 @@ export declare class QuestHelper { protected mailSendService: MailSendService; protected configServer: ConfigServer; 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, mailSendService: MailSendService, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, questConditionHelper: QuestConditionHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, mailSendService: MailSendService, configServer: ConfigServer); /** * Get status of a quest in player profile by its id * @param pmcData Profile to search @@ -119,7 +121,7 @@ export declare class QuestHelper { * @param sessionID Session id * @returns Quests accessible to player incuding newly unlocked quests now quest (startedQuestId) was started */ - acceptedUnlocked(startedQuestId: string, sessionID: string): IQuest[]; + getNewlyAccessibleQuestsWhenStartingQuest(startedQuestId: string, sessionID: string): IQuest[]; /** * Get quests that can be shown to player after failing a quest * @param failedQuestId Id of the quest failed by player diff --git a/TypeScript/9RouterHooks/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/RagfairOfferHelper.d.ts index de9d550..0699259 100644 --- a/TypeScript/9RouterHooks/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/RagfairOfferHelper.d.ts @@ -1,4 +1,5 @@ import { IPmcData } from "../models/eft/common/IPmcData"; +import { Item } from "../models/eft/common/tables/IItem"; import { ITraderAssort } from "../models/eft/common/tables/ITrader"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; @@ -13,10 +14,10 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { LocaleService } from "../services/LocaleService"; import { LocalisationService } from "../services/LocalisationService"; +import { MailSendService } from "../services/MailSendService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { HashUtil } from "../utils/HashUtil"; import { TimeUtil } from "../utils/TimeUtil"; -import { DialogueHelper } from "./DialogueHelper"; import { ItemHelper } from "./ItemHelper"; import { PaymentHelper } from "./PaymentHelper"; import { PresetHelper } from "./PresetHelper"; @@ -33,7 +34,6 @@ export declare class RagfairOfferHelper { protected databaseServer: DatabaseServer; protected traderHelper: TraderHelper; protected saveServer: SaveServer; - protected dialogueHelper: DialogueHelper; protected itemHelper: ItemHelper; protected paymentHelper: PaymentHelper; protected presetHelper: PresetHelper; @@ -44,11 +44,12 @@ export declare class RagfairOfferHelper { protected ragfairOfferService: RagfairOfferService; protected localeService: LocaleService; protected localisationService: LocalisationService; + protected mailSendService: MailSendService; protected configServer: ConfigServer; protected static goodSoldTemplate: string; protected ragfairConfig: IRagfairConfig; 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, localisationService: LocalisationService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, localisationService: LocalisationService, mailSendService: MailSendService, configServer: ConfigServer); /** * Passthrough to ragfairOfferService.getOffers(), get flea offers a player should see * @param searchRequest Data from client @@ -119,19 +120,26 @@ export declare class RagfairOfferHelper { */ protected getProfileOffers(sessionID: string): IRagfairOffer[]; /** - * Delete an offer from a desired profile + * Delete an offer from a desired profile and from ragfair offers * @param sessionID Session id of profile to delete offer from - * @param offerId Offer id to delete + * @param offerId Id of offer to delete */ - protected deleteOfferByOfferId(sessionID: string, offerId: string): void; + protected deleteOfferById(sessionID: string, offerId: string): void; /** * Complete the selling of players' offer * @param sessionID Session id * @param offer Sold offer details * @param boughtAmount Amount item was purchased for - * @returns Client response + * @returns IItemEventRouterResponse */ protected completeOffer(sessionID: string, offer: IRagfairOffer, boughtAmount: number): IItemEventRouterResponse; + /** + * Get a localised message for when players offer has sold on flea + * @param itemTpl Item sold + * @param boughtAmount How many were purchased + * @returns Localised message text + */ + protected getLocalisedOfferSoldMessage(itemTpl: string, boughtAmount: number): string; /** * Should a ragfair offer be visible to the player * @param searchRequest Search request @@ -142,4 +150,12 @@ export declare class RagfairOfferHelper { * @returns True = should be shown to player */ isDisplayableOffer(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record, offer: IRagfairOffer, pmcProfile: IPmcData): boolean; + /** + * Is items quality value within desired range + * @param item Item to check quality of + * @param min Desired minimum quality + * @param max Desired maximum quality + * @returns True if in range + */ + protected itemQualityInRange(item: Item, min: number, max: number): boolean; } diff --git a/TypeScript/9RouterHooks/types/helpers/RagfairSellHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/RagfairSellHelper.d.ts index 251d7ca..913b408 100644 --- a/TypeScript/9RouterHooks/types/helpers/RagfairSellHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/RagfairSellHelper.d.ts @@ -13,12 +13,12 @@ export declare class RagfairSellHelper { constructor(logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, configServer: ConfigServer); /** * Get the percent chance to sell an item based on its average listed price vs player chosen listing price - * @param baseChancePercent Base chance to sell item * @param averageOfferPriceRub Price of average offer in roubles * @param playerListedPriceRub Price player listed item for in roubles + * @param qualityMultiplier Quality multipler of item being sold * @returns percent value */ - calculateSellChance(baseChancePercent: number, averageOfferPriceRub: number, playerListedPriceRub: number): number; + calculateSellChance(averageOfferPriceRub: number, playerListedPriceRub: number, qualityMultiplier: number): number; /** * Get percent chance to sell an item when price is below items average listing price * @param playerListedPriceRub Price player listed item for in roubles diff --git a/TypeScript/9RouterHooks/types/helpers/TraderHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/TraderHelper.d.ts index c163f7a..6680ccf 100644 --- a/TypeScript/9RouterHooks/types/helpers/TraderHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/TraderHelper.d.ts @@ -35,7 +35,7 @@ export declare class TraderHelper { protected highestTraderBuyPriceItems: Record; constructor(logger: ILogger, databaseServer: DatabaseServer, saveServer: SaveServer, profileHelper: ProfileHelper, handbookHelper: HandbookHelper, itemHelper: ItemHelper, playerService: PlayerService, localisationService: LocalisationService, fenceService: FenceService, timeUtil: TimeUtil, randomUtil: RandomUtil, configServer: ConfigServer); getTrader(traderID: string, sessionID: string): ITraderBase; - getTraderAssortsById(traderId: string): ITraderAssort; + getTraderAssortsByTraderId(traderId: string): ITraderAssort; /** * 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 diff --git a/TypeScript/9RouterHooks/types/models/eft/common/tables/IBotBase.d.ts b/TypeScript/9RouterHooks/types/models/eft/common/tables/IBotBase.d.ts index ee40958..6c7b76f 100644 --- a/TypeScript/9RouterHooks/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/9RouterHooks/types/models/eft/common/tables/IBotBase.d.ts @@ -281,7 +281,7 @@ export interface InsuredItem { export interface Hideout { Production: Record; Areas: HideoutArea[]; - Improvements: Record; + Improvement: Record; Seed: number; sptUpdateLastRunTimestamp: number; } diff --git a/TypeScript/9RouterHooks/types/models/eft/health/IHealthTreatmentRequestData.d.ts b/TypeScript/9RouterHooks/types/models/eft/health/IHealthTreatmentRequestData.d.ts index 7fb80a8..598e60c 100644 --- a/TypeScript/9RouterHooks/types/models/eft/health/IHealthTreatmentRequestData.d.ts +++ b/TypeScript/9RouterHooks/types/models/eft/health/IHealthTreatmentRequestData.d.ts @@ -1,12 +1,14 @@ export interface IHealthTreatmentRequestData { Action: "RestoreHealth"; trader: string; - items: Item[]; + items: Cost[]; difference: Difference; timestamp: number; } -export interface Item { +export interface Cost { + /** Id of stack to take money from */ id: string; + /** Amount of money to take off player for treatment */ count: number; } export interface Difference { @@ -25,5 +27,6 @@ export interface BodyParts { } export interface BodyPart { Health: number; + /** Effects in array are to be removed */ Effects: string[]; } diff --git a/TypeScript/9RouterHooks/types/models/eft/notifier/INotifier.d.ts b/TypeScript/9RouterHooks/types/models/eft/notifier/INotifier.d.ts index ce25dee..c6c6979 100644 --- a/TypeScript/9RouterHooks/types/models/eft/notifier/INotifier.d.ts +++ b/TypeScript/9RouterHooks/types/models/eft/notifier/INotifier.d.ts @@ -14,6 +14,11 @@ export interface INotification { } export declare enum NotificationType { RAGFAIR_OFFER_SOLD = "RagfairOfferSold", + RAGFAIR_RATING_CHANGE = "RagfairRatingChange", + /** ChatMessageReceived */ NEW_MESSAGE = "new_message", - PING = "ping" + PING = "ping", + TRADER_SUPPLY = "TraderSupply", + TRADER_STANDING = "TraderStanding", + UNLOCK_TRADER = "UnlockTrader" } diff --git a/TypeScript/9RouterHooks/types/models/eft/notifier/ISelectProfileResponse.d.ts b/TypeScript/9RouterHooks/types/models/eft/notifier/ISelectProfileResponse.d.ts index ecb668a..f2d6be7 100644 --- a/TypeScript/9RouterHooks/types/models/eft/notifier/ISelectProfileResponse.d.ts +++ b/TypeScript/9RouterHooks/types/models/eft/notifier/ISelectProfileResponse.d.ts @@ -1,6 +1,3 @@ -import { INotifierChannel } from "./INotifier"; export interface ISelectProfileResponse { status: string; - notifier: INotifierChannel; - notifierServer: string; } diff --git a/TypeScript/9RouterHooks/types/models/enums/WeatherType.d.ts b/TypeScript/9RouterHooks/types/models/enums/WeatherType.d.ts index d31fefe..503dc30 100644 --- a/TypeScript/9RouterHooks/types/models/enums/WeatherType.d.ts +++ b/TypeScript/9RouterHooks/types/models/enums/WeatherType.d.ts @@ -1,19 +1,19 @@ export declare enum WeatherType { - CLEAR_DAY = 1, - CLEAR_WIND = 2, - CLEAR_NIGHT = 3, - PARTLY_CLOUD_DAY = 4, - PARTLY_CLOUD_NIGHT = 5, - CLEAR_FOG_DAY = 6, - CLEAR_FOG_NIGHT = 7, - CLOUDFOG = 8, - FOG = 9, - MOSTLY_CLOUD = 10, - LIGHT_RAIN = 11, - RAIN = 12, - CLOUD_WIND = 13, - CLOUD_WIND_RAIN = 14, - FULL_CLOUD = 15, - THUNDER_CLOUD = 16, - NONE = 0 + CLEAR_DAY = 0, + CLEAR_WIND = 1, + CLEAR_NIGHT = 2, + PARTLY_CLOUD_DAY = 3, + PARTLY_CLOUD_NIGHT = 4, + CLEAR_FOG_DAY = 5, + CLEAR_FOG_NIGHT = 6, + CLOUD_FOG = 7, + FOG = 8, + MOSTLY_CLOUD = 9, + LIGHT_RAIN = 10, + RAIN = 11, + CLOUD_WIND = 12, + CLOUD_WIND_RAIN = 13, + FULL_CLOUD = 14, + THUNDER_CLOUD = 15, + NONE = 16 } diff --git a/TypeScript/9RouterHooks/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/9RouterHooks/types/models/spt/config/IRagfairConfig.d.ts index 7c04857..7aea24f 100644 --- a/TypeScript/9RouterHooks/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/9RouterHooks/types/models/spt/config/IRagfairConfig.d.ts @@ -41,7 +41,8 @@ export interface Dynamic { /** Use the highest trader price for an offer if its greater than the price in templates/prices.json */ useTraderPriceForOffersIfHigher: boolean; /** Barter offer specific settings */ - barter: Barter; + barter: IBarterDetails; + pack: IPackDetails; /** Dynamic offer price below handbook adjustment values */ offerAdjustment: OfferAdjustment; /** How many offers should expire before an offer regeneration occurs */ @@ -49,9 +50,7 @@ export interface Dynamic { /** How many offers should be listed */ offerItemCount: MinMax; /** How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) */ - price: MinMax; - /** How much should the price of an offer vary by (percent 0.8 = 80%, 1.2 = 120%) */ - presetPrice: MinMax; + priceRanges: IPriceRanges; /** Should default presets to listed only or should non-standard presets found in globals.json be listed too */ showDefaultPresetsOnly: boolean; endTimeSeconds: MinMax; @@ -74,7 +73,12 @@ export interface Dynamic { /** Dict of price limits keyed by item type */ unreasonableModPrices: Record; } -export interface Barter { +export interface IPriceRanges { + default: MinMax; + preset: MinMax; + pack: MinMax; +} +export interface IBarterDetails { /** Should barter offers be generated */ enable: boolean; /** Percentage change an offer is listed as a barter */ @@ -90,6 +94,18 @@ export interface Barter { /** Item Tpls to never be turned into a barter */ itemTypeBlacklist: string[]; } +export interface IPackDetails { + /** Should pack offers be generated */ + enable: boolean; + /** Percentage change an offer is listed as a pack */ + chancePercent: number; + /** Min number of required items for a pack */ + itemCountMin: number; + /** Max number of required items for a pack */ + itemCountMax: number; + /** item types to allow being a pack */ + itemTypeWhitelist: string[]; +} export interface OfferAdjustment { /** Shuld offer price be adjusted when below handbook price */ adjustPriceWhenBelowHandbookPrice: boolean; diff --git a/TypeScript/9RouterHooks/types/models/spt/config/IWeatherConfig.d.ts b/TypeScript/9RouterHooks/types/models/spt/config/IWeatherConfig.d.ts index 41a1c83..6ecf35b 100644 --- a/TypeScript/9RouterHooks/types/models/spt/config/IWeatherConfig.d.ts +++ b/TypeScript/9RouterHooks/types/models/spt/config/IWeatherConfig.d.ts @@ -7,7 +7,7 @@ export interface IWeatherConfig extends IBaseConfig { weather: Weather; } export interface Weather { - clouds: MinMax; + clouds: WeatherSettings; windSpeed: WeatherSettings; windDirection: WeatherSettings; windGustiness: MinMax; diff --git a/TypeScript/9RouterHooks/types/services/HashCacheService.d.ts b/TypeScript/9RouterHooks/types/services/HashCacheService.d.ts index 5320f28..9968478 100644 --- a/TypeScript/9RouterHooks/types/services/HashCacheService.d.ts +++ b/TypeScript/9RouterHooks/types/services/HashCacheService.d.ts @@ -11,7 +11,18 @@ export declare class HashCacheService { protected modHashes: any; protected readonly modCachePath = "./user/cache/modCache.json"; constructor(vfs: VFS, hashUtil: HashUtil, jsonUtil: JsonUtil, logger: ILogger); + /** + * Return a stored hash by key + * @param modName Name of mod to get hash for + * @returns Mod hash + */ getStoredModHash(modName: string): string; + /** + * Does the generated hash match the stored hash + * @param modName name of mod + * @param modContent + * @returns True if they match + */ modContentMatchesStoredHash(modName: string, modContent: string): boolean; hashMatchesStoredHash(modName: string, modHash: string): boolean; storeModContent(modName: string, modContent: string): void; diff --git a/TypeScript/9RouterHooks/types/services/MailSendService.d.ts b/TypeScript/9RouterHooks/types/services/MailSendService.d.ts index 19397dc..fe4a7fe 100644 --- a/TypeScript/9RouterHooks/types/services/MailSendService.d.ts +++ b/TypeScript/9RouterHooks/types/services/MailSendService.d.ts @@ -35,7 +35,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendDirectNpcMessageToPlayer(playerId: string, sender: Traders, messageType: MessageType, message: string, items?: Item[], maxStorageTimeSeconds?: any): void; + sendDirectNpcMessageToPlayer(playerId: string, sender: Traders, messageType: MessageType, message: string, items?: Item[], maxStorageTimeSeconds?: any, systemData?: any, ragfair?: any): void; /** * Send a message from an NPC (e.g. prapor) to the player with or without items * @param playerId Players id to send message to @@ -45,7 +45,7 @@ export declare class MailSendService { * @param items Optional items to send to player * @param maxStorageTimeSeconds Optional time to collect items before they expire */ - sendLocalisedNpcMessageToPlayer(playerId: string, sender: Traders, messageType: MessageType, messageLocaleId: string, items?: Item[], maxStorageTimeSeconds?: any, systemData?: any): void; + sendLocalisedNpcMessageToPlayer(playerId: string, sender: Traders, messageType: MessageType, messageLocaleId: string, items?: Item[], maxStorageTimeSeconds?: any, systemData?: any, ragfair?: any): void; /** * Send a message from SYSTEM to the player with or without items * @param playerId Players id to send message to diff --git a/TypeScript/9RouterHooks/types/services/MatchBotDetailsCacheService.d.ts b/TypeScript/9RouterHooks/types/services/MatchBotDetailsCacheService.d.ts index eb365dd..c1bd322 100644 --- a/TypeScript/9RouterHooks/types/services/MatchBotDetailsCacheService.d.ts +++ b/TypeScript/9RouterHooks/types/services/MatchBotDetailsCacheService.d.ts @@ -1,7 +1,7 @@ import { IBotBase } from "../models/eft/common/tables/IBotBase"; import { ILogger } from "../models/spt/utils/ILogger"; import { LocalisationService } from "./LocalisationService"; -/** Cache bots in a dictionary, keyed by the bots name, keying by name isnt idea as its not unique but this is used by the post-raid system which doesnt have any bot ids, only name */ +/** Cache bots in a dictionary, keyed by the bots name, keying by name isnt ideal as its not unique but this is used by the post-raid system which doesnt have any bot ids, only name */ export declare class MatchBotDetailsCacheService { protected logger: ILogger; protected localisationService: LocalisationService; @@ -17,9 +17,9 @@ export declare class MatchBotDetailsCacheService { */ clearCache(): void; /** - * Find a bot in the cache by its name + * Find a bot in the cache by its name and side * @param botName Name of bot to find * @returns Bot details */ - getBotByName(botName: string): IBotBase; + getBotByNameAndSide(botName: string, botSide: string): IBotBase; } diff --git a/TypeScript/9RouterHooks/types/services/ModCompilerService.d.ts b/TypeScript/9RouterHooks/types/services/ModCompilerService.d.ts index a4bf3c8..e306177 100644 --- a/TypeScript/9RouterHooks/types/services/ModCompilerService.d.ts +++ b/TypeScript/9RouterHooks/types/services/ModCompilerService.d.ts @@ -1,14 +1,36 @@ import { CompilerOptions } from "typescript"; import type { ILogger } from "../models/spt/utils/ILogger"; -import { HashCacheService } from "./HashCacheService"; import { VFS } from "../utils/VFS"; +import { HashCacheService } from "./HashCacheService"; export declare class ModCompilerService { protected logger: ILogger; protected hashCacheService: HashCacheService; protected vfs: VFS; constructor(logger: ILogger, hashCacheService: HashCacheService, vfs: VFS); + /** + * Convert a mods TS into JS + * @param modName Name of mod + * @param modPath Dir path to mod + * @param modTypeScriptFiles + * @returns + */ compileMod(modName: string, modPath: string, modTypeScriptFiles: string[]): Promise; + /** + * Convert a TS file into JS + * @param fileNames Paths to TS files + * @param options Compiler options + */ protected compile(fileNames: string[], options: CompilerOptions): Promise; + /** + * Do the files at the provided paths exist + * @param fileNames + * @returns + */ protected areFilesReady(fileNames: string[]): boolean; + /** + * Wait the provided number of milliseconds + * @param ms Milliseconds + * @returns + */ protected delay(ms: number): Promise; } diff --git a/TypeScript/9RouterHooks/types/services/PaymentService.d.ts b/TypeScript/9RouterHooks/types/services/PaymentService.d.ts index 1c9c32b..fb5f92c 100644 --- a/TypeScript/9RouterHooks/types/services/PaymentService.d.ts +++ b/TypeScript/9RouterHooks/types/services/PaymentService.d.ts @@ -61,23 +61,26 @@ export declare class PaymentService { * Get all money stacks in inventory and prioritse items in stash * @param pmcData * @param currencyTpl + * @param playerStashId Players stash id * @returns Sorting money items */ - protected getSortedMoneyItemsInInventory(pmcData: IPmcData, currencyTpl: string): Item[]; + protected getSortedMoneyItemsInInventory(pmcData: IPmcData, currencyTpl: string, playerStashId: string): Item[]; /** * Prioritise player stash first over player inventory * Post-raid healing would often take money out of the players pockets/secure container * @param a First money stack item * @param b Second money stack item * @param inventoryItems players inventory items + * @param playerStashId Players stash id * @returns sort order */ - protected prioritiseStashSort(a: Item, b: Item, inventoryItems: Item[]): number; + protected prioritiseStashSort(a: Item, b: Item, inventoryItems: Item[], playerStashId: string): number; /** * Recursivly check items parents to see if it is inside the players inventory, not stash * @param itemId item id to check * @param inventoryItems player inventory + * @param playerStashId Players stash id * @returns true if its in inventory */ - protected isInInventory(itemId: string, inventoryItems: Item[]): boolean; + protected isInStash(itemId: string, inventoryItems: Item[], playerStashId: string): boolean; } diff --git a/TypeScript/9RouterHooks/types/services/ProfileFixerService.d.ts b/TypeScript/9RouterHooks/types/services/ProfileFixerService.d.ts index c8232fc..bc1e42e 100644 --- a/TypeScript/9RouterHooks/types/services/ProfileFixerService.d.ts +++ b/TypeScript/9RouterHooks/types/services/ProfileFixerService.d.ts @@ -14,6 +14,7 @@ import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; import { Watermark } from "../utils/Watermark"; import { LocalisationService } from "./LocalisationService"; @@ -27,17 +28,19 @@ export declare class ProfileFixerService { protected itemHelper: ItemHelper; protected localisationService: LocalisationService; protected timeUtil: TimeUtil; + protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected configServer: ConfigServer; protected coreConfig: ICoreConfig; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, profileHelper: ProfileHelper, itemHelper: ItemHelper, localisationService: LocalisationService, timeUtil: TimeUtil, databaseServer: DatabaseServer, configServer: ConfigServer); + constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, profileHelper: ProfileHelper, itemHelper: ItemHelper, localisationService: LocalisationService, timeUtil: TimeUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, configServer: ConfigServer); /** * 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; protected addMissingGunStandContainerImprovements(pmcProfile: IPmcData): void; + protected ensureGunStandLevelsMatch(pmcProfile: IPmcData): void; protected addHideoutAreaStashes(pmcProfile: IPmcData): void; protected addMissingHideoutWallAreas(pmcProfile: IPmcData): void; protected adjustUnreasonableModFleaPrices(): void; @@ -131,4 +134,9 @@ export declare class ProfileFixerService { * @param pmcProfile Profile to add missing IDs to */ addMissingIdsToBonuses(pmcProfile: IPmcData): void; + /** + * At some point the property name was changed,migrate data across to new name + * @param pmcProfile + */ + protected migrateImprovements(pmcProfile: IPmcData): void; } diff --git a/TypeScript/9RouterHooks/types/services/RagfairPriceService.d.ts b/TypeScript/9RouterHooks/types/services/RagfairPriceService.d.ts index e245efa..ff35327 100644 --- a/TypeScript/9RouterHooks/types/services/RagfairPriceService.d.ts +++ b/TypeScript/9RouterHooks/types/services/RagfairPriceService.d.ts @@ -3,6 +3,7 @@ import { HandbookHelper } from "../helpers/HandbookHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { TraderHelper } from "../helpers/TraderHelper"; +import { MinMax } from "../models/common/MinMax"; import { IPreset } from "../models/eft/common/IGlobals"; import { Item } from "../models/eft/common/tables/IItem"; import { IBarterScheme } from "../models/eft/common/tables/ITrader"; @@ -35,10 +36,6 @@ export declare class RagfairPriceService implements OnLoad { * Generate static (handbook) and dynamic (prices.json) flea prices, store inside class as dictionaries */ onLoad(): Promise; - /** - * Add placeholder values for items missing from handbook - */ - protected addMissingHandbookPrices(): void; getRoute(): string; /** * Iterate over all items of type "Item" in db and get template price, store in cache @@ -91,9 +88,17 @@ export declare class RagfairPriceService implements OnLoad { * Generate a currency cost for an item and its mods * @param items Item with mods to get price for * @param desiredCurrency Currency price desired in + * @param isPackOffer Price is for a pack type offer * @returns cost of item in desired currency */ - getDynamicOfferPrice(items: Item[], desiredCurrency: string): number; + getDynamicOfferPriceForOffer(items: Item[], desiredCurrency: string, isPackOffer: boolean): number; + /** + * Get different min/max price multipliers for different offer types (preset/pack/default) + * @param isPreset Offer is a preset + * @param isPack Offer is a pack + * @returns MinMax values + */ + protected getOfferTypeRangeValues(isPreset: boolean, isPack: boolean): MinMax; /** * Check to see if an items price is below its handbook price and adjust accoring to values set to config/ragfair.json * @param itemPrice price of item @@ -104,10 +109,10 @@ export declare class RagfairPriceService implements OnLoad { /** * Multiply the price by a randomised curve where n = 2, shift = 2 * @param existingPrice price to alter - * @param isPreset is the item we're multiplying a preset + * @param rangeValues min and max to adjust price by * @returns multiplied price */ - protected randomisePrice(existingPrice: number, isPreset: boolean): number; + protected randomiseOfferPrice(existingPrice: number, rangeValues: MinMax): number; /** * Calculate the cost of a weapon preset by adding together the price of its mods + base price of default weapon preset * @param item base weapon