Update types

This commit is contained in:
Dev 2023-08-06 16:20:08 +01:00
parent d9c933fe2b
commit 71a2f8dae6
114 changed files with 969 additions and 266 deletions

View File

@ -267,6 +267,7 @@ export interface BackendCounter {
value: number; value: number;
} }
export interface InsuredItem { export interface InsuredItem {
/** Trader Id item was insured by */
tid: string; tid: string;
itemId: string; itemId: string;
} }

View File

@ -12,6 +12,7 @@ export interface Upd {
Togglable?: Togglable; Togglable?: Togglable;
Map?: Map; Map?: Map;
Tag?: Tag; Tag?: Tag;
/** SPT specific property, not made by BSG */
sptPresetId?: string; sptPresetId?: string;
FaceShield?: FaceShield; FaceShield?: FaceShield;
StackObjectsCount?: number; StackObjectsCount?: number;

View File

@ -0,0 +1,6 @@
export interface IInsuredItemsData {
id: string;
durability?: number;
maxDurability?: number;
hits?: number;
}

View File

@ -1,9 +1,11 @@
import { PlayerRaidEndState } from "../../../models/enums/PlayerRaidEndState"; import { PlayerRaidEndState } from "../../../models/enums/PlayerRaidEndState";
import { IPmcData } from "../common/IPmcData"; import { IPmcData } from "../common/IPmcData";
import { ISyncHealthRequestData } from "../health/ISyncHealthRequestData"; import { ISyncHealthRequestData } from "../health/ISyncHealthRequestData";
import { IInsuredItemsData } from "./IInsuredItemsData";
export interface ISaveProgressRequestData { export interface ISaveProgressRequestData {
exit: PlayerRaidEndState; exit: PlayerRaidEndState;
profile: IPmcData; profile: IPmcData;
isPlayerScav: boolean; isPlayerScav: boolean;
health: ISyncHealthRequestData; health: ISyncHealthRequestData;
insurance: IInsuredItemsData[];
} }

View File

@ -71,13 +71,8 @@ export interface Dynamic {
removeSeasonalItemsWhenNotInEvent: boolean; removeSeasonalItemsWhenNotInEvent: boolean;
/** Flea blacklist settings */ /** Flea blacklist settings */
blacklist: Blacklist; blacklist: Blacklist;
/** Should prices over the multiplier be adjusted */ /** Dict of price limits keyed by item type */
unreasonableModPrices: IUnreasonableModPrices; unreasonableModPrices: Record<string, IUnreasonableModPrices>;
}
export interface IUnreasonableModPrices {
enabled: boolean;
handbookPriceOverMultiplier: number;
newPriceHandbookMultiplier: number;
} }
export interface Barter { export interface Barter {
/** Should barter offers be generated */ /** Should barter offers be generated */
@ -121,3 +116,8 @@ export interface Blacklist {
/** Should trader items that are blacklisted by bsg */ /** Should trader items that are blacklisted by bsg */
traderItems: boolean; traderItems: boolean;
} }
export interface IUnreasonableModPrices {
enabled: boolean;
handbookPriceOverMultiplier: number;
newPriceHandbookMultiplier: number;
}

View File

@ -6,14 +6,15 @@ import { NotificationSendHelper } from "../helpers/NotificationSendHelper";
import { SecureContainerHelper } from "../helpers/SecureContainerHelper"; import { SecureContainerHelper } from "../helpers/SecureContainerHelper";
import { TraderHelper } from "../helpers/TraderHelper"; import { TraderHelper } from "../helpers/TraderHelper";
import { IPmcData } from "../models/eft/common/IPmcData"; import { IPmcData } from "../models/eft/common/IPmcData";
import { InsuredItem } from "../models/eft/common/tables/IBotBase";
import { Item } from "../models/eft/common/tables/IItem"; import { Item } from "../models/eft/common/tables/IItem";
import { IInsuredItemsData } from "../models/eft/inRaid/IInsuredItemsData";
import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData";
import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig"; import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig";
import { ILogger } from "../models/spt/utils/ILogger"; import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer"; import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer"; import { DatabaseServer } from "../servers/DatabaseServer";
import { SaveServer } from "../servers/SaveServer"; import { SaveServer } from "../servers/SaveServer";
import { JsonUtil } from "../utils/JsonUtil";
import { RandomUtil } from "../utils/RandomUtil"; import { RandomUtil } from "../utils/RandomUtil";
import { TimeUtil } from "../utils/TimeUtil"; import { TimeUtil } from "../utils/TimeUtil";
import { LocaleService } from "./LocaleService"; import { LocaleService } from "./LocaleService";
@ -24,6 +25,7 @@ export declare class InsuranceService {
protected secureContainerHelper: SecureContainerHelper; protected secureContainerHelper: SecureContainerHelper;
protected randomUtil: RandomUtil; protected randomUtil: RandomUtil;
protected itemHelper: ItemHelper; protected itemHelper: ItemHelper;
protected jsonUtil: JsonUtil;
protected timeUtil: TimeUtil; protected timeUtil: TimeUtil;
protected saveServer: SaveServer; protected saveServer: SaveServer;
protected traderHelper: TraderHelper; protected traderHelper: TraderHelper;
@ -35,7 +37,12 @@ export declare class InsuranceService {
protected configServer: ConfigServer; protected configServer: ConfigServer;
protected insured: Record<string, Record<string, Item[]>>; protected insured: Record<string, Record<string, Item[]>>;
protected insuranceConfig: IInsuranceConfig; protected insuranceConfig: IInsuranceConfig;
constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, notificationSendHelper: NotificationSendHelper, configServer: ConfigServer); constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, jsonUtil: JsonUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, notificationSendHelper: NotificationSendHelper, configServer: ConfigServer);
/**
* Does player have insurance array
* @param sessionId Player id
* @returns True if exists
*/
insuranceExists(sessionId: string): boolean; insuranceExists(sessionId: string): boolean;
/** /**
* Get all insured items by all traders for a profile * Get all insured items by all traders for a profile
@ -78,7 +85,7 @@ export declare class InsuranceService {
*/ */
protected getInsuranceReturnTimestamp(pmcData: IPmcData, trader: ITraderBase): number; protected getInsuranceReturnTimestamp(pmcData: IPmcData, trader: ITraderBase): number;
/** /**
* Store lost gear post-raid inside profile * Store lost gear post-raid inside profile, ready for later code to pick it up and mail it
* @param pmcData player profile to store gear in * @param pmcData player profile to store gear in
* @param offraidData post-raid request object * @param offraidData post-raid request object
* @param preRaidGear gear player wore prior to raid * @param preRaidGear gear player wore prior to raid
@ -86,6 +93,21 @@ export declare class InsuranceService {
* @param playerDied did the player die in raid * @param playerDied did the player die in raid
*/ */
storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): void; storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): void;
/**
* Take preraid item and update properties to ensure its ready to be given to player in insurance return mail
* @param pmcData Player profile
* @param insuredItem Insured items properties
* @param preRaidItem Insured item as it was pre-raid
* @param insuredItemFromClient Item data when player left raid (durability values)
* @returns Item object
*/
protected getInsuredItemDetails(pmcData: IPmcData, preRaidItem: Item, insuredItemFromClient: IInsuredItemsData): Item;
/**
* Reset slotId property to "hideout" when necessary (used to be in )
* @param pmcData Players pmcData.Inventory.equipment value
* @param itemToReturn item we will send to player as insurance return
*/
protected updateSlotIdValue(playerBaseInventoryEquipmentId: string, itemToReturn: Item): void;
/** /**
* Create a hash table for an array of items, keyed by items _id * Create a hash table for an array of items, keyed by items _id
* @param items Items to hash * @param items Items to hash
@ -94,12 +116,17 @@ export declare class InsuranceService {
protected createItemHashTable(items: Item[]): Record<string, Item>; protected createItemHashTable(items: Item[]): Record<string, Item>;
/** /**
* Add gear item to InsuredItems array in player profile * Add gear item to InsuredItems array in player profile
* @param pmcData profile to store item in
* @param insuredItem Item to store in profile
* @param actualItem item to store
* @param sessionID Session id * @param sessionID Session id
* @param pmcData Player profile
* @param itemToReturnToPlayer item to store
* @param traderId Id of trader item was insured with
*/ */
protected addGearToSend(pmcData: IPmcData, insuredItem: InsuredItem, actualItem: Item, sessionID: string): void; protected addGearToSend(gear: {
sessionID: string;
pmcData: IPmcData;
itemToReturnToPlayer: Item;
traderId: string;
}): void;
/** /**
* Does insurance exist for a player and by trader * Does insurance exist for a player and by trader
* @param sessionId Player id (session id) * @param sessionId Player id (session id)

View File

@ -267,6 +267,7 @@ export interface BackendCounter {
value: number; value: number;
} }
export interface InsuredItem { export interface InsuredItem {
/** Trader Id item was insured by */
tid: string; tid: string;
itemId: string; itemId: string;
} }

View File

@ -12,6 +12,7 @@ export interface Upd {
Togglable?: Togglable; Togglable?: Togglable;
Map?: Map; Map?: Map;
Tag?: Tag; Tag?: Tag;
/** SPT specific property, not made by BSG */
sptPresetId?: string; sptPresetId?: string;
FaceShield?: FaceShield; FaceShield?: FaceShield;
StackObjectsCount?: number; StackObjectsCount?: number;

View File

@ -0,0 +1,6 @@
export interface IInsuredItemsData {
id: string;
durability?: number;
maxDurability?: number;
hits?: number;
}

View File

@ -1,9 +1,11 @@
import { PlayerRaidEndState } from "../../../models/enums/PlayerRaidEndState"; import { PlayerRaidEndState } from "../../../models/enums/PlayerRaidEndState";
import { IPmcData } from "../common/IPmcData"; import { IPmcData } from "../common/IPmcData";
import { ISyncHealthRequestData } from "../health/ISyncHealthRequestData"; import { ISyncHealthRequestData } from "../health/ISyncHealthRequestData";
import { IInsuredItemsData } from "./IInsuredItemsData";
export interface ISaveProgressRequestData { export interface ISaveProgressRequestData {
exit: PlayerRaidEndState; exit: PlayerRaidEndState;
profile: IPmcData; profile: IPmcData;
isPlayerScav: boolean; isPlayerScav: boolean;
health: ISyncHealthRequestData; health: ISyncHealthRequestData;
insurance: IInsuredItemsData[];
} }

View File

@ -71,13 +71,8 @@ export interface Dynamic {
removeSeasonalItemsWhenNotInEvent: boolean; removeSeasonalItemsWhenNotInEvent: boolean;
/** Flea blacklist settings */ /** Flea blacklist settings */
blacklist: Blacklist; blacklist: Blacklist;
/** Should prices over the multiplier be adjusted */ /** Dict of price limits keyed by item type */
unreasonableModPrices: IUnreasonableModPrices; unreasonableModPrices: Record<string, IUnreasonableModPrices>;
}
export interface IUnreasonableModPrices {
enabled: boolean;
handbookPriceOverMultiplier: number;
newPriceHandbookMultiplier: number;
} }
export interface Barter { export interface Barter {
/** Should barter offers be generated */ /** Should barter offers be generated */
@ -121,3 +116,8 @@ export interface Blacklist {
/** Should trader items that are blacklisted by bsg */ /** Should trader items that are blacklisted by bsg */
traderItems: boolean; traderItems: boolean;
} }
export interface IUnreasonableModPrices {
enabled: boolean;
handbookPriceOverMultiplier: number;
newPriceHandbookMultiplier: number;
}

View File

@ -6,14 +6,15 @@ import { NotificationSendHelper } from "../helpers/NotificationSendHelper";
import { SecureContainerHelper } from "../helpers/SecureContainerHelper"; import { SecureContainerHelper } from "../helpers/SecureContainerHelper";
import { TraderHelper } from "../helpers/TraderHelper"; import { TraderHelper } from "../helpers/TraderHelper";
import { IPmcData } from "../models/eft/common/IPmcData"; import { IPmcData } from "../models/eft/common/IPmcData";
import { InsuredItem } from "../models/eft/common/tables/IBotBase";
import { Item } from "../models/eft/common/tables/IItem"; import { Item } from "../models/eft/common/tables/IItem";
import { IInsuredItemsData } from "../models/eft/inRaid/IInsuredItemsData";
import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData";
import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig"; import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig";
import { ILogger } from "../models/spt/utils/ILogger"; import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer"; import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer"; import { DatabaseServer } from "../servers/DatabaseServer";
import { SaveServer } from "../servers/SaveServer"; import { SaveServer } from "../servers/SaveServer";
import { JsonUtil } from "../utils/JsonUtil";
import { RandomUtil } from "../utils/RandomUtil"; import { RandomUtil } from "../utils/RandomUtil";
import { TimeUtil } from "../utils/TimeUtil"; import { TimeUtil } from "../utils/TimeUtil";
import { LocaleService } from "./LocaleService"; import { LocaleService } from "./LocaleService";
@ -24,6 +25,7 @@ export declare class InsuranceService {
protected secureContainerHelper: SecureContainerHelper; protected secureContainerHelper: SecureContainerHelper;
protected randomUtil: RandomUtil; protected randomUtil: RandomUtil;
protected itemHelper: ItemHelper; protected itemHelper: ItemHelper;
protected jsonUtil: JsonUtil;
protected timeUtil: TimeUtil; protected timeUtil: TimeUtil;
protected saveServer: SaveServer; protected saveServer: SaveServer;
protected traderHelper: TraderHelper; protected traderHelper: TraderHelper;
@ -35,7 +37,12 @@ export declare class InsuranceService {
protected configServer: ConfigServer; protected configServer: ConfigServer;
protected insured: Record<string, Record<string, Item[]>>; protected insured: Record<string, Record<string, Item[]>>;
protected insuranceConfig: IInsuranceConfig; protected insuranceConfig: IInsuranceConfig;
constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, notificationSendHelper: NotificationSendHelper, configServer: ConfigServer); constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, jsonUtil: JsonUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, notificationSendHelper: NotificationSendHelper, configServer: ConfigServer);
/**
* Does player have insurance array
* @param sessionId Player id
* @returns True if exists
*/
insuranceExists(sessionId: string): boolean; insuranceExists(sessionId: string): boolean;
/** /**
* Get all insured items by all traders for a profile * Get all insured items by all traders for a profile
@ -78,7 +85,7 @@ export declare class InsuranceService {
*/ */
protected getInsuranceReturnTimestamp(pmcData: IPmcData, trader: ITraderBase): number; protected getInsuranceReturnTimestamp(pmcData: IPmcData, trader: ITraderBase): number;
/** /**
* Store lost gear post-raid inside profile * Store lost gear post-raid inside profile, ready for later code to pick it up and mail it
* @param pmcData player profile to store gear in * @param pmcData player profile to store gear in
* @param offraidData post-raid request object * @param offraidData post-raid request object
* @param preRaidGear gear player wore prior to raid * @param preRaidGear gear player wore prior to raid
@ -86,6 +93,21 @@ export declare class InsuranceService {
* @param playerDied did the player die in raid * @param playerDied did the player die in raid
*/ */
storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): void; storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): void;
/**
* Take preraid item and update properties to ensure its ready to be given to player in insurance return mail
* @param pmcData Player profile
* @param insuredItem Insured items properties
* @param preRaidItem Insured item as it was pre-raid
* @param insuredItemFromClient Item data when player left raid (durability values)
* @returns Item object
*/
protected getInsuredItemDetails(pmcData: IPmcData, preRaidItem: Item, insuredItemFromClient: IInsuredItemsData): Item;
/**
* Reset slotId property to "hideout" when necessary (used to be in )
* @param pmcData Players pmcData.Inventory.equipment value
* @param itemToReturn item we will send to player as insurance return
*/
protected updateSlotIdValue(playerBaseInventoryEquipmentId: string, itemToReturn: Item): void;
/** /**
* Create a hash table for an array of items, keyed by items _id * Create a hash table for an array of items, keyed by items _id
* @param items Items to hash * @param items Items to hash
@ -94,12 +116,17 @@ export declare class InsuranceService {
protected createItemHashTable(items: Item[]): Record<string, Item>; protected createItemHashTable(items: Item[]): Record<string, Item>;
/** /**
* Add gear item to InsuredItems array in player profile * Add gear item to InsuredItems array in player profile
* @param pmcData profile to store item in
* @param insuredItem Item to store in profile
* @param actualItem item to store
* @param sessionID Session id * @param sessionID Session id
* @param pmcData Player profile
* @param itemToReturnToPlayer item to store
* @param traderId Id of trader item was insured with
*/ */
protected addGearToSend(pmcData: IPmcData, insuredItem: InsuredItem, actualItem: Item, sessionID: string): void; protected addGearToSend(gear: {
sessionID: string;
pmcData: IPmcData;
itemToReturnToPlayer: Item;
traderId: string;
}): void;
/** /**
* Does insurance exist for a player and by trader * Does insurance exist for a player and by trader
* @param sessionId Player id (session id) * @param sessionId Player id (session id)

View File

@ -267,6 +267,7 @@ export interface BackendCounter {
value: number; value: number;
} }
export interface InsuredItem { export interface InsuredItem {
/** Trader Id item was insured by */
tid: string; tid: string;
itemId: string; itemId: string;
} }

