diff --git a/TypeScript/13AddTrader/types/controllers/InventoryController.d.ts b/TypeScript/13AddTrader/types/controllers/InventoryController.d.ts index cf8d81a..09c130c 100644 --- a/TypeScript/13AddTrader/types/controllers/InventoryController.d.ts +++ b/TypeScript/13AddTrader/types/controllers/InventoryController.d.ts @@ -63,6 +63,12 @@ export declare class InventoryController { * @returns IItemEventRouterResponse */ moveItem(pmcData: IPmcData, moveRequest: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Get a event router response with inventory trader message + * @param output Item event router response + * @returns Item event router response + */ + protected getTraderExploitErrorResponse(output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Remove Item from Profile * Deep tree item deletion, also removes items from insurance list diff --git a/TypeScript/13AddTrader/types/generators/BotLootGenerator.d.ts b/TypeScript/13AddTrader/types/generators/BotLootGenerator.d.ts index c847d4d..6f2f6ec 100644 --- a/TypeScript/13AddTrader/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/13AddTrader/types/generators/BotLootGenerator.d.ts @@ -64,6 +64,7 @@ export declare class BotLootGenerator { */ protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): void; /** + * @deprecated replaced by getRandomItemFromPoolByRole() * Get a random item from the pool parameter using the biasedRandomNumber system * @param pool pool of items to pick an item from * @param isPmc is the bot being created a pmc @@ -71,11 +72,25 @@ export declare class BotLootGenerator { */ protected getRandomItemFromPool(pool: ITemplateItem[], isPmc: boolean): ITemplateItem; /** + * Get a random item from the pool parameter using the biasedRandomNumber system + * @param pool pool of items to pick an item from + * @param isPmc is the bot being created a pmc + * @returns ITemplateItem object + */ + protected getRandomItemFromPoolByRole(pool: ITemplateItem[], botRole: string): ITemplateItem; + /** + * @deprecated Replaced by getBotLootNValueByRole() * Get the loot nvalue from botconfig * @param isPmc if true the pmc nvalue is returned * @returns nvalue as number */ protected getBotLootNValue(isPmc: boolean): number; + /** + * Get the loot nvalue from botconfig + * @param botRole role of bot e.g. assault/sptBear + * @returns nvalue as number + */ + protected getBotLootNValueByRole(botRole: string): number; /** * Update item limit array to contain items that have a limit * All values are set to 0 diff --git a/TypeScript/13AddTrader/types/generators/LocationGenerator.d.ts b/TypeScript/13AddTrader/types/generators/LocationGenerator.d.ts index 04b1599..d5bf61c 100644 --- a/TypeScript/13AddTrader/types/generators/LocationGenerator.d.ts +++ b/TypeScript/13AddTrader/types/generators/LocationGenerator.d.ts @@ -2,7 +2,7 @@ import { ContainerHelper } from "../helpers/ContainerHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; -import { ILooseLoot, Spawnpoint, SpawnpointsForced, SpawnpointTemplate } from "../models/eft/common/ILooseLoot"; +import { ILooseLoot, Spawnpoint, SpawnpointTemplate, SpawnpointsForced } from "../models/eft/common/ILooseLoot"; import { Item } from "../models/eft/common/tables/IItem"; import { IStaticAmmoDetails, IStaticContainerProps, IStaticForcedProps, IStaticLootDetails } from "../models/eft/common/tables/ILootBase"; import { ILocationConfig } from "../models/spt/config/ILocationConfig"; @@ -13,7 +13,7 @@ import { SeasonalEventService } from "../services/SeasonalEventService"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; import { ObjectId } from "../utils/ObjectId"; -import { RandomUtil } from "../utils/RandomUtil"; +import { ProbabilityObjectArray, RandomUtil } from "../utils/RandomUtil"; export interface IContainerItem { items: Item[]; width: number; @@ -35,15 +35,38 @@ export declare class LocationGenerator { protected locationConfig: ILocationConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, mathUtil: MathUtil, seasonalEventService: SeasonalEventService, containerHelper: ContainerHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** - * Choose loot to put into a static container - * @param containerIn - * @param staticForced - * @param staticLootDist - * @param staticAmmoDist + * Choose loot to put into a static container based on weighting + * Handle forced items + seasonal item removal when not in season + * @param staticContainer The container itself we will add loot to + * @param staticForced Loot we need to force into the container + * @param staticLootDist staticLoot.json + * @param staticAmmoDist staticAmmo.json * @param locationName Name of the map to generate static loot for * @returns IStaticContainerProps */ - generateContainerLoot(containerIn: IStaticContainerProps, staticForced: IStaticForcedProps[], staticLootDist: Record, staticAmmoDist: Record, locationName: string): IStaticContainerProps; + generateContainerLoot(staticContainer: IStaticContainerProps, staticForced: IStaticForcedProps[], staticLootDist: Record, staticAmmoDist: Record, locationName: string): IStaticContainerProps; + /** + * Get a 2d grid of a containers item slots + * @param containerTpl Tpl id of the container + * @returns number[][] + */ + protected getContainerMapping(containerTpl: string): number[][]; + /** + * Look up a containers itemcountDistribution data and choose an item count based on the found weights + * @param containerTypeId Container to get item count for + * @param staticLootDist staticLoot.json + * @param locationName Map name (to get per-map multiplier for from config) + * @returns item count + */ + protected getWeightedCountOfContainerItems(containerTypeId: string, staticLootDist: Record, locationName: string): number; + /** + * Get all possible loot items that can be placed into a container + * Do not add seasonal items if found + current date is inside seasonal event + * @param containerTypeId Contianer to get possible loot for + * @param staticLootDist staticLoot.json + * @returns ProbabilityObjectArray of item tpls + probabilty + */ + protected getPossibleLootItemsForContainer(containerTypeId: string, staticLootDist: Record): ProbabilityObjectArray; protected getLooseLootMultiplerForLocation(location: string): number; protected getStaticLootMultiplerForLocation(location: string): number; /** diff --git a/TypeScript/13AddTrader/types/helpers/ContainerHelper.d.ts b/TypeScript/13AddTrader/types/helpers/ContainerHelper.d.ts index 3c2ee93..84e8c41 100644 --- a/TypeScript/13AddTrader/types/helpers/ContainerHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/ContainerHelper.d.ts @@ -8,5 +8,5 @@ export declare class FindSlotResult { export declare class ContainerHelper { protected locateSlot(container2D: number[][], containerX: number, containerY: number, x: number, y: number, itemW: number, itemH: number): boolean; findSlotForItem(container2D: number[][], itemWidth: number, itemHeight: number): FindSlotResult; - fillContainerMapWithItem(container2D: number[][], x: number, y: number, itemW: number, itemH: number, rotate: boolean): any; + fillContainerMapWithItem(container2D: number[][], x: number, y: number, itemW: number, itemH: number, rotate: boolean): number[][]; } diff --git a/TypeScript/13AddTrader/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/13AddTrader/types/models/spt/config/IRagfairConfig.d.ts index 1eb640b..9676977 100644 --- a/TypeScript/13AddTrader/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/13AddTrader/types/models/spt/config/IRagfairConfig.d.ts @@ -107,6 +107,8 @@ export interface Condition { max: number; } export interface Blacklist { + /** Damaged ammo packs */ + damagedAmmoPacks: boolean; /** Custom blacklist for item Tpls */ custom: string[]; /** BSG blacklist a large number of items from flea, true = use blacklist */ diff --git a/TypeScript/13AddTrader/types/services/RagfairPriceService.d.ts b/TypeScript/13AddTrader/types/services/RagfairPriceService.d.ts index d3f56c6..ca162da 100644 --- a/TypeScript/13AddTrader/types/services/RagfairPriceService.d.ts +++ b/TypeScript/13AddTrader/types/services/RagfairPriceService.d.ts @@ -34,7 +34,7 @@ export declare class RagfairPriceService implements OnLoad { */ onLoad(): Promise; /** - * Add placeholder values for the new sealed weapon containers + * Add placeholder values for items missing from handbook */ protected addMissingHandbookPrices(): void; getRoute(): string; diff --git a/TypeScript/16ImporterUtil/types/controllers/InventoryController.d.ts b/TypeScript/16ImporterUtil/types/controllers/InventoryController.d.ts index cf8d81a..09c130c 100644 --- a/TypeScript/16ImporterUtil/types/controllers/InventoryController.d.ts +++ b/TypeScript/16ImporterUtil/types/controllers/InventoryController.d.ts @@ -63,6 +63,12 @@ export declare class InventoryController { * @returns IItemEventRouterResponse */ moveItem(pmcData: IPmcData, moveRequest: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Get a event router response with inventory trader message + * @param output Item event router response + * @returns Item event router response + */ + protected getTraderExploitErrorResponse(output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Remove Item from Profile * Deep tree item deletion, also removes items from insurance list diff --git a/TypeScript/16ImporterUtil/types/generators/BotLootGenerator.d.ts b/TypeScript/16ImporterUtil/types/generators/BotLootGenerator.d.ts index c847d4d..6f2f6ec 100644 --- a/TypeScript/16ImporterUtil/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/16ImporterUtil/types/generators/BotLootGenerator.d.ts @@ -64,6 +64,7 @@ export declare class BotLootGenerator { */ protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): void; /** + * @deprecated replaced by getRandomItemFromPoolByRole() * Get a random item from the pool parameter using the biasedRandomNumber system * @param pool pool of items to pick an item from * @param isPmc is the bot being created a pmc @@ -71,11 +72,25 @@ export declare class BotLootGenerator { */ protected getRandomItemFromPool(pool: ITemplateItem[], isPmc: boolean): ITemplateItem; /** + * Get a random item from the pool parameter using the biasedRandomNumber system + * @param pool pool of items to pick an item from + * @param isPmc is the bot being created a pmc + * @returns ITemplateItem object + */ + protected getRandomItemFromPoolByRole(pool: ITemplateItem[], botRole: string): ITemplateItem; + /** + * @deprecated Replaced by getBotLootNValueByRole() * Get the loot nvalue from botconfig * @param isPmc if true the pmc nvalue is returned * @returns nvalue as number */ protected getBotLootNValue(isPmc: boolean): number; + /** + * Get the loot nvalue from botconfig + * @param botRole role of bot e.g. assault/sptBear + * @returns nvalue as number + */ + protected getBotLootNValueByRole(botRole: string): number; /** * Update item limit array to contain items that have a limit * All values are set to 0 diff --git a/TypeScript/16ImporterUtil/types/generators/LocationGenerator.d.ts b/TypeScript/16ImporterUtil/types/generators/LocationGenerator.d.ts index 04b1599..d5bf61c 100644 --- a/TypeScript/16ImporterUtil/types/generators/LocationGenerator.d.ts +++ b/TypeScript/16ImporterUtil/types/generators/LocationGenerator.d.ts @@ -2,7 +2,7 @@ import { ContainerHelper } from "../helpers/ContainerHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; -import { ILooseLoot, Spawnpoint, SpawnpointsForced, SpawnpointTemplate } from "../models/eft/common/ILooseLoot"; +import { ILooseLoot, Spawnpoint, SpawnpointTemplate, SpawnpointsForced } from "../models/eft/common/ILooseLoot"; import { Item } from "../models/eft/common/tables/IItem"; import { IStaticAmmoDetails, IStaticContainerProps, IStaticForcedProps, IStaticLootDetails } from "../models/eft/common/tables/ILootBase"; import { ILocationConfig } from "../models/spt/config/ILocationConfig"; @@ -13,7 +13,7 @@ import { SeasonalEventService } from "../services/SeasonalEventService"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; import { ObjectId } from "../utils/ObjectId"; -import { RandomUtil } from "../utils/RandomUtil"; +import { ProbabilityObjectArray, RandomUtil } from "../utils/RandomUtil"; export interface IContainerItem { items: Item[]; width: number; @@ -35,15 +35,38 @@ export declare class LocationGenerator { protected locationConfig: ILocationConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, mathUtil: MathUtil, seasonalEventService: SeasonalEventService, containerHelper: ContainerHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** - * Choose loot to put into a static container - * @param containerIn - * @param staticForced - * @param staticLootDist - * @param staticAmmoDist + * Choose loot to put into a static container based on weighting + * Handle forced items + seasonal item removal when not in season + * @param staticContainer The container itself we will add loot to + * @param staticForced Loot we need to force into the container + * @param staticLootDist staticLoot.json + * @param staticAmmoDist staticAmmo.json * @param locationName Name of the map to generate static loot for * @returns IStaticContainerProps */ - generateContainerLoot(containerIn: IStaticContainerProps, staticForced: IStaticForcedProps[], staticLootDist: Record, staticAmmoDist: Record, locationName: string): IStaticContainerProps; + generateContainerLoot(staticContainer: IStaticContainerProps, staticForced: IStaticForcedProps[], staticLootDist: Record, staticAmmoDist: Record, locationName: string): IStaticContainerProps; + /** + * Get a 2d grid of a containers item slots + * @param containerTpl Tpl id of the container + * @returns number[][] + */ + protected getContainerMapping(containerTpl: string): number[][]; + /** + * Look up a containers itemcountDistribution data and choose an item count based on the found weights + * @param containerTypeId Container to get item count for + * @param staticLootDist staticLoot.json + * @param locationName Map name (to get per-map multiplier for from config) + * @returns item count + */ + protected getWeightedCountOfContainerItems(containerTypeId: string, staticLootDist: Record, locationName: string): number; + /** + * Get all possible loot items that can be placed into a container + * Do not add seasonal items if found + current date is inside seasonal event + * @param containerTypeId Contianer to get possible loot for + * @param staticLootDist staticLoot.json + * @returns ProbabilityObjectArray of item tpls + probabilty + */ + protected getPossibleLootItemsForContainer(containerTypeId: string, staticLootDist: Record): ProbabilityObjectArray; protected getLooseLootMultiplerForLocation(location: string): number; protected getStaticLootMultiplerForLocation(location: string): number; /** diff --git a/TypeScript/16ImporterUtil/types/helpers/ContainerHelper.d.ts b/TypeScript/16ImporterUtil/types/helpers/ContainerHelper.d.ts index 3c2ee93..84e8c41 100644 --- a/TypeScript/16ImporterUtil/types/helpers/ContainerHelper.d.ts +++ b/TypeScript/16ImporterUtil/types/helpers/ContainerHelper.d.ts @@ -8,5 +8,5 @@ export declare class FindSlotResult { export declare class ContainerHelper { protected locateSlot(container2D: number[][], containerX: number, containerY: number, x: number, y: number, itemW: number, itemH: number): boolean; findSlotForItem(container2D: number[][], itemWidth: number, itemHeight: number): FindSlotResult; - fillContainerMapWithItem(container2D: number[][], x: number, y: number, itemW: number, itemH: number, rotate: boolean): any; + fillContainerMapWithItem(container2D: number[][], x: number, y: number, itemW: number, itemH: number, rotate: boolean): number[][]; } diff --git a/TypeScript/16ImporterUtil/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/16ImporterUtil/types/models/spt/config/IRagfairConfig.d.ts index 1eb640b..9676977 100644 --- a/TypeScript/16ImporterUtil/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/16ImporterUtil/types/models/spt/config/IRagfairConfig.d.ts @@ -107,6 +107,8 @@ export interface Condition { max: number; } export interface Blacklist { + /** Damaged ammo packs */ + damagedAmmoPacks: boolean; /** Custom blacklist for item Tpls */ custom: string[]; /** BSG blacklist a large number of items from flea, true = use blacklist */ diff --git a/TypeScript/16ImporterUtil/types/services/RagfairPriceService.d.ts b/TypeScript/16ImporterUtil/types/services/RagfairPriceService.d.ts index d3f56c6..ca162da 100644 --- a/TypeScript/16ImporterUtil/types/services/RagfairPriceService.d.ts +++ b/TypeScript/16ImporterUtil/types/services/RagfairPriceService.d.ts @@ -34,7 +34,7 @@ export declare class RagfairPriceService implements OnLoad { */ onLoad(): Promise; /** - * Add placeholder values for the new sealed weapon containers + * Add placeholder values for items missing from handbook */ protected addMissingHandbookPrices(): void; getRoute(): string; diff --git a/TypeScript/18CustomItemService/types/controllers/InventoryController.d.ts b/TypeScript/18CustomItemService/types/controllers/InventoryController.d.ts index cf8d81a..09c130c 100644 --- a/TypeScript/18CustomItemService/types/controllers/InventoryController.d.ts +++ b/TypeScript/18CustomItemService/types/controllers/InventoryController.d.ts @@ -63,6 +63,12 @@ export declare class InventoryController { * @returns IItemEventRouterResponse */ moveItem(pmcData: IPmcData, moveRequest: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Get a event router response with inventory trader message + * @param output Item event router response + * @returns Item event router response + */ + protected getTraderExploitErrorResponse(output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Remove Item from Profile * Deep tree item deletion, also removes items from insurance list diff --git a/TypeScript/18CustomItemService/types/generators/BotLootGenerator.d.ts b/TypeScript/18CustomItemService/types/generators/BotLootGenerator.d.ts index c847d4d..6f2f6ec 100644 --- a/TypeScript/18CustomItemService/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/18CustomItemService/types/generators/BotLootGenerator.d.ts @@ -64,6 +64,7 @@ export declare class BotLootGenerator { */ protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): void; /** + * @deprecated replaced by getRandomItemFromPoolByRole() * Get a random item from the pool parameter using the biasedRandomNumber system * @param pool pool of items to pick an item from * @param isPmc is the bot being created a pmc @@ -71,11 +72,25 @@ export declare class BotLootGenerator { */ protected getRandomItemFromPool(pool: ITemplateItem[], isPmc: boolean): ITemplateItem; /** + * Get a random item from the pool parameter using the biasedRandomNumber system + * @param pool pool of items to pick an item from + * @param isPmc is the bot being created a pmc + * @returns ITemplateItem object + */ + protected getRandomItemFromPoolByRole(pool: ITemplateItem[], botRole: string): ITemplateItem; + /** + * @deprecated Replaced by getBotLootNValueByRole() * Get the loot nvalue from botconfig * @param isPmc if true the pmc nvalue is returned * @returns nvalue as number */ protected getBotLootNValue(isPmc: boolean): number; + /** + * Get the loot nvalue from botconfig + * @param botRole role of bot e.g. assault/sptBear + * @returns nvalue as number + */ + protected getBotLootNValueByRole(botRole: string): number; /** * Update item limit array to contain items that have a limit * All values are set to 0 diff --git a/TypeScript/18CustomItemService/types/generators/LocationGenerator.d.ts b/TypeScript/18CustomItemService/types/generators/LocationGenerator.d.ts index 04b1599..d5bf61c 100644 --- a/TypeScript/18CustomItemService/types/generators/LocationGenerator.d.ts +++ b/TypeScript/18CustomItemService/types/generators/LocationGenerator.d.ts @@ -2,7 +2,7 @@ import { ContainerHelper } from "../helpers/ContainerHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; -import { ILooseLoot, Spawnpoint, SpawnpointsForced, SpawnpointTemplate } from "../models/eft/common/ILooseLoot"; +import { ILooseLoot, Spawnpoint, SpawnpointTemplate, SpawnpointsForced } from "../models/eft/common/ILooseLoot"; import { Item } from "../models/eft/common/tables/IItem"; import { IStaticAmmoDetails, IStaticContainerProps, IStaticForcedProps, IStaticLootDetails } from "../models/eft/common/tables/ILootBase"; import { ILocationConfig } from "../models/spt/config/ILocationConfig"; @@ -13,7 +13,7 @@ import { SeasonalEventService } from "../services/SeasonalEventService"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; import { ObjectId } from "../utils/ObjectId"; -import { RandomUtil } from "../utils/RandomUtil"; +import { ProbabilityObjectArray, RandomUtil } from "../utils/RandomUtil"; export interface IContainerItem { items: Item[]; width: number; @@ -35,15 +35,38 @@ export declare class LocationGenerator { protected locationConfig: ILocationConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, mathUtil: MathUtil, seasonalEventService: SeasonalEventService, containerHelper: ContainerHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** - * Choose loot to put into a static container - * @param containerIn - * @param staticForced - * @param staticLootDist - * @param staticAmmoDist + * Choose loot to put into a static container based on weighting + * Handle forced items + seasonal item removal when not in season + * @param staticContainer The container itself we will add loot to + * @param staticForced Loot we need to force into the container + * @param staticLootDist staticLoot.json + * @param staticAmmoDist staticAmmo.json * @param locationName Name of the map to generate static loot for * @returns IStaticContainerProps */ - generateContainerLoot(containerIn: IStaticContainerProps, staticForced: IStaticForcedProps[], staticLootDist: Record, staticAmmoDist: Record, locationName: string): IStaticContainerProps; + generateContainerLoot(staticContainer: IStaticContainerProps, staticForced: IStaticForcedProps[], staticLootDist: Record, staticAmmoDist: Record, locationName: string): IStaticContainerProps; + /** + * Get a 2d grid of a containers item slots + * @param containerTpl Tpl id of the container + * @returns number[][] + */ + protected getContainerMapping(containerTpl: string): number[][]; + /** + * Look up a containers itemcountDistribution data and choose an item count based on the found weights + * @param containerTypeId Container to get item count for + * @param staticLootDist staticLoot.json + * @param locationName Map name (to get per-map multiplier for from config) + * @returns item count + */ + protected getWeightedCountOfContainerItems(containerTypeId: string, staticLootDist: Record, locationName: string): number; + /** + * Get all possible loot items that can be placed into a container + * Do not add seasonal items if found + current date is inside seasonal event + * @param containerTypeId Contianer to get possible loot for + * @param staticLootDist staticLoot.json + * @returns ProbabilityObjectArray of item tpls + probabilty + */ + protected getPossibleLootItemsForContainer(containerTypeId: string, staticLootDist: Record): ProbabilityObjectArray; protected getLooseLootMultiplerForLocation(location: string): number; protected getStaticLootMultiplerForLocation(location: string): number; /** diff --git a/TypeScript/18CustomItemService/types/helpers/ContainerHelper.d.ts b/TypeScript/18CustomItemService/types/helpers/ContainerHelper.d.ts index 3c2ee93..84e8c41 100644 --- a/TypeScript/18CustomItemService/types/helpers/ContainerHelper.d.ts +++ b/TypeScript/18CustomItemService/types/helpers/ContainerHelper.d.ts @@ -8,5 +8,5 @@ export declare class FindSlotResult { export declare class ContainerHelper { protected locateSlot(container2D: number[][], containerX: number, containerY: number, x: number, y: number, itemW: number, itemH: number): boolean; findSlotForItem(container2D: number[][], itemWidth: number, itemHeight: number): FindSlotResult; - fillContainerMapWithItem(container2D: number[][], x: number, y: number, itemW: number, itemH: number, rotate: boolean): any; + fillContainerMapWithItem(container2D: number[][], x: number, y: number, itemW: number, itemH: number, rotate: boolean): number[][]; } diff --git a/TypeScript/18CustomItemService/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/18CustomItemService/types/models/spt/config/IRagfairConfig.d.ts index 1eb640b..9676977 100644 --- a/TypeScript/18CustomItemService/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/18CustomItemService/types/models/spt/config/IRagfairConfig.d.ts @@ -107,6 +107,8 @@ export interface Condition { max: number; } export interface Blacklist { + /** Damaged ammo packs */ + damagedAmmoPacks: boolean; /** Custom blacklist for item Tpls */ custom: string[]; /** BSG blacklist a large number of items from flea, true = use blacklist */ diff --git a/TypeScript/18CustomItemService/types/services/RagfairPriceService.d.ts b/TypeScript/18CustomItemService/types/services/RagfairPriceService.d.ts index d3f56c6..ca162da 100644 --- a/TypeScript/18CustomItemService/types/services/RagfairPriceService.d.ts +++ b/TypeScript/18CustomItemService/types/services/RagfairPriceService.d.ts @@ -34,7 +34,7 @@ export declare class RagfairPriceService implements OnLoad { */ onLoad(): Promise; /** - * Add placeholder values for the new sealed weapon containers + * Add placeholder values for items missing from handbook */ protected addMissingHandbookPrices(): void; getRoute(): string; diff --git a/TypeScript/1LogToConsole/types/controllers/InventoryController.d.ts b/TypeScript/1LogToConsole/types/controllers/InventoryController.d.ts index cf8d81a..09c130c 100644 --- a/TypeScript/1LogToConsole/types/controllers/InventoryController.d.ts +++ b/TypeScript/1LogToConsole/types/controllers/InventoryController.d.ts @@ -63,6 +63,12 @@ export declare class InventoryController { * @returns IItemEventRouterResponse */ moveItem(pmcData: IPmcData, moveRequest: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Get a event router response with inventory trader message + * @param output Item event router response + * @returns Item event router response + */ + protected getTraderExploitErrorResponse(output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Remove Item from Profile * Deep tree item deletion, also removes items from insurance list diff --git a/TypeScript/1LogToConsole/types/generators/BotLootGenerator.d.ts b/TypeScript/1LogToConsole/types/generators/BotLootGenerator.d.ts index c847d4d..6f2f6ec 100644 --- a/TypeScript/1LogToConsole/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/1LogToConsole/types/generators/BotLootGenerator.d.ts @@ -64,6 +64,7 @@ export declare class BotLootGenerator { */ protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): void; /** + * @deprecated replaced by getRandomItemFromPoolByRole() * Get a random item from the pool parameter using the biasedRandomNumber system * @param pool pool of items to pick an item from * @param isPmc is the bot being created a pmc @@ -71,11 +72,25 @@ export declare class BotLootGenerator { */ protected getRandomItemFromPool(pool: ITemplateItem[], isPmc: boolean): ITemplateItem; /** + * Get a random item from the pool parameter using the biasedRandomNumber system + * @param pool pool of items to pick an item from + * @param isPmc is the bot being created a pmc + * @returns ITemplateItem object + */ + protected getRandomItemFromPoolByRole(pool: ITemplateItem[], botRole: string): ITemplateItem; + /** + * @deprecated Replaced by getBotLootNValueByRole() * Get the loot nvalue from botconfig * @param isPmc if true the pmc nvalue is returned * @returns nvalue as number */ protected getBotLootNValue(isPmc: boolean): number; + /** + * Get the loot nvalue from botconfig + * @param botRole role of bot e.g. assault/sptBear + * @returns nvalue as number + */ + protected getBotLootNValueByRole(botRole: string): number; /** * Update item limit array to contain items that have a limit * All values are set to 0 diff --git a/TypeScript/1LogToConsole/types/generators/LocationGenerator.d.ts b/TypeScript/1LogToConsole/types/generators/LocationGenerator.d.ts index 04b1599..d5bf61c 100644 --- a/TypeScript/1LogToConsole/types/generators/LocationGenerator.d.ts +++ b/TypeScript/1LogToConsole/types/generators/LocationGenerator.d.ts @@ -2,7 +2,7 @@ import { ContainerHelper } from "../helpers/ContainerHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; -import { ILooseLoot, Spawnpoint, SpawnpointsForced, SpawnpointTemplate } from "../models/eft/common/ILooseLoot"; +import { ILooseLoot, Spawnpoint, SpawnpointTemplate, SpawnpointsForced } from "../models/eft/common/ILooseLoot"; import { Item } from "../models/eft/common/tables/IItem"; import { IStaticAmmoDetails, IStaticContainerProps, IStaticForcedProps, IStaticLootDetails } from "../models/eft/common/tables/ILootBase"; import { ILocationConfig } from "../models/spt/config/ILocationConfig"; @@ -13,7 +13,7 @@ import { SeasonalEventService } from "../services/SeasonalEventService"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; import { ObjectId } from "../utils/ObjectId"; -import { RandomUtil } from "../utils/RandomUtil"; +import { ProbabilityObjectArray, RandomUtil } from "../utils/RandomUtil"; export interface IContainerItem { items: Item[]; width: number; @@ -35,15 +35,38 @@ export declare class LocationGenerator { protected locationConfig: ILocationConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, mathUtil: MathUtil, seasonalEventService: SeasonalEventService, containerHelper: ContainerHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** - * Choose loot to put into a static container - * @param containerIn - * @param staticForced - * @param staticLootDist - * @param staticAmmoDist + * Choose loot to put into a static container based on weighting + * Handle forced items + seasonal item removal when not in season + * @param staticContainer The container itself we will add loot to + * @param staticForced Loot we need to force into the container + * @param staticLootDist staticLoot.json + * @param staticAmmoDist staticAmmo.json * @param locationName Name of the map to generate static loot for * @returns IStaticContainerProps */ - generateContainerLoot(containerIn: IStaticContainerProps, staticForced: IStaticForcedProps[], staticLootDist: Record, staticAmmoDist: Record, locationName: string): IStaticContainerProps; + generateContainerLoot(staticContainer: IStaticContainerProps, staticForced: IStaticForcedProps[], staticLootDist: Record, staticAmmoDist: Record, locationName: string): IStaticContainerProps; + /** + * Get a 2d grid of a containers item slots + * @param containerTpl Tpl id of the container + * @returns number[][] + */ + protected getContainerMapping(containerTpl: string): number[][]; + /** + * Look up a containers itemcountDistribution data and choose an item count based on the found weights + * @param containerTypeId Container to get item count for + * @param staticLootDist staticLoot.json + * @param locationName Map name (to get per-map multiplier for from config) + * @returns item count + */ + protected getWeightedCountOfContainerItems(containerTypeId: string, staticLootDist: Record, locationName: string): number; + /** + * Get all possible loot items that can be placed into a container + * Do not add seasonal items if found + current date is inside seasonal event + * @param containerTypeId Contianer to get possible loot for + * @param staticLootDist staticLoot.json + * @returns ProbabilityObjectArray of item tpls + probabilty + */ + protected getPossibleLootItemsForContainer(containerTypeId: string, staticLootDist: Record): ProbabilityObjectArray; protected getLooseLootMultiplerForLocation(location: string): number; protected getStaticLootMultiplerForLocation(location: string): number; /** diff --git a/TypeScript/1LogToConsole/types/helpers/ContainerHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/ContainerHelper.d.ts index 3c2ee93..84e8c41 100644 --- a/TypeScript/1LogToConsole/types/helpers/ContainerHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/ContainerHelper.d.ts @@ -8,5 +8,5 @@ export declare class FindSlotResult { export declare class ContainerHelper { protected locateSlot(container2D: number[][], containerX: number, containerY: number, x: number, y: number, itemW: number, itemH: number): boolean; findSlotForItem(container2D: number[][], itemWidth: number, itemHeight: number): FindSlotResult; - fillContainerMapWithItem(container2D: number[][], x: number, y: number, itemW: number, itemH: number, rotate: boolean): any; + fillContainerMapWithItem(container2D: number[][], x: number, y: number, itemW: number, itemH: number, rotate: boolean): number[][]; } diff --git a/TypeScript/2EditDatabase/types/controllers/InventoryController.d.ts b/TypeScript/2EditDatabase/types/controllers/InventoryController.d.ts index cf8d81a..09c130c 100644 --- a/TypeScript/2EditDatabase/types/controllers/InventoryController.d.ts +++ b/TypeScript/2EditDatabase/types/controllers/InventoryController.d.ts @@ -63,6 +63,12 @@ export declare class InventoryController { * @returns IItemEventRouterResponse */ moveItem(pmcData: IPmcData, moveRequest: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Get a event router response with inventory trader message + * @param output Item event router response + * @returns Item event router response + */ + protected getTraderExploitErrorResponse(output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Remove Item from Profile * Deep tree item deletion, also removes items from insurance list diff --git a/TypeScript/2EditDatabase/types/generators/BotLootGenerator.d.ts b/TypeScript/2EditDatabase/types/generators/BotLootGenerator.d.ts index c847d4d..6f2f6ec 100644 --- a/TypeScript/2EditDatabase/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/2EditDatabase/types/generators/BotLootGenerator.d.ts @@ -64,6 +64,7 @@ export declare class BotLootGenerator { */ protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): void; /** + * @deprecated replaced by getRandomItemFromPoolByRole() * Get a random item from the pool parameter using the biasedRandomNumber system * @param pool pool of items to pick an item from * @param isPmc is the bot being created a pmc @@ -71,11 +72,25 @@ export declare class BotLootGenerator { */ protected getRandomItemFromPool(pool: ITemplateItem[], isPmc: boolean): ITemplateItem; /** + * Get a random item from the pool parameter using the biasedRandomNumber system + * @param pool pool of items to pick an item from + * @param isPmc is the bot being created a pmc + * @returns ITemplateItem object + */ + protected getRandomItemFromPoolByRole(pool: ITemplateItem[], botRole: string): ITemplateItem; + /** + * @deprecated Replaced by getBotLootNValueByRole() * Get the loot nvalue from botconfig * @param isPmc if true the pmc nvalue is returned * @returns nvalue as number */ protected getBotLootNValue(isPmc: boolean): number; + /** + * Get the loot nvalue from botconfig + * @param botRole role of bot e.g. assault/sptBear + * @returns nvalue as number + */ + protected getBotLootNValueByRole(botRole: string): number; /** * Update item limit array to contain items that have a limit * All values are set to 0 diff --git a/TypeScript/2EditDatabase/types/generators/LocationGenerator.d.ts b/TypeScript/2EditDatabase/types/generators/LocationGenerator.d.ts index 04b1599..d5bf61c 100644 --- a/TypeScript/2EditDatabase/types/generators/LocationGenerator.d.ts +++ b/TypeScript/2EditDatabase/types/generators/LocationGenerator.d.ts @@ -2,7 +2,7 @@ import { ContainerHelper } from "../helpers/ContainerHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; -import { ILooseLoot, Spawnpoint, SpawnpointsForced, SpawnpointTemplate } from "../models/eft/common/ILooseLoot"; +import { ILooseLoot, Spawnpoint, SpawnpointTemplate, SpawnpointsForced } from "../models/eft/common/ILooseLoot"; import { Item } from "../models/eft/common/tables/IItem"; import { IStaticAmmoDetails, IStaticContainerProps, IStaticForcedProps, IStaticLootDetails } from "../models/eft/common/tables/ILootBase"; import { ILocationConfig } from "../models/spt/config/ILocationConfig"; @@ -13,7 +13,7 @@ import { SeasonalEventService } from "../services/SeasonalEventService"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; import { ObjectId } from "../utils/ObjectId"; -import { RandomUtil } from "../utils/RandomUtil"; +import { ProbabilityObjectArray, RandomUtil } from "../utils/RandomUtil"; export interface IContainerItem { items: Item[]; width: number; @@ -35,15 +35,38 @@ export declare class LocationGenerator { protected locationConfig: ILocationConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, mathUtil: MathUtil, seasonalEventService: SeasonalEventService, containerHelper: ContainerHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** - * Choose loot to put into a static container - * @param containerIn - * @param staticForced - * @param staticLootDist - * @param staticAmmoDist + * Choose loot to put into a static container based on weighting + * Handle forced items + seasonal item removal when not in season + * @param staticContainer The container itself we will add loot to + * @param staticForced Loot we need to force into the container + * @param staticLootDist staticLoot.json + * @param staticAmmoDist staticAmmo.json * @param locationName Name of the map to generate static loot for * @returns IStaticContainerProps */ - generateContainerLoot(containerIn: IStaticContainerProps, staticForced: IStaticForcedProps[], staticLootDist: Record, staticAmmoDist: Record, locationName: string): IStaticContainerProps; + generateContainerLoot(staticContainer: IStaticContainerProps, staticForced: IStaticForcedProps[], staticLootDist: Record, staticAmmoDist: Record, locationName: string): IStaticContainerProps; + /** + * Get a 2d grid of a containers item slots + * @param containerTpl Tpl id of the container + * @returns number[][] + */ + protected getContainerMapping(containerTpl: string): number[][]; + /** + * Look up a containers itemcountDistribution data and choose an item count based on the found weights + * @param containerTypeId Container to get item count for + * @param staticLootDist staticLoot.json + * @param locationName Map name (to get per-map multiplier for from config) + * @returns item count + */ + protected getWeightedCountOfContainerItems(containerTypeId: string, staticLootDist: Record, locationName: string): number; + /** + * Get all possible loot items that can be placed into a container + * Do not add seasonal items if found + current date is inside seasonal event + * @param containerTypeId Contianer to get possible loot for + * @param staticLootDist staticLoot.json + * @returns ProbabilityObjectArray of item tpls + probabilty + */ + protected getPossibleLootItemsForContainer(containerTypeId: string, staticLootDist: Record): ProbabilityObjectArray; protected getLooseLootMultiplerForLocation(location: string): number; protected getStaticLootMultiplerForLocation(location: string): number; /** diff --git a/TypeScript/2EditDatabase/types/helpers/ContainerHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/ContainerHelper.d.ts index 3c2ee93..84e8c41 100644 --- a/TypeScript/2EditDatabase/types/helpers/ContainerHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/ContainerHelper.d.ts @@ -8,5 +8,5 @@ export declare class FindSlotResult { export declare class ContainerHelper { protected locateSlot(container2D: number[][], containerX: number, containerY: number, x: number, y: number, itemW: number, itemH: number): boolean; findSlotForItem(container2D: number[][], itemWidth: number, itemHeight: number): FindSlotResult; - fillContainerMapWithItem(container2D: number[][], x: number, y: number, itemW: number, itemH: number, rotate: boolean): any; + fillContainerMapWithItem(container2D: number[][], x: number, y: number, itemW: number, itemH: number, rotate: boolean): number[][]; } diff --git a/TypeScript/2EditDatabase/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/2EditDatabase/types/models/spt/config/IRagfairConfig.d.ts index 1eb640b..9676977 100644 --- a/TypeScript/2EditDatabase/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/2EditDatabase/types/models/spt/config/IRagfairConfig.d.ts @@ -107,6 +107,8 @@ export interface Condition { max: number; } export interface Blacklist { + /** Damaged ammo packs */ + damagedAmmoPacks: boolean; /** Custom blacklist for item Tpls */ custom: string[]; /** BSG blacklist a large number of items from flea, true = use blacklist */ diff --git a/TypeScript/2EditDatabase/types/services/RagfairPriceService.d.ts b/TypeScript/2EditDatabase/types/services/RagfairPriceService.d.ts index d3f56c6..ca162da 100644 --- a/TypeScript/2EditDatabase/types/services/RagfairPriceService.d.ts +++ b/TypeScript/2EditDatabase/types/services/RagfairPriceService.d.ts @@ -34,7 +34,7 @@ export declare class RagfairPriceService implements OnLoad { */ onLoad(): Promise; /** - * Add placeholder values for the new sealed weapon containers + * Add placeholder values for items missing from handbook */ protected addMissingHandbookPrices(): void; getRoute(): string; diff --git a/TypeScript/3GetSptConfigFile/types/controllers/InventoryController.d.ts b/TypeScript/3GetSptConfigFile/types/controllers/InventoryController.d.ts index cf8d81a..09c130c 100644 --- a/TypeScript/3GetSptConfigFile/types/controllers/InventoryController.d.ts +++ b/TypeScript/3GetSptConfigFile/types/controllers/InventoryController.d.ts @@ -63,6 +63,12 @@ export declare class InventoryController { * @returns IItemEventRouterResponse */ moveItem(pmcData: IPmcData, moveRequest: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Get a event router response with inventory trader message + * @param output Item event router response + * @returns Item event router response + */ + protected getTraderExploitErrorResponse(output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Remove Item from Profile * Deep tree item deletion, also removes items from insurance list diff --git a/TypeScript/3GetSptConfigFile/types/generators/BotLootGenerator.d.ts b/TypeScript/3GetSptConfigFile/types/generators/BotLootGenerator.d.ts index c847d4d..6f2f6ec 100644 --- a/TypeScript/3GetSptConfigFile/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/3GetSptConfigFile/types/generators/BotLootGenerator.d.ts @@ -64,6 +64,7 @@ export declare class BotLootGenerator { */ protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): void; /** + * @deprecated replaced by getRandomItemFromPoolByRole() * Get a random item from the pool parameter using the biasedRandomNumber system * @param pool pool of items to pick an item from * @param isPmc is the bot being created a pmc @@ -71,11 +72,25 @@ export declare class BotLootGenerator { */ protected getRandomItemFromPool(pool: ITemplateItem[], isPmc: boolean): ITemplateItem; /** + * Get a random item from the pool parameter using the biasedRandomNumber system + * @param pool pool of items to pick an item from + * @param isPmc is the bot being created a pmc + * @returns ITemplateItem object + */ + protected getRandomItemFromPoolByRole(pool: ITemplateItem[], botRole: string): ITemplateItem; + /** + * @deprecated Replaced by getBotLootNValueByRole() * Get the loot nvalue from botconfig * @param isPmc if true the pmc nvalue is returned * @returns nvalue as number */ protected getBotLootNValue(isPmc: boolean): number; + /** + * Get the loot nvalue from botconfig + * @param botRole role of bot e.g. assault/sptBear + * @returns nvalue as number + */ + protected getBotLootNValueByRole(botRole: string): number; /** * Update item limit array to contain items that have a limit * All values are set to 0 diff --git a/TypeScript/3GetSptConfigFile/types/generators/LocationGenerator.d.ts b/TypeScript/3GetSptConfigFile/types/generators/LocationGenerator.d.ts index 04b1599..d5bf61c 100644 --- a/TypeScript/3GetSptConfigFile/types/generators/LocationGenerator.d.ts +++ b/TypeScript/3GetSptConfigFile/types/generators/LocationGenerator.d.ts @@ -2,7 +2,7 @@ import { ContainerHelper } from "../helpers/ContainerHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; -import { ILooseLoot, Spawnpoint, SpawnpointsForced, SpawnpointTemplate } from "../models/eft/common/ILooseLoot"; +import { ILooseLoot, Spawnpoint, SpawnpointTemplate, SpawnpointsForced } from "../models/eft/common/ILooseLoot"; import { Item } from "../models/eft/common/tables/IItem"; import { IStaticAmmoDetails, IStaticContainerProps, IStaticForcedProps, IStaticLootDetails } from "../models/eft/common/tables/ILootBase"; import { ILocationConfig } from "../models/spt/config/ILocationConfig"; @@ -13,7 +13,7 @@ import { SeasonalEventService } from "../services/SeasonalEventService"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; import { ObjectId } from "../utils/ObjectId"; -import { RandomUtil } from "../utils/RandomUtil"; +import { ProbabilityObjectArray, RandomUtil } from "../utils/RandomUtil"; export interface IContainerItem { items: Item[]; width: number; @@ -35,15 +35,38 @@ export declare class LocationGenerator { protected locationConfig: ILocationConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, mathUtil: MathUtil, seasonalEventService: SeasonalEventService, containerHelper: ContainerHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** - * Choose loot to put into a static container - * @param containerIn - * @param staticForced - * @param staticLootDist - * @param staticAmmoDist + * Choose loot to put into a static container based on weighting + * Handle forced items + seasonal item removal when not in season + * @param staticContainer The container itself we will add loot to + * @param staticForced Loot we need to force into the container + * @param staticLootDist staticLoot.json + * @param staticAmmoDist staticAmmo.json * @param locationName Name of the map to generate static loot for * @returns IStaticContainerProps */ - generateContainerLoot(containerIn: IStaticContainerProps, staticForced: IStaticForcedProps[], staticLootDist: Record, staticAmmoDist: Record, locationName: string): IStaticContainerProps; + generateContainerLoot(staticContainer: IStaticContainerProps, staticForced: IStaticForcedProps[], staticLootDist: Record, staticAmmoDist: Record, locationName: string): IStaticContainerProps; + /** + * Get a 2d grid of a containers item slots + * @param containerTpl Tpl id of the container + * @returns number[][] + */ + protected getContainerMapping(containerTpl: string): number[][]; + /** + * Look up a containers itemcountDistribution data and choose an item count based on the found weights + * @param containerTypeId Container to get item count for + * @param staticLootDist staticLoot.json + * @param locationName Map name (to get per-map multiplier for from config) + * @returns item count + */ + protected getWeightedCountOfContainerItems(containerTypeId: string, staticLootDist: Record, locationName: string): number; + /** + * Get all possible loot items that can be placed into a container + * Do not add seasonal items if found + current date is inside seasonal event + * @param containerTypeId Contianer to get possible loot for + * @param staticLootDist staticLoot.json + * @returns ProbabilityObjectArray of item tpls + probabilty + */ + protected getPossibleLootItemsForContainer(containerTypeId: string, staticLootDist: Record): ProbabilityObjectArray; protected getLooseLootMultiplerForLocation(location: string): number; protected getStaticLootMultiplerForLocation(location: string): number; /** diff --git a/TypeScript/3GetSptConfigFile/types/helpers/ContainerHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/ContainerHelper.d.ts index 3c2ee93..84e8c41 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/ContainerHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/ContainerHelper.d.ts @@ -8,5 +8,5 @@ export declare class FindSlotResult { export declare class ContainerHelper { protected locateSlot(container2D: number[][], containerX: number, containerY: number, x: number, y: number, itemW: number, itemH: number): boolean; findSlotForItem(container2D: number[][], itemWidth: number, itemHeight: number): FindSlotResult; - fillContainerMapWithItem(container2D: number[][], x: number, y: number, itemW: number, itemH: number, rotate: boolean): any; + fillContainerMapWithItem(container2D: number[][], x: number, y: number, itemW: number, itemH: number, rotate: boolean): number[][]; } diff --git a/TypeScript/3GetSptConfigFile/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/config/IRagfairConfig.d.ts index 1eb640b..9676977 100644 --- a/TypeScript/3GetSptConfigFile/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/spt/config/IRagfairConfig.d.ts @@ -107,6 +107,8 @@ export interface Condition { max: number; } export interface Blacklist { + /** Damaged ammo packs */ + damagedAmmoPacks: boolean; /** Custom blacklist for item Tpls */ custom: string[]; /** BSG blacklist a large number of items from flea, true = use blacklist */ diff --git a/TypeScript/3GetSptConfigFile/types/services/RagfairPriceService.d.ts b/TypeScript/3GetSptConfigFile/types/services/RagfairPriceService.d.ts index d3f56c6..ca162da 100644 --- a/TypeScript/3GetSptConfigFile/types/services/RagfairPriceService.d.ts +++ b/TypeScript/3GetSptConfigFile/types/services/RagfairPriceService.d.ts @@ -34,7 +34,7 @@ export declare class RagfairPriceService implements OnLoad { */ onLoad(): Promise; /** - * Add placeholder values for the new sealed weapon containers + * Add placeholder values for items missing from handbook */ protected addMissingHandbookPrices(): void; getRoute(): string; diff --git a/TypeScript/4UseACustomConfigFile/types/controllers/InventoryController.d.ts b/TypeScript/4UseACustomConfigFile/types/controllers/InventoryController.d.ts index cf8d81a..09c130c 100644 --- a/TypeScript/4UseACustomConfigFile/types/controllers/InventoryController.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/controllers/InventoryController.d.ts @@ -63,6 +63,12 @@ export declare class InventoryController { * @returns IItemEventRouterResponse */ moveItem(pmcData: IPmcData, moveRequest: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Get a event router response with inventory trader message + * @param output Item event router response + * @returns Item event router response + */ + protected getTraderExploitErrorResponse(output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Remove Item from Profile * Deep tree item deletion, also removes items from insurance list diff --git a/TypeScript/4UseACustomConfigFile/types/generators/BotLootGenerator.d.ts b/TypeScript/4UseACustomConfigFile/types/generators/BotLootGenerator.d.ts index c847d4d..6f2f6ec 100644 --- a/TypeScript/4UseACustomConfigFile/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/generators/BotLootGenerator.d.ts @@ -64,6 +64,7 @@ export declare class BotLootGenerator { */ protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): void; /** + * @deprecated replaced by getRandomItemFromPoolByRole() * Get a random item from the pool parameter using the biasedRandomNumber system * @param pool pool of items to pick an item from * @param isPmc is the bot being created a pmc @@ -71,11 +72,25 @@ export declare class BotLootGenerator { */ protected getRandomItemFromPool(pool: ITemplateItem[], isPmc: boolean): ITemplateItem; /** + * Get a random item from the pool parameter using the biasedRandomNumber system + * @param pool pool of items to pick an item from + * @param isPmc is the bot being created a pmc + * @returns ITemplateItem object + */ + protected getRandomItemFromPoolByRole(pool: ITemplateItem[], botRole: string): ITemplateItem; + /** + * @deprecated Replaced by getBotLootNValueByRole() * Get the loot nvalue from botconfig * @param isPmc if true the pmc nvalue is returned * @returns nvalue as number */ protected getBotLootNValue(isPmc: boolean): number; + /** + * Get the loot nvalue from botconfig + * @param botRole role of bot e.g. assault/sptBear + * @returns nvalue as number + */ + protected getBotLootNValueByRole(botRole: string): number; /** * Update item limit array to contain items that have a limit * All values are set to 0 diff --git a/TypeScript/4UseACustomConfigFile/types/generators/LocationGenerator.d.ts b/TypeScript/4UseACustomConfigFile/types/generators/LocationGenerator.d.ts index 04b1599..d5bf61c 100644 --- a/TypeScript/4UseACustomConfigFile/types/generators/LocationGenerator.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/generators/LocationGenerator.d.ts @@ -2,7 +2,7 @@ import { ContainerHelper } from "../helpers/ContainerHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; -import { ILooseLoot, Spawnpoint, SpawnpointsForced, SpawnpointTemplate } from "../models/eft/common/ILooseLoot"; +import { ILooseLoot, Spawnpoint, SpawnpointTemplate, SpawnpointsForced } from "../models/eft/common/ILooseLoot"; import { Item } from "../models/eft/common/tables/IItem"; import { IStaticAmmoDetails, IStaticContainerProps, IStaticForcedProps, IStaticLootDetails } from "../models/eft/common/tables/ILootBase"; import { ILocationConfig } from "../models/spt/config/ILocationConfig"; @@ -13,7 +13,7 @@ import { SeasonalEventService } from "../services/SeasonalEventService"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; import { ObjectId } from "../utils/ObjectId"; -import { RandomUtil } from "../utils/RandomUtil"; +import { ProbabilityObjectArray, RandomUtil } from "../utils/RandomUtil"; export interface IContainerItem { items: Item[]; width: number; @@ -35,15 +35,38 @@ export declare class LocationGenerator { protected locationConfig: ILocationConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, mathUtil: MathUtil, seasonalEventService: SeasonalEventService, containerHelper: ContainerHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** - * Choose loot to put into a static container - * @param containerIn - * @param staticForced - * @param staticLootDist - * @param staticAmmoDist + * Choose loot to put into a static container based on weighting + * Handle forced items + seasonal item removal when not in season + * @param staticContainer The container itself we will add loot to + * @param staticForced Loot we need to force into the container + * @param staticLootDist staticLoot.json + * @param staticAmmoDist staticAmmo.json * @param locationName Name of the map to generate static loot for * @returns IStaticContainerProps */ - generateContainerLoot(containerIn: IStaticContainerProps, staticForced: IStaticForcedProps[], staticLootDist: Record, staticAmmoDist: Record, locationName: string): IStaticContainerProps; + generateContainerLoot(staticContainer: IStaticContainerProps, staticForced: IStaticForcedProps[], staticLootDist: Record, staticAmmoDist: Record, locationName: string): IStaticContainerProps; + /** + * Get a 2d grid of a containers item slots + * @param containerTpl Tpl id of the container + * @returns number[][] + */ + protected getContainerMapping(containerTpl: string): number[][]; + /** + * Look up a containers itemcountDistribution data and choose an item count based on the found weights + * @param containerTypeId Container to get item count for + * @param staticLootDist staticLoot.json + * @param locationName Map name (to get per-map multiplier for from config) + * @returns item count + */ + protected getWeightedCountOfContainerItems(containerTypeId: string, staticLootDist: Record, locationName: string): number; + /** + * Get all possible loot items that can be placed into a container + * Do not add seasonal items if found + current date is inside seasonal event + * @param containerTypeId Contianer to get possible loot for + * @param staticLootDist staticLoot.json + * @returns ProbabilityObjectArray of item tpls + probabilty + */ + protected getPossibleLootItemsForContainer(containerTypeId: string, staticLootDist: Record): ProbabilityObjectArray; protected getLooseLootMultiplerForLocation(location: string): number; protected getStaticLootMultiplerForLocation(location: string): number; /** diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/ContainerHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/ContainerHelper.d.ts index 3c2ee93..84e8c41 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/ContainerHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/ContainerHelper.d.ts @@ -8,5 +8,5 @@ export declare class FindSlotResult { export declare class ContainerHelper { protected locateSlot(container2D: number[][], containerX: number, containerY: number, x: number, y: number, itemW: number, itemH: number): boolean; findSlotForItem(container2D: number[][], itemWidth: number, itemHeight: number): FindSlotResult; - fillContainerMapWithItem(container2D: number[][], x: number, y: number, itemW: number, itemH: number, rotate: boolean): any; + fillContainerMapWithItem(container2D: number[][], x: number, y: number, itemW: number, itemH: number, rotate: boolean): number[][]; } diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IRagfairConfig.d.ts index 1eb640b..9676977 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IRagfairConfig.d.ts @@ -107,6 +107,8 @@ export interface Condition { max: number; } export interface Blacklist { + /** Damaged ammo packs */ + damagedAmmoPacks: boolean; /** Custom blacklist for item Tpls */ custom: string[]; /** BSG blacklist a large number of items from flea, true = use blacklist */ diff --git a/TypeScript/4UseACustomConfigFile/types/services/RagfairPriceService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/RagfairPriceService.d.ts index d3f56c6..ca162da 100644 --- a/TypeScript/4UseACustomConfigFile/types/services/RagfairPriceService.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/services/RagfairPriceService.d.ts @@ -34,7 +34,7 @@ export declare class RagfairPriceService implements OnLoad { */ onLoad(): Promise; /** - * Add placeholder values for the new sealed weapon containers + * Add placeholder values for items missing from handbook */ protected addMissingHandbookPrices(): void; getRoute(): string; diff --git a/TypeScript/5ReplaceMethod/types/controllers/InventoryController.d.ts b/TypeScript/5ReplaceMethod/types/controllers/InventoryController.d.ts index cf8d81a..09c130c 100644 --- a/TypeScript/5ReplaceMethod/types/controllers/InventoryController.d.ts +++ b/TypeScript/5ReplaceMethod/types/controllers/InventoryController.d.ts @@ -63,6 +63,12 @@ export declare class InventoryController { * @returns IItemEventRouterResponse */ moveItem(pmcData: IPmcData, moveRequest: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Get a event router response with inventory trader message + * @param output Item event router response + * @returns Item event router response + */ + protected getTraderExploitErrorResponse(output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Remove Item from Profile * Deep tree item deletion, also removes items from insurance list diff --git a/TypeScript/5ReplaceMethod/types/generators/BotLootGenerator.d.ts b/TypeScript/5ReplaceMethod/types/generators/BotLootGenerator.d.ts index c847d4d..6f2f6ec 100644 --- a/TypeScript/5ReplaceMethod/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/5ReplaceMethod/types/generators/BotLootGenerator.d.ts @@ -64,6 +64,7 @@ export declare class BotLootGenerator { */ protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): void; /** + * @deprecated replaced by getRandomItemFromPoolByRole() * Get a random item from the pool parameter using the biasedRandomNumber system * @param pool pool of items to pick an item from * @param isPmc is the bot being created a pmc @@ -71,11 +72,25 @@ export declare class BotLootGenerator { */ protected getRandomItemFromPool(pool: ITemplateItem[], isPmc: boolean): ITemplateItem; /** + * Get a random item from the pool parameter using the biasedRandomNumber system + * @param pool pool of items to pick an item from + * @param isPmc is the bot being created a pmc + * @returns ITemplateItem object + */ + protected getRandomItemFromPoolByRole(pool: ITemplateItem[], botRole: string): ITemplateItem; + /** + * @deprecated Replaced by getBotLootNValueByRole() * Get the loot nvalue from botconfig * @param isPmc if true the pmc nvalue is returned * @returns nvalue as number */ protected getBotLootNValue(isPmc: boolean): number; + /** + * Get the loot nvalue from botconfig + * @param botRole role of bot e.g. assault/sptBear + * @returns nvalue as number + */ + protected getBotLootNValueByRole(botRole: string): number; /** * Update item limit array to contain items that have a limit * All values are set to 0 diff --git a/TypeScript/5ReplaceMethod/types/generators/LocationGenerator.d.ts b/TypeScript/5ReplaceMethod/types/generators/LocationGenerator.d.ts index 04b1599..d5bf61c 100644 --- a/TypeScript/5ReplaceMethod/types/generators/LocationGenerator.d.ts +++ b/TypeScript/5ReplaceMethod/types/generators/LocationGenerator.d.ts @@ -2,7 +2,7 @@ import { ContainerHelper } from "../helpers/ContainerHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; -import { ILooseLoot, Spawnpoint, SpawnpointsForced, SpawnpointTemplate } from "../models/eft/common/ILooseLoot"; +import { ILooseLoot, Spawnpoint, SpawnpointTemplate, SpawnpointsForced } from "../models/eft/common/ILooseLoot"; import { Item } from "../models/eft/common/tables/IItem"; import { IStaticAmmoDetails, IStaticContainerProps, IStaticForcedProps, IStaticLootDetails } from "../models/eft/common/tables/ILootBase"; import { ILocationConfig } from "../models/spt/config/ILocationConfig"; @@ -13,7 +13,7 @@ import { SeasonalEventService } from "../services/SeasonalEventService"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; import { ObjectId } from "../utils/ObjectId"; -import { RandomUtil } from "../utils/RandomUtil"; +import { ProbabilityObjectArray, RandomUtil } from "../utils/RandomUtil"; export interface IContainerItem { items: Item[]; width: number; @@ -35,15 +35,38 @@ export declare class LocationGenerator { protected locationConfig: ILocationConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, mathUtil: MathUtil, seasonalEventService: SeasonalEventService, containerHelper: ContainerHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** - * Choose loot to put into a static container - * @param containerIn - * @param staticForced - * @param staticLootDist - * @param staticAmmoDist + * Choose loot to put into a static container based on weighting + * Handle forced items + seasonal item removal when not in season + * @param staticContainer The container itself we will add loot to + * @param staticForced Loot we need to force into the container + * @param staticLootDist staticLoot.json + * @param staticAmmoDist staticAmmo.json * @param locationName Name of the map to generate static loot for * @returns IStaticContainerProps */ - generateContainerLoot(containerIn: IStaticContainerProps, staticForced: IStaticForcedProps[], staticLootDist: Record, staticAmmoDist: Record, locationName: string): IStaticContainerProps; + generateContainerLoot(staticContainer: IStaticContainerProps, staticForced: IStaticForcedProps[], staticLootDist: Record, staticAmmoDist: Record, locationName: string): IStaticContainerProps; + /** + * Get a 2d grid of a containers item slots + * @param containerTpl Tpl id of the container + * @returns number[][] + */ + protected getContainerMapping(containerTpl: string): number[][]; + /** + * Look up a containers itemcountDistribution data and choose an item count based on the found weights + * @param containerTypeId Container to get item count for + * @param staticLootDist staticLoot.json + * @param locationName Map name (to get per-map multiplier for from config) + * @returns item count + */ + protected getWeightedCountOfContainerItems(containerTypeId: string, staticLootDist: Record, locationName: string): number; + /** + * Get all possible loot items that can be placed into a container + * Do not add seasonal items if found + current date is inside seasonal event + * @param containerTypeId Contianer to get possible loot for + * @param staticLootDist staticLoot.json + * @returns ProbabilityObjectArray of item tpls + probabilty + */ + protected getPossibleLootItemsForContainer(containerTypeId: string, staticLootDist: Record): ProbabilityObjectArray; protected getLooseLootMultiplerForLocation(location: string): number; protected getStaticLootMultiplerForLocation(location: string): number; /** diff --git a/TypeScript/5ReplaceMethod/types/helpers/ContainerHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/ContainerHelper.d.ts index 3c2ee93..84e8c41 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/ContainerHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/ContainerHelper.d.ts @@ -8,5 +8,5 @@ export declare class FindSlotResult { export declare class ContainerHelper { protected locateSlot(container2D: number[][], containerX: number, containerY: number, x: number, y: number, itemW: number, itemH: number): boolean; findSlotForItem(container2D: number[][], itemWidth: number, itemHeight: number): FindSlotResult; - fillContainerMapWithItem(container2D: number[][], x: number, y: number, itemW: number, itemH: number, rotate: boolean): any; + fillContainerMapWithItem(container2D: number[][], x: number, y: number, itemW: number, itemH: number, rotate: boolean): number[][]; } diff --git a/TypeScript/5ReplaceMethod/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/config/IRagfairConfig.d.ts index 1eb640b..9676977 100644 --- a/TypeScript/5ReplaceMethod/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/spt/config/IRagfairConfig.d.ts @@ -107,6 +107,8 @@ export interface Condition { max: number; } export interface Blacklist { + /** Damaged ammo packs */ + damagedAmmoPacks: boolean; /** Custom blacklist for item Tpls */ custom: string[]; /** BSG blacklist a large number of items from flea, true = use blacklist */ diff --git a/TypeScript/5ReplaceMethod/types/services/RagfairPriceService.d.ts b/TypeScript/5ReplaceMethod/types/services/RagfairPriceService.d.ts index d3f56c6..ca162da 100644 --- a/TypeScript/5ReplaceMethod/types/services/RagfairPriceService.d.ts +++ b/TypeScript/5ReplaceMethod/types/services/RagfairPriceService.d.ts @@ -34,7 +34,7 @@ export declare class RagfairPriceService implements OnLoad { */ onLoad(): Promise; /** - * Add placeholder values for the new sealed weapon containers + * Add placeholder values for items missing from handbook */ protected addMissingHandbookPrices(): void; getRoute(): string; diff --git a/TypeScript/6ReferenceAnotherClass/types/controllers/InventoryController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/InventoryController.d.ts index cf8d81a..09c130c 100644 --- a/TypeScript/6ReferenceAnotherClass/types/controllers/InventoryController.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/controllers/InventoryController.d.ts @@ -63,6 +63,12 @@ export declare class InventoryController { * @returns IItemEventRouterResponse */ moveItem(pmcData: IPmcData, moveRequest: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Get a event router response with inventory trader message + * @param output Item event router response + * @returns Item event router response + */ + protected getTraderExploitErrorResponse(output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Remove Item from Profile * Deep tree item deletion, also removes items from insurance list diff --git a/TypeScript/6ReferenceAnotherClass/types/generators/BotLootGenerator.d.ts b/TypeScript/6ReferenceAnotherClass/types/generators/BotLootGenerator.d.ts index c847d4d..6f2f6ec 100644 --- a/TypeScript/6ReferenceAnotherClass/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/generators/BotLootGenerator.d.ts @@ -64,6 +64,7 @@ export declare class BotLootGenerator { */ protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): void; /** + * @deprecated replaced by getRandomItemFromPoolByRole() * Get a random item from the pool parameter using the biasedRandomNumber system * @param pool pool of items to pick an item from * @param isPmc is the bot being created a pmc @@ -71,11 +72,25 @@ export declare class BotLootGenerator { */ protected getRandomItemFromPool(pool: ITemplateItem[], isPmc: boolean): ITemplateItem; /** + * Get a random item from the pool parameter using the biasedRandomNumber system + * @param pool pool of items to pick an item from + * @param isPmc is the bot being created a pmc + * @returns ITemplateItem object + */ + protected getRandomItemFromPoolByRole(pool: ITemplateItem[], botRole: string): ITemplateItem; + /** + * @deprecated Replaced by getBotLootNValueByRole() * Get the loot nvalue from botconfig * @param isPmc if true the pmc nvalue is returned * @returns nvalue as number */ protected getBotLootNValue(isPmc: boolean): number; + /** + * Get the loot nvalue from botconfig + * @param botRole role of bot e.g. assault/sptBear + * @returns nvalue as number + */ + protected getBotLootNValueByRole(botRole: string): number; /** * Update item limit array to contain items that have a limit * All values are set to 0 diff --git a/TypeScript/6ReferenceAnotherClass/types/generators/LocationGenerator.d.ts b/TypeScript/6ReferenceAnotherClass/types/generators/LocationGenerator.d.ts index 04b1599..d5bf61c 100644 --- a/TypeScript/6ReferenceAnotherClass/types/generators/LocationGenerator.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/generators/LocationGenerator.d.ts @@ -2,7 +2,7 @@ import { ContainerHelper } from "../helpers/ContainerHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; -import { ILooseLoot, Spawnpoint, SpawnpointsForced, SpawnpointTemplate } from "../models/eft/common/ILooseLoot"; +import { ILooseLoot, Spawnpoint, SpawnpointTemplate, SpawnpointsForced } from "../models/eft/common/ILooseLoot"; import { Item } from "../models/eft/common/tables/IItem"; import { IStaticAmmoDetails, IStaticContainerProps, IStaticForcedProps, IStaticLootDetails } from "../models/eft/common/tables/ILootBase"; import { ILocationConfig } from "../models/spt/config/ILocationConfig"; @@ -13,7 +13,7 @@ import { SeasonalEventService } from "../services/SeasonalEventService"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; import { ObjectId } from "../utils/ObjectId"; -import { RandomUtil } from "../utils/RandomUtil"; +import { ProbabilityObjectArray, RandomUtil } from "../utils/RandomUtil"; export interface IContainerItem { items: Item[]; width: number; @@ -35,15 +35,38 @@ export declare class LocationGenerator { protected locationConfig: ILocationConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, mathUtil: MathUtil, seasonalEventService: SeasonalEventService, containerHelper: ContainerHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** - * Choose loot to put into a static container - * @param containerIn - * @param staticForced - * @param staticLootDist - * @param staticAmmoDist + * Choose loot to put into a static container based on weighting + * Handle forced items + seasonal item removal when not in season + * @param staticContainer The container itself we will add loot to + * @param staticForced Loot we need to force into the container + * @param staticLootDist staticLoot.json + * @param staticAmmoDist staticAmmo.json * @param locationName Name of the map to generate static loot for * @returns IStaticContainerProps */ - generateContainerLoot(containerIn: IStaticContainerProps, staticForced: IStaticForcedProps[], staticLootDist: Record, staticAmmoDist: Record, locationName: string): IStaticContainerProps; + generateContainerLoot(staticContainer: IStaticContainerProps, staticForced: IStaticForcedProps[], staticLootDist: Record, staticAmmoDist: Record, locationName: string): IStaticContainerProps; + /** + * Get a 2d grid of a containers item slots + * @param containerTpl Tpl id of the container + * @returns number[][] + */ + protected getContainerMapping(containerTpl: string): number[][]; + /** + * Look up a containers itemcountDistribution data and choose an item count based on the found weights + * @param containerTypeId Container to get item count for + * @param staticLootDist staticLoot.json + * @param locationName Map name (to get per-map multiplier for from config) + * @returns item count + */ + protected getWeightedCountOfContainerItems(containerTypeId: string, staticLootDist: Record, locationName: string): number; + /** + * Get all possible loot items that can be placed into a container + * Do not add seasonal items if found + current date is inside seasonal event + * @param containerTypeId Contianer to get possible loot for + * @param staticLootDist staticLoot.json + * @returns ProbabilityObjectArray of item tpls + probabilty + */ + protected getPossibleLootItemsForContainer(containerTypeId: string, staticLootDist: Record): ProbabilityObjectArray; protected getLooseLootMultiplerForLocation(location: string): number; protected getStaticLootMultiplerForLocation(location: string): number; /** diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/ContainerHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/ContainerHelper.d.ts index 3c2ee93..84e8c41 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/ContainerHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/ContainerHelper.d.ts @@ -8,5 +8,5 @@ export declare class FindSlotResult { export declare class ContainerHelper { protected locateSlot(container2D: number[][], containerX: number, containerY: number, x: number, y: number, itemW: number, itemH: number): boolean; findSlotForItem(container2D: number[][], itemWidth: number, itemHeight: number): FindSlotResult; - fillContainerMapWithItem(container2D: number[][], x: number, y: number, itemW: number, itemH: number, rotate: boolean): any; + fillContainerMapWithItem(container2D: number[][], x: number, y: number, itemW: number, itemH: number, rotate: boolean): number[][]; } diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IRagfairConfig.d.ts index 1eb640b..9676977 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IRagfairConfig.d.ts @@ -107,6 +107,8 @@ export interface Condition { max: number; } export interface Blacklist { + /** Damaged ammo packs */ + damagedAmmoPacks: boolean; /** Custom blacklist for item Tpls */ custom: string[]; /** BSG blacklist a large number of items from flea, true = use blacklist */ diff --git a/TypeScript/6ReferenceAnotherClass/types/services/RagfairPriceService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/RagfairPriceService.d.ts index d3f56c6..ca162da 100644 --- a/TypeScript/6ReferenceAnotherClass/types/services/RagfairPriceService.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/services/RagfairPriceService.d.ts @@ -34,7 +34,7 @@ export declare class RagfairPriceService implements OnLoad { */ onLoad(): Promise; /** - * Add placeholder values for the new sealed weapon containers + * Add placeholder values for items missing from handbook */ protected addMissingHandbookPrices(): void; getRoute(): string; diff --git a/TypeScript/7OnLoadHook/types/controllers/InventoryController.d.ts b/TypeScript/7OnLoadHook/types/controllers/InventoryController.d.ts index cf8d81a..09c130c 100644 --- a/TypeScript/7OnLoadHook/types/controllers/InventoryController.d.ts +++ b/TypeScript/7OnLoadHook/types/controllers/InventoryController.d.ts @@ -63,6 +63,12 @@ export declare class InventoryController { * @returns IItemEventRouterResponse */ moveItem(pmcData: IPmcData, moveRequest: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Get a event router response with inventory trader message + * @param output Item event router response + * @returns Item event router response + */ + protected getTraderExploitErrorResponse(output: IItemEventRouterResponse): IItemEventRouterResponse; /** * Remove Item from Profile * Deep tree item deletion, also removes items from insurance list diff --git a/TypeScript/7OnLoadHook/types/generators/BotLootGenerator.d.ts b/TypeScript/7OnLoadHook/types/generators/BotLootGenerator.d.ts index c847d4d..6f2f6ec 100644 --- a/TypeScript/7OnLoadHook/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/7OnLoadHook/types/generators/BotLootGenerator.d.ts @@ -64,6 +64,7 @@ export declare class BotLootGenerator { */ protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): void; /** + * @deprecated replaced by getRandomItemFromPoolByRole() * Get a random item from the pool parameter using the biasedRandomNumber system * @param pool pool of items to pick an item from * @param isPmc is the bot being created a pmc @@ -71,11 +72,25 @@ export declare class BotLootGenerator { */ protected getRandomItemFromPool(pool: ITemplateItem[], isPmc: boolean): ITemplateItem; /** + * Get a random item from the pool parameter using the biasedRandomNumber system + * @param pool pool of items to pick an item from + * @param isPmc is the bot being created a pmc + * @returns ITemplateItem object + */ + protected getRandomItemFromPoolByRole(pool: ITemplateItem[], botRole: string): ITemplateItem; + /** + * @deprecated Replaced by getBotLootNValueByRole() * Get the loot nvalue from botconfig * @param isPmc if true the pmc nvalue is returned * @returns nvalue as number */ protected getBotLootNValue(isPmc: boolean): number; + /** + * Get the loot nvalue from botconfig + * @param botRole role of bot e.g. assault/sptBear + * @returns nvalue as number + */ + protected getBotLootNValueByRole(botRole: string): number; /** * Update item limit array to contain items that have a limit * All values are set to 0 diff --git a/TypeScript/7OnLoadHook/types/generators/LocationGenerator.d.ts b/TypeScript/7OnLoadHook/types/generators/LocationGenerator.d.ts index 04b1599..d5bf61c 100644 --- a/TypeScript/7OnLoadHook/types/generators/LocationGenerator.d.ts +++ b/TypeScript/7OnLoadHook/types/generators/LocationGenerator.d.ts @@ -2,7 +2,7 @@ import { ContainerHelper } from "../helpers/ContainerHelper"; import { ItemHelper } from "../helpers/ItemHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; -import { ILooseLoot, Spawnpoint, SpawnpointsForced, SpawnpointTemplate } from "../models/eft/common/ILooseLoot"; +import { ILooseLoot, Spawnpoint, SpawnpointTemplate, SpawnpointsForced } from "../models/eft/common/ILooseLoot"; import { Item } from "../models/eft/common/tables/IItem"; import { IStaticAmmoDetails, IStaticContainerProps, IStaticForcedProps, IStaticLootDetails } from "../models/eft/common/tables/ILootBase"; import { ILocationConfig } from "../models/spt/config/ILocationConfig"; @@ -13,7 +13,7 @@ import { SeasonalEventService } from "../services/SeasonalEventService"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; import { ObjectId } from "../utils/ObjectId"; -import { RandomUtil } from "../utils/RandomUtil"; +import { ProbabilityObjectArray, RandomUtil } from "../utils/RandomUtil"; export interface IContainerItem { items: Item[]; width: number; @@ -35,15 +35,38 @@ export declare class LocationGenerator { protected locationConfig: ILocationConfig; constructor(logger: ILogger, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, mathUtil: MathUtil, seasonalEventService: SeasonalEventService, containerHelper: ContainerHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer); /** - * Choose loot to put into a static container - * @param containerIn - * @param staticForced - * @param staticLootDist - * @param staticAmmoDist + * Choose loot to put into a static container based on weighting + * Handle forced items + seasonal item removal when not in season + * @param staticContainer The container itself we will add loot to + * @param staticForced Loot we need to force into the container + * @param staticLootDist staticLoot.json + * @param staticAmmoDist staticAmmo.json * @param locationName Name of the map to generate static loot for * @returns IStaticContainerProps */ - generateContainerLoot(containerIn: IStaticContainerProps, staticForced: IStaticForcedProps[], staticLootDist: Record, staticAmmoDist: Record, locationName: string): IStaticContainerProps; + generateContainerLoot(staticContainer: IStaticContainerProps, staticForced: IStaticForcedProps[], staticLootDist: Record, staticAmmoDist: Record, locationName: string): IStaticContainerProps; + /** + * Get a 2d grid of a containers item slots + * @param containerTpl Tpl id of the container + * @returns number[][] + */ + protected getContainerMapping(containerTpl: string): number[][]; + /** + * Look up a containers itemcountDistribution data and choose an item count based on the found weights + * @param containerTypeId Container to get item count for + * @param staticLootDist staticLoot.json + * @param locationName Map name (to get per-map multiplier for from config) + * @returns item count + */ + protected getWeightedCountOfContainerItems(containerTypeId: string, staticLootDist: Record, locationName: string): number; + /** + * Get all possible loot items that can be placed into a container + * Do not add seasonal items if found + current date is inside seasonal event + * @param containerTypeId Contianer to get possible loot for + * @param staticLootDist staticLoot.json + * @returns ProbabilityObjectArray of item tpls + probabilty + */ + protected getPossibleLootItemsForContainer(containerTypeId: string, staticLootDist: Record): ProbabilityObjectArray; protected getLooseLootMultiplerForLocation(location: string): number; protected getStaticLootMultiplerForLocation(location: string): number; /** diff --git a/TypeScript/7OnLoadHook/types/helpers/ContainerHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/ContainerHelper.d.ts index 3c2ee93..84e8c41 100644 --- a/TypeScript/7OnLoadHook/types/helpers/ContainerHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/ContainerHelper.d.ts @@ -8,5 +8,5 @@ export declare class FindSlotResult { export declare class ContainerHelper { protected locateSlot(container2D: number[][], containerX: number, containerY: number, x: number, y: number, itemW: number, itemH: number): boolean; findSlotForItem(container2D: number[][], itemWidth: number, itemHeight: number): FindSlotResult; - fillContainerMapWithItem(container2D: number[][], x: number, y: number, itemW: number, itemH: number, rotate: boolean): any; + fillContainerMapWithItem(container2D: number[][], x: number, y: number, itemW: number, itemH: number, rotate: boolean): number[][]; } diff --git a/TypeScript/7OnLoadHook/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/7OnLoadHook/types/models/spt/config/IRagfairConfig.d.ts index 1eb640b..9676977 100644 --- a/TypeScript/7OnLoadHook/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/7OnLoadHook/types/models/spt/config/IRagfairConfig.d.ts @@ -107,6 +107,8 @@ export interface Condition { max: number; } export interface Blacklist { + /** Damaged ammo packs */ + damagedAmmoPacks: boolean; /** Custom blacklist for item Tpls */ custom: string[]; /** BSG blacklist a large number of items from flea, true = use blacklist */ diff --git a/TypeScript/7OnLoadHook/types/services/RagfairPriceService.d.ts b/TypeScript/7OnLoadHook/types/services/RagfairPriceService.d.ts index d3f56c6..ca162da 100644 --- a/TypeScript/7OnLoadHook/types/services/RagfairPriceService.d.ts +++ b/TypeScript/7OnLoadHook/types/services/RagfairPriceService.d.ts @@ -34,7 +34,7 @@ export declare class RagfairPriceService implements OnLoad { */ onLoad(): Promise; /** - * Add placeholder values for the new sealed weapon containers + * Add placeholder values for items missing from handbook */ protected addMissingHandbookPrices(): void; getRoute(): string;