From 3768742bc8ac3a06bfe5a9133f3a8d7c3524d12a Mon Sep 17 00:00:00 2001 From: Dev Date: Tue, 18 Jul 2023 16:53:15 +0100 Subject: [PATCH] Improvements to varous types throughout the codebase Added quest type as enum for IQuest Added missing values to QuestReward enum --- project/src/callbacks/GameCallbacks.ts | 3 ++- project/src/callbacks/MatchCallbacks.ts | 2 ++ .../src/generators/ScavCaseRewardGenerator.ts | 3 ++- project/src/helpers/HealthHelper.ts | 2 +- project/src/models/eft/common/tables/IQuest.ts | 11 ++++++++--- .../dialog/IGetMailDialogViewResponseData.ts | 4 ++-- project/src/models/enums/QuestRewardType.ts | 4 +++- project/src/models/enums/QuestTypeEnum.ts | 17 +++++++++++++++++ 8 files changed, 37 insertions(+), 9 deletions(-) create mode 100644 project/src/models/enums/QuestTypeEnum.ts diff --git a/project/src/callbacks/GameCallbacks.ts b/project/src/callbacks/GameCallbacks.ts index f381af70..1743259d 100644 --- a/project/src/callbacks/GameCallbacks.ts +++ b/project/src/callbacks/GameCallbacks.ts @@ -3,6 +3,7 @@ import { inject, injectable } from "tsyringe"; import { GameController } from "../controllers/GameController"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { ICheckVersionResponse } from "../models/eft/game/ICheckVersionResponse"; +import { ICurrentGroupResponse } from "../models/eft/game/ICurrentGroupResponse"; import { IGameConfigResponse } from "../models/eft/game/IGameConfigResponse"; import { IGameEmptyCrcRequestData } from "../models/eft/game/IGameEmptyCrcRequestData"; import { IGameKeepAliveResponse } from "../models/eft/game/IGameKeepAliveResponse"; @@ -88,7 +89,7 @@ class GameCallbacks /** * Handle client/match/group/current */ - public getCurrentGroup(url: string, info: IEmptyRequestData, sessionID: string): any + public getCurrentGroup(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData { return this.httpResponse.getBody(this.gameController.getCurrentGroup(sessionID)); } diff --git a/project/src/callbacks/MatchCallbacks.ts b/project/src/callbacks/MatchCallbacks.ts index 46531ba9..88b71f60 100644 --- a/project/src/callbacks/MatchCallbacks.ts +++ b/project/src/callbacks/MatchCallbacks.ts @@ -107,6 +107,7 @@ export class MatchCallbacks return this.httpResponse.nullResponse(); } + /** @deprecated - not called on raid start/end or game start/exit */ // eslint-disable-next-line @typescript-eslint/no-unused-vars public putMetrics(url: string, info: IPutMetricsRequestData, sessionID: string): INullResponseData { @@ -148,6 +149,7 @@ export class MatchCallbacks } /** + * @deprecated - not called on raid start/end or game start/exit * Handle client/match/group/status * @returns */ diff --git a/project/src/generators/ScavCaseRewardGenerator.ts b/project/src/generators/ScavCaseRewardGenerator.ts index 5c7ffeb3..a628ef1e 100644 --- a/project/src/generators/ScavCaseRewardGenerator.ts +++ b/project/src/generators/ScavCaseRewardGenerator.ts @@ -2,6 +2,7 @@ import { inject, injectable } from "tsyringe"; import { ItemHelper } from "../helpers/ItemHelper"; import { Product } from "../models/eft/common/tables/IBotBase"; +import { Upd } from "../models/eft/common/tables/IItem"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { IHideoutScavCase } from "../models/eft/hideout/IHideoutScavCase"; import { BaseClasses } from "../models/enums/BaseClasses"; @@ -239,7 +240,7 @@ export class ScavCaseRewardGenerator * @param item money or ammo item * @param resultItem money or ammo item with a randomise stack size */ - protected addStackCountToAmmoAndMoney(item: ITemplateItem, resultItem: { _id: string; _tpl: string; upd: any; }, rarity: string): void + protected addStackCountToAmmoAndMoney(item: ITemplateItem, resultItem: { _id: string; _tpl: string; upd: Upd; }, rarity: string): void { if (item._parent === BaseClasses.AMMO || item._parent === BaseClasses.MONEY) { diff --git a/project/src/helpers/HealthHelper.ts b/project/src/helpers/HealthHelper.ts index e799f55a..ed4c592c 100644 --- a/project/src/helpers/HealthHelper.ts +++ b/project/src/helpers/HealthHelper.ts @@ -244,7 +244,7 @@ export class HealthHelper } } - protected isEmpty(map: any): boolean + protected isEmpty(map: Record): boolean { for (const key in map) { diff --git a/project/src/models/eft/common/tables/IQuest.ts b/project/src/models/eft/common/tables/IQuest.ts index 6c7c2539..b5412b8d 100644 --- a/project/src/models/eft/common/tables/IQuest.ts +++ b/project/src/models/eft/common/tables/IQuest.ts @@ -1,9 +1,11 @@ import { QuestRewardType } from "../../../enums/QuestRewardType"; import { QuestStatus } from "../../../enums/QuestStatus"; +import { QuestTypeEnum } from "../../../enums/QuestTypeEnum"; import { Item } from "./IItem"; export interface IQuest { + /** SPT addition - human readable quest name */ QuestName?: string _id: string canShowNotificationsInGame: boolean @@ -15,9 +17,10 @@ export interface IQuest traderId: string location: string image: string - type: string + type: QuestTypeEnum isKey: boolean - questStatus: any + /** @deprecated - Likely not used, use 'status' instead */ + questStatus: QuestStatus restartable: boolean instantComplete: boolean secretQuest: boolean @@ -25,12 +28,14 @@ export interface IQuest successMessageText: string templateId: string rewards: Rewards + /** Becomes 'AppearStatus' inside client */ status: string | number KeyQuest: boolean changeQuestMessageText: string + /** "Pmc" or "Scav" */ side: string } - + export interface Conditions { Started: AvailableForConditions[] diff --git a/project/src/models/eft/dialog/IGetMailDialogViewResponseData.ts b/project/src/models/eft/dialog/IGetMailDialogViewResponseData.ts index 6b26e071..68826cc2 100644 --- a/project/src/models/eft/dialog/IGetMailDialogViewResponseData.ts +++ b/project/src/models/eft/dialog/IGetMailDialogViewResponseData.ts @@ -1,8 +1,8 @@ -import { Message } from "../profile/IAkiProfile"; +import { IUserDialogInfo, Message } from "../profile/IAkiProfile"; export interface IGetMailDialogViewResponseData { messages: Message[] - profiles: any[] + profiles: IUserDialogInfo[] hasMessagesWithRewards: boolean } \ No newline at end of file diff --git a/project/src/models/enums/QuestRewardType.ts b/project/src/models/enums/QuestRewardType.ts index 506fd29b..137e87de 100644 --- a/project/src/models/enums/QuestRewardType.ts +++ b/project/src/models/enums/QuestRewardType.ts @@ -6,5 +6,7 @@ export enum QuestRewardType TRADER_UNLOCK = "TraderUnlock", ITEM = "Item", ASSORTMENT_UNLOCK = "AssortmentUnlock", - PRODUCTIONS_SCHEME = "ProductionScheme" + PRODUCTIONS_SCHEME = "ProductionScheme", + TRADER_STANDING_RESET = "TraderStandingReset", + TRADER_STANDING_RESTORE = "TraderStandingRestore" } \ No newline at end of file diff --git a/project/src/models/enums/QuestTypeEnum.ts b/project/src/models/enums/QuestTypeEnum.ts new file mode 100644 index 00000000..38b0fcdd --- /dev/null +++ b/project/src/models/enums/QuestTypeEnum.ts @@ -0,0 +1,17 @@ + +export enum QuestTypeEnum + { + PICKUP = "PickUp", + ELIMINATION = "Elimination", + DISCOVER = "Discover", + COMPLETION = "Completion", + EXPLORATION = "Exploration", + LEVELLING = "Levelling", + EXPERIENCE = "Experience", + STANDING = "Standing", + LOYALTY = "Loyalty", + MERCHANT = "Merchant", + SKILL = "Skill", + MULTI = "Multi", + WEAPON_ASSEMBLY = "WeaponAssembly" +}