View File

@ -12,6 +12,7 @@ export interface Upd {
Togglable?: Togglable; Togglable?: Togglable;
Map?: Map; Map?: Map;
Tag?: Tag; Tag?: Tag;
/** SPT specific property, not made by BSG */
sptPresetId?: string; sptPresetId?: string;
FaceShield?: FaceShield; FaceShield?: FaceShield;
StackObjectsCount?: number; StackObjectsCount?: number;

View File

@ -0,0 +1,6 @@
export interface IInsuredItemsData {
id: string;
durability?: number;
maxDurability?: number;
hits?: number;
}

View File

@ -1,9 +1,11 @@
import { PlayerRaidEndState } from "../../../models/enums/PlayerRaidEndState"; import { PlayerRaidEndState } from "../../../models/enums/PlayerRaidEndState";
import { IPmcData } from "../common/IPmcData"; import { IPmcData } from "../common/IPmcData";
import { ISyncHealthRequestData } from "../health/ISyncHealthRequestData"; import { ISyncHealthRequestData } from "../health/ISyncHealthRequestData";
import { IInsuredItemsData } from "./IInsuredItemsData";
export interface ISaveProgressRequestData { export interface ISaveProgressRequestData {
exit: PlayerRaidEndState; exit: PlayerRaidEndState;
profile: IPmcData; profile: IPmcData;
isPlayerScav: boolean; isPlayerScav: boolean;
health: ISyncHealthRequestData; health: ISyncHealthRequestData;
insurance: IInsuredItemsData[];
} }

View File

@ -71,13 +71,8 @@ export interface Dynamic {
removeSeasonalItemsWhenNotInEvent: boolean; removeSeasonalItemsWhenNotInEvent: boolean;
/** Flea blacklist settings */ /** Flea blacklist settings */
blacklist: Blacklist; blacklist: Blacklist;
/** Should prices over the multiplier be adjusted */ /** Dict of price limits keyed by item type */
unreasonableModPrices: IUnreasonableModPrices; unreasonableModPrices: Record<string, IUnreasonableModPrices>;
}
export interface IUnreasonableModPrices {
enabled: boolean;
handbookPriceOverMultiplier: number;
newPriceHandbookMultiplier: number;
} }
export interface Barter { export interface Barter {
/** Should barter offers be generated */ /** Should barter offers be generated */
@ -121,3 +116,8 @@ export interface Blacklist {
/** Should trader items that are blacklisted by bsg */ /** Should trader items that are blacklisted by bsg */
traderItems: boolean; traderItems: boolean;
} }
export interface IUnreasonableModPrices {
enabled: boolean;
handbookPriceOverMultiplier: number;
newPriceHandbookMultiplier: number;
}

View File

@ -6,14 +6,15 @@ import { NotificationSendHelper } from "../helpers/NotificationSendHelper";
import { SecureContainerHelper } from "../helpers/SecureContainerHelper"; import { SecureContainerHelper } from "../helpers/SecureContainerHelper";
import { TraderHelper } from "../helpers/TraderHelper"; import { TraderHelper } from "../helpers/TraderHelper";
import { IPmcData } from "../models/eft/common/IPmcData"; import { IPmcData } from "../models/eft/common/IPmcData";
import { InsuredItem } from "../models/eft/common/tables/IBotBase";
import { Item } from "../models/eft/common/tables/IItem"; import { Item } from "../models/eft/common/tables/IItem";
import { IInsuredItemsData } from "../models/eft/inRaid/IInsuredItemsData";
import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData";
import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig"; import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig";
import { ILogger } from "../models/spt/utils/ILogger"; import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer"; import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer"; import { DatabaseServer } from "../servers/DatabaseServer";
import { SaveServer } from "../servers/SaveServer"; import { SaveServer } from "../servers/SaveServer";
import { JsonUtil } from "../utils/JsonUtil";
import { RandomUtil } from "../utils/RandomUtil"; import { RandomUtil } from "../utils/RandomUtil";
import { TimeUtil } from "../utils/TimeUtil"; import { TimeUtil } from "../utils/TimeUtil";
import { LocaleService } from "./LocaleService"; import { LocaleService } from "./LocaleService";
@ -24,6 +25,7 @@ export declare class InsuranceService {
protected secureContainerHelper: SecureContainerHelper; protected secureContainerHelper: SecureContainerHelper;
protected randomUtil: RandomUtil; protected randomUtil: RandomUtil;
protected itemHelper: ItemHelper; protected itemHelper: ItemHelper;
protected jsonUtil: JsonUtil;
protected timeUtil: TimeUtil; protected timeUtil: TimeUtil;
protected saveServer: SaveServer; protected saveServer: SaveServer;
protected traderHelper: TraderHelper; protected traderHelper: TraderHelper;
@ -35,7 +37,12 @@ export declare class InsuranceService {
protected configServer: ConfigServer; protected configServer: ConfigServer;
protected insured: Record<string, Record<string, Item[]>>; protected insured: Record<string, Record<string, Item[]>>;
protected insuranceConfig: IInsuranceConfig; protected insuranceConfig: IInsuranceConfig;
constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, notificationSendHelper: NotificationSendHelper, configServer: ConfigServer); constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, jsonUtil: JsonUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, notificationSendHelper: NotificationSendHelper, configServer: ConfigServer);
/**
* Does player have insurance array
* @param sessionId Player id
* @returns True if exists
*/
insuranceExists(sessionId: string): boolean; insuranceExists(sessionId: string): boolean;
/** /**
* Get all insured items by all traders for a profile * Get all insured items by all traders for a profile
@ -78,7 +85,7 @@ export declare class InsuranceService {
*/ */
protected getInsuranceReturnTimestamp(pmcData: IPmcData, trader: ITraderBase): number; protected getInsuranceReturnTimestamp(pmcData: IPmcData, trader: ITraderBase): number;
/** /**
* Store lost gear post-raid inside profile * Store lost gear post-raid inside profile, ready for later code to pick it up and mail it
* @param pmcData player profile to store gear in * @param pmcData player profile to store gear in
* @param offraidData post-raid request object * @param offraidData post-raid request object
* @param preRaidGear gear player wore prior to raid * @param preRaidGear gear player wore prior to raid
@ -86,6 +93,21 @@ export declare class InsuranceService {
* @param playerDied did the player die in raid * @param playerDied did the player die in raid
*/ */
storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): void; storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): void;
/**
* Take preraid item and update properties to ensure its ready to be given to player in insurance return mail
* @param pmcData Player profile
* @param insuredItem Insured items properties
* @param preRaidItem Insured item as it was pre-raid
* @param insuredItemFromClient Item data when player left raid (durability values)
* @returns Item object
*/
protected getInsuredItemDetails(pmcData: IPmcData, preRaidItem: Item, insuredItemFromClient: IInsuredItemsData): Item;
/**
* Reset slotId property to "hideout" when necessary (used to be in )
* @param pmcData Players pmcData.Inventory.equipment value
* @param itemToReturn item we will send to player as insurance return
*/
protected updateSlotIdValue(playerBaseInventoryEquipmentId: string, itemToReturn: Item): void;
/** /**
* Create a hash table for an array of items, keyed by items _id * Create a hash table for an array of items, keyed by items _id
* @param items Items to hash * @param items Items to hash
@ -94,12 +116,17 @@ export declare class InsuranceService {
protected createItemHashTable(items: Item[]): Record<string, Item>; protected createItemHashTable(items: Item[]): Record<string, Item>;
/** /**
* Add gear item to InsuredItems array in player profile * Add gear item to InsuredItems array in player profile
* @param pmcData profile to store item in
* @param insuredItem Item to store in profile
* @param actualItem item to store
* @param sessionID Session id * @param sessionID Session id
* @param pmcData Player profile
* @param itemToReturnToPlayer item to store
* @param traderId Id of trader item was insured with
*/ */
protected addGearToSend(pmcData: IPmcData, insuredItem: InsuredItem, actualItem: Item, sessionID: string): void; protected addGearToSend(gear: {
sessionID: string;
pmcData: IPmcData;
itemToReturnToPlayer: Item;
traderId: string;
}): void;
/** /**
* Does insurance exist for a player and by trader * Does insurance exist for a player and by trader
* @param sessionId Player id (session id) * @param sessionId Player id (session id)

View File

@ -267,6 +267,7 @@ export interface BackendCounter {
value: number; value: number;
} }
export interface InsuredItem { export interface InsuredItem {
/** Trader Id item was insured by */
tid: string; tid: string;
itemId: string; itemId: string;
} }

View File

@ -12,6 +12,7 @@ export interface Upd {
Togglable?: Togglable; Togglable?: Togglable;
Map?: Map; Map?: Map;
Tag?: Tag; Tag?: Tag;
/** SPT specific property, not made by BSG */
sptPresetId?: string; sptPresetId?: string;
FaceShield?: FaceShield; FaceShield?: FaceShield;
StackObjectsCount?: number; StackObjectsCount?: number;

View File

@ -0,0 +1,6 @@
export interface IInsuredItemsData {
id: string;
durability?: number;
maxDurability?: number;
hits?: number;
}

View File

@ -1,9 +1,11 @@
import { PlayerRaidEndState } from "../../../models/enums/PlayerRaidEndState"; import { PlayerRaidEndState } from "../../../models/enums/PlayerRaidEndState";
import { IPmcData } from "../common/IPmcData"; import { IPmcData } from "../common/IPmcData";
import { ISyncHealthRequestData } from "../health/ISyncHealthRequestData"; import { ISyncHealthRequestData } from "../health/ISyncHealthRequestData";
import { IInsuredItemsData } from "./IInsuredItemsData";
export interface ISaveProgressRequestData { export interface ISaveProgressRequestData {
exit: PlayerRaidEndState; exit: PlayerRaidEndState;
profile: IPmcData; profile: IPmcData;
isPlayerScav: boolean; isPlayerScav: boolean;
health: ISyncHealthRequestData; health: ISyncHealthRequestData;
insurance: IInsuredItemsData[];
} }

View File

@ -71,13 +71,8 @@ export interface Dynamic {
removeSeasonalItemsWhenNotInEvent: boolean; removeSeasonalItemsWhenNotInEvent: boolean;
/** Flea blacklist settings */ /** Flea blacklist settings */
blacklist: Blacklist; blacklist: Blacklist;
/** Should prices over the multiplier be adjusted */ /** Dict of price limits keyed by item type */
unreasonableModPrices: IUnreasonableModPrices; unreasonableModPrices: Record<string, IUnreasonableModPrices>;
}
export interface IUnreasonableModPrices {
enabled: boolean;
handbookPriceOverMultiplier: number;
newPriceHandbookMultiplier: number;
} }
export interface Barter { export interface Barter {
/** Should barter offers be generated */ /** Should barter offers be generated */
@ -121,3 +116,8 @@ export interface Blacklist {
/** Should trader items that are blacklisted by bsg */ /** Should trader items that are blacklisted by bsg */
traderItems: boolean; traderItems: boolean;
} }
export interface IUnreasonableModPrices {
enabled: boolean;
handbookPriceOverMultiplier: number;
newPriceHandbookMultiplier: number;
}

View File

@ -6,14 +6,15 @@ import { NotificationSendHelper } from "../helpers/NotificationSendHelper";
import { SecureContainerHelper } from "../helpers/SecureContainerHelper"; import { SecureContainerHelper } from "../helpers/SecureContainerHelper";
import { TraderHelper } from "../helpers/TraderHelper"; import { TraderHelper } from "../helpers/TraderHelper";
import { IPmcData } from "../models/eft/common/IPmcData"; import { IPmcData } from "../models/eft/common/IPmcData";
import { InsuredItem } from "../models/eft/common/tables/IBotBase";
import { Item } from "../models/eft/common/tables/IItem"; import { Item } from "../models/eft/common/tables/IItem";
import { IInsuredItemsData } from "../models/eft/inRaid/IInsuredItemsData";
import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData";
import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig"; import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig";
import { ILogger } from "../models/spt/utils/ILogger"; import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer"; import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer"; import { DatabaseServer } from "../servers/DatabaseServer";
import { SaveServer } from "../servers/SaveServer"; import { SaveServer } from "../servers/SaveServer";
import { JsonUtil } from "../utils/JsonUtil";
import { RandomUtil } from "../utils/RandomUtil"; import { RandomUtil } from "../utils/RandomUtil";
import { TimeUtil } from "../utils/TimeUtil"; import { TimeUtil } from "../utils/TimeUtil";
import { LocaleService } from "./LocaleService"; import { LocaleService } from "./LocaleService";
@ -24,6 +25,7 @@ export declare class InsuranceService {
protected secureContainerHelper: SecureContainerHelper; protected secureContainerHelper: SecureContainerHelper;
protected randomUtil: RandomUtil; protected randomUtil: RandomUtil;
protected itemHelper: ItemHelper; protected itemHelper: ItemHelper;
protected jsonUtil: JsonUtil;
protected timeUtil: TimeUtil; protected timeUtil: TimeUtil;
protected saveServer: SaveServer; protected saveServer: SaveServer;
protected traderHelper: TraderHelper; protected traderHelper: TraderHelper;
@ -35,7 +37,12 @@ export declare class InsuranceService {
protected configServer: ConfigServer; protected configServer: ConfigServer;
protected insured: Record<string, Record<string, Item[]>>; protected insured: Record<string, Record<string, Item[]>>;
protected insuranceConfig: IInsuranceConfig; protected insuranceConfig: IInsuranceConfig;
constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, notificationSendHelper: NotificationSendHelper, configServer: ConfigServer); constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, jsonUtil: JsonUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, notificationSendHelper: NotificationSendHelper, configServer: ConfigServer);
/**
* Does player have insurance array
* @param sessionId Player id
* @returns True if exists
*/
insuranceExists(sessionId: string): boolean; insuranceExists(sessionId: string): boolean;
/** /**
* Get all insured items by all traders for a profile * Get all insured items by all traders for a profile
@ -78,7 +85,7 @@ export declare class InsuranceService {
*/ */
protected getInsuranceReturnTimestamp(pmcData: IPmcData, trader: ITraderBase): number; protected getInsuranceReturnTimestamp(pmcData: IPmcData, trader: ITraderBase): number;
/** /**
* Store lost gear post-raid inside profile * Store lost gear post-raid inside profile, ready for later code to pick it up and mail it
* @param pmcData player profile to store gear in * @param pmcData player profile to store gear in
* @param offraidData post-raid request object * @param offraidData post-raid request object
* @param preRaidGear gear player wore prior to raid * @param preRaidGear gear player wore prior to raid
@ -86,6 +93,21 @@ export declare class InsuranceService {
* @param playerDied did the player die in raid * @param playerDied did the player die in raid
*/ */
storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): void; storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): void;
/**
* Take preraid item and update properties to ensure its ready to be given to player in insurance return mail
* @param pmcData Player profile
* @param insuredItem Insured items properties
* @param preRaidItem Insured item as it was pre-raid
* @param insuredItemFromClient Item data when player left raid (durability values)
* @returns Item object
*/
protected getInsuredItemDetails(pmcData: IPmcData, preRaidItem: Item, insuredItemFromClient: IInsuredItemsData): Item;
/**
* Reset slotId property to "hideout" when necessary (used to be in )
* @param pmcData Players pmcData.Inventory.equipment value
* @param itemToReturn item we will send to player as insurance return
*/
protected updateSlotIdValue(playerBaseInventoryEquipmentId: string, itemToReturn: Item): void;
/** /**
* Create a hash table for an array of items, keyed by items _id * Create a hash table for an array of items, keyed by items _id
* @param items Items to hash * @param items Items to hash
@ -94,12 +116,17 @@ export declare class InsuranceService {
protected createItemHashTable(items: Item[]): Record<string, Item>; protected createItemHashTable(items: Item[]): Record<string, Item>;
/** /**
* Add gear item to InsuredItems array in player profile * Add gear item to InsuredItems array in player profile
* @param pmcData profile to store item in
* @param insuredItem Item to store in profile
* @param actualItem item to store
* @param sessionID Session id * @param sessionID Session id
* @param pmcData Player profile
* @param itemToReturnToPlayer item to store
* @param traderId Id of trader item was insured with
*/ */
protected addGearToSend(pmcData: IPmcData, insuredItem: InsuredItem, actualItem: Item, sessionID: string): void; protected addGearToSend(gear: {
sessionID: string;
pmcData: IPmcData;
itemToReturnToPlayer: Item;
traderId: string;
}): void;
/** /**
* Does insurance exist for a player and by trader * Does insurance exist for a player and by trader
* @param sessionId Player id (session id) * @param sessionId Player id (session id)

View File

@ -267,6 +267,7 @@ export interface BackendCounter {
value: number; value: number;
} }
export interface InsuredItem { export interface InsuredItem {
/** Trader Id item was insured by */
tid: string; tid: string;
itemId: string; itemId: string;
} }

View File

