Update types

This commit is contained in:
Chomp 2022-08-24 22:24:30 +01:00
parent 129b6eb52a
commit 019adcc79b
12 changed files with 148 additions and 30 deletions

View File

@ -1,5 +1,6 @@
import { ProfileController } from "../controllers/ProfileController";
import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData";
import { IPmcData } from "../models/eft/common/IPmcData";
import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData";
import { INullResponseData } from "../models/eft/httpResponse/INullResponseData";
import { IGetMiniProfileRequestData } from "../models/eft/launcher/IGetMiniProfileRequestData";
@ -12,14 +13,30 @@ import { ISearchFriendResponse } from "../models/eft/profile/ISearchFriendRespon
import { IValidateNicknameRequestData } from "../models/eft/profile/IValidateNicknameRequestData";
import { HttpResponseUtil } from "../utils/HttpResponseUtil";
import { TimeUtil } from "../utils/TimeUtil";
/** Handle profile related client events */
export declare class ProfileCallbacks {
protected httpResponse: HttpResponseUtil;
protected timeUtil: TimeUtil;
protected profileController: ProfileController;
constructor(httpResponse: HttpResponseUtil, timeUtil: TimeUtil, profileController: ProfileController);
createProfile(url: string, info: IProfileCreateRequestData, sessionID: string): IGetBodyResponseData<any>;
getProfileData(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<any>;
regenerateScav(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<any>;
/**
* Get the complete player profile (scav + pmc character)
* @param url
* @param info Empty
* @param sessionID Session id
* @returns Profile object
*/
getProfileData(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<IPmcData[]>;
/**
* Handle the creation of a scav profile for player
* Occurs post-raid and when profile first created immediately after character details are confirmed by player
* @param url
* @param info empty
* @param sessionID Session id
* @returns Profile object
*/
regenerateScav(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<IPmcData[]>;
/**
* Handle client/game/profile/voice/change event
* @param url
@ -40,7 +57,7 @@ export declare class ProfileCallbacks {
validateNickname(url: string, info: IValidateNicknameRequestData, sessionID: string): IGetBodyResponseData<any>;
getReservedNickname(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<string>;
/**
* Called when creating a character, when you choose a character face/voice
* Called when creating a character when choosing a character face/voice
* @param url
* @param info response (empty)
* @param sessionID

View File

@ -35,6 +35,29 @@ export declare class InraidController {
constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, configServer: ConfigServer);
addPlayer(sessionID: string, info: IRegisterPlayerRequestData): void;
saveProgress(offraidData: ISaveProgressRequestData, sessionID: string): void;
/**
* Handle updating the profile post-pmc raid
* @param sessionID session id
* @param offraidData post-raid data of raid
*/
protected savePmcProgress(sessionID: string, offraidData: ISaveProgressRequestData): void;
/**
* Reduce body part hp to 10% of max
* @param pmcData profile to edit
*/
protected reducePmcHealthTo10Percent(pmcData: IPmcData): void;
/**
* Handle updating the profile post-pscav raid
* @param sessionID session id
* @param offraidData post-raid data of raid
*/
protected savePlayerScavProgress(sessionID: string, offraidData: ISaveProgressRequestData): void;
/**
* Is the player dead after a raid
* @param statusOnExit exit value from offraidData object
* @returns true if dead
*/
protected isPlayerDead(statusOnExit: string): boolean;
/**
* Mark inventory items as FiR if player survived raid, otherwise remove FiR from them
* @param offraidData Save Progress Request

View File

@ -9,6 +9,7 @@ import { IGetProfileRequestData } from "../models/eft/match/IGetProfileRequestDa
import { IJoinMatchRequestData } from "../models/eft/match/IJoinMatchRequestData";
import { IJoinMatchResult } from "../models/eft/match/IJoinMatchResult";
import { IStartOfflineRaidRequestData } from "../models/eft/match/IStartOffineRaidRequestData";
import { IBotConfig } from "../models/spt/config/IBotConfig";
import { IInRaidConfig } from "../models/spt/config/IInRaidConfig";
import { IMatchConfig } from "../models/spt/config/IMatchConfig";
import { ILogger } from "../models/spt/utils/ILogger";
@ -29,6 +30,7 @@ export declare class MatchController {
protected applicationContext: ApplicationContext;
protected matchConfig: IMatchConfig;
protected inraidConfig: IInRaidConfig;
protected botConfig: IBotConfig;
constructor(logger: ILogger, saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, applicationContext: ApplicationContext);
getEnabled(): boolean;
getProfile(info: IGetProfileRequestData): IPmcData[];

View File

@ -3,10 +3,9 @@ import { GameEventHelper } from "../helpers/GameEventHelper";
import { ItemHelper } from "../helpers/ItemHelper";
import { PresetHelper } from "../helpers/PresetHelper";
import { RagfairServerHelper } from "../helpers/RagfairServerHelper";
import { ILooseLoot, SpawnpointTemplate } from "../models/eft/common/ILooseLoot";
import { ILooseLoot, SpawnpointsForced, SpawnpointTemplate } from "../models/eft/common/ILooseLoot";
import { Item } from "../models/eft/common/tables/IItem";
import { IStaticAmmoDetails, IStaticContainerProps, IStaticForcedProps, IStaticLootDetails } from "../models/eft/common/tables/ILootBase";
import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem";
import { ILocationConfig } from "../models/spt/config/ILocationConfig";
import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer";
@ -36,11 +35,19 @@ export declare class LocationGenerator {
generateContainerLoot(containerIn: IStaticContainerProps, staticForced: IStaticForcedProps[], staticLootDist: Record<string, IStaticLootDetails>, staticAmmoDist: Record<string, IStaticAmmoDetails[]>, locationName: string): IStaticContainerProps;
protected getLooseLootMultiplerForLocation(location: string): number;
protected getStaticLootMultiplerForLocation(location: string): number;
/**
* Create array of loose + forced loot using probability system
* @param dynamicLootDist
* @param staticAmmoDist
* @param locationName Location to generate loot for
* @returns Array of spawn points with loot in them
*/
generateDynamicLoot(dynamicLootDist: ILooseLoot, staticAmmoDist: Record<string, IStaticAmmoDetails[]>, locationName: string): SpawnpointTemplate[];
/**
* Add forced spawn point loot into loot parameter array
* @param loot array to add forced loot to
* @param forcedSpawnPoints forced loot to add
*/
protected addForcedLoot(loot: SpawnpointTemplate[], forcedSpawnPoints: SpawnpointsForced[]): void;
protected createItem(tpl: string, staticAmmoDist: Record<string, IStaticAmmoDetails[]>, parentId?: string): IContainerItem;
protected getRandomCompatibleCaliberTemplateId(item: ITemplateItem): string;
protected getRandomValidCaliber(magTemplate: ITemplateItem): string;
protected drawAmmoTpl(caliber: string, staticAmmoDist: Record<string, IStaticAmmoDetails[]>): string;
protected createRandomMagCartridges(magTemplate: ITemplateItem, parentId: string, staticAmmoDist: Record<string, IStaticAmmoDetails[]>, caliber?: string): Item;
protected createCartidges(parentId: string, ammoTpl: string, stackCount: number): Item;
}

View File

@ -1,7 +1,7 @@
import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper";
import { ConfigServer } from "../servers/ConfigServer";
import { IWeatherData } from "../models/eft/weather/IWeatherData";
import { IWeatherConfig } from "../models/spt/config/IWeatherConfig";
import { ConfigServer } from "../servers/ConfigServer";
import { RandomUtil } from "../utils/RandomUtil";
import { TimeUtil } from "../utils/TimeUtil";
export declare class WeatherGenerator {
@ -21,11 +21,16 @@ export declare class WeatherGenerator {
protected getAcceleratedTime(computedDate: Date): string;
/**
* Get current time formatted to fit BSGs requirement
* @param computedDate
* @param computedDate date to format into bsg style
* @returns
*/
protected getNormalTime(computedDate: Date): string;
generateWeather(data: IWeatherData): IWeatherData;
/**
* Return randomised Weather data
* @param weatherData weather input data
* @returns Randomised weather data
*/
generateWeather(weatherData: IWeatherData): IWeatherData;
protected getWeightedFog(): string;
protected getWeightedRain(): number;
protected getRandomFloat(node: string): number;

View File

@ -18,18 +18,6 @@ export declare class InRaidHelper {
protected paymentHelper: PaymentHelper;
protected profileFixerService: ProfileFixerService;
constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper, profileFixerService: ProfileFixerService);
/**
* Reset the SPT inraid property stored in a profile to 'none'
* @param sessionID Session id
*/
protected removePlayer(sessionID: string): void;
/**
* Some maps have one-time-use keys (e.g. Labs
* Remove the relevant key from an inventory based on the post-raid request data passed in
* @param offraidData post-raid data
* @param sessionID Session id
*/
protected removeMapAccessKey(offraidData: ISaveProgressRequestData, sessionID: string): void;
/**
* Check an array of items and add an upd object to money items with a stack count of 1
* Single stack money items have no upd object and thus no StackObjectsCount, causing issues
@ -54,6 +42,18 @@ export declare class InRaidHelper {
* @returns Reset profile object
*/
updateProfileBaseStats(profileData: IPmcData, saveProgressRequest: ISaveProgressRequestData, sessionID: string): IPmcData;
/**
* Some maps have one-time-use keys (e.g. Labs
* Remove the relevant key from an inventory based on the post-raid request data passed in
* @param offraidData post-raid data
* @param sessionID Session id
*/
protected removeMapAccessKey(offraidData: ISaveProgressRequestData, sessionID: string): void;
/**
* Set the SPT inraid location Profile property to 'none'
* @param sessionID Session id
*/
protected setPlayerInRaidLocationStatusToNone(sessionID: string): void;
/**
* Adds SpawnedInSession property to items found in a raid
* Removes SpawnedInSession for non-scav players if item was taken into raid with SpawnedInSession = true
@ -95,5 +95,10 @@ export declare class InRaidHelper {
* @returns true if item is kept after death
*/
isItemKeptAfterDeath(slotId: string): boolean;
/**
* Return the equipped items from a players inventory
* @param items Players inventory to search through
* @returns an array of equipped items
*/
getPlayerGear(items: Item[]): Item[];
}

View File

@ -1,17 +1,24 @@
import { IPmcData } from "../models/eft/common/IPmcData";
import { InsuredItem } from "../models/eft/common/tables/IBotBase";
import { Item, Repairable } from "../models/eft/common/tables/IItem";
import { IStaticAmmoDetails } from "../models/eft/common/tables/ILootBase";
import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem";
import { ILogger } from "../models/spt/utils/ILogger";
import { DatabaseServer } from "../servers/DatabaseServer";
import { HashUtil } from "../utils/HashUtil";
import { JsonUtil } from "../utils/JsonUtil";
import { MathUtil } from "../utils/MathUtil";
import { ObjectId } from "../utils/ObjectId";
import { RandomUtil } from "../utils/RandomUtil";
declare class ItemHelper {
protected logger: ILogger;
protected hashUtil: HashUtil;
protected jsonUtil: JsonUtil;
protected randomUtil: RandomUtil;
protected objectId: ObjectId;
protected mathUtil: MathUtil;
protected databaseServer: DatabaseServer;
constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer);
constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer);
/**
* Checks if a id is a valid item. Valid meaning that it's an item that be stored in stash
* @param {string} tpl the template id / tpl
@ -184,6 +191,22 @@ declare class ItemHelper {
* @returns ItemSize object (width and height)
*/
getItemSize(items: Item[], rootItemId: string): ItemHelper.ItemSize;
/**
* Get a random cartridge from an items Filter property
* @param item
* @returns
*/
getRandomCompatibleCaliberTemplateId(item: ITemplateItem): string;
createRandomMagCartridges(magTemplate: ITemplateItem, parentId: string, staticAmmoDist: Record<string, IStaticAmmoDetails[]>, caliber?: string): Item;
protected getRandomValidCaliber(magTemplate: ITemplateItem): string;
protected drawAmmoTpl(caliber: string, staticAmmoDist: Record<string, IStaticAmmoDetails[]>): string;
createCartidges(parentId: string, ammoTpl: string, stackCount: number): Item;
/**
* Get the size of a stack, return 1 if no stack object count property found
* @param item Item to get stack size of
* @returns size of stack
*/
getItemStackSize(item: Item): number;
}
declare namespace ItemHelper {
interface ItemSize {

View File

@ -36,11 +36,20 @@ export declare class QuestHelper {
protected configServer: ConfigServer;
protected questConfig: IQuestConfig;
constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, traderHelper: TraderHelper, configServer: ConfigServer);
questStatus(pmcData: IPmcData, questID: string): QuestStatus;
/**
* returns true is the condition is satisfied
* Get status of a quest by quest id
* @param pmcData Profile to search
* @param questID Quest id to look up
* @returns QuestStauts enum
*/
getQuestStatus(pmcData: IPmcData, questID: string): QuestStatus;
/**
* returns true is the level condition is satisfied
* @param playerLevel Players level
* @param condition Quest condition
* @returns true if player level is greater than or equal to quest
*/
evaluateLevel(pmcProfile: IPmcData, cond: AvailableForConditions): boolean;
doesPlayerLevelFulfilCondition(playerLevel: number, condition: AvailableForConditions): boolean;
getDeltaQuests(before: IQuest[], after: IQuest[]): IQuest[];
/**
* Increase skill points of a skill on player profile

View File

@ -1,5 +1,6 @@
export declare enum ELocationName {
FACTORY_DAY = "factory4_day",
FACTORY_NIGHT = "factory4_night",
BIGMAP = "bigmap",
WOODS = "Woods",
SHORELINE = "Shoreline",

View File

@ -95,6 +95,7 @@ export interface LootNvalue {
}
export interface PmcConfig {
dynamicLoot: PmcDynamicLoot;
useDifficultyOverride: boolean;
difficulty: string;
looseWeaponInBackpackChancePercent: number;
looseWeaponInBackpackLootMinMax: MinMax;

View File

@ -2,6 +2,7 @@ import { DialogueHelper } from "../helpers/DialogueHelper";
import { SecureContainerHelper } from "../helpers/SecureContainerHelper";
import { TraderHelper } from "../helpers/TraderHelper";
import { IPmcData } from "../models/eft/common/IPmcData";
import { InsuredItem } from "../models/eft/common/tables/IBotBase";
import { Item } from "../models/eft/common/tables/IItem";
import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData";
import { IInsuranceConfig } from "../models/spt/config/IInsuranceConfig";
@ -44,8 +45,22 @@ export declare class InsuranceService {
* @param mapId Id of the map player died/exited that caused the insurance to be issued on
*/
sendInsuredItems(pmcData: IPmcData, sessionID: string, mapId: string): void;
/**
* Store lost gear post-raid inside profile
* @param pmcData player profile to store gear in
* @param offraidData post-raid request object
* @param preRaidGear gear player wore prior to raid
* @param sessionID Session id
*/
storeLostGear(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string): void;
storeInsuredItemsForReturn(pmcData: IPmcData, offraidData: ISaveProgressRequestData, preRaidGear: Item[], sessionID: string): void;
protected addGearToSend(pmcData: IPmcData, insuredItem: any, actualItem: any, sessionID: string): any;
/**
* Add gear item to InsuredItems array in player profile
* @param pmcData profile to store item in
* @param insuredItem Item to store in profile
* @param actualItem item to store
* @param sessionID Session id
*/
protected addGearToSend(pmcData: IPmcData, insuredItem: InsuredItem, actualItem: Item, sessionID: string): void;
getPremium(pmcData: IPmcData, inventoryItem: Item, traderId: string): number;
}

View File

@ -4,8 +4,18 @@ import { TimeUtil } from "./TimeUtil";
export declare class HashUtil {
protected timeUtil: TimeUtil;
constructor(timeUtil: TimeUtil);
/**
* Create a 24 character id using the sha256 algorithm + current timestamp
* @returns 24 character hash
*/
generate(): string;
generateMd5ForData(data: string): string;
generateSha1ForData(data: string): string;
/**
* Create a hash for the data parameter
* @param algorithm algorithm to use to hash
* @param data data to be hashed
* @returns hash value
*/
generateHashForData(algorithm: string, data: crypto.BinaryLike): string;
}