Skip to content

Commit

Permalink
Update types
Browse files Browse the repository at this point in the history
  • Loading branch information
Lacyway committed Dec 16, 2024
1 parent 83c474a commit 988458e
Show file tree
Hide file tree
Showing 21 changed files with 251 additions and 31 deletions.
4 changes: 3 additions & 1 deletion types/callbacks/SaveCallbacks.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ import { OnUpdate } from "@spt/di/OnUpdate";
import { ICoreConfig } from "@spt/models/spt/config/ICoreConfig";
import { ConfigServer } from "@spt/servers/ConfigServer";
import { SaveServer } from "@spt/servers/SaveServer";
import { BackupService } from "@spt/services/BackupService";
export declare class SaveCallbacks implements OnLoad, OnUpdate {
protected saveServer: SaveServer;
protected configServer: ConfigServer;
protected backupService: BackupService;
protected coreConfig: ICoreConfig;
constructor(saveServer: SaveServer, configServer: ConfigServer);
constructor(saveServer: SaveServer, configServer: ConfigServer, backupService: BackupService);
onLoad(): Promise<void>;
getRoute(): string;
onUpdate(secondsSinceLastRun: number): Promise<boolean>;
Expand Down
9 changes: 8 additions & 1 deletion types/controllers/DialogueController.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { IDialogueChatBot } from "@spt/helpers/Dialogue/IDialogueChatBot";
import { DialogueHelper } from "@spt/helpers/DialogueHelper";
import { NotificationSendHelper } from "@spt/helpers/NotificationSendHelper";
import { ProfileHelper } from "@spt/helpers/ProfileHelper";
import { IDeleteFriendRequest } from "@spt/models/eft/dialog/IDeleteFriendRequest";
import { IFriendRequestData } from "@spt/models/eft/dialog/IFriendRequestData";
import { IFriendRequestSendResponse } from "@spt/models/eft/dialog/IFriendRequestSendResponse";
import { IGetAllAttachmentsResponse } from "@spt/models/eft/dialog/IGetAllAttachmentsResponse";
Expand All @@ -20,11 +23,13 @@ export declare class DialogueController {
protected saveServer: SaveServer;
protected timeUtil: TimeUtil;
protected dialogueHelper: DialogueHelper;
protected notificationSendHelper: NotificationSendHelper;
protected profileHelper: ProfileHelper;
protected mailSendService: MailSendService;
protected localisationService: LocalisationService;
protected configServer: ConfigServer;
protected dialogueChatBots: IDialogueChatBot[];
constructor(logger: ILogger, saveServer: SaveServer, timeUtil: TimeUtil, dialogueHelper: DialogueHelper, mailSendService: MailSendService, localisationService: LocalisationService, configServer: ConfigServer, dialogueChatBots: IDialogueChatBot[]);
constructor(logger: ILogger, saveServer: SaveServer, timeUtil: TimeUtil, dialogueHelper: DialogueHelper, notificationSendHelper: NotificationSendHelper, profileHelper: ProfileHelper, mailSendService: MailSendService, localisationService: LocalisationService, configServer: ConfigServer, dialogueChatBots: IDialogueChatBot[]);
registerChatBot(chatBot: IDialogueChatBot): void;
/** Handle onUpdate spt event */
update(): void;
Expand Down Expand Up @@ -151,4 +156,6 @@ export declare class DialogueController {
protected messageHasExpired(message: IMessage): boolean;
/** Handle client/friend/request/send */
sendFriendRequest(sessionID: string, request: IFriendRequestData): IFriendRequestSendResponse;
/** Handle client/friend/delete */
deleteFriend(sessionID: string, request: IDeleteFriendRequest): void;
}
2 changes: 1 addition & 1 deletion types/controllers/QuestController.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export declare class QuestController {
*/
protected addTaskConditionCountersToProfile(questConditions: IQuestCondition[], pmcData: IPmcData, questId: string): void;
/**
* TODO - Move this code into RepeatableQuestController
* Handle the client accepting a repeatable quest and starting it
* Send starting rewards if any to player and
* Send start notification if any to player
Expand All @@ -81,7 +82,6 @@ export declare class QuestController {
* @returns IItemEventRouterResponse
*/
acceptRepeatableQuest(pmcData: IPmcData, acceptedQuest: IAcceptQuestRequestData, sessionID: string): IItemEventRouterResponse;
protected createAcceptedQuestClientResponse(sessionID: string, pmcData: IPmcData, repeatableQuestProfile: IRepeatableQuest): IItemEventRouterResponse;
/**
* Look for an accepted quest inside player profile, return matching
* @param pmcData Profile to search through
Expand Down
14 changes: 13 additions & 1 deletion types/controllers/RepeatableQuestController.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,26 @@ export declare class RepeatableQuestController {
* @returns IItemEventRouterResponse
*/
changeRepeatableQuest(pmcData: IPmcData, changeRequest: IRepeatableQuestChangeRequest, sessionID: string): IItemEventRouterResponse;
/**
* Remove the provided quest from pmc and scav character profiles
* @param fullProfile Profile to remove quest from
* @param questToReplaceId Quest id to remove from profile
*/
protected removeQuestFromProfile(fullProfile: ISptProfile, questToReplaceId: string): void;
/**
* Clean up the repeatables `changeRequirement` dictionary of expired data
* @param repeatablesOfTypeInProfile The repeatables that have the replaced and new quest
* @param replacedQuestId Id of the replaced quest
*/
protected cleanUpRepeatableChangeRequirements(repeatablesOfTypeInProfile: IPmcDataRepeatableQuest, replacedQuestId: string): void;
/**
* Find a repeatable (daily/weekly/scav) from a players profile by its id
* @param questId Id of quest to find
* @param pmcData Profile that contains quests to look through
* @returns IGetRepeatableByIdResult
*/
protected getRepeatableById(questId: string, pmcData: IPmcData): IGetRepeatableByIdResult;
protected attemptToGenerateRepeatableQuest(pmcData: IPmcData, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest;
protected attemptToGenerateRepeatableQuest(sessionId: string, pmcData: IPmcData, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest;
/**
* Some accounts have access to free repeatable quest refreshes
* Track the usage of them inside players profile
Expand Down
13 changes: 7 additions & 6 deletions types/generators/RepeatableQuestGenerator.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,14 @@ export declare class RepeatableQuestGenerator {
/**
* This method is called by /GetClientRepeatableQuests/ and creates one element of quest type format (see assets/database/templates/repeatableQuests.json).
* It randomly draws a quest type (currently Elimination, Completion or Exploration) as well as a trader who is providing the quest
* @param sessionId Session id
* @param pmcLevel Player's level for requested items and reward generation
* @param pmcTraderInfo Players traper standing/rep levels
* @param questTypePool Possible quest types pool
* @param repeatableConfig Repeatable quest config
* @returns IRepeatableQuest
*/
generateRepeatableQuest(pmcLevel: number, pmcTraderInfo: Record<string, ITraderInfo>, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest;
generateRepeatableQuest(sessionId: string, pmcLevel: number, pmcTraderInfo: Record<string, ITraderInfo>, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest;
/**
* Generate a randomised Elimination quest
* @param pmcLevel Player's level for requested items and reward generation
Expand All @@ -48,7 +49,7 @@ export declare class RepeatableQuestGenerator {
* @param repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest
* @returns Object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json)
*/
protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest;
protected generateEliminationQuest(sessionid: string, pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest;
/**
* Get a number of kills neded to complete elimination quest
* @param targetKey Target type desired e.g. anyPmc/bossBully/Savage
Expand Down Expand Up @@ -83,7 +84,7 @@ export declare class RepeatableQuestGenerator {
* @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest
* @returns {object} object of quest type format for "Completion" (see assets/database/templates/repeatableQuests.json)
*/
protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest;
protected generateCompletionQuest(sessionId: string, pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest;
/**
* A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json)
* This is a helper method for GenerateCompletionQuest to create a completion condition (of which a completion quest theoretically can have many)
Expand All @@ -102,15 +103,15 @@ export declare class RepeatableQuestGenerator {
* @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest
* @returns {object} object of quest type format for "Exploration" (see assets/database/templates/repeatableQuests.json)
*/
protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest;
protected generateExplorationQuest(sessionId: string, pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest;
/**
* Filter a maps exits to just those for the desired side
* @param locationKey Map id (e.g. factory4_day)
* @param playerSide Scav/Pmc
* @returns Array of Exit objects
*/
protected getLocationExitsForSide(locationKey: string, playerSide: string): IExit[];
protected generatePickupQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest;
protected generatePickupQuest(sessionId: string, pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest;
/**
* Convert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567)
* @param locationKey e.g factory4_day
Expand All @@ -135,5 +136,5 @@ export declare class RepeatableQuestGenerator {
* @returns {object} Object which contains the base elements for repeatable quests of the requests type
* (needs to be filled with reward and conditions by called to make a valid quest)
*/
protected generateRepeatableTemplate(type: string, traderId: string, side: string): IRepeatableQuest;
protected generateRepeatableTemplate(type: string, traderId: string, side: string, sessionId: string): IRepeatableQuest;
}
8 changes: 5 additions & 3 deletions types/generators/RepeatableQuestRewardGenerator.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@ import { DatabaseService } from "@spt/services/DatabaseService";
import { ItemFilterService } from "@spt/services/ItemFilterService";
import { LocalisationService } from "@spt/services/LocalisationService";
import { SeasonalEventService } from "@spt/services/SeasonalEventService";
import { HashUtil } from "@spt/utils/HashUtil";
import { MathUtil } from "@spt/utils/MathUtil";
import { ObjectId } from "@spt/utils/ObjectId";
import { RandomUtil } from "@spt/utils/RandomUtil";
import { ICloner } from "@spt/utils/cloners/ICloner";
export declare class RepeatableQuestRewardGenerator {
protected logger: ILogger;
protected randomUtil: RandomUtil;
protected hashUtil: HashUtil;
protected mathUtil: MathUtil;
protected databaseService: DatabaseService;
protected itemHelper: ItemHelper;
Expand All @@ -31,7 +33,7 @@ export declare class RepeatableQuestRewardGenerator {
protected configServer: ConfigServer;
protected cloner: ICloner;
protected questConfig: IQuestConfig;
constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, databaseService: DatabaseService, itemHelper: ItemHelper, presetHelper: PresetHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, objectId: ObjectId, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer, cloner: ICloner);
constructor(logger: ILogger, randomUtil: RandomUtil, hashUtil: HashUtil, mathUtil: MathUtil, databaseService: DatabaseService, itemHelper: ItemHelper, presetHelper: PresetHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, objectId: ObjectId, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer, cloner: ICloner);
/**
* Generate the reward for a mission. A reward can consist of:
* - Experience
Expand Down Expand Up @@ -127,7 +129,7 @@ export declare class RepeatableQuestRewardGenerator {
* @param preset Optional array of preset items
* @returns {object} Object of "Reward"-item-type
*/
protected generateItemReward(tpl: string, count: number, index: number): IQuestReward;
protected generateItemReward(tpl: string, count: number, index: number, foundInRaid?: boolean): IQuestReward;
/**
* Helper to create a reward item structured as required by the client
*
Expand All @@ -137,7 +139,7 @@ export declare class RepeatableQuestRewardGenerator {
* @param preset Optional array of preset items
* @returns {object} Object of "Reward"-item-type
*/
protected generatePresetReward(tpl: string, count: number, index: number, preset?: IItem[]): IQuestReward;
protected generatePresetReward(tpl: string, count: number, index: number, preset?: IItem[], foundInRaid?: boolean): IQuestReward;
/**
* Picks rewardable items from items.json
* This means they must:
Expand Down
19 changes: 19 additions & 0 deletions types/helpers/ProfileHelper.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { ItemHelper } from "@spt/helpers/ItemHelper";
import { IPmcData } from "@spt/models/eft/common/IPmcData";
import { Common, ICounterKeyValue, IStats } from "@spt/models/eft/common/tables/IBotBase";
import { IItem } from "@spt/models/eft/common/tables/IItem";
import { ISearchFriendResponse } from "@spt/models/eft/profile/ISearchFriendResponse";
import { ISptProfile } from "@spt/models/eft/profile/ISptProfile";
import { IValidateNicknameRequestData } from "@spt/models/eft/profile/IValidateNicknameRequestData";
import { BonusType } from "@spt/models/enums/BonusType";
Expand Down Expand Up @@ -90,6 +91,24 @@ export declare class ProfileHelper {
* @returns ISptProfile object
*/
getFullProfile(sessionID: string): ISptProfile | undefined;
/**
* Get full representation of a players profile JSON by the account ID, or undefined if not found
* @param accountId Account ID to find
* @returns
*/
getFullProfileByAccountId(accountID: string): ISptProfile | undefined;
/**
* Retrieve a ChatRoomMember formatted profile for the given session ID
* @param sessionID The session ID to return the profile for
* @returns
*/
getChatRoomMemberFromSessionId(sessionID: string): ISearchFriendResponse | undefined;
/**
* Retrieve a ChatRoomMember formatted profile for the given PMC profile data
* @param pmcProfile The PMC profile data to format into a ChatRoomMember structure
* @returns
*/
getChatRoomMemberFromPmcProfile(pmcProfile: IPmcData): ISearchFriendResponse;
/**
* Get a PMC profile by its session id
* @param sessionID Profile id to return
Expand Down
7 changes: 7 additions & 0 deletions types/models/eft/common/tables/IQuest.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ export interface IQuest {
changeQuestMessageText: string;
/** "Pmc" or "Scav" */
side: string;
acceptanceAndFinishingSource: string;
progressSource: string;
rankingModes: string[];
gameModes: string[];
arenaLocations: string[];
/** Status of quest to player */
sptStatus?: QuestStatus;
}
Expand Down Expand Up @@ -148,8 +153,10 @@ export interface IQuestReward {
loyaltyLevel?: number;
/** Hideout area id */
traderId?: string;
isEncoded?: boolean;
unknown?: boolean;
findInRaid?: boolean;
gameMode?: string[];
/** Game editions whitelisted to get reward */
availableInGameEditions?: string[];
/** Game editions blacklisted from getting reward */
Expand Down
14 changes: 14 additions & 0 deletions types/models/eft/common/tables/IRepeatableQuests.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,27 @@ export interface IRepeatableQuest extends IQuest {
changeCost: IChangeCost[];
changeStandingCost: number;
sptRepatableGroupName: string;
acceptanceAndFinishingSource: string;
progressSource: string;
rankingModes: string[];
gameModes: string[];
arenaLocations: string[];
questStatus: IRepeatableQuestStatus;
}
export interface IRepeatableQuestDatabase {
templates: IRepeatableTemplates;
rewards: IRewardOptions;
data: IOptions;
samples: ISampleQuests[];
}
export interface IRepeatableQuestStatus {
id: string;
uid: string;
qid: string;
startTime: number;
status: number;
statusTimers: any;
}
export interface IRepeatableTemplates {
Elimination: IQuest;
Completion: IQuest;
Expand Down
2 changes: 1 addition & 1 deletion types/models/eft/profile/IGetOtherProfileResponse.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export interface IGetOtherProfileResponse {
skills: ISkills;
equipment: IOtherProfileEquipment;
achievements: Record<string, number>;
favoriteItems: string[];
favoriteItems: IItem[];
pmcStats: IOtherProfileStats;
scavStats: IOtherProfileStats;
}
Expand Down
1 change: 1 addition & 0 deletions types/models/eft/profile/ISearchFriendResponse.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ export interface Info {
Side: string;
Level: number;
MemberCategory: number;
SelectedMemberCategory: number;
}
2 changes: 2 additions & 0 deletions types/models/eft/profile/ISptProfile.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ export interface ISptProfile {
traderPurchases?: Record<string, Record<string, ITraderPurchaseData>>;
/** Achievements earned by player */
achievements: Record<string, number>;
/** List of friend profile IDs */
friends: string[];
}
export declare class ITraderPurchaseData {
count: number;
Expand Down
5 changes: 5 additions & 0 deletions types/models/eft/ws/IWsFriendsListAccept.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { IWsNotificationEvent } from "@spt/models/eft/ws/IWsNotificationEvent";
import { ISearchFriendResponse } from "../profile/ISearchFriendResponse";
export interface IWsFriendsListAccept extends IWsNotificationEvent {
profile: ISearchFriendResponse;
}
2 changes: 1 addition & 1 deletion types/models/eft/ws/IWsNotificationEvent.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export interface IWsNotificationEvent {
type: string;
eventId: string;
eventId?: string;
}
1 change: 1 addition & 0 deletions types/models/enums/ConfigTypes.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export declare enum ConfigTypes {
AIRDROP = "spt-airdrop",
BACKUP = "spt-backup",
BOT = "spt-bot",
PMC = "spt-pmc",
CORE = "spt-core",
Expand Down
12 changes: 12 additions & 0 deletions types/models/spt/config/IBackupConfig.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { IBaseConfig } from "@spt/models/spt/config/IBaseConfig";
export interface IBackupConfig extends IBaseConfig {
kind: "spt-backup";
enabled: boolean;
maxBackups: number;
directory: string;
backupInterval: IBackupConfigInterval;
}
export interface IBackupConfigInterval {
enabled: boolean;
intervalMinutes: number;
}
2 changes: 2 additions & 0 deletions types/models/spt/config/IItemConfig.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ export interface IItemConfig extends IBaseConfig {
lootableItemBlacklist: string[];
/** items that should not be given as rewards */
rewardItemBlacklist: string[];
/** Item base types that should not be given as rewards */
rewardItemTypeBlacklist: string[];
/** Items that can only be found on bosses */
bossItems: string[];
handbookPriceOverride: Record<string, IHandbookPriceOverride>;
Expand Down
Loading

0 comments on commit 988458e

Please sign in to comment.