@ -12,6 +12,7 @@ export interface Upd {
Togglable?: Togglable; Togglable?: Togglable;
Map?: Map; Map?: Map;
Tag?: Tag; Tag?: Tag;
/** SPT specific property, not made by BSG */
sptPresetId?: string; sptPresetId?: string;
FaceShield?: FaceShield; FaceShield?: FaceShield;
StackObjectsCount?: number; StackObjectsCount?: number;

View File

@ -0,0 +1,6 @@
export interface IInsuredItemsData {
id: string;
durability?: number;
maxDurability?: number;
hits?: number;
}

View File

@ -1,9 +1,11 @@
import { PlayerRaidEndState } from "../../../models/enums/PlayerRaidEndState"; import { PlayerRaidEndState } from "../../../models/enums/PlayerRaidEndState";
import { IPmcData } from "../common/IPmcData"; import { IPmcData } from "../common/IPmcData";
import { ISyncHealthRequestData } from "../health/ISyncHealthRequestData"; import { ISyncHealthRequestData } from "../health/ISyncHealthRequestData";
import { IInsuredItemsData } from "./IInsuredItemsData";
export interface ISaveProgressRequestData { export interface ISaveProgressRequestData {
exit: PlayerRaidEndState; exit: PlayerRaidEndState;
profile: IPmcData; profile: IPmcData;
isPlayerScav: boolean; isPlayerScav: boolean;
health: ISyncHealthRequestData; health: ISyncHealthRequestData;
insurance: IInsuredItemsData[];
} }

View File

@ -71,13 +71,8 @@ export interface Dynamic {
removeSeasonalItemsWhenNotInEvent: boolean; removeSeasonalItemsWhenNotInEvent: boolean;
/** Flea blacklist settings */ /** Flea blacklist settings */
blacklist: Blacklist; blacklist: Blacklist;
/** Should prices over the multiplier be adjusted */ /** Dict of price limits keyed by item type */
unreasonableModPrices: IUnreasonableModPrices; unreasonableModPrices: Record<string, IUnreasonableModPrices>;
}
export interface IUnreasonableModPrices {
enabled: boolean;
handbookPriceOverMultiplier: number;
newPriceHandbookMultiplier: number;
} }
export interface Barter { export interface Barter {
/** Should barter offers be generated */ /** Should barter offers be generated */
@ -121,3 +116,8 @@ export interface Blacklist {
/** Should trader items that are blacklisted by bsg */ /** Should trader items that are blacklisted by bsg */
traderItems: boolean; traderItems: boolean;
} }
export interface IUnreasonableModPrices {
enabled: boolean;
handbookPriceOverMultiplier: number;
newPriceHandbookMultiplier: number;
}

View File

@ -6,14 +6,15 @@ import { NotificationSendHelper } from "../helpers/NotificationSendHelper";
import { SecureContainerHelper } from "../helpers/SecureContainerHelper"; import { SecureContainerHelper } from "../helpers/SecureContainerHelper";
import { TraderHelper } from "../helpers/TraderHelper"; import { TraderHelper } from "../helpers/TraderHelper";
import { IPmcData } from "../models/eft/common/IPmcData"; import { IPmcData } from "../models/eft/common/IPmcData";
import { InsuredItem } from "../models/eft/common/tables/IBotBase";
import { Item } from "../models/eft/common/tables/IItem"; import { Item } from "../models/eft/common/tables/IItem";
import { IInsuredItemsData } from "../models/eft/inRaid/IInsuredItemsData";
import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData";
import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig"; import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig";
import { ILogger } from "../models/spt/utils/ILogger"; import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer"; import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer"; import { DatabaseServer } from "../servers/DatabaseServer";
import { SaveServer } from "../servers/SaveServer"; import { SaveServer } from "../servers/SaveServer";
import { JsonUtil } from "../utils/JsonUtil";
import { RandomUtil } from "../utils/RandomUtil"; import { RandomUtil } from "../utils/RandomUtil";
import { TimeUtil } from "../utils/TimeUtil"; import { TimeUtil } from "../utils/TimeUtil";
import { LocaleService } from "./LocaleService"; import { LocaleService } from "./LocaleService";
@ -24,6 +25,7 @@ export declare class InsuranceService {
protected secureContainerHelper: SecureContainerHelper; protected secureContainerHelper: SecureContainerHelper;
protected randomUtil: RandomUtil; protected randomUtil: RandomUtil;
protected itemHelper: ItemHelper; protected itemHelper: ItemHelper;
protected jsonUtil: JsonUtil;
protected timeUtil: TimeUtil; protected timeUtil: TimeUtil;
protected saveServer: SaveServer; protected saveServer: SaveServer;
protected traderHelper: TraderHelper; protected traderHelper: TraderHelper;
@ -35,7 +37,12 @@ export declare class InsuranceService {
protected configServer: ConfigServer; protected configServer: ConfigServer;
protected insured: Record<string, Record<string, Item[]>>; protected insured: Record<string, Record<string, Item[]>>;
protected insuranceConfig: IInsuranceConfig; protected insuranceConfig: IInsuranceConfig;
constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, notificationSendHelper: NotificationSendHelper, configServer: ConfigServer); constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, jsonUtil: JsonUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, notificationSendHelper: NotificationSendHelper, configServer: ConfigServer);
/**
* Does player have insurance array
* @param sessionId Player id
* @returns True if exists
*/
insuranceExists(sessionId: string): boolean; insuranceExists(sessionId: string): boolean;
/** /**
* Get all insured items by all traders for a profile * Get all insured items by all traders for a profile
@ -78,7 +85,7 @@ export declare class InsuranceService {
*/ */
protected getInsuranceReturnTimestamp(pmcData: IPmcData, trader: ITraderBase): number; protected getInsuranceReturnTimestamp(pmcData: IPmcData, trader: ITraderBase): number;
/** /**
* Store lost gear post-raid inside profile * Store lost gear post-raid inside profile, ready for later code to pick it up and mail it
* @param pmcData player profile to store gear in * @param pmcData player profile to store gear in
* @param offraidData post-raid request object * @param offraidData post-raid request object
* @param preRaidGear gear player wore prior to raid * @param preRaidGear gear player wore prior to raid
@ -86,6 +93,21 @@ export declare class InsuranceService {
* @param playerDied did the player die in raid * @param playerDied did the player die in raid
*/ */
storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): void; storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): void;
/**
* Take preraid item and update properties to ensure its ready to be given to player in insurance return mail
* @param pmcData Player profile
* @param insuredItem Insured items properties
* @param preRaidItem Insured item as it was pre-raid
* @param insuredItemFromClient Item data when player left raid (durability values)
* @returns Item object
*/
protected getInsuredItemDetails(pmcData: IPmcData, preRaidItem: Item, insuredItemFromClient: IInsuredItemsData): Item;
/**
* Reset slotId property to "hideout" when necessary (used to be in )
* @param pmcData Players pmcData.Inventory.equipment value
* @param itemToReturn item we will send to player as insurance return
*/
protected updateSlotIdValue(playerBaseInventoryEquipmentId: string, itemToReturn: Item): void;
/** /**
* Create a hash table for an array of items, keyed by items _id * Create a hash table for an array of items, keyed by items _id
* @param items Items to hash * @param items Items to hash
@ -94,12 +116,17 @@ export declare class InsuranceService {
protected createItemHashTable(items: Item[]): Record<string, Item>; protected createItemHashTable(items: Item[]): Record<string, Item>;
/** /**
* Add gear item to InsuredItems array in player profile * Add gear item to InsuredItems array in player profile
* @param pmcData profile to store item in
* @param insuredItem Item to store in profile
* @param actualItem item to store
* @param sessionID Session id * @param sessionID Session id
* @param pmcData Player profile
* @param itemToReturnToPlayer item to store
* @param traderId Id of trader item was insured with
*/ */
protected addGearToSend(pmcData: IPmcData, insuredItem: InsuredItem, actualItem: Item, sessionID: string): void; protected addGearToSend(gear: {
sessionID: string;
pmcData: IPmcData;
itemToReturnToPlayer: Item;
traderId: string;
}): void;
/** /**
* Does insurance exist for a player and by trader * Does insurance exist for a player and by trader
* @param sessionId Player id (session id) * @param sessionId Player id (session id)

View File

@ -267,6 +267,7 @@ export interface BackendCounter {
value: number; value: number;
} }
export interface InsuredItem { export interface InsuredItem {
/** Trader Id item was insured by */
tid: string; tid: string;
itemId: string; itemId: string;
} }

View File

@ -12,6 +12,7 @@ export interface Upd {
Togglable?: Togglable; Togglable?: Togglable;
Map?: Map; Map?: Map;
Tag?: Tag; Tag?: Tag;
/** SPT specific property, not made by BSG */
sptPresetId?: string; sptPresetId?: string;
FaceShield?: FaceShield; FaceShield?: FaceShield;
StackObjectsCount?: number; StackObjectsCount?: number;

View File

@ -0,0 +1,6 @@
export interface IInsuredItemsData {
id: string;
durability?: number;
maxDurability?: number;
hits?: number;
}

View File

@ -1,9 +1,11 @@
import { PlayerRaidEndState } from "../../../models/enums/PlayerRaidEndState"; import { PlayerRaidEndState } from "../../../models/enums/PlayerRaidEndState";
import { IPmcData } from "../common/IPmcData"; import { IPmcData } from "../common/IPmcData";
import { ISyncHealthRequestData } from "../health/ISyncHealthRequestData"; import { ISyncHealthRequestData } from "../health/ISyncHealthRequestData";
import { IInsuredItemsData } from "./IInsuredItemsData";
export interface ISaveProgressRequestData { export interface ISaveProgressRequestData {
exit: PlayerRaidEndState; exit: PlayerRaidEndState;
profile: IPmcData; profile: IPmcData;
isPlayerScav: boolean; isPlayerScav: boolean;
health: ISyncHealthRequestData; health: ISyncHealthRequestData;
insurance: IInsuredItemsData[];
} }

View File

@ -71,13 +71,8 @@ export interface Dynamic {
removeSeasonalItemsWhenNotInEvent: boolean; removeSeasonalItemsWhenNotInEvent: boolean;
/** Flea blacklist settings */ /** Flea blacklist settings */
blacklist: Blacklist; blacklist: Blacklist;
/** Should prices over the multiplier be adjusted */ /** Dict of price limits keyed by item type */
unreasonableModPrices: IUnreasonableModPrices; unreasonableModPrices: Record<string, IUnreasonableModPrices>;
}
export interface IUnreasonableModPrices {
enabled: boolean;
handbookPriceOverMultiplier: number;
newPriceHandbookMultiplier: number;
} }
export interface Barter { export interface Barter {
/** Should barter offers be generated */ /** Should barter offers be generated */
@ -121,3 +116,8 @@ export interface Blacklist {
/** Should trader items that are blacklisted by bsg */ /** Should trader items that are blacklisted by bsg */
traderItems: boolean; traderItems: boolean;
} }
export interface IUnreasonableModPrices {
enabled: boolean;
handbookPriceOverMultiplier: number;
newPriceHandbookMultiplier: number;
}

View File

@ -6,14 +6,15 @@ import { NotificationSendHelper } from "../helpers/NotificationSendHelper";
import { SecureContainerHelper } from "../helpers/SecureContainerHelper"; import { SecureContainerHelper } from "../helpers/SecureContainerHelper";
import { TraderHelper } from "../helpers/TraderHelper"; import { TraderHelper } from "../helpers/TraderHelper";
import { IPmcData } from "../models/eft/common/IPmcData"; import { IPmcData } from "../models/eft/common/IPmcData";
import { InsuredItem } from "../models/eft/common/tables/IBotBase";
import { Item } from "../models/eft/common/tables/IItem"; import { Item } from "../models/eft/common/tables/IItem";
import { IInsuredItemsData } from "../models/eft/inRaid/IInsuredItemsData";
import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData";
import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig"; import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig";
import { ILogger } from "../models/spt/utils/ILogger"; import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer"; import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer"; import { DatabaseServer } from "../servers/DatabaseServer";
import { SaveServer } from "../servers/SaveServer"; import { SaveServer } from "../servers/SaveServer";
import { JsonUtil } from "../utils/JsonUtil";
import { RandomUtil } from "../utils/RandomUtil"; import { RandomUtil } from "../utils/RandomUtil";
import { TimeUtil } from "../utils/TimeUtil"; import { TimeUtil } from "../utils/TimeUtil";
import { LocaleService } from "./LocaleService"; import { LocaleService } from "./LocaleService";
@ -24,6 +25,7 @@ export declare class InsuranceService {
protected secureContainerHelper: SecureContainerHelper; protected secureContainerHelper: SecureContainerHelper;
protected randomUtil: RandomUtil; protected randomUtil: RandomUtil;
protected itemHelper: ItemHelper; protected itemHelper: ItemHelper;
protected jsonUtil: JsonUtil;
protected timeUtil: TimeUtil; protected timeUtil: TimeUtil;
protected saveServer: SaveServer; protected saveServer: SaveServer;
protected traderHelper: TraderHelper; protected traderHelper: TraderHelper;
@ -35,7 +37,12 @@ export declare class InsuranceService {
protected configServer: ConfigServer; protected configServer: ConfigServer;
protected insured: Record<string, Record<string, Item[]>>; protected insured: Record<string, Record<string, Item[]>>;
protected insuranceConfig: IInsuranceConfig; protected insuranceConfig: IInsuranceConfig;
constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, notificationSendHelper: NotificationSendHelper, configServer: ConfigServer); constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, jsonUtil: JsonUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, notificationSendHelper: NotificationSendHelper, configServer: ConfigServer);
/**
* Does player have insurance array
* @param sessionId Player id
* @returns True if exists
*/
insuranceExists(sessionId: string): boolean; insuranceExists(sessionId: string): boolean;
/** /**
* Get all insured items by all traders for a profile * Get all insured items by all traders for a profile
@ -78,7 +85,7 @@ export declare class InsuranceService {
*/ */
protected getInsuranceReturnTimestamp(pmcData: IPmcData, trader: ITraderBase): number; protected getInsuranceReturnTimestamp(pmcData: IPmcData, trader: ITraderBase): number;
/** /**
* Store lost gear post-raid inside profile * Store lost gear post-raid inside profile, ready for later code to pick it up and mail it
* @param pmcData player profile to store gear in * @param pmcData player profile to store gear in
* @param offraidData post-raid request object * @param offraidData post-raid request object
* @param preRaidGear gear player wore prior to raid * @param preRaidGear gear player wore prior to raid
@ -86,6 +93,21 @@ export declare class InsuranceService {
* @param playerDied did the player die in raid * @param playerDied did the player die in raid
*/ */
storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): void; storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): void;
/**
* Take preraid item and update properties to ensure its ready to be given to player in insurance return mail
* @param pmcData Player profile
* @param insuredItem Insured items properties
* @param preRaidItem Insured item as it was pre-raid
* @param insuredItemFromClient Item data when player left raid (durability values)
* @returns Item object
*/
protected getInsuredItemDetails(pmcData: IPmcData, preRaidItem: Item, insuredItemFromClient: IInsuredItemsData): Item;
/**
* Reset slotId property to "hideout" when necessary (used to be in )
* @param pmcData Players pmcData.Inventory.equipment value
* @param itemToReturn item we will send to player as insurance return
*/
protected updateSlotIdValue(playerBaseInventoryEquipmentId: string, itemToReturn: Item): void;
/** /**
* Create a hash table for an array of items, keyed by items _id * Create a hash table for an array of items, keyed by items _id
* @param items Items to hash * @param items Items to hash
@ -94,12 +116,17 @@ export declare class InsuranceService {
protected createItemHashTable(items: Item[]): Record<string, Item>; protected createItemHashTable(items: Item[]): Record<string, Item>;
/** /**
* Add gear item to InsuredItems array in player profile * Add gear item to InsuredItems array in player profile
* @param pmcData profile to store item in
* @param insuredItem Item to store in profile
* @param actualItem item to store
* @param sessionID Session id * @param sessionID Session id
* @param pmcData Player profile
* @param itemToReturnToPlayer item to store
* @param traderId Id of trader item was insured with
*/ */
protected addGearToSend(pmcData: IPmcData, insuredItem: InsuredItem, actualItem: Item, sessionID: string): void; protected addGearToSend(gear: {
sessionID: string;
pmcData: IPmcData;
itemToReturnToPlayer: Item;
traderId: string;
}): void;
/** /**
* Does insurance exist for a player and by trader * Does insurance exist for a player and by trader
* @param sessionId Player id (session id) * @param sessionId Player id (session id)

View File

@ -267,6 +267,7 @@ export interface BackendCounter {
value: number; value: number;
} }
export interface InsuredItem { export interface InsuredItem {
/** Trader Id item was insured by */
tid: string; tid: string;
itemId: string; itemId: string;
} }

View File

