Skip to content

Commit

Permalink
Update types
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchangelWTF committed Nov 18, 2024
1 parent 76329d4 commit 789d4f3
Show file tree
Hide file tree
Showing 47 changed files with 221 additions and 131 deletions.
14 changes: 13 additions & 1 deletion types/callbacks/GameCallbacks.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ import { IGameModeResponse } from "@spt/models/eft/game/IGameModeResponse";
import { IGameStartResponse } from "@spt/models/eft/game/IGameStartResponse";
import { IGetRaidTimeRequest } from "@spt/models/eft/game/IGetRaidTimeRequest";
import { IGetRaidTimeResponse } from "@spt/models/eft/game/IGetRaidTimeResponse";
import { ISendSurveyOpinionRequest } from "@spt/models/eft/game/ISendSurveyOpinionRequest";
import { IServerDetails } from "@spt/models/eft/game/IServerDetails";
import { ISurveyResponseData } from "@spt/models/eft/game/ISurveyResponseData";
import { IVersionValidateRequestData } from "@spt/models/eft/game/IVersionValidateRequestData";
import { IGetBodyResponseData } from "@spt/models/eft/httpResponse/IGetBodyResponseData";
import { INullResponseData } from "@spt/models/eft/httpResponse/INullResponseData";
Expand Down Expand Up @@ -90,5 +92,15 @@ export declare class GameCallbacks implements OnLoad {
* Handle /client/survey
* @returns INullResponseData
*/
getSurvey(url: string, request: IEmptyRequestData, sessionID: string): INullResponseData;
getSurvey(url: string, request: IEmptyRequestData, sessionId: string): INullResponseData | IGetBodyResponseData<ISurveyResponseData>;
/**
* Handle client/survey/view
* @returns INullResponseData
*/
getSurveyView(url: string, request: any, sessionId: string): INullResponseData;
/**
* Handle client/survey/opinion
* @returns INullResponseData
*/
sendSurveyOpinion(url: string, request: ISendSurveyOpinionRequest, sessionId: string): INullResponseData;
}
2 changes: 1 addition & 1 deletion types/callbacks/InraidCallbacks.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export declare class InraidCallbacks {
*/
registerPlayer(url: string, info: IRegisterPlayerRequestData, sessionID: string): INullResponseData;
/**
* Handle raid/profile/save
* Handle raid/profile/scavsave
* @param url
* @param info Save progress request
* @param sessionID Session id
Expand Down
3 changes: 2 additions & 1 deletion types/callbacks/MatchCallbacks.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { MatchController } from "@spt/controllers/MatchController";
import { IEmptyRequestData } from "@spt/models/eft/common/IEmptyRequestData";
import { IMetrics } from "@spt/models/eft/common/tables/IMatch";
import { IGetBodyResponseData } from "@spt/models/eft/httpResponse/IGetBodyResponseData";
import { INullResponseData } from "@spt/models/eft/httpResponse/INullResponseData";
import { IEndLocalRaidRequestData } from "@spt/models/eft/match/IEndLocalRaidRequestData";
Expand Down Expand Up @@ -53,7 +54,7 @@ export declare class MatchCallbacks {
/** Handle match/group/start_game */
joinMatch(url: string, info: IMatchGroupStartGameRequest, sessionID: string): IGetBodyResponseData<IProfileStatusResponse>;
/** Handle client/getMetricsConfig */
getMetrics(url: string, info: any, sessionID: string): IGetBodyResponseData<string>;
getMetrics(url: string, info: any, sessionID: string): IGetBodyResponseData<IMetrics>;
/**
* Called periodically while in a group
* Handle client/match/group/status
Expand Down
2 changes: 2 additions & 0 deletions types/controllers/GameController.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { IGameModeRequestData } from "@spt/models/eft/game/IGameModeRequestData"
import { IGetRaidTimeRequest } from "@spt/models/eft/game/IGetRaidTimeRequest";
import { IGetRaidTimeResponse } from "@spt/models/eft/game/IGetRaidTimeResponse";
import { IServerDetails } from "@spt/models/eft/game/IServerDetails";
import { ISurveyResponseData } from "@spt/models/eft/game/ISurveyResponseData";
import { ISptProfile } from "@spt/models/eft/profile/ISptProfile";
import { IBotConfig } from "@spt/models/spt/config/IBotConfig";
import { ICoreConfig } from "@spt/models/spt/config/ICoreConfig";
Expand Down Expand Up @@ -132,4 +133,5 @@ export declare class GameController {
*/
protected checkForAndRemoveUndefinedDialogs(fullProfile: ISptProfile): void;
protected logProfileDetails(fullProfile: ISptProfile): void;
getSurvey(sessionId: string): ISurveyResponseData;
}
6 changes: 3 additions & 3 deletions types/controllers/InraidController.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ export declare class InraidController {
*/
addPlayer(sessionID: string, info: IRegisterPlayerRequestData): void;
/**
* Handle raid/profile/save
* Handle raid/profile/scavsave
* Save profile state to disk
* Handles pmc/pscav
* @param offraidData post-raid request data
* @param offraidProfileData Post-raid scav profile data
* @param sessionID Session id
*/
savePostRaidProfileForScav(offraidData: IScavSaveRequestData, sessionID: string): void;
savePostRaidProfileForScav(offraidProfileData: IScavSaveRequestData, sessionID: string): void;
/**
* Get the inraid config from configs/inraid.json
* @returns InRaid Config
Expand Down
2 changes: 1 addition & 1 deletion types/di/Serializer.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { IncomingMessage, ServerResponse } from "node:http";
export declare class Serializer {
serialize(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): void;
serialize(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): Promise<void>;
canHandle(something: string): boolean;
}
7 changes: 7 additions & 0 deletions types/generators/BotEquipmentModGenerator.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,13 @@ export declare class BotEquipmentModGenerator {
* @returns itemHelper.getItem() result
*/
protected chooseModToPutIntoSlot(request: IModToSpawnRequest): [boolean, ITemplateItem] | undefined;
/**
* Given the passed in array of magaizne tpls, look up the min size set in config and return only those that have that size or larger
* @param modSpawnRequest Request data
* @param modPool Pool of magazine tpls to filter
* @returns Filtered pool of magazine tpls
*/
protected getFilterdMagazinePoolByCapacity(modSpawnRequest: IModToSpawnRequest, modPool: string[]): string[];
/**
* Choose a weapon mod tpl for a given slot from a pool of choices
* Checks chosen tpl is compatible with all existing weapon items
Expand Down
27 changes: 26 additions & 1 deletion types/generators/BotGenerator.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { BotGeneratorHelper } from "@spt/helpers/BotGeneratorHelper";
import { BotHelper } from "@spt/helpers/BotHelper";
import { ProfileHelper } from "@spt/helpers/ProfileHelper";
import { WeightedRandomHelper } from "@spt/helpers/WeightedRandomHelper";
import { MinMax } from "@spt/models/common/MinMax";
import { IBaseJsonSkills, IBaseSkill, IBotBase, IInfo, IHealth as PmcHealth, ISkills as botSkills } from "@spt/models/eft/common/tables/IBotBase";
import { IAppearance, IBodyPart, IBotType, IHealth, IInventory } from "@spt/models/eft/common/tables/IBotType";
import { IBotGenerationDetails } from "@spt/models/spt/bots/BotGenerationDetails";
Expand Down Expand Up @@ -50,7 +51,7 @@ export declare class BotGenerator {
*/
generatePlayerScav(sessionId: string, role: string, difficulty: string, botTemplate: IBotType): IBotBase;
/**
* Create 1 bots of the type/side/difficulty defined in botGenerationDetails
* Create 1 bot of the type/side/difficulty defined in botGenerationDetails
* @param sessionId Session id
* @param botGenerationDetails details on how to generate bots
* @returns constructed bot
Expand Down Expand Up @@ -78,6 +79,30 @@ export declare class BotGenerator {
* @returns IBotBase object
*/
protected generateBot(sessionId: string, bot: IBotBase, botJsonTemplate: IBotType, botGenerationDetails: IBotGenerationDetails): IBotBase;
/**
* Get exp for kill by bot difficulty
* @param experience Dict of difficulties and experience
* @param botDifficulty the killed bots difficulty
* @param role Role of bot (optional, used for error logging)
* @returns Experience for kill
*/
protected getExperienceRewardForKillByDifficulty(experience: Record<string, MinMax>, botDifficulty: string, role: string): number;
/**
* Get the standing value change when player kills a bot
* @param standingForKill Dictionary of standing values keyed by bot difficulty
* @param botDifficulty Difficulty of bot to look up
* @param role Role of bot (optional, used for error logging)
* @returns Standing change value
*/
protected getStandingChangeForKillByDifficulty(standingForKill: Record<string, number>, botDifficulty: string, role: string): number;
/**
* Get the agressor bonus value when player kills a bot
* @param standingForKill Dictionary of standing values keyed by bot difficulty
* @param botDifficulty Difficulty of bot to look up
* @param role Role of bot (optional, used for error logging)
* @returns Standing change value
*/
protected getAgressorBonusByDifficulty(aggressorBonus: Record<string, number>, botDifficulty: string, role: string): number;
/**
* Set weighting of flagged equipment to 0
* @param botJsonTemplate Bot data to adjust
Expand Down
8 changes: 0 additions & 8 deletions types/generators/BotLootGenerator.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,6 @@ export declare class BotLootGenerator {
* @param botRole Role of bot (pmcBEAR/pmcUSEC)
*/
protected addForcedMedicalItemsToPmcSecure(botInventory: PmcInventory, botRole: string): void;
/**
* Get a biased random number
* @param min Smallest size
* @param max Biggest size
* @param nValue Value to bias choice
* @returns Chosen number
*/
protected getRandomisedCount(min: number, max: number, nValue: number): number;
/**
* Take random items from a pool and add to an inventory until totalItemCount or totalValueLimit or space limit is reached
* @param pool Pool of items to pick from with weight
Expand Down
6 changes: 3 additions & 3 deletions types/generators/LocationLootGenerator.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { ItemHelper } from "@spt/helpers/ItemHelper";
import { PresetHelper } from "@spt/helpers/PresetHelper";
import { IContainerMinMax, IStaticAmmoDetails, IStaticContainer, IStaticContainerData, IStaticForcedProps, IStaticLootDetails } from "@spt/models/eft/common/ILocation";
import { ILocationBase } from "@spt/models/eft/common/ILocationBase";
import { ILooseLoot, ISpawnpoint, ISpawnpointTemplate, ISpawnpointsForced } from "@spt/models/eft/common/ILooseLoot";
import { ILooseLoot, ISpawnpointTemplate, ISpawnpointsForced } from "@spt/models/eft/common/ILooseLoot";
import { IItem } from "@spt/models/eft/common/tables/IItem";
import { ILocationConfig } from "@spt/models/spt/config/ILocationConfig";
import { ILogger } from "@spt/models/spt/utils/ILogger";
Expand Down Expand Up @@ -124,15 +124,15 @@ export declare class LocationLootGenerator {
* @param forcedSpawnPoints forced Forced loot locations that must be added
* @param locationName Name of map currently having force loot created for
*/
protected addForcedLoot(lootLocationTemplates: ISpawnpointTemplate[], forcedSpawnPoints: ISpawnpointsForced[], locationName: string): void;
protected addForcedLoot(lootLocationTemplates: ISpawnpointTemplate[], forcedSpawnPoints: ISpawnpointsForced[], locationName: string, staticAmmoDist: Record<string, IStaticAmmoDetails[]>): void;
/**
* Create array of item (with child items) and return
* @param chosenComposedKey Key we want to look up items for
* @param spawnPoint Dynamic spawn point item we want will be placed in
* @param staticAmmoDist ammo distributions
* @returns IContainerItem
*/
protected createDynamicLootItem(chosenComposedKey: string, spawnPoint: ISpawnpoint, staticAmmoDist: Record<string, IStaticAmmoDetails[]>): IContainerItem;
protected createDynamicLootItem(chosenComposedKey: string, items: IItem[], staticAmmoDist: Record<string, IStaticAmmoDetails[]>): IContainerItem;
/**
* Find an item in array by its _tpl, handle differently if chosenTpl is a weapon
* @param items Items array to search
Expand Down
2 changes: 1 addition & 1 deletion types/generators/WeatherGenerator.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,5 @@ export declare class WeatherGenerator {
protected getWeightedWindSpeed(): number;
protected getWeightedFog(): number;
protected getWeightedRain(): number;
protected getRandomFloat(node: string): number;
protected getRandomFloat(node: string, precision?: number): number;
}
6 changes: 5 additions & 1 deletion types/helpers/Dialogue/SptDialogueChatBot.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,21 @@ import { ICoreConfig } from "@spt/models/spt/config/ICoreConfig";
import { IWeatherConfig } from "@spt/models/spt/config/IWeatherConfig";
import { ConfigServer } from "@spt/servers/ConfigServer";
import { GiftService } from "@spt/services/GiftService";
import { LocalisationService } from "@spt/services/LocalisationService";
import { MailSendService } from "@spt/services/MailSendService";
import { SeasonalEventService } from "@spt/services/SeasonalEventService";
import { RandomUtil } from "@spt/utils/RandomUtil";
export declare class SptDialogueChatBot implements IDialogueChatBot {
protected profileHelper: ProfileHelper;
protected randomUtil: RandomUtil;
protected mailSendService: MailSendService;
protected seasonalEventService: SeasonalEventService;
protected localisationService: LocalisationService;
protected giftService: GiftService;
protected configServer: ConfigServer;
protected coreConfig: ICoreConfig;
protected weatherConfig: IWeatherConfig;
constructor(profileHelper: ProfileHelper, randomUtil: RandomUtil, mailSendService: MailSendService, giftService: GiftService, configServer: ConfigServer);
constructor(profileHelper: ProfileHelper, randomUtil: RandomUtil, mailSendService: MailSendService, seasonalEventService: SeasonalEventService, localisationService: LocalisationService, giftService: GiftService, configServer: ConfigServer);
getChatBot(): IUserDialogInfo;
/**
* Send responses back to player when they communicate with SPT friend on friends list
Expand Down
11 changes: 11 additions & 0 deletions types/helpers/InRaidHelper.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,17 @@ export declare class InRaidHelper {
* @param postRaidProfile Profile returned by client after a raid
*/
setInventory(sessionID: string, serverProfile: IPmcData, postRaidProfile: IPmcData, isSurvived: boolean, isTransfer: boolean): void;
/**
* Remove FiR status from items
* @param items Items to process
*/
protected removeFiRStatusFromCertainItems(items: IItem[]): void;
/**
* Add items from one parameter into another
* @param itemsToAdd Items we want to add
* @param serverInventoryItems Location to add items to
*/
protected addItemsToInventory(itemsToAdd: IItem[], serverInventoryItems: IItem[]): void;
/**
* Clear PMC inventory of all items except those that are exempt
* Used post-raid to remove items after death
Expand Down
1 change: 1 addition & 0 deletions types/models/eft/common/tables/IBotBase.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ export interface IVictim {
Level: number;
Weapon: string;
Role: string;
Location: string;
}
export interface ISessionCounters {
Items: ICounterKeyValue[];
Expand Down
9 changes: 6 additions & 3 deletions types/models/eft/common/tables/IBotType.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,13 @@ export interface IDifficultyCategories {
Shoot: Record<string, string | number | boolean>;
}
export interface IExperience {
aggressorBonus: number;
/** key = bot difficulty */
aggressorBonus: Record<string, number>;
level: MinMax;
reward: MinMax;
standingForKill: number;
/** key = bot difficulty */
reward: Record<string, MinMax>;
/** key = bot difficulty */
standingForKill: Record<string, number>;
useSimpleAnimator: boolean;
}
export interface IGeneration {
Expand Down
8 changes: 4 additions & 4 deletions types/models/eft/common/tables/IItem.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ export declare enum PinLockState {
PINNED = "Pinned"
}
export interface IUpdBuff {
rarity: string;
buffType: string;
value: number;
thresholdDurability?: number;
Rarity: string;
BuffType: string;
Value: number;
ThresholdDurability?: number;
}
export interface IUpdTogglable {
On: boolean;
Expand Down
9 changes: 9 additions & 0 deletions types/models/eft/game/ISendSurveyOpinionRequest.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export interface ISendSurveyOpinionRequest {
surveyId: number;
answers: ISurveyOpinionAnswer[];
}
export interface ISurveyOpinionAnswer {
questionId: number;
answerType: string;
answers: any;
}
35 changes: 35 additions & 0 deletions types/models/eft/game/ISurveyResponseData.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
export interface ISurveyResponseData {
locale: Record<string, Record<string, string>>;
survey: ISurvey;
}
export interface ISurvey {
id: number;
welcomePageData: IWelcomePageData;
farewellPageData: IFarewellPageData;
pages: number[][];
questions: ISurveyQuestion[];
isNew: boolean;
}
export interface IWelcomePageData {
titleLocaleKey: string;
timeLocaleKey: string;
descriptionLocaleKey: string;
}
export interface IFarewellPageData {
textLocaleKey: string;
}
export interface ISurveyQuestion {
id: number;
sortIndex: number;
titleLocaleKey: string;
hintLocaleKey: string;
answerLimit: number;
answerType: string;
answers: ISurveyAnswer[];
}
export interface ISurveyAnswer {
id: number;
questionId: number;
sortIndex: number;
localeKey: string;
}

This file was deleted.

1 change: 1 addition & 0 deletions types/models/eft/hideout/IHideoutProduction.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export interface IHideoutProduction {
continuous: boolean;
count: number;
productionLimitCount: number;
isCodeProduction: boolean;
}
export interface IRequirement extends IRequirementBase {
templateId?: string;
Expand Down
3 changes: 1 addition & 2 deletions types/models/eft/inRaid/IScavSaveRequestData.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { IPostRaidPmcData } from "@spt/models/eft/common/IPmcData";
export interface IScavSaveRequestData {
profile: IPostRaidPmcData;
export interface IScavSaveRequestData extends IPostRaidPmcData {
}
9 changes: 6 additions & 3 deletions types/models/eft/match/IEndLocalRaidRequestData.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@ export interface IEndLocalRaidRequestData {
}
export interface IEndRaidResult {
profile: IPmcData;
/** "Survived/Transit etc" */
result: string;
ExitStatus: ExitStatus;
/** "Survived/Transit" etc */
result: ExitStatus;
killerId: string;
killerAid: string;
/** "Gate 3" etc */
exitName: string;
inSession: boolean;
favorite: boolean;
/** Seconds in raid */
playTime: number;
}
export interface ILocationTransit {
Expand All @@ -33,6 +34,8 @@ export interface ILocationTransit {
raidMode: string;
side: string;
dayTime: string;
/** The location player last visited */
sptLastVisitedLocation: string;
}
export interface ITransitProfile {
_id: string;
Expand Down
11 changes: 6 additions & 5 deletions types/models/enums/ExitStatis.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
export declare enum ExitStatus {
SURVIVED = 0,
KILLED = 1,
LEFT = 2,
RUNNER = 3,
MISSINGINACTION = 4
SURVIVED = "Survived",
KILLED = "Killed",
LEFT = "Left",
RUNNER = "Runner",
MISSINGINACTION = "MissingInAction",
TRANSIT = "Transit"
}
4 changes: 3 additions & 1 deletion types/models/enums/Season.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@ export declare enum Season {
AUTUMN = 1,
WINTER = 2,
SPRING = 3,
STORM = 4
AUTUMN_LATE = 4,
SPRING_EARLY = 5,
STORM = 6
}
Loading

0 comments on commit 789d4f3

Please sign in to comment.