Merge pull request 'Updated types/readme' (#34) from 3.9.2-DEV into master
Reviewed-on: #34
This commit is contained in:
commit
5e32ead325
@ -1,4 +1,4 @@
|
||||
# Mod examples for v3.9.1
|
||||
# Mod examples for v3.9.2
|
||||
|
||||
A collection of example mods that perform typical actions in SPT
|
||||
|
||||
|
@ -77,7 +77,7 @@ export declare class BotController {
|
||||
* @param sessionId Session id
|
||||
* @returns
|
||||
*/
|
||||
protected generateBotsFirstTime(request: IGenerateBotsRequestData, pmcProfile: IPmcData, sessionId: string): Promise<IBotBase[]>;
|
||||
generateBotsFirstTime(request: IGenerateBotsRequestData, pmcProfile: IPmcData, sessionId: string): Promise<IBotBase[]>;
|
||||
/**
|
||||
* Create a BotGenerationDetails for the bot generator to use
|
||||
* @param condition Client data defining bot type and difficulty
|
||||
@ -117,7 +117,7 @@ export declare class BotController {
|
||||
* @param request Bot generation request object
|
||||
* @returns Single IBotBase object
|
||||
*/
|
||||
protected returnSingleBotFromCache(sessionId: string, request: IGenerateBotsRequestData): Promise<IBotBase[]>;
|
||||
returnSingleBotFromCache(sessionId: string, request: IGenerateBotsRequestData): Promise<IBotBase[]>;
|
||||
protected updateBotGenerationDetailsToRandomBoss(botGenerationDetails: BotGenerationDetails, possibleBossTypeWeights: Record<string, number>): void;
|
||||
/**
|
||||
* Get the difficulty passed in, if its not "asonline", get selected difficulty from config
|
||||
|
@ -24,6 +24,7 @@ import { IRagfairOffer } from "@spt/models/eft/ragfair/IRagfairOffer";
|
||||
import { IRemoveOfferRequestData } from "@spt/models/eft/ragfair/IRemoveOfferRequestData";
|
||||
import { ISearchRequestData } from "@spt/models/eft/ragfair/ISearchRequestData";
|
||||
import { IProcessBuyTradeRequestData } from "@spt/models/eft/trade/IProcessBuyTradeRequestData";
|
||||
import { FleaOfferType } from "@spt/models/enums/FleaOfferType";
|
||||
import { IRagfairConfig } from "@spt/models/spt/config/IRagfairConfig";
|
||||
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||
import { EventOutputHolder } from "@spt/routers/EventOutputHolder";
|
||||
@ -148,13 +149,52 @@ export declare class RagfairController {
|
||||
* @returns IItemEventRouterResponse
|
||||
*/
|
||||
addPlayerOffer(pmcData: IPmcData, offerRequest: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse;
|
||||
/**
|
||||
* Create a flea offer for a single item - uncludes an item with > 1 sized stack
|
||||
* e.g. 1 ammo stack of 30 cartridges
|
||||
* @param sessionID Session id
|
||||
* @param offerRequest Offer request from client
|
||||
* @param fullProfile Full profile of player
|
||||
* @param output Response to send to client
|
||||
* @returns IItemEventRouterResponse
|
||||
*/
|
||||
protected createSingleOffer(sessionID: string, offerRequest: IAddOfferRequestData, fullProfile: ISptProfile, output: IItemEventRouterResponse): IItemEventRouterResponse;
|
||||
/**
|
||||
* Create a flea offer for multiples of the same item, can be single items or items with multiple in the stack
|
||||
* e.g. 2 ammo stacks of 30 cartridges each
|
||||
* Each item can be purchsed individually
|
||||
* @param sessionID Session id
|
||||
* @param offerRequest Offer request from client
|
||||
* @param fullProfile Full profile of player
|
||||
* @param output Response to send to client
|
||||
* @returns IItemEventRouterResponse
|
||||
*/
|
||||
protected createMultiOffer(sessionID: string, offerRequest: IAddOfferRequestData, fullProfile: ISptProfile, output: IItemEventRouterResponse): IItemEventRouterResponse;
|
||||
/**
|
||||
* Create a flea offer for multiple items, can be single items or items with multiple in the stack
|
||||
* e.g. 2 ammo stacks of 30 cartridges each
|
||||
* The entire package must be purchased in one go
|
||||
* @param sessionID Session id
|
||||
* @param offerRequest Offer request from client
|
||||
* @param fullProfile Full profile of player
|
||||
* @param output Response to send to client
|
||||
* @returns IItemEventRouterResponse
|
||||
*/
|
||||
protected createPackOffer(sessionID: string, offerRequest: IAddOfferRequestData, fullProfile: ISptProfile, output: IItemEventRouterResponse): IItemEventRouterResponse;
|
||||
/**
|
||||
* Given a client request, determine what type of offer is being created
|
||||
* single/multi/pack
|
||||
* @param offerRequest Client request
|
||||
* @returns FleaOfferType
|
||||
*/
|
||||
protected getOfferType(offerRequest: IAddOfferRequestData): FleaOfferType;
|
||||
/**
|
||||
* Charge player a listing fee for using flea, pulls charge from data previously sent by client
|
||||
* @param sessionID Player id
|
||||
* @param rootItem Base item being listed (used when client tax cost not found and must be done on server)
|
||||
* @param pmcData Player profile
|
||||
* @param requirementsPriceInRub Rouble cost player chose for listing (used when client tax cost not found and must be done on server)
|
||||
* @param itemStackCount How many items were listed in player (used when client tax cost not found and must be done on server)
|
||||
* @param itemStackCount How many items were listed by player (used when client tax cost not found and must be done on server)
|
||||
* @param offerRequest Add offer request object from client
|
||||
* @param output IItemEventRouterResponse
|
||||
* @returns True if charging tax to player failed
|
||||
@ -180,7 +220,7 @@ export declare class RagfairController {
|
||||
* @returns Array of items from player inventory
|
||||
*/
|
||||
protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[]): {
|
||||
items: Item[] | undefined;
|
||||
items: Item[][] | undefined;
|
||||
errorMessage: string | undefined;
|
||||
};
|
||||
createPlayerOffer(sessionId: string, requirements: Requirement[], items: Item[], sellInOnePiece: boolean): IRagfairOffer;
|
||||
|
@ -33,7 +33,7 @@ export declare class RagfairHelper {
|
||||
getDisplayableAssorts(sessionID: string): Record<string, ITraderAssort>;
|
||||
protected getCategoryList(handbookId: string): string[];
|
||||
/**
|
||||
* Merges Root Items
|
||||
* Iterate over array of identical items and merge stack count
|
||||
* Ragfair allows abnormally large stacks.
|
||||
*/
|
||||
mergeStackable(items: Item[]): Item[];
|
||||
|
@ -120,6 +120,12 @@ export declare class RagfairOfferHelper {
|
||||
* @returns true = complete
|
||||
*/
|
||||
processOffersOnProfile(sessionID: string): boolean;
|
||||
/**
|
||||
* Count up all rootitem StackObjectsCount properties of an array of items
|
||||
* @param itemsInInventoryToList items to sum up
|
||||
* @returns Total count
|
||||
*/
|
||||
getTotalStackCountSize(itemsInInventoryToList: Item[][]): number;
|
||||
/**
|
||||
* Add amount to players ragfair rating
|
||||
* @param sessionId Profile to update
|
||||
|
@ -25,7 +25,8 @@ export declare class RagfairSellHelper {
|
||||
* Get array of item count and sell time (empty array = no sell)
|
||||
* @param sellChancePercent chance item will sell
|
||||
* @param itemSellCount count of items to sell
|
||||
* @param sellInOneGo All items listed get sold at once
|
||||
* @returns Array of purchases of item(s) listed
|
||||
*/
|
||||
rollForSale(sellChancePercent: number, itemSellCount: number): SellResult[];
|
||||
rollForSale(sellChancePercent: number, itemSellCount: number, sellInOneGo?: boolean): SellResult[];
|
||||
}
|
||||
|
6
TypeScript/10ScopesAndTypes/types/models/enums/FleaOfferType.d.ts
vendored
Normal file
6
TypeScript/10ScopesAndTypes/types/models/enums/FleaOfferType.d.ts
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
export declare enum FleaOfferType {
|
||||
SINGLE = 0,
|
||||
MULTI = 1,
|
||||
PACK = 2,
|
||||
UNKNOWN = 3
|
||||
}
|
@ -1,3 +1,4 @@
|
||||
import { ItemHelper } from "@spt/helpers/ItemHelper";
|
||||
import { ProfileHelper } from "@spt/helpers/ProfileHelper";
|
||||
import { RagfairServerHelper } from "@spt/helpers/RagfairServerHelper";
|
||||
import { Item } from "@spt/models/eft/common/tables/IItem";
|
||||
@ -9,6 +10,7 @@ import { ConfigServer } from "@spt/servers/ConfigServer";
|
||||
import { SaveServer } from "@spt/servers/SaveServer";
|
||||
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||
import { LocalisationService } from "@spt/services/LocalisationService";
|
||||
import { ICloner } from "@spt/utils/cloners/ICloner";
|
||||
import { HttpResponseUtil } from "@spt/utils/HttpResponseUtil";
|
||||
import { RagfairOfferHolder } from "@spt/utils/RagfairOfferHolder";
|
||||
import { TimeUtil } from "@spt/utils/TimeUtil";
|
||||
@ -18,17 +20,19 @@ export declare class RagfairOfferService {
|
||||
protected databaseService: DatabaseService;
|
||||
protected saveServer: SaveServer;
|
||||
protected ragfairServerHelper: RagfairServerHelper;
|
||||
protected itemHelper: ItemHelper;
|
||||
protected profileHelper: ProfileHelper;
|
||||
protected eventOutputHolder: EventOutputHolder;
|
||||
protected httpResponse: HttpResponseUtil;
|
||||
protected localisationService: LocalisationService;
|
||||
protected configServer: ConfigServer;
|
||||
protected cloner: ICloner;
|
||||
protected playerOffersLoaded: boolean;
|
||||
/** Offer id + offer object */
|
||||
protected expiredOffers: Record<string, IRagfairOffer>;
|
||||
protected ragfairConfig: IRagfairConfig;
|
||||
protected ragfairOfferHandler: RagfairOfferHolder;
|
||||
constructor(logger: ILogger, timeUtil: TimeUtil, databaseService: DatabaseService, saveServer: SaveServer, ragfairServerHelper: RagfairServerHelper, profileHelper: ProfileHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, localisationService: LocalisationService, configServer: ConfigServer);
|
||||
constructor(logger: ILogger, timeUtil: TimeUtil, databaseService: DatabaseService, saveServer: SaveServer, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, localisationService: LocalisationService, configServer: ConfigServer, cloner: ICloner);
|
||||
/**
|
||||
* Get all offers
|
||||
* @returns IRagfairOffer array
|
||||
@ -84,4 +88,12 @@ export declare class RagfairOfferService {
|
||||
*/
|
||||
protected processStaleOffer(staleOffer: IRagfairOffer): void;
|
||||
protected returnPlayerOffer(playerOffer: IRagfairOffer): void;
|
||||
/**
|
||||
* Flea offer items are stacked up often beyond the StackMaxSize limit
|
||||
* Un stack the items into an array of root items and their children
|
||||
* Will create new items equal to the
|
||||
* @param items Offer items to unstack
|
||||
* @returns Unstacked array of items
|
||||
*/
|
||||
protected unstackOfferItems(items: Item[]): Item[];
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ export declare class BotController {
|
||||
* @param sessionId Session id
|
||||
* @returns
|
||||
*/
|
||||
protected generateBotsFirstTime(request: IGenerateBotsRequestData, pmcProfile: IPmcData, sessionId: string): Promise<IBotBase[]>;
|
||||
generateBotsFirstTime(request: IGenerateBotsRequestData, pmcProfile: IPmcData, sessionId: string): Promise<IBotBase[]>;
|
||||
/**
|
||||
* Create a BotGenerationDetails for the bot generator to use
|
||||
* @param condition Client data defining bot type and difficulty
|
||||
@ -117,7 +117,7 @@ export declare class BotController {
|
||||
* @param request Bot generation request object
|
||||
* @returns Single IBotBase object
|
||||
*/
|
||||
protected returnSingleBotFromCache(sessionId: string, request: IGenerateBotsRequestData): Promise<IBotBase[]>;
|
||||
returnSingleBotFromCache(sessionId: string, request: IGenerateBotsRequestData): Promise<IBotBase[]>;
|
||||
protected updateBotGenerationDetailsToRandomBoss(botGenerationDetails: BotGenerationDetails, possibleBossTypeWeights: Record<string, number>): void;
|
||||
/**
|
||||
* Get the difficulty passed in, if its not "asonline", get selected difficulty from config
|
||||
|
@ -24,6 +24,7 @@ import { IRagfairOffer } from "@spt/models/eft/ragfair/IRagfairOffer";
|
||||
import { IRemoveOfferRequestData } from "@spt/models/eft/ragfair/IRemoveOfferRequestData";
|
||||
import { ISearchRequestData } from "@spt/models/eft/ragfair/ISearchRequestData";
|
||||
import { IProcessBuyTradeRequestData } from "@spt/models/eft/trade/IProcessBuyTradeRequestData";
|
||||
import { FleaOfferType } from "@spt/models/enums/FleaOfferType";
|
||||
import { IRagfairConfig } from "@spt/models/spt/config/IRagfairConfig";
|
||||
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||
import { EventOutputHolder } from "@spt/routers/EventOutputHolder";
|
||||
@ -148,13 +149,52 @@ export declare class RagfairController {
|
||||
* @returns IItemEventRouterResponse
|
||||
*/
|
||||
addPlayerOffer(pmcData: IPmcData, offerRequest: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse;
|
||||
/**
|
||||
* Create a flea offer for a single item - uncludes an item with > 1 sized stack
|
||||
* e.g. 1 ammo stack of 30 cartridges
|
||||
* @param sessionID Session id
|
||||
* @param offerRequest Offer request from client
|
||||
* @param fullProfile Full profile of player
|
||||
* @param output Response to send to client
|
||||
* @returns IItemEventRouterResponse
|
||||
*/
|
||||
protected createSingleOffer(sessionID: string, offerRequest: IAddOfferRequestData, fullProfile: ISptProfile, output: IItemEventRouterResponse): IItemEventRouterResponse;
|
||||
/**
|
||||
* Create a flea offer for multiples of the same item, can be single items or items with multiple in the stack
|
||||
* e.g. 2 ammo stacks of 30 cartridges each
|
||||
* Each item can be purchsed individually
|
||||
* @param sessionID Session id
|
||||
* @param offerRequest Offer request from client
|
||||
* @param fullProfile Full profile of player
|
||||
* @param output Response to send to client
|
||||
* @returns IItemEventRouterResponse
|
||||
*/
|
||||
protected createMultiOffer(sessionID: string, offerRequest: IAddOfferRequestData, fullProfile: ISptProfile, output: IItemEventRouterResponse): IItemEventRouterResponse;
|
||||
/**
|
||||
* Create a flea offer for multiple items, can be single items or items with multiple in the stack
|
||||
* e.g. 2 ammo stacks of 30 cartridges each
|
||||
* The entire package must be purchased in one go
|
||||
* @param sessionID Session id
|
||||
* @param offerRequest Offer request from client
|
||||
* @param fullProfile Full profile of player
|
||||
* @param output Response to send to client
|
||||
* @returns IItemEventRouterResponse
|
||||
*/
|
||||
protected createPackOffer(sessionID: string, offerRequest: IAddOfferRequestData, fullProfile: ISptProfile, output: IItemEventRouterResponse): IItemEventRouterResponse;
|
||||
/**
|
||||
* Given a client request, determine what type of offer is being created
|
||||
* single/multi/pack
|
||||
* @param offerRequest Client request
|
||||
* @returns FleaOfferType
|
||||
*/
|
||||
protected getOfferType(offerRequest: IAddOfferRequestData): FleaOfferType;
|
||||
/**
|
||||
* Charge player a listing fee for using flea, pulls charge from data previously sent by client
|
||||
* @param sessionID Player id
|
||||
* @param rootItem Base item being listed (used when client tax cost not found and must be done on server)
|
||||
* @param pmcData Player profile
|
||||
* @param requirementsPriceInRub Rouble cost player chose for listing (used when client tax cost not found and must be done on server)
|
||||
* @param itemStackCount How many items were listed in player (used when client tax cost not found and must be done on server)
|
||||
* @param itemStackCount How many items were listed by player (used when client tax cost not found and must be done on server)
|
||||
* @param offerRequest Add offer request object from client
|
||||
* @param output IItemEventRouterResponse
|
||||
* @returns True if charging tax to player failed
|
||||
@ -180,7 +220,7 @@ export declare class RagfairController {
|
||||
* @returns Array of items from player inventory
|
||||
*/
|
||||
protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[]): {
|
||||
items: Item[] | undefined;
|
||||
items: Item[][] | undefined;
|
||||
errorMessage: string | undefined;
|
||||
};
|
||||
createPlayerOffer(sessionId: string, requirements: Requirement[], items: Item[], sellInOnePiece: boolean): IRagfairOffer;
|
||||
|
@ -33,7 +33,7 @@ export declare class RagfairHelper {
|
||||
getDisplayableAssorts(sessionID: string): Record<string, ITraderAssort>;
|
||||
protected getCategoryList(handbookId: string): string[];
|
||||
/**
|
||||
* Merges Root Items
|
||||
* Iterate over array of identical items and merge stack count
|
||||
* Ragfair allows abnormally large stacks.
|
||||
*/
|
||||
mergeStackable(items: Item[]): Item[];
|
||||
|
@ -120,6 +120,12 @@ export declare class RagfairOfferHelper {
|
||||
* @returns true = complete
|
||||
*/
|
||||
processOffersOnProfile(sessionID: string): boolean;
|
||||
/**
|
||||
* Count up all rootitem StackObjectsCount properties of an array of items
|
||||
* @param itemsInInventoryToList items to sum up
|
||||
* @returns Total count
|
||||
*/
|
||||
getTotalStackCountSize(itemsInInventoryToList: Item[][]): number;
|
||||
/**
|
||||
* Add amount to players ragfair rating
|
||||
* @param sessionId Profile to update
|
||||
|
@ -25,7 +25,8 @@ export declare class RagfairSellHelper {
|
||||
* Get array of item count and sell time (empty array = no sell)
|
||||
* @param sellChancePercent chance item will sell
|
||||
* @param itemSellCount count of items to sell
|
||||
* @param sellInOneGo All items listed get sold at once
|
||||
* @returns Array of purchases of item(s) listed
|
||||
*/
|
||||
rollForSale(sellChancePercent: number, itemSellCount: number): SellResult[];
|
||||
rollForSale(sellChancePercent: number, itemSellCount: number, sellInOneGo?: boolean): SellResult[];
|
||||
}
|
||||
|
6
TypeScript/11BundleLoadingSample/types/models/enums/FleaOfferType.d.ts
vendored
Normal file
6
TypeScript/11BundleLoadingSample/types/models/enums/FleaOfferType.d.ts
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
export declare enum FleaOfferType {
|
||||
SINGLE = 0,
|
||||
MULTI = 1,
|
||||
PACK = 2,
|
||||
UNKNOWN = 3
|
||||
}
|
@ -1,3 +1,4 @@
|
||||
import { ItemHelper } from "@spt/helpers/ItemHelper";
|
||||
import { ProfileHelper } from "@spt/helpers/ProfileHelper";
|
||||
import { RagfairServerHelper } from "@spt/helpers/RagfairServerHelper";
|
||||
import { Item } from "@spt/models/eft/common/tables/IItem";
|
||||
@ -9,6 +10,7 @@ import { ConfigServer } from "@spt/servers/ConfigServer";
|
||||
import { SaveServer } from "@spt/servers/SaveServer";
|
||||
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||
import { LocalisationService } from "@spt/services/LocalisationService";
|
||||
import { ICloner } from "@spt/utils/cloners/ICloner";
|
||||
import { HttpResponseUtil } from "@spt/utils/HttpResponseUtil";
|
||||
import { RagfairOfferHolder } from "@spt/utils/RagfairOfferHolder";
|
||||
import { TimeUtil } from "@spt/utils/TimeUtil";
|
||||
@ -18,17 +20,19 @@ export declare class RagfairOfferService {
|
||||
protected databaseService: DatabaseService;
|
||||
protected saveServer: SaveServer;
|
||||
protected ragfairServerHelper: RagfairServerHelper;
|
||||
protected itemHelper: ItemHelper;
|
||||
protected profileHelper: ProfileHelper;
|
||||
protected eventOutputHolder: EventOutputHolder;
|
||||
protected httpResponse: HttpResponseUtil;
|
||||
protected localisationService: LocalisationService;
|
||||
protected configServer: ConfigServer;
|
||||
protected cloner: ICloner;
|
||||
protected playerOffersLoaded: boolean;
|
||||
/** Offer id + offer object */
|
||||
protected expiredOffers: Record<string, IRagfairOffer>;
|
||||
protected ragfairConfig: IRagfairConfig;
|
||||
protected ragfairOfferHandler: RagfairOfferHolder;
|
||||
constructor(logger: ILogger, timeUtil: TimeUtil, databaseService: DatabaseService, saveServer: SaveServer, ragfairServerHelper: RagfairServerHelper, profileHelper: ProfileHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, localisationService: LocalisationService, configServer: ConfigServer);
|
||||
constructor(logger: ILogger, timeUtil: TimeUtil, databaseService: DatabaseService, saveServer: SaveServer, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, localisationService: LocalisationService, configServer: ConfigServer, cloner: ICloner);
|
||||
/**
|
||||
* Get all offers
|
||||
* @returns IRagfairOffer array
|
||||
@ -84,4 +88,12 @@ export declare class RagfairOfferService {
|
||||
*/
|
||||
protected processStaleOffer(staleOffer: IRagfairOffer): void;
|
||||
protected returnPlayerOffer(playerOffer: IRagfairOffer): void;
|
||||
/**
|
||||
* Flea offer items are stacked up often beyond the StackMaxSize limit
|
||||
* Un stack the items into an array of root items and their children
|
||||
* Will create new items equal to the
|
||||
* @param items Offer items to unstack
|
||||
* @returns Unstacked array of items
|
||||
*/
|
||||
protected unstackOfferItems(items: Item[]): Item[];
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ export declare class BotController {
|
||||
* @param sessionId Session id
|
||||
* @returns
|
||||
*/
|
||||
protected generateBotsFirstTime(request: IGenerateBotsRequestData, pmcProfile: IPmcData, sessionId: string): Promise<IBotBase[]>;
|
||||
generateBotsFirstTime(request: IGenerateBotsRequestData, pmcProfile: IPmcData, sessionId: string): Promise<IBotBase[]>;
|
||||
/**
|
||||
* Create a BotGenerationDetails for the bot generator to use
|
||||
* @param condition Client data defining bot type and difficulty
|
||||
@ -117,7 +117,7 @@ export declare class BotController {
|
||||
* @param request Bot generation request object
|
||||
* @returns Single IBotBase object
|
||||
*/
|
||||
protected returnSingleBotFromCache(sessionId: string, request: IGenerateBotsRequestData): Promise<IBotBase[]>;
|
||||
returnSingleBotFromCache(sessionId: string, request: IGenerateBotsRequestData): Promise<IBotBase[]>;
|
||||
protected updateBotGenerationDetailsToRandomBoss(botGenerationDetails: BotGenerationDetails, possibleBossTypeWeights: Record<string, number>): void;
|
||||
/**
|
||||
* Get the difficulty passed in, if its not "asonline", get selected difficulty from config
|
||||
|
@ -24,6 +24,7 @@ import { IRagfairOffer } from "@spt/models/eft/ragfair/IRagfairOffer";
|
||||
import { IRemoveOfferRequestData } from "@spt/models/eft/ragfair/IRemoveOfferRequestData";
|
||||
import { ISearchRequestData } from "@spt/models/eft/ragfair/ISearchRequestData";
|
||||
import { IProcessBuyTradeRequestData } from "@spt/models/eft/trade/IProcessBuyTradeRequestData";
|
||||
import { FleaOfferType } from "@spt/models/enums/FleaOfferType";
|
||||
import { IRagfairConfig } from "@spt/models/spt/config/IRagfairConfig";
|
||||
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||
import { EventOutputHolder } from "@spt/routers/EventOutputHolder";
|
||||
@ -148,13 +149,52 @@ export declare class RagfairController {
|
||||
* @returns IItemEventRouterResponse
|
||||
*/
|
||||
addPlayerOffer(pmcData: IPmcData, offerRequest: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse;
|
||||
/**
|
||||
* Create a flea offer for a single item - uncludes an item with > 1 sized stack
|
||||
* e.g. 1 ammo stack of 30 cartridges
|
||||
* @param sessionID Session id
|
||||
* @param offerRequest Offer request from client
|
||||
* @param fullProfile Full profile of player
|
||||
* @param output Response to send to client
|
||||
* @returns IItemEventRouterResponse
|
||||
*/
|
||||
protected createSingleOffer(sessionID: string, offerRequest: IAddOfferRequestData, fullProfile: ISptProfile, output: IItemEventRouterResponse): IItemEventRouterResponse;
|
||||
/**
|
||||
* Create a flea offer for multiples of the same item, can be single items or items with multiple in the stack
|
||||
* e.g. 2 ammo stacks of 30 cartridges each
|
||||
* Each item can be purchsed individually
|
||||
* @param sessionID Session id
|
||||
* @param offerRequest Offer request from client
|
||||
* @param fullProfile Full profile of player
|
||||
* @param output Response to send to client
|
||||
* @returns IItemEventRouterResponse
|
||||
*/
|
||||
protected createMultiOffer(sessionID: string, offerRequest: IAddOfferRequestData, fullProfile: ISptProfile, output: IItemEventRouterResponse): IItemEventRouterResponse;
|
||||
/**
|
||||
* Create a flea offer for multiple items, can be single items or items with multiple in the stack
|
||||
* e.g. 2 ammo stacks of 30 cartridges each
|
||||
* The entire package must be purchased in one go
|
||||
* @param sessionID Session id
|
||||
* @param offerRequest Offer request from client
|
||||
* @param fullProfile Full profile of player
|
||||
* @param output Response to send to client
|
||||
* @returns IItemEventRouterResponse
|
||||
*/
|
||||
protected createPackOffer(sessionID: string, offerRequest: IAddOfferRequestData, fullProfile: ISptProfile, output: IItemEventRouterResponse): IItemEventRouterResponse;
|
||||
/**
|
||||
* Given a client request, determine what type of offer is being created
|
||||
* single/multi/pack
|
||||
* @param offerRequest Client request
|
||||
* @returns FleaOfferType
|
||||
*/
|
||||
protected getOfferType(offerRequest: IAddOfferRequestData): FleaOfferType;
|
||||
/**
|
||||
* Charge player a listing fee for using flea, pulls charge from data previously sent by client
|
||||
* @param sessionID Player id
|
||||
* @param rootItem Base item being listed (used when client tax cost not found and must be done on server)
|
||||
* @param pmcData Player profile
|
||||
* @param requirementsPriceInRub Rouble cost player chose for listing (used when client tax cost not found and must be done on server)
|
||||
* @param itemStackCount How many items were listed in player (used when client tax cost not found and must be done on server)
|
||||
* @param itemStackCount How many items were listed by player (used when client tax cost not found and must be done on server)
|
||||
* @param offerRequest Add offer request object from client
|
||||
* @param output IItemEventRouterResponse
|
||||
* @returns True if charging tax to player failed
|
||||
@ -180,7 +220,7 @@ export declare class RagfairController {
|
||||
* @returns Array of items from player inventory
|
||||
*/
|
||||
protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[]): {
|
||||
items: Item[] | undefined;
|
||||
items: Item[][] | undefined;
|
||||
errorMessage: string | undefined;
|
||||
};
|
||||
createPlayerOffer(sessionId: string, requirements: Requirement[], items: Item[], sellInOnePiece: boolean): IRagfairOffer;
|
||||
|
@ -33,7 +33,7 @@ export declare class RagfairHelper {
|
||||
getDisplayableAssorts(sessionID: string): Record<string, ITraderAssort>;
|
||||
protected getCategoryList(handbookId: string): string[];
|
||||
/**
|
||||
* Merges Root Items
|
||||
* Iterate over array of identical items and merge stack count
|
||||
* Ragfair allows abnormally large stacks.
|
||||
*/
|
||||
mergeStackable(items: Item[]): Item[];
|
||||
|
@ -120,6 +120,12 @@ export declare class RagfairOfferHelper {
|
||||
* @returns true = complete
|
||||
*/
|
||||
processOffersOnProfile(sessionID: string): boolean;
|
||||
/**
|
||||
* Count up all rootitem StackObjectsCount properties of an array of items
|
||||
* @param itemsInInventoryToList items to sum up
|
||||
* @returns Total count
|
||||
*/
|
||||
getTotalStackCountSize(itemsInInventoryToList: Item[][]): number;
|
||||
/**
|
||||
* Add amount to players ragfair rating
|
||||
* @param sessionId Profile to update
|
||||
|
@ -25,7 +25,8 @@ export declare class RagfairSellHelper {
|
||||
* Get array of item count and sell time (empty array = no sell)
|
||||
* @param sellChancePercent chance item will sell
|
||||
* @param itemSellCount count of items to sell
|
||||
* @param sellInOneGo All items listed get sold at once
|
||||
* @returns Array of purchases of item(s) listed
|
||||
*/
|
||||
rollForSale(sellChancePercent: number, itemSellCount: number): SellResult[];
|
||||
rollForSale(sellChancePercent: number, itemSellCount: number, sellInOneGo?: boolean): SellResult[];
|
||||
}
|
||||
|
6
TypeScript/12ClassExtensionOverride/types/models/enums/FleaOfferType.d.ts
vendored
Normal file
6
TypeScript/12ClassExtensionOverride/types/models/enums/FleaOfferType.d.ts
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
export declare enum FleaOfferType {
|
||||
SINGLE = 0,
|
||||
MULTI = 1,
|
||||
PACK = 2,
|
||||
UNKNOWN = 3
|
||||
}
|
@ -1,3 +1,4 @@
|
||||
import { ItemHelper } from "@spt/helpers/ItemHelper";
|
||||
import { ProfileHelper } from "@spt/helpers/ProfileHelper";
|
||||
import { RagfairServerHelper } from "@spt/helpers/RagfairServerHelper";
|
||||
import { Item } from "@spt/models/eft/common/tables/IItem";
|
||||
@ -9,6 +10,7 @@ import { ConfigServer } from "@spt/servers/ConfigServer";
|
||||
import { SaveServer } from "@spt/servers/SaveServer";
|
||||
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||
import { LocalisationService } from "@spt/services/LocalisationService";
|
||||
import { ICloner } from "@spt/utils/cloners/ICloner";
|
||||
import { HttpResponseUtil } from "@spt/utils/HttpResponseUtil";
|
||||
import { RagfairOfferHolder } from "@spt/utils/RagfairOfferHolder";
|
||||
import { TimeUtil } from "@spt/utils/TimeUtil";
|
||||
@ -18,17 +20,19 @@ export declare class RagfairOfferService {
|
||||
protected databaseService: DatabaseService;
|
||||
protected saveServer: SaveServer;
|
||||
protected ragfairServerHelper: RagfairServerHelper;
|
||||
protected itemHelper: ItemHelper;
|
||||
protected profileHelper: ProfileHelper;
|
||||
protected eventOutputHolder: EventOutputHolder;
|
||||
protected httpResponse: HttpResponseUtil;
|
||||
protected localisationService: LocalisationService;
|
||||
protected configServer: ConfigServer;
|
||||
protected cloner: ICloner;
|
||||
protected playerOffersLoaded: boolean;
|
||||
/** Offer id + offer object */
|
||||
protected expiredOffers: Record<string, IRagfairOffer>;
|
||||
protected ragfairConfig: IRagfairConfig;
|
||||
protected ragfairOfferHandler: RagfairOfferHolder;
|
||||
constructor(logger: ILogger, timeUtil: TimeUtil, databaseService: DatabaseService, saveServer: SaveServer, ragfairServerHelper: RagfairServerHelper, profileHelper: ProfileHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, localisationService: LocalisationService, configServer: ConfigServer);
|
||||
constructor(logger: ILogger, timeUtil: TimeUtil, databaseService: DatabaseService, saveServer: SaveServer, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, localisationService: LocalisationService, configServer: ConfigServer, cloner: ICloner);
|
||||
/**
|
||||
* Get all offers
|
||||
* @returns IRagfairOffer array
|
||||
@ -84,4 +88,12 @@ export declare class RagfairOfferService {
|
||||
*/
|
||||
protected processStaleOffer(staleOffer: IRagfairOffer): void;
|
||||
protected returnPlayerOffer(playerOffer: IRagfairOffer): void;
|
||||
/**
|
||||
* Flea offer items are stacked up often beyond the StackMaxSize limit
|
||||
* Un stack the items into an array of root items and their children
|
||||
* Will create new items equal to the
|
||||
* @param items Offer items to unstack
|
||||
* @returns Unstacked array of items
|
||||
*/
|
||||
protected unstackOfferItems(items: Item[]): Item[];
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ export declare class BotController {
|
||||
* @param sessionId Session id
|
||||
* @returns
|
||||
*/
|
||||
protected generateBotsFirstTime(request: IGenerateBotsRequestData, pmcProfile: IPmcData, sessionId: string): Promise<IBotBase[]>;
|
||||
generateBotsFirstTime(request: IGenerateBotsRequestData, pmcProfile: IPmcData, sessionId: string): Promise<IBotBase[]>;
|
||||
/**
|
||||
* Create a BotGenerationDetails for the bot generator to use
|
||||
* @param condition Client data defining bot type and difficulty
|
||||
@ -117,7 +117,7 @@ export declare class BotController {
|
||||
* @param request Bot generation request object
|
||||
* @returns Single IBotBase object
|
||||
*/
|
||||
protected returnSingleBotFromCache(sessionId: string, request: IGenerateBotsRequestData): Promise<IBotBase[]>;
|
||||
returnSingleBotFromCache(sessionId: string, request: IGenerateBotsRequestData): Promise<IBotBase[]>;
|
||||
protected updateBotGenerationDetailsToRandomBoss(botGenerationDetails: BotGenerationDetails, possibleBossTypeWeights: Record<string, number>): void;
|
||||
/**
|
||||
* Get the difficulty passed in, if its not "asonline", get selected difficulty from config
|
||||
|
@ -24,6 +24,7 @@ import { IRagfairOffer } from "@spt/models/eft/ragfair/IRagfairOffer";
|
||||
import { IRemoveOfferRequestData } from "@spt/models/eft/ragfair/IRemoveOfferRequestData";
|
||||
import { ISearchRequestData } from "@spt/models/eft/ragfair/ISearchRequestData";
|
||||
import { IProcessBuyTradeRequestData } from "@spt/models/eft/trade/IProcessBuyTradeRequestData";
|
||||
import { FleaOfferType } from "@spt/models/enums/FleaOfferType";
|
||||
import { IRagfairConfig } from "@spt/models/spt/config/IRagfairConfig";
|
||||
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||
import { EventOutputHolder } from "@spt/routers/EventOutputHolder";
|
||||
@ -148,13 +149,52 @@ export declare class RagfairController {
|
||||
* @returns IItemEventRouterResponse
|
||||
*/
|
||||
addPlayerOffer(pmcData: IPmcData, offerRequest: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse;
|
||||
/**
|
||||
* Create a flea offer for a single item - uncludes an item with > 1 sized stack
|
||||
* e.g. 1 ammo stack of 30 cartridges
|
||||
* @param sessionID Session id
|
||||
* @param offerRequest Offer request from client
|
||||
* @param fullProfile Full profile of player
|
||||
* @param output Response to send to client
|
||||
* @returns IItemEventRouterResponse
|
||||
*/
|
||||
protected createSingleOffer(sessionID: string, offerRequest: IAddOfferRequestData, fullProfile: ISptProfile, output: IItemEventRouterResponse): IItemEventRouterResponse;
|
||||
/**
|
||||
* Create a flea offer for multiples of the same item, can be single items or items with multiple in the stack
|
||||
* e.g. 2 ammo stacks of 30 cartridges each
|
||||
* Each item can be purchsed individually
|
||||
* @param sessionID Session id
|
||||
* @param offerRequest Offer request from client
|
||||
* @param fullProfile Full profile of player
|
||||
* @param output Response to send to client
|
||||
* @returns IItemEventRouterResponse
|
||||
*/
|
||||
protected createMultiOffer(sessionID: string, offerRequest: IAddOfferRequestData, fullProfile: ISptProfile, output: IItemEventRouterResponse): IItemEventRouterResponse;
|
||||
/**
|
||||
* Create a flea offer for multiple items, can be single items or items with multiple in the stack
|
||||
* e.g. 2 ammo stacks of 30 cartridges each
|
||||
* The entire package must be purchased in one go
|
||||
* @param sessionID Session id
|
||||
* @param offerRequest Offer request from client
|
||||
* @param fullProfile Full profile of player
|
||||
* @param output Response to send to client
|
||||
* @returns IItemEventRouterResponse
|
||||
*/
|
||||
protected createPackOffer(sessionID: string, offerRequest: IAddOfferRequestData, fullProfile: ISptProfile, output: IItemEventRouterResponse): IItemEventRouterResponse;
|
||||
/**
|
||||
* Given a client request, determine what type of offer is being created
|
||||
* single/multi/pack
|
||||
* @param offerRequest Client request
|
||||
* @returns FleaOfferType
|
||||
*/
|
||||
protected getOfferType(offerRequest: IAddOfferRequestData): FleaOfferType;
|
||||
/**
|
||||
* Charge player a listing fee for using flea, pulls charge from data previously sent by client
|
||||
* @param sessionID Player id
|
||||
* @param rootItem Base item being listed (used when client tax cost not found and must be done on server)
|
||||
* @param pmcData Player profile
|
||||
* @param requirementsPriceInRub Rouble cost player chose for listing (used when client tax cost not found and must be done on server)
|
||||
* @param itemStackCount How many items were listed in player (used when client tax cost not found and must be done on server)
|
||||
* @param itemStackCount How many items were listed by player (used when client tax cost not found and must be done on server)
|
||||
* @param offerRequest Add offer request object from client
|
||||
* @param output IItemEventRouterResponse
|
||||
* @returns True if charging tax to player failed
|
||||
@ -180,7 +220,7 @@ export declare class RagfairController {
|
||||
* @returns Array of items from player inventory
|
||||
*/
|
||||
protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[]): {
|
||||
items: Item[] | undefined;
|
||||
items: Item[][] | undefined;
|
||||
errorMessage: string | undefined;
|
||||
};
|
||||
createPlayerOffer(sessionId: string, requirements: Requirement[], items: Item[], sellInOnePiece: boolean): IRagfairOffer;
|
||||
|
@ -33,7 +33,7 @@ export declare class RagfairHelper {
|
||||
getDisplayableAssorts(sessionID: string): Record<string, ITraderAssort>;
|
||||
protected getCategoryList(handbookId: string): string[];
|
||||
/**
|
||||
* Merges Root Items
|
||||
* Iterate over array of identical items and merge stack count
|
||||
* Ragfair allows abnormally large stacks.
|
||||
*/
|
||||
mergeStackable(items: Item[]): Item[];
|
||||
|
@ -120,6 +120,12 @@ export declare class RagfairOfferHelper {
|
||||
* @returns true = complete
|
||||
*/
|
||||
processOffersOnProfile(sessionID: string): boolean;
|
||||
/**
|
||||
* Count up all rootitem StackObjectsCount properties of an array of items
|
||||
* @param itemsInInventoryToList items to sum up
|
||||
* @returns Total count
|
||||
*/
|
||||
getTotalStackCountSize(itemsInInventoryToList: Item[][]): number;
|
||||
/**
|
||||
* Add amount to players ragfair rating
|
||||
* @param sessionId Profile to update
|
||||
|
@ -25,7 +25,8 @@ export declare class RagfairSellHelper {
|
||||
* Get array of item count and sell time (empty array = no sell)
|
||||
* @param sellChancePercent chance item will sell
|
||||
* @param itemSellCount count of items to sell
|
||||
* @param sellInOneGo All items listed get sold at once
|
||||
* @returns Array of purchases of item(s) listed
|
||||
*/
|
||||
rollForSale(sellChancePercent: number, itemSellCount: number): SellResult[];
|
||||
rollForSale(sellChancePercent: number, itemSellCount: number, sellInOneGo?: boolean): SellResult[];
|
||||
}
|
||||
|
6
TypeScript/13.1AddTraderWithAssortJSON/types/models/enums/FleaOfferType.d.ts
vendored
Normal file
6
TypeScript/13.1AddTraderWithAssortJSON/types/models/enums/FleaOfferType.d.ts
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
export declare enum FleaOfferType {
|
||||
SINGLE = 0,
|
||||
MULTI = 1,
|
||||
PACK = 2,
|
||||
UNKNOWN = 3
|
||||
}
|
@ -1,3 +1,4 @@
|
||||
import { ItemHelper } from "@spt/helpers/ItemHelper";
|
||||
import { ProfileHelper } from "@spt/helpers/ProfileHelper";
|
||||
import { RagfairServerHelper } from "@spt/helpers/RagfairServerHelper";
|
||||
import { Item } from "@spt/models/eft/common/tables/IItem";
|
||||
@ -9,6 +10,7 @@ import { ConfigServer } from "@spt/servers/ConfigServer";
|
||||
import { SaveServer } from "@spt/servers/SaveServer";
|
||||
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||
import { LocalisationService } from "@spt/services/LocalisationService";
|
||||
import { ICloner } from "@spt/utils/cloners/ICloner";
|
||||
import { HttpResponseUtil } from "@spt/utils/HttpResponseUtil";
|
||||
import { RagfairOfferHolder } from "@spt/utils/RagfairOfferHolder";
|
||||
import { TimeUtil } from "@spt/utils/TimeUtil";
|
||||
@ -18,17 +20,19 @@ export declare class RagfairOfferService {
|
||||
protected databaseService: DatabaseService;
|
||||
protected saveServer: SaveServer;
|
||||
protected ragfairServerHelper: RagfairServerHelper;
|
||||
protected itemHelper: ItemHelper;
|
||||
protected profileHelper: ProfileHelper;
|
||||
protected eventOutputHolder: EventOutputHolder;
|
||||
protected httpResponse: HttpResponseUtil;
|
||||
protected localisationService: LocalisationService;
|
||||
protected configServer: ConfigServer;
|
||||
protected cloner: ICloner;
|
||||
protected playerOffersLoaded: boolean;
|
||||
/** Offer id + offer object */
|
||||
protected expiredOffers: Record<string, IRagfairOffer>;
|
||||
protected ragfairConfig: IRagfairConfig;
|
||||
protected ragfairOfferHandler: RagfairOfferHolder;
|
||||
constructor(logger: ILogger, timeUtil: TimeUtil, databaseService: DatabaseService, saveServer: SaveServer, ragfairServerHelper: RagfairServerHelper, profileHelper: ProfileHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, localisationService: LocalisationService, configServer: ConfigServer);
|
||||
constructor(logger: ILogger, timeUtil: TimeUtil, databaseService: DatabaseService, saveServer: SaveServer, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, localisationService: LocalisationService, configServer: ConfigServer, cloner: ICloner);
|
||||
/**
|
||||
* Get all offers
|
||||
* @returns IRagfairOffer array
|
||||
@ -84,4 +88,12 @@ export declare class RagfairOfferService {
|
||||
*/
|
||||
protected processStaleOffer(staleOffer: IRagfairOffer): void;
|
||||
protected returnPlayerOffer(playerOffer: IRagfairOffer): void;
|
||||
/**
|
||||
* Flea offer items are stacked up often beyond the StackMaxSize limit
|
||||
* Un stack the items into an array of root items and their children
|
||||
* Will create new items equal to the
|
||||
* @param items Offer items to unstack
|
||||
* @returns Unstacked array of items
|
||||
*/
|
||||
protected unstackOfferItems(items: Item[]): Item[];
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ export declare class BotController {
|
||||
* @param sessionId Session id
|
||||
* @returns
|
||||
*/
|
||||
protected generateBotsFirstTime(request: IGenerateBotsRequestData, pmcProfile: IPmcData, sessionId: string): Promise<IBotBase[]>;
|
||||
generateBotsFirstTime(request: IGenerateBotsRequestData, pmcProfile: IPmcData, sessionId: string): Promise<IBotBase[]>;
|
||||
/**
|
||||
* Create a BotGenerationDetails for the bot generator to use
|
||||
* @param condition Client data defining bot type and difficulty
|
||||
@ -117,7 +117,7 @@ export declare class BotController {
|
||||
* @param request Bot generation request object
|
||||
* @returns Single IBotBase object
|
||||
*/
|
||||
protected returnSingleBotFromCache(sessionId: string, request: IGenerateBotsRequestData): Promise<IBotBase[]>;
|
||||
returnSingleBotFromCache(sessionId: string, request: IGenerateBotsRequestData): Promise<IBotBase[]>;
|
||||
protected updateBotGenerationDetailsToRandomBoss(botGenerationDetails: BotGenerationDetails, possibleBossTypeWeights: Record<string, number>): void;
|
||||
/**
|
||||
* Get the difficulty passed in, if its not "asonline", get selected difficulty from config
|
||||
|
@ -24,6 +24,7 @@ import { IRagfairOffer } from "@spt/models/eft/ragfair/IRagfairOffer";
|
||||
import { IRemoveOfferRequestData } from "@spt/models/eft/ragfair/IRemoveOfferRequestData";
|
||||
import { ISearchRequestData } from "@spt/models/eft/ragfair/ISearchRequestData";
|
||||
import { IProcessBuyTradeRequestData } from "@spt/models/eft/trade/IProcessBuyTradeRequestData";
|
||||
import { FleaOfferType } from "@spt/models/enums/FleaOfferType";
|
||||
import { IRagfairConfig } from "@spt/models/spt/config/IRagfairConfig";
|
||||
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||
import { EventOutputHolder } from "@spt/routers/EventOutputHolder";
|
||||
@ -148,13 +149,52 @@ export declare class RagfairController {
|
||||
* @returns IItemEventRouterResponse
|
||||
*/
|
||||
addPlayerOffer(pmcData: IPmcData, offerRequest: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse;
|
||||
/**
|
||||
* Create a flea offer for a single item - uncludes an item with > 1 sized stack
|
||||
* e.g. 1 ammo stack of 30 cartridges
|
||||
* @param sessionID Session id
|
||||
* @param offerRequest Offer request from client
|
||||
* @param fullProfile Full profile of player
|
||||
* @param output Response to send to client
|
||||
* @returns IItemEventRouterResponse
|
||||
*/
|
||||
protected createSingleOffer(sessionID: string, offerRequest: IAddOfferRequestData, fullProfile: ISptProfile, output: IItemEventRouterResponse): IItemEventRouterResponse;
|
||||
/**
|
||||
* Create a flea offer for multiples of the same item, can be single items or items with multiple in the stack
|
||||
* e.g. 2 ammo stacks of 30 cartridges each
|
||||
* Each item can be purchsed individually
|
||||
* @param sessionID Session id
|
||||
* @param offerRequest Offer request from client
|
||||
* @param fullProfile Full profile of player
|
||||
* @param output Response to send to client
|
||||
* @returns IItemEventRouterResponse
|
||||
*/
|
||||
protected createMultiOffer(sessionID: string, offerRequest: IAddOfferRequestData, fullProfile: ISptProfile, output: IItemEventRouterResponse): IItemEventRouterResponse;
|
||||
/**
|
||||
* Create a flea offer for multiple items, can be single items or items with multiple in the stack
|
||||
* e.g. 2 ammo stacks of 30 cartridges each
|
||||
* The entire package must be purchased in one go
|
||||
* @param sessionID Session id
|
||||
* @param offerRequest Offer request from client
|
||||
* @param fullProfile Full profile of player
|
||||
* @param output Response to send to client
|
||||
* @returns IItemEventRouterResponse
|
||||
*/
|
||||
protected createPackOffer(sessionID: string, offerRequest: IAddOfferRequestData, fullProfile: ISptProfile, output: IItemEventRouterResponse): IItemEventRouterResponse;
|
||||
/**
|
||||
* Given a client request, determine what type of offer is being created
|
||||
* single/multi/pack
|
||||
* @param offerRequest Client request
|
||||
* @returns FleaOfferType
|
||||
*/
|
||||
protected getOfferType(offerRequest: IAddOfferRequestData): FleaOfferType;
|
||||
/**
|
||||
* Charge player a listing fee for using flea, pulls charge from data previously sent by client
|
||||
* @param sessionID Player id
|
||||
* @param rootItem Base item being listed (used when client tax cost not found and must be done on server)
|
||||
* @param pmcData Player profile
|
||||
* @param requirementsPriceInRub Rouble cost player chose for listing (used when client tax cost not found and must be done on server)
|
||||
* @param itemStackCount How many items were listed in player (used when client tax cost not found and must be done on server)
|
||||
* @param itemStackCount How many items were listed by player (used when client tax cost not found and must be done on server)
|
||||
* @param offerRequest Add offer request object from client
|
||||
* @param output IItemEventRouterResponse
|
||||
* @returns True if charging tax to player failed
|
||||
@ -180,7 +220,7 @@ export declare class RagfairController {
|
||||
* @returns Array of items from player inventory
|
||||
*/
|
||||
protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[]): {
|
||||
items: Item[] | undefined;
|
||||
items: Item[][] | undefined;
|
||||
errorMessage: string | undefined;
|
||||
};
|
||||
createPlayerOffer(sessionId: string, requirements: Requirement[], items: Item[], sellInOnePiece: boolean): IRagfairOffer;
|
||||
|
@ -33,7 +33,7 @@ export declare class RagfairHelper {
|
||||
getDisplayableAssorts(sessionID: string): Record<string, ITraderAssort>;
|
||||
protected getCategoryList(handbookId: string): string[];
|
||||
/**
|
||||
* Merges Root Items
|
||||
* Iterate over array of identical items and merge stack count
|
||||
* Ragfair allows abnormally large stacks.
|
||||
*/
|
||||
mergeStackable(items: Item[]): Item[];
|
||||
|
@ -120,6 +120,12 @@ export declare class RagfairOfferHelper {
|
||||
* @returns true = complete
|
||||
*/
|
||||
processOffersOnProfile(sessionID: string): boolean;
|
||||
/**
|
||||
* Count up all rootitem StackObjectsCount properties of an array of items
|
||||
* @param itemsInInventoryToList items to sum up
|
||||
* @returns Total count
|
||||
*/
|
||||
getTotalStackCountSize(itemsInInventoryToList: Item[][]): number;
|
||||
/**
|
||||
* Add amount to players ragfair rating
|
||||
* @param sessionId Profile to update
|
||||
|
@ -25,7 +25,8 @@ export declare class RagfairSellHelper {
|
||||
* Get array of item count and sell time (empty array = no sell)
|
||||
* @param sellChancePercent chance item will sell
|
||||
* @param itemSellCount count of items to sell
|
||||
* @param sellInOneGo All items listed get sold at once
|
||||
* @returns Array of purchases of item(s) listed
|
||||
*/
|
||||
rollForSale(sellChancePercent: number, itemSellCount: number): SellResult[];
|
||||
rollForSale(sellChancePercent: number, itemSellCount: number, sellInOneGo?: boolean): SellResult[];
|
||||
}
|
||||
|
6
TypeScript/13AddTrader/types/models/enums/FleaOfferType.d.ts
vendored
Normal file
6
TypeScript/13AddTrader/types/models/enums/FleaOfferType.d.ts
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
export declare enum FleaOfferType {
|
||||
SINGLE = 0,
|
||||
MULTI = 1,
|
||||
PACK = 2,
|
||||
UNKNOWN = 3
|
||||
}
|
@ -1,3 +1,4 @@
|
||||
import { ItemHelper } from "@spt/helpers/ItemHelper";
|
||||
import { ProfileHelper } from "@spt/helpers/ProfileHelper";
|
||||
import { RagfairServerHelper } from "@spt/helpers/RagfairServerHelper";
|
||||
import { Item } from "@spt/models/eft/common/tables/IItem";
|
||||
@ -9,6 +10,7 @@ import { ConfigServer } from "@spt/servers/ConfigServer";
|
||||
import { SaveServer } from "@spt/servers/SaveServer";
|
||||
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||
import { LocalisationService } from "@spt/services/LocalisationService";
|
||||
import { ICloner } from "@spt/utils/cloners/ICloner";
|
||||
import { HttpResponseUtil } from "@spt/utils/HttpResponseUtil";
|
||||
import { RagfairOfferHolder } from "@spt/utils/RagfairOfferHolder";
|
||||
import { TimeUtil } from "@spt/utils/TimeUtil";
|
||||
@ -18,17 +20,19 @@ export declare class RagfairOfferService {
|
||||
protected databaseService: DatabaseService;
|
||||
protected saveServer: SaveServer;
|
||||
protected ragfairServerHelper: RagfairServerHelper;
|
||||
protected itemHelper: ItemHelper;
|
||||
protected profileHelper: ProfileHelper;
|
||||
protected eventOutputHolder: EventOutputHolder;
|
||||
protected httpResponse: HttpResponseUtil;
|
||||
protected localisationService: LocalisationService;
|
||||
protected configServer: ConfigServer;
|
||||
protected cloner: ICloner;
|
||||
protected playerOffersLoaded: boolean;
|
||||
/** Offer id + offer object */
|
||||
protected expiredOffers: Record<string, IRagfairOffer>;
|
||||
protected ragfairConfig: IRagfairConfig;
|
||||
protected ragfairOfferHandler: RagfairOfferHolder;
|
||||
constructor(logger: ILogger, timeUtil: TimeUtil, databaseService: DatabaseService, saveServer: SaveServer, ragfairServerHelper: RagfairServerHelper, profileHelper: ProfileHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, localisationService: LocalisationService, configServer: ConfigServer);
|
||||
constructor(logger: ILogger, timeUtil: TimeUtil, databaseService: DatabaseService, saveServer: SaveServer, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, localisationService: LocalisationService, configServer: ConfigServer, cloner: ICloner);
|
||||
/**
|
||||
* Get all offers
|
||||
* @returns IRagfairOffer array
|
||||
@ -84,4 +88,12 @@ export declare class RagfairOfferService {
|
||||
*/
|
||||
protected processStaleOffer(staleOffer: IRagfairOffer): void;
|
||||
protected returnPlayerOffer(playerOffer: IRagfairOffer): void;
|
||||
/**
|
||||
* Flea offer items are stacked up often beyond the StackMaxSize limit
|
||||
* Un stack the items into an array of root items and their children
|
||||
* Will create new items equal to the
|
||||
* @param items Offer items to unstack
|
||||
* @returns Unstacked array of items
|
||||
*/
|
||||
protected unstackOfferItems(items: Item[]): Item[];
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ export declare class BotController {
|
||||
* @param sessionId Session id
|
||||
* @returns
|
||||
*/
|
||||
protected generateBotsFirstTime(request: IGenerateBotsRequestData, pmcProfile: IPmcData, sessionId: string): Promise<IBotBase[]>;
|
||||
generateBotsFirstTime(request: IGenerateBotsRequestData, pmcProfile: IPmcData, sessionId: string): Promise<IBotBase[]>;
|
||||
/**
|
||||
* Create a BotGenerationDetails for the bot generator to use
|
||||
* @param condition Client data defining bot type and difficulty
|
||||
@ -117,7 +117,7 @@ export declare class BotController {
|
||||
* @param request Bot generation request object
|
||||
* @returns Single IBotBase object
|
||||
*/
|
||||
protected returnSingleBotFromCache(sessionId: string, request: IGenerateBotsRequestData): Promise<IBotBase[]>;
|
||||
returnSingleBotFromCache(sessionId: string, request: IGenerateBotsRequestData): Promise<IBotBase[]>;
|
||||
protected updateBotGenerationDetailsToRandomBoss(botGenerationDetails: BotGenerationDetails, possibleBossTypeWeights: Record<string, number>): void;
|
||||
/**
|
||||
* Get the difficulty passed in, if its not "asonline", get selected difficulty from config
|
||||
|
@ -24,6 +24,7 @@ import { IRagfairOffer } from "@spt/models/eft/ragfair/IRagfairOffer";
|
||||
import { IRemoveOfferRequestData } from "@spt/models/eft/ragfair/IRemoveOfferRequestData";
|
||||
import { ISearchRequestData } from "@spt/models/eft/ragfair/ISearchRequestData";
|
||||
import { IProcessBuyTradeRequestData } from "@spt/models/eft/trade/IProcessBuyTradeRequestData";
|
||||
import { FleaOfferType } from "@spt/models/enums/FleaOfferType";
|
||||
import { IRagfairConfig } from "@spt/models/spt/config/IRagfairConfig";
|
||||
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||
import { EventOutputHolder } from "@spt/routers/EventOutputHolder";
|
||||
@ -148,13 +149,52 @@ export declare class RagfairController {
|
||||
* @returns IItemEventRouterResponse
|
||||
*/
|
||||
addPlayerOffer(pmcData: IPmcData, offerRequest: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse;
|
||||
/**
|
||||
* Create a flea offer for a single item - uncludes an item with > 1 sized stack
|
||||
* e.g. 1 ammo stack of 30 cartridges
|
||||
* @param sessionID Session id
|
||||
* @param offerRequest Offer request from client
|
||||
* @param fullProfile Full profile of player
|
||||
* @param output Response to send to client
|
||||
* @returns IItemEventRouterResponse
|
||||
*/
|
||||
protected createSingleOffer(sessionID: string, offerRequest: IAddOfferRequestData, fullProfile: ISptProfile, output: IItemEventRouterResponse): IItemEventRouterResponse;
|
||||
/**
|
||||
* Create a flea offer for multiples of the same item, can be single items or items with multiple in the stack
|
||||
* e.g. 2 ammo stacks of 30 cartridges each
|
||||
* Each item can be purchsed individually
|
||||
* @param sessionID Session id
|
||||
* @param offerRequest Offer request from client
|
||||
* @param fullProfile Full profile of player
|
||||
* @param output Response to send to client
|
||||
* @returns IItemEventRouterResponse
|
||||
*/
|
||||
protected createMultiOffer(sessionID: string, offerRequest: IAddOfferRequestData, fullProfile: ISptProfile, output: IItemEventRouterResponse): IItemEventRouterResponse;
|
||||
/**
|
||||
* Create a flea offer for multiple items, can be single items or items with multiple in the stack
|
||||
* e.g. 2 ammo stacks of 30 cartridges each
|
||||
* The entire package must be purchased in one go
|
||||
* @param sessionID Session id
|
||||
* @param offerRequest Offer request from client
|
||||
* @param fullProfile Full profile of player
|
||||
* @param output Response to send to client
|
||||
* @returns IItemEventRouterResponse
|
||||
*/
|
||||
protected createPackOffer(sessionID: string, offerRequest: IAddOfferRequestData, fullProfile: ISptProfile, output: IItemEventRouterResponse): IItemEventRouterResponse;
|
||||
/**
|
||||
* Given a client request, determine what type of offer is being created
|
||||
* single/multi/pack
|
||||
* @param offerRequest Client request
|
||||
* @returns FleaOfferType
|
||||
*/
|
||||
protected getOfferType(offerRequest: IAddOfferRequestData): FleaOfferType;
|
||||
/**
|
||||
* Charge player a listing fee for using flea, pulls charge from data previously sent by client
|
||||
* @param sessionID Player id
|
||||
* @param rootItem Base item being listed (used when client tax cost not found and must be done on server)
|
||||
* @param pmcData Player profile
|
||||
* @param requirementsPriceInRub Rouble cost player chose for listing (used when client tax cost not found and must be done on server)
|
||||
* @param itemStackCount How many items were listed in player (used when client tax cost not found and must be done on server)
|
||||
* @param itemStackCount How many items were listed by player (used when client tax cost not found and must be done on server)
|
||||
* @param offerRequest Add offer request object from client
|
||||
* @param output IItemEventRouterResponse
|
||||
* @returns True if charging tax to player failed
|
||||
@ -180,7 +220,7 @@ export declare class RagfairController {
|
||||
* @returns Array of items from player inventory
|
||||
*/
|
||||
protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[]): {
|
||||
items: Item[] | undefined;
|
||||
items: Item[][] | undefined;
|
||||
errorMessage: string | undefined;
|
||||
};
|
||||
createPlayerOffer(sessionId: string, requirements: Requirement[], items: Item[], sellInOnePiece: boolean): IRagfairOffer;
|
||||
|
@ -33,7 +33,7 @@ export declare class RagfairHelper {
|
||||
getDisplayableAssorts(sessionID: string): Record<string, ITraderAssort>;
|
||||
protected getCategoryList(handbookId: string): string[];
|
||||
/**
|
||||
* Merges Root Items
|
||||
* Iterate over array of identical items and merge stack count
|
||||
* Ragfair allows abnormally large stacks.
|
||||
*/
|
||||
mergeStackable(items: Item[]): Item[];
|
||||
|
@ -120,6 +120,12 @@ export declare class RagfairOfferHelper {
|
||||
* @returns true = complete
|
||||
*/
|
||||
processOffersOnProfile(sessionID: string): boolean;
|
||||
/**
|
||||
* Count up all rootitem StackObjectsCount properties of an array of items
|
||||
* @param itemsInInventoryToList items to sum up
|
||||
* @returns Total count
|
||||
*/
|
||||
getTotalStackCountSize(itemsInInventoryToList: Item[][]): number;
|
||||
/**
|
||||
* Add amount to players ragfair rating
|
||||
* @param sessionId Profile to update
|
||||
|
@ -25,7 +25,8 @@ export declare class RagfairSellHelper {
|
||||
* Get array of item count and sell time (empty array = no sell)
|
||||
* @param sellChancePercent chance item will sell
|
||||
* @param itemSellCount count of items to sell
|
||||
* @param sellInOneGo All items listed get sold at once
|
||||
* @returns Array of purchases of item(s) listed
|
||||
*/
|
||||
rollForSale(sellChancePercent: number, itemSellCount: number): SellResult[];
|
||||
rollForSale(sellChancePercent: number, itemSellCount: number, sellInOneGo?: boolean): SellResult[];
|
||||
}
|
||||
|
6
TypeScript/14AfterDBLoadHook/types/models/enums/FleaOfferType.d.ts
vendored
Normal file
6
TypeScript/14AfterDBLoadHook/types/models/enums/FleaOfferType.d.ts
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
export declare enum FleaOfferType {
|
||||
SINGLE = 0,
|
||||
MULTI = 1,
|
||||
PACK = 2,
|
||||
UNKNOWN = 3
|
||||
}
|
@ -1,3 +1,4 @@
|
||||
import { ItemHelper } from "@spt/helpers/ItemHelper";
|
||||
import { ProfileHelper } from "@spt/helpers/ProfileHelper";
|
||||
import { RagfairServerHelper } from "@spt/helpers/RagfairServerHelper";
|
||||
import { Item } from "@spt/models/eft/common/tables/IItem";
|
||||
@ -9,6 +10,7 @@ import { ConfigServer } from "@spt/servers/ConfigServer";
|
||||
import { SaveServer } from "@spt/servers/SaveServer";
|
||||
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||
import { LocalisationService } from "@spt/services/LocalisationService";
|
||||
import { ICloner } from "@spt/utils/cloners/ICloner";
|
||||
import { HttpResponseUtil } from "@spt/utils/HttpResponseUtil";
|
||||
import { RagfairOfferHolder } from "@spt/utils/RagfairOfferHolder";
|
||||
import { TimeUtil } from "@spt/utils/TimeUtil";
|
||||
@ -18,17 +20,19 @@ export declare class RagfairOfferService {
|
||||
protected databaseService: DatabaseService;
|
||||
protected saveServer: SaveServer;
|
||||
protected ragfairServerHelper: RagfairServerHelper;
|
||||
protected itemHelper: ItemHelper;
|
||||
protected profileHelper: ProfileHelper;
|
||||
protected eventOutputHolder: EventOutputHolder;
|
||||
protected httpResponse: HttpResponseUtil;
|
||||
protected localisationService: LocalisationService;
|
||||
protected configServer: ConfigServer;
|
||||
protected cloner: ICloner;
|
||||
protected playerOffersLoaded: boolean;
|
||||
/** Offer id + offer object */
|
||||
protected expiredOffers: Record<string, IRagfairOffer>;
|
||||
protected ragfairConfig: IRagfairConfig;
|
||||
protected ragfairOfferHandler: RagfairOfferHolder;
|
||||
constructor(logger: ILogger, timeUtil: TimeUtil, databaseService: DatabaseService, saveServer: SaveServer, ragfairServerHelper: RagfairServerHelper, profileHelper: ProfileHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, localisationService: LocalisationService, configServer: ConfigServer);
|
||||
constructor(logger: ILogger, timeUtil: TimeUtil, databaseService: DatabaseService, saveServer: SaveServer, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, localisationService: LocalisationService, configServer: ConfigServer, cloner: ICloner);
|
||||
/**
|
||||
* Get all offers
|
||||
* @returns IRagfairOffer array
|
||||
@ -84,4 +88,12 @@ export declare class RagfairOfferService {
|
||||
*/
|
||||
protected processStaleOffer(staleOffer: IRagfairOffer): void;
|
||||
protected returnPlayerOffer(playerOffer: IRagfairOffer): void;
|
||||
/**
|
||||
* Flea offer items are stacked up often beyond the StackMaxSize limit
|
||||
* Un stack the items into an array of root items and their children
|
||||
* Will create new items equal to the
|
||||
* @param items Offer items to unstack
|
||||
* @returns Unstacked array of items
|
||||
*/
|
||||
protected unstackOfferItems(items: Item[]): Item[];
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ export declare class BotController {
|
||||
* @param sessionId Session id
|
||||
* @returns
|
||||
*/
|
||||
protected generateBotsFirstTime(request: IGenerateBotsRequestData, pmcProfile: IPmcData, sessionId: string): Promise<IBotBase[]>;
|
||||
generateBotsFirstTime(request: IGenerateBotsRequestData, pmcProfile: IPmcData, sessionId: string): Promise<IBotBase[]>;
|
||||
/**
|
||||
* Create a BotGenerationDetails for the bot generator to use
|
||||
* @param condition Client data defining bot type and difficulty
|
||||
@ -117,7 +117,7 @@ export declare class BotController {
|
||||
* @param request Bot generation request object
|
||||
* @returns Single IBotBase object
|
||||
*/
|
||||
protected returnSingleBotFromCache(sessionId: string, request: IGenerateBotsRequestData): Promise<IBotBase[]>;
|
||||
returnSingleBotFromCache(sessionId: string, request: IGenerateBotsRequestData): Promise<IBotBase[]>;
|
||||
protected updateBotGenerationDetailsToRandomBoss(botGenerationDetails: BotGenerationDetails, possibleBossTypeWeights: Record<string, number>): void;
|
||||
/**
|
||||
* Get the difficulty passed in, if its not "asonline", get selected difficulty from config
|
||||
|
@ -24,6 +24,7 @@ import { IRagfairOffer } from "@spt/models/eft/ragfair/IRagfairOffer";
|
||||
import { IRemoveOfferRequestData } from "@spt/models/eft/ragfair/IRemoveOfferRequestData";
|
||||
import { ISearchRequestData } from "@spt/models/eft/ragfair/ISearchRequestData";
|
||||
import { IProcessBuyTradeRequestData } from "@spt/models/eft/trade/IProcessBuyTradeRequestData";
|
||||
import { FleaOfferType } from "@spt/models/enums/FleaOfferType";
|
||||
import { IRagfairConfig } from "@spt/models/spt/config/IRagfairConfig";
|
||||
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||
import { EventOutputHolder } from "@spt/routers/EventOutputHolder";
|
||||
@ -148,13 +149,52 @@ export declare class RagfairController {
|
||||
* @returns IItemEventRouterResponse
|
||||
*/
|
||||
addPlayerOffer(pmcData: IPmcData, offerRequest: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse;
|
||||
/**
|
||||
* Create a flea offer for a single item - uncludes an item with > 1 sized stack
|
||||
* e.g. 1 ammo stack of 30 cartridges
|
||||
* @param sessionID Session id
|
||||
* @param offerRequest Offer request from client
|
||||
* @param fullProfile Full profile of player
|
||||
* @param output Response to send to client
|
||||
* @returns IItemEventRouterResponse
|
||||
*/
|
||||
protected createSingleOffer(sessionID: string, offerRequest: IAddOfferRequestData, fullProfile: ISptProfile, output: IItemEventRouterResponse): IItemEventRouterResponse;
|
||||
/**
|
||||
* Create a flea offer for multiples of the same item, can be single items or items with multiple in the stack
|
||||
* e.g. 2 ammo stacks of 30 cartridges each
|
||||
* Each item can be purchsed individually
|
||||
* @param sessionID Session id
|
||||
* @param offerRequest Offer request from client
|
||||
* @param fullProfile Full profile of player
|
||||
* @param output Response to send to client
|
||||
* @returns IItemEventRouterResponse
|
||||
*/
|
||||
protected createMultiOffer(sessionID: string, offerRequest: IAddOfferRequestData, fullProfile: ISptProfile, output: IItemEventRouterResponse): IItemEventRouterResponse;
|
||||
/**
|
||||
* Create a flea offer for multiple items, can be single items or items with multiple in the stack
|
||||
* e.g. 2 ammo stacks of 30 cartridges each
|
||||
* The entire package must be purchased in one go
|
||||
* @param sessionID Session id
|
||||
* @param offerRequest Offer request from client
|
||||
* @param fullProfile Full profile of player
|
||||
* @param output Response to send to client
|
||||
* @returns IItemEventRouterResponse
|
||||
*/
|
||||
protected createPackOffer(sessionID: string, offerRequest: IAddOfferRequestData, fullProfile: ISptProfile, output: IItemEventRouterResponse): IItemEventRouterResponse;
|
||||
/**
|
||||
* Given a client request, determine what type of offer is being created
|
||||
* single/multi/pack
|
||||
* @param offerRequest Client request
|
||||
* @returns FleaOfferType
|
||||
*/
|
||||
protected getOfferType(offerRequest: IAddOfferRequestData): FleaOfferType;
|
||||
/**
|
||||
* Charge player a listing fee for using flea, pulls charge from data previously sent by client
|
||||
* @param sessionID Player id
|
||||
* @param rootItem Base item being listed (used when client tax cost not found and must be done on server)
|
||||
* @param pmcData Player profile
|
||||
* @param requirementsPriceInRub Rouble cost player chose for listing (used when client tax cost not found and must be done on server)
|
||||
* @param itemStackCount How many items were listed in player (used when client tax cost not found and must be done on server)
|
||||
* @param itemStackCount How many items were listed by player (used when client tax cost not found and must be done on server)
|
||||
* @param offerRequest Add offer request object from client
|
||||
* @param output IItemEventRouterResponse
|
||||
* @returns True if charging tax to player failed
|
||||
@ -180,7 +220,7 @@ export declare class RagfairController {
|
||||
* @returns Array of items from player inventory
|
||||
*/
|
||||
protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[]): {
|
||||
items: Item[] | undefined;
|
||||
items: Item[][] | undefined;
|
||||
errorMessage: string | undefined;
|
||||
};
|
||||
createPlayerOffer(sessionId: string, requirements: Requirement[], items: Item[], sellInOnePiece: boolean): IRagfairOffer;
|
||||
|
@ -33,7 +33,7 @@ export declare class RagfairHelper {
|
||||
getDisplayableAssorts(sessionID: string): Record<string, ITraderAssort>;
|
||||
protected getCategoryList(handbookId: string): string[];
|
||||
/**
|
||||
* Merges Root Items
|
||||
* Iterate over array of identical items and merge stack count
|
||||
* Ragfair allows abnormally large stacks.
|
||||
*/
|
||||
mergeStackable(items: Item[]): Item[];
|
||||
|
@ -120,6 +120,12 @@ export declare class RagfairOfferHelper {
|
||||
* @returns true = complete
|
||||
*/
|
||||
processOffersOnProfile(sessionID: string): boolean;
|
||||
/**
|
||||
* Count up all rootitem StackObjectsCount properties of an array of items
|
||||
* @param itemsInInventoryToList items to sum up
|
||||
* @returns Total count
|
||||
*/
|
||||
getTotalStackCountSize(itemsInInventoryToList: Item[][]): number;
|
||||
/**
|
||||
* Add amount to players ragfair rating
|
||||
* @param sessionId Profile to update
|
||||
|
@ -25,7 +25,8 @@ export declare class RagfairSellHelper {
|
||||
* Get array of item count and sell time (empty array = no sell)
|
||||
* @param sellChancePercent chance item will sell
|
||||
* @param itemSellCount count of items to sell
|
||||
* @param sellInOneGo All items listed get sold at once
|
||||
* @returns Array of purchases of item(s) listed
|
||||
*/
|
||||
rollForSale(sellChancePercent: number, itemSellCount: number): SellResult[];
|
||||
rollForSale(sellChancePercent: number, itemSellCount: number, sellInOneGo?: boolean): SellResult[];
|
||||
}
|
||||
|
6
TypeScript/15HttpListenerExample/types/models/enums/FleaOfferType.d.ts
vendored
Normal file
6
TypeScript/15HttpListenerExample/types/models/enums/FleaOfferType.d.ts
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
export declare enum FleaOfferType {
|
||||
SINGLE = 0,
|
||||
MULTI = 1,
|
||||
PACK = 2,
|
||||
UNKNOWN = 3
|
||||
}
|
@ -1,3 +1,4 @@
|
||||
import { ItemHelper } from "@spt/helpers/ItemHelper";
|
||||
import { ProfileHelper } from "@spt/helpers/ProfileHelper";
|
||||
import { RagfairServerHelper } from "@spt/helpers/RagfairServerHelper";
|
||||
import { Item } from "@spt/models/eft/common/tables/IItem";
|
||||
@ -9,6 +10,7 @@ import { ConfigServer } from "@spt/servers/ConfigServer";
|
||||
import { SaveServer } from "@spt/servers/SaveServer";
|
||||
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||
import { LocalisationService } from "@spt/services/LocalisationService";
|
||||
import { ICloner } from "@spt/utils/cloners/ICloner";
|
||||
import { HttpResponseUtil } from "@spt/utils/HttpResponseUtil";
|
||||
import { RagfairOfferHolder } from "@spt/utils/RagfairOfferHolder";
|
||||
import { TimeUtil } from "@spt/utils/TimeUtil";
|
||||
@ -18,17 +20,19 @@ export declare class RagfairOfferService {
|
||||
protected databaseService: DatabaseService;
|
||||
protected saveServer: SaveServer;
|
||||
protected ragfairServerHelper: RagfairServerHelper;
|
||||
protected itemHelper: ItemHelper;
|
||||
protected profileHelper: ProfileHelper;
|
||||
protected eventOutputHolder: EventOutputHolder;
|
||||
protected httpResponse: HttpResponseUtil;
|
||||
protected localisationService: LocalisationService;
|
||||
protected configServer: ConfigServer;
|
||||
protected cloner: ICloner;
|
||||
protected playerOffersLoaded: boolean;
|
||||
/** Offer id + offer object */
|
||||
protected expiredOffers: Record<string, IRagfairOffer>;
|
||||
protected ragfairConfig: IRagfairConfig;
|
||||
protected ragfairOfferHandler: RagfairOfferHolder;
|
||||
constructor(logger: ILogger, timeUtil: TimeUtil, databaseService: DatabaseService, saveServer: SaveServer, ragfairServerHelper: RagfairServerHelper, profileHelper: ProfileHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, localisationService: LocalisationService, configServer: ConfigServer);
|
||||
constructor(logger: ILogger, timeUtil: TimeUtil, databaseService: DatabaseService, saveServer: SaveServer, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, localisationService: LocalisationService, configServer: ConfigServer, cloner: ICloner);
|
||||
/**
|
||||
* Get all offers
|
||||
* @returns IRagfairOffer array
|
||||
@ -84,4 +88,12 @@ export declare class RagfairOfferService {
|
||||
*/
|
||||
protected processStaleOffer(staleOffer: IRagfairOffer): void;
|
||||
protected returnPlayerOffer(playerOffer: IRagfairOffer): void;
|
||||
/**
|
||||
* Flea offer items are stacked up often beyond the StackMaxSize limit
|
||||
* Un stack the items into an array of root items and their children
|
||||
* Will create new items equal to the
|
||||
* @param items Offer items to unstack
|
||||
* @returns Unstacked array of items
|
||||
*/
|
||||
protected unstackOfferItems(items: Item[]): Item[];
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ export declare class BotController {
|
||||
* @param sessionId Session id
|
||||
* @returns
|
||||
*/
|
||||
protected generateBotsFirstTime(request: IGenerateBotsRequestData, pmcProfile: IPmcData, sessionId: string): Promise<IBotBase[]>;
|
||||
generateBotsFirstTime(request: IGenerateBotsRequestData, pmcProfile: IPmcData, sessionId: string): Promise<IBotBase[]>;
|
||||
/**
|
||||
* Create a BotGenerationDetails for the bot generator to use
|
||||
* @param condition Client data defining bot type and difficulty
|
||||
@ -117,7 +117,7 @@ export declare class BotController {
|
||||
* @param request Bot generation request object
|
||||
* @returns Single IBotBase object
|
||||
*/
|
||||
protected returnSingleBotFromCache(sessionId: string, request: IGenerateBotsRequestData): Promise<IBotBase[]>;
|
||||
returnSingleBotFromCache(sessionId: string, request: IGenerateBotsRequestData): Promise<IBotBase[]>;
|
||||
protected updateBotGenerationDetailsToRandomBoss(botGenerationDetails: BotGenerationDetails, possibleBossTypeWeights: Record<string, number>): void;
|
||||
/**
|
||||
* Get the difficulty passed in, if its not "asonline", get selected difficulty from config
|
||||
|
@ -24,6 +24,7 @@ import { IRagfairOffer } from "@spt/models/eft/ragfair/IRagfairOffer";
|
||||
import { IRemoveOfferRequestData } from "@spt/models/eft/ragfair/IRemoveOfferRequestData";
|
||||
import { ISearchRequestData } from "@spt/models/eft/ragfair/ISearchRequestData";
|
||||
import { IProcessBuyTradeRequestData } from "@spt/models/eft/trade/IProcessBuyTradeRequestData";
|
||||
import { FleaOfferType } from "@spt/models/enums/FleaOfferType";
|
||||
import { IRagfairConfig } from "@spt/models/spt/config/IRagfairConfig";
|
||||
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||
import { EventOutputHolder } from "@spt/routers/EventOutputHolder";
|
||||
@ -148,13 +149,52 @@ export declare class RagfairController {
|
||||
* @returns IItemEventRouterResponse
|
||||
*/
|
||||
addPlayerOffer(pmcData: IPmcData, offerRequest: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse;
|
||||
/**
|
||||
* Create a flea offer for a single item - uncludes an item with > 1 sized stack
|
||||
* e.g. 1 ammo stack of 30 cartridges
|
||||
* @param sessionID Session id
|
||||
* @param offerRequest Offer request from client
|
||||
* @param fullProfile Full profile of player
|
||||
* @param output Response to send to client
|
||||
* @returns IItemEventRouterResponse
|
||||
*/
|
||||
protected createSingleOffer(sessionID: string, offerRequest: IAddOfferRequestData, fullProfile: ISptProfile, output: IItemEventRouterResponse): IItemEventRouterResponse;
|
||||
/**
|
||||
* Create a flea offer for multiples of the same item, can be single items or items with multiple in the stack
|
||||
* e.g. 2 ammo stacks of 30 cartridges each
|
||||
* Each item can be purchsed individually
|
||||
* @param sessionID Session id
|
||||
* @param offerRequest Offer request from client
|
||||
* @param fullProfile Full profile of player
|
||||
* @param output Response to send to client
|
||||
* @returns IItemEventRouterResponse
|
||||
*/
|
||||
protected createMultiOffer(sessionID: string, offerRequest: IAddOfferRequestData, fullProfile: ISptProfile, output: IItemEventRouterResponse): IItemEventRouterResponse;
|
||||
/**
|
||||
* Create a flea offer for multiple items, can be single items or items with multiple in the stack
|
||||
* e.g. 2 ammo stacks of 30 cartridges each
|
||||
* The entire package must be purchased in one go
|
||||
* @param sessionID Session id
|
||||
* @param offerRequest Offer request from client
|
||||
* @param fullProfile Full profile of player
|
||||
* @param output Response to send to client
|
||||
* @returns IItemEventRouterResponse
|
||||
*/
|
||||
protected createPackOffer(sessionID: string, offerRequest: IAddOfferRequestData, fullProfile: ISptProfile, output: IItemEventRouterResponse): IItemEventRouterResponse;
|
||||
/**
|
||||
* Given a client request, determine what type of offer is being created
|
||||
* single/multi/pack
|
||||
* @param offerRequest Client request
|
||||
* @returns FleaOfferType
|
||||
*/
|
||||
protected getOfferType(offerRequest: IAddOfferRequestData): FleaOfferType;
|
||||
/**
|
||||
* Charge player a listing fee for using flea, pulls charge from data previously sent by client
|
||||
* @param sessionID Player id
|
||||
* @param rootItem Base item being listed (used when client tax cost not found and must be done on server)
|
||||
* @param pmcData Player profile
|
||||
* @param requirementsPriceInRub Rouble cost player chose for listing (used when client tax cost not found and must be done on server)
|
||||
* @param itemStackCount How many items were listed in player (used when client tax cost not found and must be done on server)
|
||||
* @param itemStackCount How many items were listed by player (used when client tax cost not found and must be done on server)
|
||||
* @param offerRequest Add offer request object from client
|
||||
* @param output IItemEventRouterResponse
|
||||
* @returns True if charging tax to player failed
|
||||
@ -180,7 +220,7 @@ export declare class RagfairController {
|
||||
* @returns Array of items from player inventory
|
||||
*/
|
||||
protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[]): {
|
||||
items: Item[] | undefined;
|
||||
items: Item[][] | undefined;
|
||||
errorMessage: string | undefined;
|
||||
};
|
||||
createPlayerOffer(sessionId: string, requirements: Requirement[], items: Item[], sellInOnePiece: boolean): IRagfairOffer;
|
||||
|
@ -33,7 +33,7 @@ export declare class RagfairHelper {
|
||||
getDisplayableAssorts(sessionID: string): Record<string, ITraderAssort>;
|
||||
protected getCategoryList(handbookId: string): string[];
|
||||
/**
|
||||
* Merges Root Items
|
||||
* Iterate over array of identical items and merge stack count
|
||||
* Ragfair allows abnormally large stacks.
|
||||
*/
|
||||
mergeStackable(items: Item[]): Item[];
|
||||
|
@ -120,6 +120,12 @@ export declare class RagfairOfferHelper {
|
||||
* @returns true = complete
|
||||
*/
|
||||
processOffersOnProfile(sessionID: string): boolean;
|
||||
/**
|
||||
* Count up all rootitem StackObjectsCount properties of an array of items
|
||||
* @param itemsInInventoryToList items to sum up
|
||||
* @returns Total count
|
||||
*/
|
||||
getTotalStackCountSize(itemsInInventoryToList: Item[][]): number;
|
||||
/**
|
||||
* Add amount to players ragfair rating
|
||||
* @param sessionId Profile to update
|
||||
|
@ -25,7 +25,8 @@ export declare class RagfairSellHelper {
|
||||
* Get array of item count and sell time (empty array = no sell)
|
||||
* @param sellChancePercent chance item will sell
|
||||
* @param itemSellCount count of items to sell
|
||||
* @param sellInOneGo All items listed get sold at once
|
||||
* @returns Array of purchases of item(s) listed
|
||||
*/
|
||||
rollForSale(sellChancePercent: number, itemSellCount: number): SellResult[];
|
||||
rollForSale(sellChancePercent: number, itemSellCount: number, sellInOneGo?: boolean): SellResult[];
|
||||
}
|
||||
|
6
TypeScript/16ImporterUtil/types/models/enums/FleaOfferType.d.ts
vendored
Normal file
6
TypeScript/16ImporterUtil/types/models/enums/FleaOfferType.d.ts
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
export declare enum FleaOfferType {
|
||||
SINGLE = 0,
|
||||
MULTI = 1,
|
||||
PACK = 2,
|
||||
UNKNOWN = 3
|
||||
}
|
@ -1,3 +1,4 @@
|
||||
import { ItemHelper } from "@spt/helpers/ItemHelper";
|
||||
import { ProfileHelper } from "@spt/helpers/ProfileHelper";
|
||||
import { RagfairServerHelper } from "@spt/helpers/RagfairServerHelper";
|
||||
import { Item } from "@spt/models/eft/common/tables/IItem";
|
||||
@ -9,6 +10,7 @@ import { ConfigServer } from "@spt/servers/ConfigServer";
|
||||
import { SaveServer } from "@spt/servers/SaveServer";
|
||||
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||
import { LocalisationService } from "@spt/services/LocalisationService";
|
||||
import { ICloner } from "@spt/utils/cloners/ICloner";
|
||||
import { HttpResponseUtil } from "@spt/utils/HttpResponseUtil";
|
||||
import { RagfairOfferHolder } from "@spt/utils/RagfairOfferHolder";
|
||||
import { TimeUtil } from "@spt/utils/TimeUtil";
|
||||
@ -18,17 +20,19 @@ export declare class RagfairOfferService {
|
||||
protected databaseService: DatabaseService;
|
||||
protected saveServer: SaveServer;
|
||||
protected ragfairServerHelper: RagfairServerHelper;
|
||||
protected itemHelper: ItemHelper;
|
||||
protected profileHelper: ProfileHelper;
|
||||
protected eventOutputHolder: EventOutputHolder;
|
||||
protected httpResponse: HttpResponseUtil;
|
||||
protected localisationService: LocalisationService;
|
||||
protected configServer: ConfigServer;
|
||||
protected cloner: ICloner;
|
||||
protected playerOffersLoaded: boolean;
|
||||
/** Offer id + offer object */
|
||||
protected expiredOffers: Record<string, IRagfairOffer>;
|
||||
protected ragfairConfig: IRagfairConfig;
|
||||
protected ragfairOfferHandler: RagfairOfferHolder;
|
||||
constructor(logger: ILogger, timeUtil: TimeUtil, databaseService: DatabaseService, saveServer: SaveServer, ragfairServerHelper: RagfairServerHelper, profileHelper: ProfileHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, localisationService: LocalisationService, configServer: ConfigServer);
|
||||
constructor(logger: ILogger, timeUtil: TimeUtil, databaseService: DatabaseService, saveServer: SaveServer, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, localisationService: LocalisationService, configServer: ConfigServer, cloner: ICloner);
|
||||
/**
|
||||
* Get all offers
|
||||
* @returns IRagfairOffer array
|
||||
@ -84,4 +88,12 @@ export declare class RagfairOfferService {
|
||||
*/
|
||||
protected processStaleOffer(staleOffer: IRagfairOffer): void;
|
||||
protected returnPlayerOffer(playerOffer: IRagfairOffer): void;
|
||||
/**
|
||||
* Flea offer items are stacked up often beyond the StackMaxSize limit
|
||||
* Un stack the items into an array of root items and their children
|
||||
* Will create new items equal to the
|
||||
* @param items Offer items to unstack
|
||||
* @returns Unstacked array of items
|
||||
*/
|
||||
protected unstackOfferItems(items: Item[]): Item[];
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ export declare class BotController {
|
||||
* @param sessionId Session id
|
||||
* @returns
|
||||
*/
|
||||
protected generateBotsFirstTime(request: IGenerateBotsRequestData, pmcProfile: IPmcData, sessionId: string): Promise<IBotBase[]>;
|
||||
generateBotsFirstTime(request: IGenerateBotsRequestData, pmcProfile: IPmcData, sessionId: string): Promise<IBotBase[]>;
|
||||
/**
|
||||
* Create a BotGenerationDetails for the bot generator to use
|
||||
* @param condition Client data defining bot type and difficulty
|
||||
@ -117,7 +117,7 @@ export declare class BotController {
|
||||
* @param request Bot generation request object
|
||||
* @returns Single IBotBase object
|
||||
*/
|
||||
protected returnSingleBotFromCache(sessionId: string, request: IGenerateBotsRequestData): Promise<IBotBase[]>;
|
||||
returnSingleBotFromCache(sessionId: string, request: IGenerateBotsRequestData): Promise<IBotBase[]>;
|
||||
protected updateBotGenerationDetailsToRandomBoss(botGenerationDetails: BotGenerationDetails, possibleBossTypeWeights: Record<string, number>): void;
|
||||
/**
|
||||
* Get the difficulty passed in, if its not "asonline", get selected difficulty from config
|
||||
|
@ -24,6 +24,7 @@ import { IRagfairOffer } from "@spt/models/eft/ragfair/IRagfairOffer";
|
||||
import { IRemoveOfferRequestData } from "@spt/models/eft/ragfair/IRemoveOfferRequestData";
|
||||
import { ISearchRequestData } from "@spt/models/eft/ragfair/ISearchRequestData";
|
||||
import { IProcessBuyTradeRequestData } from "@spt/models/eft/trade/IProcessBuyTradeRequestData";
|
||||
import { FleaOfferType } from "@spt/models/enums/FleaOfferType";
|
||||
import { IRagfairConfig } from "@spt/models/spt/config/IRagfairConfig";
|
||||
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||
import { EventOutputHolder } from "@spt/routers/EventOutputHolder";
|
||||
@ -148,13 +149,52 @@ export declare class RagfairController {
|
||||
* @returns IItemEventRouterResponse
|
||||
*/
|
||||
addPlayerOffer(pmcData: IPmcData, offerRequest: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse;
|
||||
/**
|
||||
* Create a flea offer for a single item - uncludes an item with > 1 sized stack
|
||||
* e.g. 1 ammo stack of 30 cartridges
|
||||
* @param sessionID Session id
|
||||
* @param offerRequest Offer request from client
|
||||
* @param fullProfile Full profile of player
|
||||
* @param output Response to send to client
|
||||
* @returns IItemEventRouterResponse
|
||||
*/
|
||||
protected createSingleOffer(sessionID: string, offerRequest: IAddOfferRequestData, fullProfile: ISptProfile, output: IItemEventRouterResponse): IItemEventRouterResponse;
|
||||
/**
|
||||
* Create a flea offer for multiples of the same item, can be single items or items with multiple in the stack
|
||||
* e.g. 2 ammo stacks of 30 cartridges each
|
||||
* Each item can be purchsed individually
|
||||
* @param sessionID Session id
|
||||
* @param offerRequest Offer request from client
|
||||
* @param fullProfile Full profile of player
|
||||
* @param output Response to send to client
|
||||
* @returns IItemEventRouterResponse
|
||||
*/
|
||||
protected createMultiOffer(sessionID: string, offerRequest: IAddOfferRequestData, fullProfile: ISptProfile, output: IItemEventRouterResponse): IItemEventRouterResponse;
|
||||
/**
|
||||
* Create a flea offer for multiple items, can be single items or items with multiple in the stack
|
||||
* e.g. 2 ammo stacks of 30 cartridges each
|
||||
* The entire package must be purchased in one go
|
||||
* @param sessionID Session id
|
||||
* @param offerRequest Offer request from client
|
||||
* @param fullProfile Full profile of player
|
||||
* @param output Response to send to client
|
||||
* @returns IItemEventRouterResponse
|
||||
*/
|
||||
protected createPackOffer(sessionID: string, offerRequest: IAddOfferRequestData, fullProfile: ISptProfile, output: IItemEventRouterResponse): IItemEventRouterResponse;
|
||||
/**
|
||||
* Given a client request, determine what type of offer is being created
|
||||
* single/multi/pack
|
||||
* @param offerRequest Client request
|
||||
* @returns FleaOfferType
|
||||
*/
|
||||
protected getOfferType(offerRequest: IAddOfferRequestData): FleaOfferType;
|
||||
/**
|
||||
* Charge player a listing fee for using flea, pulls charge from data previously sent by client
|
||||
* @param sessionID Player id
|
||||
* @param rootItem Base item being listed (used when client tax cost not found and must be done on server)
|
||||
* @param pmcData Player profile
|
||||
* @param requirementsPriceInRub Rouble cost player chose for listing (used when client tax cost not found and must be done on server)
|
||||
* @param itemStackCount How many items were listed in player (used when client tax cost not found and must be done on server)
|
||||
* @param itemStackCount How many items were listed by player (used when client tax cost not found and must be done on server)
|
||||
* @param offerRequest Add offer request object from client
|
||||
* @param output IItemEventRouterResponse
|
||||
* @returns True if charging tax to player failed
|
||||
@ -180,7 +220,7 @@ export declare class RagfairController {
|
||||
* @returns Array of items from player inventory
|
||||
*/
|
||||
protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[]): {
|
||||
items: Item[] | undefined;
|
||||
items: Item[][] | undefined;
|
||||
errorMessage: string | undefined;
|
||||
};
|
||||
createPlayerOffer(sessionId: string, requirements: Requirement[], items: Item[], sellInOnePiece: boolean): IRagfairOffer;
|
||||
|
@ -33,7 +33,7 @@ export declare class RagfairHelper {
|
||||
getDisplayableAssorts(sessionID: string): Record<string, ITraderAssort>;
|
||||
protected getCategoryList(handbookId: string): string[];
|
||||
/**
|
||||
* Merges Root Items
|
||||
* Iterate over array of identical items and merge stack count
|
||||
* Ragfair allows abnormally large stacks.
|
||||
*/
|
||||
mergeStackable(items: Item[]): Item[];
|
||||
|
@ -120,6 +120,12 @@ export declare class RagfairOfferHelper {
|
||||
* @returns true = complete
|
||||
*/
|
||||
processOffersOnProfile(sessionID: string): boolean;
|
||||
/**
|
||||
* Count up all rootitem StackObjectsCount properties of an array of items
|
||||
* @param itemsInInventoryToList items to sum up
|
||||
* @returns Total count
|
||||
*/
|
||||
getTotalStackCountSize(itemsInInventoryToList: Item[][]): number;
|
||||
/**
|
||||
* Add amount to players ragfair rating
|
||||
* @param sessionId Profile to update
|
||||
|
@ -25,7 +25,8 @@ export declare class RagfairSellHelper {
|
||||
* Get array of item count and sell time (empty array = no sell)
|
||||
* @param sellChancePercent chance item will sell
|
||||
* @param itemSellCount count of items to sell
|
||||
* @param sellInOneGo All items listed get sold at once
|
||||
* @returns Array of purchases of item(s) listed
|
||||
*/
|
||||
rollForSale(sellChancePercent: number, itemSellCount: number): SellResult[];
|
||||
rollForSale(sellChancePercent: number, itemSellCount: number, sellInOneGo?: boolean): SellResult[];
|
||||
}
|
||||
|
6
TypeScript/17AsyncImporterWithDependency1/types/models/enums/FleaOfferType.d.ts
vendored
Normal file
6
TypeScript/17AsyncImporterWithDependency1/types/models/enums/FleaOfferType.d.ts
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
export declare enum FleaOfferType {
|
||||
SINGLE = 0,
|
||||
MULTI = 1,
|
||||
PACK = 2,
|
||||
UNKNOWN = 3
|
||||
}
|
@ -1,3 +1,4 @@
|
||||
import { ItemHelper } from "@spt/helpers/ItemHelper";
|
||||
import { ProfileHelper } from "@spt/helpers/ProfileHelper";
|
||||
import { RagfairServerHelper } from "@spt/helpers/RagfairServerHelper";
|
||||
import { Item } from "@spt/models/eft/common/tables/IItem";
|
||||
@ -9,6 +10,7 @@ import { ConfigServer } from "@spt/servers/ConfigServer";
|
||||
import { SaveServer } from "@spt/servers/SaveServer";
|
||||
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||
import { LocalisationService } from "@spt/services/LocalisationService";
|
||||
import { ICloner } from "@spt/utils/cloners/ICloner";
|
||||
import { HttpResponseUtil } from "@spt/utils/HttpResponseUtil";
|
||||
import { RagfairOfferHolder } from "@spt/utils/RagfairOfferHolder";
|
||||
import { TimeUtil } from "@spt/utils/TimeUtil";
|
||||
@ -18,17 +20,19 @@ export declare class RagfairOfferService {
|
||||
protected databaseService: DatabaseService;
|
||||
protected saveServer: SaveServer;
|
||||
protected ragfairServerHelper: RagfairServerHelper;
|
||||
protected itemHelper: ItemHelper;
|
||||
protected profileHelper: ProfileHelper;
|
||||
protected eventOutputHolder: EventOutputHolder;
|
||||
protected httpResponse: HttpResponseUtil;
|
||||
protected localisationService: LocalisationService;
|
||||
protected configServer: ConfigServer;
|
||||
protected cloner: ICloner;
|
||||
protected playerOffersLoaded: boolean;
|
||||
/** Offer id + offer object */
|
||||
protected expiredOffers: Record<string, IRagfairOffer>;
|
||||
protected ragfairConfig: IRagfairConfig;
|
||||
protected ragfairOfferHandler: RagfairOfferHolder;
|
||||
constructor(logger: ILogger, timeUtil: TimeUtil, databaseService: DatabaseService, saveServer: SaveServer, ragfairServerHelper: RagfairServerHelper, profileHelper: ProfileHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, localisationService: LocalisationService, configServer: ConfigServer);
|
||||
constructor(logger: ILogger, timeUtil: TimeUtil, databaseService: DatabaseService, saveServer: SaveServer, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, localisationService: LocalisationService, configServer: ConfigServer, cloner: ICloner);
|
||||
/**
|
||||
* Get all offers
|
||||
* @returns IRagfairOffer array
|
||||
@ -84,4 +88,12 @@ export declare class RagfairOfferService {
|
||||
*/
|
||||
protected processStaleOffer(staleOffer: IRagfairOffer): void;
|
||||
protected returnPlayerOffer(playerOffer: IRagfairOffer): void;
|
||||
/**
|
||||
* Flea offer items are stacked up often beyond the StackMaxSize limit
|
||||
* Un stack the items into an array of root items and their children
|
||||
* Will create new items equal to the
|
||||
* @param items Offer items to unstack
|
||||
* @returns Unstacked array of items
|
||||
*/
|
||||
protected unstackOfferItems(items: Item[]): Item[];
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ export declare class BotController {
|
||||
* @param sessionId Session id
|
||||
* @returns
|
||||
*/
|
||||
protected generateBotsFirstTime(request: IGenerateBotsRequestData, pmcProfile: IPmcData, sessionId: string): Promise<IBotBase[]>;
|
||||
generateBotsFirstTime(request: IGenerateBotsRequestData, pmcProfile: IPmcData, sessionId: string): Promise<IBotBase[]>;
|
||||
/**
|
||||
* Create a BotGenerationDetails for the bot generator to use
|
||||
* @param condition Client data defining bot type and difficulty
|
||||
@ -117,7 +117,7 @@ export declare class BotController {
|
||||
* @param request Bot generation request object
|
||||
* @returns Single IBotBase object
|
||||
*/
|
||||
protected returnSingleBotFromCache(sessionId: string, request: IGenerateBotsRequestData): Promise<IBotBase[]>;
|
||||
returnSingleBotFromCache(sessionId: string, request: IGenerateBotsRequestData): Promise<IBotBase[]>;
|
||||
protected updateBotGenerationDetailsToRandomBoss(botGenerationDetails: BotGenerationDetails, possibleBossTypeWeights: Record<string, number>): void;
|
||||
/**
|
||||
* Get the difficulty passed in, if its not "asonline", get selected difficulty from config
|
||||
|
@ -24,6 +24,7 @@ import { IRagfairOffer } from "@spt/models/eft/ragfair/IRagfairOffer";
|
||||
import { IRemoveOfferRequestData } from "@spt/models/eft/ragfair/IRemoveOfferRequestData";
|
||||
import { ISearchRequestData } from "@spt/models/eft/ragfair/ISearchRequestData";
|
||||
import { IProcessBuyTradeRequestData } from "@spt/models/eft/trade/IProcessBuyTradeRequestData";
|
||||
import { FleaOfferType } from "@spt/models/enums/FleaOfferType";
|
||||
import { IRagfairConfig } from "@spt/models/spt/config/IRagfairConfig";
|
||||
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||
import { EventOutputHolder } from "@spt/routers/EventOutputHolder";
|
||||
@ -148,13 +149,52 @@ export declare class RagfairController {
|
||||
* @returns IItemEventRouterResponse
|
||||
*/
|
||||
addPlayerOffer(pmcData: IPmcData, offerRequest: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse;
|
||||
/**
|
||||
* Create a flea offer for a single item - uncludes an item with > 1 sized stack
|
||||
* e.g. 1 ammo stack of 30 cartridges
|
||||
* @param sessionID Session id
|
||||
* @param offerRequest Offer request from client
|
||||
* @param fullProfile Full profile of player
|
||||
* @param output Response to send to client
|
||||
* @returns IItemEventRouterResponse
|
||||
*/
|
||||
protected createSingleOffer(sessionID: string, offerRequest: IAddOfferRequestData, fullProfile: ISptProfile, output: IItemEventRouterResponse): IItemEventRouterResponse;
|
||||
/**
|
||||
* Create a flea offer for multiples of the same item, can be single items or items with multiple in the stack
|
||||
* e.g. 2 ammo stacks of 30 cartridges each
|
||||
* Each item can be purchsed individually
|
||||
* @param sessionID Session id
|
||||
* @param offerRequest Offer request from client
|
||||
* @param fullProfile Full profile of player
|
||||
* @param output Response to send to client
|
||||
* @returns IItemEventRouterResponse
|
||||
*/
|
||||
protected createMultiOffer(sessionID: string, offerRequest: IAddOfferRequestData, fullProfile: ISptProfile, output: IItemEventRouterResponse): IItemEventRouterResponse;
|
||||
/**
|
||||
* Create a flea offer for multiple items, can be single items or items with multiple in the stack
|
||||
* e.g. 2 ammo stacks of 30 cartridges each
|
||||
* The entire package must be purchased in one go
|
||||
* @param sessionID Session id
|
||||
* @param offerRequest Offer request from client
|
||||
* @param fullProfile Full profile of player
|
||||
* @param output Response to send to client
|
||||
* @returns IItemEventRouterResponse
|
||||
*/
|
||||
protected createPackOffer(sessionID: string, offerRequest: IAddOfferRequestData, fullProfile: ISptProfile, output: IItemEventRouterResponse): IItemEventRouterResponse;
|
||||
/**
|
||||
* Given a client request, determine what type of offer is being created
|
||||
* single/multi/pack
|
||||
* @param offerRequest Client request
|
||||
* @returns FleaOfferType
|
||||
*/
|
||||
protected getOfferType(offerRequest: IAddOfferRequestData): FleaOfferType;
|
||||
/**
|
||||
* Charge player a listing fee for using flea, pulls charge from data previously sent by client
|
||||
* @param sessionID Player id
|
||||
* @param rootItem Base item being listed (used when client tax cost not found and must be done on server)
|
||||
* @param pmcData Player profile
|
||||
* @param requirementsPriceInRub Rouble cost player chose for listing (used when client tax cost not found and must be done on server)
|
||||
* @param itemStackCount How many items were listed in player (used when client tax cost not found and must be done on server)
|
||||
* @param itemStackCount How many items were listed by player (used when client tax cost not found and must be done on server)
|
||||
* @param offerRequest Add offer request object from client
|
||||
* @param output IItemEventRouterResponse
|
||||
* @returns True if charging tax to player failed
|
||||
@ -180,7 +220,7 @@ export declare class RagfairController {
|
||||
* @returns Array of items from player inventory
|
||||
*/
|
||||
protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[]): {
|
||||
items: Item[] | undefined;
|
||||
items: Item[][] | undefined;
|
||||
errorMessage: string | undefined;
|
||||
};
|
||||
createPlayerOffer(sessionId: string, requirements: Requirement[], items: Item[], sellInOnePiece: boolean): IRagfairOffer;
|
||||
|
@ -33,7 +33,7 @@ export declare class RagfairHelper {
|
||||
getDisplayableAssorts(sessionID: string): Record<string, ITraderAssort>;
|
||||
protected getCategoryList(handbookId: string): string[];
|
||||
/**
|
||||
* Merges Root Items
|
||||
* Iterate over array of identical items and merge stack count
|
||||
* Ragfair allows abnormally large stacks.
|
||||
*/
|
||||
mergeStackable(items: Item[]): Item[];
|
||||
|
@ -120,6 +120,12 @@ export declare class RagfairOfferHelper {
|
||||
* @returns true = complete
|
||||
*/
|
||||
processOffersOnProfile(sessionID: string): boolean;
|
||||
/**
|
||||
* Count up all rootitem StackObjectsCount properties of an array of items
|
||||
* @param itemsInInventoryToList items to sum up
|
||||
* @returns Total count
|
||||
*/
|
||||
getTotalStackCountSize(itemsInInventoryToList: Item[][]): number;
|
||||
/**
|
||||
* Add amount to players ragfair rating
|
||||
* @param sessionId Profile to update
|
||||
|
@ -25,7 +25,8 @@ export declare class RagfairSellHelper {
|
||||
* Get array of item count and sell time (empty array = no sell)
|
||||
* @param sellChancePercent chance item will sell
|
||||
* @param itemSellCount count of items to sell
|
||||
* @param sellInOneGo All items listed get sold at once
|
||||
* @returns Array of purchases of item(s) listed
|
||||
*/
|
||||
rollForSale(sellChancePercent: number, itemSellCount: number): SellResult[];
|
||||
rollForSale(sellChancePercent: number, itemSellCount: number, sellInOneGo?: boolean): SellResult[];
|
||||
}
|
||||
|
6
TypeScript/17AsyncImporterWithDependency2/types/models/enums/FleaOfferType.d.ts
vendored
Normal file
6
TypeScript/17AsyncImporterWithDependency2/types/models/enums/FleaOfferType.d.ts
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
export declare enum FleaOfferType {
|
||||
SINGLE = 0,
|
||||
MULTI = 1,
|
||||
PACK = 2,
|
||||
UNKNOWN = 3
|
||||
}
|
@ -1,3 +1,4 @@
|
||||
import { ItemHelper } from "@spt/helpers/ItemHelper";
|
||||
import { ProfileHelper } from "@spt/helpers/ProfileHelper";
|
||||
import { RagfairServerHelper } from "@spt/helpers/RagfairServerHelper";
|
||||
import { Item } from "@spt/models/eft/common/tables/IItem";
|
||||
@ -9,6 +10,7 @@ import { ConfigServer } from "@spt/servers/ConfigServer";
|
||||
import { SaveServer } from "@spt/servers/SaveServer";
|
||||
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||
import { LocalisationService } from "@spt/services/LocalisationService";
|
||||
import { ICloner } from "@spt/utils/cloners/ICloner";
|
||||
import { HttpResponseUtil } from "@spt/utils/HttpResponseUtil";
|
||||
import { RagfairOfferHolder } from "@spt/utils/RagfairOfferHolder";
|
||||
import { TimeUtil } from "@spt/utils/TimeUtil";
|
||||
@ -18,17 +20,19 @@ export declare class RagfairOfferService {
|
||||
protected databaseService: DatabaseService;
|
||||
protected saveServer: SaveServer;
|
||||
protected ragfairServerHelper: RagfairServerHelper;
|
||||
protected itemHelper: ItemHelper;
|
||||
protected profileHelper: ProfileHelper;
|
||||
protected eventOutputHolder: EventOutputHolder;
|
||||
protected httpResponse: HttpResponseUtil;
|
||||
protected localisationService: LocalisationService;
|
||||
protected configServer: ConfigServer;
|
||||
protected cloner: ICloner;
|
||||
protected playerOffersLoaded: boolean;
|
||||
/** Offer id + offer object */
|
||||
protected expiredOffers: Record<string, IRagfairOffer>;
|
||||
protected ragfairConfig: IRagfairConfig;
|
||||
protected ragfairOfferHandler: RagfairOfferHolder;
|
||||
constructor(logger: ILogger, timeUtil: TimeUtil, databaseService: DatabaseService, saveServer: SaveServer, ragfairServerHelper: RagfairServerHelper, profileHelper: ProfileHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, localisationService: LocalisationService, configServer: ConfigServer);
|
||||
constructor(logger: ILogger, timeUtil: TimeUtil, databaseService: DatabaseService, saveServer: SaveServer, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, localisationService: LocalisationService, configServer: ConfigServer, cloner: ICloner);
|
||||
/**
|
||||
* Get all offers
|
||||
* @returns IRagfairOffer array
|
||||
@ -84,4 +88,12 @@ export declare class RagfairOfferService {
|
||||
*/
|
||||
protected processStaleOffer(staleOffer: IRagfairOffer): void;
|
||||
protected returnPlayerOffer(playerOffer: IRagfairOffer): void;
|
||||
/**
|
||||
* Flea offer items are stacked up often beyond the StackMaxSize limit
|
||||
* Un stack the items into an array of root items and their children
|
||||
* Will create new items equal to the
|
||||
* @param items Offer items to unstack
|
||||
* @returns Unstacked array of items
|
||||
*/
|
||||
protected unstackOfferItems(items: Item[]): Item[];
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ export declare class BotController {
|
||||
* @param sessionId Session id
|
||||
* @returns
|
||||
*/
|
||||
protected generateBotsFirstTime(request: IGenerateBotsRequestData, pmcProfile: IPmcData, sessionId: string): Promise<IBotBase[]>;
|
||||
generateBotsFirstTime(request: IGenerateBotsRequestData, pmcProfile: IPmcData, sessionId: string): Promise<IBotBase[]>;
|
||||
/**
|
||||
* Create a BotGenerationDetails for the bot generator to use
|
||||
* @param condition Client data defining bot type and difficulty
|
||||
@ -117,7 +117,7 @@ export declare class BotController {
|
||||
* @param request Bot generation request object
|
||||
* @returns Single IBotBase object
|
||||
*/
|
||||
protected returnSingleBotFromCache(sessionId: string, request: IGenerateBotsRequestData): Promise<IBotBase[]>;
|
||||
returnSingleBotFromCache(sessionId: string, request: IGenerateBotsRequestData): Promise<IBotBase[]>;
|
||||
protected updateBotGenerationDetailsToRandomBoss(botGenerationDetails: BotGenerationDetails, possibleBossTypeWeights: Record<string, number>): void;
|
||||
/**
|
||||
* Get the difficulty passed in, if its not "asonline", get selected difficulty from config
|
||||
|
@ -24,6 +24,7 @@ import { IRagfairOffer } from "@spt/models/eft/ragfair/IRagfairOffer";
|
||||
import { IRemoveOfferRequestData } from "@spt/models/eft/ragfair/IRemoveOfferRequestData";
|
||||
import { ISearchRequestData } from "@spt/models/eft/ragfair/ISearchRequestData";
|
||||
import { IProcessBuyTradeRequestData } from "@spt/models/eft/trade/IProcessBuyTradeRequestData";
|
||||
import { FleaOfferType } from "@spt/models/enums/FleaOfferType";
|
||||
import { IRagfairConfig } from "@spt/models/spt/config/IRagfairConfig";
|
||||
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||
import { EventOutputHolder } from "@spt/routers/EventOutputHolder";
|
||||
@ -148,13 +149,52 @@ export declare class RagfairController {
|
||||
* @returns IItemEventRouterResponse
|
||||
*/
|
||||
addPlayerOffer(pmcData: IPmcData, offerRequest: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse;
|
||||
/**
|
||||
* Create a flea offer for a single item - uncludes an item with > 1 sized stack
|
||||
* e.g. 1 ammo stack of 30 cartridges
|
||||
* @param sessionID Session id
|
||||
* @param offerRequest Offer request from client
|
||||
* @param fullProfile Full profile of player
|
||||
* @param output Response to send to client
|
||||
* @returns IItemEventRouterResponse
|
||||
*/
|
||||
protected createSingleOffer(sessionID: string, offerRequest: IAddOfferRequestData, fullProfile: ISptProfile, output: IItemEventRouterResponse): IItemEventRouterResponse;
|
||||
/**
|
||||
* Create a flea offer for multiples of the same item, can be single items or items with multiple in the stack
|
||||
* e.g. 2 ammo stacks of 30 cartridges each
|
||||
* Each item can be purchsed individually
|
||||
* @param sessionID Session id
|
||||
* @param offerRequest Offer request from client
|
||||
* @param fullProfile Full profile of player
|
||||
* @param output Response to send to client
|
||||
* @returns IItemEventRouterResponse
|
||||
*/
|
||||
protected createMultiOffer(sessionID: string, offerRequest: IAddOfferRequestData, fullProfile: ISptProfile, output: IItemEventRouterResponse): IItemEventRouterResponse;
|
||||
/**
|
||||
* Create a flea offer for multiple items, can be single items or items with multiple in the stack
|
||||
* e.g. 2 ammo stacks of 30 cartridges each
|
||||
* The entire package must be purchased in one go
|
||||
* @param sessionID Session id
|
||||
* @param offerRequest Offer request from client
|
||||
* @param fullProfile Full profile of player
|
||||
* @param output Response to send to client
|
||||
* @returns IItemEventRouterResponse
|
||||
*/
|
||||
protected createPackOffer(sessionID: string, offerRequest: IAddOfferRequestData, fullProfile: ISptProfile, output: IItemEventRouterResponse): IItemEventRouterResponse;
|
||||
/**
|
||||
* Given a client request, determine what type of offer is being created
|
||||
* single/multi/pack
|
||||
* @param offerRequest Client request
|
||||
* @returns FleaOfferType
|
||||
*/
|
||||
protected getOfferType(offerRequest: IAddOfferRequestData): FleaOfferType;
|
||||
/**
|
||||
* Charge player a listing fee for using flea, pulls charge from data previously sent by client
|
||||
* @param sessionID Player id
|
||||
* @param rootItem Base item being listed (used when client tax cost not found and must be done on server)
|
||||
* @param pmcData Player profile
|
||||
* @param requirementsPriceInRub Rouble cost player chose for listing (used when client tax cost not found and must be done on server)
|
||||
* @param itemStackCount How many items were listed in player (used when client tax cost not found and must be done on server)
|
||||
* @param itemStackCount How many items were listed by player (used when client tax cost not found and must be done on server)
|
||||
* @param offerRequest Add offer request object from client
|
||||
* @param output IItemEventRouterResponse
|
||||
* @returns True if charging tax to player failed
|
||||
@ -180,7 +220,7 @@ export declare class RagfairController {
|
||||
* @returns Array of items from player inventory
|
||||
*/
|
||||
protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[]): {
|
||||
items: Item[] | undefined;
|
||||
items: Item[][] | undefined;
|
||||
errorMessage: string | undefined;
|
||||
};
|
||||
createPlayerOffer(sessionId: string, requirements: Requirement[], items: Item[], sellInOnePiece: boolean): IRagfairOffer;
|
||||
|
@ -33,7 +33,7 @@ export declare class RagfairHelper {
|
||||
getDisplayableAssorts(sessionID: string): Record<string, ITraderAssort>;
|
||||
protected getCategoryList(handbookId: string): string[];
|
||||
/**
|
||||
* Merges Root Items
|
||||
* Iterate over array of identical items and merge stack count
|
||||
* Ragfair allows abnormally large stacks.
|
||||
*/
|
||||
mergeStackable(items: Item[]): Item[];
|
||||
|
@ -120,6 +120,12 @@ export declare class RagfairOfferHelper {
|
||||
* @returns true = complete
|
||||
*/
|
||||
processOffersOnProfile(sessionID: string): boolean;
|
||||
/**
|
||||
* Count up all rootitem StackObjectsCount properties of an array of items
|
||||
* @param itemsInInventoryToList items to sum up
|
||||
* @returns Total count
|
||||
*/
|
||||
getTotalStackCountSize(itemsInInventoryToList: Item[][]): number;
|
||||
/**
|
||||
* Add amount to players ragfair rating
|
||||
* @param sessionId Profile to update
|
||||
|
@ -25,7 +25,8 @@ export declare class RagfairSellHelper {
|
||||
* Get array of item count and sell time (empty array = no sell)
|
||||
* @param sellChancePercent chance item will sell
|
||||
* @param itemSellCount count of items to sell
|
||||
* @param sellInOneGo All items listed get sold at once
|
||||
* @returns Array of purchases of item(s) listed
|
||||
*/
|
||||
rollForSale(sellChancePercent: number, itemSellCount: number): SellResult[];
|
||||
rollForSale(sellChancePercent: number, itemSellCount: number, sellInOneGo?: boolean): SellResult[];
|
||||
}
|
||||
|
6
TypeScript/18.1CustomItemServiceLootBox/types/models/enums/FleaOfferType.d.ts
vendored
Normal file
6
TypeScript/18.1CustomItemServiceLootBox/types/models/enums/FleaOfferType.d.ts
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
export declare enum FleaOfferType {
|
||||
SINGLE = 0,
|
||||
MULTI = 1,
|
||||
PACK = 2,
|
||||
UNKNOWN = 3
|
||||
}
|
@ -1,3 +1,4 @@
|
||||
import { ItemHelper } from "@spt/helpers/ItemHelper";
|
||||
import { ProfileHelper } from "@spt/helpers/ProfileHelper";
|
||||
import { RagfairServerHelper } from "@spt/helpers/RagfairServerHelper";
|
||||
import { Item } from "@spt/models/eft/common/tables/IItem";
|
||||
@ -9,6 +10,7 @@ import { ConfigServer } from "@spt/servers/ConfigServer";
|
||||
import { SaveServer } from "@spt/servers/SaveServer";
|
||||
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||
import { LocalisationService } from "@spt/services/LocalisationService";
|
||||
import { ICloner } from "@spt/utils/cloners/ICloner";
|
||||
import { HttpResponseUtil } from "@spt/utils/HttpResponseUtil";
|
||||
import { RagfairOfferHolder } from "@spt/utils/RagfairOfferHolder";
|
||||
import { TimeUtil } from "@spt/utils/TimeUtil";
|
||||
@ -18,17 +20,19 @@ export declare class RagfairOfferService {
|
||||
protected databaseService: DatabaseService;
|
||||
protected saveServer: SaveServer;
|
||||
protected ragfairServerHelper: RagfairServerHelper;
|
||||
protected itemHelper: ItemHelper;
|
||||
protected profileHelper: ProfileHelper;
|
||||
protected eventOutputHolder: EventOutputHolder;
|
||||
protected httpResponse: HttpResponseUtil;
|
||||
protected localisationService: LocalisationService;
|
||||
protected configServer: ConfigServer;
|
||||
protected cloner: ICloner;
|
||||
protected playerOffersLoaded: boolean;
|
||||
/** Offer id + offer object */
|
||||
protected expiredOffers: Record<string, IRagfairOffer>;
|
||||
protected ragfairConfig: IRagfairConfig;
|
||||
protected ragfairOfferHandler: RagfairOfferHolder;
|
||||
constructor(logger: ILogger, timeUtil: TimeUtil, databaseService: DatabaseService, saveServer: SaveServer, ragfairServerHelper: RagfairServerHelper, profileHelper: ProfileHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, localisationService: LocalisationService, configServer: ConfigServer);
|
||||
constructor(logger: ILogger, timeUtil: TimeUtil, databaseService: DatabaseService, saveServer: SaveServer, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, localisationService: LocalisationService, configServer: ConfigServer, cloner: ICloner);
|
||||
/**
|
||||
* Get all offers
|
||||
* @returns IRagfairOffer array
|
||||
@ -84,4 +88,12 @@ export declare class RagfairOfferService {
|
||||
*/
|
||||
protected processStaleOffer(staleOffer: IRagfairOffer): void;
|
||||
protected returnPlayerOffer(playerOffer: IRagfairOffer): void;
|
||||
/**
|
||||
* Flea offer items are stacked up often beyond the StackMaxSize limit
|
||||
* Un stack the items into an array of root items and their children
|
||||
* Will create new items equal to the
|
||||
* @param items Offer items to unstack
|
||||
* @returns Unstacked array of items
|
||||
*/
|
||||
protected unstackOfferItems(items: Item[]): Item[];
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ export declare class BotController {
|
||||
* @param sessionId Session id
|
||||
* @returns
|
||||
*/
|
||||
protected generateBotsFirstTime(request: IGenerateBotsRequestData, pmcProfile: IPmcData, sessionId: string): Promise<IBotBase[]>;
|
||||
generateBotsFirstTime(request: IGenerateBotsRequestData, pmcProfile: IPmcData, sessionId: string): Promise<IBotBase[]>;
|
||||
/**
|
||||
* Create a BotGenerationDetails for the bot generator to use
|
||||
* @param condition Client data defining bot type and difficulty
|
||||
@ -117,7 +117,7 @@ export declare class BotController {
|
||||
* @param request Bot generation request object
|
||||
* @returns Single IBotBase object
|
||||
*/
|
||||
protected returnSingleBotFromCache(sessionId: string, request: IGenerateBotsRequestData): Promise<IBotBase[]>;
|
||||
returnSingleBotFromCache(sessionId: string, request: IGenerateBotsRequestData): Promise<IBotBase[]>;
|
||||
protected updateBotGenerationDetailsToRandomBoss(botGenerationDetails: BotGenerationDetails, possibleBossTypeWeights: Record<string, number>): void;
|
||||
/**
|
||||
* Get the difficulty passed in, if its not "asonline", get selected difficulty from config
|
||||
|
@ -24,6 +24,7 @@ import { IRagfairOffer } from "@spt/models/eft/ragfair/IRagfairOffer";
|
||||
import { IRemoveOfferRequestData } from "@spt/models/eft/ragfair/IRemoveOfferRequestData";
|
||||
import { ISearchRequestData } from "@spt/models/eft/ragfair/ISearchRequestData";
|
||||
import { IProcessBuyTradeRequestData } from "@spt/models/eft/trade/IProcessBuyTradeRequestData";
|
||||
import { FleaOfferType } from "@spt/models/enums/FleaOfferType";
|
||||
import { IRagfairConfig } from "@spt/models/spt/config/IRagfairConfig";
|
||||
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||
import { EventOutputHolder } from "@spt/routers/EventOutputHolder";
|
||||
@ -148,13 +149,52 @@ export declare class RagfairController {
|
||||
* @returns IItemEventRouterResponse
|
||||
*/
|
||||
addPlayerOffer(pmcData: IPmcData, offerRequest: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse;
|
||||
/**
|
||||
* Create a flea offer for a single item - uncludes an item with > 1 sized stack
|
||||
* e.g. 1 ammo stack of 30 cartridges
|
||||
* @param sessionID Session id
|
||||
* @param offerRequest Offer request from client
|
||||
* @param fullProfile Full profile of player
|
||||
* @param output Response to send to client
|
||||
* @returns IItemEventRouterResponse
|
||||
*/
|
||||
protected createSingleOffer(sessionID: string, offerRequest: IAddOfferRequestData, fullProfile: ISptProfile, output: IItemEventRouterResponse): IItemEventRouterResponse;
|
||||
/**
|
||||
* Create a flea offer for multiples of the same item, can be single items or items with multiple in the stack
|
||||
* e.g. 2 ammo stacks of 30 cartridges each
|
||||
* Each item can be purchsed individually
|
||||
* @param sessionID Session id
|
||||
* @param offerRequest Offer request from client
|
||||
* @param fullProfile Full profile of player
|
||||
* @param output Response to send to client
|
||||
* @returns IItemEventRouterResponse
|
||||
*/
|
||||
protected createMultiOffer(sessionID: string, offerRequest: IAddOfferRequestData, fullProfile: ISptProfile, output: IItemEventRouterResponse): IItemEventRouterResponse;
|
||||
/**
|
||||
* Create a flea offer for multiple items, can be single items or items with multiple in the stack
|
||||
* e.g. 2 ammo stacks of 30 cartridges each
|
||||
* The entire package must be purchased in one go
|
||||
* @param sessionID Session id
|
||||
* @param offerRequest Offer request from client
|
||||
* @param fullProfile Full profile of player
|
||||
* @param output Response to send to client
|
||||
* @returns IItemEventRouterResponse
|
||||
*/
|
||||
protected createPackOffer(sessionID: string, offerRequest: IAddOfferRequestData, fullProfile: ISptProfile, output: IItemEventRouterResponse): IItemEventRouterResponse;
|
||||
/**
|
||||
* Given a client request, determine what type of offer is being created
|
||||
* single/multi/pack
|
||||
* @param offerRequest Client request
|
||||
* @returns FleaOfferType
|
||||
*/
|
||||
protected getOfferType(offerRequest: IAddOfferRequestData): FleaOfferType;
|
||||
/**
|
||||
* Charge player a listing fee for using flea, pulls charge from data previously sent by client
|
||||
* @param sessionID Player id
|
||||
* @param rootItem Base item being listed (used when client tax cost not found and must be done on server)
|
||||
* @param pmcData Player profile
|
||||
* @param requirementsPriceInRub Rouble cost player chose for listing (used when client tax cost not found and must be done on server)
|
||||
* @param itemStackCount How many items were listed in player (used when client tax cost not found and must be done on server)
|
||||
* @param itemStackCount How many items were listed by player (used when client tax cost not found and must be done on server)
|
||||
* @param offerRequest Add offer request object from client
|
||||
* @param output IItemEventRouterResponse
|
||||
* @returns True if charging tax to player failed
|
||||
@ -180,7 +220,7 @@ export declare class RagfairController {
|
||||
* @returns Array of items from player inventory
|
||||
*/
|
||||
protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[]): {
|
||||
items: Item[] | undefined;
|
||||
items: Item[][] | undefined;
|
||||
errorMessage: string | undefined;
|
||||
};
|
||||
createPlayerOffer(sessionId: string, requirements: Requirement[], items: Item[], sellInOnePiece: boolean): IRagfairOffer;
|
||||
|
@ -33,7 +33,7 @@ export declare class RagfairHelper {
|
||||
getDisplayableAssorts(sessionID: string): Record<string, ITraderAssort>;
|
||||
protected getCategoryList(handbookId: string): string[];
|
||||
/**
|
||||
* Merges Root Items
|
||||
* Iterate over array of identical items and merge stack count
|
||||
* Ragfair allows abnormally large stacks.
|
||||
*/
|
||||
mergeStackable(items: Item[]): Item[];
|
||||
|
@ -120,6 +120,12 @@ export declare class RagfairOfferHelper {
|
||||
* @returns true = complete
|
||||
*/
|
||||
processOffersOnProfile(sessionID: string): boolean;
|
||||
/**
|
||||
* Count up all rootitem StackObjectsCount properties of an array of items
|
||||
* @param itemsInInventoryToList items to sum up
|
||||
* @returns Total count
|
||||
*/
|
||||
getTotalStackCountSize(itemsInInventoryToList: Item[][]): number;
|
||||
/**
|
||||
* Add amount to players ragfair rating
|
||||
* @param sessionId Profile to update
|
||||
|
@ -25,7 +25,8 @@ export declare class RagfairSellHelper {
|
||||
* Get array of item count and sell time (empty array = no sell)
|
||||
* @param sellChancePercent chance item will sell
|
||||
* @param itemSellCount count of items to sell
|
||||
* @param sellInOneGo All items listed get sold at once
|
||||
* @returns Array of purchases of item(s) listed
|
||||
*/
|
||||
rollForSale(sellChancePercent: number, itemSellCount: number): SellResult[];
|
||||
rollForSale(sellChancePercent: number, itemSellCount: number, sellInOneGo?: boolean): SellResult[];
|
||||
}
|
||||
|
6
TypeScript/18CustomItemService/types/models/enums/FleaOfferType.d.ts
vendored
Normal file
6
TypeScript/18CustomItemService/types/models/enums/FleaOfferType.d.ts
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
export declare enum FleaOfferType {
|
||||
SINGLE = 0,
|
||||
MULTI = 1,
|
||||
PACK = 2,
|
||||
UNKNOWN = 3
|
||||
}
|
@ -1,3 +1,4 @@
|
||||
import { ItemHelper } from "@spt/helpers/ItemHelper";
|
||||
import { ProfileHelper } from "@spt/helpers/ProfileHelper";
|
||||
import { RagfairServerHelper } from "@spt/helpers/RagfairServerHelper";
|
||||
import { Item } from "@spt/models/eft/common/tables/IItem";
|
||||
@ -9,6 +10,7 @@ import { ConfigServer } from "@spt/servers/ConfigServer";
|
||||
import { SaveServer } from "@spt/servers/SaveServer";
|
||||
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||
import { LocalisationService } from "@spt/services/LocalisationService";
|
||||
import { ICloner } from "@spt/utils/cloners/ICloner";
|
||||
import { HttpResponseUtil } from "@spt/utils/HttpResponseUtil";
|
||||
import { RagfairOfferHolder } from "@spt/utils/RagfairOfferHolder";
|
||||
import { TimeUtil } from "@spt/utils/TimeUtil";
|
||||
@ -18,17 +20,19 @@ export declare class RagfairOfferService {
|
||||
protected databaseService: DatabaseService;
|
||||
protected saveServer: SaveServer;
|
||||
protected ragfairServerHelper: RagfairServerHelper;
|
||||
protected itemHelper: ItemHelper;
|
||||
protected profileHelper: ProfileHelper;
|
||||
protected eventOutputHolder: EventOutputHolder;
|
||||
protected httpResponse: HttpResponseUtil;
|
||||
protected localisationService: LocalisationService;
|
||||
protected configServer: ConfigServer;
|
||||
protected cloner: ICloner;
|
||||
protected playerOffersLoaded: boolean;
|
||||
/** Offer id + offer object */
|
||||
protected expiredOffers: Record<string, IRagfairOffer>;
|
||||
protected ragfairConfig: IRagfairConfig;
|
||||
protected ragfairOfferHandler: RagfairOfferHolder;
|
||||
constructor(logger: ILogger, timeUtil: TimeUtil, databaseService: DatabaseService, saveServer: SaveServer, ragfairServerHelper: RagfairServerHelper, profileHelper: ProfileHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, localisationService: LocalisationService, configServer: ConfigServer);
|
||||
constructor(logger: ILogger, timeUtil: TimeUtil, databaseService: DatabaseService, saveServer: SaveServer, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, localisationService: LocalisationService, configServer: ConfigServer, cloner: ICloner);
|
||||
/**
|
||||
* Get all offers
|
||||
* @returns IRagfairOffer array
|
||||
@ -84,4 +88,12 @@ export declare class RagfairOfferService {
|
||||
*/
|
||||
protected processStaleOffer(staleOffer: IRagfairOffer): void;
|
||||
protected returnPlayerOffer(playerOffer: IRagfairOffer): void;
|
||||
/**
|
||||
* Flea offer items are stacked up often beyond the StackMaxSize limit
|
||||
* Un stack the items into an array of root items and their children
|
||||
* Will create new items equal to the
|
||||
* @param items Offer items to unstack
|
||||
* @returns Unstacked array of items
|
||||
*/
|
||||
protected unstackOfferItems(items: Item[]): Item[];
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ export declare class BotController {
|
||||
* @param sessionId Session id
|
||||
* @returns
|
||||
*/
|
||||
protected generateBotsFirstTime(request: IGenerateBotsRequestData, pmcProfile: IPmcData, sessionId: string): Promise<IBotBase[]>;
|
||||
generateBotsFirstTime(request: IGenerateBotsRequestData, pmcProfile: IPmcData, sessionId: string): Promise<IBotBase[]>;
|
||||
/**
|
||||
* Create a BotGenerationDetails for the bot generator to use
|
||||
* @param condition Client data defining bot type and difficulty
|
||||
@ -117,7 +117,7 @@ export declare class BotController {
|
||||
* @param request Bot generation request object
|
||||
* @returns Single IBotBase object
|
||||
*/
|
||||
protected returnSingleBotFromCache(sessionId: string, request: IGenerateBotsRequestData): Promise<IBotBase[]>;
|
||||
returnSingleBotFromCache(sessionId: string, request: IGenerateBotsRequestData): Promise<IBotBase[]>;
|
||||
protected updateBotGenerationDetailsToRandomBoss(botGenerationDetails: BotGenerationDetails, possibleBossTypeWeights: Record<string, number>): void;
|
||||
/**
|
||||
* Get the difficulty passed in, if its not "asonline", get selected difficulty from config
|
||||
|
@ -24,6 +24,7 @@ import { IRagfairOffer } from "@spt/models/eft/ragfair/IRagfairOffer";
|
||||
import { IRemoveOfferRequestData } from "@spt/models/eft/ragfair/IRemoveOfferRequestData";
|
||||
import { ISearchRequestData } from "@spt/models/eft/ragfair/ISearchRequestData";
|
||||
import { IProcessBuyTradeRequestData } from "@spt/models/eft/trade/IProcessBuyTradeRequestData";
|
||||
import { FleaOfferType } from "@spt/models/enums/FleaOfferType";
|
||||
import { IRagfairConfig } from "@spt/models/spt/config/IRagfairConfig";
|
||||
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||
import { EventOutputHolder } from "@spt/routers/EventOutputHolder";
|
||||
@ -148,13 +149,52 @@ export declare class RagfairController {
|
||||
* @returns IItemEventRouterResponse
|
||||
*/
|
||||
addPlayerOffer(pmcData: IPmcData, offerRequest: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse;
|
||||
/**
|
||||
* Create a flea offer for a single item - uncludes an item with > 1 sized stack
|
||||
* e.g. 1 ammo stack of 30 cartridges
|
||||
* @param sessionID Session id
|
||||
* @param offerRequest Offer request from client
|
||||
* @param fullProfile Full profile of player
|
||||
* @param output Response to send to client
|
||||
* @returns IItemEventRouterResponse
|
||||
*/
|
||||
protected createSingleOffer(sessionID: string, offerRequest: IAddOfferRequestData, fullProfile: ISptProfile, output: IItemEventRouterResponse): IItemEventRouterResponse;
|
||||
/**
|
||||
* Create a flea offer for multiples of the same item, can be single items or items with multiple in the stack
|
||||
* e.g. 2 ammo stacks of 30 cartridges each
|
||||
* Each item can be purchsed individually
|
||||
* @param sessionID Session id
|
||||
* @param offerRequest Offer request from client
|
||||
* @param fullProfile Full profile of player
|
||||
* @param output Response to send to client
|
||||
* @returns IItemEventRouterResponse
|
||||
*/
|
||||
protected createMultiOffer(sessionID: string, offerRequest: IAddOfferRequestData, fullProfile: ISptProfile, output: IItemEventRouterResponse): IItemEventRouterResponse;
|
||||
/**
|
||||
* Create a flea offer for multiple items, can be single items or items with multiple in the stack
|
||||
* e.g. 2 ammo stacks of 30 cartridges each
|
||||
* The entire package must be purchased in one go
|
||||
* @param sessionID Session id
|
||||
* @param offerRequest Offer request from client
|
||||
* @param fullProfile Full profile of player
|
||||
* @param output Response to send to client
|
||||
* @returns IItemEventRouterResponse
|
||||
*/
|
||||
protected createPackOffer(sessionID: string, offerRequest: IAddOfferRequestData, fullProfile: ISptProfile, output: IItemEventRouterResponse): IItemEventRouterResponse;
|
||||
/**
|
||||
* Given a client request, determine what type of offer is being created
|
||||
* single/multi/pack
|
||||
* @param offerRequest Client request
|
||||
* @returns FleaOfferType
|
||||
*/
|
||||
protected getOfferType(offerRequest: IAddOfferRequestData): FleaOfferType;
|
||||
/**
|
||||
* Charge player a listing fee for using flea, pulls charge from data previously sent by client
|
||||
* @param sessionID Player id
|
||||
* @param rootItem Base item being listed (used when client tax cost not found and must be done on server)
|
||||
* @param pmcData Player profile
|
||||
* @param requirementsPriceInRub Rouble cost player chose for listing (used when client tax cost not found and must be done on server)
|
||||
* @param itemStackCount How many items were listed in player (used when client tax cost not found and must be done on server)
|
||||
* @param itemStackCount How many items were listed by player (used when client tax cost not found and must be done on server)
|
||||
* @param offerRequest Add offer request object from client
|
||||
* @param output IItemEventRouterResponse
|
||||
* @returns True if charging tax to player failed
|
||||
@ -180,7 +220,7 @@ export declare class RagfairController {
|
||||
* @returns Array of items from player inventory
|
||||
*/
|
||||
protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[]): {
|
||||
items: Item[] | undefined;
|
||||
items: Item[][] | undefined;
|
||||
errorMessage: string | undefined;
|
||||
};
|
||||
createPlayerOffer(sessionId: string, requirements: Requirement[], items: Item[], sellInOnePiece: boolean): IRagfairOffer;
|
||||
|
@ -33,7 +33,7 @@ export declare class RagfairHelper {
|
||||
getDisplayableAssorts(sessionID: string): Record<string, ITraderAssort>;
|
||||
protected getCategoryList(handbookId: string): string[];
|
||||
/**
|
||||
* Merges Root Items
|
||||
* Iterate over array of identical items and merge stack count
|
||||
* Ragfair allows abnormally large stacks.
|
||||
*/
|
||||
mergeStackable(items: Item[]): Item[];
|
||||
|
@ -120,6 +120,12 @@ export declare class RagfairOfferHelper {
|
||||
* @returns true = complete
|
||||
*/
|
||||
processOffersOnProfile(sessionID: string): boolean;
|
||||
/**
|
||||
* Count up all rootitem StackObjectsCount properties of an array of items
|
||||
* @param itemsInInventoryToList items to sum up
|
||||
* @returns Total count
|
||||
*/
|
||||
getTotalStackCountSize(itemsInInventoryToList: Item[][]): number;
|
||||
/**
|
||||
* Add amount to players ragfair rating
|
||||
* @param sessionId Profile to update
|
||||
|
@ -25,7 +25,8 @@ export declare class RagfairSellHelper {
|
||||
* Get array of item count and sell time (empty array = no sell)
|
||||
* @param sellChancePercent chance item will sell
|
||||
* @param itemSellCount count of items to sell
|
||||
* @param sellInOneGo All items listed get sold at once
|
||||
* @returns Array of purchases of item(s) listed
|
||||
*/
|
||||
rollForSale(sellChancePercent: number, itemSellCount: number): SellResult[];
|
||||
rollForSale(sellChancePercent: number, itemSellCount: number, sellInOneGo?: boolean): SellResult[];
|
||||
}
|
||||
|
6
TypeScript/19UseExternalLibraries/types/models/enums/FleaOfferType.d.ts
vendored
Normal file
6
TypeScript/19UseExternalLibraries/types/models/enums/FleaOfferType.d.ts
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
export declare enum FleaOfferType {
|
||||
SINGLE = 0,
|
||||
MULTI = 1,
|
||||
PACK = 2,
|
||||
UNKNOWN = 3
|
||||
}
|
@ -1,3 +1,4 @@
|
||||
import { ItemHelper } from "@spt/helpers/ItemHelper";
|
||||
import { ProfileHelper } from "@spt/helpers/ProfileHelper";
|
||||
import { RagfairServerHelper } from "@spt/helpers/RagfairServerHelper";
|
||||
import { Item } from "@spt/models/eft/common/tables/IItem";
|
||||
@ -9,6 +10,7 @@ import { ConfigServer } from "@spt/servers/ConfigServer";
|
||||
import { SaveServer } from "@spt/servers/SaveServer";
|
||||
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||
import { LocalisationService } from "@spt/services/LocalisationService";
|
||||
import { ICloner } from "@spt/utils/cloners/ICloner";
|
||||
import { HttpResponseUtil } from "@spt/utils/HttpResponseUtil";
|
||||
import { RagfairOfferHolder } from "@spt/utils/RagfairOfferHolder";
|
||||
import { TimeUtil } from "@spt/utils/TimeUtil";
|
||||
@ -18,17 +20,19 @@ export declare class RagfairOfferService {
|
||||
protected databaseService: DatabaseService;
|
||||
protected saveServer: SaveServer;
|
||||
protected ragfairServerHelper: RagfairServerHelper;
|
||||
protected itemHelper: ItemHelper;
|
||||
protected profileHelper: ProfileHelper;
|
||||
protected eventOutputHolder: EventOutputHolder;
|
||||
protected httpResponse: HttpResponseUtil;
|
||||
protected localisationService: LocalisationService;
|
||||
protected configServer: ConfigServer;
|
||||
protected cloner: ICloner;
|
||||
protected playerOffersLoaded: boolean;
|
||||
/** Offer id + offer object */
|
||||
protected expiredOffers: Record<string, IRagfairOffer>;
|
||||
protected ragfairConfig: IRagfairConfig;
|
||||
protected ragfairOfferHandler: RagfairOfferHolder;
|
||||
constructor(logger: ILogger, timeUtil: TimeUtil, databaseService: DatabaseService, saveServer: SaveServer, ragfairServerHelper: RagfairServerHelper, profileHelper: ProfileHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, localisationService: LocalisationService, configServer: ConfigServer);
|
||||
constructor(logger: ILogger, timeUtil: TimeUtil, databaseService: DatabaseService, saveServer: SaveServer, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, localisationService: LocalisationService, configServer: ConfigServer, cloner: ICloner);
|
||||
/**
|
||||
* Get all offers
|
||||
* @returns IRagfairOffer array
|
||||
@ -84,4 +88,12 @@ export declare class RagfairOfferService {
|
||||
*/
|
||||
protected processStaleOffer(staleOffer: IRagfairOffer): void;
|
||||
protected returnPlayerOffer(playerOffer: IRagfairOffer): void;
|
||||
/**
|
||||
* Flea offer items are stacked up often beyond the StackMaxSize limit
|
||||
* Un stack the items into an array of root items and their children
|
||||
* Will create new items equal to the
|
||||
* @param items Offer items to unstack
|
||||
* @returns Unstacked array of items
|
||||
*/
|
||||
protected unstackOfferItems(items: Item[]): Item[];
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ export declare class BotController {
|
||||
* @param sessionId Session id
|
||||
* @returns
|
||||
*/
|
||||
protected generateBotsFirstTime(request: IGenerateBotsRequestData, pmcProfile: IPmcData, sessionId: string): Promise<IBotBase[]>;
|
||||
generateBotsFirstTime(request: IGenerateBotsRequestData, pmcProfile: IPmcData, sessionId: string): Promise<IBotBase[]>;
|
||||
/**
|
||||
* Create a BotGenerationDetails for the bot generator to use
|
||||
* @param condition Client data defining bot type and difficulty
|
||||
@ -117,7 +117,7 @@ export declare class BotController {
|
||||
* @param request Bot generation request object
|
||||
* @returns Single IBotBase object
|
||||
*/
|
||||
protected returnSingleBotFromCache(sessionId: string, request: IGenerateBotsRequestData): Promise<IBotBase[]>;
|
||||
returnSingleBotFromCache(sessionId: string, request: IGenerateBotsRequestData): Promise<IBotBase[]>;
|
||||
protected updateBotGenerationDetailsToRandomBoss(botGenerationDetails: BotGenerationDetails, possibleBossTypeWeights: Record<string, number>): void;
|
||||
/**
|
||||
* Get the difficulty passed in, if its not "asonline", get selected difficulty from config
|
||||
|
@ -24,6 +24,7 @@ import { IRagfairOffer } from "@spt/models/eft/ragfair/IRagfairOffer";
|
||||
import { IRemoveOfferRequestData } from "@spt/models/eft/ragfair/IRemoveOfferRequestData";
|
||||
import { ISearchRequestData } from "@spt/models/eft/ragfair/ISearchRequestData";
|
||||
import { IProcessBuyTradeRequestData } from "@spt/models/eft/trade/IProcessBuyTradeRequestData";
|
||||
import { FleaOfferType } from "@spt/models/enums/FleaOfferType";
|
||||
import { IRagfairConfig } from "@spt/models/spt/config/IRagfairConfig";
|
||||
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||
import { EventOutputHolder } from "@spt/routers/EventOutputHolder";
|
||||
@ -148,13 +149,52 @@ export declare class RagfairController {
|
||||
* @returns IItemEventRouterResponse
|
||||
*/
|
||||
addPlayerOffer(pmcData: IPmcData, offerRequest: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse;
|
||||
/**
|
||||
* Create a flea offer for a single item - uncludes an item with > 1 sized stack
|
||||
* e.g. 1 ammo stack of 30 cartridges
|
||||
* @param sessionID Session id
|
||||
* @param offerRequest Offer request from client
|
||||
* @param fullProfile Full profile of player
|
||||
* @param output Response to send to client
|
||||
* @returns IItemEventRouterResponse
|
||||
*/
|
||||
protected createSingleOffer(sessionID: string, offerRequest: IAddOfferRequestData, fullProfile: ISptProfile, output: IItemEventRouterResponse): IItemEventRouterResponse;
|
||||
/**
|
||||
* Create a flea offer for multiples of the same item, can be single items or items with multiple in the stack
|
||||
* e.g. 2 ammo stacks of 30 cartridges each
|
||||
* Each item can be purchsed individually
|
||||
* @param sessionID Session id
|
||||
* @param offerRequest Offer request from client
|
||||
* @param fullProfile Full profile of player
|
||||
* @param output Response to send to client
|
||||
* @returns IItemEventRouterResponse
|
||||
*/
|
||||
protected createMultiOffer(sessionID: string, offerRequest: IAddOfferRequestData, fullProfile: ISptProfile, output: IItemEventRouterResponse): IItemEventRouterResponse;
|
||||
/**
|
||||
* Create a flea offer for multiple items, can be single items or items with multiple in the stack
|
||||
* e.g. 2 ammo stacks of 30 cartridges each
|
||||
* The entire package must be purchased in one go
|
||||
* @param sessionID Session id
|
||||
* @param offerRequest Offer request from client
|
||||
* @param fullProfile Full profile of player
|
||||
* @param output Response to send to client
|
||||
* @returns IItemEventRouterResponse
|
||||
*/
|
||||
protected createPackOffer(sessionID: string, offerRequest: IAddOfferRequestData, fullProfile: ISptProfile, output: IItemEventRouterResponse): IItemEventRouterResponse;
|
||||
/**
|
||||
* Given a client request, determine what type of offer is being created
|
||||
* single/multi/pack
|
||||
* @param offerRequest Client request
|
||||
* @returns FleaOfferType
|
||||
*/
|
||||
protected getOfferType(offerRequest: IAddOfferRequestData): FleaOfferType;
|
||||
/**
|
||||
* Charge player a listing fee for using flea, pulls charge from data previously sent by client
|
||||
* @param sessionID Player id
|
||||
* @param rootItem Base item being listed (used when client tax cost not found and must be done on server)
|
||||
* @param pmcData Player profile
|
||||
* @param requirementsPriceInRub Rouble cost player chose for listing (used when client tax cost not found and must be done on server)
|
||||
* @param itemStackCount How many items were listed in player (used when client tax cost not found and must be done on server)
|
||||
* @param itemStackCount How many items were listed by player (used when client tax cost not found and must be done on server)
|
||||
* @param offerRequest Add offer request object from client
|
||||
* @param output IItemEventRouterResponse
|
||||
* @returns True if charging tax to player failed
|
||||
@ -180,7 +220,7 @@ export declare class RagfairController {
|
||||
* @returns Array of items from player inventory
|
||||
*/
|
||||
protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[]): {
|
||||
items: Item[] | undefined;
|
||||
items: Item[][] | undefined;
|
||||
errorMessage: string | undefined;
|
||||
};
|
||||
createPlayerOffer(sessionId: string, requirements: Requirement[], items: Item[], sellInOnePiece: boolean): IRagfairOffer;
|
||||
|
@ -33,7 +33,7 @@ export declare class RagfairHelper {
|
||||
getDisplayableAssorts(sessionID: string): Record<string, ITraderAssort>;
|
||||
protected getCategoryList(handbookId: string): string[];
|
||||
/**
|
||||
* Merges Root Items
|
||||
* Iterate over array of identical items and merge stack count
|
||||
* Ragfair allows abnormally large stacks.
|
||||
*/
|
||||
mergeStackable(items: Item[]): Item[];
|
||||
|
@ -120,6 +120,12 @@ export declare class RagfairOfferHelper {
|
||||
* @returns true = complete
|
||||
*/
|
||||
processOffersOnProfile(sessionID: string): boolean;
|
||||
/**
|
||||
* Count up all rootitem StackObjectsCount properties of an array of items
|
||||
* @param itemsInInventoryToList items to sum up
|
||||
* @returns Total count
|
||||
*/
|
||||
getTotalStackCountSize(itemsInInventoryToList: Item[][]): number;
|
||||
/**
|
||||
* Add amount to players ragfair rating
|
||||
* @param sessionId Profile to update
|
||||
|
@ -25,7 +25,8 @@ export declare class RagfairSellHelper {
|
||||
* Get array of item count and sell time (empty array = no sell)
|
||||
* @param sellChancePercent chance item will sell
|
||||
* @param itemSellCount count of items to sell
|
||||
* @param sellInOneGo All items listed get sold at once
|
||||
* @returns Array of purchases of item(s) listed
|
||||
*/
|
||||
rollForSale(sellChancePercent: number, itemSellCount: number): SellResult[];
|
||||
rollForSale(sellChancePercent: number, itemSellCount: number, sellInOneGo?: boolean): SellResult[];
|
||||
}
|
||||
|
6
TypeScript/1LogToConsole/types/models/enums/FleaOfferType.d.ts
vendored
Normal file
6
TypeScript/1LogToConsole/types/models/enums/FleaOfferType.d.ts
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
export declare enum FleaOfferType {
|
||||
SINGLE = 0,
|
||||
MULTI = 1,
|
||||
PACK = 2,
|
||||
UNKNOWN = 3
|
||||
}
|
@ -1,3 +1,4 @@
|
||||
import { ItemHelper } from "@spt/helpers/ItemHelper";
|
||||
import { ProfileHelper } from "@spt/helpers/ProfileHelper";
|
||||
import { RagfairServerHelper } from "@spt/helpers/RagfairServerHelper";
|
||||
import { Item } from "@spt/models/eft/common/tables/IItem";
|
||||
@ -9,6 +10,7 @@ import { ConfigServer } from "@spt/servers/ConfigServer";
|
||||
import { SaveServer } from "@spt/servers/SaveServer";
|
||||
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||
import { LocalisationService } from "@spt/services/LocalisationService";
|
||||
import { ICloner } from "@spt/utils/cloners/ICloner";
|
||||
import { HttpResponseUtil } from "@spt/utils/HttpResponseUtil";
|
||||
import { RagfairOfferHolder } from "@spt/utils/RagfairOfferHolder";
|
||||
import { TimeUtil } from "@spt/utils/TimeUtil";
|
||||
@ -18,17 +20,19 @@ export declare class RagfairOfferService {
|
||||
protected databaseService: DatabaseService;
|
||||
protected saveServer: SaveServer;
|
||||
protected ragfairServerHelper: RagfairServerHelper;
|
||||
protected itemHelper: ItemHelper;
|
||||
protected profileHelper: ProfileHelper;
|
||||
protected eventOutputHolder: EventOutputHolder;
|
||||
protected httpResponse: HttpResponseUtil;
|
||||
protected localisationService: LocalisationService;
|
||||
protected configServer: ConfigServer;
|
||||
protected cloner: ICloner;
|
||||
protected playerOffersLoaded: boolean;
|
||||
/** Offer id + offer object */
|
||||
protected expiredOffers: Record<string, IRagfairOffer>;
|
||||
protected ragfairConfig: IRagfairConfig;
|
||||
protected ragfairOfferHandler: RagfairOfferHolder;
|
||||
constructor(logger: ILogger, timeUtil: TimeUtil, databaseService: DatabaseService, saveServer: SaveServer, ragfairServerHelper: RagfairServerHelper, profileHelper: ProfileHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, localisationService: LocalisationService, configServer: ConfigServer);
|
||||
constructor(logger: ILogger, timeUtil: TimeUtil, databaseService: DatabaseService, saveServer: SaveServer, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, localisationService: LocalisationService, configServer: ConfigServer, cloner: ICloner);
|
||||
/**
|
||||
* Get all offers
|
||||
* @returns IRagfairOffer array
|
||||
@ -84,4 +88,12 @@ export declare class RagfairOfferService {
|
||||
*/
|
||||
protected processStaleOffer(staleOffer: IRagfairOffer): void;
|
||||
protected returnPlayerOffer(playerOffer: IRagfairOffer): void;
|
||||
/**
|
||||
* Flea offer items are stacked up often beyond the StackMaxSize limit
|
||||
* Un stack the items into an array of root items and their children
|
||||
* Will create new items equal to the
|
||||
* @param items Offer items to unstack
|
||||
* @returns Unstacked array of items
|
||||
*/
|
||||
protected unstackOfferItems(items: Item[]): Item[];
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ export declare class BotController {
|
||||
* @param sessionId Session id
|
||||
* @returns
|
||||
*/
|
||||
protected generateBotsFirstTime(request: IGenerateBotsRequestData, pmcProfile: IPmcData, sessionId: string): Promise<IBotBase[]>;
|
||||
generateBotsFirstTime(request: IGenerateBotsRequestData, pmcProfile: IPmcData, sessionId: string): Promise<IBotBase[]>;
|
||||
/**
|
||||
* Create a BotGenerationDetails for the bot generator to use
|
||||
* @param condition Client data defining bot type and difficulty
|
||||
@ -117,7 +117,7 @@ export declare class BotController {
|
||||
* @param request Bot generation request object
|
||||
* @returns Single IBotBase object
|
||||
*/
|
||||
protected returnSingleBotFromCache(sessionId: string, request: IGenerateBotsRequestData): Promise<IBotBase[]>;
|
||||
returnSingleBotFromCache(sessionId: string, request: IGenerateBotsRequestData): Promise<IBotBase[]>;
|
||||
protected updateBotGenerationDetailsToRandomBoss(botGenerationDetails: BotGenerationDetails, possibleBossTypeWeights: Record<string, number>): void;
|
||||
/**
|
||||
* Get the difficulty passed in, if its not "asonline", get selected difficulty from config
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user