@ -12,6 +12,7 @@ export interface Upd {
Togglable?: Togglable; Togglable?: Togglable;
Map?: Map; Map?: Map;
Tag?: Tag; Tag?: Tag;
/** SPT specific property, not made by BSG */
sptPresetId?: string; sptPresetId?: string;
FaceShield?: FaceShield; FaceShield?: FaceShield;
StackObjectsCount?: number; StackObjectsCount?: number;

View File

@ -0,0 +1,6 @@
export interface IInsuredItemsData {
id: string;
durability?: number;
maxDurability?: number;
hits?: number;
}

View File

@ -1,9 +1,11 @@
import { PlayerRaidEndState } from "../../../models/enums/PlayerRaidEndState"; import { PlayerRaidEndState } from "../../../models/enums/PlayerRaidEndState";
import { IPmcData } from "../common/IPmcData"; import { IPmcData } from "../common/IPmcData";
import { ISyncHealthRequestData } from "../health/ISyncHealthRequestData"; import { ISyncHealthRequestData } from "../health/ISyncHealthRequestData";
import { IInsuredItemsData } from "./IInsuredItemsData";
export interface ISaveProgressRequestData { export interface ISaveProgressRequestData {
exit: PlayerRaidEndState; exit: PlayerRaidEndState;
profile: IPmcData; profile: IPmcData;
isPlayerScav: boolean; isPlayerScav: boolean;
health: ISyncHealthRequestData; health: ISyncHealthRequestData;
insurance: IInsuredItemsData[];
} }

View File

@ -71,13 +71,8 @@ export interface Dynamic {
removeSeasonalItemsWhenNotInEvent: boolean; removeSeasonalItemsWhenNotInEvent: boolean;
/** Flea blacklist settings */ /** Flea blacklist settings */
blacklist: Blacklist; blacklist: Blacklist;
/** Should prices over the multiplier be adjusted */ /** Dict of price limits keyed by item type */
unreasonableModPrices: IUnreasonableModPrices; unreasonableModPrices: Record<string, IUnreasonableModPrices>;
}
export interface IUnreasonableModPrices {
enabled: boolean;
handbookPriceOverMultiplier: number;
newPriceHandbookMultiplier: number;
} }
export interface Barter { export interface Barter {
/** Should barter offers be generated */ /** Should barter offers be generated */
@ -121,3 +116,8 @@ export interface Blacklist {
/** Should trader items that are blacklisted by bsg */ /** Should trader items that are blacklisted by bsg */
traderItems: boolean; traderItems: boolean;
} }
export interface IUnreasonableModPrices {
enabled: boolean;
handbookPriceOverMultiplier: number;
newPriceHandbookMultiplier: number;
}

View File

@ -6,14 +6,15 @@ import { NotificationSendHelper } from "../helpers/NotificationSendHelper";
import { SecureContainerHelper } from "../helpers/SecureContainerHelper"; import { SecureContainerHelper } from "../helpers/SecureContainerHelper";
import { TraderHelper } from "../helpers/TraderHelper"; import { TraderHelper } from "../helpers/TraderHelper";
import { IPmcData } from "../models/eft/common/IPmcData"; import { IPmcData } from "../models/eft/common/IPmcData";
import { InsuredItem } from "../models/eft/common/tables/IBotBase";
import { Item } from "../models/eft/common/tables/IItem"; import { Item } from "../models/eft/common/tables/IItem";
import { IInsuredItemsData } from "../models/eft/inRaid/IInsuredItemsData";
import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData";
import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig"; import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig";
import { ILogger } from "../models/spt/utils/ILogger"; import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer"; import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer"; import { DatabaseServer } from "../servers/DatabaseServer";
import { SaveServer } from "../servers/SaveServer"; import { SaveServer } from "../servers/SaveServer";
import { JsonUtil } from "../utils/JsonUtil";
import { RandomUtil } from "../utils/RandomUtil"; import { RandomUtil } from "../utils/RandomUtil";
import { TimeUtil } from "../utils/TimeUtil"; import { TimeUtil } from "../utils/TimeUtil";
import { LocaleService } from "./LocaleService"; import { LocaleService } from "./LocaleService";
@ -24,6 +25,7 @@ export declare class InsuranceService {
protected secureContainerHelper: SecureContainerHelper; protected secureContainerHelper: SecureContainerHelper;
protected randomUtil: RandomUtil; protected randomUtil: RandomUtil;
protected itemHelper: ItemHelper; protected itemHelper: ItemHelper;
protected jsonUtil: JsonUtil;
protected timeUtil: TimeUtil; protected timeUtil: TimeUtil;
protected saveServer: SaveServer; protected saveServer: SaveServer;
protected traderHelper: TraderHelper; protected traderHelper: TraderHelper;
@ -35,7 +37,12 @@ export declare class InsuranceService {
protected configServer: ConfigServer; protected configServer: ConfigServer;
protected insured: Record<string, Record<string, Item[]>>; protected insured: Record<string, Record<string, Item[]>>;
protected insuranceConfig: IInsuranceConfig; protected insuranceConfig: IInsuranceConfig;
constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, notificationSendHelper: NotificationSendHelper, configServer: ConfigServer); constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, jsonUtil: JsonUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, notificationSendHelper: NotificationSendHelper, configServer: ConfigServer);
/**
* Does player have insurance array
* @param sessionId Player id
* @returns True if exists
*/
insuranceExists(sessionId: string): boolean; insuranceExists(sessionId: string): boolean;
/** /**
* Get all insured items by all traders for a profile * Get all insured items by all traders for a profile
@ -78,7 +85,7 @@ export declare class InsuranceService {
*/ */
protected getInsuranceReturnTimestamp(pmcData: IPmcData, trader: ITraderBase): number; protected getInsuranceReturnTimestamp(pmcData: IPmcData, trader: ITraderBase): number;
/** /**
* Store lost gear post-raid inside profile * Store lost gear post-raid inside profile, ready for later code to pick it up and mail it
* @param pmcData player profile to store gear in * @param pmcData player profile to store gear in
* @param offraidData post-raid request object * @param offraidData post-raid request object
* @param preRaidGear gear player wore prior to raid * @param preRaidGear gear player wore prior to raid
@ -86,6 +93,21 @@ export declare class InsuranceService {
* @param playerDied did the player die in raid * @param playerDied did the player die in raid
*/ */
storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): void; storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): void;
/**
* Take preraid item and update properties to ensure its ready to be given to player in insurance return mail
* @param pmcData Player profile
* @param insuredItem Insured items properties
* @param preRaidItem Insured item as it was pre-raid
* @param insuredItemFromClient Item data when player left raid (durability values)
* @returns Item object
*/
protected getInsuredItemDetails(pmcData: IPmcData, preRaidItem: Item, insuredItemFromClient: IInsuredItemsData): Item;
/**
* Reset slotId property to "hideout" when necessary (used to be in )
* @param pmcData Players pmcData.Inventory.equipment value
* @param itemToReturn item we will send to player as insurance return
*/
protected updateSlotIdValue(playerBaseInventoryEquipmentId: string, itemToReturn: Item): void;
/** /**
* Create a hash table for an array of items, keyed by items _id * Create a hash table for an array of items, keyed by items _id
* @param items Items to hash * @param items Items to hash
@ -94,12 +116,17 @@ export declare class InsuranceService {
protected createItemHashTable(items: Item[]): Record<string, Item>; protected createItemHashTable(items: Item[]): Record<string, Item>;
/** /**
* Add gear item to InsuredItems array in player profile * Add gear item to InsuredItems array in player profile
* @param pmcData profile to store item in
* @param insuredItem Item to store in profile
* @param actualItem item to store
* @param sessionID Session id * @param sessionID Session id
* @param pmcData Player profile
* @param itemToReturnToPlayer item to store
* @param traderId Id of trader item was insured with
*/ */
protected addGearToSend(pmcData: IPmcData, insuredItem: InsuredItem, actualItem: Item, sessionID: string): void; protected addGearToSend(gear: {
sessionID: string;
pmcData: IPmcData;
itemToReturnToPlayer: Item;
traderId: string;
}): void;
/** /**
* Does insurance exist for a player and by trader * Does insurance exist for a player and by trader
* @param sessionId Player id (session id) * @param sessionId Player id (session id)

View File

@ -267,6 +267,7 @@ export interface BackendCounter {
value: number; value: number;
} }
export interface InsuredItem { export interface InsuredItem {
/** Trader Id item was insured by */
tid: string; tid: string;
itemId: string; itemId: string;
} }

View File

@ -12,6 +12,7 @@ export interface Upd {
Togglable?: Togglable; Togglable?: Togglable;
Map?: Map; Map?: Map;
Tag?: Tag; Tag?: Tag;
/** SPT specific property, not made by BSG */
sptPresetId?: string; sptPresetId?: string;
FaceShield?: FaceShield; FaceShield?: FaceShield;
StackObjectsCount?: number; StackObjectsCount?: number;

View File

@ -0,0 +1,6 @@
export interface IInsuredItemsData {
id: string;
durability?: number;
maxDurability?: number;
hits?: number;
}

View File

@ -1,9 +1,11 @@
import { PlayerRaidEndState } from "../../../models/enums/PlayerRaidEndState"; import { PlayerRaidEndState } from "../../../models/enums/PlayerRaidEndState";
import { IPmcData } from "../common/IPmcData"; import { IPmcData } from "../common/IPmcData";
import { ISyncHealthRequestData } from "../health/ISyncHealthRequestData"; import { ISyncHealthRequestData } from "../health/ISyncHealthRequestData";
import { IInsuredItemsData } from "./IInsuredItemsData";
export interface ISaveProgressRequestData { export interface ISaveProgressRequestData {
exit: PlayerRaidEndState; exit: PlayerRaidEndState;
profile: IPmcData; profile: IPmcData;
isPlayerScav: boolean; isPlayerScav: boolean;
health: ISyncHealthRequestData; health: ISyncHealthRequestData;
insurance: IInsuredItemsData[];
} }

View File

@ -71,13 +71,8 @@ export interface Dynamic {
removeSeasonalItemsWhenNotInEvent: boolean; removeSeasonalItemsWhenNotInEvent: boolean;
/** Flea blacklist settings */ /** Flea blacklist settings */
blacklist: Blacklist; blacklist: Blacklist;
/** Should prices over the multiplier be adjusted */ /** Dict of price limits keyed by item type */
unreasonableModPrices: IUnreasonableModPrices; unreasonableModPrices: Record<string, IUnreasonableModPrices>;
}
export interface IUnreasonableModPrices {
enabled: boolean;
handbookPriceOverMultiplier: number;
newPriceHandbookMultiplier: number;
} }
export interface Barter { export interface Barter {
/** Should barter offers be generated */ /** Should barter offers be generated */
@ -121,3 +116,8 @@ export interface Blacklist {
/** Should trader items that are blacklisted by bsg */ /** Should trader items that are blacklisted by bsg */
traderItems: boolean; traderItems: boolean;
} }
export interface IUnreasonableModPrices {
enabled: boolean;
handbookPriceOverMultiplier: number;
newPriceHandbookMultiplier: number;
}

View File

@ -6,14 +6,15 @@ import { NotificationSendHelper } from "../helpers/NotificationSendHelper";
import { SecureContainerHelper } from "../helpers/SecureContainerHelper"; import { SecureContainerHelper } from "../helpers/SecureContainerHelper";
import { TraderHelper } from "../helpers/TraderHelper"; import { TraderHelper } from "../helpers/TraderHelper";
import { IPmcData } from "../models/eft/common/IPmcData"; import { IPmcData } from "../models/eft/common/IPmcData";
import { InsuredItem } from "../models/eft/common/tables/IBotBase";
import { Item } from "../models/eft/common/tables/IItem"; import { Item } from "../models/eft/common/tables/IItem";
import { IInsuredItemsData } from "../models/eft/inRaid/IInsuredItemsData";
import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData";
import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig"; import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig";
import { ILogger } from "../models/spt/utils/ILogger"; import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer"; import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer"; import { DatabaseServer } from "../servers/DatabaseServer";
import { SaveServer } from "../servers/SaveServer"; import { SaveServer } from "../servers/SaveServer";
import { JsonUtil } from "../utils/JsonUtil";
import { RandomUtil } from "../utils/RandomUtil"; import { RandomUtil } from "../utils/RandomUtil";
import { TimeUtil } from "../utils/TimeUtil"; import { TimeUtil } from "../utils/TimeUtil";
import { LocaleService } from "./LocaleService"; import { LocaleService } from "./LocaleService";
@ -24,6 +25,7 @@ export declare class InsuranceService {
protected secureContainerHelper: SecureContainerHelper; protected secureContainerHelper: SecureContainerHelper;
protected randomUtil: RandomUtil; protected randomUtil: RandomUtil;
protected itemHelper: ItemHelper; protected itemHelper: ItemHelper;
protected jsonUtil: JsonUtil;
protected timeUtil: TimeUtil; protected timeUtil: TimeUtil;
protected saveServer: SaveServer; protected saveServer: SaveServer;
protected traderHelper: TraderHelper; protected traderHelper: TraderHelper;
@ -35,7 +37,12 @@ export declare class InsuranceService {
protected configServer: ConfigServer; protected configServer: ConfigServer;
protected insured: Record<string, Record<string, Item[]>>; protected insured: Record<string, Record<string, Item[]>>;
protected insuranceConfig: IInsuranceConfig; protected insuranceConfig: IInsuranceConfig;
constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, notificationSendHelper: NotificationSendHelper, configServer: ConfigServer); constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, jsonUtil: JsonUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, notificationSendHelper: NotificationSendHelper, configServer: ConfigServer);
/**
* Does player have insurance array
* @param sessionId Player id
* @returns True if exists
*/
insuranceExists(sessionId: string): boolean; insuranceExists(sessionId: string): boolean;
/** /**
* Get all insured items by all traders for a profile * Get all insured items by all traders for a profile
@ -78,7 +85,7 @@ export declare class InsuranceService {
*/ */
protected getInsuranceReturnTimestamp(pmcData: IPmcData, trader: ITraderBase): number; protected getInsuranceReturnTimestamp(pmcData: IPmcData, trader: ITraderBase): number;
/** /**
* Store lost gear post-raid inside profile * Store lost gear post-raid inside profile, ready for later code to pick it up and mail it
* @param pmcData player profile to store gear in * @param pmcData player profile to store gear in
* @param offraidData post-raid request object * @param offraidData post-raid request object
* @param preRaidGear gear player wore prior to raid * @param preRaidGear gear player wore prior to raid
@ -86,6 +93,21 @@ export declare class InsuranceService {
* @param playerDied did the player die in raid * @param playerDied did the player die in raid
*/ */
storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): void; storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): void;
/**
* Take preraid item and update properties to ensure its ready to be given to player in insurance return mail
* @param pmcData Player profile
* @param insuredItem Insured items properties
* @param preRaidItem Insured item as it was pre-raid
* @param insuredItemFromClient Item data when player left raid (durability values)
* @returns Item object
*/
protected getInsuredItemDetails(pmcData: IPmcData, preRaidItem: Item, insuredItemFromClient: IInsuredItemsData): Item;
/**
* Reset slotId property to "hideout" when necessary (used to be in )
* @param pmcData Players pmcData.Inventory.equipment value
* @param itemToReturn item we will send to player as insurance return
*/
protected updateSlotIdValue(playerBaseInventoryEquipmentId: string, itemToReturn: Item): void;
/** /**
* Create a hash table for an array of items, keyed by items _id * Create a hash table for an array of items, keyed by items _id
* @param items Items to hash * @param items Items to hash
@ -94,12 +116,17 @@ export declare class InsuranceService {
protected createItemHashTable(items: Item[]): Record<string, Item>; protected createItemHashTable(items: Item[]): Record<string, Item>;
/** /**
* Add gear item to InsuredItems array in player profile * Add gear item to InsuredItems array in player profile
* @param pmcData profile to store item in
* @param insuredItem Item to store in profile
* @param actualItem item to store
* @param sessionID Session id * @param sessionID Session id
* @param pmcData Player profile
* @param itemToReturnToPlayer item to store
* @param traderId Id of trader item was insured with
*/ */
protected addGearToSend(pmcData: IPmcData, insuredItem: InsuredItem, actualItem: Item, sessionID: string): void; protected addGearToSend(gear: {
sessionID: string;
pmcData: IPmcData;
itemToReturnToPlayer: Item;
traderId: string;
}): void;
/** /**
* Does insurance exist for a player and by trader * Does insurance exist for a player and by trader
* @param sessionId Player id (session id) * @param sessionId Player id (session id)

View File

@ -267,6 +267,7 @@ export interface BackendCounter {
value: number; value: number;
} }
export interface InsuredItem { export interface InsuredItem {
/** Trader Id item was insured by */
tid: string; tid: string;
itemId: string; itemId: string;
} }

View File

@ -12,6 +12,7 @@ export interface Upd {
Togglable?: Togglable; Togglable?: Togglable;
Map?: Map; Map?: Map;
Tag?: Tag; Tag?: Tag;
/** SPT specific property, not made by BSG */
sptPresetId?: string; sptPresetId?: string;
FaceShield?: FaceShield; FaceShield?: FaceShield;
StackObjectsCount?: number; StackObjectsCount?: number;

View File

@ -0,0 +1,6 @@
export interface IInsuredItemsData {
id: string;
durability?: number;
maxDurability?: number;
hits?: number;
}

View File

@ -1,9 +1,11 @@
import { PlayerRaidEndState } from "../../../models/enums/PlayerRaidEndState"; import { PlayerRaidEndState } from "../../../models/enums/PlayerRaidEndState";
import { IPmcData } from "../common/IPmcData"; import { IPmcData } from "../common/IPmcData";
import { ISyncHealthRequestData } from "../health/ISyncHealthRequestData"; import { ISyncHealthRequestData } from "../health/ISyncHealthRequestData";
import { IInsuredItemsData } from "./IInsuredItemsData";
export interface ISaveProgressRequestData { export interface ISaveProgressRequestData {
exit: PlayerRaidEndState; exit: PlayerRaidEndState;
profile: IPmcData; profile: IPmcData;
isPlayerScav: boolean; isPlayerScav: boolean;
health: ISyncHealthRequestData; health: ISyncHealthRequestData;
insurance: IInsuredItemsData[];
} }

View File

@ -71,13 +71,8 @@ export interface Dynamic {
removeSeasonalItemsWhenNotInEvent: boolean; removeSeasonalItemsWhenNotInEvent: boolean;
/** Flea blacklist settings */ /** Flea blacklist settings */
blacklist: Blacklist; blacklist: Blacklist;
/** Should prices over the multiplier be adjusted */ /** Dict of price limits keyed by item type */
unreasonableModPrices: IUnreasonableModPrices; unreasonableModPrices: Record<string, IUnreasonableModPrices>;
}
export interface IUnreasonableModPrices {
enabled: boolean;
handbookPriceOverMultiplier: number;
newPriceHandbookMultiplier: number;
} }
export interface Barter { export interface Barter {
/** Should barter offers be generated */ /** Should barter offers be generated */
@ -121,3 +116,8 @@ export interface Blacklist {
/** Should trader items that are blacklisted by bsg */ /** Should trader items that are blacklisted by bsg */
traderItems: boolean; traderItems: boolean;
} }
export interface IUnreasonableModPrices {
enabled: boolean;
handbookPriceOverMultiplier: number;
newPriceHandbookMultiplier: number;
}

View File

@ -6,14 +6,15 @@ import { NotificationSendHelper } from "../helpers/NotificationSendHelper";
import { SecureContainerHelper } from "../helpers/SecureContainerHelper"; import { SecureContainerHelper } from "../helpers/SecureContainerHelper";
import { TraderHelper } from "../helpers/TraderHelper"; import { TraderHelper } from "../helpers/TraderHelper";
import { IPmcData } from "../models/eft/common/IPmcData"; import { IPmcData } from "../models/eft/common/IPmcData";
import { InsuredItem } from "../models/eft/common/tables/IBotBase";
import { Item } from "../models/eft/common/tables/IItem"; import { Item } from "../models/eft/common/tables/IItem";
import { IInsuredItemsData } from "../models/eft/inRaid/IInsuredItemsData";
import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData";
import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig"; import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig";
import { ILogger } from "../models/spt/utils/ILogger"; import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer"; import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer"; import { DatabaseServer } from "../servers/DatabaseServer";
import { SaveServer } from "../servers/SaveServer"; import { SaveServer } from "../servers/SaveServer";
import { JsonUtil } from "../utils/JsonUtil";
import { RandomUtil } from "../utils/RandomUtil"; import { RandomUtil } from "../utils/RandomUtil";
import { TimeUtil } from "../utils/TimeUtil"; import { TimeUtil } from "../utils/TimeUtil";
import { LocaleService } from "./LocaleService"; import { LocaleService } from "./LocaleService";
@ -24,6 +25,7 @@ export declare class InsuranceService {
protected secureContainerHelper: SecureContainerHelper; protected secureContainerHelper: SecureContainerHelper;
protected randomUtil: RandomUtil; protected randomUtil: RandomUtil;
protected itemHelper: ItemHelper; protected itemHelper: ItemHelper;
protected jsonUtil: JsonUtil;
protected timeUtil: TimeUtil; protected timeUtil: TimeUtil;
protected saveServer: SaveServer; protected saveServer: SaveServer;
protected traderHelper: TraderHelper; protected traderHelper: TraderHelper;
@ -35,7 +37,12 @@ export declare class InsuranceService {
protected configServer: ConfigServer; protected configServer: ConfigServer;
protected insured: Record<string, Record<string, Item[]>>; protected insured: Record<string, Record<string, Item[]>>;
protected insuranceConfig: IInsuranceConfig; protected insuranceConfig: IInsuranceConfig;
constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, notificationSendHelper: NotificationSendHelper, configServer: ConfigServer); constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, jsonUtil: JsonUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, notificationSendHelper: NotificationSendHelper, configServer: ConfigServer);
/**
* Does player have insurance array
* @param sessionId Player id
* @returns True if exists
*/
insuranceExists(sessionId: string): boolean; insuranceExists(sessionId: string): boolean;
/** /**
* Get all insured items by all traders for a profile * Get all insured items by all traders for a profile
@ -78,7 +85,7 @@ export declare class InsuranceService {
*/ */
protected getInsuranceReturnTimestamp(pmcData: IPmcData, trader: ITraderBase): number; protected getInsuranceReturnTimestamp(pmcData: IPmcData, trader: ITraderBase): number;
/** /**
* Store lost gear post-raid inside profile * Store lost gear post-raid inside profile, ready for later code to pick it up and mail it
* @param pmcData player profile to store gear in * @param pmcData player profile to store gear in
* @param offraidData post-raid request object * @param offraidData post-raid request object
* @param preRaidGear gear player wore prior to raid * @param preRaidGear gear player wore prior to raid
@ -86,6 +93,21 @@ export declare class InsuranceService {
* @param playerDied did the player die in raid * @param playerDied did the player die in raid
*/ */
storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): void; storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): void;
/**
* Take preraid item and update properties to ensure its ready to be given to player in insurance return mail
* @param pmcData Player profile
* @param insuredItem Insured items properties
* @param preRaidItem Insured item as it was pre-raid
* @param insuredItemFromClient Item data when player left raid (durability values)
* @returns Item object
*/
protected getInsuredItemDetails(pmcData: IPmcData, preRaidItem: Item, insuredItemFromClient: IInsuredItemsData): Item;
/**
* Reset slotId property to "hideout" when necessary (used to be in )
* @param pmcData Players pmcData.Inventory.equipment value
* @param itemToReturn item we will send to player as insurance return
*/
protected updateSlotIdValue(playerBaseInventoryEquipmentId: string, itemToReturn: Item): void;
/** /**
* Create a hash table for an array of items, keyed by items _id * Create a hash table for an array of items, keyed by items _id
* @param items Items to hash * @param items Items to hash
@ -94,12 +116,17 @@ export declare class InsuranceService {
protected createItemHashTable(items: Item[]): Record<string, Item>; protected createItemHashTable(items: Item[]): Record<string, Item>;
/** /**
* Add gear item to InsuredItems array in player profile * Add gear item to InsuredItems array in player profile
* @param pmcData profile to store item in
* @param insuredItem Item to store in profile
* @param actualItem item to store
* @param sessionID Session id * @param sessionID Session id
* @param pmcData Player profile
* @param itemToReturnToPlayer item to store
* @param traderId Id of trader item was insured with
*/ */
protected addGearToSend(pmcData: IPmcData, insuredItem: InsuredItem, actualItem: Item, sessionID: string): void; protected addGearToSend(gear: {
sessionID: string;
pmcData: IPmcData;
itemToReturnToPlayer: Item;
traderId: string;
}): void;
/** /**
* Does insurance exist for a player and by trader * Does insurance exist for a player and by trader
* @param sessionId Player id (session id) * @param sessionId Player id (session id)

View File

@ -267,6 +267,7 @@ export interface BackendCounter {
value: number; value: number;
} }
export interface InsuredItem { export interface InsuredItem {
/** Trader Id item was insured by */
tid: string; tid: string;
itemId: string; itemId: string;
} }

View File

@ -12,6 +12,7 @@ export interface Upd {
Togglable?: Togglable; Togglable?: Togglable;
Map?: Map; Map?: Map;
Tag?: Tag; Tag?: Tag;
/** SPT specific property, not made by BSG */
sptPresetId?: string; sptPresetId?: string;
FaceShield?: FaceShield; FaceShield?: FaceShield;
StackObjectsCount?: number; StackObjectsCount?: number;

View File

@ -0,0 +1,6 @@
export interface IInsuredItemsData {
id: string;
durability?: number;
maxDurability?: number;
hits?: number;
}

View File

@ -1,9 +1,11 @@
import { PlayerRaidEndState } from "../../../models/enums/PlayerRaidEndState"; import { PlayerRaidEndState } from "../../../models/enums/PlayerRaidEndState";
import { IPmcData } from "../common/IPmcData"; import { IPmcData } from "../common/IPmcData";
import { ISyncHealthRequestData } from "../health/ISyncHealthRequestData"; import { ISyncHealthRequestData } from "../health/ISyncHealthRequestData";
import { IInsuredItemsData } from "./IInsuredItemsData";
export interface ISaveProgressRequestData { export interface ISaveProgressRequestData {
exit: PlayerRaidEndState; exit: PlayerRaidEndState;
profile: IPmcData; profile: IPmcData;
isPlayerScav: boolean; isPlayerScav: boolean;
health: ISyncHealthRequestData; health: ISyncHealthRequestData;
insurance: IInsuredItemsData[];
} }

View File

@ -71,13 +71,8 @@ export interface Dynamic {
removeSeasonalItemsWhenNotInEvent: boolean; removeSeasonalItemsWhenNotInEvent: boolean;
/** Flea blacklist settings */ /** Flea blacklist settings */
blacklist: Blacklist; blacklist: Blacklist;
/** Should prices over the multiplier be adjusted */ /** Dict of price limits keyed by item type */
unreasonableModPrices: IUnreasonableModPrices; unreasonableModPrices: Record<string, IUnreasonableModPrices>;
}
export interface IUnreasonableModPrices {
enabled: boolean;
handbookPriceOverMultiplier: number;
newPriceHandbookMultiplier: number;
} }
export interface Barter { export interface Barter {
/** Should barter offers be generated */ /** Should barter offers be generated */
@ -121,3 +116,8 @@ export interface Blacklist {
/** Should trader items that are blacklisted by bsg */ /** Should trader items that are blacklisted by bsg */
traderItems: boolean; traderItems: boolean;
} }
export interface IUnreasonableModPrices {
enabled: boolean;
handbookPriceOverMultiplier: number;
newPriceHandbookMultiplier: number;
}

View File

@ -6,14 +6,15 @@ import { NotificationSendHelper } from "../helpers/NotificationSendHelper";
import { SecureContainerHelper } from "../helpers/SecureContainerHelper"; import { SecureContainerHelper } from "../helpers/SecureContainerHelper";
import { TraderHelper } from "../helpers/TraderHelper"; import { TraderHelper } from "../helpers/TraderHelper";
import { IPmcData } from "../models/eft/common/IPmcData"; import { IPmcData } from "../models/eft/common/IPmcData";
import { InsuredItem } from "../models/eft/common/tables/IBotBase";
import { Item } from "../models/eft/common/tables/IItem"; import { Item } from "../models/eft/common/tables/IItem";
import { IInsuredItemsData } from "../models/eft/inRaid/IInsuredItemsData";
import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData";
import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig"; import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig";
import { ILogger } from "../models/spt/utils/ILogger"; import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer"; import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer"; import { DatabaseServer } from "../servers/DatabaseServer";
import { SaveServer } from "../servers/SaveServer"; import { SaveServer } from "../servers/SaveServer";
import { JsonUtil } from "../utils/JsonUtil";
import { RandomUtil } from "../utils/RandomUtil"; import { RandomUtil } from "../utils/RandomUtil";
import { TimeUtil } from "../utils/TimeUtil"; import { TimeUtil } from "../utils/TimeUtil";
import { LocaleService } from "./LocaleService"; import { LocaleService } from "./LocaleService";
@ -24,6 +25,7 @@ export declare class InsuranceService {
protected secureContainerHelper: SecureContainerHelper; protected secureContainerHelper: SecureContainerHelper;
protected randomUtil: RandomUtil; protected randomUtil: RandomUtil;
protected itemHelper: ItemHelper; protected itemHelper: ItemHelper;
protected jsonUtil: JsonUtil;
protected timeUtil: TimeUtil; protected timeUtil: TimeUtil;
protected saveServer: SaveServer; protected saveServer: SaveServer;
protected traderHelper: TraderHelper; protected traderHelper: TraderHelper;
@ -35,7 +37,12 @@ export declare class InsuranceService {
protected configServer: ConfigServer; protected configServer: ConfigServer;
protected insured: Record<string, Record<string, Item[]>>; protected insured: Record<string, Record<string, Item[]>>;
protected insuranceConfig: IInsuranceConfig; protected insuranceConfig: IInsuranceConfig;
constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, notificationSendHelper: NotificationSendHelper, configServer: ConfigServer); constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, jsonUtil: JsonUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, notificationSendHelper: NotificationSendHelper, configServer: ConfigServer);
/**
* Does player have insurance array
* @param sessionId Player id
* @returns True if exists
*/
insuranceExists(sessionId: string): boolean; insuranceExists(sessionId: string): boolean;
/** /**
* Get all insured items by all traders for a profile * Get all insured items by all traders for a profile
@ -78,7 +85,7 @@ export declare class InsuranceService {
*/ */
protected getInsuranceReturnTimestamp(pmcData: IPmcData, trader: ITraderBase): number; protected getInsuranceReturnTimestamp(pmcData: IPmcData, trader: ITraderBase): number;
/** /**
* Store lost gear post-raid inside profile * Store lost gear post-raid inside profile, ready for later code to pick it up and mail it
* @param pmcData player profile to store gear in * @param pmcData player profile to store gear in
* @param offraidData post-raid request object * @param offraidData post-raid request object
* @param preRaidGear gear player wore prior to raid * @param preRaidGear gear player wore prior to raid
@ -86,6 +93,21 @@ export declare class InsuranceService {
* @param playerDied did the player die in raid * @param playerDied did the player die in raid
*/ */
storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): void; storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): void;
/**
* Take preraid item and update properties to ensure its ready to be given to player in insurance return mail
* @param pmcData Player profile
* @param insuredItem Insured items properties
* @param preRaidItem Insured item as it was pre-raid
* @param insuredItemFromClient Item data when player left raid (durability values)
* @returns Item object
*/
protected getInsuredItemDetails(pmcData: IPmcData, preRaidItem: Item, insuredItemFromClient: IInsuredItemsData): Item;
/**
* Reset slotId property to "hideout" when necessary (used to be in )
* @param pmcData Players pmcData.Inventory.equipment value
* @param itemToReturn item we will send to player as insurance return
*/
protected updateSlotIdValue(playerBaseInventoryEquipmentId: string, itemToReturn: Item): void;
/** /**
* Create a hash table for an array of items, keyed by items _id * Create a hash table for an array of items, keyed by items _id
* @param items Items to hash * @param items Items to hash
@ -94,12 +116,17 @@ export declare class InsuranceService {
protected createItemHashTable(items: Item[]): Record<string, Item>; protected createItemHashTable(items: Item[]): Record<string, Item>;
/** /**
* Add gear item to InsuredItems array in player profile * Add gear item to InsuredItems array in player profile
* @param pmcData profile to store item in
* @param insuredItem Item to store in profile
* @param actualItem item to store
* @param sessionID Session id * @param sessionID Session id
* @param pmcData Player profile
* @param itemToReturnToPlayer item to store
* @param traderId Id of trader item was insured with
*/ */
protected addGearToSend(pmcData: IPmcData, insuredItem: InsuredItem, actualItem: Item, sessionID: string): void; protected addGearToSend(gear: {
sessionID: string;
pmcData: IPmcData;
itemToReturnToPlayer: Item;
traderId: string;
}): void;
/** /**
* Does insurance exist for a player and by trader * Does insurance exist for a player and by trader
* @param sessionId Player id (session id) * @param sessionId Player id (session id)

View File

@ -267,6 +267,7 @@ export interface BackendCounter {
value: number; value: number;
} }
export interface InsuredItem { export interface InsuredItem {
/** Trader Id item was insured by */
tid: string; tid: string;
itemId: string; itemId: string;
} }

View File

@ -12,6 +12,7 @@ export interface Upd {
Togglable?: Togglable; Togglable?: Togglable;
Map?: Map; Map?: Map;
Tag?: Tag; Tag?: Tag;
/** SPT specific property, not made by BSG */
sptPresetId?: string; sptPresetId?: string;
FaceShield?: FaceShield; FaceShield?: FaceShield;
StackObjectsCount?: number; StackObjectsCount?: number;

View File

@ -0,0 +1,6 @@
export interface IInsuredItemsData {
id: string;
durability?: number;
maxDurability?: number;
hits?: number;
}

View File

@ -1,9 +1,11 @@
import { PlayerRaidEndState } from "../../../models/enums/PlayerRaidEndState"; import { PlayerRaidEndState } from "../../../models/enums/PlayerRaidEndState";
import { IPmcData } from "../common/IPmcData"; import { IPmcData } from "../common/IPmcData";
import { ISyncHealthRequestData } from "../health/ISyncHealthRequestData"; import { ISyncHealthRequestData } from "../health/ISyncHealthRequestData";
import { IInsuredItemsData } from "./IInsuredItemsData";
export interface ISaveProgressRequestData { export interface ISaveProgressRequestData {
exit: PlayerRaidEndState; exit: PlayerRaidEndState;
profile: IPmcData; profile: IPmcData;
isPlayerScav: boolean; isPlayerScav: boolean;
health: ISyncHealthRequestData; health: ISyncHealthRequestData;
insurance: IInsuredItemsData[];
} }

View File

@ -71,13 +71,8 @@ export interface Dynamic {
removeSeasonalItemsWhenNotInEvent: boolean; removeSeasonalItemsWhenNotInEvent: boolean;
/** Flea blacklist settings */ /** Flea blacklist settings */
blacklist: Blacklist; blacklist: Blacklist;
/** Should prices over the multiplier be adjusted */ /** Dict of price limits keyed by item type */
unreasonableModPrices: IUnreasonableModPrices; unreasonableModPrices: Record<string, IUnreasonableModPrices>;
}
export interface IUnreasonableModPrices {
enabled: boolean;
handbookPriceOverMultiplier: number;
newPriceHandbookMultiplier: number;
} }
export interface Barter { export interface Barter {
/** Should barter offers be generated */ /** Should barter offers be generated */
@ -121,3 +116,8 @@ export interface Blacklist {
/** Should trader items that are blacklisted by bsg */ /** Should trader items that are blacklisted by bsg */
traderItems: boolean; traderItems: boolean;
} }
export interface IUnreasonableModPrices {
enabled: boolean;
handbookPriceOverMultiplier: number;
newPriceHandbookMultiplier: number;
}

View File

@ -6,14 +6,15 @@ import { NotificationSendHelper } from "../helpers/NotificationSendHelper";
import { SecureContainerHelper } from "../helpers/SecureContainerHelper"; import { SecureContainerHelper } from "../helpers/SecureContainerHelper";
import { TraderHelper } from "../helpers/TraderHelper"; import { TraderHelper } from "../helpers/TraderHelper";
import { IPmcData } from "../models/eft/common/IPmcData"; import { IPmcData } from "../models/eft/common/IPmcData";
import { InsuredItem } from "../models/eft/common/tables/IBotBase";
import { Item } from "../models/eft/common/tables/IItem"; import { Item } from "../models/eft/common/tables/IItem";
import { IInsuredItemsData } from "../models/eft/inRaid/IInsuredItemsData";
import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData";
import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig"; import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig";
import { ILogger } from "../models/spt/utils/ILogger"; import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer"; import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer"; import { DatabaseServer } from "../servers/DatabaseServer";
import { SaveServer } from "../servers/SaveServer"; import { SaveServer } from "../servers/SaveServer";
import { JsonUtil } from "../utils/JsonUtil";
import { RandomUtil } from "../utils/RandomUtil"; import { RandomUtil } from "../utils/RandomUtil";
import { TimeUtil } from "../utils/TimeUtil"; import { TimeUtil } from "../utils/TimeUtil";
import { LocaleService } from "./LocaleService"; import { LocaleService } from "./LocaleService";
@ -24,6 +25,7 @@ export declare class InsuranceService {
protected secureContainerHelper: SecureContainerHelper; protected secureContainerHelper: SecureContainerHelper;
protected randomUtil: RandomUtil; protected randomUtil: RandomUtil;
protected itemHelper: ItemHelper; protected itemHelper: ItemHelper;
protected jsonUtil: JsonUtil;
protected timeUtil: TimeUtil; protected timeUtil: TimeUtil;
protected saveServer: SaveServer; protected saveServer: SaveServer;
protected traderHelper: TraderHelper; protected traderHelper: TraderHelper;
@ -35,7 +37,12 @@ export declare class InsuranceService {
protected configServer: ConfigServer; protected configServer: ConfigServer;
protected insured: Record<string, Record<string, Item[]>>; protected insured: Record<string, Record<string, Item[]>>;
protected insuranceConfig: IInsuranceConfig; protected insuranceConfig: IInsuranceConfig;
constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, notificationSendHelper: NotificationSendHelper, configServer: ConfigServer); constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, jsonUtil: JsonUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, notificationSendHelper: NotificationSendHelper, configServer: ConfigServer);
/**
* Does player have insurance array
* @param sessionId Player id
* @returns True if exists
*/
insuranceExists(sessionId: string): boolean; insuranceExists(sessionId: string): boolean;
/** /**
* Get all insured items by all traders for a profile * Get all insured items by all traders for a profile
@ -78,7 +85,7 @@ export declare class InsuranceService {
*/ */
protected getInsuranceReturnTimestamp(pmcData: IPmcData, trader: ITraderBase): number; protected getInsuranceReturnTimestamp(pmcData: IPmcData, trader: ITraderBase): number;
/** /**
* Store lost gear post-raid inside profile * Store lost gear post-raid inside profile, ready for later code to pick it up and mail it
* @param pmcData player profile to store gear in * @param pmcData player profile to store gear in
* @param offraidData post-raid request object * @param offraidData post-raid request object
* @param preRaidGear gear player wore prior to raid * @param preRaidGear gear player wore prior to raid
@ -86,6 +93,21 @@ export declare class InsuranceService {
* @param playerDied did the player die in raid * @param playerDied did the player die in raid
*/ */
storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): void; storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): void;
/**
* Take preraid item and update properties to ensure its ready to be given to player in insurance return mail
* @param pmcData Player profile
* @param insuredItem Insured items properties
* @param preRaidItem Insured item as it was pre-raid
* @param insuredItemFromClient Item data when player left raid (durability values)
* @returns Item object
*/
protected getInsuredItemDetails(pmcData: IPmcData, preRaidItem: Item, insuredItemFromClient: IInsuredItemsData): Item;
/**
* Reset slotId property to "hideout" when necessary (used to be in )
* @param pmcData Players pmcData.Inventory.equipment value
* @param itemToReturn item we will send to player as insurance return
*/
protected updateSlotIdValue(playerBaseInventoryEquipmentId: string, itemToReturn: Item): void;
/** /**
* Create a hash table for an array of items, keyed by items _id * Create a hash table for an array of items, keyed by items _id
* @param items Items to hash * @param items Items to hash
@ -94,12 +116,17 @@ export declare class InsuranceService {
protected createItemHashTable(items: Item[]): Record<string, Item>; protected createItemHashTable(items: Item[]): Record<string, Item>;
/** /**
* Add gear item to InsuredItems array in player profile * Add gear item to InsuredItems array in player profile
* @param pmcData profile to store item in
* @param insuredItem Item to store in profile
* @param actualItem item to store
* @param sessionID Session id * @param sessionID Session id
* @param pmcData Player profile
* @param itemToReturnToPlayer item to store
* @param traderId Id of trader item was insured with
*/ */
protected addGearToSend(pmcData: IPmcData, insuredItem: InsuredItem, actualItem: Item, sessionID: string): void; protected addGearToSend(gear: {
sessionID: string;
pmcData: IPmcData;
itemToReturnToPlayer: Item;
traderId: string;
}): void;
/** /**
* Does insurance exist for a player and by trader * Does insurance exist for a player and by trader
* @param sessionId Player id (session id) * @param sessionId Player id (session id)

View File

@ -267,6 +267,7 @@ export interface BackendCounter {
value: number; value: number;
} }
export interface InsuredItem { export interface InsuredItem {
/** Trader Id item was insured by */
tid: string; tid: string;
itemId: string; itemId: string;
} }

View File

@ -12,6 +12,7 @@ export interface Upd {
Togglable?: Togglable; Togglable?: Togglable;
Map?: Map; Map?: Map;
Tag?: Tag; Tag?: Tag;
/** SPT specific property, not made by BSG */
sptPresetId?: string; sptPresetId?: string;
FaceShield?: FaceShield; FaceShield?: FaceShield;
StackObjectsCount?: number; StackObjectsCount?: number;

View File

@ -0,0 +1,6 @@
export interface IInsuredItemsData {
id: string;
durability?: number;
maxDurability?: number;
hits?: number;
}

View File

@ -1,9 +1,11 @@
import { PlayerRaidEndState } from "../../../models/enums/PlayerRaidEndState"; import { PlayerRaidEndState } from "../../../models/enums/PlayerRaidEndState";
import { IPmcData } from "../common/IPmcData"; import { IPmcData } from "../common/IPmcData";
import { ISyncHealthRequestData } from "../health/ISyncHealthRequestData"; import { ISyncHealthRequestData } from "../health/ISyncHealthRequestData";
import { IInsuredItemsData } from "./IInsuredItemsData";
export interface ISaveProgressRequestData { export interface ISaveProgressRequestData {
exit: PlayerRaidEndState; exit: PlayerRaidEndState;
profile: IPmcData; profile: IPmcData;
isPlayerScav: boolean; isPlayerScav: boolean;
health: ISyncHealthRequestData; health: ISyncHealthRequestData;
insurance: IInsuredItemsData[];
} }

View File

@ -71,13 +71,8 @@ export interface Dynamic {
removeSeasonalItemsWhenNotInEvent: boolean; removeSeasonalItemsWhenNotInEvent: boolean;
/** Flea blacklist settings */ /** Flea blacklist settings */
blacklist: Blacklist; blacklist: Blacklist;
/** Should prices over the multiplier be adjusted */ /** Dict of price limits keyed by item type */
unreasonableModPrices: IUnreasonableModPrices; unreasonableModPrices: Record<string, IUnreasonableModPrices>;
}
export interface IUnreasonableModPrices {
enabled: boolean;
handbookPriceOverMultiplier: number;
newPriceHandbookMultiplier: number;
} }
export interface Barter { export interface Barter {
/** Should barter offers be generated */ /** Should barter offers be generated */
@ -121,3 +116,8 @@ export interface Blacklist {
/** Should trader items that are blacklisted by bsg */ /** Should trader items that are blacklisted by bsg */
traderItems: boolean; traderItems: boolean;
} }
export interface IUnreasonableModPrices {
enabled: boolean;
handbookPriceOverMultiplier: number;
newPriceHandbookMultiplier: number;
}

View File

@ -6,14 +6,15 @@ import { NotificationSendHelper } from "../helpers/NotificationSendHelper";
import { SecureContainerHelper } from "../helpers/SecureContainerHelper"; import { SecureContainerHelper } from "../helpers/SecureContainerHelper";
import { TraderHelper } from "../helpers/TraderHelper"; import { TraderHelper } from "../helpers/TraderHelper";
import { IPmcData } from "../models/eft/common/IPmcData"; import { IPmcData } from "../models/eft/common/IPmcData";
import { InsuredItem } from "../models/eft/common/tables/IBotBase";
import { Item } from "../models/eft/common/tables/IItem"; import { Item } from "../models/eft/common/tables/IItem";
import { IInsuredItemsData } from "../models/eft/inRaid/IInsuredItemsData";
import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData";
import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig"; import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig";
import { ILogger } from "../models/spt/utils/ILogger"; import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer"; import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer"; import { DatabaseServer } from "../servers/DatabaseServer";
import { SaveServer } from "../servers/SaveServer"; import { SaveServer } from "../servers/SaveServer";
import { JsonUtil } from "../utils/JsonUtil";
import { RandomUtil } from "../utils/RandomUtil"; import { RandomUtil } from "../utils/RandomUtil";
import { TimeUtil } from "../utils/TimeUtil"; import { TimeUtil } from "../utils/TimeUtil";
import { LocaleService } from "./LocaleService"; import { LocaleService } from "./LocaleService";
@ -24,6 +25,7 @@ export declare class InsuranceService {
protected secureContainerHelper: SecureContainerHelper; protected secureContainerHelper: SecureContainerHelper;
protected randomUtil: RandomUtil; protected randomUtil: RandomUtil;
protected itemHelper: ItemHelper; protected itemHelper: ItemHelper;
protected jsonUtil: JsonUtil;
protected timeUtil: TimeUtil; protected timeUtil: TimeUtil;
protected saveServer: SaveServer; protected saveServer: SaveServer;
protected traderHelper: TraderHelper; protected traderHelper: TraderHelper;
@ -35,7 +37,12 @@ export declare class InsuranceService {
protected configServer: ConfigServer; protected configServer: ConfigServer;
protected insured: Record<string, Record<string, Item[]>>; protected insured: Record<string, Record<string, Item[]>>;
protected insuranceConfig: IInsuranceConfig; protected insuranceConfig: IInsuranceConfig;
constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, notificationSendHelper: NotificationSendHelper, configServer: ConfigServer); constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, jsonUtil: JsonUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, notificationSendHelper: NotificationSendHelper, configServer: ConfigServer);
/**
* Does player have insurance array
* @param sessionId Player id
* @returns True if exists
*/
insuranceExists(sessionId: string): boolean; insuranceExists(sessionId: string): boolean;
/** /**
* Get all insured items by all traders for a profile * Get all insured items by all traders for a profile
@ -78,7 +85,7 @@ export declare class InsuranceService {
*/ */
protected getInsuranceReturnTimestamp(pmcData: IPmcData, trader: ITraderBase): number; protected getInsuranceReturnTimestamp(pmcData: IPmcData, trader: ITraderBase): number;
/** /**
* Store lost gear post-raid inside profile * Store lost gear post-raid inside profile, ready for later code to pick it up and mail it
* @param pmcData player profile to store gear in * @param pmcData player profile to store gear in
* @param offraidData post-raid request object * @param offraidData post-raid request object
* @param preRaidGear gear player wore prior to raid * @param preRaidGear gear player wore prior to raid
@ -86,6 +93,21 @@ export declare class InsuranceService {
* @param playerDied did the player die in raid * @param playerDied did the player die in raid
*/ */
storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): void; storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): void;
/**
* Take preraid item and update properties to ensure its ready to be given to player in insurance return mail
* @param pmcData Player profile
* @param insuredItem Insured items properties
* @param preRaidItem Insured item as it was pre-raid
* @param insuredItemFromClient Item data when player left raid (durability values)
* @returns Item object
*/
protected getInsuredItemDetails(pmcData: IPmcData, preRaidItem: Item, insuredItemFromClient: IInsuredItemsData): Item;
/**
* Reset slotId property to "hideout" when necessary (used to be in )
* @param pmcData Players pmcData.Inventory.equipment value
* @param itemToReturn item we will send to player as insurance return
*/
protected updateSlotIdValue(playerBaseInventoryEquipmentId: string, itemToReturn: Item): void;
/** /**
* Create a hash table for an array of items, keyed by items _id * Create a hash table for an array of items, keyed by items _id
* @param items Items to hash * @param items Items to hash
@ -94,12 +116,17 @@ export declare class InsuranceService {
protected createItemHashTable(items: Item[]): Record<string, Item>; protected createItemHashTable(items: Item[]): Record<string, Item>;
/** /**
* Add gear item to InsuredItems array in player profile * Add gear item to InsuredItems array in player profile
* @param pmcData profile to store item in
* @param insuredItem Item to store in profile
* @param actualItem item to store
* @param sessionID Session id * @param sessionID Session id
* @param pmcData Player profile
* @param itemToReturnToPlayer item to store
* @param traderId Id of trader item was insured with
*/ */
protected addGearToSend(pmcData: IPmcData, insuredItem: InsuredItem, actualItem: Item, sessionID: string): void; protected addGearToSend(gear: {
sessionID: string;
pmcData: IPmcData;
itemToReturnToPlayer: Item;
traderId: string;
}): void;
/** /**
* Does insurance exist for a player and by trader * Does insurance exist for a player and by trader
* @param sessionId Player id (session id) * @param sessionId Player id (session id)

View File

@ -267,6 +267,7 @@ export interface BackendCounter {
value: number; value: number;
} }
export interface InsuredItem { export interface InsuredItem {
/** Trader Id item was insured by */
tid: string; tid: string;
itemId: string; itemId: string;
} }

View File

@ -12,6 +12,7 @@ export interface Upd {
Togglable?: Togglable; Togglable?: Togglable;
Map?: Map; Map?: Map;
Tag?: Tag; Tag?: Tag;
/** SPT specific property, not made by BSG */
sptPresetId?: string; sptPresetId?: string;
FaceShield?: FaceShield; FaceShield?: FaceShield;
StackObjectsCount?: number; StackObjectsCount?: number;

View File

@ -0,0 +1,6 @@
export interface IInsuredItemsData {
id: string;
durability?: number;
maxDurability?: number;
hits?: number;
}

View File

@ -1,9 +1,11 @@
import { PlayerRaidEndState } from "../../../models/enums/PlayerRaidEndState"; import { PlayerRaidEndState } from "../../../models/enums/PlayerRaidEndState";
import { IPmcData } from "../common/IPmcData"; import { IPmcData } from "../common/IPmcData";
import { ISyncHealthRequestData } from "../health/ISyncHealthRequestData"; import { ISyncHealthRequestData } from "../health/ISyncHealthRequestData";
import { IInsuredItemsData } from "./IInsuredItemsData";
export interface ISaveProgressRequestData { export interface ISaveProgressRequestData {
exit: PlayerRaidEndState; exit: PlayerRaidEndState;
profile: IPmcData; profile: IPmcData;
isPlayerScav: boolean; isPlayerScav: boolean;
health: ISyncHealthRequestData; health: ISyncHealthRequestData;
insurance: IInsuredItemsData[];
} }

View File

@ -71,13 +71,8 @@ export interface Dynamic {
removeSeasonalItemsWhenNotInEvent: boolean; removeSeasonalItemsWhenNotInEvent: boolean;
/** Flea blacklist settings */ /** Flea blacklist settings */
blacklist: Blacklist; blacklist: Blacklist;
/** Should prices over the multiplier be adjusted */ /** Dict of price limits keyed by item type */
unreasonableModPrices: IUnreasonableModPrices; unreasonableModPrices: Record<string, IUnreasonableModPrices>;
}
export interface IUnreasonableModPrices {
enabled: boolean;
handbookPriceOverMultiplier: number;
newPriceHandbookMultiplier: number;
} }
export interface Barter { export interface Barter {
/** Should barter offers be generated */ /** Should barter offers be generated */
@ -121,3 +116,8 @@ export interface Blacklist {
/** Should trader items that are blacklisted by bsg */ /** Should trader items that are blacklisted by bsg */
traderItems: boolean; traderItems: boolean;
} }
export interface IUnreasonableModPrices {
enabled: boolean;
handbookPriceOverMultiplier: number;
newPriceHandbookMultiplier: number;
}

View File

@ -6,14 +6,15 @@ import { NotificationSendHelper } from "../helpers/NotificationSendHelper";
import { SecureContainerHelper } from "../helpers/SecureContainerHelper"; import { SecureContainerHelper } from "../helpers/SecureContainerHelper";
import { TraderHelper } from "../helpers/TraderHelper"; import { TraderHelper } from "../helpers/TraderHelper";
import { IPmcData } from "../models/eft/common/IPmcData"; import { IPmcData } from "../models/eft/common/IPmcData";
import { InsuredItem } from "../models/eft/common/tables/IBotBase";
import { Item } from "../models/eft/common/tables/IItem"; import { Item } from "../models/eft/common/tables/IItem";
import { IInsuredItemsData } from "../models/eft/inRaid/IInsuredItemsData";
import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData";
import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig"; import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig";
import { ILogger } from "../models/spt/utils/ILogger"; import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer"; import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer"; import { DatabaseServer } from "../servers/DatabaseServer";
import { SaveServer } from "../servers/SaveServer"; import { SaveServer } from "../servers/SaveServer";
import { JsonUtil } from "../utils/JsonUtil";
import { RandomUtil } from "../utils/RandomUtil"; import { RandomUtil } from "../utils/RandomUtil";
import { TimeUtil } from "../utils/TimeUtil"; import { TimeUtil } from "../utils/TimeUtil";
import { LocaleService } from "./LocaleService"; import { LocaleService } from "./LocaleService";
@ -24,6 +25,7 @@ export declare class InsuranceService {
protected secureContainerHelper: SecureContainerHelper; protected secureContainerHelper: SecureContainerHelper;
protected randomUtil: RandomUtil; protected randomUtil: RandomUtil;
protected itemHelper: ItemHelper; protected itemHelper: ItemHelper;
protected jsonUtil: JsonUtil;
protected timeUtil: TimeUtil; protected timeUtil: TimeUtil;
protected saveServer: SaveServer; protected saveServer: SaveServer;
protected traderHelper: TraderHelper; protected traderHelper: TraderHelper;
@ -35,7 +37,12 @@ export declare class InsuranceService {
protected configServer: ConfigServer; protected configServer: ConfigServer;
protected insured: Record<string, Record<string, Item[]>>; protected insured: Record<string, Record<string, Item[]>>;
protected insuranceConfig: IInsuranceConfig; protected insuranceConfig: IInsuranceConfig;
constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, notificationSendHelper: NotificationSendHelper, configServer: ConfigServer); constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, jsonUtil: JsonUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, notificationSendHelper: NotificationSendHelper, configServer: ConfigServer);
/**
* Does player have insurance array
* @param sessionId Player id
* @returns True if exists
*/
insuranceExists(sessionId: string): boolean; insuranceExists(sessionId: string): boolean;
/** /**
* Get all insured items by all traders for a profile * Get all insured items by all traders for a profile
@ -78,7 +85,7 @@ export declare class InsuranceService {
*/ */
protected getInsuranceReturnTimestamp(pmcData: IPmcData, trader: ITraderBase): number; protected getInsuranceReturnTimestamp(pmcData: IPmcData, trader: ITraderBase): number;
/** /**
* Store lost gear post-raid inside profile * Store lost gear post-raid inside profile, ready for later code to pick it up and mail it
* @param pmcData player profile to store gear in * @param pmcData player profile to store gear in
* @param offraidData post-raid request object * @param offraidData post-raid request object
* @param preRaidGear gear player wore prior to raid * @param preRaidGear gear player wore prior to raid
@ -86,6 +93,21 @@ export declare class InsuranceService {
* @param playerDied did the player die in raid * @param playerDied did the player die in raid
*/ */
storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): void; storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): void;
/**
* Take preraid item and update properties to ensure its ready to be given to player in insurance return mail
* @param pmcData Player profile
* @param insuredItem Insured items properties
* @param preRaidItem Insured item as it was pre-raid
* @param insuredItemFromClient Item data when player left raid (durability values)
* @returns Item object
*/
protected getInsuredItemDetails(pmcData: IPmcData, preRaidItem: Item, insuredItemFromClient: IInsuredItemsData): Item;
/**
* Reset slotId property to "hideout" when necessary (used to be in )
* @param pmcData Players pmcData.Inventory.equipment value
* @param itemToReturn item we will send to player as insurance return
*/
protected updateSlotIdValue(playerBaseInventoryEquipmentId: string, itemToReturn: Item): void;
/** /**
* Create a hash table for an array of items, keyed by items _id * Create a hash table for an array of items, keyed by items _id
* @param items Items to hash * @param items Items to hash
@ -94,12 +116,17 @@ export declare class InsuranceService {
protected createItemHashTable(items: Item[]): Record<string, Item>; protected createItemHashTable(items: Item[]): Record<string, Item>;
/** /**
* Add gear item to InsuredItems array in player profile * Add gear item to InsuredItems array in player profile
* @param pmcData profile to store item in
* @param insuredItem Item to store in profile
* @param actualItem item to store
* @param sessionID Session id * @param sessionID Session id
* @param pmcData Player profile
* @param itemToReturnToPlayer item to store
* @param traderId Id of trader item was insured with
*/ */
protected addGearToSend(pmcData: IPmcData, insuredItem: InsuredItem, actualItem: Item, sessionID: string): void; protected addGearToSend(gear: {
sessionID: string;
pmcData: IPmcData;
itemToReturnToPlayer: Item;
traderId: string;
}): void;
/** /**
* Does insurance exist for a player and by trader * Does insurance exist for a player and by trader
* @param sessionId Player id (session id) * @param sessionId Player id (session id)

View File

@ -267,6 +267,7 @@ export interface BackendCounter {
value: number; value: number;
} }
export interface InsuredItem { export interface InsuredItem {
/** Trader Id item was insured by */
tid: string; tid: string;
itemId: string; itemId: string;
} }

View File

@ -12,6 +12,7 @@ export interface Upd {
Togglable?: Togglable; Togglable?: Togglable;
Map?: Map; Map?: Map;
Tag?: Tag; Tag?: Tag;
/** SPT specific property, not made by BSG */
sptPresetId?: string; sptPresetId?: string;
FaceShield?: FaceShield; FaceShield?: FaceShield;
StackObjectsCount?: number; StackObjectsCount?: number;

View File

@ -0,0 +1,6 @@
export interface IInsuredItemsData {
id: string;
durability?: number;
maxDurability?: number;
hits?: number;
}

View File

@ -1,9 +1,11 @@
import { PlayerRaidEndState } from "../../../models/enums/PlayerRaidEndState"; import { PlayerRaidEndState } from "../../../models/enums/PlayerRaidEndState";
import { IPmcData } from "../common/IPmcData"; import { IPmcData } from "../common/IPmcData";
import { ISyncHealthRequestData } from "../health/ISyncHealthRequestData"; import { ISyncHealthRequestData } from "../health/ISyncHealthRequestData";
import { IInsuredItemsData } from "./IInsuredItemsData";
export interface ISaveProgressRequestData { export interface ISaveProgressRequestData {
exit: PlayerRaidEndState; exit: PlayerRaidEndState;
profile: IPmcData; profile: IPmcData;
isPlayerScav: boolean; isPlayerScav: boolean;
health: ISyncHealthRequestData; health: ISyncHealthRequestData;
insurance: IInsuredItemsData[];
} }

View File

@ -71,13 +71,8 @@ export interface Dynamic {
removeSeasonalItemsWhenNotInEvent: boolean; removeSeasonalItemsWhenNotInEvent: boolean;
/** Flea blacklist settings */ /** Flea blacklist settings */
blacklist: Blacklist; blacklist: Blacklist;
/** Should prices over the multiplier be adjusted */ /** Dict of price limits keyed by item type */
unreasonableModPrices: IUnreasonableModPrices; unreasonableModPrices: Record<string, IUnreasonableModPrices>;
}
export interface IUnreasonableModPrices {
enabled: boolean;
handbookPriceOverMultiplier: number;
newPriceHandbookMultiplier: number;
} }
export interface Barter { export interface Barter {
/** Should barter offers be generated */ /** Should barter offers be generated */
@ -121,3 +116,8 @@ export interface Blacklist {
/** Should trader items that are blacklisted by bsg */ /** Should trader items that are blacklisted by bsg */
traderItems: boolean; traderItems: boolean;
} }
export interface IUnreasonableModPrices {
enabled: boolean;
handbookPriceOverMultiplier: number;
newPriceHandbookMultiplier: number;
}

View File

@ -6,14 +6,15 @@ import { NotificationSendHelper } from "../helpers/NotificationSendHelper";
import { SecureContainerHelper } from "../helpers/SecureContainerHelper"; import { SecureContainerHelper } from "../helpers/SecureContainerHelper";
import { TraderHelper } from "../helpers/TraderHelper"; import { TraderHelper } from "../helpers/TraderHelper";
import { IPmcData } from "../models/eft/common/IPmcData"; import { IPmcData } from "../models/eft/common/IPmcData";
import { InsuredItem } from "../models/eft/common/tables/IBotBase";
import { Item } from "../models/eft/common/tables/IItem"; import { Item } from "../models/eft/common/tables/IItem";
import { IInsuredItemsData } from "../models/eft/inRaid/IInsuredItemsData";
import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData";
import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig"; import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig";
import { ILogger } from "../models/spt/utils/ILogger"; import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer"; import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer"; import { DatabaseServer } from "../servers/DatabaseServer";
import { SaveServer } from "../servers/SaveServer"; import { SaveServer } from "../servers/SaveServer";
import { JsonUtil } from "../utils/JsonUtil";
import { RandomUtil } from "../utils/RandomUtil"; import { RandomUtil } from "../utils/RandomUtil";
import { TimeUtil } from "../utils/TimeUtil"; import { TimeUtil } from "../utils/TimeUtil";
import { LocaleService } from "./LocaleService"; import { LocaleService } from "./LocaleService";
@ -24,6 +25,7 @@ export declare class InsuranceService {
protected secureContainerHelper: SecureContainerHelper; protected secureContainerHelper: SecureContainerHelper;
protected randomUtil: RandomUtil; protected randomUtil: RandomUtil;
protected itemHelper: ItemHelper; protected itemHelper: ItemHelper;
protected jsonUtil: JsonUtil;
protected timeUtil: TimeUtil; protected timeUtil: TimeUtil;
protected saveServer: SaveServer; protected saveServer: SaveServer;
protected traderHelper: TraderHelper; protected traderHelper: TraderHelper;
@ -35,7 +37,12 @@ export declare class InsuranceService {
protected configServer: ConfigServer; protected configServer: ConfigServer;
protected insured: Record<string, Record<string, Item[]>>; protected insured: Record<string, Record<string, Item[]>>;
protected insuranceConfig: IInsuranceConfig; protected insuranceConfig: IInsuranceConfig;
constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, notificationSendHelper: NotificationSendHelper, configServer: ConfigServer); constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, jsonUtil: JsonUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, notificationSendHelper: NotificationSendHelper, configServer: ConfigServer);
/**
* Does player have insurance array
* @param sessionId Player id
* @returns True if exists
*/
insuranceExists(sessionId: string): boolean; insuranceExists(sessionId: string): boolean;
/** /**
* Get all insured items by all traders for a profile * Get all insured items by all traders for a profile
@ -78,7 +85,7 @@ export declare class InsuranceService {
*/ */
protected getInsuranceReturnTimestamp(pmcData: IPmcData, trader: ITraderBase): number; protected getInsuranceReturnTimestamp(pmcData: IPmcData, trader: ITraderBase): number;
/** /**
* Store lost gear post-raid inside profile * Store lost gear post-raid inside profile, ready for later code to pick it up and mail it
* @param pmcData player profile to store gear in * @param pmcData player profile to store gear in
* @param offraidData post-raid request object * @param offraidData post-raid request object
* @param preRaidGear gear player wore prior to raid * @param preRaidGear gear player wore prior to raid
@ -86,6 +93,21 @@ export declare class InsuranceService {
* @param playerDied did the player die in raid * @param playerDied did the player die in raid
*/ */
storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): void; storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): void;
/**
* Take preraid item and update properties to ensure its ready to be given to player in insurance return mail
* @param pmcData Player profile
* @param insuredItem Insured items properties
* @param preRaidItem Insured item as it was pre-raid
* @param insuredItemFromClient Item data when player left raid (durability values)
* @returns Item object
*/
protected getInsuredItemDetails(pmcData: IPmcData, preRaidItem: Item, insuredItemFromClient: IInsuredItemsData): Item;
/**
* Reset slotId property to "hideout" when necessary (used to be in )
* @param pmcData Players pmcData.Inventory.equipment value
* @param itemToReturn item we will send to player as insurance return
*/
protected updateSlotIdValue(playerBaseInventoryEquipmentId: string, itemToReturn: Item): void;
/** /**
* Create a hash table for an array of items, keyed by items _id * Create a hash table for an array of items, keyed by items _id
* @param items Items to hash * @param items Items to hash
@ -94,12 +116,17 @@ export declare class InsuranceService {
protected createItemHashTable(items: Item[]): Record<string, Item>; protected createItemHashTable(items: Item[]): Record<string, Item>;
/** /**
* Add gear item to InsuredItems array in player profile * Add gear item to InsuredItems array in player profile
* @param pmcData profile to store item in
* @param insuredItem Item to store in profile
* @param actualItem item to store
* @param sessionID Session id * @param sessionID Session id
* @param pmcData Player profile
* @param itemToReturnToPlayer item to store
* @param traderId Id of trader item was insured with
*/ */
protected addGearToSend(pmcData: IPmcData, insuredItem: InsuredItem, actualItem: Item, sessionID: string): void; protected addGearToSend(gear: {
sessionID: string;
pmcData: IPmcData;
itemToReturnToPlayer: Item;
traderId: string;
}): void;
/** /**
* Does insurance exist for a player and by trader * Does insurance exist for a player and by trader
* @param sessionId Player id (session id) * @param sessionId Player id (session id)

View File

@ -267,6 +267,7 @@ export interface BackendCounter {
value: number; value: number;
} }
export interface InsuredItem { export interface InsuredItem {
/** Trader Id item was insured by */
tid: string; tid: string;
itemId: string; itemId: string;
} }

View File

@ -12,6 +12,7 @@ export interface Upd {
Togglable?: Togglable; Togglable?: Togglable;
Map?: Map; Map?: Map;
Tag?: Tag; Tag?: Tag;
/** SPT specific property, not made by BSG */
sptPresetId?: string; sptPresetId?: string;
FaceShield?: FaceShield; FaceShield?: FaceShield;
StackObjectsCount?: number; StackObjectsCount?: number;

View File

@ -0,0 +1,6 @@
export interface IInsuredItemsData {
id: string;
durability?: number;
maxDurability?: number;
hits?: number;
}

View File

@ -1,9 +1,11 @@
import { PlayerRaidEndState } from "../../../models/enums/PlayerRaidEndState"; import { PlayerRaidEndState } from "../../../models/enums/PlayerRaidEndState";
import { IPmcData } from "../common/IPmcData"; import { IPmcData } from "../common/IPmcData";
import { ISyncHealthRequestData } from "../health/ISyncHealthRequestData"; import { ISyncHealthRequestData } from "../health/ISyncHealthRequestData";
import { IInsuredItemsData } from "./IInsuredItemsData";
export interface ISaveProgressRequestData { export interface ISaveProgressRequestData {
exit: PlayerRaidEndState; exit: PlayerRaidEndState;
profile: IPmcData; profile: IPmcData;
isPlayerScav: boolean; isPlayerScav: boolean;
health: ISyncHealthRequestData; health: ISyncHealthRequestData;
insurance: IInsuredItemsData[];
} }

View File

@ -71,13 +71,8 @@ export interface Dynamic {
removeSeasonalItemsWhenNotInEvent: boolean; removeSeasonalItemsWhenNotInEvent: boolean;
/** Flea blacklist settings */ /** Flea blacklist settings */
blacklist: Blacklist; blacklist: Blacklist;
/** Should prices over the multiplier be adjusted */ /** Dict of price limits keyed by item type */
unreasonableModPrices: IUnreasonableModPrices; unreasonableModPrices: Record<string, IUnreasonableModPrices>;
}
export interface IUnreasonableModPrices {
enabled: boolean;
handbookPriceOverMultiplier: number;
newPriceHandbookMultiplier: number;
} }
export interface Barter { export interface Barter {
/** Should barter offers be generated */ /** Should barter offers be generated */
@ -121,3 +116,8 @@ export interface Blacklist {
/** Should trader items that are blacklisted by bsg */ /** Should trader items that are blacklisted by bsg */
traderItems: boolean; traderItems: boolean;
} }
export interface IUnreasonableModPrices {
enabled: boolean;
handbookPriceOverMultiplier: number;
newPriceHandbookMultiplier: number;
}

View File

@ -6,14 +6,15 @@ import { NotificationSendHelper } from "../helpers/NotificationSendHelper";
import { SecureContainerHelper } from "../helpers/SecureContainerHelper"; import { SecureContainerHelper } from "../helpers/SecureContainerHelper";
import { TraderHelper } from "../helpers/TraderHelper"; import { TraderHelper } from "../helpers/TraderHelper";
import { IPmcData } from "../models/eft/common/IPmcData"; import { IPmcData } from "../models/eft/common/IPmcData";
import { InsuredItem } from "../models/eft/common/tables/IBotBase";
import { Item } from "../models/eft/common/tables/IItem"; import { Item } from "../models/eft/common/tables/IItem";
import { IInsuredItemsData } from "../models/eft/inRaid/IInsuredItemsData";
import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData";
import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig"; import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig";
import { ILogger } from "../models/spt/utils/ILogger"; import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer"; import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer"; import { DatabaseServer } from "../servers/DatabaseServer";
import { SaveServer } from "../servers/SaveServer"; import { SaveServer } from "../servers/SaveServer";
import { JsonUtil } from "../utils/JsonUtil";
import { RandomUtil } from "../utils/RandomUtil"; import { RandomUtil } from "../utils/RandomUtil";
import { TimeUtil } from "../utils/TimeUtil"; import { TimeUtil } from "../utils/TimeUtil";
import { LocaleService } from "./LocaleService"; import { LocaleService } from "./LocaleService";
@ -24,6 +25,7 @@ export declare class InsuranceService {
protected secureContainerHelper: SecureContainerHelper; protected secureContainerHelper: SecureContainerHelper;
protected randomUtil: RandomUtil; protected randomUtil: RandomUtil;
protected itemHelper: ItemHelper; protected itemHelper: ItemHelper;
protected jsonUtil: JsonUtil;
protected timeUtil: TimeUtil; protected timeUtil: TimeUtil;
protected saveServer: SaveServer; protected saveServer: SaveServer;
protected traderHelper: TraderHelper; protected traderHelper: TraderHelper;
@ -35,7 +37,12 @@ export declare class InsuranceService {
protected configServer: ConfigServer; protected configServer: ConfigServer;
protected insured: Record<string, Record<string, Item[]>>; protected insured: Record<string, Record<string, Item[]>>;
protected insuranceConfig: IInsuranceConfig; protected insuranceConfig: IInsuranceConfig;
constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, notificationSendHelper: NotificationSendHelper, configServer: ConfigServer); constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, jsonUtil: JsonUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, notificationSendHelper: NotificationSendHelper, configServer: ConfigServer);
/**
* Does player have insurance array
* @param sessionId Player id
* @returns True if exists
*/
insuranceExists(sessionId: string): boolean; insuranceExists(sessionId: string): boolean;
/** /**
* Get all insured items by all traders for a profile * Get all insured items by all traders for a profile
@ -78,7 +85,7 @@ export declare class InsuranceService {
*/ */
protected getInsuranceReturnTimestamp(pmcData: IPmcData, trader: ITraderBase): number; protected getInsuranceReturnTimestamp(pmcData: IPmcData, trader: ITraderBase): number;
/** /**
* Store lost gear post-raid inside profile * Store lost gear post-raid inside profile, ready for later code to pick it up and mail it
* @param pmcData player profile to store gear in * @param pmcData player profile to store gear in
* @param offraidData post-raid request object * @param offraidData post-raid request object
* @param preRaidGear gear player wore prior to raid * @param preRaidGear gear player wore prior to raid
@ -86,6 +93,21 @@ export declare class InsuranceService {
* @param playerDied did the player die in raid * @param playerDied did the player die in raid
*/ */
storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): void; storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): void;
/**
* Take preraid item and update properties to ensure its ready to be given to player in insurance return mail
* @param pmcData Player profile
* @param insuredItem Insured items properties
* @param preRaidItem Insured item as it was pre-raid
* @param insuredItemFromClient Item data when player left raid (durability values)
* @returns Item object
*/
protected getInsuredItemDetails(pmcData: IPmcData, preRaidItem: Item, insuredItemFromClient: IInsuredItemsData): Item;
/**
* Reset slotId property to "hideout" when necessary (used to be in )
* @param pmcData Players pmcData.Inventory.equipment value
* @param itemToReturn item we will send to player as insurance return
*/
protected updateSlotIdValue(playerBaseInventoryEquipmentId: string, itemToReturn: Item): void;
/** /**
* Create a hash table for an array of items, keyed by items _id * Create a hash table for an array of items, keyed by items _id
* @param items Items to hash * @param items Items to hash
@ -94,12 +116,17 @@ export declare class InsuranceService {
protected createItemHashTable(items: Item[]): Record<string, Item>; protected createItemHashTable(items: Item[]): Record<string, Item>;
/** /**
* Add gear item to InsuredItems array in player profile * Add gear item to InsuredItems array in player profile
* @param pmcData profile to store item in
* @param insuredItem Item to store in profile
* @param actualItem item to store
* @param sessionID Session id * @param sessionID Session id
* @param pmcData Player profile
* @param itemToReturnToPlayer item to store
* @param traderId Id of trader item was insured with
*/ */
protected addGearToSend(pmcData: IPmcData, insuredItem: InsuredItem, actualItem: Item, sessionID: string): void; protected addGearToSend(gear: {
sessionID: string;
pmcData: IPmcData;
itemToReturnToPlayer: Item;
traderId: string;
}): void;
/** /**
* Does insurance exist for a player and by trader * Does insurance exist for a player and by trader
* @param sessionId Player id (session id) * @param sessionId Player id (session id)

View File

@ -267,6 +267,7 @@ export interface BackendCounter {
value: number; value: number;
} }
export interface InsuredItem { export interface InsuredItem {
/** Trader Id item was insured by */
tid: string; tid: string;
itemId: string; itemId: string;
} }

View File

@ -12,6 +12,7 @@ export interface Upd {
Togglable?: Togglable; Togglable?: Togglable;
Map?: Map; Map?: Map;
Tag?: Tag; Tag?: Tag;
/** SPT specific property, not made by BSG */
sptPresetId?: string; sptPresetId?: string;
FaceShield?: FaceShield; FaceShield?: FaceShield;
StackObjectsCount?: number; StackObjectsCount?: number;

View File

@ -0,0 +1,6 @@
export interface IInsuredItemsData {
id: string;
durability?: number;
maxDurability?: number;
hits?: number;
}

View File

@ -1,9 +1,11 @@
import { PlayerRaidEndState } from "../../../models/enums/PlayerRaidEndState"; import { PlayerRaidEndState } from "../../../models/enums/PlayerRaidEndState";
import { IPmcData } from "../common/IPmcData"; import { IPmcData } from "../common/IPmcData";
import { ISyncHealthRequestData } from "../health/ISyncHealthRequestData"; import { ISyncHealthRequestData } from "../health/ISyncHealthRequestData";
import { IInsuredItemsData } from "./IInsuredItemsData";
export interface ISaveProgressRequestData { export interface ISaveProgressRequestData {
exit: PlayerRaidEndState; exit: PlayerRaidEndState;
profile: IPmcData; profile: IPmcData;
isPlayerScav: boolean; isPlayerScav: boolean;
health: ISyncHealthRequestData; health: ISyncHealthRequestData;
insurance: IInsuredItemsData[];
} }

View File

@ -71,13 +71,8 @@ export interface Dynamic {
removeSeasonalItemsWhenNotInEvent: boolean; removeSeasonalItemsWhenNotInEvent: boolean;
/** Flea blacklist settings */ /** Flea blacklist settings */
blacklist: Blacklist; blacklist: Blacklist;
/** Should prices over the multiplier be adjusted */ /** Dict of price limits keyed by item type */
unreasonableModPrices: IUnreasonableModPrices; unreasonableModPrices: Record<string, IUnreasonableModPrices>;
}
export interface IUnreasonableModPrices {
enabled: boolean;
handbookPriceOverMultiplier: number;
newPriceHandbookMultiplier: number;
} }
export interface Barter { export interface Barter {
/** Should barter offers be generated */ /** Should barter offers be generated */
@ -121,3 +116,8 @@ export interface Blacklist {
/** Should trader items that are blacklisted by bsg */ /** Should trader items that are blacklisted by bsg */
traderItems: boolean; traderItems: boolean;
} }
export interface IUnreasonableModPrices {
enabled: boolean;
handbookPriceOverMultiplier: number;
newPriceHandbookMultiplier: number;
}

View File

@ -6,14 +6,15 @@ import { NotificationSendHelper } from "../helpers/NotificationSendHelper";
import { SecureContainerHelper } from "../helpers/SecureContainerHelper"; import { SecureContainerHelper } from "../helpers/SecureContainerHelper";
import { TraderHelper } from "../helpers/TraderHelper"; import { TraderHelper } from "../helpers/TraderHelper";
import { IPmcData } from "../models/eft/common/IPmcData"; import { IPmcData } from "../models/eft/common/IPmcData";
import { InsuredItem } from "../models/eft/common/tables/IBotBase";
import { Item } from "../models/eft/common/tables/IItem"; import { Item } from "../models/eft/common/tables/IItem";
import { IInsuredItemsData } from "../models/eft/inRaid/IInsuredItemsData";
import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData";
import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig"; import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig";
import { ILogger } from "../models/spt/utils/ILogger"; import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer"; import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer"; import { DatabaseServer } from "../servers/DatabaseServer";
import { SaveServer } from "../servers/SaveServer"; import { SaveServer } from "../servers/SaveServer";
import { JsonUtil } from "../utils/JsonUtil";
import { RandomUtil } from "../utils/RandomUtil"; import { RandomUtil } from "../utils/RandomUtil";
import { TimeUtil } from "../utils/TimeUtil"; import { TimeUtil } from "../utils/TimeUtil";
import { LocaleService } from "./LocaleService"; import { LocaleService } from "./LocaleService";
@ -24,6 +25,7 @@ export declare class InsuranceService {
protected secureContainerHelper: SecureContainerHelper; protected secureContainerHelper: SecureContainerHelper;
protected randomUtil: RandomUtil; protected randomUtil: RandomUtil;
protected itemHelper: ItemHelper; protected itemHelper: ItemHelper;
protected jsonUtil: JsonUtil;
protected timeUtil: TimeUtil; protected timeUtil: TimeUtil;
protected saveServer: SaveServer; protected saveServer: SaveServer;
protected traderHelper: TraderHelper; protected traderHelper: TraderHelper;
@ -35,7 +37,12 @@ export declare class InsuranceService {
protected configServer: ConfigServer; protected configServer: ConfigServer;
protected insured: Record<string, Record<string, Item[]>>; protected insured: Record<string, Record<string, Item[]>>;
protected insuranceConfig: IInsuranceConfig; protected insuranceConfig: IInsuranceConfig;
constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, notificationSendHelper: NotificationSendHelper, configServer: ConfigServer); constructor(logger: ILogger, databaseServer: DatabaseServer, secureContainerHelper: SecureContainerHelper, randomUtil: RandomUtil, itemHelper: ItemHelper, jsonUtil: JsonUtil, timeUtil: TimeUtil, saveServer: SaveServer, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, localeService: LocaleService, notificationSendHelper: NotificationSendHelper, configServer: ConfigServer);
/**
* Does player have insurance array
* @param sessionId Player id
* @returns True if exists
*/
insuranceExists(sessionId: string): boolean; insuranceExists(sessionId: string): boolean;
/** /**
* Get all insured items by all traders for a profile * Get all insured items by all traders for a profile
@ -78,7 +85,7 @@ export declare class InsuranceService {
*/ */
protected getInsuranceReturnTimestamp(pmcData: IPmcData, trader: ITraderBase): number; protected getInsuranceReturnTimestamp(pmcData: IPmcData, trader: ITraderBase): number;
/** /**
* Store lost gear post-raid inside profile * Store lost gear post-raid inside profile, ready for later code to pick it up and mail it
* @param pmcData player profile to store gear in * @param pmcData player profile to store gear in
* @param offraidData post-raid request object * @param offraidData post-raid request object
* @param preRaidGear gear player wore prior to raid * @param preRaidGear gear player wore prior to raid
@ -86,6 +93,21 @@ export declare class InsuranceService {
* @param playerDied did the player die in raid * @param playerDied did the player die in raid
*/ */
storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): void; storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string, playerDied: boolean): void;
/**
* Take preraid item and update properties to ensure its ready to be given to player in insurance return mail
* @param pmcData Player profile
* @param insuredItem Insured items properties
* @param preRaidItem Insured item as it was pre-raid
* @param insuredItemFromClient Item data when player left raid (durability values)
* @returns Item object
*/
protected getInsuredItemDetails(pmcData: IPmcData, preRaidItem: Item, insuredItemFromClient: IInsuredItemsData): Item;
/**
* Reset slotId property to "hideout" when necessary (used to be in )
* @param pmcData Players pmcData.Inventory.equipment value
* @param itemToReturn item we will send to player as insurance return
*/
protected updateSlotIdValue(playerBaseInventoryEquipmentId: string, itemToReturn: Item): void;
/** /**
* Create a hash table for an array of items, keyed by items _id * Create a hash table for an array of items, keyed by items _id
* @param items Items to hash * @param items Items to hash
@ -94,12 +116,17 @@ export declare class InsuranceService {
protected createItemHashTable(items: Item[]): Record<string, Item>; protected createItemHashTable(items: Item[]): Record<string, Item>;
/** /**
* Add gear item to InsuredItems array in player profile * Add gear item to InsuredItems array in player profile
* @param pmcData profile to store item in
* @param insuredItem Item to store in profile
* @param actualItem item to store
* @param sessionID Session id * @param sessionID Session id
* @param pmcData Player profile
* @param itemToReturnToPlayer item to store
* @param traderId Id of trader item was insured with
*/ */
protected addGearToSend(pmcData: IPmcData, insuredItem: InsuredItem, actualItem: Item, sessionID: string): void; protected addGearToSend(gear: {
sessionID: string;
pmcData: IPmcData;
itemToReturnToPlayer: Item;
traderId: string;
}): void;
/** /**
* Does insurance exist for a player and by trader * Does insurance exist for a player and by trader
* @param sessionId Player id (session id) * @param sessionId Player id (session id)

View File

@ -267,6 +267,7 @@ export interface BackendCounter {
value: number; value: number;
} }
export interface InsuredItem { export interface InsuredItem {
/** Trader Id item was insured by */
tid: string; tid: string;
itemId: string; itemId: string;
} }

View File

@ -12,6 +12,7 @@ export interface Upd {
Togglable?: Togglable; Togglable?: Togglable;
Map?: Map; Map?: Map;
Tag?: Tag; Tag?: Tag;
/** SPT specific property, not made by BSG */
sptPresetId?: string; sptPresetId?: string;
FaceShield?: FaceShield; FaceShield?: FaceShield;
StackObjectsCount?: number; StackObjectsCount?: number;

View File

@ -0,0 +1,6 @@
export interface IInsuredItemsData {
id: string;
durability?: number;
maxDurability?: number;
hits?: number;
}

View File

@ -1,9 +1,11 @@
import { PlayerRaidEndState } from "../../../models/enums/PlayerRaidEndState"; import { PlayerRaidEndState } from "../../../models/enums/PlayerRaidEndState";
import { IPmcData } from "../common/IPmcData"; import { IPmcData } from "../common/IPmcData";
import { ISyncHealthRequestData } from "../health/ISyncHealthRequestData"; import { ISyncHealthRequestData } from "../health/ISyncHealthRequestData";
import { IInsuredItemsData } from "./IInsuredItemsData";
export interface ISaveProgressRequestData { export interface ISaveProgressRequestData {
exit: PlayerRaidEndState; exit: PlayerRaidEndState;
profile: IPmcData; profile: IPmcData;
isPlayerScav: boolean; isPlayerScav: boolean;
health: ISyncHealthRequestData; health: ISyncHealthRequestData;
insurance: IInsuredItemsData[];
} }

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