diff --git a/TypeScript/10ScopesAndTypes/types/callbacks/BotCallbacks.d.ts b/TypeScript/10ScopesAndTypes/types/callbacks/BotCallbacks.d.ts index 2db60dc..827015e 100644 --- a/TypeScript/10ScopesAndTypes/types/callbacks/BotCallbacks.d.ts +++ b/TypeScript/10ScopesAndTypes/types/callbacks/BotCallbacks.d.ts @@ -8,8 +8,29 @@ export declare class BotCallbacks { protected botController: BotController; protected httpResponse: HttpResponseUtil; constructor(botController: BotController, httpResponse: HttpResponseUtil); + /** + * Handle singleplayer/settings/bot/limit + * @returns string + */ getBotLimit(url: string, info: IEmptyRequestData, sessionID: string): string; + /** + * Handle singleplayer/settings/bot/difficulty + * @returns string + */ getBotDifficulty(url: string, info: IEmptyRequestData, sessionID: string): string; + /** + * Handle client/game/bot/generate + * @returns IGetBodyResponseData + */ generateBots(url: string, info: IGenerateBotsRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle singleplayer/settings/bot/maxCap + * @returns string + */ getBotCap(): string; + /** + * Handle singleplayer/settings/bot/getBotBehaviours + * @returns string + */ + getBotBehaviours(): string; } diff --git a/TypeScript/10ScopesAndTypes/types/callbacks/CustomizationCallbacks.d.ts b/TypeScript/10ScopesAndTypes/types/callbacks/CustomizationCallbacks.d.ts index 3bab8c0..75d5701 100644 --- a/TypeScript/10ScopesAndTypes/types/callbacks/CustomizationCallbacks.d.ts +++ b/TypeScript/10ScopesAndTypes/types/callbacks/CustomizationCallbacks.d.ts @@ -3,6 +3,7 @@ import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { IPmcData } from "../models/eft/common/IPmcData"; import { ISuit } from "../models/eft/common/tables/ITrader"; import { IBuyClothingRequestData } from "../models/eft/customization/IBuyClothingRequestData"; +import { IGetSuitsResponse } from "../models/eft/customization/IGetSuitsResponse"; import { IWearClothingRequestData } from "../models/eft/customization/IWearClothingRequestData"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; @@ -13,10 +14,15 @@ export declare class CustomizationCallbacks { protected saveServer: SaveServer; protected httpResponse: HttpResponseUtil; constructor(customizationController: CustomizationController, saveServer: SaveServer, httpResponse: HttpResponseUtil); - getSuits(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<{ - _id: string; - suites: string[]; - }>; + /** + * Handles client/trading/customization/storage + * @returns + */ + getSuits(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handles client/trading/customization + * @returns ISuit[] + */ getTraderSuits(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; wearClothing(pmcData: IPmcData, body: IWearClothingRequestData, sessionID: string): IItemEventRouterResponse; buyClothing(pmcData: IPmcData, body: IBuyClothingRequestData, sessionID: string): IItemEventRouterResponse; diff --git a/TypeScript/10ScopesAndTypes/types/callbacks/DataCallbacks.d.ts b/TypeScript/10ScopesAndTypes/types/callbacks/DataCallbacks.d.ts index 04566ff..2efcf81 100644 --- a/TypeScript/10ScopesAndTypes/types/callbacks/DataCallbacks.d.ts +++ b/TypeScript/10ScopesAndTypes/types/callbacks/DataCallbacks.d.ts @@ -12,15 +12,42 @@ import { ILanguageBase } from "../models/spt/server/ILocaleBase"; import { ISettingsBase } from "../models/spt/server/ISettingsBase"; import { DatabaseServer } from "../servers/DatabaseServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +/** + * Handle client requests + */ export declare class DataCallbacks { protected httpResponse: HttpResponseUtil; protected databaseServer: DatabaseServer; constructor(httpResponse: HttpResponseUtil, databaseServer: DatabaseServer); + /** + * Handles client/settings + * @returns ISettingsBase + */ getSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handles client/globals + * @returns IGlobals + */ getGlobals(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handles client/items + * @returns string + */ getTemplateItems(url: string, info: IEmptyRequestData, sessionID: string): string; + /** + * Handles client/handbook/templates + * @returns IHandbookBase + */ getTemplateHandbook(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handles client/customization + * @returns Record>; + /** + * Handles client/account/customization + * @returns string[] + */ getTemplateCharacter(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getTemplateQuests(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getHideoutSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; @@ -28,6 +55,6 @@ export declare class DataCallbacks { gethideoutProduction(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getHideoutScavcase(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getLocalesLanguages(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - getLocalesMenu(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + getLocalesMenu(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getLocalesGlobal(url: string, info: IEmptyRequestData, sessionID: string): string; } diff --git a/TypeScript/10ScopesAndTypes/types/callbacks/DialogueCallbacks.d.ts b/TypeScript/10ScopesAndTypes/types/callbacks/DialogueCallbacks.d.ts index 634f90b..7b2eeae 100644 --- a/TypeScript/10ScopesAndTypes/types/callbacks/DialogueCallbacks.d.ts +++ b/TypeScript/10ScopesAndTypes/types/callbacks/DialogueCallbacks.d.ts @@ -26,15 +26,27 @@ export declare class DialogueCallbacks extends OnUpdate { protected httpResponse: HttpResponseUtil; protected dialogueController: DialogueController; constructor(hashUtil: HashUtil, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, dialogueController: DialogueController); + /** + * Handles client/friend/list + * @returns IGetFriendListDataResponse + */ getFriendList(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handles client/chatServer/list + * @returns + */ getChatServerList(url: string, info: IGetChatServerListRequestData, sessionID: string): IGetBodyResponseData; getMailDialogList(url: string, info: IGetMailDialogListRequestData, sessionID: string): IGetBodyResponseData; getMailDialogView(url: string, info: IGetMailDialogViewRequestData, sessionID: string): IGetBodyResponseData; - getMailDialogInfo(url: string, info: IGetMailDialogInfoRequestData, sessionID: string): IGetBodyResponseData; + getMailDialogInfo(url: string, info: IGetMailDialogInfoRequestData, sessionID: string): IGetBodyResponseData; removeDialog(url: string, info: IRemoveDialogRequestData, sessionID: string): IGetBodyResponseData; pinDialog(url: string, info: IPinDialogRequestData, sessionID: string): IGetBodyResponseData; unpinDialog(url: string, info: IPinDialogRequestData, sessionID: string): IGetBodyResponseData; setRead(url: string, info: ISetDialogReadRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handles client/mail/dialog/getAllAttachments + * @returns IGetAllAttachmentsResponse + */ getAllAttachments(url: string, info: IGetAllAttachmentsRequestData, sessionID: string): IGetBodyResponseData; listOutbox(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; listInbox(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; diff --git a/TypeScript/10ScopesAndTypes/types/callbacks/GameCallbacks.d.ts b/TypeScript/10ScopesAndTypes/types/callbacks/GameCallbacks.d.ts index 5e4c240..3a6b7e6 100644 --- a/TypeScript/10ScopesAndTypes/types/callbacks/GameCallbacks.d.ts +++ b/TypeScript/10ScopesAndTypes/types/callbacks/GameCallbacks.d.ts @@ -3,6 +3,9 @@ import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { ICheckVersionResponse } from "../models/eft/game/ICheckVersionResponse"; import { IGameConfigResponse } from "../models/eft/game/IGameConfigResponse"; import { IGameEmptyCrcRequestData } from "../models/eft/game/IGameEmptyCrcRequestData"; +import { IGameKeepAliveResponse } from "../models/eft/game/IGameKeepAliveResponse"; +import { IGameLogoutResponseData } from "../models/eft/game/IGameLogoutResponseData"; +import { IGameStartResponse } from "../models/eft/game/IGameStartResponse"; import { IReportNicknameRequestData } from "../models/eft/game/IReportNicknameRequestData"; import { IServerDetails } from "../models/eft/game/IServerDetails"; import { IVersionValidateRequestData } from "../models/eft/game/IVersionValidateRequestData"; @@ -15,13 +18,37 @@ declare class GameCallbacks { protected watermark: Watermark; protected gameController: GameController; constructor(httpResponse: HttpResponseUtil, watermark: Watermark, gameController: GameController); + /** + * Handle client/game/version/validate + * @returns INullResponseData + */ versionValidate(url: string, info: IVersionValidateRequestData, sessionID: string): INullResponseData; - gameStart(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - gameLogout(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/game/start + * @returns IGameStartResponse + */ + gameStart(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/game/logout + * @returns IGameLogoutResponseData + */ + gameLogout(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/game/config + * @returns IGameConfigResponse + */ getGameConfig(url: string, info: IGameEmptyCrcRequestData, sessionID: string): IGetBodyResponseData; getServer(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; validateGameVersion(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - gameKeepalive(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/game/keepalive + * @returns IGameKeepAliveResponse + */ + gameKeepalive(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle singleplayer/settings/version + * @returns string + */ getVersion(url: string, info: IEmptyRequestData, sessionID: string): string; reportNickname(url: string, info: IReportNicknameRequestData, sessionID: string): INullResponseData; } diff --git a/TypeScript/10ScopesAndTypes/types/callbacks/HealthCallbacks.d.ts b/TypeScript/10ScopesAndTypes/types/callbacks/HealthCallbacks.d.ts index 8672be7..7edf03e 100644 --- a/TypeScript/10ScopesAndTypes/types/callbacks/HealthCallbacks.d.ts +++ b/TypeScript/10ScopesAndTypes/types/callbacks/HealthCallbacks.d.ts @@ -21,7 +21,19 @@ export declare class HealthCallbacks { * @returns empty response, no data sent back to client */ syncHealth(url: string, info: ISyncHealthRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle Eat + * @returns IItemEventRouterResponse + */ offraidEat(pmcData: IPmcData, body: IOffraidEatRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle Heal + * @returns IItemEventRouterResponse + */ offraidHeal(pmcData: IPmcData, body: IOffraidHealRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle RestoreHealth + * @returns IItemEventRouterResponse + */ healthTreatment(pmcData: IPmcData, info: IHealthTreatmentRequestData, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/10ScopesAndTypes/types/callbacks/HideoutCallbacks.d.ts b/TypeScript/10ScopesAndTypes/types/callbacks/HideoutCallbacks.d.ts index 99ab4c9..e39e806 100644 --- a/TypeScript/10ScopesAndTypes/types/callbacks/HideoutCallbacks.d.ts +++ b/TypeScript/10ScopesAndTypes/types/callbacks/HideoutCallbacks.d.ts @@ -19,14 +19,77 @@ export declare class HideoutCallbacks extends OnUpdate { protected hideoutConfig: IHideoutConfig; constructor(hideoutController: HideoutController, // TODO: delay needed configServer: ConfigServer); + /** + * Handle HideoutUpgrade + * @param pmcData + * @param body + * @param sessionID + * @returns + */ upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutUpgradeComplete + * @param pmcData + * @param body + * @param sessionID + * @returns + */ upgradeComplete(pmcData: IPmcData, body: IHideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutPutItemsInAreaSlots + * @param pmcData + * @param body + * @param sessionID + * @returns + */ putItemsInAreaSlots(pmcData: IPmcData, body: IHideoutPutItemInRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutTakeItemsFromAreaSlots + * @param pmcData + * @param body + * @param sessionID + * @returns + */ takeItemsFromAreaSlots(pmcData: IPmcData, body: IHideoutTakeItemOutRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutToggleArea + * @param pmcData + * @param body + * @param sessionID + * @returns + */ toggleArea(pmcData: IPmcData, body: IHideoutToggleAreaRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutSingleProductionStart + * @param pmcData + * @param body + * @param sessionID + * @returns + */ singleProductionStart(pmcData: IPmcData, body: IHideoutSingleProductionStartRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutScavCaseProductionStart + * @param pmcData + * @param body + * @param sessionID + * @returns + */ scavCaseProductionStart(pmcData: IPmcData, body: IHideoutScavCaseStartRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutContinuousProductionStart + * @param pmcData + * @param body + * @param sessionID + * @returns + */ continuousProductionStart(pmcData: IPmcData, body: IHideoutContinousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutTakeProduction + * @param pmcData + * @param body + * @param sessionID + * @returns + */ takeProduction(pmcData: IPmcData, body: IHideoutTakeProductionRequestData, sessionID: string): IItemEventRouterResponse; onUpdate(timeSinceLastRun: number): boolean; getRoute(): string; diff --git a/TypeScript/10ScopesAndTypes/types/callbacks/InraidCallbacks.d.ts b/TypeScript/10ScopesAndTypes/types/callbacks/InraidCallbacks.d.ts index 05bcce4..918bfaf 100644 --- a/TypeScript/10ScopesAndTypes/types/callbacks/InraidCallbacks.d.ts +++ b/TypeScript/10ScopesAndTypes/types/callbacks/InraidCallbacks.d.ts @@ -1,23 +1,49 @@ import { InraidController } from "../controllers/InraidController"; -import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { INullResponseData } from "../models/eft/httpResponse/INullResponseData"; import { IRegisterPlayerRequestData } from "../models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; -import { IAirdropConfig } from "../models/spt/config/IAirdropConfig"; -import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; -import { ConfigServer } from "../servers/ConfigServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +/** + * Handle client requests + */ export declare class InraidCallbacks { protected inraidController: InraidController; protected httpResponse: HttpResponseUtil; - protected configServer: ConfigServer; - protected airdropConfig: IAirdropConfig; - protected inraidConfig: IInRaidConfig; - constructor(inraidController: InraidController, httpResponse: HttpResponseUtil, configServer: ConfigServer); + constructor(inraidController: InraidController, httpResponse: HttpResponseUtil); + /** + * Handle client/location/getLocalloot + * @param url + * @param info register player request + * @param sessionID Session id + * @returns Null http response + */ registerPlayer(url: string, info: IRegisterPlayerRequestData, sessionID: string): INullResponseData; + /** + * Handle raid/profile/save + * @param url + * @param info Save progress request + * @param sessionID Session id + * @returns Null http response + */ saveProgress(url: string, info: ISaveProgressRequestData, sessionID: string): INullResponseData; + /** + * Handle singleplayer/settings/raid/endstate + * @returns + */ getRaidEndState(): string; - getRaidMenuSettings(url: string, info: IEmptyRequestData, sessionID: string): string; - getWeaponDurability(url: string, info: any, sessionID: string): string; - getAirdropConfig(url: string, info: any, sessionID: string): string; + /** + * Handle singleplayer/settings/raid/menu + * @returns JSON as string + */ + getRaidMenuSettings(): string; + /** + * Handle singleplayer/settings/weapon/durability + * @returns + */ + getWeaponDurability(): string; + /** + * Handle singleplayer/airdrop/config + * @returns JSON as string + */ + getAirdropConfig(): string; } diff --git a/TypeScript/10ScopesAndTypes/types/callbacks/InsuranceCallbacks.d.ts b/TypeScript/10ScopesAndTypes/types/callbacks/InsuranceCallbacks.d.ts index 8835ba2..a171e1c 100644 --- a/TypeScript/10ScopesAndTypes/types/callbacks/InsuranceCallbacks.d.ts +++ b/TypeScript/10ScopesAndTypes/types/callbacks/InsuranceCallbacks.d.ts @@ -17,7 +17,15 @@ export declare class InsuranceCallbacks extends OnUpdate { protected configServer: ConfigServer; protected insuranceConfig: IInsuranceConfig; constructor(insuranceController: InsuranceController, insuranceService: InsuranceService, httpResponse: HttpResponseUtil, configServer: ConfigServer); + /** + * Handle client/insurance/items/list/cost + * @returns IGetInsuranceCostResponseData + */ getInsuranceCost(url: string, info: IGetInsuranceCostRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle Insure + * @returns IItemEventRouterResponse + */ insure(pmcData: IPmcData, body: IInsureRequestData, sessionID: string): IItemEventRouterResponse; onUpdate(secondsSinceLastRun: number): boolean; getRoute(): string; diff --git a/TypeScript/10ScopesAndTypes/types/callbacks/InventoryCallbacks.d.ts b/TypeScript/10ScopesAndTypes/types/callbacks/InventoryCallbacks.d.ts index 9ab1486..46bf6fd 100644 --- a/TypeScript/10ScopesAndTypes/types/callbacks/InventoryCallbacks.d.ts +++ b/TypeScript/10ScopesAndTypes/types/callbacks/InventoryCallbacks.d.ts @@ -16,6 +16,7 @@ import { IInventorySwapRequestData } from "../models/eft/inventory/IInventorySwa import { IInventoryTagRequestData } from "../models/eft/inventory/IInventoryTagRequestData"; import { IInventoryToggleRequestData } from "../models/eft/inventory/IInventoryToggleRequestData"; import { IInventoryTransferRequestData } from "../models/eft/inventory/IInventoryTransferRequestData"; +import { IOpenRandomLootContainerRequestData } from "../models/eft/inventory/IOpenRandomLootContainerRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; export declare class InventoryCallbacks { protected inventoryController: InventoryController; @@ -36,4 +37,5 @@ export declare class InventoryCallbacks { createMapMarker(pmcData: IPmcData, body: IInventoryCreateMarkerRequestData, sessionID: string): IItemEventRouterResponse; deleteMapMarker(pmcData: IPmcData, body: IInventoryDeleteMarkerRequestData, sessionID: string): IItemEventRouterResponse; editMapMarker(pmcData: IPmcData, body: IInventoryEditMarkerRequestData, sessionID: string): IItemEventRouterResponse; + openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/10ScopesAndTypes/types/callbacks/ItemEventCallbacks.d.ts b/TypeScript/10ScopesAndTypes/types/callbacks/ItemEventCallbacks.d.ts index f4f04f9..fbb0b5f 100644 --- a/TypeScript/10ScopesAndTypes/types/callbacks/ItemEventCallbacks.d.ts +++ b/TypeScript/10ScopesAndTypes/types/callbacks/ItemEventCallbacks.d.ts @@ -1,4 +1,5 @@ import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; +import { Warning } from "../models/eft/itemEvent/IItemEventRouterBase"; import { IItemEventRouterRequest } from "../models/eft/itemEvent/IItemEventRouterRequest"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { ItemEventRouter } from "../routers/ItemEventRouter"; @@ -8,4 +9,5 @@ export declare class ItemEventCallbacks { protected itemEventRouter: ItemEventRouter; constructor(httpResponse: HttpResponseUtil, itemEventRouter: ItemEventRouter); handleEvents(url: string, info: IItemEventRouterRequest, sessionID: string): IGetBodyResponseData; + protected getErrorCode(warnings: Warning[]): number; } diff --git a/TypeScript/10ScopesAndTypes/types/callbacks/MatchCallbacks.d.ts b/TypeScript/10ScopesAndTypes/types/callbacks/MatchCallbacks.d.ts index 2a92ef5..10fbc44 100644 --- a/TypeScript/10ScopesAndTypes/types/callbacks/MatchCallbacks.d.ts +++ b/TypeScript/10ScopesAndTypes/types/callbacks/MatchCallbacks.d.ts @@ -34,6 +34,10 @@ export declare class MatchCallbacks { serverAvailable(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData | IGetBodyResponseData; joinMatch(url: string, info: IJoinMatchRequestData, sessionID: string): IGetBodyResponseData; getMetrics(url: string, info: any, sessionID: string): IGetBodyResponseData; + /** + * Handle client/match/group/status + * @returns + */ getGroupStatus(url: string, info: IGetGroupStatusRequestData, sessionID: string): IGetBodyResponseData; createGroup(url: string, info: ICreateGroupRequestData, sessionID: string): IGetBodyResponseData; deleteGroup(url: string, info: any, sessionID: string): INullResponseData; diff --git a/TypeScript/10ScopesAndTypes/types/callbacks/NotifierCallbacks.d.ts b/TypeScript/10ScopesAndTypes/types/callbacks/NotifierCallbacks.d.ts index c42058f..fab325b 100644 --- a/TypeScript/10ScopesAndTypes/types/callbacks/NotifierCallbacks.d.ts +++ b/TypeScript/10ScopesAndTypes/types/callbacks/NotifierCallbacks.d.ts @@ -4,6 +4,7 @@ import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { INotifierChannel } from "../models/eft/notifier/INotifier"; import { ISelectProfileRequestData } from "../models/eft/notifier/ISelectProfileRequestData"; +import { ISelectProfileResponse } from "../models/eft/notifier/ISelectProfileResponse"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; export declare class NotifierCallbacks { protected httpServerHelper: HttpServerHelper; @@ -19,6 +20,10 @@ export declare class NotifierCallbacks { sendNotification(sessionID: string, req: any, resp: any, data: any): void; getNotifier(url: string, info: any, sessionID: string): IGetBodyResponseData; createNotifierChannel(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - selectProfile(url: string, info: ISelectProfileRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/game/profile/select + * @returns ISelectProfileResponse + */ + selectProfile(url: string, info: ISelectProfileRequestData, sessionID: string): IGetBodyResponseData; notify(url: string, info: any, sessionID: string): string; } diff --git a/TypeScript/10ScopesAndTypes/types/callbacks/QuestCallbacks.d.ts b/TypeScript/10ScopesAndTypes/types/callbacks/QuestCallbacks.d.ts index 559c29e..2a3eb20 100644 --- a/TypeScript/10ScopesAndTypes/types/callbacks/QuestCallbacks.d.ts +++ b/TypeScript/10ScopesAndTypes/types/callbacks/QuestCallbacks.d.ts @@ -21,6 +21,13 @@ export declare class QuestCallbacks { acceptQuest(pmcData: IPmcData, body: IAcceptQuestRequestData, sessionID: string): IItemEventRouterResponse; completeQuest(pmcData: IPmcData, body: ICompleteQuestRequestData, sessionID: string): IItemEventRouterResponse; handoverQuest(pmcData: IPmcData, body: IHandoverQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle client/quest/list + * @param url + * @param info + * @param sessionID + * @returns + */ listQuests(url: string, info: IListQuestsRequestData, sessionID: string): IGetBodyResponseData; activityPeriods(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; } diff --git a/TypeScript/10ScopesAndTypes/types/callbacks/RagfairCallbacks.d.ts b/TypeScript/10ScopesAndTypes/types/callbacks/RagfairCallbacks.d.ts index c609f2f..37f3807 100644 --- a/TypeScript/10ScopesAndTypes/types/callbacks/RagfairCallbacks.d.ts +++ b/TypeScript/10ScopesAndTypes/types/callbacks/RagfairCallbacks.d.ts @@ -35,7 +35,7 @@ export declare class RagfairCallbacks extends OnLoadOnUpdate { getRoute(): string; search(url: string, info: ISearchRequestData, sessionID: string): IGetBodyResponseData; getMarketPrice(url: string, info: IGetMarketPriceRequestData, sessionID: string): IGetBodyResponseData; - getItemPrices(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + getItemPrices(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData>; addOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; removeOffer(pmcData: IPmcData, info: IRemoveOfferRequestData, sessionID: string): IItemEventRouterResponse; extendOffer(pmcData: IPmcData, info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; diff --git a/TypeScript/10ScopesAndTypes/types/callbacks/TraderCallbacks.d.ts b/TypeScript/10ScopesAndTypes/types/callbacks/TraderCallbacks.d.ts index e4fd099..40a1455 100644 --- a/TypeScript/10ScopesAndTypes/types/callbacks/TraderCallbacks.d.ts +++ b/TypeScript/10ScopesAndTypes/types/callbacks/TraderCallbacks.d.ts @@ -12,6 +12,10 @@ export declare class TraderCallbacks extends OnLoadOnUpdate { onUpdate(): boolean; getRoute(): string; getTraderSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/trading/api/getUserAssortPrice/trader + * @returns + */ getProfilePurchases(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData>; getTrader(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getAssort(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; diff --git a/TypeScript/10ScopesAndTypes/types/callbacks/WeatherCallbacks.d.ts b/TypeScript/10ScopesAndTypes/types/callbacks/WeatherCallbacks.d.ts index ae784c8..f9d2002 100644 --- a/TypeScript/10ScopesAndTypes/types/callbacks/WeatherCallbacks.d.ts +++ b/TypeScript/10ScopesAndTypes/types/callbacks/WeatherCallbacks.d.ts @@ -1,10 +1,15 @@ import { WeatherController } from "../controllers/WeatherController"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; +import { IWeatherData } from "../models/eft/weather/IWeatherData"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; export declare class WeatherCallbacks { protected httpResponse: HttpResponseUtil; protected weatherController: WeatherController; constructor(httpResponse: HttpResponseUtil, weatherController: WeatherController); - getWeather(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/weather + * @returns IWeatherData + */ + getWeather(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; } diff --git a/TypeScript/10ScopesAndTypes/types/context/ContextVariableType.d.ts b/TypeScript/10ScopesAndTypes/types/context/ContextVariableType.d.ts index 5fc1704..a7dd9b5 100644 --- a/TypeScript/10ScopesAndTypes/types/context/ContextVariableType.d.ts +++ b/TypeScript/10ScopesAndTypes/types/context/ContextVariableType.d.ts @@ -1,4 +1,8 @@ export declare enum ContextVariableType { + /** Logged in users session id */ SESSION_ID = 0, - MATCH_INFO = 1 + /** Currently acive raid information */ + MATCH_INFO = 1, + /** Timestamp when client first connected */ + CLIENT_START_TIMESTAMP = 2 } diff --git a/TypeScript/10ScopesAndTypes/types/controllers/BotController.d.ts b/TypeScript/10ScopesAndTypes/types/controllers/BotController.d.ts index a5111d5..92317c3 100644 --- a/TypeScript/10ScopesAndTypes/types/controllers/BotController.d.ts +++ b/TypeScript/10ScopesAndTypes/types/controllers/BotController.d.ts @@ -1,6 +1,8 @@ import { ApplicationContext } from "../context/ApplicationContext"; import { BotGenerator } from "../generators/BotGenerator"; +import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { IGenerateBotsRequestData } from "../models/eft/bot/IGenerateBotsRequestData"; import { IBotBase } from "../models/eft/common/tables/IBotBase"; import { IBotCore } from "../models/eft/common/tables/IBotCore"; @@ -10,18 +12,23 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; -import { PmcAiService } from "../services/PmcAiService"; +import { LocalisationService } from "../services/LocalisationService"; +import { JsonUtil } from "../utils/JsonUtil"; export declare class BotController { protected logger: ILogger; protected databaseServer: DatabaseServer; protected botGenerator: BotGenerator; protected botHelper: BotHelper; - protected pmcAiService: PmcAiService; + protected botDifficultyHelper: BotDifficultyHelper; protected botGenerationCacheService: BotGenerationCacheService; + protected localisationService: LocalisationService; + protected weightedRandomHelper: WeightedRandomHelper; protected configServer: ConfigServer; protected applicationContext: ApplicationContext; + protected jsonUtil: JsonUtil; protected botConfig: IBotConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, pmcAiService: PmcAiService, botGenerationCacheService: BotGenerationCacheService, configServer: ConfigServer, applicationContext: ApplicationContext); + static readonly pmcTypeLabel = "PMC"; + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); /** * Return the number of bot loadout varieties to be generated * @param type bot Type we want the loadout gen count for @@ -37,7 +44,6 @@ export declare class BotController { * @returns Difficulty object */ getBotDifficulty(type: string, difficulty: string): Difficulty; - protected getPmcDifficultySettings(pmcType: "bear" | "usec", difficulty: string, usecType: string, bearType: string): Difficulty; /** * Generate bot profiles and store in cache * @param sessionId Session id @@ -51,4 +57,5 @@ export declare class BotController { * @returns cap number */ getBotCap(): number; + getPmcBotTypes(): Record>>; } diff --git a/TypeScript/10ScopesAndTypes/types/controllers/DialogueController.d.ts b/TypeScript/10ScopesAndTypes/types/controllers/DialogueController.d.ts index 1b72522..9c8b728 100644 --- a/TypeScript/10ScopesAndTypes/types/controllers/DialogueController.d.ts +++ b/TypeScript/10ScopesAndTypes/types/controllers/DialogueController.d.ts @@ -23,7 +23,7 @@ export declare class DialogueController { * Get the content of a dialogue * @param dialogueID Dialog id * @param sessionID Session Id - * @returns + * @returns DialogueInfo */ getDialogueInfo(dialogueID: string, sessionID: string): DialogueInfo; /** diff --git a/TypeScript/10ScopesAndTypes/types/controllers/GameController.d.ts b/TypeScript/10ScopesAndTypes/types/controllers/GameController.d.ts index 3bfbdb1..f4f5849 100644 --- a/TypeScript/10ScopesAndTypes/types/controllers/GameController.d.ts +++ b/TypeScript/10ScopesAndTypes/types/controllers/GameController.d.ts @@ -1,3 +1,4 @@ +import { ApplicationContext } from "../context/ApplicationContext"; import { GameEventHelper } from "../helpers/GameEventHelper"; import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; @@ -14,6 +15,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; +import { LocalisationService } from "../services/LocalisationService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { Watermark } from "../utils/Watermark"; export declare class GameController { @@ -24,14 +26,33 @@ export declare class GameController { protected localeService: LocaleService; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; + protected localisationService: LocalisationService; protected gameEventHelper: GameEventHelper; + protected applicationContext: ApplicationContext; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; protected coreConfig: ICoreConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, gameEventHelper: GameEventHelper, configServer: ConfigServer); - gameStart(_url: string, _info: IEmptyRequestData, sessionID: string): void; + constructor(logger: ILogger, databaseServer: DatabaseServer, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, gameEventHelper: GameEventHelper, applicationContext: ApplicationContext, configServer: ConfigServer); + gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; + /** + * Check if current date falls inside any of the seasons events pased in, if so, handle them + * @param seasonalEvents events to check for + */ protected checkForAndEnableSeasonalEvents(seasonalEvents: ISeasonalEvent[]): void; + /** + * Make adjusted to server code based on the name of the event passed in + * @param globalConfig globals.json + * @param eventName Name of the event to enable. e.g. Christmas + */ protected updateGlobalEvents(globalConfig: Config, eventName: string): void; + /** + * Read in data from seasonalEvents.json and add found equipment items to bots + * @param eventName Name of the event to read equipment in from config + */ + protected addEventGearToScavs(eventName: string): void; + /** + * Set Khorovod(dancing tree) chance to 100% on all maps that support it + */ protected enableDancingTree(): void; /** * Make non-trigger-spawned raiders spawn earlier + always @@ -40,5 +61,6 @@ export declare class GameController { protected logProfileDetails(fullProfile: IAkiProfile): void; getGameConfig(sessionID: string): IGameConfigResponse; getServer(): IServerDetails[]; + protected addPumpkinsToScavBackpacks(): void; getValidGameVersion(): ICheckVersionResponse; } diff --git a/TypeScript/10ScopesAndTypes/types/controllers/HideoutController.d.ts b/TypeScript/10ScopesAndTypes/types/controllers/HideoutController.d.ts index ada5bd9..5b6507b 100644 --- a/TypeScript/10ScopesAndTypes/types/controllers/HideoutController.d.ts +++ b/TypeScript/10ScopesAndTypes/types/controllers/HideoutController.d.ts @@ -23,12 +23,13 @@ import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; import { PlayerService } from "../services/PlayerService"; import { HashUtil } from "../utils/HashUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; -import { JsonUtil } from "../utils/JsonUtil"; export declare class HideoutController { protected logger: ILogger; protected hashUtil: HashUtil; @@ -45,11 +46,12 @@ export declare class HideoutController { protected profileHelper: ProfileHelper; protected hideoutHelper: HideoutHelper; protected scavCaseRewardGenerator: ScavCaseRewardGenerator; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected jsonUtil: JsonUtil; protected static nameBackendCountersCrafting: string; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, configServer: ConfigServer, jsonUtil: JsonUtil); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, localisationService: LocalisationService, configServer: ConfigServer, jsonUtil: JsonUtil); upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; upgradeComplete(pmcData: IPmcData, body: HideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; /** diff --git a/TypeScript/10ScopesAndTypes/types/controllers/InraidController.d.ts b/TypeScript/10ScopesAndTypes/types/controllers/InraidController.d.ts index e84eea1..39a6396 100644 --- a/TypeScript/10ScopesAndTypes/types/controllers/InraidController.d.ts +++ b/TypeScript/10ScopesAndTypes/types/controllers/InraidController.d.ts @@ -6,6 +6,7 @@ import { ProfileHelper } from "../helpers/ProfileHelper"; import { QuestHelper } from "../helpers/QuestHelper"; import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; +import { Item } from "../models/eft/common/tables/IItem"; import { IRegisterPlayerRequestData } from "../models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; import { IAirdropConfig } from "../models/spt/config/IAirdropConfig"; @@ -17,6 +18,9 @@ import { SaveServer } from "../servers/SaveServer"; import { InsuranceService } from "../services/InsuranceService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; +/** + * Logic for handling In Raid callbacks + */ export declare class InraidController { protected logger: ILogger; protected saveServer: SaveServer; @@ -35,14 +39,42 @@ export declare class InraidController { protected airdropConfig: IAirdropConfig; protected inraidConfig: IInRaidConfig; 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 + * Save locationid to active profiles inraid object + * @param sessionID Session id + * @param info Register player request + */ + addPlayer(sessionID: string, info: IRegisterPlayerRequestData): void; + /** + * Save profile state to disk + * Handles pmc/pscav + * @param offraidData post-raid request data + * @param sessionID Session id + */ + savePostRaidProgress(offraidData: ISaveProgressRequestData, sessionID: string): void; + /** + * Handle updating player profile post-pmc raid * @param sessionID session id - * @param offraidData post-raid data of raid + * @param offraidData post-raid data */ protected savePmcProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; + /** + * Make changes to pmc profile after they left raid dead, + * alter bodypart hp, handle insurance, delete inventory items, remove carried quest items + * @param postRaidSaveRequest post-raid save request + * @param pmcData pmc profile + * @param insuranceEnabled is insurance enabled + * @param preRaidGear gear player had before raid + * @param sessionID Session id + * @returns Updated profile object + */ + protected performPostRaidActionsWhenDead(postRaidSaveRequest: ISaveProgressRequestData, pmcData: IPmcData, insuranceEnabled: boolean, preRaidGear: Item[], sessionID: string): IPmcData; + /** + * Adjust player characters bodypart hp if they left raid early + * @param postRaidSaveRequest post raid data + * @param pmcData player profile + */ + protected updatePmcHealthPostRaid(postRaidSaveRequest: ISaveProgressRequestData, pmcData: IPmcData): void; /** * Reduce body part hp to % of max * @param pmcData profile to edit @@ -68,7 +100,31 @@ export declare class InraidController { * @param isPlayerScav Was the player a pScav */ protected markOrRemoveFoundInRaidItems(offraidData: ISaveProgressRequestData, pmcData: IPmcData, isPlayerScav: boolean): void; + /** + * Update profile after player completes scav raid + * @param scavData Scav profile + * @param sessionID Session id + * @param offraidData Post-raid save request + * @param pmcData Pmc profile + * @param isDead Is player dead + */ protected handlePostRaidPlayerScavProcess(scavData: IPmcData, sessionID: string, offraidData: ISaveProgressRequestData, pmcData: IPmcData, isDead: boolean): void; + /** + * Update profile with scav karma values based on in-raid actions + * @param pmcData Pmc profile + * @param offraidData Post-raid save request + * @param scavData Scav profile + * @param sessionID Session id + */ protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData, scavData: IPmcData, sessionID: string): void; + /** + * Get the inraid config from configs/inraid.json + * @returns InRaid Config + */ + getInraidConfig(): IInRaidConfig; + /** + * Get airdrop config from configs/airdrop.json + * @returns Airdrop config + */ getAirdropConfig(): IAirdropConfig; } diff --git a/TypeScript/10ScopesAndTypes/types/controllers/InsuranceController.d.ts b/TypeScript/10ScopesAndTypes/types/controllers/InsuranceController.d.ts index 14bf129..54f31b5 100644 --- a/TypeScript/10ScopesAndTypes/types/controllers/InsuranceController.d.ts +++ b/TypeScript/10ScopesAndTypes/types/controllers/InsuranceController.d.ts @@ -30,8 +30,7 @@ export declare class InsuranceController { protected insuranceService: InsuranceService; protected configServer: ConfigServer; protected insuranceConfig: IInsuranceConfig; - constructor(logger: ILogger, randomUtil: RandomUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, paymentService: PaymentService, // TODO: delay required - insuranceService: InsuranceService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, paymentService: PaymentService, insuranceService: InsuranceService, configServer: ConfigServer); processReturn(): void; insure(pmcData: IPmcData, body: IInsureRequestData, sessionID: string): IItemEventRouterResponse; /** diff --git a/TypeScript/10ScopesAndTypes/types/controllers/InventoryController.d.ts b/TypeScript/10ScopesAndTypes/types/controllers/InventoryController.d.ts index 6a1a21e..e1c08c0 100644 --- a/TypeScript/10ScopesAndTypes/types/controllers/InventoryController.d.ts +++ b/TypeScript/10ScopesAndTypes/types/controllers/InventoryController.d.ts @@ -1,8 +1,8 @@ -import { EventOutputHolder } from "../routers/EventOutputHolder"; import { InventoryHelper } from "../helpers/InventoryHelper"; import { PaymentHelper } from "../helpers/PaymentHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IAddItemRequestData } from "../models/eft/inventory/IAddItemRequestData"; import { IInventoryBindRequestData } from "../models/eft/inventory/IInventoryBindRequestData"; @@ -21,33 +21,46 @@ import { IInventorySwapRequestData } from "../models/eft/inventory/IInventorySwa import { IInventoryTagRequestData } from "../models/eft/inventory/IInventoryTagRequestData"; import { IInventoryToggleRequestData } from "../models/eft/inventory/IInventoryToggleRequestData"; import { IInventoryTransferRequestData } from "../models/eft/inventory/IInventoryTransferRequestData"; +import { IOpenRandomLootContainerRequestData } from "../models/eft/inventory/IOpenRandomLootContainerRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { ILogger } from "../models/spt/utils/ILogger"; +import { EventOutputHolder } from "../routers/EventOutputHolder"; import { DatabaseServer } from "../servers/DatabaseServer"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { HashUtil } from "../utils/HashUtil"; +import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { JsonUtil } from "../utils/JsonUtil"; +import { RandomUtil } from "../utils/RandomUtil"; export declare class InventoryController { protected logger: ILogger; protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; + protected randomUtil: RandomUtil; protected databaseServer: DatabaseServer; protected fenceService: FenceService; protected presetHelper: PresetHelper; protected inventoryHelper: InventoryHelper; protected ragfairOfferService: RagfairOfferService; protected profileHelper: ProfileHelper; + protected weightedRandomHelper: WeightedRandomHelper; protected paymentHelper: PaymentHelper; + protected localisationService: LocalisationService; protected eventOutputHolder: EventOutputHolder; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder); + protected httpResponseUtil: HttpResponseUtil; + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, weightedRandomHelper: WeightedRandomHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); /** * Move Item * change location of item with parentId and slotId * transfers items from one profile to another if fromOwner/toOwner is set in the body. * otherwise, move is contained within the same profile_f. - */ - moveItem(pmcData: IPmcData, body: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; + * @param pmcData Profile + * @param moveRequest Move request data + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ + moveItem(pmcData: IPmcData, moveRequest: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; /** * Remove Item from Profile * Deep tree item deletion, also removes items from insurance list @@ -122,4 +135,12 @@ export declare class InventoryController { createMapMarker(pmcData: IPmcData, body: IInventoryCreateMarkerRequestData, sessionID: string): IItemEventRouterResponse; deleteMapMarker(pmcData: IPmcData, body: IInventoryDeleteMarkerRequestData, sessionID: string): IItemEventRouterResponse; editMapMarker(pmcData: IPmcData, body: IInventoryEditMarkerRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle event fired when a container is unpacked (currently only the halloween pumpkin) + * @param pmcData Profile data + * @param body open loot container request data + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ + openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/10ScopesAndTypes/types/controllers/LocationController.d.ts b/TypeScript/10ScopesAndTypes/types/controllers/LocationController.d.ts index 9db3205..b6feba8 100644 --- a/TypeScript/10ScopesAndTypes/types/controllers/LocationController.d.ts +++ b/TypeScript/10ScopesAndTypes/types/controllers/LocationController.d.ts @@ -7,6 +7,7 @@ import { LootItem } from "../models/spt/services/LootItem"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -15,12 +16,13 @@ export declare class LocationController { protected hashUtil: HashUtil; protected logger: ILogger; protected locationGenerator: LocationGenerator; + protected localisationService: LocalisationService; protected lootGenerator: LootGenerator; protected databaseServer: DatabaseServer; protected timeUtil: TimeUtil; protected configServer: ConfigServer; protected airdropConfig: IAirdropConfig; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, logger: ILogger, locationGenerator: LocationGenerator, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer); + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer); get(location: string): ILocationBase; generate(name: string): ILocationBase; generateAll(): ILocationsGenerateAllResponse; diff --git a/TypeScript/10ScopesAndTypes/types/controllers/MatchController.d.ts b/TypeScript/10ScopesAndTypes/types/controllers/MatchController.d.ts index dac6a3f..2b0d150 100644 --- a/TypeScript/10ScopesAndTypes/types/controllers/MatchController.d.ts +++ b/TypeScript/10ScopesAndTypes/types/controllers/MatchController.d.ts @@ -19,7 +19,6 @@ import { SaveServer } from "../servers/SaveServer"; import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; import { BotLootCacheService } from "../services/BotLootCacheService"; import { MatchLocationService } from "../services/MatchLocationService"; -import { PmcAiService } from "../services/PmcAiService"; import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; export declare class MatchController { protected logger: ILogger; @@ -30,13 +29,12 @@ export declare class MatchController { protected botLootCacheService: BotLootCacheService; protected configServer: ConfigServer; protected profileSnapshotService: ProfileSnapshotService; - protected pmcAiService: PmcAiService; protected botGenerationCacheService: BotGenerationCacheService; 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, pmcAiService: PmcAiService, botGenerationCacheService: BotGenerationCacheService, applicationContext: ApplicationContext); + constructor(logger: ILogger, saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, botGenerationCacheService: BotGenerationCacheService, applicationContext: ApplicationContext); getEnabled(): boolean; getProfile(info: IGetProfileRequestData): IPmcData[]; createGroup(sessionID: string, info: ICreateGroupRequestData): any; diff --git a/TypeScript/10ScopesAndTypes/types/controllers/RagfairController.d.ts b/TypeScript/10ScopesAndTypes/types/controllers/RagfairController.d.ts index 5440458..95702f2 100644 --- a/TypeScript/10ScopesAndTypes/types/controllers/RagfairController.d.ts +++ b/TypeScript/10ScopesAndTypes/types/controllers/RagfairController.d.ts @@ -29,6 +29,7 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { RagfairServer } from "../servers/RagfairServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; import { PaymentService } from "../services/PaymentService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { RagfairPriceService } from "../services/RagfairPriceService"; @@ -62,9 +63,10 @@ export declare class RagfairController { protected ragfairOfferService: RagfairOfferService; protected ragfairRequiredItemsService: RagfairRequiredItemsService; protected ragfairOfferGenerator: RagfairOfferGenerator; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, eventOutputHolder: EventOutputHolder, ragfairServer: RagfairServer, ragfairPriceService: RagfairPriceService, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer, ragfairSellHelper: RagfairSellHelper, ragfairTaxHelper: RagfairTaxHelper, ragfairSortHelper: RagfairSortHelper, ragfairOfferHelper: RagfairOfferHelper, profileHelper: ProfileHelper, paymentService: PaymentService, handbookHelper: HandbookHelper, paymentHelper: PaymentHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, ragfairOfferGenerator: RagfairOfferGenerator, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, eventOutputHolder: EventOutputHolder, ragfairServer: RagfairServer, ragfairPriceService: RagfairPriceService, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer, ragfairSellHelper: RagfairSellHelper, ragfairTaxHelper: RagfairTaxHelper, ragfairSortHelper: RagfairSortHelper, ragfairOfferHelper: RagfairOfferHelper, profileHelper: ProfileHelper, paymentService: PaymentService, handbookHelper: HandbookHelper, paymentHelper: PaymentHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, ragfairOfferGenerator: RagfairOfferGenerator, localisationService: LocalisationService, configServer: ConfigServer); getOffers(sessionID: string, info: ISearchRequestData): IGetOffersResult; /** * Get offers for the client based on type of search being performed @@ -103,7 +105,12 @@ export declare class RagfairController { protected isLinkedSearch(info: ISearchRequestData): boolean; protected isRequiredSearch(info: ISearchRequestData): boolean; update(): void; - getItemPrice(info: IGetMarketPriceRequestData): IGetItemPriceResult; + /** + * Called when creating an offer on flea, fills values in top right corner + * @param getPriceRequest + * @returns min/avg/max values for an item based on flea offers available + */ + getItemMinAvgMaxFleaPriceValues(getPriceRequest: IGetMarketPriceRequestData): IGetItemPriceResult; addPlayerOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; createPlayerOffer(profile: IAkiProfile, requirements: Requirement[], items: Item[], sellInOnePiece: boolean, amountToSend: number): IRagfairOffer; getAllFleaPrices(): Record; diff --git a/TypeScript/10ScopesAndTypes/types/controllers/RepeatableQuestController.d.ts b/TypeScript/10ScopesAndTypes/types/controllers/RepeatableQuestController.d.ts index 7db5886..333583b 100644 --- a/TypeScript/10ScopesAndTypes/types/controllers/RepeatableQuestController.d.ts +++ b/TypeScript/10ScopesAndTypes/types/controllers/RepeatableQuestController.d.ts @@ -17,6 +17,7 @@ import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { ItemFilterService } from "../services/ItemFilterService"; +import { LocalisationService } from "../services/LocalisationService"; import { PaymentService } from "../services/PaymentService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { JsonUtil } from "../utils/JsonUtil"; @@ -64,12 +65,13 @@ export declare class RepeatableQuestController { protected profileFixerService: ProfileFixerService; protected ragfairServerHelper: RagfairServerHelper; protected eventOutputHolder: EventOutputHolder; + protected localisationService: LocalisationService; protected paymentService: PaymentService; protected objectId: ObjectId; protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * This is the method reached by the /client/repeatalbeQuests/activityPeriods endpoint * Returns an array of objects in the format of repeatable quests to the client. diff --git a/TypeScript/10ScopesAndTypes/types/controllers/WeatherController.d.ts b/TypeScript/10ScopesAndTypes/types/controllers/WeatherController.d.ts index ca7f5eb..631a90c 100644 --- a/TypeScript/10ScopesAndTypes/types/controllers/WeatherController.d.ts +++ b/TypeScript/10ScopesAndTypes/types/controllers/WeatherController.d.ts @@ -1,11 +1,18 @@ import { WeatherGenerator } from "../generators/WeatherGenerator"; import { IWeatherData } from "../models/eft/weather/IWeatherData"; import { IWeatherConfig } from "../models/spt/config/IWeatherConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; export declare class WeatherController { protected weatherGenerator: WeatherGenerator; + protected logger: ILogger; protected configServer: ConfigServer; protected weatherConfig: IWeatherConfig; - constructor(weatherGenerator: WeatherGenerator, configServer: ConfigServer); + constructor(weatherGenerator: WeatherGenerator, logger: ILogger, configServer: ConfigServer); generate(): IWeatherData; + /** + * Get the current in-raid time (MUST HAVE PLAYER LOGGED INTO CLIENT TO WORK) + * @returns Date object + */ + getCurrentInRaidTime(): Date; } diff --git a/TypeScript/10ScopesAndTypes/types/generators/BotGenerator.d.ts b/TypeScript/10ScopesAndTypes/types/generators/BotGenerator.d.ts index 2ac51db..a1ac9ed 100644 --- a/TypeScript/10ScopesAndTypes/types/generators/BotGenerator.d.ts +++ b/TypeScript/10ScopesAndTypes/types/generators/BotGenerator.d.ts @@ -1,7 +1,8 @@ +import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; import { GameEventHelper } from "../helpers/GameEventHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; -import { IGenerateBotsRequestData } from "../models/eft/bot/IGenerateBotsRequestData"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { Health as PmcHealth, IBotBase, Skills } from "../models/eft/common/tables/IBotBase"; import { Health, IBotType, Inventory } from "../models/eft/common/tables/IBotType"; import { IBotConfig } from "../models/spt/config/IBotConfig"; @@ -9,7 +10,6 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; -import { PmcAiService } from "../services/PmcAiService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; @@ -29,12 +29,13 @@ export declare class BotGenerator { protected databaseServer: DatabaseServer; protected botInventoryGenerator: BotInventoryGenerator; protected botEquipmentFilterService: BotEquipmentFilterService; + protected weightedRandomHelper: WeightedRandomHelper; protected botHelper: BotHelper; + protected botDifficultyHelper: BotDifficultyHelper; protected gameEventHelper: GameEventHelper; - protected pmcAiService: PmcAiService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botEquipmentFilterService: BotEquipmentFilterService, botHelper: BotHelper, gameEventHelper: GameEventHelper, pmcAiService: PmcAiService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botEquipmentFilterService: BotEquipmentFilterService, weightedRandomHelper: WeightedRandomHelper, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, gameEventHelper: GameEventHelper, configServer: ConfigServer); /** * Generate a player scav bot object * @param role e.g. assault / pmcbot @@ -44,12 +45,18 @@ export declare class BotGenerator { */ generatePlayerScav(sessionId: string, role: string, difficulty: string, botTemplate: IBotType): IBotBase; /** - * Generate an array of bot objects for populate a raid with + * Generate an array of bot objects based on a condition for a raid with * @param sessionId session id - * @param info request object + * @param condition request condition * @returns bot array */ - generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; + generateByCondition(sessionId: string, botCountToGenerate: number, difficulty: string, role: string, isPmc: boolean): IBotBase[]; + /** + * Get the PMCs wildSpawnType value + * @param role "usec" / "bear" + * @returns wildSpawnType value as string + */ + protected getPmcRoleByDescription(role: string): string; /** * Get a randomised PMC side based on bot config value 'isUsec' * @returns pmc side as string @@ -64,13 +71,13 @@ export declare class BotGenerator { * Create a IBotBase object with equipment/loot/exp etc * @param sessionId Session id * @param bot bots base file - * @param role botRole bot will use + * @param botRole Role bot will use (bear/usec for PMCs) * @param node Bot template from db/bots/x.json * @param isPmc Is bot to be a PMC * @param isPlayerScav is bot to be a p scav bot * @returns IBotBase object */ - protected generateBot(sessionId: string, bot: IBotBase, role: string, node: IBotType, isPmc: boolean, isPlayerScav?: boolean): IBotBase; + protected generateBot(sessionId: string, bot: IBotBase, botRole: string, node: IBotType, isPmc: boolean, isPlayerScav?: boolean): IBotBase; /** * Log the number of PMCs generated to the debug console * @param output Generated bot array, ready to send to client diff --git a/TypeScript/10ScopesAndTypes/types/generators/BotInventoryGenerator.d.ts b/TypeScript/10ScopesAndTypes/types/generators/BotInventoryGenerator.d.ts index c5ed545..e1efaf2 100644 --- a/TypeScript/10ScopesAndTypes/types/generators/BotInventoryGenerator.d.ts +++ b/TypeScript/10ScopesAndTypes/types/generators/BotInventoryGenerator.d.ts @@ -7,6 +7,7 @@ import { IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { BotLootGenerator } from "./BotLootGenerator"; @@ -20,14 +21,68 @@ export declare class BotInventoryGenerator { protected botLootGenerator: BotLootGenerator; protected botGeneratorHelper: BotGeneratorHelper; protected weightedRandomHelper: WeightedRandomHelper; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, configServer: ConfigServer); + /** + * Add equipment/weapons/loot to bot + * @param sessionId Session id + * @param templateInventory bot/x.json data from db + * @param equipmentChances Chances each item will be added to bot + * @param itemGenerationLimitsMinMax item gen limits for bot role + * @param botRole Role bot has (assault/pmcBot) + * @param isPmc Is bot being converted into a pmc + * @returns PmcInventory object with equipment/weapons/loot + */ generateInventory(sessionId: string, templateInventory: Inventory, equipmentChances: Chances, itemGenerationLimitsMinMax: Generation, botRole: string, isPmc: boolean): PmcInventory; + /** + * Create a pmcInventory object with all the base/generic items needed + * @returns PmcInventory object + */ + protected generateInventoryBase(): PmcInventory; + /** + * Add equipment to a bot + * @param templateInventory bot/x.json data from db + * @param equipmentChances Chances items will be added to bot + * @param botRole Role bot has (assault/pmcBot) + * @param botInventory Inventory to add equipment to + */ + protected generateAndAddEquipmentToBot(templateInventory: Inventory, equipmentChances: Chances, botRole: string, botInventory: PmcInventory): void; + protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory): void; + /** + * Work out what weapons bot should have equipped and add them to bot inventory + * @param templateInventory bot/x.json data from db + * @param equipmentChances Chances bot can have equipment equipped + * @param sessionId Session id + * @param botInventory Inventory to add weapons to + * @param botRole assault/pmcBot/bossTagilla etc + * @param isPmc Is the bot being generated as a pmc + * @param itemGenerationLimitsMinMax Limits for items the bot can have + */ + protected generateAndAddWeaponsToBot(templateInventory: Inventory, equipmentChances: Chances, sessionId: string, botInventory: PmcInventory, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation): void; + /** + * Calculate if the bot should have weapons in Primary/Secondary/Holster slots + * @param equipmentChances Chances bot has certain equipment + * @returns What slots bot should have weapons generated for + */ + protected getDesiredWeaponsForBot(equipmentChances: Chances): { + slot: EquipmentSlots; + shouldSpawn: boolean; + }[]; + /** + * Add weapon + spare mags/ammo to bots inventory + * @param sessionId Session id + * @param weaponSlot Weapon slot being generated + * @param templateInventory bot/x.json data from db + * @param botInventory Inventory to add weapon+mags/ammo to + * @param equipmentChances Chances bot can have equipment equipped + * @param botRole assault/pmcBot/bossTagilla etc + * @param isPmc Is the bot being generated as a pmc + * @param itemGenerationLimitsMinMax + */ protected addWeaponAndMagazinesToInventory(sessionId: string, weaponSlot: { slot: EquipmentSlots; shouldSpawn: boolean; }, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation): void; - protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory): void; - protected generateInventoryBase(): PmcInventory; } diff --git a/TypeScript/10ScopesAndTypes/types/generators/BotLootGenerator.d.ts b/TypeScript/10ScopesAndTypes/types/generators/BotLootGenerator.d.ts index c1f5310..3352a46 100644 --- a/TypeScript/10ScopesAndTypes/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/10ScopesAndTypes/types/generators/BotLootGenerator.d.ts @@ -10,6 +10,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotLootCacheService } from "../services/BotLootCacheService"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { BotWeaponGenerator } from "./BotWeaponGenerator"; @@ -23,9 +24,10 @@ export declare class BotLootGenerator { protected botWeaponGenerator: BotWeaponGenerator; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected botLootCacheService: BotLootCacheService; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, configServer: ConfigServer); generateLoot(sessionId: string, templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances): void; protected getRandomisedCount(min: number, max: number, nValue: number): number; /** @@ -113,7 +115,7 @@ export declare class BotLootGenerator { * If no limit found for a non pmc bot, fall back to defaults * @param isPmc is the bot we want limits for a pmc * @param botRole what role does the bot have - * @returns dictionary of tplIds and limit + * @returns Dictionary of tplIds and limit */ protected getItemSpawnLimitsForBotType(isPmc: boolean, botRole: string): Record; /** diff --git a/TypeScript/10ScopesAndTypes/types/generators/BotWeaponGenerator.d.ts b/TypeScript/10ScopesAndTypes/types/generators/BotWeaponGenerator.d.ts index 487901b..40284ea 100644 --- a/TypeScript/10ScopesAndTypes/types/generators/BotWeaponGenerator.d.ts +++ b/TypeScript/10ScopesAndTypes/types/generators/BotWeaponGenerator.d.ts @@ -12,6 +12,7 @@ import { IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; @@ -27,10 +28,11 @@ export declare class BotWeaponGenerator { protected randomUtil: RandomUtil; protected configServer: ConfigServer; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected localisationService: LocalisationService; protected inventoryMagGenComponents: IInventoryMagGen[]; protected readonly modMagazineSlotId = "mod_magazine"; protected botConfig: IBotConfig; - constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil, configServer: ConfigServer, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, inventoryMagGenComponents: IInventoryMagGen[]); + constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil, configServer: ConfigServer, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, inventoryMagGenComponents: IInventoryMagGen[]); /** * Pick a random weapon based on weightings and generate a functional weapon * @param equipmentSlot Primary/secondary/holster diff --git a/TypeScript/10ScopesAndTypes/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/10ScopesAndTypes/types/generators/RagfairOfferGenerator.d.ts index b64a7e7..23882d2 100644 --- a/TypeScript/10ScopesAndTypes/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/10ScopesAndTypes/types/generators/RagfairOfferGenerator.d.ts @@ -1,16 +1,19 @@ +import { HandbookHelper } from "../helpers/HandbookHelper"; import { ItemHelper } from "../helpers/ItemHelper"; +import { PaymentHelper } from "../helpers/PaymentHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; import { Item } from "../models/eft/common/tables/IItem"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { IBarterScheme } from "../models/eft/common/tables/ITrader"; -import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; +import { IRagfairOffer, OfferRequirement } from "../models/eft/ragfair/IRagfairOffer"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { RagfairCategoriesService } from "../services/RagfairCategoriesService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { RagfairPriceService } from "../services/RagfairPriceService"; @@ -27,18 +30,31 @@ export declare class RagfairOfferGenerator { protected timeUtil: TimeUtil; protected databaseServer: DatabaseServer; protected ragfairServerHelper: RagfairServerHelper; + protected handbookHelper: HandbookHelper; protected saveServer: SaveServer; protected presetHelper: PresetHelper; protected ragfairAssortGenerator: RagfairAssortGenerator; protected ragfairOfferService: RagfairOfferService; protected ragfairPriceService: RagfairPriceService; + protected localisationService: LocalisationService; + protected paymentHelper: PaymentHelper; protected ragfairCategoriesService: RagfairCategoriesService; protected fenceService: FenceService; protected itemHelper: ItemHelper; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, ragfairServerHelper: RagfairServerHelper, saveServer: SaveServer, presetHelper: PresetHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferService: RagfairOfferService, ragfairPriceService: RagfairPriceService, ragfairCategoriesService: RagfairCategoriesService, fenceService: FenceService, itemHelper: ItemHelper, configServer: ConfigServer); + protected allowedFleaPriceItemsForBarter: { + tpl: string; + price: number; + }[]; + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, ragfairServerHelper: RagfairServerHelper, handbookHelper: HandbookHelper, saveServer: SaveServer, presetHelper: PresetHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferService: RagfairOfferService, ragfairPriceService: RagfairPriceService, localisationService: LocalisationService, paymentHelper: PaymentHelper, ragfairCategoriesService: RagfairCategoriesService, fenceService: FenceService, itemHelper: ItemHelper, configServer: ConfigServer); createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; + /** + * Calculate the offer price that's listed on the flea listing + * @param offerRequirements barter requirements for offer + * @returns rouble cost of offer + */ + protected calculateOfferListingPrice(offerRequirements: OfferRequirement[]): number; /** * Get avatar url from trader table in db * @param isTrader Is user we're getting avatar for a trader @@ -87,20 +103,36 @@ export declare class RagfairOfferGenerator { * @returns Item with conditions added */ protected addMissingCondition(item: Item): Item; - protected getOfferRequirements(items: Item[]): { - count: number; - _tpl: string; + /** + * Create a barter-based barter scheme, if not possible, fall back to making barter scheme currency based + * @param offerItems Items for sale in offer + * @returns barter scheme + */ + protected createBarterRequirement(offerItems: Item[]): IBarterScheme[]; + /** + * Get an array of flea prices + item tpl, cached in generator class + * @returns array with tpl/price values + */ + protected getFleaPricesAsArray(): { + tpl: string; + price: number; }[]; + /** + * Create a random currency-based barter scheme for an array of items + * @param offerItems Items on offer + * @returns Barter scheme for offer + */ + protected createCurrencyRequirement(offerItems: Item[]): IBarterScheme[]; /** * Create a flea offer and store it in the Ragfair server offers array * @param userID owner of the offer * @param time time offer is put up * @param items items in the offer - * @param barterScheme - * @param loyalLevel + * @param barterScheme cost of item (currency or barter) + * @param loyalLevel Loyalty level needed to buy item * @param price price of offer * @param sellInOnePiece - * @returns + * @returns Ragfair offer */ createFleaOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; } diff --git a/TypeScript/10ScopesAndTypes/types/generators/WeatherGenerator.d.ts b/TypeScript/10ScopesAndTypes/types/generators/WeatherGenerator.d.ts index 8ddbe49..65d2c76 100644 --- a/TypeScript/10ScopesAndTypes/types/generators/WeatherGenerator.d.ts +++ b/TypeScript/10ScopesAndTypes/types/generators/WeatherGenerator.d.ts @@ -1,38 +1,54 @@ +import { ApplicationContext } from "../context/ApplicationContext"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; -import { IWeatherData } from "../models/eft/weather/IWeatherData"; +import { IWeather, IWeatherData } from "../models/eft/weather/IWeatherData"; +import { WindDirection } from "../models/enums/WindDirection"; import { IWeatherConfig } from "../models/spt/config/IWeatherConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class WeatherGenerator { protected weightedRandomHelper: WeightedRandomHelper; + protected logger: ILogger; protected randomUtil: RandomUtil; protected timeUtil: TimeUtil; + protected applicationContext: ApplicationContext; protected configServer: ConfigServer; protected weatherConfig: IWeatherConfig; - constructor(weightedRandomHelper: WeightedRandomHelper, randomUtil: RandomUtil, timeUtil: TimeUtil, configServer: ConfigServer); - calculateTime(data: IWeatherData): IWeatherData; + constructor(weightedRandomHelper: WeightedRandomHelper, logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, applicationContext: ApplicationContext, configServer: ConfigServer); + calculateGameTime(data: IWeatherData): IWeatherData; /** * Get server uptime seconds multiplied by a multiplier and add to current time as seconds * Format to BSGs requirements - * @param computedDate current date + * @param currentDate current date * @returns formatted time */ - protected getAcceleratedTime(computedDate: Date): string; + protected getBsgFormattedInRaidTime(currentDate: Date): string; + /** + * Get the current in-raid time + * @param currentDate (new Date()) + * @returns Date object of current in-raid time + */ + getInRaidTime(currentDate: Date): Date; /** * Get current time formatted to fit BSGs requirement - * @param computedDate date to format into bsg style + * @param date date to format into bsg style * @returns */ - protected getNormalTime(computedDate: Date): string; + protected getBSGFormattedTime(date: Date): string; /** - * Return randomised Weather data - * @param weatherData weather input data + * Return randomised Weather data with help of config/weather.json * @returns Randomised weather data */ - generateWeather(weatherData: IWeatherData): IWeatherData; - protected getWeightedFog(): string; + generateWeather(): IWeather; + /** + * Set IWeather date/time/timestamp values to now + * @param weather Object to update + */ + protected setCurrentDateTime(weather: IWeather): void; + protected getWeightedWindDirection(): WindDirection; + protected getWeightedWindSpeed(): number; + protected getWeightedFog(): number; protected getWeightedRain(): number; protected getRandomFloat(node: string): number; - protected getRandomInt(node: string): number; } diff --git a/TypeScript/10ScopesAndTypes/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts b/TypeScript/10ScopesAndTypes/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts index 4fcb1e2..1589707 100644 --- a/TypeScript/10ScopesAndTypes/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts +++ b/TypeScript/10ScopesAndTypes/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts @@ -1,13 +1,15 @@ import { BotWeaponGeneratorHelper } from "../../../helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "../../../helpers/ItemHelper"; import { ILogger } from "../../../models/spt/utils/ILogger"; +import { LocalisationService } from "../../../services/LocalisationService"; import { IInventoryMagGen } from "../IInventoryMagGen"; import { InventoryMagGen } from "../InventoryMagGen"; export declare class ExternalInventoryMagGen implements IInventoryMagGen { protected logger: ILogger; protected itemHelper: ItemHelper; + protected localisationService: LocalisationService; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; - constructor(logger: ILogger, itemHelper: ItemHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper); + constructor(logger: ILogger, itemHelper: ItemHelper, localisationService: LocalisationService, botWeaponGeneratorHelper: BotWeaponGeneratorHelper); getPriority(): number; canHandleInventoryMagGen(inventoryMagGen: InventoryMagGen): boolean; process(inventoryMagGen: InventoryMagGen): void; diff --git a/TypeScript/10ScopesAndTypes/types/helpers/BotDifficultyHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/BotDifficultyHelper.d.ts new file mode 100644 index 0000000..a58ebdb --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/helpers/BotDifficultyHelper.d.ts @@ -0,0 +1,46 @@ +import { Difficulty } from "../models/eft/common/tables/IBotType"; +import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; +import { JsonUtil } from "../utils/JsonUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +import { BotHelper } from "./BotHelper"; +export declare class BotDifficultyHelper { + protected logger: ILogger; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected randomUtil: RandomUtil; + protected localisationService: LocalisationService; + protected botHelper: BotHelper; + protected configServer: ConfigServer; + protected botConfig: IBotConfig; + constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, localisationService: LocalisationService, botHelper: BotHelper, configServer: ConfigServer); + getPmcDifficultySettings(pmcType: "bear" | "usec", difficulty: string, usecType: string, bearType: string): Difficulty; + /** + * Get difficulty settings for desired bot type, if not found use assault bot types + * @param type bot type to retreive difficulty of + * @param difficulty difficulty to get settings for (easy/normal etc) + * @returns Difficulty object + */ + getBotDifficultySettings(type: string, difficulty: string): Difficulty; + /** + * Get difficulty settings for a PMC + * @param type "usec" / "bear" + * @param difficulty what difficulty to retrieve + * @returns Difficulty object + */ + protected getDifficultySettings(type: string, difficulty: string): Difficulty; + /** + * Translate chosen value from pre-raid difficulty dropdown into bot difficulty value + * @param dropDownDifficulty Dropdown difficulty value to convert + * @returns bot difficulty + */ + convertBotDifficultyDropdownToBotDifficulty(dropDownDifficulty: string): string; + /** + * Choose a random difficulty from - easy/normal/hard/impossible + * @returns random difficulty + */ + chooseRandomDifficulty(): string; +} diff --git a/TypeScript/10ScopesAndTypes/types/helpers/BotGeneratorHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/BotGeneratorHelper.d.ts index 5e3e501..899669e 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/BotGeneratorHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/BotGeneratorHelper.d.ts @@ -8,6 +8,7 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; import { ItemFilterService } from "../services/ItemFilterService"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; @@ -43,9 +44,10 @@ export declare class BotGeneratorHelper { protected itemFilterService: ItemFilterService; protected profileHelper: ProfileHelper; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Check mods are compatible and add to array * @param equipment Equipment item to add mods to @@ -53,9 +55,11 @@ export declare class BotGeneratorHelper { * @param parentId parentid of item to add mod to * @param parentTemplate template objet of item to add mods to * @param modSpawnChances dictionary of mod items and their chance to spawn for this bot type + * @param botRole the bot role being generated for + * @param forceSpawn should this mod be forced to spawn * @returns Item + compatible mods as an array */ - generateModsForEquipment(equipment: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances): Item[]; + generateModsForEquipment(equipment: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances, botRole: string, forceSpawn?: boolean): Item[]; /** * @param sessionId session id * @param weapon Weapon to add mods to @@ -70,15 +74,15 @@ export declare class BotGeneratorHelper { generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponParentId: string, parentWeaponTemplate: ITemplateItem, modSpawnChances: ModsChances, ammoTpl: string, botRole: string): Item[]; /** * - * @param modSlot - * @param isRandomisableSlot - * @param modsParent - * @param botEquipBlacklist - * @param itemModPool + * @param modSlot Slot mod will fit into + * @param isRandomisableSlot Will generate a randomised mod pool if true + * @param modsParent Parent slot the item will be a part of + * @param botEquipBlacklist Blacklist to prevent mods from being picked + * @param itemModPool Pool of items to pick from * @param weapon array with only weapon tpl in it, ready for mods to be added * @param ammoTpl ammo tpl to use if slot requires a cartridge to be added (e.g. mod_magazine) - * @param parentTemplate - * @returns + * @param parentTemplate Parent item the mod will go into + * @returns ITemplateItem */ protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, modsParent: Slot, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem): [boolean, ITemplateItem]; /** @@ -114,8 +118,10 @@ export declare class BotGeneratorHelper { * Find all compatible mods for equipment item and add to modPool * @param itemDetails item to find mods for * @param modPool ModPool to add mods to + * @param equipmentBlacklist equipment not allowed to be used by the bot + * @param botEquipmentRole bot type to generate pool for (e.g. assault, pmcBot, pmc for usec/bear) */ - generateDynamicModPool(itemDetails: ITemplateItem, modPool: Mods): void; + generateDynamicModPool(itemDetails: ITemplateItem, modPool: Mods, equipmentBlacklist: EquipmentFilterDetails[], botEquipmentRole: string): void; /** * Take a list of tpls and filter out blacklisted values using itemFilterService + botEquipmentBlacklist * @param allowedMods base mods to filter @@ -153,7 +159,7 @@ export declare class BotGeneratorHelper { * @param modTemplate Used to add additional properites in the upd object * @returns Item object */ - protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem): Item; + protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem, botRole: string): Item; /** * randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot * never return true for an item that has 0% spawn chance @@ -170,10 +176,10 @@ export declare class BotGeneratorHelper { */ protected getAmmoContainers(): string[]; /** - * Get the slot details for an item (chamber/cartridge/slot) + * Get a Slot property for an item (chamber/cartridge/slot) * @param modSlot e.g patron_in_weapon * @param parentTemplate item template - * @returns + * @returns Slot item */ protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; /** @@ -185,7 +191,6 @@ export declare class BotGeneratorHelper { * @param modPool modPool which should include available cartrigdes * @param parentId The CylinderMagazine's UID * @param parentTemplate The CylinderMagazine's template - * @returns */ protected fillCamora(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem): void; /** @@ -197,11 +202,11 @@ export declare class BotGeneratorHelper { /** * Adds properties to an item * e.g. Repairable / HasHinge / Foldable / MaxDurability - * @param itemTemplate - * @param botRole Used by weapons to randomise the durability values + * @param itemTemplate Item extra properties are being generated for + * @param botRole Used by weapons to randomise the durability values. Null for non-equipped items * @returns Item Upd object with extra properties */ - generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: any): { + generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: string): { upd?: Upd; }; /** @@ -220,21 +225,27 @@ export declare class BotGeneratorHelper { protected generateArmorRepairableProperties(itemTemplate: ITemplateItem, botRole: string): Repairable; /** * Get a random mod from an items compatible mods Filter array - * @param modTpl - * @param parentSlot - * @param modSlot - * @param items + * @param modTpl ???? + * @param parentSlot item mod will go into, used to get combatible items + * @param modSlot Slot to get mod to fill + * @param items items to ensure picked mod is compatible with * @returns item tpl */ protected getModTplFromItemDb(modTpl: string, parentSlot: Slot, modSlot: string, items: Item[]): string; /** * Can an item be added to an item without issue - * @param items - * @param tplToCheck - * @param equipmentSlot - * @returns true if possible + * @param items items to check compatiblilities with + * @param tplToCheck tpl of the item to check for incompatibilities + * @param equipmentSlot Slot the item will be placed into + * @returns false if no incompatibilties */ isItemIncompatibleWithCurrentItems(items: Item[], tplToCheck: string, equipmentSlot: string): boolean; + /** + * Convert a bots role to the equipment role used in config/bot.json + * @param botRole Role to convert + * @returns Equipment role (e.g. pmc / assault / bossTagilla) + */ + getBotEquipmentRole(botRole: string): string; } /** TODO - move into own class */ export declare class ExhaustableArray { diff --git a/TypeScript/10ScopesAndTypes/types/helpers/BotHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/BotHelper.d.ts index 67a6384..a7f779e 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/BotHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/BotHelper.d.ts @@ -3,6 +3,7 @@ import { IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; export declare class BotHelper { @@ -10,46 +11,27 @@ export declare class BotHelper { protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, configServer: ConfigServer); - /** - * Get difficulty settings for desired bot type, if not found use assault bot types - * @param type bot type to retreive difficulty of - * @param difficulty difficulty to get settings for (easy/normal etc) - * @returns Difficulty object - */ - getBotDifficultySettings(type: string, difficulty: string): Difficulty; + constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, localisationService: LocalisationService, configServer: ConfigServer); /** * Get a template object for the specified botRole from bots.types db * @param role botRole to get template for * @returns IBotType object */ getBotTemplate(role: string): IBotType; - /** - * Get difficulty settings for a PMC - * @param type "usec" / "bear" - * @param difficulty what difficulty to retrieve - * @returns Difficulty object - */ - getPmcDifficultySettings(type: string, difficulty: string): Difficulty; - /** - * Translate chosen value from pre-raid difficulty dropdown into bot difficulty value - * @param dropDownDifficulty Dropdown difficulty value to convert - * @returns bot difficulty - */ - convertBotDifficultyDropdownToBotDifficulty(dropDownDifficulty: string): string; - /** - * Choose a random difficulty from - easy/normal/hard/impossible - * @returns random difficulty - */ - chooseRandomDifficulty(): string; /** * Randomise the chance the PMC will attack their own side * Look up value in bot.json/chanceSameSideIsHostilePercent * @param difficultySettings pmc difficulty settings */ randomisePmcHostility(difficultySettings: Difficulty): void; + /** + * Is the passed in bot role a PMC (usec/bear/pmc) + * @param botRole bot role to check + * @returns true if is pmc + */ isBotPmc(botRole: string): boolean; isBotBoss(botRole: string): boolean; isBotFollower(botRole: string): boolean; diff --git a/TypeScript/10ScopesAndTypes/types/helpers/GameEventHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/GameEventHelper.d.ts index fca87be..fa25eff 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/GameEventHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/GameEventHelper.d.ts @@ -15,4 +15,15 @@ export declare class GameEventHelper { * @returns Record with event name + start/end date */ getEventDetails(): ISeasonalEvent[]; + /** + * Is detection of seasonal events enabled (halloween / christmas) + * @returns true if seasonal events should be checked for + */ + isAutomaticEventDetectionEnabled(): boolean; + /** + * Get a dictionary of gear changes to apply to bots for a specific event e.g. Christmas/Halloween + * @param eventName Name of event to get gear changes for + * @returns bots with equipment changes + */ + getEventBotGear(eventName: string): Record>>; } diff --git a/TypeScript/10ScopesAndTypes/types/helpers/HideoutHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/HideoutHelper.d.ts index 5f7e3b7..9d51fed 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/HideoutHelper.d.ts @@ -11,6 +11,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { PlayerService } from "../services/PlayerService"; import { HashUtil } from "../utils/HashUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; @@ -29,13 +30,14 @@ export declare class HideoutHelper { protected profileHelper: ProfileHelper; protected inventoryHelper: InventoryHelper; protected playerService: PlayerService; + protected localisationService: LocalisationService; protected configServer: ConfigServer; static bitcoinFarm: string; static waterCollector: string; static bitcoin: string; static expeditionaryFuelTank: string; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, localisationService: LocalisationService, configServer: ConfigServer); registerProduction(pmcData: IPmcData, body: IHideoutSingleProductionStartRequestData | IHideoutContinousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; /** * This convinience function intialies new Production Object diff --git a/TypeScript/10ScopesAndTypes/types/helpers/InventoryHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/InventoryHelper.d.ts index b8e5c9d..6419f93 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/InventoryHelper.d.ts @@ -5,11 +5,12 @@ import { IInventoryMergeRequestData } from "../models/eft/inventory/IInventoryMe import { IInventoryMoveRequestData } from "../models/eft/inventory/IInventoryMoveRequestData"; import { IInventorySplitRequestData } from "../models/eft/inventory/IInventorySplitRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { IInventoryConfig } from "../models/spt/config/IInventoryConfig"; +import { IInventoryConfig, RewardDetails } from "../models/spt/config/IInventoryConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { JsonUtil } from "../utils/JsonUtil"; @@ -38,9 +39,10 @@ export declare class InventoryHelper { protected itemHelper: ItemHelper; protected containerHelper: ContainerHelper; protected profileHelper: ProfileHelper; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected inventoryConfig: IInventoryConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); addItem(pmcData: IPmcData, body: IAddItemRequestData, output: IItemEventRouterResponse, sessionID: string, callback: any, foundInRaid?: boolean, addUpd?: any): IItemEventRouterResponse; removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; removeItemByCount(pmcData: IPmcData, itemId: string, count: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; @@ -76,6 +78,12 @@ export declare class InventoryHelper { * Internal helper function to handle cartridges in inventory if any of them exist. */ protected handleCartridges(items: Item[], body: IInventoryMoveRequestData): void; + /** + * Get details for how a random loot container should be handled, max rewards, possible reward tpls + * @param itemTpl Container being opened + * @returns Reward details + */ + getRandomLootContainerRewardDetails(itemTpl: string): RewardDetails; } declare namespace InventoryHelper { interface InventoryItemHash { diff --git a/TypeScript/10ScopesAndTypes/types/helpers/ItemHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/ItemHelper.d.ts index 0effaf2..fc88a46 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/ItemHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/ItemHelper.d.ts @@ -5,6 +5,7 @@ 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 { LocaleService } from "../services/LocaleService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; @@ -18,7 +19,8 @@ declare class ItemHelper { protected objectId: ObjectId; protected mathUtil: MathUtil; protected databaseServer: DatabaseServer; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer); + protected localeService: LocaleService; + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, localeService: LocaleService); /** * Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash * @param {string} tpl the template id / tpl @@ -212,6 +214,12 @@ declare class ItemHelper { * @returns size of stack */ getItemStackSize(item: Item): number; + /** + * Get the name of an item from the locale file using the item tpl + * @param itemTpl Tpl of item to get name of + * @returns Name of item + */ + getItemName(itemTpl: string): string; } declare namespace ItemHelper { interface ItemSize { diff --git a/TypeScript/10ScopesAndTypes/types/helpers/QuestHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/QuestHelper.d.ts index a6b4892..edbd2e1 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/QuestHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/QuestHelper.d.ts @@ -50,6 +50,12 @@ export declare class QuestHelper { * @returns true if player level is greater than or equal to quest */ doesPlayerLevelFulfilCondition(playerLevel: number, condition: AvailableForConditions): boolean; + /** + * Get the quests found in both arrays (inner join) + * @param before Array of qeusts #1 + * @param after Array of quests #2 + * @returns Reduction of cartesian product between two quest arrays + */ getDeltaQuests(before: IQuest[], after: IQuest[]): IQuest[]; /** * Increase skill points of a skill on player profile @@ -66,38 +72,85 @@ export declare class QuestHelper { * quest list in question. */ dumpQuests(quests: any): void; - loyaltyRequirementCheck(loyaltyRequirementProperties: AvailableForProps, profile: IPmcData): boolean; - protected processReward(reward: Reward): any[]; + /** + * Check if trader has sufficient loyalty to fullfill quest requirement + * @param questProperties Quest props + * @param profile Player profile + * @returns true if loyalty is high enough to fulfil quest requirement + */ + traderStandingRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; + protected processReward(reward: Reward): Reward[]; + /** + * Gets a flat list of reward items for the given quest at a specific state (e.g. Fail/Success) + * @param quest quest to get rewards for + * @param state Quest status that holds the items (Started, Success, Fail) + * @returns array of items with the correct maxStack + */ getQuestRewardItems(quest: IQuest, state: QuestStatus): Reward[]; /** - * Add quest with new state value to pmc profile + * Update player profile with quest status (e.g. Fail/Success) * @param pmcData profile to add quest to * @param newState state the new quest should be in when added * @param acceptedQuest Details of quest being added */ addQuestToPMCData(pmcData: IPmcData, newState: QuestStatus, acceptedQuest: IAcceptQuestRequestData): void; - acceptedUnlocked(acceptedQuestId: string, sessionID: string): IQuest[]; - failedUnlocked(failedQuestId: string, sessionID: string): IQuest[]; - applyMoneyBoost(quest: IQuest, moneyBoost: number): IQuest; - changeItemStack(pmcData: IPmcData, id: string, value: number, sessionID: string, output: any): void; /** - * Get List of All Quests as an array + * TODO: what is going on here + * @param acceptedQuestId Quest to add to profile + * @param sessionID Session id + * @returns Array of quests in profile + quest passed in as param + */ + acceptedUnlocked(acceptedQuestId: string, sessionID: string): IQuest[]; + /** + * TODO: what is going on here + * @param failedQuestId + * @param sessionID Session id + * @returns + */ + failedUnlocked(failedQuestId: string, sessionID: string): IQuest[]; + /** + * Adjust quest money rewards by passed in multipler + * @param quest Quest to multiple money rewards + * @param multipler Value to adjust money rewards by + * @returns Updated quest + */ + applyMoneyBoost(quest: IQuest, multipler: number): IQuest; + /** + * Sets the item stack to new value, or delete the item if value <= 0 + * // TODO maybe merge this function and the one from customization + * @param pmcData Profile + * @param itemId id of item to adjust stack size of + * @param newStackSize Stack size to adjust to + * @param sessionID Session id + * @param output ItemEvent router response + */ + changeItemStack(pmcData: IPmcData, itemId: string, newStackSize: number, sessionID: string, output: IItemEventRouterResponse): void; + /** + * Get List of All Quests from db + * NOT CLONED * @returns Array of IQuest objects */ - questValues(): IQuest[]; + getQuestsFromDb(): IQuest[]; /** - * Reest AvailableForStart conditions for quests - * @param quests queststo clean + * Get quests, strip all requirement conditions except level + * @param quests quests to process * @returns quest array without conditions */ - protected cleanQuestList(quests: IQuest[]): IQuest[]; + protected getQuestsWithOnlyLevelRequirementStartCondition(quests: IQuest[]): IQuest[]; /** - * Reset AvailableForStart conditions on a quest + * Remove all quest conditions except for level requirement * @param quest quest to clean * @returns reset IQuest object */ - cleanQuestConditions(quest: IQuest): IQuest; - failQuest(pmcData: IPmcData, body: any, sessionID: string): any; + getQuestWithOnlyLevelRequirementStartCondition(quest: IQuest): IQuest; + /** + * Fail a quest in a player profile + * @param pmcData Profile + * @param failRequest fail quest request data + * @param sessionID Session id + * @returns Item event router response + */ + failQuest(pmcData: IPmcData, failRequest: any, sessionID: string): IItemEventRouterResponse; /** * Get quest by id from database * @param questId questid to look for @@ -105,7 +158,12 @@ export declare class QuestHelper { * @returns IQuest object */ getQuestFromDb(questId: string, pmcData: IPmcData): IQuest; - getQuestLocaleIdFromDb(messageId: string): string; + /** + * Get the locale Id from locale db for a quest message + * @param questMessageId Quest mesage id to look up + * @returns Locale Id from locale db + */ + getQuestLocaleIdFromDb(questMessageId: string): string; /** * Alter a quests state + Add a record to tis status timers object * @param pmcData Profile to update @@ -128,5 +186,10 @@ export declare class QuestHelper { * @returns bonus in percent */ protected getIntelCenterRewardBonus(pmcData: IPmcData): number; - getFindItemIdForQuestItem(itemTpl: string): string; + /** + * Find quest with 'findItem' requirement that needs the item tpl be handed in + * @param itemTpl item tpl to look for + * @returns 'FindItem' condition id + */ + getFindItemIdForQuestHandIn(itemTpl: string): string; } diff --git a/TypeScript/10ScopesAndTypes/types/helpers/RagfairServerHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/RagfairServerHelper.d.ts index a03cdda..ec388d8 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/RagfairServerHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/RagfairServerHelper.d.ts @@ -44,10 +44,20 @@ export declare class RagfairServerHelper { isPlayer(userID: string): boolean; returnItems(sessionID: string, items: any[]): void; calculateDynamicStackCount(tplId: string, isWeaponPreset: boolean): number; + /** + * Choose a currency at random with bias + * @returns currency tpl + */ getDynamicOfferCurrency(): string; getMemberType(userID: string): MemberCategory; getNickname(userID: string): string; getPresetItems(item: any): Item[]; getPresetItemsByTpl(item: Item): Item[]; + /** + * Generate new unique ids for the children while preserving hierarchy + * @param item base item + * @param preset + * @returns Item array with new IDs + */ reparentPresets(item: Item, preset: Item[]): Item[]; } diff --git a/TypeScript/10ScopesAndTypes/types/helpers/RagfairSortHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/RagfairSortHelper.d.ts index 28d1d38..4669ce6 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/RagfairSortHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/RagfairSortHelper.d.ts @@ -18,7 +18,7 @@ export declare class RagfairSortHelper { protected sortOffersByRating(a: IRagfairOffer, b: IRagfairOffer): number; protected sortOffersByName(a: IRagfairOffer, b: IRagfairOffer): number; /** - * Order two offers by price value + * Order two offers by rouble price value * @param a Offer a * @param b Offer b * @returns diff --git a/TypeScript/10ScopesAndTypes/types/loaders/PreAkiModLoader.d.ts b/TypeScript/10ScopesAndTypes/types/loaders/PreAkiModLoader.d.ts index 7a687a5..f486a28 100644 --- a/TypeScript/10ScopesAndTypes/types/loaders/PreAkiModLoader.d.ts +++ b/TypeScript/10ScopesAndTypes/types/loaders/PreAkiModLoader.d.ts @@ -1,29 +1,31 @@ import { DependencyContainer } from "tsyringe"; +import { IPostAkiLoadMod } from "../models/external/IPostAkiLoadMod"; +import { IPostDBLoadMod } from "../models/external/IPostDBLoadMod"; +import { IPreAkiLoadMod } from "../models/external/IPreAkiLoadMod"; import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { ModLoader } from "../models/spt/mod/IMod"; import { IModLoader } from "../models/spt/mod/IModLoader"; import { IPackageJsonData } from "../models/spt/mod/IPackageJsonData"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { LocalisationService } from "../services/LocalisationService"; import { ModCompilerService } from "../services/ModCompilerService"; import { JsonUtil } from "../utils/JsonUtil"; import { VFS } from "../utils/VFS"; import { BundleLoader } from "./BundleLoader"; -import { IPostAkiLoadMod } from "../models/external/IPostAkiLoadMod"; -import { IPreAkiLoadMod } from "../models/external/IPreAkiLoadMod"; -import { IPostDBLoadMod } from "../models/external/IPostDBLoadMod"; export declare class PreAkiModLoader implements IModLoader { protected logger: ILogger; protected vfs: VFS; protected jsonUtil: JsonUtil; protected modCompilerService: ModCompilerService; protected bundleLoader: BundleLoader; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected static container: DependencyContainer; protected readonly basepath = "user/mods/"; protected imported: Record; protected akiConfig: ICoreConfig; - constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, modCompilerService: ModCompilerService, bundleLoader: BundleLoader, configServer: ConfigServer); + constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, modCompilerService: ModCompilerService, bundleLoader: BundleLoader, localisationService: LocalisationService, configServer: ConfigServer); load(container: DependencyContainer): Promise; getBundles(local: boolean): string; getBundle(key: string, local: boolean): void; diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/bot/IGenerateBotsRequestData.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/bot/IGenerateBotsRequestData.d.ts index c49cef7..f1f7013 100644 --- a/TypeScript/10ScopesAndTypes/types/models/eft/bot/IGenerateBotsRequestData.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/eft/bot/IGenerateBotsRequestData.d.ts @@ -2,6 +2,7 @@ export interface IGenerateBotsRequestData { conditions: Condition[]; } export interface Condition { + /** e.g. assault/pmcBot/bossKilla */ Role: string; Limit: number; Difficulty: string; diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/common/IGlobals.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/common/IGlobals.d.ts index 81e2023..b53f106 100644 --- a/TypeScript/10ScopesAndTypes/types/models/eft/common/IGlobals.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/eft/common/IGlobals.d.ts @@ -591,6 +591,7 @@ export interface HealPrice { export interface ProfileHealthSettings { BodyPartsSettings: BodyPartsSettings; HealthFactorsSettings: HealthFactorsSettings; + DefaultStimulatorBuff: string; } export interface BodyPartsSettings { Head: BodyPartsSetting; diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/IBotBase.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/IBotBase.d.ts index 1c28ae0..2b418c1 100644 --- a/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/IBotBase.d.ts @@ -107,6 +107,7 @@ export interface CurrentMax { Maximum: number; } export interface Inventory { + discardLimits: Record; items: Item[]; equipment: string; stash: string; diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/IBotType.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/IBotType.d.ts index c1fe579..55b4bd9 100644 --- a/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/IBotType.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/IBotType.d.ts @@ -13,8 +13,8 @@ export interface IBotType { skills: Skills; } export interface Appearance { - body: string[]; - feet: string[]; + body: Record; + feet: Record; hands: string[]; head: string[]; voice: string[]; diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/ITemplateItem.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/ITemplateItem.d.ts index 8569e61..0fa7e18 100644 --- a/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/eft/common/tables/ITemplateItem.d.ts @@ -254,7 +254,7 @@ export interface Props { foodUseTime?: number; foodEffectType?: string; StimulatorBuffs?: string; - effects_health?: any; + effects_health?: IHealthEffect[] | Record>; effects_damage?: any; MaximumNumberOfUsage?: number; knifeHitDelay?: number; @@ -366,6 +366,10 @@ export interface Props { MinTimeToContactExplode?: number; ExplosionEffectType?: string; } +export interface IHealthEffect { + type: string; + value: number; +} export interface Prefab { path: string; rcid: string; diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/customization/IGetSuitsResponse.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/customization/IGetSuitsResponse.d.ts new file mode 100644 index 0000000..fe6888c --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/models/eft/customization/IGetSuitsResponse.d.ts @@ -0,0 +1,4 @@ +export interface IGetSuitsResponse { + _id: string; + suits: string[]; +} diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/game/IGameKeepAliveResponse.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/game/IGameKeepAliveResponse.d.ts new file mode 100644 index 0000000..170ce6a --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/models/eft/game/IGameKeepAliveResponse.d.ts @@ -0,0 +1,4 @@ +export interface IGameKeepAliveResponse { + msg: string; + utc_time: number; +} diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/game/IGameLogoutResponseData.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/game/IGameLogoutResponseData.d.ts new file mode 100644 index 0000000..0f52050 --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/models/eft/game/IGameLogoutResponseData.d.ts @@ -0,0 +1,3 @@ +export interface IGameLogoutResponseData { + status: string; +} diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/game/IGameStartResponse.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/game/IGameStartResponse.d.ts new file mode 100644 index 0000000..9f0ab6d --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/models/eft/game/IGameStartResponse.d.ts @@ -0,0 +1,3 @@ +export interface IGameStartResponse { + utc_time: number; +} diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts new file mode 100644 index 0000000..3c45124 --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts @@ -0,0 +1,11 @@ +import { IInventoryBaseActionRequestData } from "./IInventoryBaseActionRequestData"; +export interface IOpenRandomLootContainerRequestData extends IInventoryBaseActionRequestData { + Action: "OpenRandomLootContainer"; + /** Container item opened */ + item: string; + to: To[]; +} +export interface To { + /** Player character (pmc/scav) id items will be sent to */ + id: string; +} diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/itemEvent/IItemEventRouterBase.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/itemEvent/IItemEventRouterBase.d.ts index 4841cfd..60ab284 100644 --- a/TypeScript/10ScopesAndTypes/types/models/eft/itemEvent/IItemEventRouterBase.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/eft/itemEvent/IItemEventRouterBase.d.ts @@ -10,8 +10,9 @@ export interface IItemEventRouterBase { export declare type TProfileChanges = Record; export interface Warning { index: number; - err: string; errmsg: string; + code?: string; + data?: any; } export interface ProfileChange { _id: string; diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/match/IStartOffineRaidRequestData.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/match/IStartOffineRaidRequestData.d.ts index af0625e..1983728 100644 --- a/TypeScript/10ScopesAndTypes/types/models/eft/match/IStartOffineRaidRequestData.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/eft/match/IStartOffineRaidRequestData.d.ts @@ -2,8 +2,10 @@ import { BotAmount } from "../../enums/BotAmount"; import { BotDifficulty } from "../../enums/BotDifficulty"; export interface IStartOfflineRaidRequestData { locationName: string; + /** Current time, not in-game time */ startTime: number; - dateTime: string; + /** CURR = am, past = pm */ + dateTime: "CURR" | "PAST"; gameSettings: GameSettings; } export interface GameSettings { diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/notifier/ISelectProfileResponse.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/notifier/ISelectProfileResponse.d.ts new file mode 100644 index 0000000..ecb668a --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/models/eft/notifier/ISelectProfileResponse.d.ts @@ -0,0 +1,6 @@ +import { INotifierChannel } from "./INotifier"; +export interface ISelectProfileResponse { + status: string; + notifier: INotifierChannel; + notifierServer: string; +} diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/ragfair/IRagfairOffer.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/ragfair/IRagfairOffer.d.ts index 3251a37..792ec7d 100644 --- a/TypeScript/10ScopesAndTypes/types/models/eft/ragfair/IRagfairOffer.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/eft/ragfair/IRagfairOffer.d.ts @@ -7,19 +7,19 @@ export interface IRagfairOffer { requirements: OfferRequirement[]; root: string; intId: number; + /** Handbook price */ itemsCost: number; + /** Rouble price */ requirementsCost: number; - sptRequirementsCostRouble: number; startTime: number; endTime: number; sellInOnePiece: boolean; - name?: string; - shortName?: string; loyaltyLevel: number; buyRestrictionMax?: number; buyRestrictionCurrent?: number; locked: boolean; unlimitedCount: boolean; + /** Rouble price */ summaryCost: number; user: IRagfairOfferUser; notAvailable: boolean; @@ -33,11 +33,11 @@ export interface OfferRequirement { } export interface IRagfairOfferUser { id: string; - nickname: string; - rating: number; + nickname?: string; + rating?: number; memberType: MemberCategory; - avatar: string; - isRatingGrowing: boolean; + avatar?: string; + isRatingGrowing?: boolean; } export interface SellResult { sellTime: number; diff --git a/TypeScript/10ScopesAndTypes/types/models/eft/weather/IWeatherData.d.ts b/TypeScript/10ScopesAndTypes/types/models/eft/weather/IWeatherData.d.ts index ecc96ce..1f5d5b5 100644 --- a/TypeScript/10ScopesAndTypes/types/models/eft/weather/IWeatherData.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/eft/weather/IWeatherData.d.ts @@ -1,17 +1,18 @@ +import { WindDirection } from "../../../models/enums/WindDirection"; export interface IWeatherData { acceleration: number; time: string; date: string; - weather: IWeather; + weather?: IWeather; } export interface IWeather { pressure: number; temp: number; - fog: string; + fog: number; rain_intensity: number; - rain: any; + rain: number; wind_gustiness: number; - wind_direction: any; + wind_direction: WindDirection; wind_speed: number; cloud: number; time: string; diff --git a/TypeScript/10ScopesAndTypes/types/models/enums/BackendErrorCodes.d.ts b/TypeScript/10ScopesAndTypes/types/models/enums/BackendErrorCodes.d.ts new file mode 100644 index 0000000..6614b75 --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/models/enums/BackendErrorCodes.d.ts @@ -0,0 +1,67 @@ +export declare enum BackendErrorCodes { + NONE = 0, + UNKNOWN_ERROR = 200, + NOT_AUTHORIZED = 201, + NEED_AUTHORIZATION_CODE = 209, + WRONG_AUTHORIZATION_CODE = 211, + NEED_CAPTCHA = 214, + NO_NEED_CAPTCHA = 215, + CAPTCHA_FAILED = 218, + CAPTCHA_BRUTE_FORCED = 219, + NO_ROOM_IN_STASH = 223, + NICKNAME_NOT_UNIQUE = 225, + NICKNAME_NOT_VALID = 226, + UNSUPPORTED_CLIENT_VERSION = 232, + REPORT_NOT_ALLOWED = 238, + NICKNAME_IS_ABUSIVE = 241, + NICKNAME_CHANGE_TIMEOUT = 242, + NOT_MODIFIED = 304, + HTTP_BAD_REQUEST = 400, + HTTP_NOT_AUTHORIZED = 401, + HTTP_FORBIDDEN = 403, + HTTP_NOT_FOUND = 404, + HTTP_METHOD_NOT_ALLOWED = 405, + UNKNOWN_TRADING_ERROR = 500, + HTTPNOTIMPLEMENTED = 501, + HTTPBADGATEWAY = 502, + HTTPSERVICEUNAVAILABLE = 503, + HTTPGATEWAYTIMEOUT = 504, + TRADEROUTOFMONEY = 505, + HTTPVARIANTALSONEGOTIATES = 506, + PRICECHANGED = 509, + TRADERDISABLED = 512, + ITEMHASBEENSOLD = 513, + NOTENOUGHSPACEFORMONEY = 518, + HTTPINVALIDSSLCERTIFICATE = 526, + UNKNOWNRAGFAIRERROR = 550, + UNKNOWNRAGFAIRERROR2 = 551, + UNKNOWNMATCHMAKERERROR = 600, + SESSIONPARAMETERSERROR = 601, + SESSIONLOST = 602, + SERVERNOTREGISTERED = 604, + UNKNOWNQUESTERROR = 700, + QUESTBADPARAM = 702, + QUESTNOTFOUND = 703, + QUESTISUNAVAILABLE = 704, + NOFREESPACEFORREWARDS = 705, + WRONGQUESTSTATUS = 706, + CANTCOMPLETEQUEST = 707, + UNKNOWNMAILERROR = 900, + TOOMANYFRIENDREQUESTS = 925, + UNKNOWNSCRIPTEXECUTIONERROR = 1000, + UNKNOWNREPAIRINGERROR = 1200, + UNKNOWNINSURANCEERROR = 1300, + UNKNOWNCURRENCYEXCHANGEERROR = 1400, + OFFERNOTFOUND = 1503, + NOTENOUGHSPACE = 1505, + OFFEROUTOFSTOCK = 1506, + OFFERSOLD = 1507, + RAGFAIRUNAVAILABLE = 1511, + BANNEDERRORCODE = 1513, + INSUFFICIENTNUMBERINSTOCK = 1516, + TOOMANYITEMSTOSELL = 1517, + EXAMINATIONFAILED = 22001, + ITEMALREADYEXAMINED = 22002, + UNKNOWNNGINXERROR = 9000, + PARSERESPONSEERROR = 9001 +} diff --git a/TypeScript/10ScopesAndTypes/types/models/enums/HideoutEventActions.d.ts b/TypeScript/10ScopesAndTypes/types/models/enums/HideoutEventActions.d.ts new file mode 100644 index 0000000..e441477 --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/models/enums/HideoutEventActions.d.ts @@ -0,0 +1,11 @@ +export declare enum HideoutEventActions { + HIDEOUT_UPGRADE = "HideoutUpgrade", + HIDEOUT_UPGRADE_COMPLETE = "HideoutUpgradeComplete", + HIDEOUT_PUT_ITEMS_IN_AREA_SLOTS = "HideoutPutItemsInAreaSlots", + HIDEOUT_TAKE_ITEMS_FROM_AREA_SLOTS = "HideoutTakeItemsFromAreaSlots", + HIDEOUT_TOGGLE_AREA = "HideoutToggleArea", + HIDEOUT_SINGLE_PRODUCTION_START = "HideoutSingleProductionStart", + HIDEOUT_SCAV_CASE_PRODUCTION_START = "HideoutScavCaseProductionStart", + HIDEOUT_CONTINUOUS_PRODUCTION_START = "HideoutContinuousProductionStart", + HIDEOUT_TAKE_PRODUCTION = "HideoutTakeProduction" +} diff --git a/TypeScript/10ScopesAndTypes/types/models/enums/ItemEventActions.d.ts b/TypeScript/10ScopesAndTypes/types/models/enums/ItemEventActions.d.ts new file mode 100644 index 0000000..0e65453 --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/models/enums/ItemEventActions.d.ts @@ -0,0 +1,19 @@ +export declare enum ItemEventActions { + MOVE = "Move", + REMOVE = "Remove", + SPLIT = "Split", + MERGE = "Merge", + TRANSFER = "Transfer", + SWAP = "Swap", + FOLD = "Fold", + TOGGLE = "Toggle", + TAG = "Tag", + BIND = "Bind", + EXAMINE = "Examine", + READ_ENCYCLOPEDIA = "ReadEncyclopedia", + APPLY_INVENTORY_CHANGES = "ApplyInventoryChanges", + CREATE_MAP_MARKER = "CreateMapMarker", + DELETE_MAP_MARKER = "DeleteMapMarker", + EDIT_MAP_MARKER = "EditMapMarker", + OPEN_RANDOM_LOOT_CONTAINER = "OpenRandomLootContainer" +} diff --git a/TypeScript/10ScopesAndTypes/types/models/enums/WeatherType.d.ts b/TypeScript/10ScopesAndTypes/types/models/enums/WeatherType.d.ts new file mode 100644 index 0000000..d31fefe --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/models/enums/WeatherType.d.ts @@ -0,0 +1,19 @@ +export declare enum WeatherType { + CLEAR_DAY = 1, + CLEAR_WIND = 2, + CLEAR_NIGHT = 3, + PARTLY_CLOUD_DAY = 4, + PARTLY_CLOUD_NIGHT = 5, + CLEAR_FOG_DAY = 6, + CLEAR_FOG_NIGHT = 7, + CLOUDFOG = 8, + FOG = 9, + MOSTLY_CLOUD = 10, + LIGHT_RAIN = 11, + RAIN = 12, + CLOUD_WIND = 13, + CLOUD_WIND_RAIN = 14, + FULL_CLOUD = 15, + THUNDER_CLOUD = 16, + NONE = 0 +} diff --git a/TypeScript/10ScopesAndTypes/types/models/enums/WildSpawnTypeNumber.d.ts b/TypeScript/10ScopesAndTypes/types/models/enums/WildSpawnTypeNumber.d.ts new file mode 100644 index 0000000..ff806fe --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/models/enums/WildSpawnTypeNumber.d.ts @@ -0,0 +1,33 @@ +export declare enum WildSpawnTypeNumber { + ASSAULT = 1, + MARKSMAN = 2, + BOSSTEST = 4, + BOSSBULLY = 8, + FOLLOWERTEST = 16, + FOLLOWERBULLY = 32, + BOSSKILLA = 64, + BOSSKOJANIY = 128, + FOLLOWERKOJANIY = 256, + PMCBOT = 512, + CURSEDASSAULT = 1024, + BOSSGLUHAR = 2048, + FOLLOWERGLUHARASSAULT = 4096, + FOLLOWERGLUHARSECURITY = 8192, + FOLLOWERGLUHARSCOUT = 16384, + FOLLOWERGLUHARSNIPE = 32768, + FOLLOWERSANITAR = 65536, + BOSSSANITAR = 131072, + TEST = 262144, + ASSAULTGROUP = 524288, + SECTANTWARRIOR = 1048576, + SECTANTPRIEST = 2097152, + BOSSTAGILLA = 4194304, + FOLLOWERTAGILLA = 8388608, + EXUSEC = 16777216, + GIFTER = 33554432, + BOSSKNIGHT = 67108864, + FOLLOWERBIGPIPE = 134217728, + FOLLOWERBIRDEYE = 268435456, + SPTUSEC = 536870912, + SPTBEAR = 1073741824 +} diff --git a/TypeScript/10ScopesAndTypes/types/models/enums/WindDirection.d.ts b/TypeScript/10ScopesAndTypes/types/models/enums/WindDirection.d.ts new file mode 100644 index 0000000..fb30b20 --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/models/enums/WindDirection.d.ts @@ -0,0 +1,10 @@ +export declare enum WindDirection { + EAST = 1, + NORTH = 2, + WEST = 3, + SOUTH = 4, + SE = 5, + SW = 6, + NW = 7, + NE = 8 +} diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/config/IBotConfig.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/config/IBotConfig.d.ts index af8ceba..d6fa5e0 100644 --- a/TypeScript/10ScopesAndTypes/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/spt/config/IBotConfig.d.ts @@ -27,6 +27,8 @@ export interface IBotConfig extends IBaseConfig { maxBotCap: Record; /** How many stacks of secret ammo should a bot have in its bot secure container */ secureContainerAmmoStackCount: number; + /** Batch generation size when type not available in cache */ + botGenerationBatchSizePerType: number; } export interface PresetBatch { assault: number; @@ -66,8 +68,12 @@ export interface EquipmentFilters { weaponModLimits: ModLimits; randomisedWeaponModSlots?: string[]; randomisedArmorSlots?: string[]; + faceShieldIsActiveChancePercent?: number; + lightLaserIsActiveChancePercent?: number; blacklist: EquipmentFilterDetails[]; whitelist: EquipmentFilterDetails[]; + clothing: WeightingAdjustmentDetails[]; + weightingAdjustments: WeightingAdjustmentDetails[]; } export interface ModLimits { /** How many scopes are allowed on a weapon - hard coded to work with OPTIC_SCOPE, ASSAULT_SCOPE, COLLIMATOR, COMPACT_COLLIMATOR */ @@ -80,3 +86,8 @@ export interface EquipmentFilterDetails { equipment: Record; cartridge: Record; } +export interface WeightingAdjustmentDetails { + levelRange: MinMax; + add: Record>; + edit: Record>; +} diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/config/IInventoryConfig.d.ts index ffffa41..4642b9b 100644 --- a/TypeScript/10ScopesAndTypes/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/spt/config/IInventoryConfig.d.ts @@ -2,4 +2,10 @@ import { IBaseConfig } from "./IBaseConfig"; export interface IInventoryConfig extends IBaseConfig { kind: "aki-inventory"; newItemsMarkedFound: boolean; + randomLootContainers: Record; +} +export interface RewardDetails { + rewardCount: number; + foundInRaid: boolean; + rewardTplPool: Record; } diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/config/ILocaleConfig.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/config/ILocaleConfig.d.ts index fe9abf7..0a8955c 100644 --- a/TypeScript/10ScopesAndTypes/types/models/spt/config/ILocaleConfig.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/spt/config/ILocaleConfig.d.ts @@ -1,5 +1,10 @@ import { IBaseConfig } from "./IBaseConfig"; export interface ILocaleConfig extends IBaseConfig { kind: "aki-locale"; - desiredLocale: string; + /** e.g. ru/en/cn/fr etc, or 'system', will take computer locale setting */ + gameLocale: string; + /** e.g. ru/en/cn/fr etc, or 'system', will take computer locale setting */ + serverLocale: string; + /** Languages server can be translated into */ + serverSupportedLocales: string[]; } diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/config/IPmcConfig.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/config/IPmcConfig.d.ts index 9db2ba1..48601b2 100644 --- a/TypeScript/10ScopesAndTypes/types/models/spt/config/IPmcConfig.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/spt/config/IPmcConfig.d.ts @@ -6,9 +6,11 @@ export interface IPmcConfig { looseWeaponInBackpackChancePercent: number; looseWeaponInBackpackLootMinMax: MinMax; isUsec: number; + usecType: string; + bearType: string; chanceSameSideIsHostilePercent: number; /** key: location, value: type for usec/bear */ - pmcType: Record; + pmcType: Record>>; maxBackpackLootTotalRub: number; maxPocketLootTotalRub: number; maxVestLootTotalRub: number; diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/config/IRagfairConfig.d.ts index c1b8763..6786417 100644 --- a/TypeScript/10ScopesAndTypes/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/spt/config/IRagfairConfig.d.ts @@ -28,12 +28,8 @@ export interface Reputation { gain: number; loss: number; } -export declare class OfferAdjustment { - maxPriceDifferenceBelowHandbookPercent: number; - handbookPriceMultipier: number; - priceThreshholdRub: number; -} export interface Dynamic { + barter: Barter; offerAdjustment: OfferAdjustment; expiredOfferThreshold: number; offerItemCount: MinMax; @@ -49,6 +45,20 @@ export interface Dynamic { showAsSingleStack: string[]; blacklist: Blacklist; } +export declare class Barter { + enable: boolean; + chancePercent: number; + itemCountMin: number; + itemCountMax: number; + priceRangeVariancePercent: number; + minRoubleCostToBecomeBarter: number; + itemTypeBlacklist: string[]; +} +export declare class OfferAdjustment { + maxPriceDifferenceBelowHandbookPercent: number; + handbookPriceMultipier: number; + priceThreshholdRub: number; +} export interface Condition { conditionChance: number; min: number; diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/config/ISeasonalEventConfig.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/config/ISeasonalEventConfig.d.ts index bc60618..e410925 100644 --- a/TypeScript/10ScopesAndTypes/types/models/spt/config/ISeasonalEventConfig.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/spt/config/ISeasonalEventConfig.d.ts @@ -1,6 +1,9 @@ import { IBaseConfig } from "./IBaseConfig"; export interface ISeasonalEventConfig extends IBaseConfig { kind: "aki-seasonalevents"; + enableSeasonalEventDetection: boolean; + /** event / botType / equipSlot / itemid */ + eventGear: Record>>>; events: ISeasonalEvent[]; } export interface ISeasonalEvent { diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/config/IWeatherConfig.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/config/IWeatherConfig.d.ts index bbdc43e..41a1c83 100644 --- a/TypeScript/10ScopesAndTypes/types/models/spt/config/IWeatherConfig.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/spt/config/IWeatherConfig.d.ts @@ -1,3 +1,4 @@ +import { WindDirection } from "../../../models/enums/WindDirection"; import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface IWeatherConfig extends IBaseConfig { @@ -7,12 +8,16 @@ export interface IWeatherConfig extends IBaseConfig { } export interface Weather { clouds: MinMax; - windSpeed: MinMax; - windDirection: MinMax; + windSpeed: WeatherSettings; + windDirection: WeatherSettings; windGustiness: MinMax; - rain: MinMax; + rain: WeatherSettings; rainIntensity: MinMax; - fog: MinMax; + fog: WeatherSettings; temp: MinMax; pressure: MinMax; } +export interface WeatherSettings { + values: T[]; + weights: number[]; +} diff --git a/TypeScript/10ScopesAndTypes/types/routers/item_events/HideoutItemEventRouter.d.ts b/TypeScript/10ScopesAndTypes/types/routers/item_events/HideoutItemEventRouter.d.ts index e1e98af..44bd1cd 100644 --- a/TypeScript/10ScopesAndTypes/types/routers/item_events/HideoutItemEventRouter.d.ts +++ b/TypeScript/10ScopesAndTypes/types/routers/item_events/HideoutItemEventRouter.d.ts @@ -1,7 +1,7 @@ -import { IPmcData } from "../../models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "../../models/eft/itemEvent/IItemEventRouterResponse"; import { HideoutCallbacks } from "../../callbacks/HideoutCallbacks"; import { HandledRoute, ItemEventRouterDefinition } from "../../di/Router"; +import { IPmcData } from "../../models/eft/common/IPmcData"; +import { IItemEventRouterResponse } from "../../models/eft/itemEvent/IItemEventRouterResponse"; export declare class HideoutItemEventRouter extends ItemEventRouterDefinition { protected hideoutCallbacks: HideoutCallbacks; constructor(hideoutCallbacks: HideoutCallbacks); diff --git a/TypeScript/10ScopesAndTypes/types/routers/item_events/InventoryItemEventRouter.d.ts b/TypeScript/10ScopesAndTypes/types/routers/item_events/InventoryItemEventRouter.d.ts index 2619bb9..953d322 100644 --- a/TypeScript/10ScopesAndTypes/types/routers/item_events/InventoryItemEventRouter.d.ts +++ b/TypeScript/10ScopesAndTypes/types/routers/item_events/InventoryItemEventRouter.d.ts @@ -1,7 +1,7 @@ -import { IPmcData } from "../../models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "../../models/eft/itemEvent/IItemEventRouterResponse"; import { InventoryCallbacks } from "../../callbacks/InventoryCallbacks"; import { HandledRoute, ItemEventRouterDefinition } from "../../di/Router"; +import { IPmcData } from "../../models/eft/common/IPmcData"; +import { IItemEventRouterResponse } from "../../models/eft/itemEvent/IItemEventRouterResponse"; export declare class InventoryItemEventRouter extends ItemEventRouterDefinition { protected inventoryCallbacks: InventoryCallbacks; constructor(inventoryCallbacks: InventoryCallbacks); diff --git a/TypeScript/10ScopesAndTypes/types/servers/HttpServer.d.ts b/TypeScript/10ScopesAndTypes/types/servers/HttpServer.d.ts index bbca8af..80c1d48 100644 --- a/TypeScript/10ScopesAndTypes/types/servers/HttpServer.d.ts +++ b/TypeScript/10ScopesAndTypes/types/servers/HttpServer.d.ts @@ -4,6 +4,7 @@ import { ApplicationContext } from "../context/ApplicationContext"; import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; import { ILogger } from "../models/spt/utils/ILogger"; +import { LocalisationService } from "../services/LocalisationService"; import { ConfigServer } from "./ConfigServer"; import { DatabaseServer } from "./DatabaseServer"; import { IHttpListener } from "./http/IHttpListener"; @@ -12,11 +13,12 @@ export declare class HttpServer { protected logger: ILogger; protected databaseServer: DatabaseServer; protected httpServerHelper: HttpServerHelper; + protected localisationService: LocalisationService; protected httpListeners: IHttpListener[]; protected configServer: ConfigServer; protected applicationContext: ApplicationContext; protected webSocketServer: WebSocketServer; - constructor(logger: ILogger, databaseServer: DatabaseServer, httpServerHelper: HttpServerHelper, httpListeners: IHttpListener[], configServer: ConfigServer, applicationContext: ApplicationContext, webSocketServer: WebSocketServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, httpServerHelper: HttpServerHelper, localisationService: LocalisationService, httpListeners: IHttpListener[], configServer: ConfigServer, applicationContext: ApplicationContext, webSocketServer: WebSocketServer); protected httpConfig: IHttpConfig; getCookies(req: http.IncomingMessage): any; handleRequest(req: IncomingMessage, resp: ServerResponse): void; diff --git a/TypeScript/10ScopesAndTypes/types/servers/SaveServer.d.ts b/TypeScript/10ScopesAndTypes/types/servers/SaveServer.d.ts index cb28f49..4dca514 100644 --- a/TypeScript/10ScopesAndTypes/types/servers/SaveServer.d.ts +++ b/TypeScript/10ScopesAndTypes/types/servers/SaveServer.d.ts @@ -1,20 +1,22 @@ +import { SaveLoadRouter } from "../di/Router"; import { IAkiProfile, Info } from "../models/eft/profile/IAkiProfile"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { VFS } from "../utils/VFS"; -import { SaveLoadRouter } from "../di/Router"; -import { ILogger } from "../models/spt/utils/ILogger"; export declare class SaveServer { protected vfs: VFS; protected saveLoadRouters: SaveLoadRouter[]; protected jsonUtil: JsonUtil; protected hashUtil: HashUtil; + protected localisationService: LocalisationService; protected logger: ILogger; protected profileFilepath: string; protected profiles: {}; protected onSave: {}; protected saveMd5: {}; - constructor(vfs: VFS, saveLoadRouters: SaveLoadRouter[], jsonUtil: JsonUtil, hashUtil: HashUtil, logger: ILogger); + constructor(vfs: VFS, saveLoadRouters: SaveLoadRouter[], jsonUtil: JsonUtil, hashUtil: HashUtil, localisationService: LocalisationService, logger: ILogger); load(): void; save(): void; getProfile(sessionId: string): IAkiProfile; diff --git a/TypeScript/10ScopesAndTypes/types/servers/WebSocketServer.d.ts b/TypeScript/10ScopesAndTypes/types/servers/WebSocketServer.d.ts index f33d214..5d40e6e 100644 --- a/TypeScript/10ScopesAndTypes/types/servers/WebSocketServer.d.ts +++ b/TypeScript/10ScopesAndTypes/types/servers/WebSocketServer.d.ts @@ -1,18 +1,20 @@ /// -import { HttpServerHelper } from "../helpers/HttpServerHelper"; -import WebSocket from "ws"; import http, { IncomingMessage } from "http"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { RandomUtil } from "../utils/RandomUtil"; +import WebSocket from "ws"; +import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { INotification } from "../models/eft/notifier/INotifier"; -import { ConfigServer } from "./ConfigServer"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { LocalisationService } from "../services/LocalisationService"; +import { RandomUtil } from "../utils/RandomUtil"; +import { ConfigServer } from "./ConfigServer"; export declare class WebSocketServer { protected logger: ILogger; protected randomUtil: RandomUtil; protected configServer: ConfigServer; + protected localisationService: LocalisationService; protected httpServerHelper: HttpServerHelper; - constructor(logger: ILogger, randomUtil: RandomUtil, configServer: ConfigServer, httpServerHelper: HttpServerHelper); + constructor(logger: ILogger, randomUtil: RandomUtil, configServer: ConfigServer, localisationService: LocalisationService, httpServerHelper: HttpServerHelper); protected httpConfig: IHttpConfig; protected defaultNotification: INotification; protected webSockets: Record; diff --git a/TypeScript/10ScopesAndTypes/types/servers/http/AkiHttpListener.d.ts b/TypeScript/10ScopesAndTypes/types/servers/http/AkiHttpListener.d.ts index 6f78939..acf92aa 100644 --- a/TypeScript/10ScopesAndTypes/types/servers/http/AkiHttpListener.d.ts +++ b/TypeScript/10ScopesAndTypes/types/servers/http/AkiHttpListener.d.ts @@ -1,22 +1,24 @@ /// /// import { IncomingMessage, ServerResponse } from "http"; -import { IHttpListener } from "./IHttpListener"; import { Serializer } from "../../di/Serializer"; import { ILogger } from "../../models/spt/utils/ILogger"; import { HttpRouter } from "../../routers/HttpRouter"; +import { LocalisationService } from "../../services/LocalisationService"; import { HttpResponseUtil } from "../../utils/HttpResponseUtil"; import { JsonUtil } from "../../utils/JsonUtil"; import { HttpBufferHandler } from "./HttpBufferHandler"; +import { IHttpListener } from "./IHttpListener"; export declare class AkiHttpListener implements IHttpListener { protected httpRouter: HttpRouter; protected serializers: Serializer[]; protected logger: ILogger; protected jsonUtil: JsonUtil; protected httpResponse: HttpResponseUtil; + protected localisationService: LocalisationService; protected httpBufferHandler: HttpBufferHandler; constructor(httpRouter: HttpRouter, // TODO: delay required - serializers: Serializer[], logger: ILogger, jsonUtil: JsonUtil, httpResponse: HttpResponseUtil, httpBufferHandler: HttpBufferHandler); + serializers: Serializer[], logger: ILogger, jsonUtil: JsonUtil, httpResponse: HttpResponseUtil, localisationService: LocalisationService, httpBufferHandler: HttpBufferHandler); canHandle(_: string, req: IncomingMessage): boolean; handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): void; sendResponse(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: Buffer, output: string): void; diff --git a/TypeScript/10ScopesAndTypes/types/services/BotEquipmentFilterService.d.ts b/TypeScript/10ScopesAndTypes/types/services/BotEquipmentFilterService.d.ts index 632f961..ae72cc3 100644 --- a/TypeScript/10ScopesAndTypes/types/services/BotEquipmentFilterService.d.ts +++ b/TypeScript/10ScopesAndTypes/types/services/BotEquipmentFilterService.d.ts @@ -1,12 +1,12 @@ import { IBotType } from "../models/eft/common/tables/IBotType"; -import { EquipmentFilters, EquipmentFilterDetails, IBotConfig } from "../models/spt/config/IBotConfig"; +import { EquipmentFilters, EquipmentFilterDetails, IBotConfig, WeightingAdjustmentDetails } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; export declare class BotEquipmentFilterService { protected logger: ILogger; protected configServer: ConfigServer; protected botConfig: IBotConfig; - protected botEquipmentFilterlists: Record; + protected botEquipmentConfig: Record; constructor(logger: ILogger, configServer: ConfigServer); /** * Filter a bots data to exclude equipment and cartridges defines in the botConfig @@ -30,6 +30,20 @@ export declare class BotEquipmentFilterService { * @returns EquipmentFilterDetails object */ protected getBotEquipmentWhitelist(botRole: string, playerLevel: number): EquipmentFilterDetails; + /** + * Retreive clothing weighting adjustments from bot.json config + * @param botRole Bot type to get adjustments for + * @param playerLevel level of player + * @returns Weighting adjustments for bots clothing + */ + protected getBotClothingAdjustments(botRole: string, playerLevel: number): WeightingAdjustmentDetails; + /** + * Retreive item weighting adjustments from bot.json config + * @param botRole Bot type to get adjustments for + * @param playerLevel level of player + * @returns Weighting adjustments for bot items + */ + protected getBotWeightingAdjustments(botRole: string, playerLevel: number): WeightingAdjustmentDetails; /** * Filter bot equipment based on blacklist and whitelist from config/bot.json * Prioritises whitelist first, if one is found blacklist is ignored @@ -47,4 +61,10 @@ export declare class BotEquipmentFilterService { * @returns Filtered bot file */ protected filterCartridges(baseBotNode: IBotType, blacklist: EquipmentFilterDetails, whitelist: EquipmentFilterDetails): void; + /** + * Add/Edit weighting changes to bot items using values from config/bot.json/equipment + * @param weightingAdjustments Weighting change to apply to bot + * @param botItemPool Bot item dictionary to adjust + */ + protected adjustWeighting(weightingAdjustments: WeightingAdjustmentDetails, botItemPool: Record): void; } diff --git a/TypeScript/10ScopesAndTypes/types/services/BotGenerationCacheService.d.ts b/TypeScript/10ScopesAndTypes/types/services/BotGenerationCacheService.d.ts index ba53fec..0be0576 100644 --- a/TypeScript/10ScopesAndTypes/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/10ScopesAndTypes/types/services/BotGenerationCacheService.d.ts @@ -8,11 +8,11 @@ export declare class BotGenerationCacheService { protected randomUtil: RandomUtil; protected jsonUtil: JsonUtil; protected botHelper: BotHelper; - protected storedBots: IBotBase[]; + protected storedBots: Map; constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, botHelper: BotHelper); /** * Store array of bots in cache, shuffle results before storage - * @param botsToStore + * @param botsToStore Bots we want to store in the cache */ storeBots(botsToStore: IBotBase[]): void; /** @@ -21,25 +21,7 @@ export declare class BotGenerationCacheService { * @param role role to retreive (assault/bossTagilla etc) * @returns IBotBase object */ - getBot(role: string): IBotBase[]; - /** - * Find a bot by its index from cache - * @param indexOfBotToReturn index to find bot by - * @returns bot profile - */ - protected getBotFromCache(indexOfBotToReturn: number): IBotBase; - /** - * Remove bot profile by index from cache - * @param indexOfBotToReturn Index of bot profile to remove - */ - protected removeBotFromCache(indexOfBotToReturn: number): void; - /** - * Get index of bot profile that matches criteria - * @param role Role of bot wanted - * @param getPmc Requested bot a pmc - * @returns index of found bot, -1 if not found - */ - protected getIndexOfBotToReturn(role: string, getPmc: boolean): number; + getBot(role: string): IBotBase; /** * Remove all cached bot profiles */ @@ -48,5 +30,5 @@ export declare class BotGenerationCacheService { * Does cache have bots * @returns true if empty */ - cacheIsEmpty(): boolean; + cacheHasBotOfRole(role: string): boolean; } diff --git a/TypeScript/10ScopesAndTypes/types/services/LocaleService.d.ts b/TypeScript/10ScopesAndTypes/types/services/LocaleService.d.ts index 33bea7b..8275b75 100644 --- a/TypeScript/10ScopesAndTypes/types/services/LocaleService.d.ts +++ b/TypeScript/10ScopesAndTypes/types/services/LocaleService.d.ts @@ -1,14 +1,42 @@ import { ILocaleConfig } from "../models/spt/config/ILocaleConfig"; +import { ILocaleGlobalBase } from "../models/spt/server/ILocaleBase"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +/** + * Handles getting locales from config or users machine + */ export declare class LocaleService { protected logger: ILogger; + protected databaseServer: DatabaseServer; protected configServer: ConfigServer; protected localeConfig: ILocaleConfig; - constructor(logger: ILogger, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, configServer: ConfigServer); /** - * Gets the locale key from the locale.json file + * Get the eft globals db file based on the configured locale in config/locale.json, if not found, fall back to 'en' + * @returns ILocaleGlobalBase + */ + getLocaleDb(): ILocaleGlobalBase; + /** + * Gets the game locale key from the locale.json file, + * if value is 'system' get system locale * @returns locale e.g en/ge/cz/cn */ - getDesiredLocale(): string; + getDesiredGameLocale(): string; + /** + * Gets the game locale key from the locale.json file, + * if value is 'system' get system locale + * @returns locale e.g en/ge/cz/cn + */ + getDesiredServerLocale(): string; + /** + * Get array of languages supported for localisation + * @returns array of locales e.g. en/fr/cn + */ + getServerSupportedLocales(): string[]; + /** + * Get the locale of the computer running the server + * @returns langage part of locale e.g. 'en' part of 'en-US' + */ + protected getPlatformLocale(): string; } diff --git a/TypeScript/10ScopesAndTypes/types/services/LocalisationService.d.ts b/TypeScript/10ScopesAndTypes/types/services/LocalisationService.d.ts new file mode 100644 index 0000000..519325d --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/services/LocalisationService.d.ts @@ -0,0 +1,21 @@ +import { I18n } from "i18n"; +import { ILocaleConfig } from "../models/spt/config/ILocaleConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { LocaleService } from "./LocaleService"; +/** + * Handles translating server text into different langauges + */ +export declare class LocalisationService { + protected logger: ILogger; + protected localeService: LocaleService; + protected localeConfig: ILocaleConfig; + protected i18n: I18n; + constructor(logger: ILogger, localeService: LocaleService); + /** + * Get a localised value using the passed in key + * @param key Key to loop up locale for + * @param args optional arguments + * @returns Localised string + */ + getText(key: string, args?: any): string; +} diff --git a/TypeScript/10ScopesAndTypes/types/services/PaymentService.d.ts b/TypeScript/10ScopesAndTypes/types/services/PaymentService.d.ts index a5e538f..c9ce95a 100644 --- a/TypeScript/10ScopesAndTypes/types/services/PaymentService.d.ts +++ b/TypeScript/10ScopesAndTypes/types/services/PaymentService.d.ts @@ -11,6 +11,7 @@ import { IProcessSellTradeRequestData } from "../models/eft/trade/IProcessSellTr import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +import { LocalisationService } from "./LocalisationService"; export declare class PaymentService { protected logger: ILogger; protected httpResponse: HttpResponseUtil; @@ -19,8 +20,9 @@ export declare class PaymentService { protected traderHelper: TraderHelper; protected itemHelper: ItemHelper; protected inventoryHelper: InventoryHelper; + protected localisationService: LocalisationService; protected paymentHelper: PaymentHelper; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, traderHelper: TraderHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper); + constructor(logger: ILogger, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, traderHelper: TraderHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, localisationService: LocalisationService, paymentHelper: PaymentHelper); /** * Take money and insert items into return to server request * @param {Object} pmcData @@ -50,7 +52,7 @@ export declare class PaymentService { * @param pmcData Player profile to find and remove currency from * @param currencyTpl Type of currency to pay * @param amountToPay money value to pay - * @param sessionID Sessino id + * @param sessionID Session id * @param output output object to send to client * @returns IItemEventRouterResponse */ diff --git a/TypeScript/10ScopesAndTypes/types/services/PlayerService.d.ts b/TypeScript/10ScopesAndTypes/types/services/PlayerService.d.ts index 519b7e5..2f364d5 100644 --- a/TypeScript/10ScopesAndTypes/types/services/PlayerService.d.ts +++ b/TypeScript/10ScopesAndTypes/types/services/PlayerService.d.ts @@ -2,10 +2,12 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { IPlayerIncrementSkillLevelRequestData } from "../models/eft/player/IPlayerIncrementSkillLevelRequestData"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "./LocalisationService"; export declare class PlayerService { protected logger: ILogger; + protected localisationService: LocalisationService; protected databaseServer: DatabaseServer; - constructor(logger: ILogger, databaseServer: DatabaseServer); + constructor(logger: ILogger, localisationService: LocalisationService, databaseServer: DatabaseServer); /** * increases the profile skill and updates any output * @param {Object} pmcData diff --git a/TypeScript/10ScopesAndTypes/types/services/PmcAiService.d.ts b/TypeScript/10ScopesAndTypes/types/services/PmcAiService.d.ts deleted file mode 100644 index 0690f1f..0000000 --- a/TypeScript/10ScopesAndTypes/types/services/PmcAiService.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { IBotConfig } from "../models/spt/config/IBotConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { ConfigServer } from "../servers/ConfigServer"; -/** Storing/retreving pmcRoles set at the start of a raid - its done at that point as we know what location the player is heading to */ -export declare class PmcAiService { - protected logger: ILogger; - protected configServer: ConfigServer; - protected botConfig: IBotConfig; - protected usecRole: string; - protected bearRole: string; - constructor(logger: ILogger, configServer: ConfigServer); - /** - * Convert from pmc side (usec/bear) to the side as defined in the bot config (usecType/bearType) - * @param pmcSide eft side (usec/bear) - * @returns pmc side as defined in config - */ - getPmcRole(pmcSide: "usec" | "bear" | string): string; - /** - * Set the roles for pmcs - * @param location map location to look up and use as pmc types - */ - setPmcRolesByLocation(location: string): void; - /** - * Clear the saved role from usec/bear PMCs - */ - clearPmcRoles(): void; -} diff --git a/TypeScript/10ScopesAndTypes/types/services/ProfileFixerService.d.ts b/TypeScript/10ScopesAndTypes/types/services/ProfileFixerService.d.ts index e772919..86a6af8 100644 --- a/TypeScript/10ScopesAndTypes/types/services/ProfileFixerService.d.ts +++ b/TypeScript/10ScopesAndTypes/types/services/ProfileFixerService.d.ts @@ -8,12 +8,14 @@ import { HideoutAreas } from "../models/enums/HideoutAreas"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { Watermark } from "../utils/Watermark"; +import { LocalisationService } from "./LocalisationService"; export declare class ProfileFixerService { protected logger: ILogger; protected watermark: Watermark; protected hideoutHelper: HideoutHelper; + protected localisationService: LocalisationService; protected databaseServer: DatabaseServer; - constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, databaseServer: DatabaseServer); + constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, localisationService: LocalisationService, databaseServer: DatabaseServer); /** * Find issues in the pmc profile data that may cause issues and fix them * @param pmcProfile profile to check and fix diff --git a/TypeScript/10ScopesAndTypes/types/services/RagfairOfferService.d.ts b/TypeScript/10ScopesAndTypes/types/services/RagfairOfferService.d.ts index a6f6b6d..86c1e52 100644 --- a/TypeScript/10ScopesAndTypes/types/services/RagfairOfferService.d.ts +++ b/TypeScript/10ScopesAndTypes/types/services/RagfairOfferService.d.ts @@ -11,6 +11,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { TimeUtil } from "../utils/TimeUtil"; +import { LocalisationService } from "./LocalisationService"; import { RagfairCategoriesService } from "./RagfairCategoriesService"; export declare class RagfairOfferService { protected logger: ILogger; @@ -22,12 +23,14 @@ export declare class RagfairOfferService { protected profileHelper: ProfileHelper; protected eventOutputHolder: EventOutputHolder; protected httpResponse: HttpResponseUtil; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected playerOffersLoaded: boolean; protected expiredOffers: Item[]; - protected offers: IRagfairOffer[]; + /** offerId, offer */ + protected offers: Record; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, databaseServer: DatabaseServer, saveServer: SaveServer, ragfairServerHelper: RagfairServerHelper, ragfairCategoriesService: RagfairCategoriesService, profileHelper: ProfileHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, databaseServer: DatabaseServer, saveServer: SaveServer, ragfairServerHelper: RagfairServerHelper, ragfairCategoriesService: RagfairCategoriesService, profileHelper: ProfileHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, localisationService: LocalisationService, configServer: ConfigServer); /** * Get all offers * @returns IRagfairOffer array diff --git a/TypeScript/10ScopesAndTypes/types/utils/App.d.ts b/TypeScript/10ScopesAndTypes/types/utils/App.d.ts index dcc2669..cc8a5af 100644 --- a/TypeScript/10ScopesAndTypes/types/utils/App.d.ts +++ b/TypeScript/10ScopesAndTypes/types/utils/App.d.ts @@ -1,14 +1,16 @@ -import { TimeUtil } from "./TimeUtil"; import { OnLoad } from "../di/OnLoad"; import { OnUpdate } from "../di/OnUpdate"; import { ILogger } from "../models/spt/utils/ILogger"; +import { LocalisationService } from "../services/LocalisationService"; +import { TimeUtil } from "./TimeUtil"; export declare class App { protected logger: ILogger; protected timeUtil: TimeUtil; + protected localisationService: LocalisationService; protected onLoadComponents: OnLoad[]; protected onUpdateComponents: OnUpdate[]; protected onUpdateLastRun: {}; - constructor(logger: ILogger, timeUtil: TimeUtil, onLoadComponents: OnLoad[], onUpdateComponents: OnUpdate[]); + constructor(logger: ILogger, timeUtil: TimeUtil, localisationService: LocalisationService, onLoadComponents: OnLoad[], onUpdateComponents: OnUpdate[]); load(): void; protected update(onUpdateComponents: OnUpdate[]): void; protected logUpdateException(err: any, updateable: OnUpdate): void; diff --git a/TypeScript/10ScopesAndTypes/types/utils/DatabaseImporter.d.ts b/TypeScript/10ScopesAndTypes/types/utils/DatabaseImporter.d.ts index 483e135..31670ae 100644 --- a/TypeScript/10ScopesAndTypes/types/utils/DatabaseImporter.d.ts +++ b/TypeScript/10ScopesAndTypes/types/utils/DatabaseImporter.d.ts @@ -3,15 +3,17 @@ import { IDatabaseTables } from "../models/spt/server/IDatabaseTables"; import { ILogger } from "../models/spt/utils/ILogger"; import { ImageRouter } from "../routers/ImageRouter"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { JsonUtil } from "./JsonUtil"; import { VFS } from "./VFS"; export declare class DatabaseImporter extends OnLoad { protected logger: ILogger; protected vfs: VFS; protected jsonUtil: JsonUtil; + protected localisationService: LocalisationService; protected databaseServer: DatabaseServer; protected imageRouter: ImageRouter; - constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, databaseServer: DatabaseServer, imageRouter: ImageRouter); + constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, localisationService: LocalisationService, databaseServer: DatabaseServer, imageRouter: ImageRouter); onLoad(): void; /** * Read all json files in database folder and map into a json object diff --git a/TypeScript/10ScopesAndTypes/types/utils/HttpResponseUtil.d.ts b/TypeScript/10ScopesAndTypes/types/utils/HttpResponseUtil.d.ts index 29502be..3a78618 100644 --- a/TypeScript/10ScopesAndTypes/types/utils/HttpResponseUtil.d.ts +++ b/TypeScript/10ScopesAndTypes/types/utils/HttpResponseUtil.d.ts @@ -1,10 +1,13 @@ -import { JsonUtil } from "./JsonUtil"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { INullResponseData } from "../models/eft/httpResponse/INullResponseData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; +import { BackendErrorCodes } from "../models/enums/BackendErrorCodes"; +import { LocalisationService } from "../services/LocalisationService"; +import { JsonUtil } from "./JsonUtil"; export declare class HttpResponseUtil { protected jsonUtil: JsonUtil; - constructor(jsonUtil: JsonUtil); + protected localisationService: LocalisationService; + constructor(jsonUtil: JsonUtil, localisationService: LocalisationService); protected clearString(s: string): any; noBody(data: any): any; getBody(data: T, err?: number, errmsg?: any): IGetBodyResponseData; @@ -12,5 +15,5 @@ export declare class HttpResponseUtil { emptyResponse(): IGetBodyResponseData; nullResponse(): INullResponseData; emptyArrayResponse(): IGetBodyResponseData; - appendErrorToOutput(output: IItemEventRouterResponse, message?: string, title?: string): IItemEventRouterResponse; + appendErrorToOutput(output: IItemEventRouterResponse, message?: string, errorCode?: BackendErrorCodes): IItemEventRouterResponse; } diff --git a/TypeScript/10ScopesAndTypes/types/utils/RandomUtil.d.ts b/TypeScript/10ScopesAndTypes/types/utils/RandomUtil.d.ts index 633e472..aa556e3 100644 --- a/TypeScript/10ScopesAndTypes/types/utils/RandomUtil.d.ts +++ b/TypeScript/10ScopesAndTypes/types/utils/RandomUtil.d.ts @@ -110,6 +110,12 @@ export declare class RandomUtil { getIntEx(max: number): number; getFloat(min: number, max: number): number; getBool(): boolean; + /** + * Check if number passes a check out of 100 + * @param chancePercent value check needs to be above + * @returns true if value passes check + */ + getChance100(chancePercent: number): boolean; getStringArrayValue(arr: string[]): string; getArrayValue(arr: T[]): T; getKey(node: any): string; diff --git a/TypeScript/10ScopesAndTypes/types/utils/Watermark.d.ts b/TypeScript/10ScopesAndTypes/types/utils/Watermark.d.ts index c6dc120..e02eba2 100644 --- a/TypeScript/10ScopesAndTypes/types/utils/Watermark.d.ts +++ b/TypeScript/10ScopesAndTypes/types/utils/Watermark.d.ts @@ -1,20 +1,15 @@ import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { LocalisationService } from "../services/LocalisationService"; export declare class WatermarkLocale { - protected locales: { - "en-US": { - description: string[]; - warning: string[]; - modding: string[]; - }; - "zh-CN": { - description: string[]; - warning: string[]; - modding: string[]; - }; + protected localisationService: LocalisationService; + constructor(localisationService: LocalisationService); + protected watermark: { + description: string[]; + warning: string[]; + modding: string[]; }; - getLocale(): string; getDescription(): string[]; getWarning(): string[]; getModding(): string[]; @@ -22,9 +17,10 @@ export declare class WatermarkLocale { export declare class Watermark { protected logger: ILogger; protected configServer: ConfigServer; + protected localisationService: LocalisationService; protected watermarkLocale?: WatermarkLocale; protected akiConfig: ICoreConfig; - constructor(logger: ILogger, configServer: ConfigServer, watermarkLocale?: WatermarkLocale); + constructor(logger: ILogger, configServer: ConfigServer, localisationService: LocalisationService, watermarkLocale?: WatermarkLocale); protected text: string[]; protected versionLabel: string; initialize(): void; diff --git a/TypeScript/11BundleLoadingSample/types/callbacks/BotCallbacks.d.ts b/TypeScript/11BundleLoadingSample/types/callbacks/BotCallbacks.d.ts index 2db60dc..827015e 100644 --- a/TypeScript/11BundleLoadingSample/types/callbacks/BotCallbacks.d.ts +++ b/TypeScript/11BundleLoadingSample/types/callbacks/BotCallbacks.d.ts @@ -8,8 +8,29 @@ export declare class BotCallbacks { protected botController: BotController; protected httpResponse: HttpResponseUtil; constructor(botController: BotController, httpResponse: HttpResponseUtil); + /** + * Handle singleplayer/settings/bot/limit + * @returns string + */ getBotLimit(url: string, info: IEmptyRequestData, sessionID: string): string; + /** + * Handle singleplayer/settings/bot/difficulty + * @returns string + */ getBotDifficulty(url: string, info: IEmptyRequestData, sessionID: string): string; + /** + * Handle client/game/bot/generate + * @returns IGetBodyResponseData + */ generateBots(url: string, info: IGenerateBotsRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle singleplayer/settings/bot/maxCap + * @returns string + */ getBotCap(): string; + /** + * Handle singleplayer/settings/bot/getBotBehaviours + * @returns string + */ + getBotBehaviours(): string; } diff --git a/TypeScript/11BundleLoadingSample/types/callbacks/CustomizationCallbacks.d.ts b/TypeScript/11BundleLoadingSample/types/callbacks/CustomizationCallbacks.d.ts index 3bab8c0..75d5701 100644 --- a/TypeScript/11BundleLoadingSample/types/callbacks/CustomizationCallbacks.d.ts +++ b/TypeScript/11BundleLoadingSample/types/callbacks/CustomizationCallbacks.d.ts @@ -3,6 +3,7 @@ import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { IPmcData } from "../models/eft/common/IPmcData"; import { ISuit } from "../models/eft/common/tables/ITrader"; import { IBuyClothingRequestData } from "../models/eft/customization/IBuyClothingRequestData"; +import { IGetSuitsResponse } from "../models/eft/customization/IGetSuitsResponse"; import { IWearClothingRequestData } from "../models/eft/customization/IWearClothingRequestData"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; @@ -13,10 +14,15 @@ export declare class CustomizationCallbacks { protected saveServer: SaveServer; protected httpResponse: HttpResponseUtil; constructor(customizationController: CustomizationController, saveServer: SaveServer, httpResponse: HttpResponseUtil); - getSuits(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<{ - _id: string; - suites: string[]; - }>; + /** + * Handles client/trading/customization/storage + * @returns + */ + getSuits(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handles client/trading/customization + * @returns ISuit[] + */ getTraderSuits(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; wearClothing(pmcData: IPmcData, body: IWearClothingRequestData, sessionID: string): IItemEventRouterResponse; buyClothing(pmcData: IPmcData, body: IBuyClothingRequestData, sessionID: string): IItemEventRouterResponse; diff --git a/TypeScript/11BundleLoadingSample/types/callbacks/DataCallbacks.d.ts b/TypeScript/11BundleLoadingSample/types/callbacks/DataCallbacks.d.ts index 04566ff..2efcf81 100644 --- a/TypeScript/11BundleLoadingSample/types/callbacks/DataCallbacks.d.ts +++ b/TypeScript/11BundleLoadingSample/types/callbacks/DataCallbacks.d.ts @@ -12,15 +12,42 @@ import { ILanguageBase } from "../models/spt/server/ILocaleBase"; import { ISettingsBase } from "../models/spt/server/ISettingsBase"; import { DatabaseServer } from "../servers/DatabaseServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +/** + * Handle client requests + */ export declare class DataCallbacks { protected httpResponse: HttpResponseUtil; protected databaseServer: DatabaseServer; constructor(httpResponse: HttpResponseUtil, databaseServer: DatabaseServer); + /** + * Handles client/settings + * @returns ISettingsBase + */ getSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handles client/globals + * @returns IGlobals + */ getGlobals(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handles client/items + * @returns string + */ getTemplateItems(url: string, info: IEmptyRequestData, sessionID: string): string; + /** + * Handles client/handbook/templates + * @returns IHandbookBase + */ getTemplateHandbook(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handles client/customization + * @returns Record>; + /** + * Handles client/account/customization + * @returns string[] + */ getTemplateCharacter(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getTemplateQuests(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getHideoutSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; @@ -28,6 +55,6 @@ export declare class DataCallbacks { gethideoutProduction(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getHideoutScavcase(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getLocalesLanguages(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - getLocalesMenu(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + getLocalesMenu(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getLocalesGlobal(url: string, info: IEmptyRequestData, sessionID: string): string; } diff --git a/TypeScript/11BundleLoadingSample/types/callbacks/DialogueCallbacks.d.ts b/TypeScript/11BundleLoadingSample/types/callbacks/DialogueCallbacks.d.ts index 634f90b..7b2eeae 100644 --- a/TypeScript/11BundleLoadingSample/types/callbacks/DialogueCallbacks.d.ts +++ b/TypeScript/11BundleLoadingSample/types/callbacks/DialogueCallbacks.d.ts @@ -26,15 +26,27 @@ export declare class DialogueCallbacks extends OnUpdate { protected httpResponse: HttpResponseUtil; protected dialogueController: DialogueController; constructor(hashUtil: HashUtil, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, dialogueController: DialogueController); + /** + * Handles client/friend/list + * @returns IGetFriendListDataResponse + */ getFriendList(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handles client/chatServer/list + * @returns + */ getChatServerList(url: string, info: IGetChatServerListRequestData, sessionID: string): IGetBodyResponseData; getMailDialogList(url: string, info: IGetMailDialogListRequestData, sessionID: string): IGetBodyResponseData; getMailDialogView(url: string, info: IGetMailDialogViewRequestData, sessionID: string): IGetBodyResponseData; - getMailDialogInfo(url: string, info: IGetMailDialogInfoRequestData, sessionID: string): IGetBodyResponseData; + getMailDialogInfo(url: string, info: IGetMailDialogInfoRequestData, sessionID: string): IGetBodyResponseData; removeDialog(url: string, info: IRemoveDialogRequestData, sessionID: string): IGetBodyResponseData; pinDialog(url: string, info: IPinDialogRequestData, sessionID: string): IGetBodyResponseData; unpinDialog(url: string, info: IPinDialogRequestData, sessionID: string): IGetBodyResponseData; setRead(url: string, info: ISetDialogReadRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handles client/mail/dialog/getAllAttachments + * @returns IGetAllAttachmentsResponse + */ getAllAttachments(url: string, info: IGetAllAttachmentsRequestData, sessionID: string): IGetBodyResponseData; listOutbox(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; listInbox(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; diff --git a/TypeScript/11BundleLoadingSample/types/callbacks/GameCallbacks.d.ts b/TypeScript/11BundleLoadingSample/types/callbacks/GameCallbacks.d.ts index 5e4c240..3a6b7e6 100644 --- a/TypeScript/11BundleLoadingSample/types/callbacks/GameCallbacks.d.ts +++ b/TypeScript/11BundleLoadingSample/types/callbacks/GameCallbacks.d.ts @@ -3,6 +3,9 @@ import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { ICheckVersionResponse } from "../models/eft/game/ICheckVersionResponse"; import { IGameConfigResponse } from "../models/eft/game/IGameConfigResponse"; import { IGameEmptyCrcRequestData } from "../models/eft/game/IGameEmptyCrcRequestData"; +import { IGameKeepAliveResponse } from "../models/eft/game/IGameKeepAliveResponse"; +import { IGameLogoutResponseData } from "../models/eft/game/IGameLogoutResponseData"; +import { IGameStartResponse } from "../models/eft/game/IGameStartResponse"; import { IReportNicknameRequestData } from "../models/eft/game/IReportNicknameRequestData"; import { IServerDetails } from "../models/eft/game/IServerDetails"; import { IVersionValidateRequestData } from "../models/eft/game/IVersionValidateRequestData"; @@ -15,13 +18,37 @@ declare class GameCallbacks { protected watermark: Watermark; protected gameController: GameController; constructor(httpResponse: HttpResponseUtil, watermark: Watermark, gameController: GameController); + /** + * Handle client/game/version/validate + * @returns INullResponseData + */ versionValidate(url: string, info: IVersionValidateRequestData, sessionID: string): INullResponseData; - gameStart(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - gameLogout(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/game/start + * @returns IGameStartResponse + */ + gameStart(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/game/logout + * @returns IGameLogoutResponseData + */ + gameLogout(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/game/config + * @returns IGameConfigResponse + */ getGameConfig(url: string, info: IGameEmptyCrcRequestData, sessionID: string): IGetBodyResponseData; getServer(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; validateGameVersion(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - gameKeepalive(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/game/keepalive + * @returns IGameKeepAliveResponse + */ + gameKeepalive(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle singleplayer/settings/version + * @returns string + */ getVersion(url: string, info: IEmptyRequestData, sessionID: string): string; reportNickname(url: string, info: IReportNicknameRequestData, sessionID: string): INullResponseData; } diff --git a/TypeScript/11BundleLoadingSample/types/callbacks/HealthCallbacks.d.ts b/TypeScript/11BundleLoadingSample/types/callbacks/HealthCallbacks.d.ts index 8672be7..7edf03e 100644 --- a/TypeScript/11BundleLoadingSample/types/callbacks/HealthCallbacks.d.ts +++ b/TypeScript/11BundleLoadingSample/types/callbacks/HealthCallbacks.d.ts @@ -21,7 +21,19 @@ export declare class HealthCallbacks { * @returns empty response, no data sent back to client */ syncHealth(url: string, info: ISyncHealthRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle Eat + * @returns IItemEventRouterResponse + */ offraidEat(pmcData: IPmcData, body: IOffraidEatRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle Heal + * @returns IItemEventRouterResponse + */ offraidHeal(pmcData: IPmcData, body: IOffraidHealRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle RestoreHealth + * @returns IItemEventRouterResponse + */ healthTreatment(pmcData: IPmcData, info: IHealthTreatmentRequestData, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/11BundleLoadingSample/types/callbacks/HideoutCallbacks.d.ts b/TypeScript/11BundleLoadingSample/types/callbacks/HideoutCallbacks.d.ts index 99ab4c9..e39e806 100644 --- a/TypeScript/11BundleLoadingSample/types/callbacks/HideoutCallbacks.d.ts +++ b/TypeScript/11BundleLoadingSample/types/callbacks/HideoutCallbacks.d.ts @@ -19,14 +19,77 @@ export declare class HideoutCallbacks extends OnUpdate { protected hideoutConfig: IHideoutConfig; constructor(hideoutController: HideoutController, // TODO: delay needed configServer: ConfigServer); + /** + * Handle HideoutUpgrade + * @param pmcData + * @param body + * @param sessionID + * @returns + */ upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutUpgradeComplete + * @param pmcData + * @param body + * @param sessionID + * @returns + */ upgradeComplete(pmcData: IPmcData, body: IHideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutPutItemsInAreaSlots + * @param pmcData + * @param body + * @param sessionID + * @returns + */ putItemsInAreaSlots(pmcData: IPmcData, body: IHideoutPutItemInRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutTakeItemsFromAreaSlots + * @param pmcData + * @param body + * @param sessionID + * @returns + */ takeItemsFromAreaSlots(pmcData: IPmcData, body: IHideoutTakeItemOutRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutToggleArea + * @param pmcData + * @param body + * @param sessionID + * @returns + */ toggleArea(pmcData: IPmcData, body: IHideoutToggleAreaRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutSingleProductionStart + * @param pmcData + * @param body + * @param sessionID + * @returns + */ singleProductionStart(pmcData: IPmcData, body: IHideoutSingleProductionStartRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutScavCaseProductionStart + * @param pmcData + * @param body + * @param sessionID + * @returns + */ scavCaseProductionStart(pmcData: IPmcData, body: IHideoutScavCaseStartRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutContinuousProductionStart + * @param pmcData + * @param body + * @param sessionID + * @returns + */ continuousProductionStart(pmcData: IPmcData, body: IHideoutContinousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutTakeProduction + * @param pmcData + * @param body + * @param sessionID + * @returns + */ takeProduction(pmcData: IPmcData, body: IHideoutTakeProductionRequestData, sessionID: string): IItemEventRouterResponse; onUpdate(timeSinceLastRun: number): boolean; getRoute(): string; diff --git a/TypeScript/11BundleLoadingSample/types/callbacks/InraidCallbacks.d.ts b/TypeScript/11BundleLoadingSample/types/callbacks/InraidCallbacks.d.ts index 05bcce4..918bfaf 100644 --- a/TypeScript/11BundleLoadingSample/types/callbacks/InraidCallbacks.d.ts +++ b/TypeScript/11BundleLoadingSample/types/callbacks/InraidCallbacks.d.ts @@ -1,23 +1,49 @@ import { InraidController } from "../controllers/InraidController"; -import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { INullResponseData } from "../models/eft/httpResponse/INullResponseData"; import { IRegisterPlayerRequestData } from "../models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; -import { IAirdropConfig } from "../models/spt/config/IAirdropConfig"; -import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; -import { ConfigServer } from "../servers/ConfigServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +/** + * Handle client requests + */ export declare class InraidCallbacks { protected inraidController: InraidController; protected httpResponse: HttpResponseUtil; - protected configServer: ConfigServer; - protected airdropConfig: IAirdropConfig; - protected inraidConfig: IInRaidConfig; - constructor(inraidController: InraidController, httpResponse: HttpResponseUtil, configServer: ConfigServer); + constructor(inraidController: InraidController, httpResponse: HttpResponseUtil); + /** + * Handle client/location/getLocalloot + * @param url + * @param info register player request + * @param sessionID Session id + * @returns Null http response + */ registerPlayer(url: string, info: IRegisterPlayerRequestData, sessionID: string): INullResponseData; + /** + * Handle raid/profile/save + * @param url + * @param info Save progress request + * @param sessionID Session id + * @returns Null http response + */ saveProgress(url: string, info: ISaveProgressRequestData, sessionID: string): INullResponseData; + /** + * Handle singleplayer/settings/raid/endstate + * @returns + */ getRaidEndState(): string; - getRaidMenuSettings(url: string, info: IEmptyRequestData, sessionID: string): string; - getWeaponDurability(url: string, info: any, sessionID: string): string; - getAirdropConfig(url: string, info: any, sessionID: string): string; + /** + * Handle singleplayer/settings/raid/menu + * @returns JSON as string + */ + getRaidMenuSettings(): string; + /** + * Handle singleplayer/settings/weapon/durability + * @returns + */ + getWeaponDurability(): string; + /** + * Handle singleplayer/airdrop/config + * @returns JSON as string + */ + getAirdropConfig(): string; } diff --git a/TypeScript/11BundleLoadingSample/types/callbacks/InsuranceCallbacks.d.ts b/TypeScript/11BundleLoadingSample/types/callbacks/InsuranceCallbacks.d.ts index 8835ba2..a171e1c 100644 --- a/TypeScript/11BundleLoadingSample/types/callbacks/InsuranceCallbacks.d.ts +++ b/TypeScript/11BundleLoadingSample/types/callbacks/InsuranceCallbacks.d.ts @@ -17,7 +17,15 @@ export declare class InsuranceCallbacks extends OnUpdate { protected configServer: ConfigServer; protected insuranceConfig: IInsuranceConfig; constructor(insuranceController: InsuranceController, insuranceService: InsuranceService, httpResponse: HttpResponseUtil, configServer: ConfigServer); + /** + * Handle client/insurance/items/list/cost + * @returns IGetInsuranceCostResponseData + */ getInsuranceCost(url: string, info: IGetInsuranceCostRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle Insure + * @returns IItemEventRouterResponse + */ insure(pmcData: IPmcData, body: IInsureRequestData, sessionID: string): IItemEventRouterResponse; onUpdate(secondsSinceLastRun: number): boolean; getRoute(): string; diff --git a/TypeScript/11BundleLoadingSample/types/callbacks/InventoryCallbacks.d.ts b/TypeScript/11BundleLoadingSample/types/callbacks/InventoryCallbacks.d.ts index 9ab1486..46bf6fd 100644 --- a/TypeScript/11BundleLoadingSample/types/callbacks/InventoryCallbacks.d.ts +++ b/TypeScript/11BundleLoadingSample/types/callbacks/InventoryCallbacks.d.ts @@ -16,6 +16,7 @@ import { IInventorySwapRequestData } from "../models/eft/inventory/IInventorySwa import { IInventoryTagRequestData } from "../models/eft/inventory/IInventoryTagRequestData"; import { IInventoryToggleRequestData } from "../models/eft/inventory/IInventoryToggleRequestData"; import { IInventoryTransferRequestData } from "../models/eft/inventory/IInventoryTransferRequestData"; +import { IOpenRandomLootContainerRequestData } from "../models/eft/inventory/IOpenRandomLootContainerRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; export declare class InventoryCallbacks { protected inventoryController: InventoryController; @@ -36,4 +37,5 @@ export declare class InventoryCallbacks { createMapMarker(pmcData: IPmcData, body: IInventoryCreateMarkerRequestData, sessionID: string): IItemEventRouterResponse; deleteMapMarker(pmcData: IPmcData, body: IInventoryDeleteMarkerRequestData, sessionID: string): IItemEventRouterResponse; editMapMarker(pmcData: IPmcData, body: IInventoryEditMarkerRequestData, sessionID: string): IItemEventRouterResponse; + openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/11BundleLoadingSample/types/callbacks/ItemEventCallbacks.d.ts b/TypeScript/11BundleLoadingSample/types/callbacks/ItemEventCallbacks.d.ts index f4f04f9..fbb0b5f 100644 --- a/TypeScript/11BundleLoadingSample/types/callbacks/ItemEventCallbacks.d.ts +++ b/TypeScript/11BundleLoadingSample/types/callbacks/ItemEventCallbacks.d.ts @@ -1,4 +1,5 @@ import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; +import { Warning } from "../models/eft/itemEvent/IItemEventRouterBase"; import { IItemEventRouterRequest } from "../models/eft/itemEvent/IItemEventRouterRequest"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { ItemEventRouter } from "../routers/ItemEventRouter"; @@ -8,4 +9,5 @@ export declare class ItemEventCallbacks { protected itemEventRouter: ItemEventRouter; constructor(httpResponse: HttpResponseUtil, itemEventRouter: ItemEventRouter); handleEvents(url: string, info: IItemEventRouterRequest, sessionID: string): IGetBodyResponseData; + protected getErrorCode(warnings: Warning[]): number; } diff --git a/TypeScript/11BundleLoadingSample/types/callbacks/MatchCallbacks.d.ts b/TypeScript/11BundleLoadingSample/types/callbacks/MatchCallbacks.d.ts index 2a92ef5..10fbc44 100644 --- a/TypeScript/11BundleLoadingSample/types/callbacks/MatchCallbacks.d.ts +++ b/TypeScript/11BundleLoadingSample/types/callbacks/MatchCallbacks.d.ts @@ -34,6 +34,10 @@ export declare class MatchCallbacks { serverAvailable(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData | IGetBodyResponseData; joinMatch(url: string, info: IJoinMatchRequestData, sessionID: string): IGetBodyResponseData; getMetrics(url: string, info: any, sessionID: string): IGetBodyResponseData; + /** + * Handle client/match/group/status + * @returns + */ getGroupStatus(url: string, info: IGetGroupStatusRequestData, sessionID: string): IGetBodyResponseData; createGroup(url: string, info: ICreateGroupRequestData, sessionID: string): IGetBodyResponseData; deleteGroup(url: string, info: any, sessionID: string): INullResponseData; diff --git a/TypeScript/11BundleLoadingSample/types/callbacks/NotifierCallbacks.d.ts b/TypeScript/11BundleLoadingSample/types/callbacks/NotifierCallbacks.d.ts index c42058f..fab325b 100644 --- a/TypeScript/11BundleLoadingSample/types/callbacks/NotifierCallbacks.d.ts +++ b/TypeScript/11BundleLoadingSample/types/callbacks/NotifierCallbacks.d.ts @@ -4,6 +4,7 @@ import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { INotifierChannel } from "../models/eft/notifier/INotifier"; import { ISelectProfileRequestData } from "../models/eft/notifier/ISelectProfileRequestData"; +import { ISelectProfileResponse } from "../models/eft/notifier/ISelectProfileResponse"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; export declare class NotifierCallbacks { protected httpServerHelper: HttpServerHelper; @@ -19,6 +20,10 @@ export declare class NotifierCallbacks { sendNotification(sessionID: string, req: any, resp: any, data: any): void; getNotifier(url: string, info: any, sessionID: string): IGetBodyResponseData; createNotifierChannel(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - selectProfile(url: string, info: ISelectProfileRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/game/profile/select + * @returns ISelectProfileResponse + */ + selectProfile(url: string, info: ISelectProfileRequestData, sessionID: string): IGetBodyResponseData; notify(url: string, info: any, sessionID: string): string; } diff --git a/TypeScript/11BundleLoadingSample/types/callbacks/QuestCallbacks.d.ts b/TypeScript/11BundleLoadingSample/types/callbacks/QuestCallbacks.d.ts index 559c29e..2a3eb20 100644 --- a/TypeScript/11BundleLoadingSample/types/callbacks/QuestCallbacks.d.ts +++ b/TypeScript/11BundleLoadingSample/types/callbacks/QuestCallbacks.d.ts @@ -21,6 +21,13 @@ export declare class QuestCallbacks { acceptQuest(pmcData: IPmcData, body: IAcceptQuestRequestData, sessionID: string): IItemEventRouterResponse; completeQuest(pmcData: IPmcData, body: ICompleteQuestRequestData, sessionID: string): IItemEventRouterResponse; handoverQuest(pmcData: IPmcData, body: IHandoverQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle client/quest/list + * @param url + * @param info + * @param sessionID + * @returns + */ listQuests(url: string, info: IListQuestsRequestData, sessionID: string): IGetBodyResponseData; activityPeriods(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; } diff --git a/TypeScript/11BundleLoadingSample/types/callbacks/RagfairCallbacks.d.ts b/TypeScript/11BundleLoadingSample/types/callbacks/RagfairCallbacks.d.ts index c609f2f..37f3807 100644 --- a/TypeScript/11BundleLoadingSample/types/callbacks/RagfairCallbacks.d.ts +++ b/TypeScript/11BundleLoadingSample/types/callbacks/RagfairCallbacks.d.ts @@ -35,7 +35,7 @@ export declare class RagfairCallbacks extends OnLoadOnUpdate { getRoute(): string; search(url: string, info: ISearchRequestData, sessionID: string): IGetBodyResponseData; getMarketPrice(url: string, info: IGetMarketPriceRequestData, sessionID: string): IGetBodyResponseData; - getItemPrices(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + getItemPrices(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData>; addOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; removeOffer(pmcData: IPmcData, info: IRemoveOfferRequestData, sessionID: string): IItemEventRouterResponse; extendOffer(pmcData: IPmcData, info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; diff --git a/TypeScript/11BundleLoadingSample/types/callbacks/TraderCallbacks.d.ts b/TypeScript/11BundleLoadingSample/types/callbacks/TraderCallbacks.d.ts index e4fd099..40a1455 100644 --- a/TypeScript/11BundleLoadingSample/types/callbacks/TraderCallbacks.d.ts +++ b/TypeScript/11BundleLoadingSample/types/callbacks/TraderCallbacks.d.ts @@ -12,6 +12,10 @@ export declare class TraderCallbacks extends OnLoadOnUpdate { onUpdate(): boolean; getRoute(): string; getTraderSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/trading/api/getUserAssortPrice/trader + * @returns + */ getProfilePurchases(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData>; getTrader(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getAssort(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; diff --git a/TypeScript/11BundleLoadingSample/types/callbacks/WeatherCallbacks.d.ts b/TypeScript/11BundleLoadingSample/types/callbacks/WeatherCallbacks.d.ts index ae784c8..f9d2002 100644 --- a/TypeScript/11BundleLoadingSample/types/callbacks/WeatherCallbacks.d.ts +++ b/TypeScript/11BundleLoadingSample/types/callbacks/WeatherCallbacks.d.ts @@ -1,10 +1,15 @@ import { WeatherController } from "../controllers/WeatherController"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; +import { IWeatherData } from "../models/eft/weather/IWeatherData"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; export declare class WeatherCallbacks { protected httpResponse: HttpResponseUtil; protected weatherController: WeatherController; constructor(httpResponse: HttpResponseUtil, weatherController: WeatherController); - getWeather(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/weather + * @returns IWeatherData + */ + getWeather(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; } diff --git a/TypeScript/11BundleLoadingSample/types/context/ContextVariableType.d.ts b/TypeScript/11BundleLoadingSample/types/context/ContextVariableType.d.ts index 5fc1704..a7dd9b5 100644 --- a/TypeScript/11BundleLoadingSample/types/context/ContextVariableType.d.ts +++ b/TypeScript/11BundleLoadingSample/types/context/ContextVariableType.d.ts @@ -1,4 +1,8 @@ export declare enum ContextVariableType { + /** Logged in users session id */ SESSION_ID = 0, - MATCH_INFO = 1 + /** Currently acive raid information */ + MATCH_INFO = 1, + /** Timestamp when client first connected */ + CLIENT_START_TIMESTAMP = 2 } diff --git a/TypeScript/11BundleLoadingSample/types/controllers/BotController.d.ts b/TypeScript/11BundleLoadingSample/types/controllers/BotController.d.ts index a5111d5..92317c3 100644 --- a/TypeScript/11BundleLoadingSample/types/controllers/BotController.d.ts +++ b/TypeScript/11BundleLoadingSample/types/controllers/BotController.d.ts @@ -1,6 +1,8 @@ import { ApplicationContext } from "../context/ApplicationContext"; import { BotGenerator } from "../generators/BotGenerator"; +import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { IGenerateBotsRequestData } from "../models/eft/bot/IGenerateBotsRequestData"; import { IBotBase } from "../models/eft/common/tables/IBotBase"; import { IBotCore } from "../models/eft/common/tables/IBotCore"; @@ -10,18 +12,23 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; -import { PmcAiService } from "../services/PmcAiService"; +import { LocalisationService } from "../services/LocalisationService"; +import { JsonUtil } from "../utils/JsonUtil"; export declare class BotController { protected logger: ILogger; protected databaseServer: DatabaseServer; protected botGenerator: BotGenerator; protected botHelper: BotHelper; - protected pmcAiService: PmcAiService; + protected botDifficultyHelper: BotDifficultyHelper; protected botGenerationCacheService: BotGenerationCacheService; + protected localisationService: LocalisationService; + protected weightedRandomHelper: WeightedRandomHelper; protected configServer: ConfigServer; protected applicationContext: ApplicationContext; + protected jsonUtil: JsonUtil; protected botConfig: IBotConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, pmcAiService: PmcAiService, botGenerationCacheService: BotGenerationCacheService, configServer: ConfigServer, applicationContext: ApplicationContext); + static readonly pmcTypeLabel = "PMC"; + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); /** * Return the number of bot loadout varieties to be generated * @param type bot Type we want the loadout gen count for @@ -37,7 +44,6 @@ export declare class BotController { * @returns Difficulty object */ getBotDifficulty(type: string, difficulty: string): Difficulty; - protected getPmcDifficultySettings(pmcType: "bear" | "usec", difficulty: string, usecType: string, bearType: string): Difficulty; /** * Generate bot profiles and store in cache * @param sessionId Session id @@ -51,4 +57,5 @@ export declare class BotController { * @returns cap number */ getBotCap(): number; + getPmcBotTypes(): Record>>; } diff --git a/TypeScript/11BundleLoadingSample/types/controllers/DialogueController.d.ts b/TypeScript/11BundleLoadingSample/types/controllers/DialogueController.d.ts index 1b72522..9c8b728 100644 --- a/TypeScript/11BundleLoadingSample/types/controllers/DialogueController.d.ts +++ b/TypeScript/11BundleLoadingSample/types/controllers/DialogueController.d.ts @@ -23,7 +23,7 @@ export declare class DialogueController { * Get the content of a dialogue * @param dialogueID Dialog id * @param sessionID Session Id - * @returns + * @returns DialogueInfo */ getDialogueInfo(dialogueID: string, sessionID: string): DialogueInfo; /** diff --git a/TypeScript/11BundleLoadingSample/types/controllers/GameController.d.ts b/TypeScript/11BundleLoadingSample/types/controllers/GameController.d.ts index 3bfbdb1..f4f5849 100644 --- a/TypeScript/11BundleLoadingSample/types/controllers/GameController.d.ts +++ b/TypeScript/11BundleLoadingSample/types/controllers/GameController.d.ts @@ -1,3 +1,4 @@ +import { ApplicationContext } from "../context/ApplicationContext"; import { GameEventHelper } from "../helpers/GameEventHelper"; import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; @@ -14,6 +15,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; +import { LocalisationService } from "../services/LocalisationService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { Watermark } from "../utils/Watermark"; export declare class GameController { @@ -24,14 +26,33 @@ export declare class GameController { protected localeService: LocaleService; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; + protected localisationService: LocalisationService; protected gameEventHelper: GameEventHelper; + protected applicationContext: ApplicationContext; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; protected coreConfig: ICoreConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, gameEventHelper: GameEventHelper, configServer: ConfigServer); - gameStart(_url: string, _info: IEmptyRequestData, sessionID: string): void; + constructor(logger: ILogger, databaseServer: DatabaseServer, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, gameEventHelper: GameEventHelper, applicationContext: ApplicationContext, configServer: ConfigServer); + gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; + /** + * Check if current date falls inside any of the seasons events pased in, if so, handle them + * @param seasonalEvents events to check for + */ protected checkForAndEnableSeasonalEvents(seasonalEvents: ISeasonalEvent[]): void; + /** + * Make adjusted to server code based on the name of the event passed in + * @param globalConfig globals.json + * @param eventName Name of the event to enable. e.g. Christmas + */ protected updateGlobalEvents(globalConfig: Config, eventName: string): void; + /** + * Read in data from seasonalEvents.json and add found equipment items to bots + * @param eventName Name of the event to read equipment in from config + */ + protected addEventGearToScavs(eventName: string): void; + /** + * Set Khorovod(dancing tree) chance to 100% on all maps that support it + */ protected enableDancingTree(): void; /** * Make non-trigger-spawned raiders spawn earlier + always @@ -40,5 +61,6 @@ export declare class GameController { protected logProfileDetails(fullProfile: IAkiProfile): void; getGameConfig(sessionID: string): IGameConfigResponse; getServer(): IServerDetails[]; + protected addPumpkinsToScavBackpacks(): void; getValidGameVersion(): ICheckVersionResponse; } diff --git a/TypeScript/11BundleLoadingSample/types/controllers/HideoutController.d.ts b/TypeScript/11BundleLoadingSample/types/controllers/HideoutController.d.ts index ada5bd9..5b6507b 100644 --- a/TypeScript/11BundleLoadingSample/types/controllers/HideoutController.d.ts +++ b/TypeScript/11BundleLoadingSample/types/controllers/HideoutController.d.ts @@ -23,12 +23,13 @@ import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; import { PlayerService } from "../services/PlayerService"; import { HashUtil } from "../utils/HashUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; -import { JsonUtil } from "../utils/JsonUtil"; export declare class HideoutController { protected logger: ILogger; protected hashUtil: HashUtil; @@ -45,11 +46,12 @@ export declare class HideoutController { protected profileHelper: ProfileHelper; protected hideoutHelper: HideoutHelper; protected scavCaseRewardGenerator: ScavCaseRewardGenerator; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected jsonUtil: JsonUtil; protected static nameBackendCountersCrafting: string; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, configServer: ConfigServer, jsonUtil: JsonUtil); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, localisationService: LocalisationService, configServer: ConfigServer, jsonUtil: JsonUtil); upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; upgradeComplete(pmcData: IPmcData, body: HideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; /** diff --git a/TypeScript/11BundleLoadingSample/types/controllers/InraidController.d.ts b/TypeScript/11BundleLoadingSample/types/controllers/InraidController.d.ts index e84eea1..39a6396 100644 --- a/TypeScript/11BundleLoadingSample/types/controllers/InraidController.d.ts +++ b/TypeScript/11BundleLoadingSample/types/controllers/InraidController.d.ts @@ -6,6 +6,7 @@ import { ProfileHelper } from "../helpers/ProfileHelper"; import { QuestHelper } from "../helpers/QuestHelper"; import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; +import { Item } from "../models/eft/common/tables/IItem"; import { IRegisterPlayerRequestData } from "../models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; import { IAirdropConfig } from "../models/spt/config/IAirdropConfig"; @@ -17,6 +18,9 @@ import { SaveServer } from "../servers/SaveServer"; import { InsuranceService } from "../services/InsuranceService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; +/** + * Logic for handling In Raid callbacks + */ export declare class InraidController { protected logger: ILogger; protected saveServer: SaveServer; @@ -35,14 +39,42 @@ export declare class InraidController { protected airdropConfig: IAirdropConfig; protected inraidConfig: IInRaidConfig; 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 + * Save locationid to active profiles inraid object + * @param sessionID Session id + * @param info Register player request + */ + addPlayer(sessionID: string, info: IRegisterPlayerRequestData): void; + /** + * Save profile state to disk + * Handles pmc/pscav + * @param offraidData post-raid request data + * @param sessionID Session id + */ + savePostRaidProgress(offraidData: ISaveProgressRequestData, sessionID: string): void; + /** + * Handle updating player profile post-pmc raid * @param sessionID session id - * @param offraidData post-raid data of raid + * @param offraidData post-raid data */ protected savePmcProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; + /** + * Make changes to pmc profile after they left raid dead, + * alter bodypart hp, handle insurance, delete inventory items, remove carried quest items + * @param postRaidSaveRequest post-raid save request + * @param pmcData pmc profile + * @param insuranceEnabled is insurance enabled + * @param preRaidGear gear player had before raid + * @param sessionID Session id + * @returns Updated profile object + */ + protected performPostRaidActionsWhenDead(postRaidSaveRequest: ISaveProgressRequestData, pmcData: IPmcData, insuranceEnabled: boolean, preRaidGear: Item[], sessionID: string): IPmcData; + /** + * Adjust player characters bodypart hp if they left raid early + * @param postRaidSaveRequest post raid data + * @param pmcData player profile + */ + protected updatePmcHealthPostRaid(postRaidSaveRequest: ISaveProgressRequestData, pmcData: IPmcData): void; /** * Reduce body part hp to % of max * @param pmcData profile to edit @@ -68,7 +100,31 @@ export declare class InraidController { * @param isPlayerScav Was the player a pScav */ protected markOrRemoveFoundInRaidItems(offraidData: ISaveProgressRequestData, pmcData: IPmcData, isPlayerScav: boolean): void; + /** + * Update profile after player completes scav raid + * @param scavData Scav profile + * @param sessionID Session id + * @param offraidData Post-raid save request + * @param pmcData Pmc profile + * @param isDead Is player dead + */ protected handlePostRaidPlayerScavProcess(scavData: IPmcData, sessionID: string, offraidData: ISaveProgressRequestData, pmcData: IPmcData, isDead: boolean): void; + /** + * Update profile with scav karma values based on in-raid actions + * @param pmcData Pmc profile + * @param offraidData Post-raid save request + * @param scavData Scav profile + * @param sessionID Session id + */ protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData, scavData: IPmcData, sessionID: string): void; + /** + * Get the inraid config from configs/inraid.json + * @returns InRaid Config + */ + getInraidConfig(): IInRaidConfig; + /** + * Get airdrop config from configs/airdrop.json + * @returns Airdrop config + */ getAirdropConfig(): IAirdropConfig; } diff --git a/TypeScript/11BundleLoadingSample/types/controllers/InsuranceController.d.ts b/TypeScript/11BundleLoadingSample/types/controllers/InsuranceController.d.ts index 14bf129..54f31b5 100644 --- a/TypeScript/11BundleLoadingSample/types/controllers/InsuranceController.d.ts +++ b/TypeScript/11BundleLoadingSample/types/controllers/InsuranceController.d.ts @@ -30,8 +30,7 @@ export declare class InsuranceController { protected insuranceService: InsuranceService; protected configServer: ConfigServer; protected insuranceConfig: IInsuranceConfig; - constructor(logger: ILogger, randomUtil: RandomUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, paymentService: PaymentService, // TODO: delay required - insuranceService: InsuranceService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, paymentService: PaymentService, insuranceService: InsuranceService, configServer: ConfigServer); processReturn(): void; insure(pmcData: IPmcData, body: IInsureRequestData, sessionID: string): IItemEventRouterResponse; /** diff --git a/TypeScript/11BundleLoadingSample/types/controllers/InventoryController.d.ts b/TypeScript/11BundleLoadingSample/types/controllers/InventoryController.d.ts index 6a1a21e..e1c08c0 100644 --- a/TypeScript/11BundleLoadingSample/types/controllers/InventoryController.d.ts +++ b/TypeScript/11BundleLoadingSample/types/controllers/InventoryController.d.ts @@ -1,8 +1,8 @@ -import { EventOutputHolder } from "../routers/EventOutputHolder"; import { InventoryHelper } from "../helpers/InventoryHelper"; import { PaymentHelper } from "../helpers/PaymentHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IAddItemRequestData } from "../models/eft/inventory/IAddItemRequestData"; import { IInventoryBindRequestData } from "../models/eft/inventory/IInventoryBindRequestData"; @@ -21,33 +21,46 @@ import { IInventorySwapRequestData } from "../models/eft/inventory/IInventorySwa import { IInventoryTagRequestData } from "../models/eft/inventory/IInventoryTagRequestData"; import { IInventoryToggleRequestData } from "../models/eft/inventory/IInventoryToggleRequestData"; import { IInventoryTransferRequestData } from "../models/eft/inventory/IInventoryTransferRequestData"; +import { IOpenRandomLootContainerRequestData } from "../models/eft/inventory/IOpenRandomLootContainerRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { ILogger } from "../models/spt/utils/ILogger"; +import { EventOutputHolder } from "../routers/EventOutputHolder"; import { DatabaseServer } from "../servers/DatabaseServer"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { HashUtil } from "../utils/HashUtil"; +import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { JsonUtil } from "../utils/JsonUtil"; +import { RandomUtil } from "../utils/RandomUtil"; export declare class InventoryController { protected logger: ILogger; protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; + protected randomUtil: RandomUtil; protected databaseServer: DatabaseServer; protected fenceService: FenceService; protected presetHelper: PresetHelper; protected inventoryHelper: InventoryHelper; protected ragfairOfferService: RagfairOfferService; protected profileHelper: ProfileHelper; + protected weightedRandomHelper: WeightedRandomHelper; protected paymentHelper: PaymentHelper; + protected localisationService: LocalisationService; protected eventOutputHolder: EventOutputHolder; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder); + protected httpResponseUtil: HttpResponseUtil; + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, weightedRandomHelper: WeightedRandomHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); /** * Move Item * change location of item with parentId and slotId * transfers items from one profile to another if fromOwner/toOwner is set in the body. * otherwise, move is contained within the same profile_f. - */ - moveItem(pmcData: IPmcData, body: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; + * @param pmcData Profile + * @param moveRequest Move request data + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ + moveItem(pmcData: IPmcData, moveRequest: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; /** * Remove Item from Profile * Deep tree item deletion, also removes items from insurance list @@ -122,4 +135,12 @@ export declare class InventoryController { createMapMarker(pmcData: IPmcData, body: IInventoryCreateMarkerRequestData, sessionID: string): IItemEventRouterResponse; deleteMapMarker(pmcData: IPmcData, body: IInventoryDeleteMarkerRequestData, sessionID: string): IItemEventRouterResponse; editMapMarker(pmcData: IPmcData, body: IInventoryEditMarkerRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle event fired when a container is unpacked (currently only the halloween pumpkin) + * @param pmcData Profile data + * @param body open loot container request data + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ + openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/11BundleLoadingSample/types/controllers/LocationController.d.ts b/TypeScript/11BundleLoadingSample/types/controllers/LocationController.d.ts index 9db3205..b6feba8 100644 --- a/TypeScript/11BundleLoadingSample/types/controllers/LocationController.d.ts +++ b/TypeScript/11BundleLoadingSample/types/controllers/LocationController.d.ts @@ -7,6 +7,7 @@ import { LootItem } from "../models/spt/services/LootItem"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -15,12 +16,13 @@ export declare class LocationController { protected hashUtil: HashUtil; protected logger: ILogger; protected locationGenerator: LocationGenerator; + protected localisationService: LocalisationService; protected lootGenerator: LootGenerator; protected databaseServer: DatabaseServer; protected timeUtil: TimeUtil; protected configServer: ConfigServer; protected airdropConfig: IAirdropConfig; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, logger: ILogger, locationGenerator: LocationGenerator, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer); + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer); get(location: string): ILocationBase; generate(name: string): ILocationBase; generateAll(): ILocationsGenerateAllResponse; diff --git a/TypeScript/11BundleLoadingSample/types/controllers/MatchController.d.ts b/TypeScript/11BundleLoadingSample/types/controllers/MatchController.d.ts index dac6a3f..2b0d150 100644 --- a/TypeScript/11BundleLoadingSample/types/controllers/MatchController.d.ts +++ b/TypeScript/11BundleLoadingSample/types/controllers/MatchController.d.ts @@ -19,7 +19,6 @@ import { SaveServer } from "../servers/SaveServer"; import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; import { BotLootCacheService } from "../services/BotLootCacheService"; import { MatchLocationService } from "../services/MatchLocationService"; -import { PmcAiService } from "../services/PmcAiService"; import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; export declare class MatchController { protected logger: ILogger; @@ -30,13 +29,12 @@ export declare class MatchController { protected botLootCacheService: BotLootCacheService; protected configServer: ConfigServer; protected profileSnapshotService: ProfileSnapshotService; - protected pmcAiService: PmcAiService; protected botGenerationCacheService: BotGenerationCacheService; 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, pmcAiService: PmcAiService, botGenerationCacheService: BotGenerationCacheService, applicationContext: ApplicationContext); + constructor(logger: ILogger, saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, botGenerationCacheService: BotGenerationCacheService, applicationContext: ApplicationContext); getEnabled(): boolean; getProfile(info: IGetProfileRequestData): IPmcData[]; createGroup(sessionID: string, info: ICreateGroupRequestData): any; diff --git a/TypeScript/11BundleLoadingSample/types/controllers/RagfairController.d.ts b/TypeScript/11BundleLoadingSample/types/controllers/RagfairController.d.ts index 5440458..95702f2 100644 --- a/TypeScript/11BundleLoadingSample/types/controllers/RagfairController.d.ts +++ b/TypeScript/11BundleLoadingSample/types/controllers/RagfairController.d.ts @@ -29,6 +29,7 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { RagfairServer } from "../servers/RagfairServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; import { PaymentService } from "../services/PaymentService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { RagfairPriceService } from "../services/RagfairPriceService"; @@ -62,9 +63,10 @@ export declare class RagfairController { protected ragfairOfferService: RagfairOfferService; protected ragfairRequiredItemsService: RagfairRequiredItemsService; protected ragfairOfferGenerator: RagfairOfferGenerator; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, eventOutputHolder: EventOutputHolder, ragfairServer: RagfairServer, ragfairPriceService: RagfairPriceService, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer, ragfairSellHelper: RagfairSellHelper, ragfairTaxHelper: RagfairTaxHelper, ragfairSortHelper: RagfairSortHelper, ragfairOfferHelper: RagfairOfferHelper, profileHelper: ProfileHelper, paymentService: PaymentService, handbookHelper: HandbookHelper, paymentHelper: PaymentHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, ragfairOfferGenerator: RagfairOfferGenerator, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, eventOutputHolder: EventOutputHolder, ragfairServer: RagfairServer, ragfairPriceService: RagfairPriceService, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer, ragfairSellHelper: RagfairSellHelper, ragfairTaxHelper: RagfairTaxHelper, ragfairSortHelper: RagfairSortHelper, ragfairOfferHelper: RagfairOfferHelper, profileHelper: ProfileHelper, paymentService: PaymentService, handbookHelper: HandbookHelper, paymentHelper: PaymentHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, ragfairOfferGenerator: RagfairOfferGenerator, localisationService: LocalisationService, configServer: ConfigServer); getOffers(sessionID: string, info: ISearchRequestData): IGetOffersResult; /** * Get offers for the client based on type of search being performed @@ -103,7 +105,12 @@ export declare class RagfairController { protected isLinkedSearch(info: ISearchRequestData): boolean; protected isRequiredSearch(info: ISearchRequestData): boolean; update(): void; - getItemPrice(info: IGetMarketPriceRequestData): IGetItemPriceResult; + /** + * Called when creating an offer on flea, fills values in top right corner + * @param getPriceRequest + * @returns min/avg/max values for an item based on flea offers available + */ + getItemMinAvgMaxFleaPriceValues(getPriceRequest: IGetMarketPriceRequestData): IGetItemPriceResult; addPlayerOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; createPlayerOffer(profile: IAkiProfile, requirements: Requirement[], items: Item[], sellInOnePiece: boolean, amountToSend: number): IRagfairOffer; getAllFleaPrices(): Record; diff --git a/TypeScript/11BundleLoadingSample/types/controllers/RepeatableQuestController.d.ts b/TypeScript/11BundleLoadingSample/types/controllers/RepeatableQuestController.d.ts index 7db5886..333583b 100644 --- a/TypeScript/11BundleLoadingSample/types/controllers/RepeatableQuestController.d.ts +++ b/TypeScript/11BundleLoadingSample/types/controllers/RepeatableQuestController.d.ts @@ -17,6 +17,7 @@ import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { ItemFilterService } from "../services/ItemFilterService"; +import { LocalisationService } from "../services/LocalisationService"; import { PaymentService } from "../services/PaymentService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { JsonUtil } from "../utils/JsonUtil"; @@ -64,12 +65,13 @@ export declare class RepeatableQuestController { protected profileFixerService: ProfileFixerService; protected ragfairServerHelper: RagfairServerHelper; protected eventOutputHolder: EventOutputHolder; + protected localisationService: LocalisationService; protected paymentService: PaymentService; protected objectId: ObjectId; protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * This is the method reached by the /client/repeatalbeQuests/activityPeriods endpoint * Returns an array of objects in the format of repeatable quests to the client. diff --git a/TypeScript/11BundleLoadingSample/types/controllers/WeatherController.d.ts b/TypeScript/11BundleLoadingSample/types/controllers/WeatherController.d.ts index ca7f5eb..631a90c 100644 --- a/TypeScript/11BundleLoadingSample/types/controllers/WeatherController.d.ts +++ b/TypeScript/11BundleLoadingSample/types/controllers/WeatherController.d.ts @@ -1,11 +1,18 @@ import { WeatherGenerator } from "../generators/WeatherGenerator"; import { IWeatherData } from "../models/eft/weather/IWeatherData"; import { IWeatherConfig } from "../models/spt/config/IWeatherConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; export declare class WeatherController { protected weatherGenerator: WeatherGenerator; + protected logger: ILogger; protected configServer: ConfigServer; protected weatherConfig: IWeatherConfig; - constructor(weatherGenerator: WeatherGenerator, configServer: ConfigServer); + constructor(weatherGenerator: WeatherGenerator, logger: ILogger, configServer: ConfigServer); generate(): IWeatherData; + /** + * Get the current in-raid time (MUST HAVE PLAYER LOGGED INTO CLIENT TO WORK) + * @returns Date object + */ + getCurrentInRaidTime(): Date; } diff --git a/TypeScript/11BundleLoadingSample/types/generators/BotGenerator.d.ts b/TypeScript/11BundleLoadingSample/types/generators/BotGenerator.d.ts index 2ac51db..a1ac9ed 100644 --- a/TypeScript/11BundleLoadingSample/types/generators/BotGenerator.d.ts +++ b/TypeScript/11BundleLoadingSample/types/generators/BotGenerator.d.ts @@ -1,7 +1,8 @@ +import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; import { GameEventHelper } from "../helpers/GameEventHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; -import { IGenerateBotsRequestData } from "../models/eft/bot/IGenerateBotsRequestData"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { Health as PmcHealth, IBotBase, Skills } from "../models/eft/common/tables/IBotBase"; import { Health, IBotType, Inventory } from "../models/eft/common/tables/IBotType"; import { IBotConfig } from "../models/spt/config/IBotConfig"; @@ -9,7 +10,6 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; -import { PmcAiService } from "../services/PmcAiService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; @@ -29,12 +29,13 @@ export declare class BotGenerator { protected databaseServer: DatabaseServer; protected botInventoryGenerator: BotInventoryGenerator; protected botEquipmentFilterService: BotEquipmentFilterService; + protected weightedRandomHelper: WeightedRandomHelper; protected botHelper: BotHelper; + protected botDifficultyHelper: BotDifficultyHelper; protected gameEventHelper: GameEventHelper; - protected pmcAiService: PmcAiService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botEquipmentFilterService: BotEquipmentFilterService, botHelper: BotHelper, gameEventHelper: GameEventHelper, pmcAiService: PmcAiService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botEquipmentFilterService: BotEquipmentFilterService, weightedRandomHelper: WeightedRandomHelper, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, gameEventHelper: GameEventHelper, configServer: ConfigServer); /** * Generate a player scav bot object * @param role e.g. assault / pmcbot @@ -44,12 +45,18 @@ export declare class BotGenerator { */ generatePlayerScav(sessionId: string, role: string, difficulty: string, botTemplate: IBotType): IBotBase; /** - * Generate an array of bot objects for populate a raid with + * Generate an array of bot objects based on a condition for a raid with * @param sessionId session id - * @param info request object + * @param condition request condition * @returns bot array */ - generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; + generateByCondition(sessionId: string, botCountToGenerate: number, difficulty: string, role: string, isPmc: boolean): IBotBase[]; + /** + * Get the PMCs wildSpawnType value + * @param role "usec" / "bear" + * @returns wildSpawnType value as string + */ + protected getPmcRoleByDescription(role: string): string; /** * Get a randomised PMC side based on bot config value 'isUsec' * @returns pmc side as string @@ -64,13 +71,13 @@ export declare class BotGenerator { * Create a IBotBase object with equipment/loot/exp etc * @param sessionId Session id * @param bot bots base file - * @param role botRole bot will use + * @param botRole Role bot will use (bear/usec for PMCs) * @param node Bot template from db/bots/x.json * @param isPmc Is bot to be a PMC * @param isPlayerScav is bot to be a p scav bot * @returns IBotBase object */ - protected generateBot(sessionId: string, bot: IBotBase, role: string, node: IBotType, isPmc: boolean, isPlayerScav?: boolean): IBotBase; + protected generateBot(sessionId: string, bot: IBotBase, botRole: string, node: IBotType, isPmc: boolean, isPlayerScav?: boolean): IBotBase; /** * Log the number of PMCs generated to the debug console * @param output Generated bot array, ready to send to client diff --git a/TypeScript/11BundleLoadingSample/types/generators/BotInventoryGenerator.d.ts b/TypeScript/11BundleLoadingSample/types/generators/BotInventoryGenerator.d.ts index c5ed545..e1efaf2 100644 --- a/TypeScript/11BundleLoadingSample/types/generators/BotInventoryGenerator.d.ts +++ b/TypeScript/11BundleLoadingSample/types/generators/BotInventoryGenerator.d.ts @@ -7,6 +7,7 @@ import { IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { BotLootGenerator } from "./BotLootGenerator"; @@ -20,14 +21,68 @@ export declare class BotInventoryGenerator { protected botLootGenerator: BotLootGenerator; protected botGeneratorHelper: BotGeneratorHelper; protected weightedRandomHelper: WeightedRandomHelper; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, configServer: ConfigServer); + /** + * Add equipment/weapons/loot to bot + * @param sessionId Session id + * @param templateInventory bot/x.json data from db + * @param equipmentChances Chances each item will be added to bot + * @param itemGenerationLimitsMinMax item gen limits for bot role + * @param botRole Role bot has (assault/pmcBot) + * @param isPmc Is bot being converted into a pmc + * @returns PmcInventory object with equipment/weapons/loot + */ generateInventory(sessionId: string, templateInventory: Inventory, equipmentChances: Chances, itemGenerationLimitsMinMax: Generation, botRole: string, isPmc: boolean): PmcInventory; + /** + * Create a pmcInventory object with all the base/generic items needed + * @returns PmcInventory object + */ + protected generateInventoryBase(): PmcInventory; + /** + * Add equipment to a bot + * @param templateInventory bot/x.json data from db + * @param equipmentChances Chances items will be added to bot + * @param botRole Role bot has (assault/pmcBot) + * @param botInventory Inventory to add equipment to + */ + protected generateAndAddEquipmentToBot(templateInventory: Inventory, equipmentChances: Chances, botRole: string, botInventory: PmcInventory): void; + protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory): void; + /** + * Work out what weapons bot should have equipped and add them to bot inventory + * @param templateInventory bot/x.json data from db + * @param equipmentChances Chances bot can have equipment equipped + * @param sessionId Session id + * @param botInventory Inventory to add weapons to + * @param botRole assault/pmcBot/bossTagilla etc + * @param isPmc Is the bot being generated as a pmc + * @param itemGenerationLimitsMinMax Limits for items the bot can have + */ + protected generateAndAddWeaponsToBot(templateInventory: Inventory, equipmentChances: Chances, sessionId: string, botInventory: PmcInventory, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation): void; + /** + * Calculate if the bot should have weapons in Primary/Secondary/Holster slots + * @param equipmentChances Chances bot has certain equipment + * @returns What slots bot should have weapons generated for + */ + protected getDesiredWeaponsForBot(equipmentChances: Chances): { + slot: EquipmentSlots; + shouldSpawn: boolean; + }[]; + /** + * Add weapon + spare mags/ammo to bots inventory + * @param sessionId Session id + * @param weaponSlot Weapon slot being generated + * @param templateInventory bot/x.json data from db + * @param botInventory Inventory to add weapon+mags/ammo to + * @param equipmentChances Chances bot can have equipment equipped + * @param botRole assault/pmcBot/bossTagilla etc + * @param isPmc Is the bot being generated as a pmc + * @param itemGenerationLimitsMinMax + */ protected addWeaponAndMagazinesToInventory(sessionId: string, weaponSlot: { slot: EquipmentSlots; shouldSpawn: boolean; }, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation): void; - protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory): void; - protected generateInventoryBase(): PmcInventory; } diff --git a/TypeScript/11BundleLoadingSample/types/generators/BotLootGenerator.d.ts b/TypeScript/11BundleLoadingSample/types/generators/BotLootGenerator.d.ts index c1f5310..3352a46 100644 --- a/TypeScript/11BundleLoadingSample/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/11BundleLoadingSample/types/generators/BotLootGenerator.d.ts @@ -10,6 +10,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotLootCacheService } from "../services/BotLootCacheService"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { BotWeaponGenerator } from "./BotWeaponGenerator"; @@ -23,9 +24,10 @@ export declare class BotLootGenerator { protected botWeaponGenerator: BotWeaponGenerator; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected botLootCacheService: BotLootCacheService; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, configServer: ConfigServer); generateLoot(sessionId: string, templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances): void; protected getRandomisedCount(min: number, max: number, nValue: number): number; /** @@ -113,7 +115,7 @@ export declare class BotLootGenerator { * If no limit found for a non pmc bot, fall back to defaults * @param isPmc is the bot we want limits for a pmc * @param botRole what role does the bot have - * @returns dictionary of tplIds and limit + * @returns Dictionary of tplIds and limit */ protected getItemSpawnLimitsForBotType(isPmc: boolean, botRole: string): Record; /** diff --git a/TypeScript/11BundleLoadingSample/types/generators/BotWeaponGenerator.d.ts b/TypeScript/11BundleLoadingSample/types/generators/BotWeaponGenerator.d.ts index 487901b..40284ea 100644 --- a/TypeScript/11BundleLoadingSample/types/generators/BotWeaponGenerator.d.ts +++ b/TypeScript/11BundleLoadingSample/types/generators/BotWeaponGenerator.d.ts @@ -12,6 +12,7 @@ import { IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; @@ -27,10 +28,11 @@ export declare class BotWeaponGenerator { protected randomUtil: RandomUtil; protected configServer: ConfigServer; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected localisationService: LocalisationService; protected inventoryMagGenComponents: IInventoryMagGen[]; protected readonly modMagazineSlotId = "mod_magazine"; protected botConfig: IBotConfig; - constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil, configServer: ConfigServer, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, inventoryMagGenComponents: IInventoryMagGen[]); + constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil, configServer: ConfigServer, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, inventoryMagGenComponents: IInventoryMagGen[]); /** * Pick a random weapon based on weightings and generate a functional weapon * @param equipmentSlot Primary/secondary/holster diff --git a/TypeScript/11BundleLoadingSample/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/11BundleLoadingSample/types/generators/RagfairOfferGenerator.d.ts index b64a7e7..23882d2 100644 --- a/TypeScript/11BundleLoadingSample/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/11BundleLoadingSample/types/generators/RagfairOfferGenerator.d.ts @@ -1,16 +1,19 @@ +import { HandbookHelper } from "../helpers/HandbookHelper"; import { ItemHelper } from "../helpers/ItemHelper"; +import { PaymentHelper } from "../helpers/PaymentHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; import { Item } from "../models/eft/common/tables/IItem"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { IBarterScheme } from "../models/eft/common/tables/ITrader"; -import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; +import { IRagfairOffer, OfferRequirement } from "../models/eft/ragfair/IRagfairOffer"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { RagfairCategoriesService } from "../services/RagfairCategoriesService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { RagfairPriceService } from "../services/RagfairPriceService"; @@ -27,18 +30,31 @@ export declare class RagfairOfferGenerator { protected timeUtil: TimeUtil; protected databaseServer: DatabaseServer; protected ragfairServerHelper: RagfairServerHelper; + protected handbookHelper: HandbookHelper; protected saveServer: SaveServer; protected presetHelper: PresetHelper; protected ragfairAssortGenerator: RagfairAssortGenerator; protected ragfairOfferService: RagfairOfferService; protected ragfairPriceService: RagfairPriceService; + protected localisationService: LocalisationService; + protected paymentHelper: PaymentHelper; protected ragfairCategoriesService: RagfairCategoriesService; protected fenceService: FenceService; protected itemHelper: ItemHelper; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, ragfairServerHelper: RagfairServerHelper, saveServer: SaveServer, presetHelper: PresetHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferService: RagfairOfferService, ragfairPriceService: RagfairPriceService, ragfairCategoriesService: RagfairCategoriesService, fenceService: FenceService, itemHelper: ItemHelper, configServer: ConfigServer); + protected allowedFleaPriceItemsForBarter: { + tpl: string; + price: number; + }[]; + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, ragfairServerHelper: RagfairServerHelper, handbookHelper: HandbookHelper, saveServer: SaveServer, presetHelper: PresetHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferService: RagfairOfferService, ragfairPriceService: RagfairPriceService, localisationService: LocalisationService, paymentHelper: PaymentHelper, ragfairCategoriesService: RagfairCategoriesService, fenceService: FenceService, itemHelper: ItemHelper, configServer: ConfigServer); createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; + /** + * Calculate the offer price that's listed on the flea listing + * @param offerRequirements barter requirements for offer + * @returns rouble cost of offer + */ + protected calculateOfferListingPrice(offerRequirements: OfferRequirement[]): number; /** * Get avatar url from trader table in db * @param isTrader Is user we're getting avatar for a trader @@ -87,20 +103,36 @@ export declare class RagfairOfferGenerator { * @returns Item with conditions added */ protected addMissingCondition(item: Item): Item; - protected getOfferRequirements(items: Item[]): { - count: number; - _tpl: string; + /** + * Create a barter-based barter scheme, if not possible, fall back to making barter scheme currency based + * @param offerItems Items for sale in offer + * @returns barter scheme + */ + protected createBarterRequirement(offerItems: Item[]): IBarterScheme[]; + /** + * Get an array of flea prices + item tpl, cached in generator class + * @returns array with tpl/price values + */ + protected getFleaPricesAsArray(): { + tpl: string; + price: number; }[]; + /** + * Create a random currency-based barter scheme for an array of items + * @param offerItems Items on offer + * @returns Barter scheme for offer + */ + protected createCurrencyRequirement(offerItems: Item[]): IBarterScheme[]; /** * Create a flea offer and store it in the Ragfair server offers array * @param userID owner of the offer * @param time time offer is put up * @param items items in the offer - * @param barterScheme - * @param loyalLevel + * @param barterScheme cost of item (currency or barter) + * @param loyalLevel Loyalty level needed to buy item * @param price price of offer * @param sellInOnePiece - * @returns + * @returns Ragfair offer */ createFleaOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; } diff --git a/TypeScript/11BundleLoadingSample/types/generators/WeatherGenerator.d.ts b/TypeScript/11BundleLoadingSample/types/generators/WeatherGenerator.d.ts index 8ddbe49..65d2c76 100644 --- a/TypeScript/11BundleLoadingSample/types/generators/WeatherGenerator.d.ts +++ b/TypeScript/11BundleLoadingSample/types/generators/WeatherGenerator.d.ts @@ -1,38 +1,54 @@ +import { ApplicationContext } from "../context/ApplicationContext"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; -import { IWeatherData } from "../models/eft/weather/IWeatherData"; +import { IWeather, IWeatherData } from "../models/eft/weather/IWeatherData"; +import { WindDirection } from "../models/enums/WindDirection"; import { IWeatherConfig } from "../models/spt/config/IWeatherConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class WeatherGenerator { protected weightedRandomHelper: WeightedRandomHelper; + protected logger: ILogger; protected randomUtil: RandomUtil; protected timeUtil: TimeUtil; + protected applicationContext: ApplicationContext; protected configServer: ConfigServer; protected weatherConfig: IWeatherConfig; - constructor(weightedRandomHelper: WeightedRandomHelper, randomUtil: RandomUtil, timeUtil: TimeUtil, configServer: ConfigServer); - calculateTime(data: IWeatherData): IWeatherData; + constructor(weightedRandomHelper: WeightedRandomHelper, logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, applicationContext: ApplicationContext, configServer: ConfigServer); + calculateGameTime(data: IWeatherData): IWeatherData; /** * Get server uptime seconds multiplied by a multiplier and add to current time as seconds * Format to BSGs requirements - * @param computedDate current date + * @param currentDate current date * @returns formatted time */ - protected getAcceleratedTime(computedDate: Date): string; + protected getBsgFormattedInRaidTime(currentDate: Date): string; + /** + * Get the current in-raid time + * @param currentDate (new Date()) + * @returns Date object of current in-raid time + */ + getInRaidTime(currentDate: Date): Date; /** * Get current time formatted to fit BSGs requirement - * @param computedDate date to format into bsg style + * @param date date to format into bsg style * @returns */ - protected getNormalTime(computedDate: Date): string; + protected getBSGFormattedTime(date: Date): string; /** - * Return randomised Weather data - * @param weatherData weather input data + * Return randomised Weather data with help of config/weather.json * @returns Randomised weather data */ - generateWeather(weatherData: IWeatherData): IWeatherData; - protected getWeightedFog(): string; + generateWeather(): IWeather; + /** + * Set IWeather date/time/timestamp values to now + * @param weather Object to update + */ + protected setCurrentDateTime(weather: IWeather): void; + protected getWeightedWindDirection(): WindDirection; + protected getWeightedWindSpeed(): number; + protected getWeightedFog(): number; protected getWeightedRain(): number; protected getRandomFloat(node: string): number; - protected getRandomInt(node: string): number; } diff --git a/TypeScript/11BundleLoadingSample/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts b/TypeScript/11BundleLoadingSample/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts index 4fcb1e2..1589707 100644 --- a/TypeScript/11BundleLoadingSample/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts +++ b/TypeScript/11BundleLoadingSample/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts @@ -1,13 +1,15 @@ import { BotWeaponGeneratorHelper } from "../../../helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "../../../helpers/ItemHelper"; import { ILogger } from "../../../models/spt/utils/ILogger"; +import { LocalisationService } from "../../../services/LocalisationService"; import { IInventoryMagGen } from "../IInventoryMagGen"; import { InventoryMagGen } from "../InventoryMagGen"; export declare class ExternalInventoryMagGen implements IInventoryMagGen { protected logger: ILogger; protected itemHelper: ItemHelper; + protected localisationService: LocalisationService; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; - constructor(logger: ILogger, itemHelper: ItemHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper); + constructor(logger: ILogger, itemHelper: ItemHelper, localisationService: LocalisationService, botWeaponGeneratorHelper: BotWeaponGeneratorHelper); getPriority(): number; canHandleInventoryMagGen(inventoryMagGen: InventoryMagGen): boolean; process(inventoryMagGen: InventoryMagGen): void; diff --git a/TypeScript/11BundleLoadingSample/types/helpers/BotDifficultyHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/BotDifficultyHelper.d.ts new file mode 100644 index 0000000..a58ebdb --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/helpers/BotDifficultyHelper.d.ts @@ -0,0 +1,46 @@ +import { Difficulty } from "../models/eft/common/tables/IBotType"; +import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; +import { JsonUtil } from "../utils/JsonUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +import { BotHelper } from "./BotHelper"; +export declare class BotDifficultyHelper { + protected logger: ILogger; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected randomUtil: RandomUtil; + protected localisationService: LocalisationService; + protected botHelper: BotHelper; + protected configServer: ConfigServer; + protected botConfig: IBotConfig; + constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, localisationService: LocalisationService, botHelper: BotHelper, configServer: ConfigServer); + getPmcDifficultySettings(pmcType: "bear" | "usec", difficulty: string, usecType: string, bearType: string): Difficulty; + /** + * Get difficulty settings for desired bot type, if not found use assault bot types + * @param type bot type to retreive difficulty of + * @param difficulty difficulty to get settings for (easy/normal etc) + * @returns Difficulty object + */ + getBotDifficultySettings(type: string, difficulty: string): Difficulty; + /** + * Get difficulty settings for a PMC + * @param type "usec" / "bear" + * @param difficulty what difficulty to retrieve + * @returns Difficulty object + */ + protected getDifficultySettings(type: string, difficulty: string): Difficulty; + /** + * Translate chosen value from pre-raid difficulty dropdown into bot difficulty value + * @param dropDownDifficulty Dropdown difficulty value to convert + * @returns bot difficulty + */ + convertBotDifficultyDropdownToBotDifficulty(dropDownDifficulty: string): string; + /** + * Choose a random difficulty from - easy/normal/hard/impossible + * @returns random difficulty + */ + chooseRandomDifficulty(): string; +} diff --git a/TypeScript/11BundleLoadingSample/types/helpers/BotGeneratorHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/BotGeneratorHelper.d.ts index 5e3e501..899669e 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/BotGeneratorHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/BotGeneratorHelper.d.ts @@ -8,6 +8,7 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; import { ItemFilterService } from "../services/ItemFilterService"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; @@ -43,9 +44,10 @@ export declare class BotGeneratorHelper { protected itemFilterService: ItemFilterService; protected profileHelper: ProfileHelper; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Check mods are compatible and add to array * @param equipment Equipment item to add mods to @@ -53,9 +55,11 @@ export declare class BotGeneratorHelper { * @param parentId parentid of item to add mod to * @param parentTemplate template objet of item to add mods to * @param modSpawnChances dictionary of mod items and their chance to spawn for this bot type + * @param botRole the bot role being generated for + * @param forceSpawn should this mod be forced to spawn * @returns Item + compatible mods as an array */ - generateModsForEquipment(equipment: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances): Item[]; + generateModsForEquipment(equipment: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances, botRole: string, forceSpawn?: boolean): Item[]; /** * @param sessionId session id * @param weapon Weapon to add mods to @@ -70,15 +74,15 @@ export declare class BotGeneratorHelper { generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponParentId: string, parentWeaponTemplate: ITemplateItem, modSpawnChances: ModsChances, ammoTpl: string, botRole: string): Item[]; /** * - * @param modSlot - * @param isRandomisableSlot - * @param modsParent - * @param botEquipBlacklist - * @param itemModPool + * @param modSlot Slot mod will fit into + * @param isRandomisableSlot Will generate a randomised mod pool if true + * @param modsParent Parent slot the item will be a part of + * @param botEquipBlacklist Blacklist to prevent mods from being picked + * @param itemModPool Pool of items to pick from * @param weapon array with only weapon tpl in it, ready for mods to be added * @param ammoTpl ammo tpl to use if slot requires a cartridge to be added (e.g. mod_magazine) - * @param parentTemplate - * @returns + * @param parentTemplate Parent item the mod will go into + * @returns ITemplateItem */ protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, modsParent: Slot, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem): [boolean, ITemplateItem]; /** @@ -114,8 +118,10 @@ export declare class BotGeneratorHelper { * Find all compatible mods for equipment item and add to modPool * @param itemDetails item to find mods for * @param modPool ModPool to add mods to + * @param equipmentBlacklist equipment not allowed to be used by the bot + * @param botEquipmentRole bot type to generate pool for (e.g. assault, pmcBot, pmc for usec/bear) */ - generateDynamicModPool(itemDetails: ITemplateItem, modPool: Mods): void; + generateDynamicModPool(itemDetails: ITemplateItem, modPool: Mods, equipmentBlacklist: EquipmentFilterDetails[], botEquipmentRole: string): void; /** * Take a list of tpls and filter out blacklisted values using itemFilterService + botEquipmentBlacklist * @param allowedMods base mods to filter @@ -153,7 +159,7 @@ export declare class BotGeneratorHelper { * @param modTemplate Used to add additional properites in the upd object * @returns Item object */ - protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem): Item; + protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem, botRole: string): Item; /** * randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot * never return true for an item that has 0% spawn chance @@ -170,10 +176,10 @@ export declare class BotGeneratorHelper { */ protected getAmmoContainers(): string[]; /** - * Get the slot details for an item (chamber/cartridge/slot) + * Get a Slot property for an item (chamber/cartridge/slot) * @param modSlot e.g patron_in_weapon * @param parentTemplate item template - * @returns + * @returns Slot item */ protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; /** @@ -185,7 +191,6 @@ export declare class BotGeneratorHelper { * @param modPool modPool which should include available cartrigdes * @param parentId The CylinderMagazine's UID * @param parentTemplate The CylinderMagazine's template - * @returns */ protected fillCamora(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem): void; /** @@ -197,11 +202,11 @@ export declare class BotGeneratorHelper { /** * Adds properties to an item * e.g. Repairable / HasHinge / Foldable / MaxDurability - * @param itemTemplate - * @param botRole Used by weapons to randomise the durability values + * @param itemTemplate Item extra properties are being generated for + * @param botRole Used by weapons to randomise the durability values. Null for non-equipped items * @returns Item Upd object with extra properties */ - generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: any): { + generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: string): { upd?: Upd; }; /** @@ -220,21 +225,27 @@ export declare class BotGeneratorHelper { protected generateArmorRepairableProperties(itemTemplate: ITemplateItem, botRole: string): Repairable; /** * Get a random mod from an items compatible mods Filter array - * @param modTpl - * @param parentSlot - * @param modSlot - * @param items + * @param modTpl ???? + * @param parentSlot item mod will go into, used to get combatible items + * @param modSlot Slot to get mod to fill + * @param items items to ensure picked mod is compatible with * @returns item tpl */ protected getModTplFromItemDb(modTpl: string, parentSlot: Slot, modSlot: string, items: Item[]): string; /** * Can an item be added to an item without issue - * @param items - * @param tplToCheck - * @param equipmentSlot - * @returns true if possible + * @param items items to check compatiblilities with + * @param tplToCheck tpl of the item to check for incompatibilities + * @param equipmentSlot Slot the item will be placed into + * @returns false if no incompatibilties */ isItemIncompatibleWithCurrentItems(items: Item[], tplToCheck: string, equipmentSlot: string): boolean; + /** + * Convert a bots role to the equipment role used in config/bot.json + * @param botRole Role to convert + * @returns Equipment role (e.g. pmc / assault / bossTagilla) + */ + getBotEquipmentRole(botRole: string): string; } /** TODO - move into own class */ export declare class ExhaustableArray { diff --git a/TypeScript/11BundleLoadingSample/types/helpers/BotHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/BotHelper.d.ts index 67a6384..a7f779e 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/BotHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/BotHelper.d.ts @@ -3,6 +3,7 @@ import { IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; export declare class BotHelper { @@ -10,46 +11,27 @@ export declare class BotHelper { protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, configServer: ConfigServer); - /** - * Get difficulty settings for desired bot type, if not found use assault bot types - * @param type bot type to retreive difficulty of - * @param difficulty difficulty to get settings for (easy/normal etc) - * @returns Difficulty object - */ - getBotDifficultySettings(type: string, difficulty: string): Difficulty; + constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, localisationService: LocalisationService, configServer: ConfigServer); /** * Get a template object for the specified botRole from bots.types db * @param role botRole to get template for * @returns IBotType object */ getBotTemplate(role: string): IBotType; - /** - * Get difficulty settings for a PMC - * @param type "usec" / "bear" - * @param difficulty what difficulty to retrieve - * @returns Difficulty object - */ - getPmcDifficultySettings(type: string, difficulty: string): Difficulty; - /** - * Translate chosen value from pre-raid difficulty dropdown into bot difficulty value - * @param dropDownDifficulty Dropdown difficulty value to convert - * @returns bot difficulty - */ - convertBotDifficultyDropdownToBotDifficulty(dropDownDifficulty: string): string; - /** - * Choose a random difficulty from - easy/normal/hard/impossible - * @returns random difficulty - */ - chooseRandomDifficulty(): string; /** * Randomise the chance the PMC will attack their own side * Look up value in bot.json/chanceSameSideIsHostilePercent * @param difficultySettings pmc difficulty settings */ randomisePmcHostility(difficultySettings: Difficulty): void; + /** + * Is the passed in bot role a PMC (usec/bear/pmc) + * @param botRole bot role to check + * @returns true if is pmc + */ isBotPmc(botRole: string): boolean; isBotBoss(botRole: string): boolean; isBotFollower(botRole: string): boolean; diff --git a/TypeScript/11BundleLoadingSample/types/helpers/GameEventHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/GameEventHelper.d.ts index fca87be..fa25eff 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/GameEventHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/GameEventHelper.d.ts @@ -15,4 +15,15 @@ export declare class GameEventHelper { * @returns Record with event name + start/end date */ getEventDetails(): ISeasonalEvent[]; + /** + * Is detection of seasonal events enabled (halloween / christmas) + * @returns true if seasonal events should be checked for + */ + isAutomaticEventDetectionEnabled(): boolean; + /** + * Get a dictionary of gear changes to apply to bots for a specific event e.g. Christmas/Halloween + * @param eventName Name of event to get gear changes for + * @returns bots with equipment changes + */ + getEventBotGear(eventName: string): Record>>; } diff --git a/TypeScript/11BundleLoadingSample/types/helpers/HideoutHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/HideoutHelper.d.ts index 5f7e3b7..9d51fed 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/HideoutHelper.d.ts @@ -11,6 +11,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { PlayerService } from "../services/PlayerService"; import { HashUtil } from "../utils/HashUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; @@ -29,13 +30,14 @@ export declare class HideoutHelper { protected profileHelper: ProfileHelper; protected inventoryHelper: InventoryHelper; protected playerService: PlayerService; + protected localisationService: LocalisationService; protected configServer: ConfigServer; static bitcoinFarm: string; static waterCollector: string; static bitcoin: string; static expeditionaryFuelTank: string; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, localisationService: LocalisationService, configServer: ConfigServer); registerProduction(pmcData: IPmcData, body: IHideoutSingleProductionStartRequestData | IHideoutContinousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; /** * This convinience function intialies new Production Object diff --git a/TypeScript/11BundleLoadingSample/types/helpers/InventoryHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/InventoryHelper.d.ts index b8e5c9d..6419f93 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/InventoryHelper.d.ts @@ -5,11 +5,12 @@ import { IInventoryMergeRequestData } from "../models/eft/inventory/IInventoryMe import { IInventoryMoveRequestData } from "../models/eft/inventory/IInventoryMoveRequestData"; import { IInventorySplitRequestData } from "../models/eft/inventory/IInventorySplitRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { IInventoryConfig } from "../models/spt/config/IInventoryConfig"; +import { IInventoryConfig, RewardDetails } from "../models/spt/config/IInventoryConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { JsonUtil } from "../utils/JsonUtil"; @@ -38,9 +39,10 @@ export declare class InventoryHelper { protected itemHelper: ItemHelper; protected containerHelper: ContainerHelper; protected profileHelper: ProfileHelper; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected inventoryConfig: IInventoryConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); addItem(pmcData: IPmcData, body: IAddItemRequestData, output: IItemEventRouterResponse, sessionID: string, callback: any, foundInRaid?: boolean, addUpd?: any): IItemEventRouterResponse; removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; removeItemByCount(pmcData: IPmcData, itemId: string, count: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; @@ -76,6 +78,12 @@ export declare class InventoryHelper { * Internal helper function to handle cartridges in inventory if any of them exist. */ protected handleCartridges(items: Item[], body: IInventoryMoveRequestData): void; + /** + * Get details for how a random loot container should be handled, max rewards, possible reward tpls + * @param itemTpl Container being opened + * @returns Reward details + */ + getRandomLootContainerRewardDetails(itemTpl: string): RewardDetails; } declare namespace InventoryHelper { interface InventoryItemHash { diff --git a/TypeScript/11BundleLoadingSample/types/helpers/ItemHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/ItemHelper.d.ts index 0effaf2..fc88a46 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/ItemHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/ItemHelper.d.ts @@ -5,6 +5,7 @@ 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 { LocaleService } from "../services/LocaleService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; @@ -18,7 +19,8 @@ declare class ItemHelper { protected objectId: ObjectId; protected mathUtil: MathUtil; protected databaseServer: DatabaseServer; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer); + protected localeService: LocaleService; + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, localeService: LocaleService); /** * Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash * @param {string} tpl the template id / tpl @@ -212,6 +214,12 @@ declare class ItemHelper { * @returns size of stack */ getItemStackSize(item: Item): number; + /** + * Get the name of an item from the locale file using the item tpl + * @param itemTpl Tpl of item to get name of + * @returns Name of item + */ + getItemName(itemTpl: string): string; } declare namespace ItemHelper { interface ItemSize { diff --git a/TypeScript/11BundleLoadingSample/types/helpers/QuestHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/QuestHelper.d.ts index a6b4892..edbd2e1 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/QuestHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/QuestHelper.d.ts @@ -50,6 +50,12 @@ export declare class QuestHelper { * @returns true if player level is greater than or equal to quest */ doesPlayerLevelFulfilCondition(playerLevel: number, condition: AvailableForConditions): boolean; + /** + * Get the quests found in both arrays (inner join) + * @param before Array of qeusts #1 + * @param after Array of quests #2 + * @returns Reduction of cartesian product between two quest arrays + */ getDeltaQuests(before: IQuest[], after: IQuest[]): IQuest[]; /** * Increase skill points of a skill on player profile @@ -66,38 +72,85 @@ export declare class QuestHelper { * quest list in question. */ dumpQuests(quests: any): void; - loyaltyRequirementCheck(loyaltyRequirementProperties: AvailableForProps, profile: IPmcData): boolean; - protected processReward(reward: Reward): any[]; + /** + * Check if trader has sufficient loyalty to fullfill quest requirement + * @param questProperties Quest props + * @param profile Player profile + * @returns true if loyalty is high enough to fulfil quest requirement + */ + traderStandingRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; + protected processReward(reward: Reward): Reward[]; + /** + * Gets a flat list of reward items for the given quest at a specific state (e.g. Fail/Success) + * @param quest quest to get rewards for + * @param state Quest status that holds the items (Started, Success, Fail) + * @returns array of items with the correct maxStack + */ getQuestRewardItems(quest: IQuest, state: QuestStatus): Reward[]; /** - * Add quest with new state value to pmc profile + * Update player profile with quest status (e.g. Fail/Success) * @param pmcData profile to add quest to * @param newState state the new quest should be in when added * @param acceptedQuest Details of quest being added */ addQuestToPMCData(pmcData: IPmcData, newState: QuestStatus, acceptedQuest: IAcceptQuestRequestData): void; - acceptedUnlocked(acceptedQuestId: string, sessionID: string): IQuest[]; - failedUnlocked(failedQuestId: string, sessionID: string): IQuest[]; - applyMoneyBoost(quest: IQuest, moneyBoost: number): IQuest; - changeItemStack(pmcData: IPmcData, id: string, value: number, sessionID: string, output: any): void; /** - * Get List of All Quests as an array + * TODO: what is going on here + * @param acceptedQuestId Quest to add to profile + * @param sessionID Session id + * @returns Array of quests in profile + quest passed in as param + */ + acceptedUnlocked(acceptedQuestId: string, sessionID: string): IQuest[]; + /** + * TODO: what is going on here + * @param failedQuestId + * @param sessionID Session id + * @returns + */ + failedUnlocked(failedQuestId: string, sessionID: string): IQuest[]; + /** + * Adjust quest money rewards by passed in multipler + * @param quest Quest to multiple money rewards + * @param multipler Value to adjust money rewards by + * @returns Updated quest + */ + applyMoneyBoost(quest: IQuest, multipler: number): IQuest; + /** + * Sets the item stack to new value, or delete the item if value <= 0 + * // TODO maybe merge this function and the one from customization + * @param pmcData Profile + * @param itemId id of item to adjust stack size of + * @param newStackSize Stack size to adjust to + * @param sessionID Session id + * @param output ItemEvent router response + */ + changeItemStack(pmcData: IPmcData, itemId: string, newStackSize: number, sessionID: string, output: IItemEventRouterResponse): void; + /** + * Get List of All Quests from db + * NOT CLONED * @returns Array of IQuest objects */ - questValues(): IQuest[]; + getQuestsFromDb(): IQuest[]; /** - * Reest AvailableForStart conditions for quests - * @param quests queststo clean + * Get quests, strip all requirement conditions except level + * @param quests quests to process * @returns quest array without conditions */ - protected cleanQuestList(quests: IQuest[]): IQuest[]; + protected getQuestsWithOnlyLevelRequirementStartCondition(quests: IQuest[]): IQuest[]; /** - * Reset AvailableForStart conditions on a quest + * Remove all quest conditions except for level requirement * @param quest quest to clean * @returns reset IQuest object */ - cleanQuestConditions(quest: IQuest): IQuest; - failQuest(pmcData: IPmcData, body: any, sessionID: string): any; + getQuestWithOnlyLevelRequirementStartCondition(quest: IQuest): IQuest; + /** + * Fail a quest in a player profile + * @param pmcData Profile + * @param failRequest fail quest request data + * @param sessionID Session id + * @returns Item event router response + */ + failQuest(pmcData: IPmcData, failRequest: any, sessionID: string): IItemEventRouterResponse; /** * Get quest by id from database * @param questId questid to look for @@ -105,7 +158,12 @@ export declare class QuestHelper { * @returns IQuest object */ getQuestFromDb(questId: string, pmcData: IPmcData): IQuest; - getQuestLocaleIdFromDb(messageId: string): string; + /** + * Get the locale Id from locale db for a quest message + * @param questMessageId Quest mesage id to look up + * @returns Locale Id from locale db + */ + getQuestLocaleIdFromDb(questMessageId: string): string; /** * Alter a quests state + Add a record to tis status timers object * @param pmcData Profile to update @@ -128,5 +186,10 @@ export declare class QuestHelper { * @returns bonus in percent */ protected getIntelCenterRewardBonus(pmcData: IPmcData): number; - getFindItemIdForQuestItem(itemTpl: string): string; + /** + * Find quest with 'findItem' requirement that needs the item tpl be handed in + * @param itemTpl item tpl to look for + * @returns 'FindItem' condition id + */ + getFindItemIdForQuestHandIn(itemTpl: string): string; } diff --git a/TypeScript/11BundleLoadingSample/types/helpers/RagfairServerHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/RagfairServerHelper.d.ts index a03cdda..ec388d8 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/RagfairServerHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/RagfairServerHelper.d.ts @@ -44,10 +44,20 @@ export declare class RagfairServerHelper { isPlayer(userID: string): boolean; returnItems(sessionID: string, items: any[]): void; calculateDynamicStackCount(tplId: string, isWeaponPreset: boolean): number; + /** + * Choose a currency at random with bias + * @returns currency tpl + */ getDynamicOfferCurrency(): string; getMemberType(userID: string): MemberCategory; getNickname(userID: string): string; getPresetItems(item: any): Item[]; getPresetItemsByTpl(item: Item): Item[]; + /** + * Generate new unique ids for the children while preserving hierarchy + * @param item base item + * @param preset + * @returns Item array with new IDs + */ reparentPresets(item: Item, preset: Item[]): Item[]; } diff --git a/TypeScript/11BundleLoadingSample/types/helpers/RagfairSortHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/RagfairSortHelper.d.ts index 28d1d38..4669ce6 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/RagfairSortHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/RagfairSortHelper.d.ts @@ -18,7 +18,7 @@ export declare class RagfairSortHelper { protected sortOffersByRating(a: IRagfairOffer, b: IRagfairOffer): number; protected sortOffersByName(a: IRagfairOffer, b: IRagfairOffer): number; /** - * Order two offers by price value + * Order two offers by rouble price value * @param a Offer a * @param b Offer b * @returns diff --git a/TypeScript/11BundleLoadingSample/types/loaders/PreAkiModLoader.d.ts b/TypeScript/11BundleLoadingSample/types/loaders/PreAkiModLoader.d.ts index 7a687a5..f486a28 100644 --- a/TypeScript/11BundleLoadingSample/types/loaders/PreAkiModLoader.d.ts +++ b/TypeScript/11BundleLoadingSample/types/loaders/PreAkiModLoader.d.ts @@ -1,29 +1,31 @@ import { DependencyContainer } from "tsyringe"; +import { IPostAkiLoadMod } from "../models/external/IPostAkiLoadMod"; +import { IPostDBLoadMod } from "../models/external/IPostDBLoadMod"; +import { IPreAkiLoadMod } from "../models/external/IPreAkiLoadMod"; import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { ModLoader } from "../models/spt/mod/IMod"; import { IModLoader } from "../models/spt/mod/IModLoader"; import { IPackageJsonData } from "../models/spt/mod/IPackageJsonData"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { LocalisationService } from "../services/LocalisationService"; import { ModCompilerService } from "../services/ModCompilerService"; import { JsonUtil } from "../utils/JsonUtil"; import { VFS } from "../utils/VFS"; import { BundleLoader } from "./BundleLoader"; -import { IPostAkiLoadMod } from "../models/external/IPostAkiLoadMod"; -import { IPreAkiLoadMod } from "../models/external/IPreAkiLoadMod"; -import { IPostDBLoadMod } from "../models/external/IPostDBLoadMod"; export declare class PreAkiModLoader implements IModLoader { protected logger: ILogger; protected vfs: VFS; protected jsonUtil: JsonUtil; protected modCompilerService: ModCompilerService; protected bundleLoader: BundleLoader; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected static container: DependencyContainer; protected readonly basepath = "user/mods/"; protected imported: Record; protected akiConfig: ICoreConfig; - constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, modCompilerService: ModCompilerService, bundleLoader: BundleLoader, configServer: ConfigServer); + constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, modCompilerService: ModCompilerService, bundleLoader: BundleLoader, localisationService: LocalisationService, configServer: ConfigServer); load(container: DependencyContainer): Promise; getBundles(local: boolean): string; getBundle(key: string, local: boolean): void; diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/bot/IGenerateBotsRequestData.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/bot/IGenerateBotsRequestData.d.ts index c49cef7..f1f7013 100644 --- a/TypeScript/11BundleLoadingSample/types/models/eft/bot/IGenerateBotsRequestData.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/eft/bot/IGenerateBotsRequestData.d.ts @@ -2,6 +2,7 @@ export interface IGenerateBotsRequestData { conditions: Condition[]; } export interface Condition { + /** e.g. assault/pmcBot/bossKilla */ Role: string; Limit: number; Difficulty: string; diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/common/IGlobals.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/common/IGlobals.d.ts index 81e2023..b53f106 100644 --- a/TypeScript/11BundleLoadingSample/types/models/eft/common/IGlobals.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/eft/common/IGlobals.d.ts @@ -591,6 +591,7 @@ export interface HealPrice { export interface ProfileHealthSettings { BodyPartsSettings: BodyPartsSettings; HealthFactorsSettings: HealthFactorsSettings; + DefaultStimulatorBuff: string; } export interface BodyPartsSettings { Head: BodyPartsSetting; diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/IBotBase.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/IBotBase.d.ts index 1c28ae0..2b418c1 100644 --- a/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/IBotBase.d.ts @@ -107,6 +107,7 @@ export interface CurrentMax { Maximum: number; } export interface Inventory { + discardLimits: Record; items: Item[]; equipment: string; stash: string; diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/IBotType.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/IBotType.d.ts index c1fe579..55b4bd9 100644 --- a/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/IBotType.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/IBotType.d.ts @@ -13,8 +13,8 @@ export interface IBotType { skills: Skills; } export interface Appearance { - body: string[]; - feet: string[]; + body: Record; + feet: Record; hands: string[]; head: string[]; voice: string[]; diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/ITemplateItem.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/ITemplateItem.d.ts index 8569e61..0fa7e18 100644 --- a/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/eft/common/tables/ITemplateItem.d.ts @@ -254,7 +254,7 @@ export interface Props { foodUseTime?: number; foodEffectType?: string; StimulatorBuffs?: string; - effects_health?: any; + effects_health?: IHealthEffect[] | Record>; effects_damage?: any; MaximumNumberOfUsage?: number; knifeHitDelay?: number; @@ -366,6 +366,10 @@ export interface Props { MinTimeToContactExplode?: number; ExplosionEffectType?: string; } +export interface IHealthEffect { + type: string; + value: number; +} export interface Prefab { path: string; rcid: string; diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/customization/IGetSuitsResponse.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/customization/IGetSuitsResponse.d.ts new file mode 100644 index 0000000..fe6888c --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/models/eft/customization/IGetSuitsResponse.d.ts @@ -0,0 +1,4 @@ +export interface IGetSuitsResponse { + _id: string; + suits: string[]; +} diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/game/IGameKeepAliveResponse.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/game/IGameKeepAliveResponse.d.ts new file mode 100644 index 0000000..170ce6a --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/models/eft/game/IGameKeepAliveResponse.d.ts @@ -0,0 +1,4 @@ +export interface IGameKeepAliveResponse { + msg: string; + utc_time: number; +} diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/game/IGameLogoutResponseData.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/game/IGameLogoutResponseData.d.ts new file mode 100644 index 0000000..0f52050 --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/models/eft/game/IGameLogoutResponseData.d.ts @@ -0,0 +1,3 @@ +export interface IGameLogoutResponseData { + status: string; +} diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/game/IGameStartResponse.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/game/IGameStartResponse.d.ts new file mode 100644 index 0000000..9f0ab6d --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/models/eft/game/IGameStartResponse.d.ts @@ -0,0 +1,3 @@ +export interface IGameStartResponse { + utc_time: number; +} diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts new file mode 100644 index 0000000..3c45124 --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts @@ -0,0 +1,11 @@ +import { IInventoryBaseActionRequestData } from "./IInventoryBaseActionRequestData"; +export interface IOpenRandomLootContainerRequestData extends IInventoryBaseActionRequestData { + Action: "OpenRandomLootContainer"; + /** Container item opened */ + item: string; + to: To[]; +} +export interface To { + /** Player character (pmc/scav) id items will be sent to */ + id: string; +} diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/itemEvent/IItemEventRouterBase.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/itemEvent/IItemEventRouterBase.d.ts index 4841cfd..60ab284 100644 --- a/TypeScript/11BundleLoadingSample/types/models/eft/itemEvent/IItemEventRouterBase.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/eft/itemEvent/IItemEventRouterBase.d.ts @@ -10,8 +10,9 @@ export interface IItemEventRouterBase { export declare type TProfileChanges = Record; export interface Warning { index: number; - err: string; errmsg: string; + code?: string; + data?: any; } export interface ProfileChange { _id: string; diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/match/IStartOffineRaidRequestData.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/match/IStartOffineRaidRequestData.d.ts index af0625e..1983728 100644 --- a/TypeScript/11BundleLoadingSample/types/models/eft/match/IStartOffineRaidRequestData.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/eft/match/IStartOffineRaidRequestData.d.ts @@ -2,8 +2,10 @@ import { BotAmount } from "../../enums/BotAmount"; import { BotDifficulty } from "../../enums/BotDifficulty"; export interface IStartOfflineRaidRequestData { locationName: string; + /** Current time, not in-game time */ startTime: number; - dateTime: string; + /** CURR = am, past = pm */ + dateTime: "CURR" | "PAST"; gameSettings: GameSettings; } export interface GameSettings { diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/notifier/ISelectProfileResponse.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/notifier/ISelectProfileResponse.d.ts new file mode 100644 index 0000000..ecb668a --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/models/eft/notifier/ISelectProfileResponse.d.ts @@ -0,0 +1,6 @@ +import { INotifierChannel } from "./INotifier"; +export interface ISelectProfileResponse { + status: string; + notifier: INotifierChannel; + notifierServer: string; +} diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/ragfair/IRagfairOffer.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/ragfair/IRagfairOffer.d.ts index 3251a37..792ec7d 100644 --- a/TypeScript/11BundleLoadingSample/types/models/eft/ragfair/IRagfairOffer.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/eft/ragfair/IRagfairOffer.d.ts @@ -7,19 +7,19 @@ export interface IRagfairOffer { requirements: OfferRequirement[]; root: string; intId: number; + /** Handbook price */ itemsCost: number; + /** Rouble price */ requirementsCost: number; - sptRequirementsCostRouble: number; startTime: number; endTime: number; sellInOnePiece: boolean; - name?: string; - shortName?: string; loyaltyLevel: number; buyRestrictionMax?: number; buyRestrictionCurrent?: number; locked: boolean; unlimitedCount: boolean; + /** Rouble price */ summaryCost: number; user: IRagfairOfferUser; notAvailable: boolean; @@ -33,11 +33,11 @@ export interface OfferRequirement { } export interface IRagfairOfferUser { id: string; - nickname: string; - rating: number; + nickname?: string; + rating?: number; memberType: MemberCategory; - avatar: string; - isRatingGrowing: boolean; + avatar?: string; + isRatingGrowing?: boolean; } export interface SellResult { sellTime: number; diff --git a/TypeScript/11BundleLoadingSample/types/models/eft/weather/IWeatherData.d.ts b/TypeScript/11BundleLoadingSample/types/models/eft/weather/IWeatherData.d.ts index ecc96ce..1f5d5b5 100644 --- a/TypeScript/11BundleLoadingSample/types/models/eft/weather/IWeatherData.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/eft/weather/IWeatherData.d.ts @@ -1,17 +1,18 @@ +import { WindDirection } from "../../../models/enums/WindDirection"; export interface IWeatherData { acceleration: number; time: string; date: string; - weather: IWeather; + weather?: IWeather; } export interface IWeather { pressure: number; temp: number; - fog: string; + fog: number; rain_intensity: number; - rain: any; + rain: number; wind_gustiness: number; - wind_direction: any; + wind_direction: WindDirection; wind_speed: number; cloud: number; time: string; diff --git a/TypeScript/11BundleLoadingSample/types/models/enums/BackendErrorCodes.d.ts b/TypeScript/11BundleLoadingSample/types/models/enums/BackendErrorCodes.d.ts new file mode 100644 index 0000000..6614b75 --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/models/enums/BackendErrorCodes.d.ts @@ -0,0 +1,67 @@ +export declare enum BackendErrorCodes { + NONE = 0, + UNKNOWN_ERROR = 200, + NOT_AUTHORIZED = 201, + NEED_AUTHORIZATION_CODE = 209, + WRONG_AUTHORIZATION_CODE = 211, + NEED_CAPTCHA = 214, + NO_NEED_CAPTCHA = 215, + CAPTCHA_FAILED = 218, + CAPTCHA_BRUTE_FORCED = 219, + NO_ROOM_IN_STASH = 223, + NICKNAME_NOT_UNIQUE = 225, + NICKNAME_NOT_VALID = 226, + UNSUPPORTED_CLIENT_VERSION = 232, + REPORT_NOT_ALLOWED = 238, + NICKNAME_IS_ABUSIVE = 241, + NICKNAME_CHANGE_TIMEOUT = 242, + NOT_MODIFIED = 304, + HTTP_BAD_REQUEST = 400, + HTTP_NOT_AUTHORIZED = 401, + HTTP_FORBIDDEN = 403, + HTTP_NOT_FOUND = 404, + HTTP_METHOD_NOT_ALLOWED = 405, + UNKNOWN_TRADING_ERROR = 500, + HTTPNOTIMPLEMENTED = 501, + HTTPBADGATEWAY = 502, + HTTPSERVICEUNAVAILABLE = 503, + HTTPGATEWAYTIMEOUT = 504, + TRADEROUTOFMONEY = 505, + HTTPVARIANTALSONEGOTIATES = 506, + PRICECHANGED = 509, + TRADERDISABLED = 512, + ITEMHASBEENSOLD = 513, + NOTENOUGHSPACEFORMONEY = 518, + HTTPINVALIDSSLCERTIFICATE = 526, + UNKNOWNRAGFAIRERROR = 550, + UNKNOWNRAGFAIRERROR2 = 551, + UNKNOWNMATCHMAKERERROR = 600, + SESSIONPARAMETERSERROR = 601, + SESSIONLOST = 602, + SERVERNOTREGISTERED = 604, + UNKNOWNQUESTERROR = 700, + QUESTBADPARAM = 702, + QUESTNOTFOUND = 703, + QUESTISUNAVAILABLE = 704, + NOFREESPACEFORREWARDS = 705, + WRONGQUESTSTATUS = 706, + CANTCOMPLETEQUEST = 707, + UNKNOWNMAILERROR = 900, + TOOMANYFRIENDREQUESTS = 925, + UNKNOWNSCRIPTEXECUTIONERROR = 1000, + UNKNOWNREPAIRINGERROR = 1200, + UNKNOWNINSURANCEERROR = 1300, + UNKNOWNCURRENCYEXCHANGEERROR = 1400, + OFFERNOTFOUND = 1503, + NOTENOUGHSPACE = 1505, + OFFEROUTOFSTOCK = 1506, + OFFERSOLD = 1507, + RAGFAIRUNAVAILABLE = 1511, + BANNEDERRORCODE = 1513, + INSUFFICIENTNUMBERINSTOCK = 1516, + TOOMANYITEMSTOSELL = 1517, + EXAMINATIONFAILED = 22001, + ITEMALREADYEXAMINED = 22002, + UNKNOWNNGINXERROR = 9000, + PARSERESPONSEERROR = 9001 +} diff --git a/TypeScript/11BundleLoadingSample/types/models/enums/HideoutEventActions.d.ts b/TypeScript/11BundleLoadingSample/types/models/enums/HideoutEventActions.d.ts new file mode 100644 index 0000000..e441477 --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/models/enums/HideoutEventActions.d.ts @@ -0,0 +1,11 @@ +export declare enum HideoutEventActions { + HIDEOUT_UPGRADE = "HideoutUpgrade", + HIDEOUT_UPGRADE_COMPLETE = "HideoutUpgradeComplete", + HIDEOUT_PUT_ITEMS_IN_AREA_SLOTS = "HideoutPutItemsInAreaSlots", + HIDEOUT_TAKE_ITEMS_FROM_AREA_SLOTS = "HideoutTakeItemsFromAreaSlots", + HIDEOUT_TOGGLE_AREA = "HideoutToggleArea", + HIDEOUT_SINGLE_PRODUCTION_START = "HideoutSingleProductionStart", + HIDEOUT_SCAV_CASE_PRODUCTION_START = "HideoutScavCaseProductionStart", + HIDEOUT_CONTINUOUS_PRODUCTION_START = "HideoutContinuousProductionStart", + HIDEOUT_TAKE_PRODUCTION = "HideoutTakeProduction" +} diff --git a/TypeScript/11BundleLoadingSample/types/models/enums/ItemEventActions.d.ts b/TypeScript/11BundleLoadingSample/types/models/enums/ItemEventActions.d.ts new file mode 100644 index 0000000..0e65453 --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/models/enums/ItemEventActions.d.ts @@ -0,0 +1,19 @@ +export declare enum ItemEventActions { + MOVE = "Move", + REMOVE = "Remove", + SPLIT = "Split", + MERGE = "Merge", + TRANSFER = "Transfer", + SWAP = "Swap", + FOLD = "Fold", + TOGGLE = "Toggle", + TAG = "Tag", + BIND = "Bind", + EXAMINE = "Examine", + READ_ENCYCLOPEDIA = "ReadEncyclopedia", + APPLY_INVENTORY_CHANGES = "ApplyInventoryChanges", + CREATE_MAP_MARKER = "CreateMapMarker", + DELETE_MAP_MARKER = "DeleteMapMarker", + EDIT_MAP_MARKER = "EditMapMarker", + OPEN_RANDOM_LOOT_CONTAINER = "OpenRandomLootContainer" +} diff --git a/TypeScript/11BundleLoadingSample/types/models/enums/WeatherType.d.ts b/TypeScript/11BundleLoadingSample/types/models/enums/WeatherType.d.ts new file mode 100644 index 0000000..d31fefe --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/models/enums/WeatherType.d.ts @@ -0,0 +1,19 @@ +export declare enum WeatherType { + CLEAR_DAY = 1, + CLEAR_WIND = 2, + CLEAR_NIGHT = 3, + PARTLY_CLOUD_DAY = 4, + PARTLY_CLOUD_NIGHT = 5, + CLEAR_FOG_DAY = 6, + CLEAR_FOG_NIGHT = 7, + CLOUDFOG = 8, + FOG = 9, + MOSTLY_CLOUD = 10, + LIGHT_RAIN = 11, + RAIN = 12, + CLOUD_WIND = 13, + CLOUD_WIND_RAIN = 14, + FULL_CLOUD = 15, + THUNDER_CLOUD = 16, + NONE = 0 +} diff --git a/TypeScript/11BundleLoadingSample/types/models/enums/WildSpawnTypeNumber.d.ts b/TypeScript/11BundleLoadingSample/types/models/enums/WildSpawnTypeNumber.d.ts new file mode 100644 index 0000000..ff806fe --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/models/enums/WildSpawnTypeNumber.d.ts @@ -0,0 +1,33 @@ +export declare enum WildSpawnTypeNumber { + ASSAULT = 1, + MARKSMAN = 2, + BOSSTEST = 4, + BOSSBULLY = 8, + FOLLOWERTEST = 16, + FOLLOWERBULLY = 32, + BOSSKILLA = 64, + BOSSKOJANIY = 128, + FOLLOWERKOJANIY = 256, + PMCBOT = 512, + CURSEDASSAULT = 1024, + BOSSGLUHAR = 2048, + FOLLOWERGLUHARASSAULT = 4096, + FOLLOWERGLUHARSECURITY = 8192, + FOLLOWERGLUHARSCOUT = 16384, + FOLLOWERGLUHARSNIPE = 32768, + FOLLOWERSANITAR = 65536, + BOSSSANITAR = 131072, + TEST = 262144, + ASSAULTGROUP = 524288, + SECTANTWARRIOR = 1048576, + SECTANTPRIEST = 2097152, + BOSSTAGILLA = 4194304, + FOLLOWERTAGILLA = 8388608, + EXUSEC = 16777216, + GIFTER = 33554432, + BOSSKNIGHT = 67108864, + FOLLOWERBIGPIPE = 134217728, + FOLLOWERBIRDEYE = 268435456, + SPTUSEC = 536870912, + SPTBEAR = 1073741824 +} diff --git a/TypeScript/11BundleLoadingSample/types/models/enums/WindDirection.d.ts b/TypeScript/11BundleLoadingSample/types/models/enums/WindDirection.d.ts new file mode 100644 index 0000000..fb30b20 --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/models/enums/WindDirection.d.ts @@ -0,0 +1,10 @@ +export declare enum WindDirection { + EAST = 1, + NORTH = 2, + WEST = 3, + SOUTH = 4, + SE = 5, + SW = 6, + NW = 7, + NE = 8 +} diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/config/IBotConfig.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/config/IBotConfig.d.ts index af8ceba..d6fa5e0 100644 --- a/TypeScript/11BundleLoadingSample/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/spt/config/IBotConfig.d.ts @@ -27,6 +27,8 @@ export interface IBotConfig extends IBaseConfig { maxBotCap: Record; /** How many stacks of secret ammo should a bot have in its bot secure container */ secureContainerAmmoStackCount: number; + /** Batch generation size when type not available in cache */ + botGenerationBatchSizePerType: number; } export interface PresetBatch { assault: number; @@ -66,8 +68,12 @@ export interface EquipmentFilters { weaponModLimits: ModLimits; randomisedWeaponModSlots?: string[]; randomisedArmorSlots?: string[]; + faceShieldIsActiveChancePercent?: number; + lightLaserIsActiveChancePercent?: number; blacklist: EquipmentFilterDetails[]; whitelist: EquipmentFilterDetails[]; + clothing: WeightingAdjustmentDetails[]; + weightingAdjustments: WeightingAdjustmentDetails[]; } export interface ModLimits { /** How many scopes are allowed on a weapon - hard coded to work with OPTIC_SCOPE, ASSAULT_SCOPE, COLLIMATOR, COMPACT_COLLIMATOR */ @@ -80,3 +86,8 @@ export interface EquipmentFilterDetails { equipment: Record; cartridge: Record; } +export interface WeightingAdjustmentDetails { + levelRange: MinMax; + add: Record>; + edit: Record>; +} diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/config/IInventoryConfig.d.ts index ffffa41..4642b9b 100644 --- a/TypeScript/11BundleLoadingSample/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/spt/config/IInventoryConfig.d.ts @@ -2,4 +2,10 @@ import { IBaseConfig } from "./IBaseConfig"; export interface IInventoryConfig extends IBaseConfig { kind: "aki-inventory"; newItemsMarkedFound: boolean; + randomLootContainers: Record; +} +export interface RewardDetails { + rewardCount: number; + foundInRaid: boolean; + rewardTplPool: Record; } diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/config/ILocaleConfig.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/config/ILocaleConfig.d.ts index fe9abf7..0a8955c 100644 --- a/TypeScript/11BundleLoadingSample/types/models/spt/config/ILocaleConfig.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/spt/config/ILocaleConfig.d.ts @@ -1,5 +1,10 @@ import { IBaseConfig } from "./IBaseConfig"; export interface ILocaleConfig extends IBaseConfig { kind: "aki-locale"; - desiredLocale: string; + /** e.g. ru/en/cn/fr etc, or 'system', will take computer locale setting */ + gameLocale: string; + /** e.g. ru/en/cn/fr etc, or 'system', will take computer locale setting */ + serverLocale: string; + /** Languages server can be translated into */ + serverSupportedLocales: string[]; } diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/config/IPmcConfig.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/config/IPmcConfig.d.ts index 9db2ba1..48601b2 100644 --- a/TypeScript/11BundleLoadingSample/types/models/spt/config/IPmcConfig.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/spt/config/IPmcConfig.d.ts @@ -6,9 +6,11 @@ export interface IPmcConfig { looseWeaponInBackpackChancePercent: number; looseWeaponInBackpackLootMinMax: MinMax; isUsec: number; + usecType: string; + bearType: string; chanceSameSideIsHostilePercent: number; /** key: location, value: type for usec/bear */ - pmcType: Record; + pmcType: Record>>; maxBackpackLootTotalRub: number; maxPocketLootTotalRub: number; maxVestLootTotalRub: number; diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/config/IRagfairConfig.d.ts index c1b8763..6786417 100644 --- a/TypeScript/11BundleLoadingSample/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/spt/config/IRagfairConfig.d.ts @@ -28,12 +28,8 @@ export interface Reputation { gain: number; loss: number; } -export declare class OfferAdjustment { - maxPriceDifferenceBelowHandbookPercent: number; - handbookPriceMultipier: number; - priceThreshholdRub: number; -} export interface Dynamic { + barter: Barter; offerAdjustment: OfferAdjustment; expiredOfferThreshold: number; offerItemCount: MinMax; @@ -49,6 +45,20 @@ export interface Dynamic { showAsSingleStack: string[]; blacklist: Blacklist; } +export declare class Barter { + enable: boolean; + chancePercent: number; + itemCountMin: number; + itemCountMax: number; + priceRangeVariancePercent: number; + minRoubleCostToBecomeBarter: number; + itemTypeBlacklist: string[]; +} +export declare class OfferAdjustment { + maxPriceDifferenceBelowHandbookPercent: number; + handbookPriceMultipier: number; + priceThreshholdRub: number; +} export interface Condition { conditionChance: number; min: number; diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/config/ISeasonalEventConfig.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/config/ISeasonalEventConfig.d.ts index bc60618..e410925 100644 --- a/TypeScript/11BundleLoadingSample/types/models/spt/config/ISeasonalEventConfig.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/spt/config/ISeasonalEventConfig.d.ts @@ -1,6 +1,9 @@ import { IBaseConfig } from "./IBaseConfig"; export interface ISeasonalEventConfig extends IBaseConfig { kind: "aki-seasonalevents"; + enableSeasonalEventDetection: boolean; + /** event / botType / equipSlot / itemid */ + eventGear: Record>>>; events: ISeasonalEvent[]; } export interface ISeasonalEvent { diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/config/IWeatherConfig.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/config/IWeatherConfig.d.ts index bbdc43e..41a1c83 100644 --- a/TypeScript/11BundleLoadingSample/types/models/spt/config/IWeatherConfig.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/spt/config/IWeatherConfig.d.ts @@ -1,3 +1,4 @@ +import { WindDirection } from "../../../models/enums/WindDirection"; import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface IWeatherConfig extends IBaseConfig { @@ -7,12 +8,16 @@ export interface IWeatherConfig extends IBaseConfig { } export interface Weather { clouds: MinMax; - windSpeed: MinMax; - windDirection: MinMax; + windSpeed: WeatherSettings; + windDirection: WeatherSettings; windGustiness: MinMax; - rain: MinMax; + rain: WeatherSettings; rainIntensity: MinMax; - fog: MinMax; + fog: WeatherSettings; temp: MinMax; pressure: MinMax; } +export interface WeatherSettings { + values: T[]; + weights: number[]; +} diff --git a/TypeScript/11BundleLoadingSample/types/routers/item_events/HideoutItemEventRouter.d.ts b/TypeScript/11BundleLoadingSample/types/routers/item_events/HideoutItemEventRouter.d.ts index e1e98af..44bd1cd 100644 --- a/TypeScript/11BundleLoadingSample/types/routers/item_events/HideoutItemEventRouter.d.ts +++ b/TypeScript/11BundleLoadingSample/types/routers/item_events/HideoutItemEventRouter.d.ts @@ -1,7 +1,7 @@ -import { IPmcData } from "../../models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "../../models/eft/itemEvent/IItemEventRouterResponse"; import { HideoutCallbacks } from "../../callbacks/HideoutCallbacks"; import { HandledRoute, ItemEventRouterDefinition } from "../../di/Router"; +import { IPmcData } from "../../models/eft/common/IPmcData"; +import { IItemEventRouterResponse } from "../../models/eft/itemEvent/IItemEventRouterResponse"; export declare class HideoutItemEventRouter extends ItemEventRouterDefinition { protected hideoutCallbacks: HideoutCallbacks; constructor(hideoutCallbacks: HideoutCallbacks); diff --git a/TypeScript/11BundleLoadingSample/types/routers/item_events/InventoryItemEventRouter.d.ts b/TypeScript/11BundleLoadingSample/types/routers/item_events/InventoryItemEventRouter.d.ts index 2619bb9..953d322 100644 --- a/TypeScript/11BundleLoadingSample/types/routers/item_events/InventoryItemEventRouter.d.ts +++ b/TypeScript/11BundleLoadingSample/types/routers/item_events/InventoryItemEventRouter.d.ts @@ -1,7 +1,7 @@ -import { IPmcData } from "../../models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "../../models/eft/itemEvent/IItemEventRouterResponse"; import { InventoryCallbacks } from "../../callbacks/InventoryCallbacks"; import { HandledRoute, ItemEventRouterDefinition } from "../../di/Router"; +import { IPmcData } from "../../models/eft/common/IPmcData"; +import { IItemEventRouterResponse } from "../../models/eft/itemEvent/IItemEventRouterResponse"; export declare class InventoryItemEventRouter extends ItemEventRouterDefinition { protected inventoryCallbacks: InventoryCallbacks; constructor(inventoryCallbacks: InventoryCallbacks); diff --git a/TypeScript/11BundleLoadingSample/types/servers/HttpServer.d.ts b/TypeScript/11BundleLoadingSample/types/servers/HttpServer.d.ts index bbca8af..80c1d48 100644 --- a/TypeScript/11BundleLoadingSample/types/servers/HttpServer.d.ts +++ b/TypeScript/11BundleLoadingSample/types/servers/HttpServer.d.ts @@ -4,6 +4,7 @@ import { ApplicationContext } from "../context/ApplicationContext"; import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; import { ILogger } from "../models/spt/utils/ILogger"; +import { LocalisationService } from "../services/LocalisationService"; import { ConfigServer } from "./ConfigServer"; import { DatabaseServer } from "./DatabaseServer"; import { IHttpListener } from "./http/IHttpListener"; @@ -12,11 +13,12 @@ export declare class HttpServer { protected logger: ILogger; protected databaseServer: DatabaseServer; protected httpServerHelper: HttpServerHelper; + protected localisationService: LocalisationService; protected httpListeners: IHttpListener[]; protected configServer: ConfigServer; protected applicationContext: ApplicationContext; protected webSocketServer: WebSocketServer; - constructor(logger: ILogger, databaseServer: DatabaseServer, httpServerHelper: HttpServerHelper, httpListeners: IHttpListener[], configServer: ConfigServer, applicationContext: ApplicationContext, webSocketServer: WebSocketServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, httpServerHelper: HttpServerHelper, localisationService: LocalisationService, httpListeners: IHttpListener[], configServer: ConfigServer, applicationContext: ApplicationContext, webSocketServer: WebSocketServer); protected httpConfig: IHttpConfig; getCookies(req: http.IncomingMessage): any; handleRequest(req: IncomingMessage, resp: ServerResponse): void; diff --git a/TypeScript/11BundleLoadingSample/types/servers/SaveServer.d.ts b/TypeScript/11BundleLoadingSample/types/servers/SaveServer.d.ts index cb28f49..4dca514 100644 --- a/TypeScript/11BundleLoadingSample/types/servers/SaveServer.d.ts +++ b/TypeScript/11BundleLoadingSample/types/servers/SaveServer.d.ts @@ -1,20 +1,22 @@ +import { SaveLoadRouter } from "../di/Router"; import { IAkiProfile, Info } from "../models/eft/profile/IAkiProfile"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { VFS } from "../utils/VFS"; -import { SaveLoadRouter } from "../di/Router"; -import { ILogger } from "../models/spt/utils/ILogger"; export declare class SaveServer { protected vfs: VFS; protected saveLoadRouters: SaveLoadRouter[]; protected jsonUtil: JsonUtil; protected hashUtil: HashUtil; + protected localisationService: LocalisationService; protected logger: ILogger; protected profileFilepath: string; protected profiles: {}; protected onSave: {}; protected saveMd5: {}; - constructor(vfs: VFS, saveLoadRouters: SaveLoadRouter[], jsonUtil: JsonUtil, hashUtil: HashUtil, logger: ILogger); + constructor(vfs: VFS, saveLoadRouters: SaveLoadRouter[], jsonUtil: JsonUtil, hashUtil: HashUtil, localisationService: LocalisationService, logger: ILogger); load(): void; save(): void; getProfile(sessionId: string): IAkiProfile; diff --git a/TypeScript/11BundleLoadingSample/types/servers/WebSocketServer.d.ts b/TypeScript/11BundleLoadingSample/types/servers/WebSocketServer.d.ts index f33d214..5d40e6e 100644 --- a/TypeScript/11BundleLoadingSample/types/servers/WebSocketServer.d.ts +++ b/TypeScript/11BundleLoadingSample/types/servers/WebSocketServer.d.ts @@ -1,18 +1,20 @@ /// -import { HttpServerHelper } from "../helpers/HttpServerHelper"; -import WebSocket from "ws"; import http, { IncomingMessage } from "http"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { RandomUtil } from "../utils/RandomUtil"; +import WebSocket from "ws"; +import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { INotification } from "../models/eft/notifier/INotifier"; -import { ConfigServer } from "./ConfigServer"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { LocalisationService } from "../services/LocalisationService"; +import { RandomUtil } from "../utils/RandomUtil"; +import { ConfigServer } from "./ConfigServer"; export declare class WebSocketServer { protected logger: ILogger; protected randomUtil: RandomUtil; protected configServer: ConfigServer; + protected localisationService: LocalisationService; protected httpServerHelper: HttpServerHelper; - constructor(logger: ILogger, randomUtil: RandomUtil, configServer: ConfigServer, httpServerHelper: HttpServerHelper); + constructor(logger: ILogger, randomUtil: RandomUtil, configServer: ConfigServer, localisationService: LocalisationService, httpServerHelper: HttpServerHelper); protected httpConfig: IHttpConfig; protected defaultNotification: INotification; protected webSockets: Record; diff --git a/TypeScript/11BundleLoadingSample/types/servers/http/AkiHttpListener.d.ts b/TypeScript/11BundleLoadingSample/types/servers/http/AkiHttpListener.d.ts index 6f78939..acf92aa 100644 --- a/TypeScript/11BundleLoadingSample/types/servers/http/AkiHttpListener.d.ts +++ b/TypeScript/11BundleLoadingSample/types/servers/http/AkiHttpListener.d.ts @@ -1,22 +1,24 @@ /// /// import { IncomingMessage, ServerResponse } from "http"; -import { IHttpListener } from "./IHttpListener"; import { Serializer } from "../../di/Serializer"; import { ILogger } from "../../models/spt/utils/ILogger"; import { HttpRouter } from "../../routers/HttpRouter"; +import { LocalisationService } from "../../services/LocalisationService"; import { HttpResponseUtil } from "../../utils/HttpResponseUtil"; import { JsonUtil } from "../../utils/JsonUtil"; import { HttpBufferHandler } from "./HttpBufferHandler"; +import { IHttpListener } from "./IHttpListener"; export declare class AkiHttpListener implements IHttpListener { protected httpRouter: HttpRouter; protected serializers: Serializer[]; protected logger: ILogger; protected jsonUtil: JsonUtil; protected httpResponse: HttpResponseUtil; + protected localisationService: LocalisationService; protected httpBufferHandler: HttpBufferHandler; constructor(httpRouter: HttpRouter, // TODO: delay required - serializers: Serializer[], logger: ILogger, jsonUtil: JsonUtil, httpResponse: HttpResponseUtil, httpBufferHandler: HttpBufferHandler); + serializers: Serializer[], logger: ILogger, jsonUtil: JsonUtil, httpResponse: HttpResponseUtil, localisationService: LocalisationService, httpBufferHandler: HttpBufferHandler); canHandle(_: string, req: IncomingMessage): boolean; handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): void; sendResponse(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: Buffer, output: string): void; diff --git a/TypeScript/11BundleLoadingSample/types/services/BotEquipmentFilterService.d.ts b/TypeScript/11BundleLoadingSample/types/services/BotEquipmentFilterService.d.ts index 632f961..ae72cc3 100644 --- a/TypeScript/11BundleLoadingSample/types/services/BotEquipmentFilterService.d.ts +++ b/TypeScript/11BundleLoadingSample/types/services/BotEquipmentFilterService.d.ts @@ -1,12 +1,12 @@ import { IBotType } from "../models/eft/common/tables/IBotType"; -import { EquipmentFilters, EquipmentFilterDetails, IBotConfig } from "../models/spt/config/IBotConfig"; +import { EquipmentFilters, EquipmentFilterDetails, IBotConfig, WeightingAdjustmentDetails } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; export declare class BotEquipmentFilterService { protected logger: ILogger; protected configServer: ConfigServer; protected botConfig: IBotConfig; - protected botEquipmentFilterlists: Record; + protected botEquipmentConfig: Record; constructor(logger: ILogger, configServer: ConfigServer); /** * Filter a bots data to exclude equipment and cartridges defines in the botConfig @@ -30,6 +30,20 @@ export declare class BotEquipmentFilterService { * @returns EquipmentFilterDetails object */ protected getBotEquipmentWhitelist(botRole: string, playerLevel: number): EquipmentFilterDetails; + /** + * Retreive clothing weighting adjustments from bot.json config + * @param botRole Bot type to get adjustments for + * @param playerLevel level of player + * @returns Weighting adjustments for bots clothing + */ + protected getBotClothingAdjustments(botRole: string, playerLevel: number): WeightingAdjustmentDetails; + /** + * Retreive item weighting adjustments from bot.json config + * @param botRole Bot type to get adjustments for + * @param playerLevel level of player + * @returns Weighting adjustments for bot items + */ + protected getBotWeightingAdjustments(botRole: string, playerLevel: number): WeightingAdjustmentDetails; /** * Filter bot equipment based on blacklist and whitelist from config/bot.json * Prioritises whitelist first, if one is found blacklist is ignored @@ -47,4 +61,10 @@ export declare class BotEquipmentFilterService { * @returns Filtered bot file */ protected filterCartridges(baseBotNode: IBotType, blacklist: EquipmentFilterDetails, whitelist: EquipmentFilterDetails): void; + /** + * Add/Edit weighting changes to bot items using values from config/bot.json/equipment + * @param weightingAdjustments Weighting change to apply to bot + * @param botItemPool Bot item dictionary to adjust + */ + protected adjustWeighting(weightingAdjustments: WeightingAdjustmentDetails, botItemPool: Record): void; } diff --git a/TypeScript/11BundleLoadingSample/types/services/BotGenerationCacheService.d.ts b/TypeScript/11BundleLoadingSample/types/services/BotGenerationCacheService.d.ts index ba53fec..0be0576 100644 --- a/TypeScript/11BundleLoadingSample/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/11BundleLoadingSample/types/services/BotGenerationCacheService.d.ts @@ -8,11 +8,11 @@ export declare class BotGenerationCacheService { protected randomUtil: RandomUtil; protected jsonUtil: JsonUtil; protected botHelper: BotHelper; - protected storedBots: IBotBase[]; + protected storedBots: Map; constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, botHelper: BotHelper); /** * Store array of bots in cache, shuffle results before storage - * @param botsToStore + * @param botsToStore Bots we want to store in the cache */ storeBots(botsToStore: IBotBase[]): void; /** @@ -21,25 +21,7 @@ export declare class BotGenerationCacheService { * @param role role to retreive (assault/bossTagilla etc) * @returns IBotBase object */ - getBot(role: string): IBotBase[]; - /** - * Find a bot by its index from cache - * @param indexOfBotToReturn index to find bot by - * @returns bot profile - */ - protected getBotFromCache(indexOfBotToReturn: number): IBotBase; - /** - * Remove bot profile by index from cache - * @param indexOfBotToReturn Index of bot profile to remove - */ - protected removeBotFromCache(indexOfBotToReturn: number): void; - /** - * Get index of bot profile that matches criteria - * @param role Role of bot wanted - * @param getPmc Requested bot a pmc - * @returns index of found bot, -1 if not found - */ - protected getIndexOfBotToReturn(role: string, getPmc: boolean): number; + getBot(role: string): IBotBase; /** * Remove all cached bot profiles */ @@ -48,5 +30,5 @@ export declare class BotGenerationCacheService { * Does cache have bots * @returns true if empty */ - cacheIsEmpty(): boolean; + cacheHasBotOfRole(role: string): boolean; } diff --git a/TypeScript/11BundleLoadingSample/types/services/LocaleService.d.ts b/TypeScript/11BundleLoadingSample/types/services/LocaleService.d.ts index 33bea7b..8275b75 100644 --- a/TypeScript/11BundleLoadingSample/types/services/LocaleService.d.ts +++ b/TypeScript/11BundleLoadingSample/types/services/LocaleService.d.ts @@ -1,14 +1,42 @@ import { ILocaleConfig } from "../models/spt/config/ILocaleConfig"; +import { ILocaleGlobalBase } from "../models/spt/server/ILocaleBase"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +/** + * Handles getting locales from config or users machine + */ export declare class LocaleService { protected logger: ILogger; + protected databaseServer: DatabaseServer; protected configServer: ConfigServer; protected localeConfig: ILocaleConfig; - constructor(logger: ILogger, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, configServer: ConfigServer); /** - * Gets the locale key from the locale.json file + * Get the eft globals db file based on the configured locale in config/locale.json, if not found, fall back to 'en' + * @returns ILocaleGlobalBase + */ + getLocaleDb(): ILocaleGlobalBase; + /** + * Gets the game locale key from the locale.json file, + * if value is 'system' get system locale * @returns locale e.g en/ge/cz/cn */ - getDesiredLocale(): string; + getDesiredGameLocale(): string; + /** + * Gets the game locale key from the locale.json file, + * if value is 'system' get system locale + * @returns locale e.g en/ge/cz/cn + */ + getDesiredServerLocale(): string; + /** + * Get array of languages supported for localisation + * @returns array of locales e.g. en/fr/cn + */ + getServerSupportedLocales(): string[]; + /** + * Get the locale of the computer running the server + * @returns langage part of locale e.g. 'en' part of 'en-US' + */ + protected getPlatformLocale(): string; } diff --git a/TypeScript/11BundleLoadingSample/types/services/LocalisationService.d.ts b/TypeScript/11BundleLoadingSample/types/services/LocalisationService.d.ts new file mode 100644 index 0000000..519325d --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/services/LocalisationService.d.ts @@ -0,0 +1,21 @@ +import { I18n } from "i18n"; +import { ILocaleConfig } from "../models/spt/config/ILocaleConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { LocaleService } from "./LocaleService"; +/** + * Handles translating server text into different langauges + */ +export declare class LocalisationService { + protected logger: ILogger; + protected localeService: LocaleService; + protected localeConfig: ILocaleConfig; + protected i18n: I18n; + constructor(logger: ILogger, localeService: LocaleService); + /** + * Get a localised value using the passed in key + * @param key Key to loop up locale for + * @param args optional arguments + * @returns Localised string + */ + getText(key: string, args?: any): string; +} diff --git a/TypeScript/11BundleLoadingSample/types/services/PaymentService.d.ts b/TypeScript/11BundleLoadingSample/types/services/PaymentService.d.ts index a5e538f..c9ce95a 100644 --- a/TypeScript/11BundleLoadingSample/types/services/PaymentService.d.ts +++ b/TypeScript/11BundleLoadingSample/types/services/PaymentService.d.ts @@ -11,6 +11,7 @@ import { IProcessSellTradeRequestData } from "../models/eft/trade/IProcessSellTr import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +import { LocalisationService } from "./LocalisationService"; export declare class PaymentService { protected logger: ILogger; protected httpResponse: HttpResponseUtil; @@ -19,8 +20,9 @@ export declare class PaymentService { protected traderHelper: TraderHelper; protected itemHelper: ItemHelper; protected inventoryHelper: InventoryHelper; + protected localisationService: LocalisationService; protected paymentHelper: PaymentHelper; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, traderHelper: TraderHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper); + constructor(logger: ILogger, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, traderHelper: TraderHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, localisationService: LocalisationService, paymentHelper: PaymentHelper); /** * Take money and insert items into return to server request * @param {Object} pmcData @@ -50,7 +52,7 @@ export declare class PaymentService { * @param pmcData Player profile to find and remove currency from * @param currencyTpl Type of currency to pay * @param amountToPay money value to pay - * @param sessionID Sessino id + * @param sessionID Session id * @param output output object to send to client * @returns IItemEventRouterResponse */ diff --git a/TypeScript/11BundleLoadingSample/types/services/PlayerService.d.ts b/TypeScript/11BundleLoadingSample/types/services/PlayerService.d.ts index 519b7e5..2f364d5 100644 --- a/TypeScript/11BundleLoadingSample/types/services/PlayerService.d.ts +++ b/TypeScript/11BundleLoadingSample/types/services/PlayerService.d.ts @@ -2,10 +2,12 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { IPlayerIncrementSkillLevelRequestData } from "../models/eft/player/IPlayerIncrementSkillLevelRequestData"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "./LocalisationService"; export declare class PlayerService { protected logger: ILogger; + protected localisationService: LocalisationService; protected databaseServer: DatabaseServer; - constructor(logger: ILogger, databaseServer: DatabaseServer); + constructor(logger: ILogger, localisationService: LocalisationService, databaseServer: DatabaseServer); /** * increases the profile skill and updates any output * @param {Object} pmcData diff --git a/TypeScript/11BundleLoadingSample/types/services/PmcAiService.d.ts b/TypeScript/11BundleLoadingSample/types/services/PmcAiService.d.ts deleted file mode 100644 index 0690f1f..0000000 --- a/TypeScript/11BundleLoadingSample/types/services/PmcAiService.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { IBotConfig } from "../models/spt/config/IBotConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { ConfigServer } from "../servers/ConfigServer"; -/** Storing/retreving pmcRoles set at the start of a raid - its done at that point as we know what location the player is heading to */ -export declare class PmcAiService { - protected logger: ILogger; - protected configServer: ConfigServer; - protected botConfig: IBotConfig; - protected usecRole: string; - protected bearRole: string; - constructor(logger: ILogger, configServer: ConfigServer); - /** - * Convert from pmc side (usec/bear) to the side as defined in the bot config (usecType/bearType) - * @param pmcSide eft side (usec/bear) - * @returns pmc side as defined in config - */ - getPmcRole(pmcSide: "usec" | "bear" | string): string; - /** - * Set the roles for pmcs - * @param location map location to look up and use as pmc types - */ - setPmcRolesByLocation(location: string): void; - /** - * Clear the saved role from usec/bear PMCs - */ - clearPmcRoles(): void; -} diff --git a/TypeScript/11BundleLoadingSample/types/services/ProfileFixerService.d.ts b/TypeScript/11BundleLoadingSample/types/services/ProfileFixerService.d.ts index e772919..86a6af8 100644 --- a/TypeScript/11BundleLoadingSample/types/services/ProfileFixerService.d.ts +++ b/TypeScript/11BundleLoadingSample/types/services/ProfileFixerService.d.ts @@ -8,12 +8,14 @@ import { HideoutAreas } from "../models/enums/HideoutAreas"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { Watermark } from "../utils/Watermark"; +import { LocalisationService } from "./LocalisationService"; export declare class ProfileFixerService { protected logger: ILogger; protected watermark: Watermark; protected hideoutHelper: HideoutHelper; + protected localisationService: LocalisationService; protected databaseServer: DatabaseServer; - constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, databaseServer: DatabaseServer); + constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, localisationService: LocalisationService, databaseServer: DatabaseServer); /** * Find issues in the pmc profile data that may cause issues and fix them * @param pmcProfile profile to check and fix diff --git a/TypeScript/11BundleLoadingSample/types/services/RagfairOfferService.d.ts b/TypeScript/11BundleLoadingSample/types/services/RagfairOfferService.d.ts index a6f6b6d..86c1e52 100644 --- a/TypeScript/11BundleLoadingSample/types/services/RagfairOfferService.d.ts +++ b/TypeScript/11BundleLoadingSample/types/services/RagfairOfferService.d.ts @@ -11,6 +11,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { TimeUtil } from "../utils/TimeUtil"; +import { LocalisationService } from "./LocalisationService"; import { RagfairCategoriesService } from "./RagfairCategoriesService"; export declare class RagfairOfferService { protected logger: ILogger; @@ -22,12 +23,14 @@ export declare class RagfairOfferService { protected profileHelper: ProfileHelper; protected eventOutputHolder: EventOutputHolder; protected httpResponse: HttpResponseUtil; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected playerOffersLoaded: boolean; protected expiredOffers: Item[]; - protected offers: IRagfairOffer[]; + /** offerId, offer */ + protected offers: Record; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, databaseServer: DatabaseServer, saveServer: SaveServer, ragfairServerHelper: RagfairServerHelper, ragfairCategoriesService: RagfairCategoriesService, profileHelper: ProfileHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, databaseServer: DatabaseServer, saveServer: SaveServer, ragfairServerHelper: RagfairServerHelper, ragfairCategoriesService: RagfairCategoriesService, profileHelper: ProfileHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, localisationService: LocalisationService, configServer: ConfigServer); /** * Get all offers * @returns IRagfairOffer array diff --git a/TypeScript/11BundleLoadingSample/types/utils/App.d.ts b/TypeScript/11BundleLoadingSample/types/utils/App.d.ts index dcc2669..cc8a5af 100644 --- a/TypeScript/11BundleLoadingSample/types/utils/App.d.ts +++ b/TypeScript/11BundleLoadingSample/types/utils/App.d.ts @@ -1,14 +1,16 @@ -import { TimeUtil } from "./TimeUtil"; import { OnLoad } from "../di/OnLoad"; import { OnUpdate } from "../di/OnUpdate"; import { ILogger } from "../models/spt/utils/ILogger"; +import { LocalisationService } from "../services/LocalisationService"; +import { TimeUtil } from "./TimeUtil"; export declare class App { protected logger: ILogger; protected timeUtil: TimeUtil; + protected localisationService: LocalisationService; protected onLoadComponents: OnLoad[]; protected onUpdateComponents: OnUpdate[]; protected onUpdateLastRun: {}; - constructor(logger: ILogger, timeUtil: TimeUtil, onLoadComponents: OnLoad[], onUpdateComponents: OnUpdate[]); + constructor(logger: ILogger, timeUtil: TimeUtil, localisationService: LocalisationService, onLoadComponents: OnLoad[], onUpdateComponents: OnUpdate[]); load(): void; protected update(onUpdateComponents: OnUpdate[]): void; protected logUpdateException(err: any, updateable: OnUpdate): void; diff --git a/TypeScript/11BundleLoadingSample/types/utils/DatabaseImporter.d.ts b/TypeScript/11BundleLoadingSample/types/utils/DatabaseImporter.d.ts index 483e135..31670ae 100644 --- a/TypeScript/11BundleLoadingSample/types/utils/DatabaseImporter.d.ts +++ b/TypeScript/11BundleLoadingSample/types/utils/DatabaseImporter.d.ts @@ -3,15 +3,17 @@ import { IDatabaseTables } from "../models/spt/server/IDatabaseTables"; import { ILogger } from "../models/spt/utils/ILogger"; import { ImageRouter } from "../routers/ImageRouter"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { JsonUtil } from "./JsonUtil"; import { VFS } from "./VFS"; export declare class DatabaseImporter extends OnLoad { protected logger: ILogger; protected vfs: VFS; protected jsonUtil: JsonUtil; + protected localisationService: LocalisationService; protected databaseServer: DatabaseServer; protected imageRouter: ImageRouter; - constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, databaseServer: DatabaseServer, imageRouter: ImageRouter); + constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, localisationService: LocalisationService, databaseServer: DatabaseServer, imageRouter: ImageRouter); onLoad(): void; /** * Read all json files in database folder and map into a json object diff --git a/TypeScript/11BundleLoadingSample/types/utils/HttpResponseUtil.d.ts b/TypeScript/11BundleLoadingSample/types/utils/HttpResponseUtil.d.ts index 29502be..3a78618 100644 --- a/TypeScript/11BundleLoadingSample/types/utils/HttpResponseUtil.d.ts +++ b/TypeScript/11BundleLoadingSample/types/utils/HttpResponseUtil.d.ts @@ -1,10 +1,13 @@ -import { JsonUtil } from "./JsonUtil"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { INullResponseData } from "../models/eft/httpResponse/INullResponseData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; +import { BackendErrorCodes } from "../models/enums/BackendErrorCodes"; +import { LocalisationService } from "../services/LocalisationService"; +import { JsonUtil } from "./JsonUtil"; export declare class HttpResponseUtil { protected jsonUtil: JsonUtil; - constructor(jsonUtil: JsonUtil); + protected localisationService: LocalisationService; + constructor(jsonUtil: JsonUtil, localisationService: LocalisationService); protected clearString(s: string): any; noBody(data: any): any; getBody(data: T, err?: number, errmsg?: any): IGetBodyResponseData; @@ -12,5 +15,5 @@ export declare class HttpResponseUtil { emptyResponse(): IGetBodyResponseData; nullResponse(): INullResponseData; emptyArrayResponse(): IGetBodyResponseData; - appendErrorToOutput(output: IItemEventRouterResponse, message?: string, title?: string): IItemEventRouterResponse; + appendErrorToOutput(output: IItemEventRouterResponse, message?: string, errorCode?: BackendErrorCodes): IItemEventRouterResponse; } diff --git a/TypeScript/11BundleLoadingSample/types/utils/RandomUtil.d.ts b/TypeScript/11BundleLoadingSample/types/utils/RandomUtil.d.ts index 633e472..aa556e3 100644 --- a/TypeScript/11BundleLoadingSample/types/utils/RandomUtil.d.ts +++ b/TypeScript/11BundleLoadingSample/types/utils/RandomUtil.d.ts @@ -110,6 +110,12 @@ export declare class RandomUtil { getIntEx(max: number): number; getFloat(min: number, max: number): number; getBool(): boolean; + /** + * Check if number passes a check out of 100 + * @param chancePercent value check needs to be above + * @returns true if value passes check + */ + getChance100(chancePercent: number): boolean; getStringArrayValue(arr: string[]): string; getArrayValue(arr: T[]): T; getKey(node: any): string; diff --git a/TypeScript/11BundleLoadingSample/types/utils/Watermark.d.ts b/TypeScript/11BundleLoadingSample/types/utils/Watermark.d.ts index c6dc120..e02eba2 100644 --- a/TypeScript/11BundleLoadingSample/types/utils/Watermark.d.ts +++ b/TypeScript/11BundleLoadingSample/types/utils/Watermark.d.ts @@ -1,20 +1,15 @@ import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { LocalisationService } from "../services/LocalisationService"; export declare class WatermarkLocale { - protected locales: { - "en-US": { - description: string[]; - warning: string[]; - modding: string[]; - }; - "zh-CN": { - description: string[]; - warning: string[]; - modding: string[]; - }; + protected localisationService: LocalisationService; + constructor(localisationService: LocalisationService); + protected watermark: { + description: string[]; + warning: string[]; + modding: string[]; }; - getLocale(): string; getDescription(): string[]; getWarning(): string[]; getModding(): string[]; @@ -22,9 +17,10 @@ export declare class WatermarkLocale { export declare class Watermark { protected logger: ILogger; protected configServer: ConfigServer; + protected localisationService: LocalisationService; protected watermarkLocale?: WatermarkLocale; protected akiConfig: ICoreConfig; - constructor(logger: ILogger, configServer: ConfigServer, watermarkLocale?: WatermarkLocale); + constructor(logger: ILogger, configServer: ConfigServer, localisationService: LocalisationService, watermarkLocale?: WatermarkLocale); protected text: string[]; protected versionLabel: string; initialize(): void; diff --git a/TypeScript/12ClassExtensionOverride/types/callbacks/BotCallbacks.d.ts b/TypeScript/12ClassExtensionOverride/types/callbacks/BotCallbacks.d.ts index 2db60dc..827015e 100644 --- a/TypeScript/12ClassExtensionOverride/types/callbacks/BotCallbacks.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/callbacks/BotCallbacks.d.ts @@ -8,8 +8,29 @@ export declare class BotCallbacks { protected botController: BotController; protected httpResponse: HttpResponseUtil; constructor(botController: BotController, httpResponse: HttpResponseUtil); + /** + * Handle singleplayer/settings/bot/limit + * @returns string + */ getBotLimit(url: string, info: IEmptyRequestData, sessionID: string): string; + /** + * Handle singleplayer/settings/bot/difficulty + * @returns string + */ getBotDifficulty(url: string, info: IEmptyRequestData, sessionID: string): string; + /** + * Handle client/game/bot/generate + * @returns IGetBodyResponseData + */ generateBots(url: string, info: IGenerateBotsRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle singleplayer/settings/bot/maxCap + * @returns string + */ getBotCap(): string; + /** + * Handle singleplayer/settings/bot/getBotBehaviours + * @returns string + */ + getBotBehaviours(): string; } diff --git a/TypeScript/12ClassExtensionOverride/types/callbacks/CustomizationCallbacks.d.ts b/TypeScript/12ClassExtensionOverride/types/callbacks/CustomizationCallbacks.d.ts index 3bab8c0..75d5701 100644 --- a/TypeScript/12ClassExtensionOverride/types/callbacks/CustomizationCallbacks.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/callbacks/CustomizationCallbacks.d.ts @@ -3,6 +3,7 @@ import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { IPmcData } from "../models/eft/common/IPmcData"; import { ISuit } from "../models/eft/common/tables/ITrader"; import { IBuyClothingRequestData } from "../models/eft/customization/IBuyClothingRequestData"; +import { IGetSuitsResponse } from "../models/eft/customization/IGetSuitsResponse"; import { IWearClothingRequestData } from "../models/eft/customization/IWearClothingRequestData"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; @@ -13,10 +14,15 @@ export declare class CustomizationCallbacks { protected saveServer: SaveServer; protected httpResponse: HttpResponseUtil; constructor(customizationController: CustomizationController, saveServer: SaveServer, httpResponse: HttpResponseUtil); - getSuits(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<{ - _id: string; - suites: string[]; - }>; + /** + * Handles client/trading/customization/storage + * @returns + */ + getSuits(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handles client/trading/customization + * @returns ISuit[] + */ getTraderSuits(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; wearClothing(pmcData: IPmcData, body: IWearClothingRequestData, sessionID: string): IItemEventRouterResponse; buyClothing(pmcData: IPmcData, body: IBuyClothingRequestData, sessionID: string): IItemEventRouterResponse; diff --git a/TypeScript/12ClassExtensionOverride/types/callbacks/DataCallbacks.d.ts b/TypeScript/12ClassExtensionOverride/types/callbacks/DataCallbacks.d.ts index 04566ff..2efcf81 100644 --- a/TypeScript/12ClassExtensionOverride/types/callbacks/DataCallbacks.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/callbacks/DataCallbacks.d.ts @@ -12,15 +12,42 @@ import { ILanguageBase } from "../models/spt/server/ILocaleBase"; import { ISettingsBase } from "../models/spt/server/ISettingsBase"; import { DatabaseServer } from "../servers/DatabaseServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +/** + * Handle client requests + */ export declare class DataCallbacks { protected httpResponse: HttpResponseUtil; protected databaseServer: DatabaseServer; constructor(httpResponse: HttpResponseUtil, databaseServer: DatabaseServer); + /** + * Handles client/settings + * @returns ISettingsBase + */ getSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handles client/globals + * @returns IGlobals + */ getGlobals(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handles client/items + * @returns string + */ getTemplateItems(url: string, info: IEmptyRequestData, sessionID: string): string; + /** + * Handles client/handbook/templates + * @returns IHandbookBase + */ getTemplateHandbook(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handles client/customization + * @returns Record>; + /** + * Handles client/account/customization + * @returns string[] + */ getTemplateCharacter(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getTemplateQuests(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getHideoutSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; @@ -28,6 +55,6 @@ export declare class DataCallbacks { gethideoutProduction(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getHideoutScavcase(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getLocalesLanguages(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - getLocalesMenu(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + getLocalesMenu(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getLocalesGlobal(url: string, info: IEmptyRequestData, sessionID: string): string; } diff --git a/TypeScript/12ClassExtensionOverride/types/callbacks/DialogueCallbacks.d.ts b/TypeScript/12ClassExtensionOverride/types/callbacks/DialogueCallbacks.d.ts index 634f90b..7b2eeae 100644 --- a/TypeScript/12ClassExtensionOverride/types/callbacks/DialogueCallbacks.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/callbacks/DialogueCallbacks.d.ts @@ -26,15 +26,27 @@ export declare class DialogueCallbacks extends OnUpdate { protected httpResponse: HttpResponseUtil; protected dialogueController: DialogueController; constructor(hashUtil: HashUtil, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, dialogueController: DialogueController); + /** + * Handles client/friend/list + * @returns IGetFriendListDataResponse + */ getFriendList(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handles client/chatServer/list + * @returns + */ getChatServerList(url: string, info: IGetChatServerListRequestData, sessionID: string): IGetBodyResponseData; getMailDialogList(url: string, info: IGetMailDialogListRequestData, sessionID: string): IGetBodyResponseData; getMailDialogView(url: string, info: IGetMailDialogViewRequestData, sessionID: string): IGetBodyResponseData; - getMailDialogInfo(url: string, info: IGetMailDialogInfoRequestData, sessionID: string): IGetBodyResponseData; + getMailDialogInfo(url: string, info: IGetMailDialogInfoRequestData, sessionID: string): IGetBodyResponseData; removeDialog(url: string, info: IRemoveDialogRequestData, sessionID: string): IGetBodyResponseData; pinDialog(url: string, info: IPinDialogRequestData, sessionID: string): IGetBodyResponseData; unpinDialog(url: string, info: IPinDialogRequestData, sessionID: string): IGetBodyResponseData; setRead(url: string, info: ISetDialogReadRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handles client/mail/dialog/getAllAttachments + * @returns IGetAllAttachmentsResponse + */ getAllAttachments(url: string, info: IGetAllAttachmentsRequestData, sessionID: string): IGetBodyResponseData; listOutbox(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; listInbox(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; diff --git a/TypeScript/12ClassExtensionOverride/types/callbacks/GameCallbacks.d.ts b/TypeScript/12ClassExtensionOverride/types/callbacks/GameCallbacks.d.ts index 5e4c240..3a6b7e6 100644 --- a/TypeScript/12ClassExtensionOverride/types/callbacks/GameCallbacks.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/callbacks/GameCallbacks.d.ts @@ -3,6 +3,9 @@ import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { ICheckVersionResponse } from "../models/eft/game/ICheckVersionResponse"; import { IGameConfigResponse } from "../models/eft/game/IGameConfigResponse"; import { IGameEmptyCrcRequestData } from "../models/eft/game/IGameEmptyCrcRequestData"; +import { IGameKeepAliveResponse } from "../models/eft/game/IGameKeepAliveResponse"; +import { IGameLogoutResponseData } from "../models/eft/game/IGameLogoutResponseData"; +import { IGameStartResponse } from "../models/eft/game/IGameStartResponse"; import { IReportNicknameRequestData } from "../models/eft/game/IReportNicknameRequestData"; import { IServerDetails } from "../models/eft/game/IServerDetails"; import { IVersionValidateRequestData } from "../models/eft/game/IVersionValidateRequestData"; @@ -15,13 +18,37 @@ declare class GameCallbacks { protected watermark: Watermark; protected gameController: GameController; constructor(httpResponse: HttpResponseUtil, watermark: Watermark, gameController: GameController); + /** + * Handle client/game/version/validate + * @returns INullResponseData + */ versionValidate(url: string, info: IVersionValidateRequestData, sessionID: string): INullResponseData; - gameStart(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - gameLogout(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/game/start + * @returns IGameStartResponse + */ + gameStart(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/game/logout + * @returns IGameLogoutResponseData + */ + gameLogout(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/game/config + * @returns IGameConfigResponse + */ getGameConfig(url: string, info: IGameEmptyCrcRequestData, sessionID: string): IGetBodyResponseData; getServer(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; validateGameVersion(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - gameKeepalive(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/game/keepalive + * @returns IGameKeepAliveResponse + */ + gameKeepalive(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle singleplayer/settings/version + * @returns string + */ getVersion(url: string, info: IEmptyRequestData, sessionID: string): string; reportNickname(url: string, info: IReportNicknameRequestData, sessionID: string): INullResponseData; } diff --git a/TypeScript/12ClassExtensionOverride/types/callbacks/HealthCallbacks.d.ts b/TypeScript/12ClassExtensionOverride/types/callbacks/HealthCallbacks.d.ts index 8672be7..7edf03e 100644 --- a/TypeScript/12ClassExtensionOverride/types/callbacks/HealthCallbacks.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/callbacks/HealthCallbacks.d.ts @@ -21,7 +21,19 @@ export declare class HealthCallbacks { * @returns empty response, no data sent back to client */ syncHealth(url: string, info: ISyncHealthRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle Eat + * @returns IItemEventRouterResponse + */ offraidEat(pmcData: IPmcData, body: IOffraidEatRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle Heal + * @returns IItemEventRouterResponse + */ offraidHeal(pmcData: IPmcData, body: IOffraidHealRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle RestoreHealth + * @returns IItemEventRouterResponse + */ healthTreatment(pmcData: IPmcData, info: IHealthTreatmentRequestData, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/12ClassExtensionOverride/types/callbacks/HideoutCallbacks.d.ts b/TypeScript/12ClassExtensionOverride/types/callbacks/HideoutCallbacks.d.ts index 99ab4c9..e39e806 100644 --- a/TypeScript/12ClassExtensionOverride/types/callbacks/HideoutCallbacks.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/callbacks/HideoutCallbacks.d.ts @@ -19,14 +19,77 @@ export declare class HideoutCallbacks extends OnUpdate { protected hideoutConfig: IHideoutConfig; constructor(hideoutController: HideoutController, // TODO: delay needed configServer: ConfigServer); + /** + * Handle HideoutUpgrade + * @param pmcData + * @param body + * @param sessionID + * @returns + */ upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutUpgradeComplete + * @param pmcData + * @param body + * @param sessionID + * @returns + */ upgradeComplete(pmcData: IPmcData, body: IHideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutPutItemsInAreaSlots + * @param pmcData + * @param body + * @param sessionID + * @returns + */ putItemsInAreaSlots(pmcData: IPmcData, body: IHideoutPutItemInRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutTakeItemsFromAreaSlots + * @param pmcData + * @param body + * @param sessionID + * @returns + */ takeItemsFromAreaSlots(pmcData: IPmcData, body: IHideoutTakeItemOutRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutToggleArea + * @param pmcData + * @param body + * @param sessionID + * @returns + */ toggleArea(pmcData: IPmcData, body: IHideoutToggleAreaRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutSingleProductionStart + * @param pmcData + * @param body + * @param sessionID + * @returns + */ singleProductionStart(pmcData: IPmcData, body: IHideoutSingleProductionStartRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutScavCaseProductionStart + * @param pmcData + * @param body + * @param sessionID + * @returns + */ scavCaseProductionStart(pmcData: IPmcData, body: IHideoutScavCaseStartRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutContinuousProductionStart + * @param pmcData + * @param body + * @param sessionID + * @returns + */ continuousProductionStart(pmcData: IPmcData, body: IHideoutContinousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutTakeProduction + * @param pmcData + * @param body + * @param sessionID + * @returns + */ takeProduction(pmcData: IPmcData, body: IHideoutTakeProductionRequestData, sessionID: string): IItemEventRouterResponse; onUpdate(timeSinceLastRun: number): boolean; getRoute(): string; diff --git a/TypeScript/12ClassExtensionOverride/types/callbacks/InraidCallbacks.d.ts b/TypeScript/12ClassExtensionOverride/types/callbacks/InraidCallbacks.d.ts index 05bcce4..918bfaf 100644 --- a/TypeScript/12ClassExtensionOverride/types/callbacks/InraidCallbacks.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/callbacks/InraidCallbacks.d.ts @@ -1,23 +1,49 @@ import { InraidController } from "../controllers/InraidController"; -import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { INullResponseData } from "../models/eft/httpResponse/INullResponseData"; import { IRegisterPlayerRequestData } from "../models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; -import { IAirdropConfig } from "../models/spt/config/IAirdropConfig"; -import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; -import { ConfigServer } from "../servers/ConfigServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +/** + * Handle client requests + */ export declare class InraidCallbacks { protected inraidController: InraidController; protected httpResponse: HttpResponseUtil; - protected configServer: ConfigServer; - protected airdropConfig: IAirdropConfig; - protected inraidConfig: IInRaidConfig; - constructor(inraidController: InraidController, httpResponse: HttpResponseUtil, configServer: ConfigServer); + constructor(inraidController: InraidController, httpResponse: HttpResponseUtil); + /** + * Handle client/location/getLocalloot + * @param url + * @param info register player request + * @param sessionID Session id + * @returns Null http response + */ registerPlayer(url: string, info: IRegisterPlayerRequestData, sessionID: string): INullResponseData; + /** + * Handle raid/profile/save + * @param url + * @param info Save progress request + * @param sessionID Session id + * @returns Null http response + */ saveProgress(url: string, info: ISaveProgressRequestData, sessionID: string): INullResponseData; + /** + * Handle singleplayer/settings/raid/endstate + * @returns + */ getRaidEndState(): string; - getRaidMenuSettings(url: string, info: IEmptyRequestData, sessionID: string): string; - getWeaponDurability(url: string, info: any, sessionID: string): string; - getAirdropConfig(url: string, info: any, sessionID: string): string; + /** + * Handle singleplayer/settings/raid/menu + * @returns JSON as string + */ + getRaidMenuSettings(): string; + /** + * Handle singleplayer/settings/weapon/durability + * @returns + */ + getWeaponDurability(): string; + /** + * Handle singleplayer/airdrop/config + * @returns JSON as string + */ + getAirdropConfig(): string; } diff --git a/TypeScript/12ClassExtensionOverride/types/callbacks/InsuranceCallbacks.d.ts b/TypeScript/12ClassExtensionOverride/types/callbacks/InsuranceCallbacks.d.ts index 8835ba2..a171e1c 100644 --- a/TypeScript/12ClassExtensionOverride/types/callbacks/InsuranceCallbacks.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/callbacks/InsuranceCallbacks.d.ts @@ -17,7 +17,15 @@ export declare class InsuranceCallbacks extends OnUpdate { protected configServer: ConfigServer; protected insuranceConfig: IInsuranceConfig; constructor(insuranceController: InsuranceController, insuranceService: InsuranceService, httpResponse: HttpResponseUtil, configServer: ConfigServer); + /** + * Handle client/insurance/items/list/cost + * @returns IGetInsuranceCostResponseData + */ getInsuranceCost(url: string, info: IGetInsuranceCostRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle Insure + * @returns IItemEventRouterResponse + */ insure(pmcData: IPmcData, body: IInsureRequestData, sessionID: string): IItemEventRouterResponse; onUpdate(secondsSinceLastRun: number): boolean; getRoute(): string; diff --git a/TypeScript/12ClassExtensionOverride/types/callbacks/InventoryCallbacks.d.ts b/TypeScript/12ClassExtensionOverride/types/callbacks/InventoryCallbacks.d.ts index 9ab1486..46bf6fd 100644 --- a/TypeScript/12ClassExtensionOverride/types/callbacks/InventoryCallbacks.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/callbacks/InventoryCallbacks.d.ts @@ -16,6 +16,7 @@ import { IInventorySwapRequestData } from "../models/eft/inventory/IInventorySwa import { IInventoryTagRequestData } from "../models/eft/inventory/IInventoryTagRequestData"; import { IInventoryToggleRequestData } from "../models/eft/inventory/IInventoryToggleRequestData"; import { IInventoryTransferRequestData } from "../models/eft/inventory/IInventoryTransferRequestData"; +import { IOpenRandomLootContainerRequestData } from "../models/eft/inventory/IOpenRandomLootContainerRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; export declare class InventoryCallbacks { protected inventoryController: InventoryController; @@ -36,4 +37,5 @@ export declare class InventoryCallbacks { createMapMarker(pmcData: IPmcData, body: IInventoryCreateMarkerRequestData, sessionID: string): IItemEventRouterResponse; deleteMapMarker(pmcData: IPmcData, body: IInventoryDeleteMarkerRequestData, sessionID: string): IItemEventRouterResponse; editMapMarker(pmcData: IPmcData, body: IInventoryEditMarkerRequestData, sessionID: string): IItemEventRouterResponse; + openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/12ClassExtensionOverride/types/callbacks/ItemEventCallbacks.d.ts b/TypeScript/12ClassExtensionOverride/types/callbacks/ItemEventCallbacks.d.ts index f4f04f9..fbb0b5f 100644 --- a/TypeScript/12ClassExtensionOverride/types/callbacks/ItemEventCallbacks.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/callbacks/ItemEventCallbacks.d.ts @@ -1,4 +1,5 @@ import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; +import { Warning } from "../models/eft/itemEvent/IItemEventRouterBase"; import { IItemEventRouterRequest } from "../models/eft/itemEvent/IItemEventRouterRequest"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { ItemEventRouter } from "../routers/ItemEventRouter"; @@ -8,4 +9,5 @@ export declare class ItemEventCallbacks { protected itemEventRouter: ItemEventRouter; constructor(httpResponse: HttpResponseUtil, itemEventRouter: ItemEventRouter); handleEvents(url: string, info: IItemEventRouterRequest, sessionID: string): IGetBodyResponseData; + protected getErrorCode(warnings: Warning[]): number; } diff --git a/TypeScript/12ClassExtensionOverride/types/callbacks/MatchCallbacks.d.ts b/TypeScript/12ClassExtensionOverride/types/callbacks/MatchCallbacks.d.ts index 2a92ef5..10fbc44 100644 --- a/TypeScript/12ClassExtensionOverride/types/callbacks/MatchCallbacks.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/callbacks/MatchCallbacks.d.ts @@ -34,6 +34,10 @@ export declare class MatchCallbacks { serverAvailable(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData | IGetBodyResponseData; joinMatch(url: string, info: IJoinMatchRequestData, sessionID: string): IGetBodyResponseData; getMetrics(url: string, info: any, sessionID: string): IGetBodyResponseData; + /** + * Handle client/match/group/status + * @returns + */ getGroupStatus(url: string, info: IGetGroupStatusRequestData, sessionID: string): IGetBodyResponseData; createGroup(url: string, info: ICreateGroupRequestData, sessionID: string): IGetBodyResponseData; deleteGroup(url: string, info: any, sessionID: string): INullResponseData; diff --git a/TypeScript/12ClassExtensionOverride/types/callbacks/NotifierCallbacks.d.ts b/TypeScript/12ClassExtensionOverride/types/callbacks/NotifierCallbacks.d.ts index c42058f..fab325b 100644 --- a/TypeScript/12ClassExtensionOverride/types/callbacks/NotifierCallbacks.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/callbacks/NotifierCallbacks.d.ts @@ -4,6 +4,7 @@ import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { INotifierChannel } from "../models/eft/notifier/INotifier"; import { ISelectProfileRequestData } from "../models/eft/notifier/ISelectProfileRequestData"; +import { ISelectProfileResponse } from "../models/eft/notifier/ISelectProfileResponse"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; export declare class NotifierCallbacks { protected httpServerHelper: HttpServerHelper; @@ -19,6 +20,10 @@ export declare class NotifierCallbacks { sendNotification(sessionID: string, req: any, resp: any, data: any): void; getNotifier(url: string, info: any, sessionID: string): IGetBodyResponseData; createNotifierChannel(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - selectProfile(url: string, info: ISelectProfileRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/game/profile/select + * @returns ISelectProfileResponse + */ + selectProfile(url: string, info: ISelectProfileRequestData, sessionID: string): IGetBodyResponseData; notify(url: string, info: any, sessionID: string): string; } diff --git a/TypeScript/12ClassExtensionOverride/types/callbacks/QuestCallbacks.d.ts b/TypeScript/12ClassExtensionOverride/types/callbacks/QuestCallbacks.d.ts index 559c29e..2a3eb20 100644 --- a/TypeScript/12ClassExtensionOverride/types/callbacks/QuestCallbacks.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/callbacks/QuestCallbacks.d.ts @@ -21,6 +21,13 @@ export declare class QuestCallbacks { acceptQuest(pmcData: IPmcData, body: IAcceptQuestRequestData, sessionID: string): IItemEventRouterResponse; completeQuest(pmcData: IPmcData, body: ICompleteQuestRequestData, sessionID: string): IItemEventRouterResponse; handoverQuest(pmcData: IPmcData, body: IHandoverQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle client/quest/list + * @param url + * @param info + * @param sessionID + * @returns + */ listQuests(url: string, info: IListQuestsRequestData, sessionID: string): IGetBodyResponseData; activityPeriods(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; } diff --git a/TypeScript/12ClassExtensionOverride/types/callbacks/RagfairCallbacks.d.ts b/TypeScript/12ClassExtensionOverride/types/callbacks/RagfairCallbacks.d.ts index c609f2f..37f3807 100644 --- a/TypeScript/12ClassExtensionOverride/types/callbacks/RagfairCallbacks.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/callbacks/RagfairCallbacks.d.ts @@ -35,7 +35,7 @@ export declare class RagfairCallbacks extends OnLoadOnUpdate { getRoute(): string; search(url: string, info: ISearchRequestData, sessionID: string): IGetBodyResponseData; getMarketPrice(url: string, info: IGetMarketPriceRequestData, sessionID: string): IGetBodyResponseData; - getItemPrices(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + getItemPrices(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData>; addOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; removeOffer(pmcData: IPmcData, info: IRemoveOfferRequestData, sessionID: string): IItemEventRouterResponse; extendOffer(pmcData: IPmcData, info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; diff --git a/TypeScript/12ClassExtensionOverride/types/callbacks/TraderCallbacks.d.ts b/TypeScript/12ClassExtensionOverride/types/callbacks/TraderCallbacks.d.ts index e4fd099..40a1455 100644 --- a/TypeScript/12ClassExtensionOverride/types/callbacks/TraderCallbacks.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/callbacks/TraderCallbacks.d.ts @@ -12,6 +12,10 @@ export declare class TraderCallbacks extends OnLoadOnUpdate { onUpdate(): boolean; getRoute(): string; getTraderSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/trading/api/getUserAssortPrice/trader + * @returns + */ getProfilePurchases(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData>; getTrader(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getAssort(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; diff --git a/TypeScript/12ClassExtensionOverride/types/callbacks/WeatherCallbacks.d.ts b/TypeScript/12ClassExtensionOverride/types/callbacks/WeatherCallbacks.d.ts index ae784c8..f9d2002 100644 --- a/TypeScript/12ClassExtensionOverride/types/callbacks/WeatherCallbacks.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/callbacks/WeatherCallbacks.d.ts @@ -1,10 +1,15 @@ import { WeatherController } from "../controllers/WeatherController"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; +import { IWeatherData } from "../models/eft/weather/IWeatherData"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; export declare class WeatherCallbacks { protected httpResponse: HttpResponseUtil; protected weatherController: WeatherController; constructor(httpResponse: HttpResponseUtil, weatherController: WeatherController); - getWeather(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/weather + * @returns IWeatherData + */ + getWeather(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; } diff --git a/TypeScript/12ClassExtensionOverride/types/context/ContextVariableType.d.ts b/TypeScript/12ClassExtensionOverride/types/context/ContextVariableType.d.ts index 5fc1704..a7dd9b5 100644 --- a/TypeScript/12ClassExtensionOverride/types/context/ContextVariableType.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/context/ContextVariableType.d.ts @@ -1,4 +1,8 @@ export declare enum ContextVariableType { + /** Logged in users session id */ SESSION_ID = 0, - MATCH_INFO = 1 + /** Currently acive raid information */ + MATCH_INFO = 1, + /** Timestamp when client first connected */ + CLIENT_START_TIMESTAMP = 2 } diff --git a/TypeScript/12ClassExtensionOverride/types/controllers/BotController.d.ts b/TypeScript/12ClassExtensionOverride/types/controllers/BotController.d.ts index a5111d5..92317c3 100644 --- a/TypeScript/12ClassExtensionOverride/types/controllers/BotController.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/controllers/BotController.d.ts @@ -1,6 +1,8 @@ import { ApplicationContext } from "../context/ApplicationContext"; import { BotGenerator } from "../generators/BotGenerator"; +import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { IGenerateBotsRequestData } from "../models/eft/bot/IGenerateBotsRequestData"; import { IBotBase } from "../models/eft/common/tables/IBotBase"; import { IBotCore } from "../models/eft/common/tables/IBotCore"; @@ -10,18 +12,23 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; -import { PmcAiService } from "../services/PmcAiService"; +import { LocalisationService } from "../services/LocalisationService"; +import { JsonUtil } from "../utils/JsonUtil"; export declare class BotController { protected logger: ILogger; protected databaseServer: DatabaseServer; protected botGenerator: BotGenerator; protected botHelper: BotHelper; - protected pmcAiService: PmcAiService; + protected botDifficultyHelper: BotDifficultyHelper; protected botGenerationCacheService: BotGenerationCacheService; + protected localisationService: LocalisationService; + protected weightedRandomHelper: WeightedRandomHelper; protected configServer: ConfigServer; protected applicationContext: ApplicationContext; + protected jsonUtil: JsonUtil; protected botConfig: IBotConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, pmcAiService: PmcAiService, botGenerationCacheService: BotGenerationCacheService, configServer: ConfigServer, applicationContext: ApplicationContext); + static readonly pmcTypeLabel = "PMC"; + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); /** * Return the number of bot loadout varieties to be generated * @param type bot Type we want the loadout gen count for @@ -37,7 +44,6 @@ export declare class BotController { * @returns Difficulty object */ getBotDifficulty(type: string, difficulty: string): Difficulty; - protected getPmcDifficultySettings(pmcType: "bear" | "usec", difficulty: string, usecType: string, bearType: string): Difficulty; /** * Generate bot profiles and store in cache * @param sessionId Session id @@ -51,4 +57,5 @@ export declare class BotController { * @returns cap number */ getBotCap(): number; + getPmcBotTypes(): Record>>; } diff --git a/TypeScript/12ClassExtensionOverride/types/controllers/DialogueController.d.ts b/TypeScript/12ClassExtensionOverride/types/controllers/DialogueController.d.ts index 1b72522..9c8b728 100644 --- a/TypeScript/12ClassExtensionOverride/types/controllers/DialogueController.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/controllers/DialogueController.d.ts @@ -23,7 +23,7 @@ export declare class DialogueController { * Get the content of a dialogue * @param dialogueID Dialog id * @param sessionID Session Id - * @returns + * @returns DialogueInfo */ getDialogueInfo(dialogueID: string, sessionID: string): DialogueInfo; /** diff --git a/TypeScript/12ClassExtensionOverride/types/controllers/GameController.d.ts b/TypeScript/12ClassExtensionOverride/types/controllers/GameController.d.ts index 3bfbdb1..f4f5849 100644 --- a/TypeScript/12ClassExtensionOverride/types/controllers/GameController.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/controllers/GameController.d.ts @@ -1,3 +1,4 @@ +import { ApplicationContext } from "../context/ApplicationContext"; import { GameEventHelper } from "../helpers/GameEventHelper"; import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; @@ -14,6 +15,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; +import { LocalisationService } from "../services/LocalisationService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { Watermark } from "../utils/Watermark"; export declare class GameController { @@ -24,14 +26,33 @@ export declare class GameController { protected localeService: LocaleService; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; + protected localisationService: LocalisationService; protected gameEventHelper: GameEventHelper; + protected applicationContext: ApplicationContext; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; protected coreConfig: ICoreConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, gameEventHelper: GameEventHelper, configServer: ConfigServer); - gameStart(_url: string, _info: IEmptyRequestData, sessionID: string): void; + constructor(logger: ILogger, databaseServer: DatabaseServer, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, gameEventHelper: GameEventHelper, applicationContext: ApplicationContext, configServer: ConfigServer); + gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; + /** + * Check if current date falls inside any of the seasons events pased in, if so, handle them + * @param seasonalEvents events to check for + */ protected checkForAndEnableSeasonalEvents(seasonalEvents: ISeasonalEvent[]): void; + /** + * Make adjusted to server code based on the name of the event passed in + * @param globalConfig globals.json + * @param eventName Name of the event to enable. e.g. Christmas + */ protected updateGlobalEvents(globalConfig: Config, eventName: string): void; + /** + * Read in data from seasonalEvents.json and add found equipment items to bots + * @param eventName Name of the event to read equipment in from config + */ + protected addEventGearToScavs(eventName: string): void; + /** + * Set Khorovod(dancing tree) chance to 100% on all maps that support it + */ protected enableDancingTree(): void; /** * Make non-trigger-spawned raiders spawn earlier + always @@ -40,5 +61,6 @@ export declare class GameController { protected logProfileDetails(fullProfile: IAkiProfile): void; getGameConfig(sessionID: string): IGameConfigResponse; getServer(): IServerDetails[]; + protected addPumpkinsToScavBackpacks(): void; getValidGameVersion(): ICheckVersionResponse; } diff --git a/TypeScript/12ClassExtensionOverride/types/controllers/HideoutController.d.ts b/TypeScript/12ClassExtensionOverride/types/controllers/HideoutController.d.ts index ada5bd9..5b6507b 100644 --- a/TypeScript/12ClassExtensionOverride/types/controllers/HideoutController.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/controllers/HideoutController.d.ts @@ -23,12 +23,13 @@ import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; import { PlayerService } from "../services/PlayerService"; import { HashUtil } from "../utils/HashUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; -import { JsonUtil } from "../utils/JsonUtil"; export declare class HideoutController { protected logger: ILogger; protected hashUtil: HashUtil; @@ -45,11 +46,12 @@ export declare class HideoutController { protected profileHelper: ProfileHelper; protected hideoutHelper: HideoutHelper; protected scavCaseRewardGenerator: ScavCaseRewardGenerator; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected jsonUtil: JsonUtil; protected static nameBackendCountersCrafting: string; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, configServer: ConfigServer, jsonUtil: JsonUtil); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, localisationService: LocalisationService, configServer: ConfigServer, jsonUtil: JsonUtil); upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; upgradeComplete(pmcData: IPmcData, body: HideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; /** diff --git a/TypeScript/12ClassExtensionOverride/types/controllers/InraidController.d.ts b/TypeScript/12ClassExtensionOverride/types/controllers/InraidController.d.ts index e84eea1..39a6396 100644 --- a/TypeScript/12ClassExtensionOverride/types/controllers/InraidController.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/controllers/InraidController.d.ts @@ -6,6 +6,7 @@ import { ProfileHelper } from "../helpers/ProfileHelper"; import { QuestHelper } from "../helpers/QuestHelper"; import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; +import { Item } from "../models/eft/common/tables/IItem"; import { IRegisterPlayerRequestData } from "../models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; import { IAirdropConfig } from "../models/spt/config/IAirdropConfig"; @@ -17,6 +18,9 @@ import { SaveServer } from "../servers/SaveServer"; import { InsuranceService } from "../services/InsuranceService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; +/** + * Logic for handling In Raid callbacks + */ export declare class InraidController { protected logger: ILogger; protected saveServer: SaveServer; @@ -35,14 +39,42 @@ export declare class InraidController { protected airdropConfig: IAirdropConfig; protected inraidConfig: IInRaidConfig; 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 + * Save locationid to active profiles inraid object + * @param sessionID Session id + * @param info Register player request + */ + addPlayer(sessionID: string, info: IRegisterPlayerRequestData): void; + /** + * Save profile state to disk + * Handles pmc/pscav + * @param offraidData post-raid request data + * @param sessionID Session id + */ + savePostRaidProgress(offraidData: ISaveProgressRequestData, sessionID: string): void; + /** + * Handle updating player profile post-pmc raid * @param sessionID session id - * @param offraidData post-raid data of raid + * @param offraidData post-raid data */ protected savePmcProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; + /** + * Make changes to pmc profile after they left raid dead, + * alter bodypart hp, handle insurance, delete inventory items, remove carried quest items + * @param postRaidSaveRequest post-raid save request + * @param pmcData pmc profile + * @param insuranceEnabled is insurance enabled + * @param preRaidGear gear player had before raid + * @param sessionID Session id + * @returns Updated profile object + */ + protected performPostRaidActionsWhenDead(postRaidSaveRequest: ISaveProgressRequestData, pmcData: IPmcData, insuranceEnabled: boolean, preRaidGear: Item[], sessionID: string): IPmcData; + /** + * Adjust player characters bodypart hp if they left raid early + * @param postRaidSaveRequest post raid data + * @param pmcData player profile + */ + protected updatePmcHealthPostRaid(postRaidSaveRequest: ISaveProgressRequestData, pmcData: IPmcData): void; /** * Reduce body part hp to % of max * @param pmcData profile to edit @@ -68,7 +100,31 @@ export declare class InraidController { * @param isPlayerScav Was the player a pScav */ protected markOrRemoveFoundInRaidItems(offraidData: ISaveProgressRequestData, pmcData: IPmcData, isPlayerScav: boolean): void; + /** + * Update profile after player completes scav raid + * @param scavData Scav profile + * @param sessionID Session id + * @param offraidData Post-raid save request + * @param pmcData Pmc profile + * @param isDead Is player dead + */ protected handlePostRaidPlayerScavProcess(scavData: IPmcData, sessionID: string, offraidData: ISaveProgressRequestData, pmcData: IPmcData, isDead: boolean): void; + /** + * Update profile with scav karma values based on in-raid actions + * @param pmcData Pmc profile + * @param offraidData Post-raid save request + * @param scavData Scav profile + * @param sessionID Session id + */ protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData, scavData: IPmcData, sessionID: string): void; + /** + * Get the inraid config from configs/inraid.json + * @returns InRaid Config + */ + getInraidConfig(): IInRaidConfig; + /** + * Get airdrop config from configs/airdrop.json + * @returns Airdrop config + */ getAirdropConfig(): IAirdropConfig; } diff --git a/TypeScript/12ClassExtensionOverride/types/controllers/InsuranceController.d.ts b/TypeScript/12ClassExtensionOverride/types/controllers/InsuranceController.d.ts index 14bf129..54f31b5 100644 --- a/TypeScript/12ClassExtensionOverride/types/controllers/InsuranceController.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/controllers/InsuranceController.d.ts @@ -30,8 +30,7 @@ export declare class InsuranceController { protected insuranceService: InsuranceService; protected configServer: ConfigServer; protected insuranceConfig: IInsuranceConfig; - constructor(logger: ILogger, randomUtil: RandomUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, paymentService: PaymentService, // TODO: delay required - insuranceService: InsuranceService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, paymentService: PaymentService, insuranceService: InsuranceService, configServer: ConfigServer); processReturn(): void; insure(pmcData: IPmcData, body: IInsureRequestData, sessionID: string): IItemEventRouterResponse; /** diff --git a/TypeScript/12ClassExtensionOverride/types/controllers/InventoryController.d.ts b/TypeScript/12ClassExtensionOverride/types/controllers/InventoryController.d.ts index 6a1a21e..e1c08c0 100644 --- a/TypeScript/12ClassExtensionOverride/types/controllers/InventoryController.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/controllers/InventoryController.d.ts @@ -1,8 +1,8 @@ -import { EventOutputHolder } from "../routers/EventOutputHolder"; import { InventoryHelper } from "../helpers/InventoryHelper"; import { PaymentHelper } from "../helpers/PaymentHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IAddItemRequestData } from "../models/eft/inventory/IAddItemRequestData"; import { IInventoryBindRequestData } from "../models/eft/inventory/IInventoryBindRequestData"; @@ -21,33 +21,46 @@ import { IInventorySwapRequestData } from "../models/eft/inventory/IInventorySwa import { IInventoryTagRequestData } from "../models/eft/inventory/IInventoryTagRequestData"; import { IInventoryToggleRequestData } from "../models/eft/inventory/IInventoryToggleRequestData"; import { IInventoryTransferRequestData } from "../models/eft/inventory/IInventoryTransferRequestData"; +import { IOpenRandomLootContainerRequestData } from "../models/eft/inventory/IOpenRandomLootContainerRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { ILogger } from "../models/spt/utils/ILogger"; +import { EventOutputHolder } from "../routers/EventOutputHolder"; import { DatabaseServer } from "../servers/DatabaseServer"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { HashUtil } from "../utils/HashUtil"; +import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { JsonUtil } from "../utils/JsonUtil"; +import { RandomUtil } from "../utils/RandomUtil"; export declare class InventoryController { protected logger: ILogger; protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; + protected randomUtil: RandomUtil; protected databaseServer: DatabaseServer; protected fenceService: FenceService; protected presetHelper: PresetHelper; protected inventoryHelper: InventoryHelper; protected ragfairOfferService: RagfairOfferService; protected profileHelper: ProfileHelper; + protected weightedRandomHelper: WeightedRandomHelper; protected paymentHelper: PaymentHelper; + protected localisationService: LocalisationService; protected eventOutputHolder: EventOutputHolder; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder); + protected httpResponseUtil: HttpResponseUtil; + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, weightedRandomHelper: WeightedRandomHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); /** * Move Item * change location of item with parentId and slotId * transfers items from one profile to another if fromOwner/toOwner is set in the body. * otherwise, move is contained within the same profile_f. - */ - moveItem(pmcData: IPmcData, body: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; + * @param pmcData Profile + * @param moveRequest Move request data + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ + moveItem(pmcData: IPmcData, moveRequest: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; /** * Remove Item from Profile * Deep tree item deletion, also removes items from insurance list @@ -122,4 +135,12 @@ export declare class InventoryController { createMapMarker(pmcData: IPmcData, body: IInventoryCreateMarkerRequestData, sessionID: string): IItemEventRouterResponse; deleteMapMarker(pmcData: IPmcData, body: IInventoryDeleteMarkerRequestData, sessionID: string): IItemEventRouterResponse; editMapMarker(pmcData: IPmcData, body: IInventoryEditMarkerRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle event fired when a container is unpacked (currently only the halloween pumpkin) + * @param pmcData Profile data + * @param body open loot container request data + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ + openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/12ClassExtensionOverride/types/controllers/LocationController.d.ts b/TypeScript/12ClassExtensionOverride/types/controllers/LocationController.d.ts index 9db3205..b6feba8 100644 --- a/TypeScript/12ClassExtensionOverride/types/controllers/LocationController.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/controllers/LocationController.d.ts @@ -7,6 +7,7 @@ import { LootItem } from "../models/spt/services/LootItem"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -15,12 +16,13 @@ export declare class LocationController { protected hashUtil: HashUtil; protected logger: ILogger; protected locationGenerator: LocationGenerator; + protected localisationService: LocalisationService; protected lootGenerator: LootGenerator; protected databaseServer: DatabaseServer; protected timeUtil: TimeUtil; protected configServer: ConfigServer; protected airdropConfig: IAirdropConfig; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, logger: ILogger, locationGenerator: LocationGenerator, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer); + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer); get(location: string): ILocationBase; generate(name: string): ILocationBase; generateAll(): ILocationsGenerateAllResponse; diff --git a/TypeScript/12ClassExtensionOverride/types/controllers/MatchController.d.ts b/TypeScript/12ClassExtensionOverride/types/controllers/MatchController.d.ts index dac6a3f..2b0d150 100644 --- a/TypeScript/12ClassExtensionOverride/types/controllers/MatchController.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/controllers/MatchController.d.ts @@ -19,7 +19,6 @@ import { SaveServer } from "../servers/SaveServer"; import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; import { BotLootCacheService } from "../services/BotLootCacheService"; import { MatchLocationService } from "../services/MatchLocationService"; -import { PmcAiService } from "../services/PmcAiService"; import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; export declare class MatchController { protected logger: ILogger; @@ -30,13 +29,12 @@ export declare class MatchController { protected botLootCacheService: BotLootCacheService; protected configServer: ConfigServer; protected profileSnapshotService: ProfileSnapshotService; - protected pmcAiService: PmcAiService; protected botGenerationCacheService: BotGenerationCacheService; 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, pmcAiService: PmcAiService, botGenerationCacheService: BotGenerationCacheService, applicationContext: ApplicationContext); + constructor(logger: ILogger, saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, botGenerationCacheService: BotGenerationCacheService, applicationContext: ApplicationContext); getEnabled(): boolean; getProfile(info: IGetProfileRequestData): IPmcData[]; createGroup(sessionID: string, info: ICreateGroupRequestData): any; diff --git a/TypeScript/12ClassExtensionOverride/types/controllers/RagfairController.d.ts b/TypeScript/12ClassExtensionOverride/types/controllers/RagfairController.d.ts index 5440458..95702f2 100644 --- a/TypeScript/12ClassExtensionOverride/types/controllers/RagfairController.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/controllers/RagfairController.d.ts @@ -29,6 +29,7 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { RagfairServer } from "../servers/RagfairServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; import { PaymentService } from "../services/PaymentService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { RagfairPriceService } from "../services/RagfairPriceService"; @@ -62,9 +63,10 @@ export declare class RagfairController { protected ragfairOfferService: RagfairOfferService; protected ragfairRequiredItemsService: RagfairRequiredItemsService; protected ragfairOfferGenerator: RagfairOfferGenerator; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, eventOutputHolder: EventOutputHolder, ragfairServer: RagfairServer, ragfairPriceService: RagfairPriceService, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer, ragfairSellHelper: RagfairSellHelper, ragfairTaxHelper: RagfairTaxHelper, ragfairSortHelper: RagfairSortHelper, ragfairOfferHelper: RagfairOfferHelper, profileHelper: ProfileHelper, paymentService: PaymentService, handbookHelper: HandbookHelper, paymentHelper: PaymentHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, ragfairOfferGenerator: RagfairOfferGenerator, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, eventOutputHolder: EventOutputHolder, ragfairServer: RagfairServer, ragfairPriceService: RagfairPriceService, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer, ragfairSellHelper: RagfairSellHelper, ragfairTaxHelper: RagfairTaxHelper, ragfairSortHelper: RagfairSortHelper, ragfairOfferHelper: RagfairOfferHelper, profileHelper: ProfileHelper, paymentService: PaymentService, handbookHelper: HandbookHelper, paymentHelper: PaymentHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, ragfairOfferGenerator: RagfairOfferGenerator, localisationService: LocalisationService, configServer: ConfigServer); getOffers(sessionID: string, info: ISearchRequestData): IGetOffersResult; /** * Get offers for the client based on type of search being performed @@ -103,7 +105,12 @@ export declare class RagfairController { protected isLinkedSearch(info: ISearchRequestData): boolean; protected isRequiredSearch(info: ISearchRequestData): boolean; update(): void; - getItemPrice(info: IGetMarketPriceRequestData): IGetItemPriceResult; + /** + * Called when creating an offer on flea, fills values in top right corner + * @param getPriceRequest + * @returns min/avg/max values for an item based on flea offers available + */ + getItemMinAvgMaxFleaPriceValues(getPriceRequest: IGetMarketPriceRequestData): IGetItemPriceResult; addPlayerOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; createPlayerOffer(profile: IAkiProfile, requirements: Requirement[], items: Item[], sellInOnePiece: boolean, amountToSend: number): IRagfairOffer; getAllFleaPrices(): Record; diff --git a/TypeScript/12ClassExtensionOverride/types/controllers/RepeatableQuestController.d.ts b/TypeScript/12ClassExtensionOverride/types/controllers/RepeatableQuestController.d.ts index 7db5886..333583b 100644 --- a/TypeScript/12ClassExtensionOverride/types/controllers/RepeatableQuestController.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/controllers/RepeatableQuestController.d.ts @@ -17,6 +17,7 @@ import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { ItemFilterService } from "../services/ItemFilterService"; +import { LocalisationService } from "../services/LocalisationService"; import { PaymentService } from "../services/PaymentService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { JsonUtil } from "../utils/JsonUtil"; @@ -64,12 +65,13 @@ export declare class RepeatableQuestController { protected profileFixerService: ProfileFixerService; protected ragfairServerHelper: RagfairServerHelper; protected eventOutputHolder: EventOutputHolder; + protected localisationService: LocalisationService; protected paymentService: PaymentService; protected objectId: ObjectId; protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * This is the method reached by the /client/repeatalbeQuests/activityPeriods endpoint * Returns an array of objects in the format of repeatable quests to the client. diff --git a/TypeScript/12ClassExtensionOverride/types/controllers/WeatherController.d.ts b/TypeScript/12ClassExtensionOverride/types/controllers/WeatherController.d.ts index ca7f5eb..631a90c 100644 --- a/TypeScript/12ClassExtensionOverride/types/controllers/WeatherController.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/controllers/WeatherController.d.ts @@ -1,11 +1,18 @@ import { WeatherGenerator } from "../generators/WeatherGenerator"; import { IWeatherData } from "../models/eft/weather/IWeatherData"; import { IWeatherConfig } from "../models/spt/config/IWeatherConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; export declare class WeatherController { protected weatherGenerator: WeatherGenerator; + protected logger: ILogger; protected configServer: ConfigServer; protected weatherConfig: IWeatherConfig; - constructor(weatherGenerator: WeatherGenerator, configServer: ConfigServer); + constructor(weatherGenerator: WeatherGenerator, logger: ILogger, configServer: ConfigServer); generate(): IWeatherData; + /** + * Get the current in-raid time (MUST HAVE PLAYER LOGGED INTO CLIENT TO WORK) + * @returns Date object + */ + getCurrentInRaidTime(): Date; } diff --git a/TypeScript/12ClassExtensionOverride/types/generators/BotGenerator.d.ts b/TypeScript/12ClassExtensionOverride/types/generators/BotGenerator.d.ts index 2ac51db..a1ac9ed 100644 --- a/TypeScript/12ClassExtensionOverride/types/generators/BotGenerator.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/generators/BotGenerator.d.ts @@ -1,7 +1,8 @@ +import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; import { GameEventHelper } from "../helpers/GameEventHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; -import { IGenerateBotsRequestData } from "../models/eft/bot/IGenerateBotsRequestData"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { Health as PmcHealth, IBotBase, Skills } from "../models/eft/common/tables/IBotBase"; import { Health, IBotType, Inventory } from "../models/eft/common/tables/IBotType"; import { IBotConfig } from "../models/spt/config/IBotConfig"; @@ -9,7 +10,6 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; -import { PmcAiService } from "../services/PmcAiService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; @@ -29,12 +29,13 @@ export declare class BotGenerator { protected databaseServer: DatabaseServer; protected botInventoryGenerator: BotInventoryGenerator; protected botEquipmentFilterService: BotEquipmentFilterService; + protected weightedRandomHelper: WeightedRandomHelper; protected botHelper: BotHelper; + protected botDifficultyHelper: BotDifficultyHelper; protected gameEventHelper: GameEventHelper; - protected pmcAiService: PmcAiService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botEquipmentFilterService: BotEquipmentFilterService, botHelper: BotHelper, gameEventHelper: GameEventHelper, pmcAiService: PmcAiService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botEquipmentFilterService: BotEquipmentFilterService, weightedRandomHelper: WeightedRandomHelper, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, gameEventHelper: GameEventHelper, configServer: ConfigServer); /** * Generate a player scav bot object * @param role e.g. assault / pmcbot @@ -44,12 +45,18 @@ export declare class BotGenerator { */ generatePlayerScav(sessionId: string, role: string, difficulty: string, botTemplate: IBotType): IBotBase; /** - * Generate an array of bot objects for populate a raid with + * Generate an array of bot objects based on a condition for a raid with * @param sessionId session id - * @param info request object + * @param condition request condition * @returns bot array */ - generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; + generateByCondition(sessionId: string, botCountToGenerate: number, difficulty: string, role: string, isPmc: boolean): IBotBase[]; + /** + * Get the PMCs wildSpawnType value + * @param role "usec" / "bear" + * @returns wildSpawnType value as string + */ + protected getPmcRoleByDescription(role: string): string; /** * Get a randomised PMC side based on bot config value 'isUsec' * @returns pmc side as string @@ -64,13 +71,13 @@ export declare class BotGenerator { * Create a IBotBase object with equipment/loot/exp etc * @param sessionId Session id * @param bot bots base file - * @param role botRole bot will use + * @param botRole Role bot will use (bear/usec for PMCs) * @param node Bot template from db/bots/x.json * @param isPmc Is bot to be a PMC * @param isPlayerScav is bot to be a p scav bot * @returns IBotBase object */ - protected generateBot(sessionId: string, bot: IBotBase, role: string, node: IBotType, isPmc: boolean, isPlayerScav?: boolean): IBotBase; + protected generateBot(sessionId: string, bot: IBotBase, botRole: string, node: IBotType, isPmc: boolean, isPlayerScav?: boolean): IBotBase; /** * Log the number of PMCs generated to the debug console * @param output Generated bot array, ready to send to client diff --git a/TypeScript/12ClassExtensionOverride/types/generators/BotInventoryGenerator.d.ts b/TypeScript/12ClassExtensionOverride/types/generators/BotInventoryGenerator.d.ts index c5ed545..e1efaf2 100644 --- a/TypeScript/12ClassExtensionOverride/types/generators/BotInventoryGenerator.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/generators/BotInventoryGenerator.d.ts @@ -7,6 +7,7 @@ import { IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { BotLootGenerator } from "./BotLootGenerator"; @@ -20,14 +21,68 @@ export declare class BotInventoryGenerator { protected botLootGenerator: BotLootGenerator; protected botGeneratorHelper: BotGeneratorHelper; protected weightedRandomHelper: WeightedRandomHelper; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, configServer: ConfigServer); + /** + * Add equipment/weapons/loot to bot + * @param sessionId Session id + * @param templateInventory bot/x.json data from db + * @param equipmentChances Chances each item will be added to bot + * @param itemGenerationLimitsMinMax item gen limits for bot role + * @param botRole Role bot has (assault/pmcBot) + * @param isPmc Is bot being converted into a pmc + * @returns PmcInventory object with equipment/weapons/loot + */ generateInventory(sessionId: string, templateInventory: Inventory, equipmentChances: Chances, itemGenerationLimitsMinMax: Generation, botRole: string, isPmc: boolean): PmcInventory; + /** + * Create a pmcInventory object with all the base/generic items needed + * @returns PmcInventory object + */ + protected generateInventoryBase(): PmcInventory; + /** + * Add equipment to a bot + * @param templateInventory bot/x.json data from db + * @param equipmentChances Chances items will be added to bot + * @param botRole Role bot has (assault/pmcBot) + * @param botInventory Inventory to add equipment to + */ + protected generateAndAddEquipmentToBot(templateInventory: Inventory, equipmentChances: Chances, botRole: string, botInventory: PmcInventory): void; + protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory): void; + /** + * Work out what weapons bot should have equipped and add them to bot inventory + * @param templateInventory bot/x.json data from db + * @param equipmentChances Chances bot can have equipment equipped + * @param sessionId Session id + * @param botInventory Inventory to add weapons to + * @param botRole assault/pmcBot/bossTagilla etc + * @param isPmc Is the bot being generated as a pmc + * @param itemGenerationLimitsMinMax Limits for items the bot can have + */ + protected generateAndAddWeaponsToBot(templateInventory: Inventory, equipmentChances: Chances, sessionId: string, botInventory: PmcInventory, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation): void; + /** + * Calculate if the bot should have weapons in Primary/Secondary/Holster slots + * @param equipmentChances Chances bot has certain equipment + * @returns What slots bot should have weapons generated for + */ + protected getDesiredWeaponsForBot(equipmentChances: Chances): { + slot: EquipmentSlots; + shouldSpawn: boolean; + }[]; + /** + * Add weapon + spare mags/ammo to bots inventory + * @param sessionId Session id + * @param weaponSlot Weapon slot being generated + * @param templateInventory bot/x.json data from db + * @param botInventory Inventory to add weapon+mags/ammo to + * @param equipmentChances Chances bot can have equipment equipped + * @param botRole assault/pmcBot/bossTagilla etc + * @param isPmc Is the bot being generated as a pmc + * @param itemGenerationLimitsMinMax + */ protected addWeaponAndMagazinesToInventory(sessionId: string, weaponSlot: { slot: EquipmentSlots; shouldSpawn: boolean; }, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation): void; - protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory): void; - protected generateInventoryBase(): PmcInventory; } diff --git a/TypeScript/12ClassExtensionOverride/types/generators/BotLootGenerator.d.ts b/TypeScript/12ClassExtensionOverride/types/generators/BotLootGenerator.d.ts index c1f5310..3352a46 100644 --- a/TypeScript/12ClassExtensionOverride/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/generators/BotLootGenerator.d.ts @@ -10,6 +10,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotLootCacheService } from "../services/BotLootCacheService"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { BotWeaponGenerator } from "./BotWeaponGenerator"; @@ -23,9 +24,10 @@ export declare class BotLootGenerator { protected botWeaponGenerator: BotWeaponGenerator; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected botLootCacheService: BotLootCacheService; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, configServer: ConfigServer); generateLoot(sessionId: string, templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances): void; protected getRandomisedCount(min: number, max: number, nValue: number): number; /** @@ -113,7 +115,7 @@ export declare class BotLootGenerator { * If no limit found for a non pmc bot, fall back to defaults * @param isPmc is the bot we want limits for a pmc * @param botRole what role does the bot have - * @returns dictionary of tplIds and limit + * @returns Dictionary of tplIds and limit */ protected getItemSpawnLimitsForBotType(isPmc: boolean, botRole: string): Record; /** diff --git a/TypeScript/12ClassExtensionOverride/types/generators/BotWeaponGenerator.d.ts b/TypeScript/12ClassExtensionOverride/types/generators/BotWeaponGenerator.d.ts index 487901b..40284ea 100644 --- a/TypeScript/12ClassExtensionOverride/types/generators/BotWeaponGenerator.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/generators/BotWeaponGenerator.d.ts @@ -12,6 +12,7 @@ import { IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; @@ -27,10 +28,11 @@ export declare class BotWeaponGenerator { protected randomUtil: RandomUtil; protected configServer: ConfigServer; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected localisationService: LocalisationService; protected inventoryMagGenComponents: IInventoryMagGen[]; protected readonly modMagazineSlotId = "mod_magazine"; protected botConfig: IBotConfig; - constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil, configServer: ConfigServer, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, inventoryMagGenComponents: IInventoryMagGen[]); + constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil, configServer: ConfigServer, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, inventoryMagGenComponents: IInventoryMagGen[]); /** * Pick a random weapon based on weightings and generate a functional weapon * @param equipmentSlot Primary/secondary/holster diff --git a/TypeScript/12ClassExtensionOverride/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/12ClassExtensionOverride/types/generators/RagfairOfferGenerator.d.ts index b64a7e7..23882d2 100644 --- a/TypeScript/12ClassExtensionOverride/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/generators/RagfairOfferGenerator.d.ts @@ -1,16 +1,19 @@ +import { HandbookHelper } from "../helpers/HandbookHelper"; import { ItemHelper } from "../helpers/ItemHelper"; +import { PaymentHelper } from "../helpers/PaymentHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; import { Item } from "../models/eft/common/tables/IItem"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { IBarterScheme } from "../models/eft/common/tables/ITrader"; -import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; +import { IRagfairOffer, OfferRequirement } from "../models/eft/ragfair/IRagfairOffer"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { RagfairCategoriesService } from "../services/RagfairCategoriesService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { RagfairPriceService } from "../services/RagfairPriceService"; @@ -27,18 +30,31 @@ export declare class RagfairOfferGenerator { protected timeUtil: TimeUtil; protected databaseServer: DatabaseServer; protected ragfairServerHelper: RagfairServerHelper; + protected handbookHelper: HandbookHelper; protected saveServer: SaveServer; protected presetHelper: PresetHelper; protected ragfairAssortGenerator: RagfairAssortGenerator; protected ragfairOfferService: RagfairOfferService; protected ragfairPriceService: RagfairPriceService; + protected localisationService: LocalisationService; + protected paymentHelper: PaymentHelper; protected ragfairCategoriesService: RagfairCategoriesService; protected fenceService: FenceService; protected itemHelper: ItemHelper; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, ragfairServerHelper: RagfairServerHelper, saveServer: SaveServer, presetHelper: PresetHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferService: RagfairOfferService, ragfairPriceService: RagfairPriceService, ragfairCategoriesService: RagfairCategoriesService, fenceService: FenceService, itemHelper: ItemHelper, configServer: ConfigServer); + protected allowedFleaPriceItemsForBarter: { + tpl: string; + price: number; + }[]; + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, ragfairServerHelper: RagfairServerHelper, handbookHelper: HandbookHelper, saveServer: SaveServer, presetHelper: PresetHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferService: RagfairOfferService, ragfairPriceService: RagfairPriceService, localisationService: LocalisationService, paymentHelper: PaymentHelper, ragfairCategoriesService: RagfairCategoriesService, fenceService: FenceService, itemHelper: ItemHelper, configServer: ConfigServer); createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; + /** + * Calculate the offer price that's listed on the flea listing + * @param offerRequirements barter requirements for offer + * @returns rouble cost of offer + */ + protected calculateOfferListingPrice(offerRequirements: OfferRequirement[]): number; /** * Get avatar url from trader table in db * @param isTrader Is user we're getting avatar for a trader @@ -87,20 +103,36 @@ export declare class RagfairOfferGenerator { * @returns Item with conditions added */ protected addMissingCondition(item: Item): Item; - protected getOfferRequirements(items: Item[]): { - count: number; - _tpl: string; + /** + * Create a barter-based barter scheme, if not possible, fall back to making barter scheme currency based + * @param offerItems Items for sale in offer + * @returns barter scheme + */ + protected createBarterRequirement(offerItems: Item[]): IBarterScheme[]; + /** + * Get an array of flea prices + item tpl, cached in generator class + * @returns array with tpl/price values + */ + protected getFleaPricesAsArray(): { + tpl: string; + price: number; }[]; + /** + * Create a random currency-based barter scheme for an array of items + * @param offerItems Items on offer + * @returns Barter scheme for offer + */ + protected createCurrencyRequirement(offerItems: Item[]): IBarterScheme[]; /** * Create a flea offer and store it in the Ragfair server offers array * @param userID owner of the offer * @param time time offer is put up * @param items items in the offer - * @param barterScheme - * @param loyalLevel + * @param barterScheme cost of item (currency or barter) + * @param loyalLevel Loyalty level needed to buy item * @param price price of offer * @param sellInOnePiece - * @returns + * @returns Ragfair offer */ createFleaOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; } diff --git a/TypeScript/12ClassExtensionOverride/types/generators/WeatherGenerator.d.ts b/TypeScript/12ClassExtensionOverride/types/generators/WeatherGenerator.d.ts index 8ddbe49..65d2c76 100644 --- a/TypeScript/12ClassExtensionOverride/types/generators/WeatherGenerator.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/generators/WeatherGenerator.d.ts @@ -1,38 +1,54 @@ +import { ApplicationContext } from "../context/ApplicationContext"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; -import { IWeatherData } from "../models/eft/weather/IWeatherData"; +import { IWeather, IWeatherData } from "../models/eft/weather/IWeatherData"; +import { WindDirection } from "../models/enums/WindDirection"; import { IWeatherConfig } from "../models/spt/config/IWeatherConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class WeatherGenerator { protected weightedRandomHelper: WeightedRandomHelper; + protected logger: ILogger; protected randomUtil: RandomUtil; protected timeUtil: TimeUtil; + protected applicationContext: ApplicationContext; protected configServer: ConfigServer; protected weatherConfig: IWeatherConfig; - constructor(weightedRandomHelper: WeightedRandomHelper, randomUtil: RandomUtil, timeUtil: TimeUtil, configServer: ConfigServer); - calculateTime(data: IWeatherData): IWeatherData; + constructor(weightedRandomHelper: WeightedRandomHelper, logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, applicationContext: ApplicationContext, configServer: ConfigServer); + calculateGameTime(data: IWeatherData): IWeatherData; /** * Get server uptime seconds multiplied by a multiplier and add to current time as seconds * Format to BSGs requirements - * @param computedDate current date + * @param currentDate current date * @returns formatted time */ - protected getAcceleratedTime(computedDate: Date): string; + protected getBsgFormattedInRaidTime(currentDate: Date): string; + /** + * Get the current in-raid time + * @param currentDate (new Date()) + * @returns Date object of current in-raid time + */ + getInRaidTime(currentDate: Date): Date; /** * Get current time formatted to fit BSGs requirement - * @param computedDate date to format into bsg style + * @param date date to format into bsg style * @returns */ - protected getNormalTime(computedDate: Date): string; + protected getBSGFormattedTime(date: Date): string; /** - * Return randomised Weather data - * @param weatherData weather input data + * Return randomised Weather data with help of config/weather.json * @returns Randomised weather data */ - generateWeather(weatherData: IWeatherData): IWeatherData; - protected getWeightedFog(): string; + generateWeather(): IWeather; + /** + * Set IWeather date/time/timestamp values to now + * @param weather Object to update + */ + protected setCurrentDateTime(weather: IWeather): void; + protected getWeightedWindDirection(): WindDirection; + protected getWeightedWindSpeed(): number; + protected getWeightedFog(): number; protected getWeightedRain(): number; protected getRandomFloat(node: string): number; - protected getRandomInt(node: string): number; } diff --git a/TypeScript/12ClassExtensionOverride/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts b/TypeScript/12ClassExtensionOverride/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts index 4fcb1e2..1589707 100644 --- a/TypeScript/12ClassExtensionOverride/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts @@ -1,13 +1,15 @@ import { BotWeaponGeneratorHelper } from "../../../helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "../../../helpers/ItemHelper"; import { ILogger } from "../../../models/spt/utils/ILogger"; +import { LocalisationService } from "../../../services/LocalisationService"; import { IInventoryMagGen } from "../IInventoryMagGen"; import { InventoryMagGen } from "../InventoryMagGen"; export declare class ExternalInventoryMagGen implements IInventoryMagGen { protected logger: ILogger; protected itemHelper: ItemHelper; + protected localisationService: LocalisationService; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; - constructor(logger: ILogger, itemHelper: ItemHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper); + constructor(logger: ILogger, itemHelper: ItemHelper, localisationService: LocalisationService, botWeaponGeneratorHelper: BotWeaponGeneratorHelper); getPriority(): number; canHandleInventoryMagGen(inventoryMagGen: InventoryMagGen): boolean; process(inventoryMagGen: InventoryMagGen): void; diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/BotDifficultyHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/BotDifficultyHelper.d.ts new file mode 100644 index 0000000..a58ebdb --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/helpers/BotDifficultyHelper.d.ts @@ -0,0 +1,46 @@ +import { Difficulty } from "../models/eft/common/tables/IBotType"; +import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; +import { JsonUtil } from "../utils/JsonUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +import { BotHelper } from "./BotHelper"; +export declare class BotDifficultyHelper { + protected logger: ILogger; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected randomUtil: RandomUtil; + protected localisationService: LocalisationService; + protected botHelper: BotHelper; + protected configServer: ConfigServer; + protected botConfig: IBotConfig; + constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, localisationService: LocalisationService, botHelper: BotHelper, configServer: ConfigServer); + getPmcDifficultySettings(pmcType: "bear" | "usec", difficulty: string, usecType: string, bearType: string): Difficulty; + /** + * Get difficulty settings for desired bot type, if not found use assault bot types + * @param type bot type to retreive difficulty of + * @param difficulty difficulty to get settings for (easy/normal etc) + * @returns Difficulty object + */ + getBotDifficultySettings(type: string, difficulty: string): Difficulty; + /** + * Get difficulty settings for a PMC + * @param type "usec" / "bear" + * @param difficulty what difficulty to retrieve + * @returns Difficulty object + */ + protected getDifficultySettings(type: string, difficulty: string): Difficulty; + /** + * Translate chosen value from pre-raid difficulty dropdown into bot difficulty value + * @param dropDownDifficulty Dropdown difficulty value to convert + * @returns bot difficulty + */ + convertBotDifficultyDropdownToBotDifficulty(dropDownDifficulty: string): string; + /** + * Choose a random difficulty from - easy/normal/hard/impossible + * @returns random difficulty + */ + chooseRandomDifficulty(): string; +} diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/BotGeneratorHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/BotGeneratorHelper.d.ts index 5e3e501..899669e 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/BotGeneratorHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/BotGeneratorHelper.d.ts @@ -8,6 +8,7 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; import { ItemFilterService } from "../services/ItemFilterService"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; @@ -43,9 +44,10 @@ export declare class BotGeneratorHelper { protected itemFilterService: ItemFilterService; protected profileHelper: ProfileHelper; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Check mods are compatible and add to array * @param equipment Equipment item to add mods to @@ -53,9 +55,11 @@ export declare class BotGeneratorHelper { * @param parentId parentid of item to add mod to * @param parentTemplate template objet of item to add mods to * @param modSpawnChances dictionary of mod items and their chance to spawn for this bot type + * @param botRole the bot role being generated for + * @param forceSpawn should this mod be forced to spawn * @returns Item + compatible mods as an array */ - generateModsForEquipment(equipment: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances): Item[]; + generateModsForEquipment(equipment: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances, botRole: string, forceSpawn?: boolean): Item[]; /** * @param sessionId session id * @param weapon Weapon to add mods to @@ -70,15 +74,15 @@ export declare class BotGeneratorHelper { generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponParentId: string, parentWeaponTemplate: ITemplateItem, modSpawnChances: ModsChances, ammoTpl: string, botRole: string): Item[]; /** * - * @param modSlot - * @param isRandomisableSlot - * @param modsParent - * @param botEquipBlacklist - * @param itemModPool + * @param modSlot Slot mod will fit into + * @param isRandomisableSlot Will generate a randomised mod pool if true + * @param modsParent Parent slot the item will be a part of + * @param botEquipBlacklist Blacklist to prevent mods from being picked + * @param itemModPool Pool of items to pick from * @param weapon array with only weapon tpl in it, ready for mods to be added * @param ammoTpl ammo tpl to use if slot requires a cartridge to be added (e.g. mod_magazine) - * @param parentTemplate - * @returns + * @param parentTemplate Parent item the mod will go into + * @returns ITemplateItem */ protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, modsParent: Slot, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem): [boolean, ITemplateItem]; /** @@ -114,8 +118,10 @@ export declare class BotGeneratorHelper { * Find all compatible mods for equipment item and add to modPool * @param itemDetails item to find mods for * @param modPool ModPool to add mods to + * @param equipmentBlacklist equipment not allowed to be used by the bot + * @param botEquipmentRole bot type to generate pool for (e.g. assault, pmcBot, pmc for usec/bear) */ - generateDynamicModPool(itemDetails: ITemplateItem, modPool: Mods): void; + generateDynamicModPool(itemDetails: ITemplateItem, modPool: Mods, equipmentBlacklist: EquipmentFilterDetails[], botEquipmentRole: string): void; /** * Take a list of tpls and filter out blacklisted values using itemFilterService + botEquipmentBlacklist * @param allowedMods base mods to filter @@ -153,7 +159,7 @@ export declare class BotGeneratorHelper { * @param modTemplate Used to add additional properites in the upd object * @returns Item object */ - protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem): Item; + protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem, botRole: string): Item; /** * randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot * never return true for an item that has 0% spawn chance @@ -170,10 +176,10 @@ export declare class BotGeneratorHelper { */ protected getAmmoContainers(): string[]; /** - * Get the slot details for an item (chamber/cartridge/slot) + * Get a Slot property for an item (chamber/cartridge/slot) * @param modSlot e.g patron_in_weapon * @param parentTemplate item template - * @returns + * @returns Slot item */ protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; /** @@ -185,7 +191,6 @@ export declare class BotGeneratorHelper { * @param modPool modPool which should include available cartrigdes * @param parentId The CylinderMagazine's UID * @param parentTemplate The CylinderMagazine's template - * @returns */ protected fillCamora(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem): void; /** @@ -197,11 +202,11 @@ export declare class BotGeneratorHelper { /** * Adds properties to an item * e.g. Repairable / HasHinge / Foldable / MaxDurability - * @param itemTemplate - * @param botRole Used by weapons to randomise the durability values + * @param itemTemplate Item extra properties are being generated for + * @param botRole Used by weapons to randomise the durability values. Null for non-equipped items * @returns Item Upd object with extra properties */ - generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: any): { + generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: string): { upd?: Upd; }; /** @@ -220,21 +225,27 @@ export declare class BotGeneratorHelper { protected generateArmorRepairableProperties(itemTemplate: ITemplateItem, botRole: string): Repairable; /** * Get a random mod from an items compatible mods Filter array - * @param modTpl - * @param parentSlot - * @param modSlot - * @param items + * @param modTpl ???? + * @param parentSlot item mod will go into, used to get combatible items + * @param modSlot Slot to get mod to fill + * @param items items to ensure picked mod is compatible with * @returns item tpl */ protected getModTplFromItemDb(modTpl: string, parentSlot: Slot, modSlot: string, items: Item[]): string; /** * Can an item be added to an item without issue - * @param items - * @param tplToCheck - * @param equipmentSlot - * @returns true if possible + * @param items items to check compatiblilities with + * @param tplToCheck tpl of the item to check for incompatibilities + * @param equipmentSlot Slot the item will be placed into + * @returns false if no incompatibilties */ isItemIncompatibleWithCurrentItems(items: Item[], tplToCheck: string, equipmentSlot: string): boolean; + /** + * Convert a bots role to the equipment role used in config/bot.json + * @param botRole Role to convert + * @returns Equipment role (e.g. pmc / assault / bossTagilla) + */ + getBotEquipmentRole(botRole: string): string; } /** TODO - move into own class */ export declare class ExhaustableArray { diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/BotHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/BotHelper.d.ts index 67a6384..a7f779e 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/BotHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/BotHelper.d.ts @@ -3,6 +3,7 @@ import { IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; export declare class BotHelper { @@ -10,46 +11,27 @@ export declare class BotHelper { protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, configServer: ConfigServer); - /** - * Get difficulty settings for desired bot type, if not found use assault bot types - * @param type bot type to retreive difficulty of - * @param difficulty difficulty to get settings for (easy/normal etc) - * @returns Difficulty object - */ - getBotDifficultySettings(type: string, difficulty: string): Difficulty; + constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, localisationService: LocalisationService, configServer: ConfigServer); /** * Get a template object for the specified botRole from bots.types db * @param role botRole to get template for * @returns IBotType object */ getBotTemplate(role: string): IBotType; - /** - * Get difficulty settings for a PMC - * @param type "usec" / "bear" - * @param difficulty what difficulty to retrieve - * @returns Difficulty object - */ - getPmcDifficultySettings(type: string, difficulty: string): Difficulty; - /** - * Translate chosen value from pre-raid difficulty dropdown into bot difficulty value - * @param dropDownDifficulty Dropdown difficulty value to convert - * @returns bot difficulty - */ - convertBotDifficultyDropdownToBotDifficulty(dropDownDifficulty: string): string; - /** - * Choose a random difficulty from - easy/normal/hard/impossible - * @returns random difficulty - */ - chooseRandomDifficulty(): string; /** * Randomise the chance the PMC will attack their own side * Look up value in bot.json/chanceSameSideIsHostilePercent * @param difficultySettings pmc difficulty settings */ randomisePmcHostility(difficultySettings: Difficulty): void; + /** + * Is the passed in bot role a PMC (usec/bear/pmc) + * @param botRole bot role to check + * @returns true if is pmc + */ isBotPmc(botRole: string): boolean; isBotBoss(botRole: string): boolean; isBotFollower(botRole: string): boolean; diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/GameEventHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/GameEventHelper.d.ts index fca87be..fa25eff 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/GameEventHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/GameEventHelper.d.ts @@ -15,4 +15,15 @@ export declare class GameEventHelper { * @returns Record with event name + start/end date */ getEventDetails(): ISeasonalEvent[]; + /** + * Is detection of seasonal events enabled (halloween / christmas) + * @returns true if seasonal events should be checked for + */ + isAutomaticEventDetectionEnabled(): boolean; + /** + * Get a dictionary of gear changes to apply to bots for a specific event e.g. Christmas/Halloween + * @param eventName Name of event to get gear changes for + * @returns bots with equipment changes + */ + getEventBotGear(eventName: string): Record>>; } diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/HideoutHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/HideoutHelper.d.ts index 5f7e3b7..9d51fed 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/HideoutHelper.d.ts @@ -11,6 +11,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { PlayerService } from "../services/PlayerService"; import { HashUtil } from "../utils/HashUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; @@ -29,13 +30,14 @@ export declare class HideoutHelper { protected profileHelper: ProfileHelper; protected inventoryHelper: InventoryHelper; protected playerService: PlayerService; + protected localisationService: LocalisationService; protected configServer: ConfigServer; static bitcoinFarm: string; static waterCollector: string; static bitcoin: string; static expeditionaryFuelTank: string; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, localisationService: LocalisationService, configServer: ConfigServer); registerProduction(pmcData: IPmcData, body: IHideoutSingleProductionStartRequestData | IHideoutContinousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; /** * This convinience function intialies new Production Object diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/InventoryHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/InventoryHelper.d.ts index b8e5c9d..6419f93 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/InventoryHelper.d.ts @@ -5,11 +5,12 @@ import { IInventoryMergeRequestData } from "../models/eft/inventory/IInventoryMe import { IInventoryMoveRequestData } from "../models/eft/inventory/IInventoryMoveRequestData"; import { IInventorySplitRequestData } from "../models/eft/inventory/IInventorySplitRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { IInventoryConfig } from "../models/spt/config/IInventoryConfig"; +import { IInventoryConfig, RewardDetails } from "../models/spt/config/IInventoryConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { JsonUtil } from "../utils/JsonUtil"; @@ -38,9 +39,10 @@ export declare class InventoryHelper { protected itemHelper: ItemHelper; protected containerHelper: ContainerHelper; protected profileHelper: ProfileHelper; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected inventoryConfig: IInventoryConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); addItem(pmcData: IPmcData, body: IAddItemRequestData, output: IItemEventRouterResponse, sessionID: string, callback: any, foundInRaid?: boolean, addUpd?: any): IItemEventRouterResponse; removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; removeItemByCount(pmcData: IPmcData, itemId: string, count: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; @@ -76,6 +78,12 @@ export declare class InventoryHelper { * Internal helper function to handle cartridges in inventory if any of them exist. */ protected handleCartridges(items: Item[], body: IInventoryMoveRequestData): void; + /** + * Get details for how a random loot container should be handled, max rewards, possible reward tpls + * @param itemTpl Container being opened + * @returns Reward details + */ + getRandomLootContainerRewardDetails(itemTpl: string): RewardDetails; } declare namespace InventoryHelper { interface InventoryItemHash { diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/ItemHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/ItemHelper.d.ts index 0effaf2..fc88a46 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/ItemHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/ItemHelper.d.ts @@ -5,6 +5,7 @@ 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 { LocaleService } from "../services/LocaleService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; @@ -18,7 +19,8 @@ declare class ItemHelper { protected objectId: ObjectId; protected mathUtil: MathUtil; protected databaseServer: DatabaseServer; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer); + protected localeService: LocaleService; + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, localeService: LocaleService); /** * Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash * @param {string} tpl the template id / tpl @@ -212,6 +214,12 @@ declare class ItemHelper { * @returns size of stack */ getItemStackSize(item: Item): number; + /** + * Get the name of an item from the locale file using the item tpl + * @param itemTpl Tpl of item to get name of + * @returns Name of item + */ + getItemName(itemTpl: string): string; } declare namespace ItemHelper { interface ItemSize { diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/QuestHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/QuestHelper.d.ts index a6b4892..edbd2e1 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/QuestHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/QuestHelper.d.ts @@ -50,6 +50,12 @@ export declare class QuestHelper { * @returns true if player level is greater than or equal to quest */ doesPlayerLevelFulfilCondition(playerLevel: number, condition: AvailableForConditions): boolean; + /** + * Get the quests found in both arrays (inner join) + * @param before Array of qeusts #1 + * @param after Array of quests #2 + * @returns Reduction of cartesian product between two quest arrays + */ getDeltaQuests(before: IQuest[], after: IQuest[]): IQuest[]; /** * Increase skill points of a skill on player profile @@ -66,38 +72,85 @@ export declare class QuestHelper { * quest list in question. */ dumpQuests(quests: any): void; - loyaltyRequirementCheck(loyaltyRequirementProperties: AvailableForProps, profile: IPmcData): boolean; - protected processReward(reward: Reward): any[]; + /** + * Check if trader has sufficient loyalty to fullfill quest requirement + * @param questProperties Quest props + * @param profile Player profile + * @returns true if loyalty is high enough to fulfil quest requirement + */ + traderStandingRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; + protected processReward(reward: Reward): Reward[]; + /** + * Gets a flat list of reward items for the given quest at a specific state (e.g. Fail/Success) + * @param quest quest to get rewards for + * @param state Quest status that holds the items (Started, Success, Fail) + * @returns array of items with the correct maxStack + */ getQuestRewardItems(quest: IQuest, state: QuestStatus): Reward[]; /** - * Add quest with new state value to pmc profile + * Update player profile with quest status (e.g. Fail/Success) * @param pmcData profile to add quest to * @param newState state the new quest should be in when added * @param acceptedQuest Details of quest being added */ addQuestToPMCData(pmcData: IPmcData, newState: QuestStatus, acceptedQuest: IAcceptQuestRequestData): void; - acceptedUnlocked(acceptedQuestId: string, sessionID: string): IQuest[]; - failedUnlocked(failedQuestId: string, sessionID: string): IQuest[]; - applyMoneyBoost(quest: IQuest, moneyBoost: number): IQuest; - changeItemStack(pmcData: IPmcData, id: string, value: number, sessionID: string, output: any): void; /** - * Get List of All Quests as an array + * TODO: what is going on here + * @param acceptedQuestId Quest to add to profile + * @param sessionID Session id + * @returns Array of quests in profile + quest passed in as param + */ + acceptedUnlocked(acceptedQuestId: string, sessionID: string): IQuest[]; + /** + * TODO: what is going on here + * @param failedQuestId + * @param sessionID Session id + * @returns + */ + failedUnlocked(failedQuestId: string, sessionID: string): IQuest[]; + /** + * Adjust quest money rewards by passed in multipler + * @param quest Quest to multiple money rewards + * @param multipler Value to adjust money rewards by + * @returns Updated quest + */ + applyMoneyBoost(quest: IQuest, multipler: number): IQuest; + /** + * Sets the item stack to new value, or delete the item if value <= 0 + * // TODO maybe merge this function and the one from customization + * @param pmcData Profile + * @param itemId id of item to adjust stack size of + * @param newStackSize Stack size to adjust to + * @param sessionID Session id + * @param output ItemEvent router response + */ + changeItemStack(pmcData: IPmcData, itemId: string, newStackSize: number, sessionID: string, output: IItemEventRouterResponse): void; + /** + * Get List of All Quests from db + * NOT CLONED * @returns Array of IQuest objects */ - questValues(): IQuest[]; + getQuestsFromDb(): IQuest[]; /** - * Reest AvailableForStart conditions for quests - * @param quests queststo clean + * Get quests, strip all requirement conditions except level + * @param quests quests to process * @returns quest array without conditions */ - protected cleanQuestList(quests: IQuest[]): IQuest[]; + protected getQuestsWithOnlyLevelRequirementStartCondition(quests: IQuest[]): IQuest[]; /** - * Reset AvailableForStart conditions on a quest + * Remove all quest conditions except for level requirement * @param quest quest to clean * @returns reset IQuest object */ - cleanQuestConditions(quest: IQuest): IQuest; - failQuest(pmcData: IPmcData, body: any, sessionID: string): any; + getQuestWithOnlyLevelRequirementStartCondition(quest: IQuest): IQuest; + /** + * Fail a quest in a player profile + * @param pmcData Profile + * @param failRequest fail quest request data + * @param sessionID Session id + * @returns Item event router response + */ + failQuest(pmcData: IPmcData, failRequest: any, sessionID: string): IItemEventRouterResponse; /** * Get quest by id from database * @param questId questid to look for @@ -105,7 +158,12 @@ export declare class QuestHelper { * @returns IQuest object */ getQuestFromDb(questId: string, pmcData: IPmcData): IQuest; - getQuestLocaleIdFromDb(messageId: string): string; + /** + * Get the locale Id from locale db for a quest message + * @param questMessageId Quest mesage id to look up + * @returns Locale Id from locale db + */ + getQuestLocaleIdFromDb(questMessageId: string): string; /** * Alter a quests state + Add a record to tis status timers object * @param pmcData Profile to update @@ -128,5 +186,10 @@ export declare class QuestHelper { * @returns bonus in percent */ protected getIntelCenterRewardBonus(pmcData: IPmcData): number; - getFindItemIdForQuestItem(itemTpl: string): string; + /** + * Find quest with 'findItem' requirement that needs the item tpl be handed in + * @param itemTpl item tpl to look for + * @returns 'FindItem' condition id + */ + getFindItemIdForQuestHandIn(itemTpl: string): string; } diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/RagfairServerHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/RagfairServerHelper.d.ts index a03cdda..ec388d8 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/RagfairServerHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/RagfairServerHelper.d.ts @@ -44,10 +44,20 @@ export declare class RagfairServerHelper { isPlayer(userID: string): boolean; returnItems(sessionID: string, items: any[]): void; calculateDynamicStackCount(tplId: string, isWeaponPreset: boolean): number; + /** + * Choose a currency at random with bias + * @returns currency tpl + */ getDynamicOfferCurrency(): string; getMemberType(userID: string): MemberCategory; getNickname(userID: string): string; getPresetItems(item: any): Item[]; getPresetItemsByTpl(item: Item): Item[]; + /** + * Generate new unique ids for the children while preserving hierarchy + * @param item base item + * @param preset + * @returns Item array with new IDs + */ reparentPresets(item: Item, preset: Item[]): Item[]; } diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/RagfairSortHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/RagfairSortHelper.d.ts index 28d1d38..4669ce6 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/RagfairSortHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/RagfairSortHelper.d.ts @@ -18,7 +18,7 @@ export declare class RagfairSortHelper { protected sortOffersByRating(a: IRagfairOffer, b: IRagfairOffer): number; protected sortOffersByName(a: IRagfairOffer, b: IRagfairOffer): number; /** - * Order two offers by price value + * Order two offers by rouble price value * @param a Offer a * @param b Offer b * @returns diff --git a/TypeScript/12ClassExtensionOverride/types/loaders/PreAkiModLoader.d.ts b/TypeScript/12ClassExtensionOverride/types/loaders/PreAkiModLoader.d.ts index 7a687a5..f486a28 100644 --- a/TypeScript/12ClassExtensionOverride/types/loaders/PreAkiModLoader.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/loaders/PreAkiModLoader.d.ts @@ -1,29 +1,31 @@ import { DependencyContainer } from "tsyringe"; +import { IPostAkiLoadMod } from "../models/external/IPostAkiLoadMod"; +import { IPostDBLoadMod } from "../models/external/IPostDBLoadMod"; +import { IPreAkiLoadMod } from "../models/external/IPreAkiLoadMod"; import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { ModLoader } from "../models/spt/mod/IMod"; import { IModLoader } from "../models/spt/mod/IModLoader"; import { IPackageJsonData } from "../models/spt/mod/IPackageJsonData"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { LocalisationService } from "../services/LocalisationService"; import { ModCompilerService } from "../services/ModCompilerService"; import { JsonUtil } from "../utils/JsonUtil"; import { VFS } from "../utils/VFS"; import { BundleLoader } from "./BundleLoader"; -import { IPostAkiLoadMod } from "../models/external/IPostAkiLoadMod"; -import { IPreAkiLoadMod } from "../models/external/IPreAkiLoadMod"; -import { IPostDBLoadMod } from "../models/external/IPostDBLoadMod"; export declare class PreAkiModLoader implements IModLoader { protected logger: ILogger; protected vfs: VFS; protected jsonUtil: JsonUtil; protected modCompilerService: ModCompilerService; protected bundleLoader: BundleLoader; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected static container: DependencyContainer; protected readonly basepath = "user/mods/"; protected imported: Record; protected akiConfig: ICoreConfig; - constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, modCompilerService: ModCompilerService, bundleLoader: BundleLoader, configServer: ConfigServer); + constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, modCompilerService: ModCompilerService, bundleLoader: BundleLoader, localisationService: LocalisationService, configServer: ConfigServer); load(container: DependencyContainer): Promise; getBundles(local: boolean): string; getBundle(key: string, local: boolean): void; diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/bot/IGenerateBotsRequestData.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/bot/IGenerateBotsRequestData.d.ts index c49cef7..f1f7013 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/eft/bot/IGenerateBotsRequestData.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/bot/IGenerateBotsRequestData.d.ts @@ -2,6 +2,7 @@ export interface IGenerateBotsRequestData { conditions: Condition[]; } export interface Condition { + /** e.g. assault/pmcBot/bossKilla */ Role: string; Limit: number; Difficulty: string; diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/common/IGlobals.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/common/IGlobals.d.ts index 81e2023..b53f106 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/eft/common/IGlobals.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/common/IGlobals.d.ts @@ -591,6 +591,7 @@ export interface HealPrice { export interface ProfileHealthSettings { BodyPartsSettings: BodyPartsSettings; HealthFactorsSettings: HealthFactorsSettings; + DefaultStimulatorBuff: string; } export interface BodyPartsSettings { Head: BodyPartsSetting; diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/IBotBase.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/IBotBase.d.ts index 1c28ae0..2b418c1 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/IBotBase.d.ts @@ -107,6 +107,7 @@ export interface CurrentMax { Maximum: number; } export interface Inventory { + discardLimits: Record; items: Item[]; equipment: string; stash: string; diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/IBotType.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/IBotType.d.ts index c1fe579..55b4bd9 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/IBotType.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/IBotType.d.ts @@ -13,8 +13,8 @@ export interface IBotType { skills: Skills; } export interface Appearance { - body: string[]; - feet: string[]; + body: Record; + feet: Record; hands: string[]; head: string[]; voice: string[]; diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/ITemplateItem.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/ITemplateItem.d.ts index 8569e61..0fa7e18 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/common/tables/ITemplateItem.d.ts @@ -254,7 +254,7 @@ export interface Props { foodUseTime?: number; foodEffectType?: string; StimulatorBuffs?: string; - effects_health?: any; + effects_health?: IHealthEffect[] | Record>; effects_damage?: any; MaximumNumberOfUsage?: number; knifeHitDelay?: number; @@ -366,6 +366,10 @@ export interface Props { MinTimeToContactExplode?: number; ExplosionEffectType?: string; } +export interface IHealthEffect { + type: string; + value: number; +} export interface Prefab { path: string; rcid: string; diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/customization/IGetSuitsResponse.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/customization/IGetSuitsResponse.d.ts new file mode 100644 index 0000000..fe6888c --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/customization/IGetSuitsResponse.d.ts @@ -0,0 +1,4 @@ +export interface IGetSuitsResponse { + _id: string; + suits: string[]; +} diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/game/IGameKeepAliveResponse.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/game/IGameKeepAliveResponse.d.ts new file mode 100644 index 0000000..170ce6a --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/game/IGameKeepAliveResponse.d.ts @@ -0,0 +1,4 @@ +export interface IGameKeepAliveResponse { + msg: string; + utc_time: number; +} diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/game/IGameLogoutResponseData.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/game/IGameLogoutResponseData.d.ts new file mode 100644 index 0000000..0f52050 --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/game/IGameLogoutResponseData.d.ts @@ -0,0 +1,3 @@ +export interface IGameLogoutResponseData { + status: string; +} diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/game/IGameStartResponse.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/game/IGameStartResponse.d.ts new file mode 100644 index 0000000..9f0ab6d --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/game/IGameStartResponse.d.ts @@ -0,0 +1,3 @@ +export interface IGameStartResponse { + utc_time: number; +} diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts new file mode 100644 index 0000000..3c45124 --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts @@ -0,0 +1,11 @@ +import { IInventoryBaseActionRequestData } from "./IInventoryBaseActionRequestData"; +export interface IOpenRandomLootContainerRequestData extends IInventoryBaseActionRequestData { + Action: "OpenRandomLootContainer"; + /** Container item opened */ + item: string; + to: To[]; +} +export interface To { + /** Player character (pmc/scav) id items will be sent to */ + id: string; +} diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/itemEvent/IItemEventRouterBase.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/itemEvent/IItemEventRouterBase.d.ts index 4841cfd..60ab284 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/eft/itemEvent/IItemEventRouterBase.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/itemEvent/IItemEventRouterBase.d.ts @@ -10,8 +10,9 @@ export interface IItemEventRouterBase { export declare type TProfileChanges = Record; export interface Warning { index: number; - err: string; errmsg: string; + code?: string; + data?: any; } export interface ProfileChange { _id: string; diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/match/IStartOffineRaidRequestData.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/match/IStartOffineRaidRequestData.d.ts index af0625e..1983728 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/eft/match/IStartOffineRaidRequestData.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/match/IStartOffineRaidRequestData.d.ts @@ -2,8 +2,10 @@ import { BotAmount } from "../../enums/BotAmount"; import { BotDifficulty } from "../../enums/BotDifficulty"; export interface IStartOfflineRaidRequestData { locationName: string; + /** Current time, not in-game time */ startTime: number; - dateTime: string; + /** CURR = am, past = pm */ + dateTime: "CURR" | "PAST"; gameSettings: GameSettings; } export interface GameSettings { diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/notifier/ISelectProfileResponse.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/notifier/ISelectProfileResponse.d.ts new file mode 100644 index 0000000..ecb668a --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/notifier/ISelectProfileResponse.d.ts @@ -0,0 +1,6 @@ +import { INotifierChannel } from "./INotifier"; +export interface ISelectProfileResponse { + status: string; + notifier: INotifierChannel; + notifierServer: string; +} diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/ragfair/IRagfairOffer.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/ragfair/IRagfairOffer.d.ts index 3251a37..792ec7d 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/eft/ragfair/IRagfairOffer.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/ragfair/IRagfairOffer.d.ts @@ -7,19 +7,19 @@ export interface IRagfairOffer { requirements: OfferRequirement[]; root: string; intId: number; + /** Handbook price */ itemsCost: number; + /** Rouble price */ requirementsCost: number; - sptRequirementsCostRouble: number; startTime: number; endTime: number; sellInOnePiece: boolean; - name?: string; - shortName?: string; loyaltyLevel: number; buyRestrictionMax?: number; buyRestrictionCurrent?: number; locked: boolean; unlimitedCount: boolean; + /** Rouble price */ summaryCost: number; user: IRagfairOfferUser; notAvailable: boolean; @@ -33,11 +33,11 @@ export interface OfferRequirement { } export interface IRagfairOfferUser { id: string; - nickname: string; - rating: number; + nickname?: string; + rating?: number; memberType: MemberCategory; - avatar: string; - isRatingGrowing: boolean; + avatar?: string; + isRatingGrowing?: boolean; } export interface SellResult { sellTime: number; diff --git a/TypeScript/12ClassExtensionOverride/types/models/eft/weather/IWeatherData.d.ts b/TypeScript/12ClassExtensionOverride/types/models/eft/weather/IWeatherData.d.ts index ecc96ce..1f5d5b5 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/eft/weather/IWeatherData.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/eft/weather/IWeatherData.d.ts @@ -1,17 +1,18 @@ +import { WindDirection } from "../../../models/enums/WindDirection"; export interface IWeatherData { acceleration: number; time: string; date: string; - weather: IWeather; + weather?: IWeather; } export interface IWeather { pressure: number; temp: number; - fog: string; + fog: number; rain_intensity: number; - rain: any; + rain: number; wind_gustiness: number; - wind_direction: any; + wind_direction: WindDirection; wind_speed: number; cloud: number; time: string; diff --git a/TypeScript/12ClassExtensionOverride/types/models/enums/BackendErrorCodes.d.ts b/TypeScript/12ClassExtensionOverride/types/models/enums/BackendErrorCodes.d.ts new file mode 100644 index 0000000..6614b75 --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/models/enums/BackendErrorCodes.d.ts @@ -0,0 +1,67 @@ +export declare enum BackendErrorCodes { + NONE = 0, + UNKNOWN_ERROR = 200, + NOT_AUTHORIZED = 201, + NEED_AUTHORIZATION_CODE = 209, + WRONG_AUTHORIZATION_CODE = 211, + NEED_CAPTCHA = 214, + NO_NEED_CAPTCHA = 215, + CAPTCHA_FAILED = 218, + CAPTCHA_BRUTE_FORCED = 219, + NO_ROOM_IN_STASH = 223, + NICKNAME_NOT_UNIQUE = 225, + NICKNAME_NOT_VALID = 226, + UNSUPPORTED_CLIENT_VERSION = 232, + REPORT_NOT_ALLOWED = 238, + NICKNAME_IS_ABUSIVE = 241, + NICKNAME_CHANGE_TIMEOUT = 242, + NOT_MODIFIED = 304, + HTTP_BAD_REQUEST = 400, + HTTP_NOT_AUTHORIZED = 401, + HTTP_FORBIDDEN = 403, + HTTP_NOT_FOUND = 404, + HTTP_METHOD_NOT_ALLOWED = 405, + UNKNOWN_TRADING_ERROR = 500, + HTTPNOTIMPLEMENTED = 501, + HTTPBADGATEWAY = 502, + HTTPSERVICEUNAVAILABLE = 503, + HTTPGATEWAYTIMEOUT = 504, + TRADEROUTOFMONEY = 505, + HTTPVARIANTALSONEGOTIATES = 506, + PRICECHANGED = 509, + TRADERDISABLED = 512, + ITEMHASBEENSOLD = 513, + NOTENOUGHSPACEFORMONEY = 518, + HTTPINVALIDSSLCERTIFICATE = 526, + UNKNOWNRAGFAIRERROR = 550, + UNKNOWNRAGFAIRERROR2 = 551, + UNKNOWNMATCHMAKERERROR = 600, + SESSIONPARAMETERSERROR = 601, + SESSIONLOST = 602, + SERVERNOTREGISTERED = 604, + UNKNOWNQUESTERROR = 700, + QUESTBADPARAM = 702, + QUESTNOTFOUND = 703, + QUESTISUNAVAILABLE = 704, + NOFREESPACEFORREWARDS = 705, + WRONGQUESTSTATUS = 706, + CANTCOMPLETEQUEST = 707, + UNKNOWNMAILERROR = 900, + TOOMANYFRIENDREQUESTS = 925, + UNKNOWNSCRIPTEXECUTIONERROR = 1000, + UNKNOWNREPAIRINGERROR = 1200, + UNKNOWNINSURANCEERROR = 1300, + UNKNOWNCURRENCYEXCHANGEERROR = 1400, + OFFERNOTFOUND = 1503, + NOTENOUGHSPACE = 1505, + OFFEROUTOFSTOCK = 1506, + OFFERSOLD = 1507, + RAGFAIRUNAVAILABLE = 1511, + BANNEDERRORCODE = 1513, + INSUFFICIENTNUMBERINSTOCK = 1516, + TOOMANYITEMSTOSELL = 1517, + EXAMINATIONFAILED = 22001, + ITEMALREADYEXAMINED = 22002, + UNKNOWNNGINXERROR = 9000, + PARSERESPONSEERROR = 9001 +} diff --git a/TypeScript/12ClassExtensionOverride/types/models/enums/HideoutEventActions.d.ts b/TypeScript/12ClassExtensionOverride/types/models/enums/HideoutEventActions.d.ts new file mode 100644 index 0000000..e441477 --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/models/enums/HideoutEventActions.d.ts @@ -0,0 +1,11 @@ +export declare enum HideoutEventActions { + HIDEOUT_UPGRADE = "HideoutUpgrade", + HIDEOUT_UPGRADE_COMPLETE = "HideoutUpgradeComplete", + HIDEOUT_PUT_ITEMS_IN_AREA_SLOTS = "HideoutPutItemsInAreaSlots", + HIDEOUT_TAKE_ITEMS_FROM_AREA_SLOTS = "HideoutTakeItemsFromAreaSlots", + HIDEOUT_TOGGLE_AREA = "HideoutToggleArea", + HIDEOUT_SINGLE_PRODUCTION_START = "HideoutSingleProductionStart", + HIDEOUT_SCAV_CASE_PRODUCTION_START = "HideoutScavCaseProductionStart", + HIDEOUT_CONTINUOUS_PRODUCTION_START = "HideoutContinuousProductionStart", + HIDEOUT_TAKE_PRODUCTION = "HideoutTakeProduction" +} diff --git a/TypeScript/12ClassExtensionOverride/types/models/enums/ItemEventActions.d.ts b/TypeScript/12ClassExtensionOverride/types/models/enums/ItemEventActions.d.ts new file mode 100644 index 0000000..0e65453 --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/models/enums/ItemEventActions.d.ts @@ -0,0 +1,19 @@ +export declare enum ItemEventActions { + MOVE = "Move", + REMOVE = "Remove", + SPLIT = "Split", + MERGE = "Merge", + TRANSFER = "Transfer", + SWAP = "Swap", + FOLD = "Fold", + TOGGLE = "Toggle", + TAG = "Tag", + BIND = "Bind", + EXAMINE = "Examine", + READ_ENCYCLOPEDIA = "ReadEncyclopedia", + APPLY_INVENTORY_CHANGES = "ApplyInventoryChanges", + CREATE_MAP_MARKER = "CreateMapMarker", + DELETE_MAP_MARKER = "DeleteMapMarker", + EDIT_MAP_MARKER = "EditMapMarker", + OPEN_RANDOM_LOOT_CONTAINER = "OpenRandomLootContainer" +} diff --git a/TypeScript/12ClassExtensionOverride/types/models/enums/WeatherType.d.ts b/TypeScript/12ClassExtensionOverride/types/models/enums/WeatherType.d.ts new file mode 100644 index 0000000..d31fefe --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/models/enums/WeatherType.d.ts @@ -0,0 +1,19 @@ +export declare enum WeatherType { + CLEAR_DAY = 1, + CLEAR_WIND = 2, + CLEAR_NIGHT = 3, + PARTLY_CLOUD_DAY = 4, + PARTLY_CLOUD_NIGHT = 5, + CLEAR_FOG_DAY = 6, + CLEAR_FOG_NIGHT = 7, + CLOUDFOG = 8, + FOG = 9, + MOSTLY_CLOUD = 10, + LIGHT_RAIN = 11, + RAIN = 12, + CLOUD_WIND = 13, + CLOUD_WIND_RAIN = 14, + FULL_CLOUD = 15, + THUNDER_CLOUD = 16, + NONE = 0 +} diff --git a/TypeScript/12ClassExtensionOverride/types/models/enums/WildSpawnTypeNumber.d.ts b/TypeScript/12ClassExtensionOverride/types/models/enums/WildSpawnTypeNumber.d.ts new file mode 100644 index 0000000..ff806fe --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/models/enums/WildSpawnTypeNumber.d.ts @@ -0,0 +1,33 @@ +export declare enum WildSpawnTypeNumber { + ASSAULT = 1, + MARKSMAN = 2, + BOSSTEST = 4, + BOSSBULLY = 8, + FOLLOWERTEST = 16, + FOLLOWERBULLY = 32, + BOSSKILLA = 64, + BOSSKOJANIY = 128, + FOLLOWERKOJANIY = 256, + PMCBOT = 512, + CURSEDASSAULT = 1024, + BOSSGLUHAR = 2048, + FOLLOWERGLUHARASSAULT = 4096, + FOLLOWERGLUHARSECURITY = 8192, + FOLLOWERGLUHARSCOUT = 16384, + FOLLOWERGLUHARSNIPE = 32768, + FOLLOWERSANITAR = 65536, + BOSSSANITAR = 131072, + TEST = 262144, + ASSAULTGROUP = 524288, + SECTANTWARRIOR = 1048576, + SECTANTPRIEST = 2097152, + BOSSTAGILLA = 4194304, + FOLLOWERTAGILLA = 8388608, + EXUSEC = 16777216, + GIFTER = 33554432, + BOSSKNIGHT = 67108864, + FOLLOWERBIGPIPE = 134217728, + FOLLOWERBIRDEYE = 268435456, + SPTUSEC = 536870912, + SPTBEAR = 1073741824 +} diff --git a/TypeScript/12ClassExtensionOverride/types/models/enums/WindDirection.d.ts b/TypeScript/12ClassExtensionOverride/types/models/enums/WindDirection.d.ts new file mode 100644 index 0000000..fb30b20 --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/models/enums/WindDirection.d.ts @@ -0,0 +1,10 @@ +export declare enum WindDirection { + EAST = 1, + NORTH = 2, + WEST = 3, + SOUTH = 4, + SE = 5, + SW = 6, + NW = 7, + NE = 8 +} diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/config/IBotConfig.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IBotConfig.d.ts index af8ceba..d6fa5e0 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IBotConfig.d.ts @@ -27,6 +27,8 @@ export interface IBotConfig extends IBaseConfig { maxBotCap: Record; /** How many stacks of secret ammo should a bot have in its bot secure container */ secureContainerAmmoStackCount: number; + /** Batch generation size when type not available in cache */ + botGenerationBatchSizePerType: number; } export interface PresetBatch { assault: number; @@ -66,8 +68,12 @@ export interface EquipmentFilters { weaponModLimits: ModLimits; randomisedWeaponModSlots?: string[]; randomisedArmorSlots?: string[]; + faceShieldIsActiveChancePercent?: number; + lightLaserIsActiveChancePercent?: number; blacklist: EquipmentFilterDetails[]; whitelist: EquipmentFilterDetails[]; + clothing: WeightingAdjustmentDetails[]; + weightingAdjustments: WeightingAdjustmentDetails[]; } export interface ModLimits { /** How many scopes are allowed on a weapon - hard coded to work with OPTIC_SCOPE, ASSAULT_SCOPE, COLLIMATOR, COMPACT_COLLIMATOR */ @@ -80,3 +86,8 @@ export interface EquipmentFilterDetails { equipment: Record; cartridge: Record; } +export interface WeightingAdjustmentDetails { + levelRange: MinMax; + add: Record>; + edit: Record>; +} diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IInventoryConfig.d.ts index ffffa41..4642b9b 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IInventoryConfig.d.ts @@ -2,4 +2,10 @@ import { IBaseConfig } from "./IBaseConfig"; export interface IInventoryConfig extends IBaseConfig { kind: "aki-inventory"; newItemsMarkedFound: boolean; + randomLootContainers: Record; +} +export interface RewardDetails { + rewardCount: number; + foundInRaid: boolean; + rewardTplPool: Record; } diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/config/ILocaleConfig.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/config/ILocaleConfig.d.ts index fe9abf7..0a8955c 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/spt/config/ILocaleConfig.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/config/ILocaleConfig.d.ts @@ -1,5 +1,10 @@ import { IBaseConfig } from "./IBaseConfig"; export interface ILocaleConfig extends IBaseConfig { kind: "aki-locale"; - desiredLocale: string; + /** e.g. ru/en/cn/fr etc, or 'system', will take computer locale setting */ + gameLocale: string; + /** e.g. ru/en/cn/fr etc, or 'system', will take computer locale setting */ + serverLocale: string; + /** Languages server can be translated into */ + serverSupportedLocales: string[]; } diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/config/IPmcConfig.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IPmcConfig.d.ts index 9db2ba1..48601b2 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/spt/config/IPmcConfig.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IPmcConfig.d.ts @@ -6,9 +6,11 @@ export interface IPmcConfig { looseWeaponInBackpackChancePercent: number; looseWeaponInBackpackLootMinMax: MinMax; isUsec: number; + usecType: string; + bearType: string; chanceSameSideIsHostilePercent: number; /** key: location, value: type for usec/bear */ - pmcType: Record; + pmcType: Record>>; maxBackpackLootTotalRub: number; maxPocketLootTotalRub: number; maxVestLootTotalRub: number; diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IRagfairConfig.d.ts index c1b8763..6786417 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IRagfairConfig.d.ts @@ -28,12 +28,8 @@ export interface Reputation { gain: number; loss: number; } -export declare class OfferAdjustment { - maxPriceDifferenceBelowHandbookPercent: number; - handbookPriceMultipier: number; - priceThreshholdRub: number; -} export interface Dynamic { + barter: Barter; offerAdjustment: OfferAdjustment; expiredOfferThreshold: number; offerItemCount: MinMax; @@ -49,6 +45,20 @@ export interface Dynamic { showAsSingleStack: string[]; blacklist: Blacklist; } +export declare class Barter { + enable: boolean; + chancePercent: number; + itemCountMin: number; + itemCountMax: number; + priceRangeVariancePercent: number; + minRoubleCostToBecomeBarter: number; + itemTypeBlacklist: string[]; +} +export declare class OfferAdjustment { + maxPriceDifferenceBelowHandbookPercent: number; + handbookPriceMultipier: number; + priceThreshholdRub: number; +} export interface Condition { conditionChance: number; min: number; diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/config/ISeasonalEventConfig.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/config/ISeasonalEventConfig.d.ts index bc60618..e410925 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/spt/config/ISeasonalEventConfig.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/config/ISeasonalEventConfig.d.ts @@ -1,6 +1,9 @@ import { IBaseConfig } from "./IBaseConfig"; export interface ISeasonalEventConfig extends IBaseConfig { kind: "aki-seasonalevents"; + enableSeasonalEventDetection: boolean; + /** event / botType / equipSlot / itemid */ + eventGear: Record>>>; events: ISeasonalEvent[]; } export interface ISeasonalEvent { diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/config/IWeatherConfig.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IWeatherConfig.d.ts index bbdc43e..41a1c83 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/spt/config/IWeatherConfig.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IWeatherConfig.d.ts @@ -1,3 +1,4 @@ +import { WindDirection } from "../../../models/enums/WindDirection"; import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface IWeatherConfig extends IBaseConfig { @@ -7,12 +8,16 @@ export interface IWeatherConfig extends IBaseConfig { } export interface Weather { clouds: MinMax; - windSpeed: MinMax; - windDirection: MinMax; + windSpeed: WeatherSettings; + windDirection: WeatherSettings; windGustiness: MinMax; - rain: MinMax; + rain: WeatherSettings; rainIntensity: MinMax; - fog: MinMax; + fog: WeatherSettings; temp: MinMax; pressure: MinMax; } +export interface WeatherSettings { + values: T[]; + weights: number[]; +} diff --git a/TypeScript/12ClassExtensionOverride/types/routers/item_events/HideoutItemEventRouter.d.ts b/TypeScript/12ClassExtensionOverride/types/routers/item_events/HideoutItemEventRouter.d.ts index e1e98af..44bd1cd 100644 --- a/TypeScript/12ClassExtensionOverride/types/routers/item_events/HideoutItemEventRouter.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/routers/item_events/HideoutItemEventRouter.d.ts @@ -1,7 +1,7 @@ -import { IPmcData } from "../../models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "../../models/eft/itemEvent/IItemEventRouterResponse"; import { HideoutCallbacks } from "../../callbacks/HideoutCallbacks"; import { HandledRoute, ItemEventRouterDefinition } from "../../di/Router"; +import { IPmcData } from "../../models/eft/common/IPmcData"; +import { IItemEventRouterResponse } from "../../models/eft/itemEvent/IItemEventRouterResponse"; export declare class HideoutItemEventRouter extends ItemEventRouterDefinition { protected hideoutCallbacks: HideoutCallbacks; constructor(hideoutCallbacks: HideoutCallbacks); diff --git a/TypeScript/12ClassExtensionOverride/types/routers/item_events/InventoryItemEventRouter.d.ts b/TypeScript/12ClassExtensionOverride/types/routers/item_events/InventoryItemEventRouter.d.ts index 2619bb9..953d322 100644 --- a/TypeScript/12ClassExtensionOverride/types/routers/item_events/InventoryItemEventRouter.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/routers/item_events/InventoryItemEventRouter.d.ts @@ -1,7 +1,7 @@ -import { IPmcData } from "../../models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "../../models/eft/itemEvent/IItemEventRouterResponse"; import { InventoryCallbacks } from "../../callbacks/InventoryCallbacks"; import { HandledRoute, ItemEventRouterDefinition } from "../../di/Router"; +import { IPmcData } from "../../models/eft/common/IPmcData"; +import { IItemEventRouterResponse } from "../../models/eft/itemEvent/IItemEventRouterResponse"; export declare class InventoryItemEventRouter extends ItemEventRouterDefinition { protected inventoryCallbacks: InventoryCallbacks; constructor(inventoryCallbacks: InventoryCallbacks); diff --git a/TypeScript/12ClassExtensionOverride/types/servers/HttpServer.d.ts b/TypeScript/12ClassExtensionOverride/types/servers/HttpServer.d.ts index bbca8af..80c1d48 100644 --- a/TypeScript/12ClassExtensionOverride/types/servers/HttpServer.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/servers/HttpServer.d.ts @@ -4,6 +4,7 @@ import { ApplicationContext } from "../context/ApplicationContext"; import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; import { ILogger } from "../models/spt/utils/ILogger"; +import { LocalisationService } from "../services/LocalisationService"; import { ConfigServer } from "./ConfigServer"; import { DatabaseServer } from "./DatabaseServer"; import { IHttpListener } from "./http/IHttpListener"; @@ -12,11 +13,12 @@ export declare class HttpServer { protected logger: ILogger; protected databaseServer: DatabaseServer; protected httpServerHelper: HttpServerHelper; + protected localisationService: LocalisationService; protected httpListeners: IHttpListener[]; protected configServer: ConfigServer; protected applicationContext: ApplicationContext; protected webSocketServer: WebSocketServer; - constructor(logger: ILogger, databaseServer: DatabaseServer, httpServerHelper: HttpServerHelper, httpListeners: IHttpListener[], configServer: ConfigServer, applicationContext: ApplicationContext, webSocketServer: WebSocketServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, httpServerHelper: HttpServerHelper, localisationService: LocalisationService, httpListeners: IHttpListener[], configServer: ConfigServer, applicationContext: ApplicationContext, webSocketServer: WebSocketServer); protected httpConfig: IHttpConfig; getCookies(req: http.IncomingMessage): any; handleRequest(req: IncomingMessage, resp: ServerResponse): void; diff --git a/TypeScript/12ClassExtensionOverride/types/servers/SaveServer.d.ts b/TypeScript/12ClassExtensionOverride/types/servers/SaveServer.d.ts index cb28f49..4dca514 100644 --- a/TypeScript/12ClassExtensionOverride/types/servers/SaveServer.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/servers/SaveServer.d.ts @@ -1,20 +1,22 @@ +import { SaveLoadRouter } from "../di/Router"; import { IAkiProfile, Info } from "../models/eft/profile/IAkiProfile"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { VFS } from "../utils/VFS"; -import { SaveLoadRouter } from "../di/Router"; -import { ILogger } from "../models/spt/utils/ILogger"; export declare class SaveServer { protected vfs: VFS; protected saveLoadRouters: SaveLoadRouter[]; protected jsonUtil: JsonUtil; protected hashUtil: HashUtil; + protected localisationService: LocalisationService; protected logger: ILogger; protected profileFilepath: string; protected profiles: {}; protected onSave: {}; protected saveMd5: {}; - constructor(vfs: VFS, saveLoadRouters: SaveLoadRouter[], jsonUtil: JsonUtil, hashUtil: HashUtil, logger: ILogger); + constructor(vfs: VFS, saveLoadRouters: SaveLoadRouter[], jsonUtil: JsonUtil, hashUtil: HashUtil, localisationService: LocalisationService, logger: ILogger); load(): void; save(): void; getProfile(sessionId: string): IAkiProfile; diff --git a/TypeScript/12ClassExtensionOverride/types/servers/WebSocketServer.d.ts b/TypeScript/12ClassExtensionOverride/types/servers/WebSocketServer.d.ts index f33d214..5d40e6e 100644 --- a/TypeScript/12ClassExtensionOverride/types/servers/WebSocketServer.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/servers/WebSocketServer.d.ts @@ -1,18 +1,20 @@ /// -import { HttpServerHelper } from "../helpers/HttpServerHelper"; -import WebSocket from "ws"; import http, { IncomingMessage } from "http"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { RandomUtil } from "../utils/RandomUtil"; +import WebSocket from "ws"; +import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { INotification } from "../models/eft/notifier/INotifier"; -import { ConfigServer } from "./ConfigServer"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { LocalisationService } from "../services/LocalisationService"; +import { RandomUtil } from "../utils/RandomUtil"; +import { ConfigServer } from "./ConfigServer"; export declare class WebSocketServer { protected logger: ILogger; protected randomUtil: RandomUtil; protected configServer: ConfigServer; + protected localisationService: LocalisationService; protected httpServerHelper: HttpServerHelper; - constructor(logger: ILogger, randomUtil: RandomUtil, configServer: ConfigServer, httpServerHelper: HttpServerHelper); + constructor(logger: ILogger, randomUtil: RandomUtil, configServer: ConfigServer, localisationService: LocalisationService, httpServerHelper: HttpServerHelper); protected httpConfig: IHttpConfig; protected defaultNotification: INotification; protected webSockets: Record; diff --git a/TypeScript/12ClassExtensionOverride/types/servers/http/AkiHttpListener.d.ts b/TypeScript/12ClassExtensionOverride/types/servers/http/AkiHttpListener.d.ts index 6f78939..acf92aa 100644 --- a/TypeScript/12ClassExtensionOverride/types/servers/http/AkiHttpListener.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/servers/http/AkiHttpListener.d.ts @@ -1,22 +1,24 @@ /// /// import { IncomingMessage, ServerResponse } from "http"; -import { IHttpListener } from "./IHttpListener"; import { Serializer } from "../../di/Serializer"; import { ILogger } from "../../models/spt/utils/ILogger"; import { HttpRouter } from "../../routers/HttpRouter"; +import { LocalisationService } from "../../services/LocalisationService"; import { HttpResponseUtil } from "../../utils/HttpResponseUtil"; import { JsonUtil } from "../../utils/JsonUtil"; import { HttpBufferHandler } from "./HttpBufferHandler"; +import { IHttpListener } from "./IHttpListener"; export declare class AkiHttpListener implements IHttpListener { protected httpRouter: HttpRouter; protected serializers: Serializer[]; protected logger: ILogger; protected jsonUtil: JsonUtil; protected httpResponse: HttpResponseUtil; + protected localisationService: LocalisationService; protected httpBufferHandler: HttpBufferHandler; constructor(httpRouter: HttpRouter, // TODO: delay required - serializers: Serializer[], logger: ILogger, jsonUtil: JsonUtil, httpResponse: HttpResponseUtil, httpBufferHandler: HttpBufferHandler); + serializers: Serializer[], logger: ILogger, jsonUtil: JsonUtil, httpResponse: HttpResponseUtil, localisationService: LocalisationService, httpBufferHandler: HttpBufferHandler); canHandle(_: string, req: IncomingMessage): boolean; handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): void; sendResponse(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: Buffer, output: string): void; diff --git a/TypeScript/12ClassExtensionOverride/types/services/BotEquipmentFilterService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/BotEquipmentFilterService.d.ts index 632f961..ae72cc3 100644 --- a/TypeScript/12ClassExtensionOverride/types/services/BotEquipmentFilterService.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/services/BotEquipmentFilterService.d.ts @@ -1,12 +1,12 @@ import { IBotType } from "../models/eft/common/tables/IBotType"; -import { EquipmentFilters, EquipmentFilterDetails, IBotConfig } from "../models/spt/config/IBotConfig"; +import { EquipmentFilters, EquipmentFilterDetails, IBotConfig, WeightingAdjustmentDetails } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; export declare class BotEquipmentFilterService { protected logger: ILogger; protected configServer: ConfigServer; protected botConfig: IBotConfig; - protected botEquipmentFilterlists: Record; + protected botEquipmentConfig: Record; constructor(logger: ILogger, configServer: ConfigServer); /** * Filter a bots data to exclude equipment and cartridges defines in the botConfig @@ -30,6 +30,20 @@ export declare class BotEquipmentFilterService { * @returns EquipmentFilterDetails object */ protected getBotEquipmentWhitelist(botRole: string, playerLevel: number): EquipmentFilterDetails; + /** + * Retreive clothing weighting adjustments from bot.json config + * @param botRole Bot type to get adjustments for + * @param playerLevel level of player + * @returns Weighting adjustments for bots clothing + */ + protected getBotClothingAdjustments(botRole: string, playerLevel: number): WeightingAdjustmentDetails; + /** + * Retreive item weighting adjustments from bot.json config + * @param botRole Bot type to get adjustments for + * @param playerLevel level of player + * @returns Weighting adjustments for bot items + */ + protected getBotWeightingAdjustments(botRole: string, playerLevel: number): WeightingAdjustmentDetails; /** * Filter bot equipment based on blacklist and whitelist from config/bot.json * Prioritises whitelist first, if one is found blacklist is ignored @@ -47,4 +61,10 @@ export declare class BotEquipmentFilterService { * @returns Filtered bot file */ protected filterCartridges(baseBotNode: IBotType, blacklist: EquipmentFilterDetails, whitelist: EquipmentFilterDetails): void; + /** + * Add/Edit weighting changes to bot items using values from config/bot.json/equipment + * @param weightingAdjustments Weighting change to apply to bot + * @param botItemPool Bot item dictionary to adjust + */ + protected adjustWeighting(weightingAdjustments: WeightingAdjustmentDetails, botItemPool: Record): void; } diff --git a/TypeScript/12ClassExtensionOverride/types/services/BotGenerationCacheService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/BotGenerationCacheService.d.ts index ba53fec..0be0576 100644 --- a/TypeScript/12ClassExtensionOverride/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/services/BotGenerationCacheService.d.ts @@ -8,11 +8,11 @@ export declare class BotGenerationCacheService { protected randomUtil: RandomUtil; protected jsonUtil: JsonUtil; protected botHelper: BotHelper; - protected storedBots: IBotBase[]; + protected storedBots: Map; constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, botHelper: BotHelper); /** * Store array of bots in cache, shuffle results before storage - * @param botsToStore + * @param botsToStore Bots we want to store in the cache */ storeBots(botsToStore: IBotBase[]): void; /** @@ -21,25 +21,7 @@ export declare class BotGenerationCacheService { * @param role role to retreive (assault/bossTagilla etc) * @returns IBotBase object */ - getBot(role: string): IBotBase[]; - /** - * Find a bot by its index from cache - * @param indexOfBotToReturn index to find bot by - * @returns bot profile - */ - protected getBotFromCache(indexOfBotToReturn: number): IBotBase; - /** - * Remove bot profile by index from cache - * @param indexOfBotToReturn Index of bot profile to remove - */ - protected removeBotFromCache(indexOfBotToReturn: number): void; - /** - * Get index of bot profile that matches criteria - * @param role Role of bot wanted - * @param getPmc Requested bot a pmc - * @returns index of found bot, -1 if not found - */ - protected getIndexOfBotToReturn(role: string, getPmc: boolean): number; + getBot(role: string): IBotBase; /** * Remove all cached bot profiles */ @@ -48,5 +30,5 @@ export declare class BotGenerationCacheService { * Does cache have bots * @returns true if empty */ - cacheIsEmpty(): boolean; + cacheHasBotOfRole(role: string): boolean; } diff --git a/TypeScript/12ClassExtensionOverride/types/services/LocaleService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/LocaleService.d.ts index 33bea7b..8275b75 100644 --- a/TypeScript/12ClassExtensionOverride/types/services/LocaleService.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/services/LocaleService.d.ts @@ -1,14 +1,42 @@ import { ILocaleConfig } from "../models/spt/config/ILocaleConfig"; +import { ILocaleGlobalBase } from "../models/spt/server/ILocaleBase"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +/** + * Handles getting locales from config or users machine + */ export declare class LocaleService { protected logger: ILogger; + protected databaseServer: DatabaseServer; protected configServer: ConfigServer; protected localeConfig: ILocaleConfig; - constructor(logger: ILogger, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, configServer: ConfigServer); /** - * Gets the locale key from the locale.json file + * Get the eft globals db file based on the configured locale in config/locale.json, if not found, fall back to 'en' + * @returns ILocaleGlobalBase + */ + getLocaleDb(): ILocaleGlobalBase; + /** + * Gets the game locale key from the locale.json file, + * if value is 'system' get system locale * @returns locale e.g en/ge/cz/cn */ - getDesiredLocale(): string; + getDesiredGameLocale(): string; + /** + * Gets the game locale key from the locale.json file, + * if value is 'system' get system locale + * @returns locale e.g en/ge/cz/cn + */ + getDesiredServerLocale(): string; + /** + * Get array of languages supported for localisation + * @returns array of locales e.g. en/fr/cn + */ + getServerSupportedLocales(): string[]; + /** + * Get the locale of the computer running the server + * @returns langage part of locale e.g. 'en' part of 'en-US' + */ + protected getPlatformLocale(): string; } diff --git a/TypeScript/12ClassExtensionOverride/types/services/LocalisationService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/LocalisationService.d.ts new file mode 100644 index 0000000..519325d --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/services/LocalisationService.d.ts @@ -0,0 +1,21 @@ +import { I18n } from "i18n"; +import { ILocaleConfig } from "../models/spt/config/ILocaleConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { LocaleService } from "./LocaleService"; +/** + * Handles translating server text into different langauges + */ +export declare class LocalisationService { + protected logger: ILogger; + protected localeService: LocaleService; + protected localeConfig: ILocaleConfig; + protected i18n: I18n; + constructor(logger: ILogger, localeService: LocaleService); + /** + * Get a localised value using the passed in key + * @param key Key to loop up locale for + * @param args optional arguments + * @returns Localised string + */ + getText(key: string, args?: any): string; +} diff --git a/TypeScript/12ClassExtensionOverride/types/services/PaymentService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/PaymentService.d.ts index a5e538f..c9ce95a 100644 --- a/TypeScript/12ClassExtensionOverride/types/services/PaymentService.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/services/PaymentService.d.ts @@ -11,6 +11,7 @@ import { IProcessSellTradeRequestData } from "../models/eft/trade/IProcessSellTr import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +import { LocalisationService } from "./LocalisationService"; export declare class PaymentService { protected logger: ILogger; protected httpResponse: HttpResponseUtil; @@ -19,8 +20,9 @@ export declare class PaymentService { protected traderHelper: TraderHelper; protected itemHelper: ItemHelper; protected inventoryHelper: InventoryHelper; + protected localisationService: LocalisationService; protected paymentHelper: PaymentHelper; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, traderHelper: TraderHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper); + constructor(logger: ILogger, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, traderHelper: TraderHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, localisationService: LocalisationService, paymentHelper: PaymentHelper); /** * Take money and insert items into return to server request * @param {Object} pmcData @@ -50,7 +52,7 @@ export declare class PaymentService { * @param pmcData Player profile to find and remove currency from * @param currencyTpl Type of currency to pay * @param amountToPay money value to pay - * @param sessionID Sessino id + * @param sessionID Session id * @param output output object to send to client * @returns IItemEventRouterResponse */ diff --git a/TypeScript/12ClassExtensionOverride/types/services/PlayerService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/PlayerService.d.ts index 519b7e5..2f364d5 100644 --- a/TypeScript/12ClassExtensionOverride/types/services/PlayerService.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/services/PlayerService.d.ts @@ -2,10 +2,12 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { IPlayerIncrementSkillLevelRequestData } from "../models/eft/player/IPlayerIncrementSkillLevelRequestData"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "./LocalisationService"; export declare class PlayerService { protected logger: ILogger; + protected localisationService: LocalisationService; protected databaseServer: DatabaseServer; - constructor(logger: ILogger, databaseServer: DatabaseServer); + constructor(logger: ILogger, localisationService: LocalisationService, databaseServer: DatabaseServer); /** * increases the profile skill and updates any output * @param {Object} pmcData diff --git a/TypeScript/12ClassExtensionOverride/types/services/PmcAiService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/PmcAiService.d.ts deleted file mode 100644 index 0690f1f..0000000 --- a/TypeScript/12ClassExtensionOverride/types/services/PmcAiService.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { IBotConfig } from "../models/spt/config/IBotConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { ConfigServer } from "../servers/ConfigServer"; -/** Storing/retreving pmcRoles set at the start of a raid - its done at that point as we know what location the player is heading to */ -export declare class PmcAiService { - protected logger: ILogger; - protected configServer: ConfigServer; - protected botConfig: IBotConfig; - protected usecRole: string; - protected bearRole: string; - constructor(logger: ILogger, configServer: ConfigServer); - /** - * Convert from pmc side (usec/bear) to the side as defined in the bot config (usecType/bearType) - * @param pmcSide eft side (usec/bear) - * @returns pmc side as defined in config - */ - getPmcRole(pmcSide: "usec" | "bear" | string): string; - /** - * Set the roles for pmcs - * @param location map location to look up and use as pmc types - */ - setPmcRolesByLocation(location: string): void; - /** - * Clear the saved role from usec/bear PMCs - */ - clearPmcRoles(): void; -} diff --git a/TypeScript/12ClassExtensionOverride/types/services/ProfileFixerService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/ProfileFixerService.d.ts index e772919..86a6af8 100644 --- a/TypeScript/12ClassExtensionOverride/types/services/ProfileFixerService.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/services/ProfileFixerService.d.ts @@ -8,12 +8,14 @@ import { HideoutAreas } from "../models/enums/HideoutAreas"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { Watermark } from "../utils/Watermark"; +import { LocalisationService } from "./LocalisationService"; export declare class ProfileFixerService { protected logger: ILogger; protected watermark: Watermark; protected hideoutHelper: HideoutHelper; + protected localisationService: LocalisationService; protected databaseServer: DatabaseServer; - constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, databaseServer: DatabaseServer); + constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, localisationService: LocalisationService, databaseServer: DatabaseServer); /** * Find issues in the pmc profile data that may cause issues and fix them * @param pmcProfile profile to check and fix diff --git a/TypeScript/12ClassExtensionOverride/types/services/RagfairOfferService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/RagfairOfferService.d.ts index a6f6b6d..86c1e52 100644 --- a/TypeScript/12ClassExtensionOverride/types/services/RagfairOfferService.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/services/RagfairOfferService.d.ts @@ -11,6 +11,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { TimeUtil } from "../utils/TimeUtil"; +import { LocalisationService } from "./LocalisationService"; import { RagfairCategoriesService } from "./RagfairCategoriesService"; export declare class RagfairOfferService { protected logger: ILogger; @@ -22,12 +23,14 @@ export declare class RagfairOfferService { protected profileHelper: ProfileHelper; protected eventOutputHolder: EventOutputHolder; protected httpResponse: HttpResponseUtil; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected playerOffersLoaded: boolean; protected expiredOffers: Item[]; - protected offers: IRagfairOffer[]; + /** offerId, offer */ + protected offers: Record; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, databaseServer: DatabaseServer, saveServer: SaveServer, ragfairServerHelper: RagfairServerHelper, ragfairCategoriesService: RagfairCategoriesService, profileHelper: ProfileHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, databaseServer: DatabaseServer, saveServer: SaveServer, ragfairServerHelper: RagfairServerHelper, ragfairCategoriesService: RagfairCategoriesService, profileHelper: ProfileHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, localisationService: LocalisationService, configServer: ConfigServer); /** * Get all offers * @returns IRagfairOffer array diff --git a/TypeScript/12ClassExtensionOverride/types/utils/App.d.ts b/TypeScript/12ClassExtensionOverride/types/utils/App.d.ts index dcc2669..cc8a5af 100644 --- a/TypeScript/12ClassExtensionOverride/types/utils/App.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/utils/App.d.ts @@ -1,14 +1,16 @@ -import { TimeUtil } from "./TimeUtil"; import { OnLoad } from "../di/OnLoad"; import { OnUpdate } from "../di/OnUpdate"; import { ILogger } from "../models/spt/utils/ILogger"; +import { LocalisationService } from "../services/LocalisationService"; +import { TimeUtil } from "./TimeUtil"; export declare class App { protected logger: ILogger; protected timeUtil: TimeUtil; + protected localisationService: LocalisationService; protected onLoadComponents: OnLoad[]; protected onUpdateComponents: OnUpdate[]; protected onUpdateLastRun: {}; - constructor(logger: ILogger, timeUtil: TimeUtil, onLoadComponents: OnLoad[], onUpdateComponents: OnUpdate[]); + constructor(logger: ILogger, timeUtil: TimeUtil, localisationService: LocalisationService, onLoadComponents: OnLoad[], onUpdateComponents: OnUpdate[]); load(): void; protected update(onUpdateComponents: OnUpdate[]): void; protected logUpdateException(err: any, updateable: OnUpdate): void; diff --git a/TypeScript/12ClassExtensionOverride/types/utils/DatabaseImporter.d.ts b/TypeScript/12ClassExtensionOverride/types/utils/DatabaseImporter.d.ts index 483e135..31670ae 100644 --- a/TypeScript/12ClassExtensionOverride/types/utils/DatabaseImporter.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/utils/DatabaseImporter.d.ts @@ -3,15 +3,17 @@ import { IDatabaseTables } from "../models/spt/server/IDatabaseTables"; import { ILogger } from "../models/spt/utils/ILogger"; import { ImageRouter } from "../routers/ImageRouter"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { JsonUtil } from "./JsonUtil"; import { VFS } from "./VFS"; export declare class DatabaseImporter extends OnLoad { protected logger: ILogger; protected vfs: VFS; protected jsonUtil: JsonUtil; + protected localisationService: LocalisationService; protected databaseServer: DatabaseServer; protected imageRouter: ImageRouter; - constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, databaseServer: DatabaseServer, imageRouter: ImageRouter); + constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, localisationService: LocalisationService, databaseServer: DatabaseServer, imageRouter: ImageRouter); onLoad(): void; /** * Read all json files in database folder and map into a json object diff --git a/TypeScript/12ClassExtensionOverride/types/utils/HttpResponseUtil.d.ts b/TypeScript/12ClassExtensionOverride/types/utils/HttpResponseUtil.d.ts index 29502be..3a78618 100644 --- a/TypeScript/12ClassExtensionOverride/types/utils/HttpResponseUtil.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/utils/HttpResponseUtil.d.ts @@ -1,10 +1,13 @@ -import { JsonUtil } from "./JsonUtil"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { INullResponseData } from "../models/eft/httpResponse/INullResponseData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; +import { BackendErrorCodes } from "../models/enums/BackendErrorCodes"; +import { LocalisationService } from "../services/LocalisationService"; +import { JsonUtil } from "./JsonUtil"; export declare class HttpResponseUtil { protected jsonUtil: JsonUtil; - constructor(jsonUtil: JsonUtil); + protected localisationService: LocalisationService; + constructor(jsonUtil: JsonUtil, localisationService: LocalisationService); protected clearString(s: string): any; noBody(data: any): any; getBody(data: T, err?: number, errmsg?: any): IGetBodyResponseData; @@ -12,5 +15,5 @@ export declare class HttpResponseUtil { emptyResponse(): IGetBodyResponseData; nullResponse(): INullResponseData; emptyArrayResponse(): IGetBodyResponseData; - appendErrorToOutput(output: IItemEventRouterResponse, message?: string, title?: string): IItemEventRouterResponse; + appendErrorToOutput(output: IItemEventRouterResponse, message?: string, errorCode?: BackendErrorCodes): IItemEventRouterResponse; } diff --git a/TypeScript/12ClassExtensionOverride/types/utils/RandomUtil.d.ts b/TypeScript/12ClassExtensionOverride/types/utils/RandomUtil.d.ts index 633e472..aa556e3 100644 --- a/TypeScript/12ClassExtensionOverride/types/utils/RandomUtil.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/utils/RandomUtil.d.ts @@ -110,6 +110,12 @@ export declare class RandomUtil { getIntEx(max: number): number; getFloat(min: number, max: number): number; getBool(): boolean; + /** + * Check if number passes a check out of 100 + * @param chancePercent value check needs to be above + * @returns true if value passes check + */ + getChance100(chancePercent: number): boolean; getStringArrayValue(arr: string[]): string; getArrayValue(arr: T[]): T; getKey(node: any): string; diff --git a/TypeScript/12ClassExtensionOverride/types/utils/Watermark.d.ts b/TypeScript/12ClassExtensionOverride/types/utils/Watermark.d.ts index c6dc120..e02eba2 100644 --- a/TypeScript/12ClassExtensionOverride/types/utils/Watermark.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/utils/Watermark.d.ts @@ -1,20 +1,15 @@ import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { LocalisationService } from "../services/LocalisationService"; export declare class WatermarkLocale { - protected locales: { - "en-US": { - description: string[]; - warning: string[]; - modding: string[]; - }; - "zh-CN": { - description: string[]; - warning: string[]; - modding: string[]; - }; + protected localisationService: LocalisationService; + constructor(localisationService: LocalisationService); + protected watermark: { + description: string[]; + warning: string[]; + modding: string[]; }; - getLocale(): string; getDescription(): string[]; getWarning(): string[]; getModding(): string[]; @@ -22,9 +17,10 @@ export declare class WatermarkLocale { export declare class Watermark { protected logger: ILogger; protected configServer: ConfigServer; + protected localisationService: LocalisationService; protected watermarkLocale?: WatermarkLocale; protected akiConfig: ICoreConfig; - constructor(logger: ILogger, configServer: ConfigServer, watermarkLocale?: WatermarkLocale); + constructor(logger: ILogger, configServer: ConfigServer, localisationService: LocalisationService, watermarkLocale?: WatermarkLocale); protected text: string[]; protected versionLabel: string; initialize(): void; diff --git a/TypeScript/13AddTrader/types/callbacks/BotCallbacks.d.ts b/TypeScript/13AddTrader/types/callbacks/BotCallbacks.d.ts index 2db60dc..827015e 100644 --- a/TypeScript/13AddTrader/types/callbacks/BotCallbacks.d.ts +++ b/TypeScript/13AddTrader/types/callbacks/BotCallbacks.d.ts @@ -8,8 +8,29 @@ export declare class BotCallbacks { protected botController: BotController; protected httpResponse: HttpResponseUtil; constructor(botController: BotController, httpResponse: HttpResponseUtil); + /** + * Handle singleplayer/settings/bot/limit + * @returns string + */ getBotLimit(url: string, info: IEmptyRequestData, sessionID: string): string; + /** + * Handle singleplayer/settings/bot/difficulty + * @returns string + */ getBotDifficulty(url: string, info: IEmptyRequestData, sessionID: string): string; + /** + * Handle client/game/bot/generate + * @returns IGetBodyResponseData + */ generateBots(url: string, info: IGenerateBotsRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle singleplayer/settings/bot/maxCap + * @returns string + */ getBotCap(): string; + /** + * Handle singleplayer/settings/bot/getBotBehaviours + * @returns string + */ + getBotBehaviours(): string; } diff --git a/TypeScript/13AddTrader/types/callbacks/CustomizationCallbacks.d.ts b/TypeScript/13AddTrader/types/callbacks/CustomizationCallbacks.d.ts index 3bab8c0..75d5701 100644 --- a/TypeScript/13AddTrader/types/callbacks/CustomizationCallbacks.d.ts +++ b/TypeScript/13AddTrader/types/callbacks/CustomizationCallbacks.d.ts @@ -3,6 +3,7 @@ import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { IPmcData } from "../models/eft/common/IPmcData"; import { ISuit } from "../models/eft/common/tables/ITrader"; import { IBuyClothingRequestData } from "../models/eft/customization/IBuyClothingRequestData"; +import { IGetSuitsResponse } from "../models/eft/customization/IGetSuitsResponse"; import { IWearClothingRequestData } from "../models/eft/customization/IWearClothingRequestData"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; @@ -13,10 +14,15 @@ export declare class CustomizationCallbacks { protected saveServer: SaveServer; protected httpResponse: HttpResponseUtil; constructor(customizationController: CustomizationController, saveServer: SaveServer, httpResponse: HttpResponseUtil); - getSuits(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<{ - _id: string; - suites: string[]; - }>; + /** + * Handles client/trading/customization/storage + * @returns + */ + getSuits(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handles client/trading/customization + * @returns ISuit[] + */ getTraderSuits(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; wearClothing(pmcData: IPmcData, body: IWearClothingRequestData, sessionID: string): IItemEventRouterResponse; buyClothing(pmcData: IPmcData, body: IBuyClothingRequestData, sessionID: string): IItemEventRouterResponse; diff --git a/TypeScript/13AddTrader/types/callbacks/DataCallbacks.d.ts b/TypeScript/13AddTrader/types/callbacks/DataCallbacks.d.ts index 04566ff..2efcf81 100644 --- a/TypeScript/13AddTrader/types/callbacks/DataCallbacks.d.ts +++ b/TypeScript/13AddTrader/types/callbacks/DataCallbacks.d.ts @@ -12,15 +12,42 @@ import { ILanguageBase } from "../models/spt/server/ILocaleBase"; import { ISettingsBase } from "../models/spt/server/ISettingsBase"; import { DatabaseServer } from "../servers/DatabaseServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +/** + * Handle client requests + */ export declare class DataCallbacks { protected httpResponse: HttpResponseUtil; protected databaseServer: DatabaseServer; constructor(httpResponse: HttpResponseUtil, databaseServer: DatabaseServer); + /** + * Handles client/settings + * @returns ISettingsBase + */ getSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handles client/globals + * @returns IGlobals + */ getGlobals(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handles client/items + * @returns string + */ getTemplateItems(url: string, info: IEmptyRequestData, sessionID: string): string; + /** + * Handles client/handbook/templates + * @returns IHandbookBase + */ getTemplateHandbook(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handles client/customization + * @returns Record>; + /** + * Handles client/account/customization + * @returns string[] + */ getTemplateCharacter(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getTemplateQuests(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getHideoutSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; @@ -28,6 +55,6 @@ export declare class DataCallbacks { gethideoutProduction(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getHideoutScavcase(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getLocalesLanguages(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - getLocalesMenu(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + getLocalesMenu(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getLocalesGlobal(url: string, info: IEmptyRequestData, sessionID: string): string; } diff --git a/TypeScript/13AddTrader/types/callbacks/DialogueCallbacks.d.ts b/TypeScript/13AddTrader/types/callbacks/DialogueCallbacks.d.ts index 634f90b..7b2eeae 100644 --- a/TypeScript/13AddTrader/types/callbacks/DialogueCallbacks.d.ts +++ b/TypeScript/13AddTrader/types/callbacks/DialogueCallbacks.d.ts @@ -26,15 +26,27 @@ export declare class DialogueCallbacks extends OnUpdate { protected httpResponse: HttpResponseUtil; protected dialogueController: DialogueController; constructor(hashUtil: HashUtil, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, dialogueController: DialogueController); + /** + * Handles client/friend/list + * @returns IGetFriendListDataResponse + */ getFriendList(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handles client/chatServer/list + * @returns + */ getChatServerList(url: string, info: IGetChatServerListRequestData, sessionID: string): IGetBodyResponseData; getMailDialogList(url: string, info: IGetMailDialogListRequestData, sessionID: string): IGetBodyResponseData; getMailDialogView(url: string, info: IGetMailDialogViewRequestData, sessionID: string): IGetBodyResponseData; - getMailDialogInfo(url: string, info: IGetMailDialogInfoRequestData, sessionID: string): IGetBodyResponseData; + getMailDialogInfo(url: string, info: IGetMailDialogInfoRequestData, sessionID: string): IGetBodyResponseData; removeDialog(url: string, info: IRemoveDialogRequestData, sessionID: string): IGetBodyResponseData; pinDialog(url: string, info: IPinDialogRequestData, sessionID: string): IGetBodyResponseData; unpinDialog(url: string, info: IPinDialogRequestData, sessionID: string): IGetBodyResponseData; setRead(url: string, info: ISetDialogReadRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handles client/mail/dialog/getAllAttachments + * @returns IGetAllAttachmentsResponse + */ getAllAttachments(url: string, info: IGetAllAttachmentsRequestData, sessionID: string): IGetBodyResponseData; listOutbox(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; listInbox(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; diff --git a/TypeScript/13AddTrader/types/callbacks/GameCallbacks.d.ts b/TypeScript/13AddTrader/types/callbacks/GameCallbacks.d.ts index 5e4c240..3a6b7e6 100644 --- a/TypeScript/13AddTrader/types/callbacks/GameCallbacks.d.ts +++ b/TypeScript/13AddTrader/types/callbacks/GameCallbacks.d.ts @@ -3,6 +3,9 @@ import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { ICheckVersionResponse } from "../models/eft/game/ICheckVersionResponse"; import { IGameConfigResponse } from "../models/eft/game/IGameConfigResponse"; import { IGameEmptyCrcRequestData } from "../models/eft/game/IGameEmptyCrcRequestData"; +import { IGameKeepAliveResponse } from "../models/eft/game/IGameKeepAliveResponse"; +import { IGameLogoutResponseData } from "../models/eft/game/IGameLogoutResponseData"; +import { IGameStartResponse } from "../models/eft/game/IGameStartResponse"; import { IReportNicknameRequestData } from "../models/eft/game/IReportNicknameRequestData"; import { IServerDetails } from "../models/eft/game/IServerDetails"; import { IVersionValidateRequestData } from "../models/eft/game/IVersionValidateRequestData"; @@ -15,13 +18,37 @@ declare class GameCallbacks { protected watermark: Watermark; protected gameController: GameController; constructor(httpResponse: HttpResponseUtil, watermark: Watermark, gameController: GameController); + /** + * Handle client/game/version/validate + * @returns INullResponseData + */ versionValidate(url: string, info: IVersionValidateRequestData, sessionID: string): INullResponseData; - gameStart(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - gameLogout(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/game/start + * @returns IGameStartResponse + */ + gameStart(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/game/logout + * @returns IGameLogoutResponseData + */ + gameLogout(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/game/config + * @returns IGameConfigResponse + */ getGameConfig(url: string, info: IGameEmptyCrcRequestData, sessionID: string): IGetBodyResponseData; getServer(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; validateGameVersion(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - gameKeepalive(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/game/keepalive + * @returns IGameKeepAliveResponse + */ + gameKeepalive(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle singleplayer/settings/version + * @returns string + */ getVersion(url: string, info: IEmptyRequestData, sessionID: string): string; reportNickname(url: string, info: IReportNicknameRequestData, sessionID: string): INullResponseData; } diff --git a/TypeScript/13AddTrader/types/callbacks/HealthCallbacks.d.ts b/TypeScript/13AddTrader/types/callbacks/HealthCallbacks.d.ts index 8672be7..7edf03e 100644 --- a/TypeScript/13AddTrader/types/callbacks/HealthCallbacks.d.ts +++ b/TypeScript/13AddTrader/types/callbacks/HealthCallbacks.d.ts @@ -21,7 +21,19 @@ export declare class HealthCallbacks { * @returns empty response, no data sent back to client */ syncHealth(url: string, info: ISyncHealthRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle Eat + * @returns IItemEventRouterResponse + */ offraidEat(pmcData: IPmcData, body: IOffraidEatRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle Heal + * @returns IItemEventRouterResponse + */ offraidHeal(pmcData: IPmcData, body: IOffraidHealRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle RestoreHealth + * @returns IItemEventRouterResponse + */ healthTreatment(pmcData: IPmcData, info: IHealthTreatmentRequestData, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/13AddTrader/types/callbacks/HideoutCallbacks.d.ts b/TypeScript/13AddTrader/types/callbacks/HideoutCallbacks.d.ts index 99ab4c9..e39e806 100644 --- a/TypeScript/13AddTrader/types/callbacks/HideoutCallbacks.d.ts +++ b/TypeScript/13AddTrader/types/callbacks/HideoutCallbacks.d.ts @@ -19,14 +19,77 @@ export declare class HideoutCallbacks extends OnUpdate { protected hideoutConfig: IHideoutConfig; constructor(hideoutController: HideoutController, // TODO: delay needed configServer: ConfigServer); + /** + * Handle HideoutUpgrade + * @param pmcData + * @param body + * @param sessionID + * @returns + */ upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutUpgradeComplete + * @param pmcData + * @param body + * @param sessionID + * @returns + */ upgradeComplete(pmcData: IPmcData, body: IHideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutPutItemsInAreaSlots + * @param pmcData + * @param body + * @param sessionID + * @returns + */ putItemsInAreaSlots(pmcData: IPmcData, body: IHideoutPutItemInRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutTakeItemsFromAreaSlots + * @param pmcData + * @param body + * @param sessionID + * @returns + */ takeItemsFromAreaSlots(pmcData: IPmcData, body: IHideoutTakeItemOutRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutToggleArea + * @param pmcData + * @param body + * @param sessionID + * @returns + */ toggleArea(pmcData: IPmcData, body: IHideoutToggleAreaRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutSingleProductionStart + * @param pmcData + * @param body + * @param sessionID + * @returns + */ singleProductionStart(pmcData: IPmcData, body: IHideoutSingleProductionStartRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutScavCaseProductionStart + * @param pmcData + * @param body + * @param sessionID + * @returns + */ scavCaseProductionStart(pmcData: IPmcData, body: IHideoutScavCaseStartRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutContinuousProductionStart + * @param pmcData + * @param body + * @param sessionID + * @returns + */ continuousProductionStart(pmcData: IPmcData, body: IHideoutContinousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutTakeProduction + * @param pmcData + * @param body + * @param sessionID + * @returns + */ takeProduction(pmcData: IPmcData, body: IHideoutTakeProductionRequestData, sessionID: string): IItemEventRouterResponse; onUpdate(timeSinceLastRun: number): boolean; getRoute(): string; diff --git a/TypeScript/13AddTrader/types/callbacks/InraidCallbacks.d.ts b/TypeScript/13AddTrader/types/callbacks/InraidCallbacks.d.ts index 05bcce4..918bfaf 100644 --- a/TypeScript/13AddTrader/types/callbacks/InraidCallbacks.d.ts +++ b/TypeScript/13AddTrader/types/callbacks/InraidCallbacks.d.ts @@ -1,23 +1,49 @@ import { InraidController } from "../controllers/InraidController"; -import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { INullResponseData } from "../models/eft/httpResponse/INullResponseData"; import { IRegisterPlayerRequestData } from "../models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; -import { IAirdropConfig } from "../models/spt/config/IAirdropConfig"; -import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; -import { ConfigServer } from "../servers/ConfigServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +/** + * Handle client requests + */ export declare class InraidCallbacks { protected inraidController: InraidController; protected httpResponse: HttpResponseUtil; - protected configServer: ConfigServer; - protected airdropConfig: IAirdropConfig; - protected inraidConfig: IInRaidConfig; - constructor(inraidController: InraidController, httpResponse: HttpResponseUtil, configServer: ConfigServer); + constructor(inraidController: InraidController, httpResponse: HttpResponseUtil); + /** + * Handle client/location/getLocalloot + * @param url + * @param info register player request + * @param sessionID Session id + * @returns Null http response + */ registerPlayer(url: string, info: IRegisterPlayerRequestData, sessionID: string): INullResponseData; + /** + * Handle raid/profile/save + * @param url + * @param info Save progress request + * @param sessionID Session id + * @returns Null http response + */ saveProgress(url: string, info: ISaveProgressRequestData, sessionID: string): INullResponseData; + /** + * Handle singleplayer/settings/raid/endstate + * @returns + */ getRaidEndState(): string; - getRaidMenuSettings(url: string, info: IEmptyRequestData, sessionID: string): string; - getWeaponDurability(url: string, info: any, sessionID: string): string; - getAirdropConfig(url: string, info: any, sessionID: string): string; + /** + * Handle singleplayer/settings/raid/menu + * @returns JSON as string + */ + getRaidMenuSettings(): string; + /** + * Handle singleplayer/settings/weapon/durability + * @returns + */ + getWeaponDurability(): string; + /** + * Handle singleplayer/airdrop/config + * @returns JSON as string + */ + getAirdropConfig(): string; } diff --git a/TypeScript/13AddTrader/types/callbacks/InsuranceCallbacks.d.ts b/TypeScript/13AddTrader/types/callbacks/InsuranceCallbacks.d.ts index 8835ba2..a171e1c 100644 --- a/TypeScript/13AddTrader/types/callbacks/InsuranceCallbacks.d.ts +++ b/TypeScript/13AddTrader/types/callbacks/InsuranceCallbacks.d.ts @@ -17,7 +17,15 @@ export declare class InsuranceCallbacks extends OnUpdate { protected configServer: ConfigServer; protected insuranceConfig: IInsuranceConfig; constructor(insuranceController: InsuranceController, insuranceService: InsuranceService, httpResponse: HttpResponseUtil, configServer: ConfigServer); + /** + * Handle client/insurance/items/list/cost + * @returns IGetInsuranceCostResponseData + */ getInsuranceCost(url: string, info: IGetInsuranceCostRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle Insure + * @returns IItemEventRouterResponse + */ insure(pmcData: IPmcData, body: IInsureRequestData, sessionID: string): IItemEventRouterResponse; onUpdate(secondsSinceLastRun: number): boolean; getRoute(): string; diff --git a/TypeScript/13AddTrader/types/callbacks/InventoryCallbacks.d.ts b/TypeScript/13AddTrader/types/callbacks/InventoryCallbacks.d.ts index 9ab1486..46bf6fd 100644 --- a/TypeScript/13AddTrader/types/callbacks/InventoryCallbacks.d.ts +++ b/TypeScript/13AddTrader/types/callbacks/InventoryCallbacks.d.ts @@ -16,6 +16,7 @@ import { IInventorySwapRequestData } from "../models/eft/inventory/IInventorySwa import { IInventoryTagRequestData } from "../models/eft/inventory/IInventoryTagRequestData"; import { IInventoryToggleRequestData } from "../models/eft/inventory/IInventoryToggleRequestData"; import { IInventoryTransferRequestData } from "../models/eft/inventory/IInventoryTransferRequestData"; +import { IOpenRandomLootContainerRequestData } from "../models/eft/inventory/IOpenRandomLootContainerRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; export declare class InventoryCallbacks { protected inventoryController: InventoryController; @@ -36,4 +37,5 @@ export declare class InventoryCallbacks { createMapMarker(pmcData: IPmcData, body: IInventoryCreateMarkerRequestData, sessionID: string): IItemEventRouterResponse; deleteMapMarker(pmcData: IPmcData, body: IInventoryDeleteMarkerRequestData, sessionID: string): IItemEventRouterResponse; editMapMarker(pmcData: IPmcData, body: IInventoryEditMarkerRequestData, sessionID: string): IItemEventRouterResponse; + openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/13AddTrader/types/callbacks/ItemEventCallbacks.d.ts b/TypeScript/13AddTrader/types/callbacks/ItemEventCallbacks.d.ts index f4f04f9..fbb0b5f 100644 --- a/TypeScript/13AddTrader/types/callbacks/ItemEventCallbacks.d.ts +++ b/TypeScript/13AddTrader/types/callbacks/ItemEventCallbacks.d.ts @@ -1,4 +1,5 @@ import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; +import { Warning } from "../models/eft/itemEvent/IItemEventRouterBase"; import { IItemEventRouterRequest } from "../models/eft/itemEvent/IItemEventRouterRequest"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { ItemEventRouter } from "../routers/ItemEventRouter"; @@ -8,4 +9,5 @@ export declare class ItemEventCallbacks { protected itemEventRouter: ItemEventRouter; constructor(httpResponse: HttpResponseUtil, itemEventRouter: ItemEventRouter); handleEvents(url: string, info: IItemEventRouterRequest, sessionID: string): IGetBodyResponseData; + protected getErrorCode(warnings: Warning[]): number; } diff --git a/TypeScript/13AddTrader/types/callbacks/MatchCallbacks.d.ts b/TypeScript/13AddTrader/types/callbacks/MatchCallbacks.d.ts index 2a92ef5..10fbc44 100644 --- a/TypeScript/13AddTrader/types/callbacks/MatchCallbacks.d.ts +++ b/TypeScript/13AddTrader/types/callbacks/MatchCallbacks.d.ts @@ -34,6 +34,10 @@ export declare class MatchCallbacks { serverAvailable(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData | IGetBodyResponseData; joinMatch(url: string, info: IJoinMatchRequestData, sessionID: string): IGetBodyResponseData; getMetrics(url: string, info: any, sessionID: string): IGetBodyResponseData; + /** + * Handle client/match/group/status + * @returns + */ getGroupStatus(url: string, info: IGetGroupStatusRequestData, sessionID: string): IGetBodyResponseData; createGroup(url: string, info: ICreateGroupRequestData, sessionID: string): IGetBodyResponseData; deleteGroup(url: string, info: any, sessionID: string): INullResponseData; diff --git a/TypeScript/13AddTrader/types/callbacks/NotifierCallbacks.d.ts b/TypeScript/13AddTrader/types/callbacks/NotifierCallbacks.d.ts index c42058f..fab325b 100644 --- a/TypeScript/13AddTrader/types/callbacks/NotifierCallbacks.d.ts +++ b/TypeScript/13AddTrader/types/callbacks/NotifierCallbacks.d.ts @@ -4,6 +4,7 @@ import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { INotifierChannel } from "../models/eft/notifier/INotifier"; import { ISelectProfileRequestData } from "../models/eft/notifier/ISelectProfileRequestData"; +import { ISelectProfileResponse } from "../models/eft/notifier/ISelectProfileResponse"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; export declare class NotifierCallbacks { protected httpServerHelper: HttpServerHelper; @@ -19,6 +20,10 @@ export declare class NotifierCallbacks { sendNotification(sessionID: string, req: any, resp: any, data: any): void; getNotifier(url: string, info: any, sessionID: string): IGetBodyResponseData; createNotifierChannel(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - selectProfile(url: string, info: ISelectProfileRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/game/profile/select + * @returns ISelectProfileResponse + */ + selectProfile(url: string, info: ISelectProfileRequestData, sessionID: string): IGetBodyResponseData; notify(url: string, info: any, sessionID: string): string; } diff --git a/TypeScript/13AddTrader/types/callbacks/QuestCallbacks.d.ts b/TypeScript/13AddTrader/types/callbacks/QuestCallbacks.d.ts index 559c29e..2a3eb20 100644 --- a/TypeScript/13AddTrader/types/callbacks/QuestCallbacks.d.ts +++ b/TypeScript/13AddTrader/types/callbacks/QuestCallbacks.d.ts @@ -21,6 +21,13 @@ export declare class QuestCallbacks { acceptQuest(pmcData: IPmcData, body: IAcceptQuestRequestData, sessionID: string): IItemEventRouterResponse; completeQuest(pmcData: IPmcData, body: ICompleteQuestRequestData, sessionID: string): IItemEventRouterResponse; handoverQuest(pmcData: IPmcData, body: IHandoverQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle client/quest/list + * @param url + * @param info + * @param sessionID + * @returns + */ listQuests(url: string, info: IListQuestsRequestData, sessionID: string): IGetBodyResponseData; activityPeriods(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; } diff --git a/TypeScript/13AddTrader/types/callbacks/RagfairCallbacks.d.ts b/TypeScript/13AddTrader/types/callbacks/RagfairCallbacks.d.ts index c609f2f..37f3807 100644 --- a/TypeScript/13AddTrader/types/callbacks/RagfairCallbacks.d.ts +++ b/TypeScript/13AddTrader/types/callbacks/RagfairCallbacks.d.ts @@ -35,7 +35,7 @@ export declare class RagfairCallbacks extends OnLoadOnUpdate { getRoute(): string; search(url: string, info: ISearchRequestData, sessionID: string): IGetBodyResponseData; getMarketPrice(url: string, info: IGetMarketPriceRequestData, sessionID: string): IGetBodyResponseData; - getItemPrices(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + getItemPrices(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData>; addOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; removeOffer(pmcData: IPmcData, info: IRemoveOfferRequestData, sessionID: string): IItemEventRouterResponse; extendOffer(pmcData: IPmcData, info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; diff --git a/TypeScript/13AddTrader/types/callbacks/TraderCallbacks.d.ts b/TypeScript/13AddTrader/types/callbacks/TraderCallbacks.d.ts index e4fd099..40a1455 100644 --- a/TypeScript/13AddTrader/types/callbacks/TraderCallbacks.d.ts +++ b/TypeScript/13AddTrader/types/callbacks/TraderCallbacks.d.ts @@ -12,6 +12,10 @@ export declare class TraderCallbacks extends OnLoadOnUpdate { onUpdate(): boolean; getRoute(): string; getTraderSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/trading/api/getUserAssortPrice/trader + * @returns + */ getProfilePurchases(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData>; getTrader(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getAssort(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; diff --git a/TypeScript/13AddTrader/types/callbacks/WeatherCallbacks.d.ts b/TypeScript/13AddTrader/types/callbacks/WeatherCallbacks.d.ts index ae784c8..f9d2002 100644 --- a/TypeScript/13AddTrader/types/callbacks/WeatherCallbacks.d.ts +++ b/TypeScript/13AddTrader/types/callbacks/WeatherCallbacks.d.ts @@ -1,10 +1,15 @@ import { WeatherController } from "../controllers/WeatherController"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; +import { IWeatherData } from "../models/eft/weather/IWeatherData"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; export declare class WeatherCallbacks { protected httpResponse: HttpResponseUtil; protected weatherController: WeatherController; constructor(httpResponse: HttpResponseUtil, weatherController: WeatherController); - getWeather(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/weather + * @returns IWeatherData + */ + getWeather(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; } diff --git a/TypeScript/13AddTrader/types/context/ContextVariableType.d.ts b/TypeScript/13AddTrader/types/context/ContextVariableType.d.ts index 5fc1704..a7dd9b5 100644 --- a/TypeScript/13AddTrader/types/context/ContextVariableType.d.ts +++ b/TypeScript/13AddTrader/types/context/ContextVariableType.d.ts @@ -1,4 +1,8 @@ export declare enum ContextVariableType { + /** Logged in users session id */ SESSION_ID = 0, - MATCH_INFO = 1 + /** Currently acive raid information */ + MATCH_INFO = 1, + /** Timestamp when client first connected */ + CLIENT_START_TIMESTAMP = 2 } diff --git a/TypeScript/13AddTrader/types/controllers/BotController.d.ts b/TypeScript/13AddTrader/types/controllers/BotController.d.ts index a5111d5..92317c3 100644 --- a/TypeScript/13AddTrader/types/controllers/BotController.d.ts +++ b/TypeScript/13AddTrader/types/controllers/BotController.d.ts @@ -1,6 +1,8 @@ import { ApplicationContext } from "../context/ApplicationContext"; import { BotGenerator } from "../generators/BotGenerator"; +import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { IGenerateBotsRequestData } from "../models/eft/bot/IGenerateBotsRequestData"; import { IBotBase } from "../models/eft/common/tables/IBotBase"; import { IBotCore } from "../models/eft/common/tables/IBotCore"; @@ -10,18 +12,23 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; -import { PmcAiService } from "../services/PmcAiService"; +import { LocalisationService } from "../services/LocalisationService"; +import { JsonUtil } from "../utils/JsonUtil"; export declare class BotController { protected logger: ILogger; protected databaseServer: DatabaseServer; protected botGenerator: BotGenerator; protected botHelper: BotHelper; - protected pmcAiService: PmcAiService; + protected botDifficultyHelper: BotDifficultyHelper; protected botGenerationCacheService: BotGenerationCacheService; + protected localisationService: LocalisationService; + protected weightedRandomHelper: WeightedRandomHelper; protected configServer: ConfigServer; protected applicationContext: ApplicationContext; + protected jsonUtil: JsonUtil; protected botConfig: IBotConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, pmcAiService: PmcAiService, botGenerationCacheService: BotGenerationCacheService, configServer: ConfigServer, applicationContext: ApplicationContext); + static readonly pmcTypeLabel = "PMC"; + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); /** * Return the number of bot loadout varieties to be generated * @param type bot Type we want the loadout gen count for @@ -37,7 +44,6 @@ export declare class BotController { * @returns Difficulty object */ getBotDifficulty(type: string, difficulty: string): Difficulty; - protected getPmcDifficultySettings(pmcType: "bear" | "usec", difficulty: string, usecType: string, bearType: string): Difficulty; /** * Generate bot profiles and store in cache * @param sessionId Session id @@ -51,4 +57,5 @@ export declare class BotController { * @returns cap number */ getBotCap(): number; + getPmcBotTypes(): Record>>; } diff --git a/TypeScript/13AddTrader/types/controllers/DialogueController.d.ts b/TypeScript/13AddTrader/types/controllers/DialogueController.d.ts index 1b72522..9c8b728 100644 --- a/TypeScript/13AddTrader/types/controllers/DialogueController.d.ts +++ b/TypeScript/13AddTrader/types/controllers/DialogueController.d.ts @@ -23,7 +23,7 @@ export declare class DialogueController { * Get the content of a dialogue * @param dialogueID Dialog id * @param sessionID Session Id - * @returns + * @returns DialogueInfo */ getDialogueInfo(dialogueID: string, sessionID: string): DialogueInfo; /** diff --git a/TypeScript/13AddTrader/types/controllers/GameController.d.ts b/TypeScript/13AddTrader/types/controllers/GameController.d.ts index 3bfbdb1..f4f5849 100644 --- a/TypeScript/13AddTrader/types/controllers/GameController.d.ts +++ b/TypeScript/13AddTrader/types/controllers/GameController.d.ts @@ -1,3 +1,4 @@ +import { ApplicationContext } from "../context/ApplicationContext"; import { GameEventHelper } from "../helpers/GameEventHelper"; import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; @@ -14,6 +15,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; +import { LocalisationService } from "../services/LocalisationService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { Watermark } from "../utils/Watermark"; export declare class GameController { @@ -24,14 +26,33 @@ export declare class GameController { protected localeService: LocaleService; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; + protected localisationService: LocalisationService; protected gameEventHelper: GameEventHelper; + protected applicationContext: ApplicationContext; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; protected coreConfig: ICoreConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, gameEventHelper: GameEventHelper, configServer: ConfigServer); - gameStart(_url: string, _info: IEmptyRequestData, sessionID: string): void; + constructor(logger: ILogger, databaseServer: DatabaseServer, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, gameEventHelper: GameEventHelper, applicationContext: ApplicationContext, configServer: ConfigServer); + gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; + /** + * Check if current date falls inside any of the seasons events pased in, if so, handle them + * @param seasonalEvents events to check for + */ protected checkForAndEnableSeasonalEvents(seasonalEvents: ISeasonalEvent[]): void; + /** + * Make adjusted to server code based on the name of the event passed in + * @param globalConfig globals.json + * @param eventName Name of the event to enable. e.g. Christmas + */ protected updateGlobalEvents(globalConfig: Config, eventName: string): void; + /** + * Read in data from seasonalEvents.json and add found equipment items to bots + * @param eventName Name of the event to read equipment in from config + */ + protected addEventGearToScavs(eventName: string): void; + /** + * Set Khorovod(dancing tree) chance to 100% on all maps that support it + */ protected enableDancingTree(): void; /** * Make non-trigger-spawned raiders spawn earlier + always @@ -40,5 +61,6 @@ export declare class GameController { protected logProfileDetails(fullProfile: IAkiProfile): void; getGameConfig(sessionID: string): IGameConfigResponse; getServer(): IServerDetails[]; + protected addPumpkinsToScavBackpacks(): void; getValidGameVersion(): ICheckVersionResponse; } diff --git a/TypeScript/13AddTrader/types/controllers/HideoutController.d.ts b/TypeScript/13AddTrader/types/controllers/HideoutController.d.ts index ada5bd9..5b6507b 100644 --- a/TypeScript/13AddTrader/types/controllers/HideoutController.d.ts +++ b/TypeScript/13AddTrader/types/controllers/HideoutController.d.ts @@ -23,12 +23,13 @@ import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; import { PlayerService } from "../services/PlayerService"; import { HashUtil } from "../utils/HashUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; -import { JsonUtil } from "../utils/JsonUtil"; export declare class HideoutController { protected logger: ILogger; protected hashUtil: HashUtil; @@ -45,11 +46,12 @@ export declare class HideoutController { protected profileHelper: ProfileHelper; protected hideoutHelper: HideoutHelper; protected scavCaseRewardGenerator: ScavCaseRewardGenerator; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected jsonUtil: JsonUtil; protected static nameBackendCountersCrafting: string; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, configServer: ConfigServer, jsonUtil: JsonUtil); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, localisationService: LocalisationService, configServer: ConfigServer, jsonUtil: JsonUtil); upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; upgradeComplete(pmcData: IPmcData, body: HideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; /** diff --git a/TypeScript/13AddTrader/types/controllers/InraidController.d.ts b/TypeScript/13AddTrader/types/controllers/InraidController.d.ts index e84eea1..39a6396 100644 --- a/TypeScript/13AddTrader/types/controllers/InraidController.d.ts +++ b/TypeScript/13AddTrader/types/controllers/InraidController.d.ts @@ -6,6 +6,7 @@ import { ProfileHelper } from "../helpers/ProfileHelper"; import { QuestHelper } from "../helpers/QuestHelper"; import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; +import { Item } from "../models/eft/common/tables/IItem"; import { IRegisterPlayerRequestData } from "../models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; import { IAirdropConfig } from "../models/spt/config/IAirdropConfig"; @@ -17,6 +18,9 @@ import { SaveServer } from "../servers/SaveServer"; import { InsuranceService } from "../services/InsuranceService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; +/** + * Logic for handling In Raid callbacks + */ export declare class InraidController { protected logger: ILogger; protected saveServer: SaveServer; @@ -35,14 +39,42 @@ export declare class InraidController { protected airdropConfig: IAirdropConfig; protected inraidConfig: IInRaidConfig; 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 + * Save locationid to active profiles inraid object + * @param sessionID Session id + * @param info Register player request + */ + addPlayer(sessionID: string, info: IRegisterPlayerRequestData): void; + /** + * Save profile state to disk + * Handles pmc/pscav + * @param offraidData post-raid request data + * @param sessionID Session id + */ + savePostRaidProgress(offraidData: ISaveProgressRequestData, sessionID: string): void; + /** + * Handle updating player profile post-pmc raid * @param sessionID session id - * @param offraidData post-raid data of raid + * @param offraidData post-raid data */ protected savePmcProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; + /** + * Make changes to pmc profile after they left raid dead, + * alter bodypart hp, handle insurance, delete inventory items, remove carried quest items + * @param postRaidSaveRequest post-raid save request + * @param pmcData pmc profile + * @param insuranceEnabled is insurance enabled + * @param preRaidGear gear player had before raid + * @param sessionID Session id + * @returns Updated profile object + */ + protected performPostRaidActionsWhenDead(postRaidSaveRequest: ISaveProgressRequestData, pmcData: IPmcData, insuranceEnabled: boolean, preRaidGear: Item[], sessionID: string): IPmcData; + /** + * Adjust player characters bodypart hp if they left raid early + * @param postRaidSaveRequest post raid data + * @param pmcData player profile + */ + protected updatePmcHealthPostRaid(postRaidSaveRequest: ISaveProgressRequestData, pmcData: IPmcData): void; /** * Reduce body part hp to % of max * @param pmcData profile to edit @@ -68,7 +100,31 @@ export declare class InraidController { * @param isPlayerScav Was the player a pScav */ protected markOrRemoveFoundInRaidItems(offraidData: ISaveProgressRequestData, pmcData: IPmcData, isPlayerScav: boolean): void; + /** + * Update profile after player completes scav raid + * @param scavData Scav profile + * @param sessionID Session id + * @param offraidData Post-raid save request + * @param pmcData Pmc profile + * @param isDead Is player dead + */ protected handlePostRaidPlayerScavProcess(scavData: IPmcData, sessionID: string, offraidData: ISaveProgressRequestData, pmcData: IPmcData, isDead: boolean): void; + /** + * Update profile with scav karma values based on in-raid actions + * @param pmcData Pmc profile + * @param offraidData Post-raid save request + * @param scavData Scav profile + * @param sessionID Session id + */ protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData, scavData: IPmcData, sessionID: string): void; + /** + * Get the inraid config from configs/inraid.json + * @returns InRaid Config + */ + getInraidConfig(): IInRaidConfig; + /** + * Get airdrop config from configs/airdrop.json + * @returns Airdrop config + */ getAirdropConfig(): IAirdropConfig; } diff --git a/TypeScript/13AddTrader/types/controllers/InsuranceController.d.ts b/TypeScript/13AddTrader/types/controllers/InsuranceController.d.ts index 14bf129..54f31b5 100644 --- a/TypeScript/13AddTrader/types/controllers/InsuranceController.d.ts +++ b/TypeScript/13AddTrader/types/controllers/InsuranceController.d.ts @@ -30,8 +30,7 @@ export declare class InsuranceController { protected insuranceService: InsuranceService; protected configServer: ConfigServer; protected insuranceConfig: IInsuranceConfig; - constructor(logger: ILogger, randomUtil: RandomUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, paymentService: PaymentService, // TODO: delay required - insuranceService: InsuranceService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, paymentService: PaymentService, insuranceService: InsuranceService, configServer: ConfigServer); processReturn(): void; insure(pmcData: IPmcData, body: IInsureRequestData, sessionID: string): IItemEventRouterResponse; /** diff --git a/TypeScript/13AddTrader/types/controllers/InventoryController.d.ts b/TypeScript/13AddTrader/types/controllers/InventoryController.d.ts index 6a1a21e..e1c08c0 100644 --- a/TypeScript/13AddTrader/types/controllers/InventoryController.d.ts +++ b/TypeScript/13AddTrader/types/controllers/InventoryController.d.ts @@ -1,8 +1,8 @@ -import { EventOutputHolder } from "../routers/EventOutputHolder"; import { InventoryHelper } from "../helpers/InventoryHelper"; import { PaymentHelper } from "../helpers/PaymentHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IAddItemRequestData } from "../models/eft/inventory/IAddItemRequestData"; import { IInventoryBindRequestData } from "../models/eft/inventory/IInventoryBindRequestData"; @@ -21,33 +21,46 @@ import { IInventorySwapRequestData } from "../models/eft/inventory/IInventorySwa import { IInventoryTagRequestData } from "../models/eft/inventory/IInventoryTagRequestData"; import { IInventoryToggleRequestData } from "../models/eft/inventory/IInventoryToggleRequestData"; import { IInventoryTransferRequestData } from "../models/eft/inventory/IInventoryTransferRequestData"; +import { IOpenRandomLootContainerRequestData } from "../models/eft/inventory/IOpenRandomLootContainerRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { ILogger } from "../models/spt/utils/ILogger"; +import { EventOutputHolder } from "../routers/EventOutputHolder"; import { DatabaseServer } from "../servers/DatabaseServer"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { HashUtil } from "../utils/HashUtil"; +import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { JsonUtil } from "../utils/JsonUtil"; +import { RandomUtil } from "../utils/RandomUtil"; export declare class InventoryController { protected logger: ILogger; protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; + protected randomUtil: RandomUtil; protected databaseServer: DatabaseServer; protected fenceService: FenceService; protected presetHelper: PresetHelper; protected inventoryHelper: InventoryHelper; protected ragfairOfferService: RagfairOfferService; protected profileHelper: ProfileHelper; + protected weightedRandomHelper: WeightedRandomHelper; protected paymentHelper: PaymentHelper; + protected localisationService: LocalisationService; protected eventOutputHolder: EventOutputHolder; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder); + protected httpResponseUtil: HttpResponseUtil; + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, weightedRandomHelper: WeightedRandomHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); /** * Move Item * change location of item with parentId and slotId * transfers items from one profile to another if fromOwner/toOwner is set in the body. * otherwise, move is contained within the same profile_f. - */ - moveItem(pmcData: IPmcData, body: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; + * @param pmcData Profile + * @param moveRequest Move request data + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ + moveItem(pmcData: IPmcData, moveRequest: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; /** * Remove Item from Profile * Deep tree item deletion, also removes items from insurance list @@ -122,4 +135,12 @@ export declare class InventoryController { createMapMarker(pmcData: IPmcData, body: IInventoryCreateMarkerRequestData, sessionID: string): IItemEventRouterResponse; deleteMapMarker(pmcData: IPmcData, body: IInventoryDeleteMarkerRequestData, sessionID: string): IItemEventRouterResponse; editMapMarker(pmcData: IPmcData, body: IInventoryEditMarkerRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle event fired when a container is unpacked (currently only the halloween pumpkin) + * @param pmcData Profile data + * @param body open loot container request data + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ + openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/13AddTrader/types/controllers/LocationController.d.ts b/TypeScript/13AddTrader/types/controllers/LocationController.d.ts index 9db3205..b6feba8 100644 --- a/TypeScript/13AddTrader/types/controllers/LocationController.d.ts +++ b/TypeScript/13AddTrader/types/controllers/LocationController.d.ts @@ -7,6 +7,7 @@ import { LootItem } from "../models/spt/services/LootItem"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -15,12 +16,13 @@ export declare class LocationController { protected hashUtil: HashUtil; protected logger: ILogger; protected locationGenerator: LocationGenerator; + protected localisationService: LocalisationService; protected lootGenerator: LootGenerator; protected databaseServer: DatabaseServer; protected timeUtil: TimeUtil; protected configServer: ConfigServer; protected airdropConfig: IAirdropConfig; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, logger: ILogger, locationGenerator: LocationGenerator, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer); + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer); get(location: string): ILocationBase; generate(name: string): ILocationBase; generateAll(): ILocationsGenerateAllResponse; diff --git a/TypeScript/13AddTrader/types/controllers/MatchController.d.ts b/TypeScript/13AddTrader/types/controllers/MatchController.d.ts index dac6a3f..2b0d150 100644 --- a/TypeScript/13AddTrader/types/controllers/MatchController.d.ts +++ b/TypeScript/13AddTrader/types/controllers/MatchController.d.ts @@ -19,7 +19,6 @@ import { SaveServer } from "../servers/SaveServer"; import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; import { BotLootCacheService } from "../services/BotLootCacheService"; import { MatchLocationService } from "../services/MatchLocationService"; -import { PmcAiService } from "../services/PmcAiService"; import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; export declare class MatchController { protected logger: ILogger; @@ -30,13 +29,12 @@ export declare class MatchController { protected botLootCacheService: BotLootCacheService; protected configServer: ConfigServer; protected profileSnapshotService: ProfileSnapshotService; - protected pmcAiService: PmcAiService; protected botGenerationCacheService: BotGenerationCacheService; 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, pmcAiService: PmcAiService, botGenerationCacheService: BotGenerationCacheService, applicationContext: ApplicationContext); + constructor(logger: ILogger, saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, botGenerationCacheService: BotGenerationCacheService, applicationContext: ApplicationContext); getEnabled(): boolean; getProfile(info: IGetProfileRequestData): IPmcData[]; createGroup(sessionID: string, info: ICreateGroupRequestData): any; diff --git a/TypeScript/13AddTrader/types/controllers/RagfairController.d.ts b/TypeScript/13AddTrader/types/controllers/RagfairController.d.ts index 5440458..95702f2 100644 --- a/TypeScript/13AddTrader/types/controllers/RagfairController.d.ts +++ b/TypeScript/13AddTrader/types/controllers/RagfairController.d.ts @@ -29,6 +29,7 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { RagfairServer } from "../servers/RagfairServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; import { PaymentService } from "../services/PaymentService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { RagfairPriceService } from "../services/RagfairPriceService"; @@ -62,9 +63,10 @@ export declare class RagfairController { protected ragfairOfferService: RagfairOfferService; protected ragfairRequiredItemsService: RagfairRequiredItemsService; protected ragfairOfferGenerator: RagfairOfferGenerator; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, eventOutputHolder: EventOutputHolder, ragfairServer: RagfairServer, ragfairPriceService: RagfairPriceService, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer, ragfairSellHelper: RagfairSellHelper, ragfairTaxHelper: RagfairTaxHelper, ragfairSortHelper: RagfairSortHelper, ragfairOfferHelper: RagfairOfferHelper, profileHelper: ProfileHelper, paymentService: PaymentService, handbookHelper: HandbookHelper, paymentHelper: PaymentHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, ragfairOfferGenerator: RagfairOfferGenerator, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, eventOutputHolder: EventOutputHolder, ragfairServer: RagfairServer, ragfairPriceService: RagfairPriceService, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer, ragfairSellHelper: RagfairSellHelper, ragfairTaxHelper: RagfairTaxHelper, ragfairSortHelper: RagfairSortHelper, ragfairOfferHelper: RagfairOfferHelper, profileHelper: ProfileHelper, paymentService: PaymentService, handbookHelper: HandbookHelper, paymentHelper: PaymentHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, ragfairOfferGenerator: RagfairOfferGenerator, localisationService: LocalisationService, configServer: ConfigServer); getOffers(sessionID: string, info: ISearchRequestData): IGetOffersResult; /** * Get offers for the client based on type of search being performed @@ -103,7 +105,12 @@ export declare class RagfairController { protected isLinkedSearch(info: ISearchRequestData): boolean; protected isRequiredSearch(info: ISearchRequestData): boolean; update(): void; - getItemPrice(info: IGetMarketPriceRequestData): IGetItemPriceResult; + /** + * Called when creating an offer on flea, fills values in top right corner + * @param getPriceRequest + * @returns min/avg/max values for an item based on flea offers available + */ + getItemMinAvgMaxFleaPriceValues(getPriceRequest: IGetMarketPriceRequestData): IGetItemPriceResult; addPlayerOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; createPlayerOffer(profile: IAkiProfile, requirements: Requirement[], items: Item[], sellInOnePiece: boolean, amountToSend: number): IRagfairOffer; getAllFleaPrices(): Record; diff --git a/TypeScript/13AddTrader/types/controllers/RepeatableQuestController.d.ts b/TypeScript/13AddTrader/types/controllers/RepeatableQuestController.d.ts index 7db5886..333583b 100644 --- a/TypeScript/13AddTrader/types/controllers/RepeatableQuestController.d.ts +++ b/TypeScript/13AddTrader/types/controllers/RepeatableQuestController.d.ts @@ -17,6 +17,7 @@ import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { ItemFilterService } from "../services/ItemFilterService"; +import { LocalisationService } from "../services/LocalisationService"; import { PaymentService } from "../services/PaymentService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { JsonUtil } from "../utils/JsonUtil"; @@ -64,12 +65,13 @@ export declare class RepeatableQuestController { protected profileFixerService: ProfileFixerService; protected ragfairServerHelper: RagfairServerHelper; protected eventOutputHolder: EventOutputHolder; + protected localisationService: LocalisationService; protected paymentService: PaymentService; protected objectId: ObjectId; protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * This is the method reached by the /client/repeatalbeQuests/activityPeriods endpoint * Returns an array of objects in the format of repeatable quests to the client. diff --git a/TypeScript/13AddTrader/types/controllers/WeatherController.d.ts b/TypeScript/13AddTrader/types/controllers/WeatherController.d.ts index ca7f5eb..631a90c 100644 --- a/TypeScript/13AddTrader/types/controllers/WeatherController.d.ts +++ b/TypeScript/13AddTrader/types/controllers/WeatherController.d.ts @@ -1,11 +1,18 @@ import { WeatherGenerator } from "../generators/WeatherGenerator"; import { IWeatherData } from "../models/eft/weather/IWeatherData"; import { IWeatherConfig } from "../models/spt/config/IWeatherConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; export declare class WeatherController { protected weatherGenerator: WeatherGenerator; + protected logger: ILogger; protected configServer: ConfigServer; protected weatherConfig: IWeatherConfig; - constructor(weatherGenerator: WeatherGenerator, configServer: ConfigServer); + constructor(weatherGenerator: WeatherGenerator, logger: ILogger, configServer: ConfigServer); generate(): IWeatherData; + /** + * Get the current in-raid time (MUST HAVE PLAYER LOGGED INTO CLIENT TO WORK) + * @returns Date object + */ + getCurrentInRaidTime(): Date; } diff --git a/TypeScript/13AddTrader/types/generators/BotGenerator.d.ts b/TypeScript/13AddTrader/types/generators/BotGenerator.d.ts index 2ac51db..a1ac9ed 100644 --- a/TypeScript/13AddTrader/types/generators/BotGenerator.d.ts +++ b/TypeScript/13AddTrader/types/generators/BotGenerator.d.ts @@ -1,7 +1,8 @@ +import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; import { GameEventHelper } from "../helpers/GameEventHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; -import { IGenerateBotsRequestData } from "../models/eft/bot/IGenerateBotsRequestData"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { Health as PmcHealth, IBotBase, Skills } from "../models/eft/common/tables/IBotBase"; import { Health, IBotType, Inventory } from "../models/eft/common/tables/IBotType"; import { IBotConfig } from "../models/spt/config/IBotConfig"; @@ -9,7 +10,6 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; -import { PmcAiService } from "../services/PmcAiService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; @@ -29,12 +29,13 @@ export declare class BotGenerator { protected databaseServer: DatabaseServer; protected botInventoryGenerator: BotInventoryGenerator; protected botEquipmentFilterService: BotEquipmentFilterService; + protected weightedRandomHelper: WeightedRandomHelper; protected botHelper: BotHelper; + protected botDifficultyHelper: BotDifficultyHelper; protected gameEventHelper: GameEventHelper; - protected pmcAiService: PmcAiService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botEquipmentFilterService: BotEquipmentFilterService, botHelper: BotHelper, gameEventHelper: GameEventHelper, pmcAiService: PmcAiService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botEquipmentFilterService: BotEquipmentFilterService, weightedRandomHelper: WeightedRandomHelper, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, gameEventHelper: GameEventHelper, configServer: ConfigServer); /** * Generate a player scav bot object * @param role e.g. assault / pmcbot @@ -44,12 +45,18 @@ export declare class BotGenerator { */ generatePlayerScav(sessionId: string, role: string, difficulty: string, botTemplate: IBotType): IBotBase; /** - * Generate an array of bot objects for populate a raid with + * Generate an array of bot objects based on a condition for a raid with * @param sessionId session id - * @param info request object + * @param condition request condition * @returns bot array */ - generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; + generateByCondition(sessionId: string, botCountToGenerate: number, difficulty: string, role: string, isPmc: boolean): IBotBase[]; + /** + * Get the PMCs wildSpawnType value + * @param role "usec" / "bear" + * @returns wildSpawnType value as string + */ + protected getPmcRoleByDescription(role: string): string; /** * Get a randomised PMC side based on bot config value 'isUsec' * @returns pmc side as string @@ -64,13 +71,13 @@ export declare class BotGenerator { * Create a IBotBase object with equipment/loot/exp etc * @param sessionId Session id * @param bot bots base file - * @param role botRole bot will use + * @param botRole Role bot will use (bear/usec for PMCs) * @param node Bot template from db/bots/x.json * @param isPmc Is bot to be a PMC * @param isPlayerScav is bot to be a p scav bot * @returns IBotBase object */ - protected generateBot(sessionId: string, bot: IBotBase, role: string, node: IBotType, isPmc: boolean, isPlayerScav?: boolean): IBotBase; + protected generateBot(sessionId: string, bot: IBotBase, botRole: string, node: IBotType, isPmc: boolean, isPlayerScav?: boolean): IBotBase; /** * Log the number of PMCs generated to the debug console * @param output Generated bot array, ready to send to client diff --git a/TypeScript/13AddTrader/types/generators/BotInventoryGenerator.d.ts b/TypeScript/13AddTrader/types/generators/BotInventoryGenerator.d.ts index c5ed545..e1efaf2 100644 --- a/TypeScript/13AddTrader/types/generators/BotInventoryGenerator.d.ts +++ b/TypeScript/13AddTrader/types/generators/BotInventoryGenerator.d.ts @@ -7,6 +7,7 @@ import { IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { BotLootGenerator } from "./BotLootGenerator"; @@ -20,14 +21,68 @@ export declare class BotInventoryGenerator { protected botLootGenerator: BotLootGenerator; protected botGeneratorHelper: BotGeneratorHelper; protected weightedRandomHelper: WeightedRandomHelper; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, configServer: ConfigServer); + /** + * Add equipment/weapons/loot to bot + * @param sessionId Session id + * @param templateInventory bot/x.json data from db + * @param equipmentChances Chances each item will be added to bot + * @param itemGenerationLimitsMinMax item gen limits for bot role + * @param botRole Role bot has (assault/pmcBot) + * @param isPmc Is bot being converted into a pmc + * @returns PmcInventory object with equipment/weapons/loot + */ generateInventory(sessionId: string, templateInventory: Inventory, equipmentChances: Chances, itemGenerationLimitsMinMax: Generation, botRole: string, isPmc: boolean): PmcInventory; + /** + * Create a pmcInventory object with all the base/generic items needed + * @returns PmcInventory object + */ + protected generateInventoryBase(): PmcInventory; + /** + * Add equipment to a bot + * @param templateInventory bot/x.json data from db + * @param equipmentChances Chances items will be added to bot + * @param botRole Role bot has (assault/pmcBot) + * @param botInventory Inventory to add equipment to + */ + protected generateAndAddEquipmentToBot(templateInventory: Inventory, equipmentChances: Chances, botRole: string, botInventory: PmcInventory): void; + protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory): void; + /** + * Work out what weapons bot should have equipped and add them to bot inventory + * @param templateInventory bot/x.json data from db + * @param equipmentChances Chances bot can have equipment equipped + * @param sessionId Session id + * @param botInventory Inventory to add weapons to + * @param botRole assault/pmcBot/bossTagilla etc + * @param isPmc Is the bot being generated as a pmc + * @param itemGenerationLimitsMinMax Limits for items the bot can have + */ + protected generateAndAddWeaponsToBot(templateInventory: Inventory, equipmentChances: Chances, sessionId: string, botInventory: PmcInventory, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation): void; + /** + * Calculate if the bot should have weapons in Primary/Secondary/Holster slots + * @param equipmentChances Chances bot has certain equipment + * @returns What slots bot should have weapons generated for + */ + protected getDesiredWeaponsForBot(equipmentChances: Chances): { + slot: EquipmentSlots; + shouldSpawn: boolean; + }[]; + /** + * Add weapon + spare mags/ammo to bots inventory + * @param sessionId Session id + * @param weaponSlot Weapon slot being generated + * @param templateInventory bot/x.json data from db + * @param botInventory Inventory to add weapon+mags/ammo to + * @param equipmentChances Chances bot can have equipment equipped + * @param botRole assault/pmcBot/bossTagilla etc + * @param isPmc Is the bot being generated as a pmc + * @param itemGenerationLimitsMinMax + */ protected addWeaponAndMagazinesToInventory(sessionId: string, weaponSlot: { slot: EquipmentSlots; shouldSpawn: boolean; }, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation): void; - protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory): void; - protected generateInventoryBase(): PmcInventory; } diff --git a/TypeScript/13AddTrader/types/generators/BotLootGenerator.d.ts b/TypeScript/13AddTrader/types/generators/BotLootGenerator.d.ts index c1f5310..3352a46 100644 --- a/TypeScript/13AddTrader/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/13AddTrader/types/generators/BotLootGenerator.d.ts @@ -10,6 +10,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotLootCacheService } from "../services/BotLootCacheService"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { BotWeaponGenerator } from "./BotWeaponGenerator"; @@ -23,9 +24,10 @@ export declare class BotLootGenerator { protected botWeaponGenerator: BotWeaponGenerator; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected botLootCacheService: BotLootCacheService; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, configServer: ConfigServer); generateLoot(sessionId: string, templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances): void; protected getRandomisedCount(min: number, max: number, nValue: number): number; /** @@ -113,7 +115,7 @@ export declare class BotLootGenerator { * If no limit found for a non pmc bot, fall back to defaults * @param isPmc is the bot we want limits for a pmc * @param botRole what role does the bot have - * @returns dictionary of tplIds and limit + * @returns Dictionary of tplIds and limit */ protected getItemSpawnLimitsForBotType(isPmc: boolean, botRole: string): Record; /** diff --git a/TypeScript/13AddTrader/types/generators/BotWeaponGenerator.d.ts b/TypeScript/13AddTrader/types/generators/BotWeaponGenerator.d.ts index 487901b..40284ea 100644 --- a/TypeScript/13AddTrader/types/generators/BotWeaponGenerator.d.ts +++ b/TypeScript/13AddTrader/types/generators/BotWeaponGenerator.d.ts @@ -12,6 +12,7 @@ import { IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; @@ -27,10 +28,11 @@ export declare class BotWeaponGenerator { protected randomUtil: RandomUtil; protected configServer: ConfigServer; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected localisationService: LocalisationService; protected inventoryMagGenComponents: IInventoryMagGen[]; protected readonly modMagazineSlotId = "mod_magazine"; protected botConfig: IBotConfig; - constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil, configServer: ConfigServer, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, inventoryMagGenComponents: IInventoryMagGen[]); + constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil, configServer: ConfigServer, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, inventoryMagGenComponents: IInventoryMagGen[]); /** * Pick a random weapon based on weightings and generate a functional weapon * @param equipmentSlot Primary/secondary/holster diff --git a/TypeScript/13AddTrader/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/13AddTrader/types/generators/RagfairOfferGenerator.d.ts index b64a7e7..23882d2 100644 --- a/TypeScript/13AddTrader/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/13AddTrader/types/generators/RagfairOfferGenerator.d.ts @@ -1,16 +1,19 @@ +import { HandbookHelper } from "../helpers/HandbookHelper"; import { ItemHelper } from "../helpers/ItemHelper"; +import { PaymentHelper } from "../helpers/PaymentHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; import { Item } from "../models/eft/common/tables/IItem"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { IBarterScheme } from "../models/eft/common/tables/ITrader"; -import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; +import { IRagfairOffer, OfferRequirement } from "../models/eft/ragfair/IRagfairOffer"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { RagfairCategoriesService } from "../services/RagfairCategoriesService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { RagfairPriceService } from "../services/RagfairPriceService"; @@ -27,18 +30,31 @@ export declare class RagfairOfferGenerator { protected timeUtil: TimeUtil; protected databaseServer: DatabaseServer; protected ragfairServerHelper: RagfairServerHelper; + protected handbookHelper: HandbookHelper; protected saveServer: SaveServer; protected presetHelper: PresetHelper; protected ragfairAssortGenerator: RagfairAssortGenerator; protected ragfairOfferService: RagfairOfferService; protected ragfairPriceService: RagfairPriceService; + protected localisationService: LocalisationService; + protected paymentHelper: PaymentHelper; protected ragfairCategoriesService: RagfairCategoriesService; protected fenceService: FenceService; protected itemHelper: ItemHelper; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, ragfairServerHelper: RagfairServerHelper, saveServer: SaveServer, presetHelper: PresetHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferService: RagfairOfferService, ragfairPriceService: RagfairPriceService, ragfairCategoriesService: RagfairCategoriesService, fenceService: FenceService, itemHelper: ItemHelper, configServer: ConfigServer); + protected allowedFleaPriceItemsForBarter: { + tpl: string; + price: number; + }[]; + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, ragfairServerHelper: RagfairServerHelper, handbookHelper: HandbookHelper, saveServer: SaveServer, presetHelper: PresetHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferService: RagfairOfferService, ragfairPriceService: RagfairPriceService, localisationService: LocalisationService, paymentHelper: PaymentHelper, ragfairCategoriesService: RagfairCategoriesService, fenceService: FenceService, itemHelper: ItemHelper, configServer: ConfigServer); createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; + /** + * Calculate the offer price that's listed on the flea listing + * @param offerRequirements barter requirements for offer + * @returns rouble cost of offer + */ + protected calculateOfferListingPrice(offerRequirements: OfferRequirement[]): number; /** * Get avatar url from trader table in db * @param isTrader Is user we're getting avatar for a trader @@ -87,20 +103,36 @@ export declare class RagfairOfferGenerator { * @returns Item with conditions added */ protected addMissingCondition(item: Item): Item; - protected getOfferRequirements(items: Item[]): { - count: number; - _tpl: string; + /** + * Create a barter-based barter scheme, if not possible, fall back to making barter scheme currency based + * @param offerItems Items for sale in offer + * @returns barter scheme + */ + protected createBarterRequirement(offerItems: Item[]): IBarterScheme[]; + /** + * Get an array of flea prices + item tpl, cached in generator class + * @returns array with tpl/price values + */ + protected getFleaPricesAsArray(): { + tpl: string; + price: number; }[]; + /** + * Create a random currency-based barter scheme for an array of items + * @param offerItems Items on offer + * @returns Barter scheme for offer + */ + protected createCurrencyRequirement(offerItems: Item[]): IBarterScheme[]; /** * Create a flea offer and store it in the Ragfair server offers array * @param userID owner of the offer * @param time time offer is put up * @param items items in the offer - * @param barterScheme - * @param loyalLevel + * @param barterScheme cost of item (currency or barter) + * @param loyalLevel Loyalty level needed to buy item * @param price price of offer * @param sellInOnePiece - * @returns + * @returns Ragfair offer */ createFleaOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; } diff --git a/TypeScript/13AddTrader/types/generators/WeatherGenerator.d.ts b/TypeScript/13AddTrader/types/generators/WeatherGenerator.d.ts index 8ddbe49..65d2c76 100644 --- a/TypeScript/13AddTrader/types/generators/WeatherGenerator.d.ts +++ b/TypeScript/13AddTrader/types/generators/WeatherGenerator.d.ts @@ -1,38 +1,54 @@ +import { ApplicationContext } from "../context/ApplicationContext"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; -import { IWeatherData } from "../models/eft/weather/IWeatherData"; +import { IWeather, IWeatherData } from "../models/eft/weather/IWeatherData"; +import { WindDirection } from "../models/enums/WindDirection"; import { IWeatherConfig } from "../models/spt/config/IWeatherConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class WeatherGenerator { protected weightedRandomHelper: WeightedRandomHelper; + protected logger: ILogger; protected randomUtil: RandomUtil; protected timeUtil: TimeUtil; + protected applicationContext: ApplicationContext; protected configServer: ConfigServer; protected weatherConfig: IWeatherConfig; - constructor(weightedRandomHelper: WeightedRandomHelper, randomUtil: RandomUtil, timeUtil: TimeUtil, configServer: ConfigServer); - calculateTime(data: IWeatherData): IWeatherData; + constructor(weightedRandomHelper: WeightedRandomHelper, logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, applicationContext: ApplicationContext, configServer: ConfigServer); + calculateGameTime(data: IWeatherData): IWeatherData; /** * Get server uptime seconds multiplied by a multiplier and add to current time as seconds * Format to BSGs requirements - * @param computedDate current date + * @param currentDate current date * @returns formatted time */ - protected getAcceleratedTime(computedDate: Date): string; + protected getBsgFormattedInRaidTime(currentDate: Date): string; + /** + * Get the current in-raid time + * @param currentDate (new Date()) + * @returns Date object of current in-raid time + */ + getInRaidTime(currentDate: Date): Date; /** * Get current time formatted to fit BSGs requirement - * @param computedDate date to format into bsg style + * @param date date to format into bsg style * @returns */ - protected getNormalTime(computedDate: Date): string; + protected getBSGFormattedTime(date: Date): string; /** - * Return randomised Weather data - * @param weatherData weather input data + * Return randomised Weather data with help of config/weather.json * @returns Randomised weather data */ - generateWeather(weatherData: IWeatherData): IWeatherData; - protected getWeightedFog(): string; + generateWeather(): IWeather; + /** + * Set IWeather date/time/timestamp values to now + * @param weather Object to update + */ + protected setCurrentDateTime(weather: IWeather): void; + protected getWeightedWindDirection(): WindDirection; + protected getWeightedWindSpeed(): number; + protected getWeightedFog(): number; protected getWeightedRain(): number; protected getRandomFloat(node: string): number; - protected getRandomInt(node: string): number; } diff --git a/TypeScript/13AddTrader/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts b/TypeScript/13AddTrader/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts index 4fcb1e2..1589707 100644 --- a/TypeScript/13AddTrader/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts +++ b/TypeScript/13AddTrader/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts @@ -1,13 +1,15 @@ import { BotWeaponGeneratorHelper } from "../../../helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "../../../helpers/ItemHelper"; import { ILogger } from "../../../models/spt/utils/ILogger"; +import { LocalisationService } from "../../../services/LocalisationService"; import { IInventoryMagGen } from "../IInventoryMagGen"; import { InventoryMagGen } from "../InventoryMagGen"; export declare class ExternalInventoryMagGen implements IInventoryMagGen { protected logger: ILogger; protected itemHelper: ItemHelper; + protected localisationService: LocalisationService; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; - constructor(logger: ILogger, itemHelper: ItemHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper); + constructor(logger: ILogger, itemHelper: ItemHelper, localisationService: LocalisationService, botWeaponGeneratorHelper: BotWeaponGeneratorHelper); getPriority(): number; canHandleInventoryMagGen(inventoryMagGen: InventoryMagGen): boolean; process(inventoryMagGen: InventoryMagGen): void; diff --git a/TypeScript/13AddTrader/types/helpers/BotDifficultyHelper.d.ts b/TypeScript/13AddTrader/types/helpers/BotDifficultyHelper.d.ts new file mode 100644 index 0000000..a58ebdb --- /dev/null +++ b/TypeScript/13AddTrader/types/helpers/BotDifficultyHelper.d.ts @@ -0,0 +1,46 @@ +import { Difficulty } from "../models/eft/common/tables/IBotType"; +import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; +import { JsonUtil } from "../utils/JsonUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +import { BotHelper } from "./BotHelper"; +export declare class BotDifficultyHelper { + protected logger: ILogger; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected randomUtil: RandomUtil; + protected localisationService: LocalisationService; + protected botHelper: BotHelper; + protected configServer: ConfigServer; + protected botConfig: IBotConfig; + constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, localisationService: LocalisationService, botHelper: BotHelper, configServer: ConfigServer); + getPmcDifficultySettings(pmcType: "bear" | "usec", difficulty: string, usecType: string, bearType: string): Difficulty; + /** + * Get difficulty settings for desired bot type, if not found use assault bot types + * @param type bot type to retreive difficulty of + * @param difficulty difficulty to get settings for (easy/normal etc) + * @returns Difficulty object + */ + getBotDifficultySettings(type: string, difficulty: string): Difficulty; + /** + * Get difficulty settings for a PMC + * @param type "usec" / "bear" + * @param difficulty what difficulty to retrieve + * @returns Difficulty object + */ + protected getDifficultySettings(type: string, difficulty: string): Difficulty; + /** + * Translate chosen value from pre-raid difficulty dropdown into bot difficulty value + * @param dropDownDifficulty Dropdown difficulty value to convert + * @returns bot difficulty + */ + convertBotDifficultyDropdownToBotDifficulty(dropDownDifficulty: string): string; + /** + * Choose a random difficulty from - easy/normal/hard/impossible + * @returns random difficulty + */ + chooseRandomDifficulty(): string; +} diff --git a/TypeScript/13AddTrader/types/helpers/BotGeneratorHelper.d.ts b/TypeScript/13AddTrader/types/helpers/BotGeneratorHelper.d.ts index 5e3e501..899669e 100644 --- a/TypeScript/13AddTrader/types/helpers/BotGeneratorHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/BotGeneratorHelper.d.ts @@ -8,6 +8,7 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; import { ItemFilterService } from "../services/ItemFilterService"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; @@ -43,9 +44,10 @@ export declare class BotGeneratorHelper { protected itemFilterService: ItemFilterService; protected profileHelper: ProfileHelper; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Check mods are compatible and add to array * @param equipment Equipment item to add mods to @@ -53,9 +55,11 @@ export declare class BotGeneratorHelper { * @param parentId parentid of item to add mod to * @param parentTemplate template objet of item to add mods to * @param modSpawnChances dictionary of mod items and their chance to spawn for this bot type + * @param botRole the bot role being generated for + * @param forceSpawn should this mod be forced to spawn * @returns Item + compatible mods as an array */ - generateModsForEquipment(equipment: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances): Item[]; + generateModsForEquipment(equipment: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances, botRole: string, forceSpawn?: boolean): Item[]; /** * @param sessionId session id * @param weapon Weapon to add mods to @@ -70,15 +74,15 @@ export declare class BotGeneratorHelper { generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponParentId: string, parentWeaponTemplate: ITemplateItem, modSpawnChances: ModsChances, ammoTpl: string, botRole: string): Item[]; /** * - * @param modSlot - * @param isRandomisableSlot - * @param modsParent - * @param botEquipBlacklist - * @param itemModPool + * @param modSlot Slot mod will fit into + * @param isRandomisableSlot Will generate a randomised mod pool if true + * @param modsParent Parent slot the item will be a part of + * @param botEquipBlacklist Blacklist to prevent mods from being picked + * @param itemModPool Pool of items to pick from * @param weapon array with only weapon tpl in it, ready for mods to be added * @param ammoTpl ammo tpl to use if slot requires a cartridge to be added (e.g. mod_magazine) - * @param parentTemplate - * @returns + * @param parentTemplate Parent item the mod will go into + * @returns ITemplateItem */ protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, modsParent: Slot, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem): [boolean, ITemplateItem]; /** @@ -114,8 +118,10 @@ export declare class BotGeneratorHelper { * Find all compatible mods for equipment item and add to modPool * @param itemDetails item to find mods for * @param modPool ModPool to add mods to + * @param equipmentBlacklist equipment not allowed to be used by the bot + * @param botEquipmentRole bot type to generate pool for (e.g. assault, pmcBot, pmc for usec/bear) */ - generateDynamicModPool(itemDetails: ITemplateItem, modPool: Mods): void; + generateDynamicModPool(itemDetails: ITemplateItem, modPool: Mods, equipmentBlacklist: EquipmentFilterDetails[], botEquipmentRole: string): void; /** * Take a list of tpls and filter out blacklisted values using itemFilterService + botEquipmentBlacklist * @param allowedMods base mods to filter @@ -153,7 +159,7 @@ export declare class BotGeneratorHelper { * @param modTemplate Used to add additional properites in the upd object * @returns Item object */ - protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem): Item; + protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem, botRole: string): Item; /** * randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot * never return true for an item that has 0% spawn chance @@ -170,10 +176,10 @@ export declare class BotGeneratorHelper { */ protected getAmmoContainers(): string[]; /** - * Get the slot details for an item (chamber/cartridge/slot) + * Get a Slot property for an item (chamber/cartridge/slot) * @param modSlot e.g patron_in_weapon * @param parentTemplate item template - * @returns + * @returns Slot item */ protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; /** @@ -185,7 +191,6 @@ export declare class BotGeneratorHelper { * @param modPool modPool which should include available cartrigdes * @param parentId The CylinderMagazine's UID * @param parentTemplate The CylinderMagazine's template - * @returns */ protected fillCamora(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem): void; /** @@ -197,11 +202,11 @@ export declare class BotGeneratorHelper { /** * Adds properties to an item * e.g. Repairable / HasHinge / Foldable / MaxDurability - * @param itemTemplate - * @param botRole Used by weapons to randomise the durability values + * @param itemTemplate Item extra properties are being generated for + * @param botRole Used by weapons to randomise the durability values. Null for non-equipped items * @returns Item Upd object with extra properties */ - generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: any): { + generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: string): { upd?: Upd; }; /** @@ -220,21 +225,27 @@ export declare class BotGeneratorHelper { protected generateArmorRepairableProperties(itemTemplate: ITemplateItem, botRole: string): Repairable; /** * Get a random mod from an items compatible mods Filter array - * @param modTpl - * @param parentSlot - * @param modSlot - * @param items + * @param modTpl ???? + * @param parentSlot item mod will go into, used to get combatible items + * @param modSlot Slot to get mod to fill + * @param items items to ensure picked mod is compatible with * @returns item tpl */ protected getModTplFromItemDb(modTpl: string, parentSlot: Slot, modSlot: string, items: Item[]): string; /** * Can an item be added to an item without issue - * @param items - * @param tplToCheck - * @param equipmentSlot - * @returns true if possible + * @param items items to check compatiblilities with + * @param tplToCheck tpl of the item to check for incompatibilities + * @param equipmentSlot Slot the item will be placed into + * @returns false if no incompatibilties */ isItemIncompatibleWithCurrentItems(items: Item[], tplToCheck: string, equipmentSlot: string): boolean; + /** + * Convert a bots role to the equipment role used in config/bot.json + * @param botRole Role to convert + * @returns Equipment role (e.g. pmc / assault / bossTagilla) + */ + getBotEquipmentRole(botRole: string): string; } /** TODO - move into own class */ export declare class ExhaustableArray { diff --git a/TypeScript/13AddTrader/types/helpers/BotHelper.d.ts b/TypeScript/13AddTrader/types/helpers/BotHelper.d.ts index 67a6384..a7f779e 100644 --- a/TypeScript/13AddTrader/types/helpers/BotHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/BotHelper.d.ts @@ -3,6 +3,7 @@ import { IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; export declare class BotHelper { @@ -10,46 +11,27 @@ export declare class BotHelper { protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, configServer: ConfigServer); - /** - * Get difficulty settings for desired bot type, if not found use assault bot types - * @param type bot type to retreive difficulty of - * @param difficulty difficulty to get settings for (easy/normal etc) - * @returns Difficulty object - */ - getBotDifficultySettings(type: string, difficulty: string): Difficulty; + constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, localisationService: LocalisationService, configServer: ConfigServer); /** * Get a template object for the specified botRole from bots.types db * @param role botRole to get template for * @returns IBotType object */ getBotTemplate(role: string): IBotType; - /** - * Get difficulty settings for a PMC - * @param type "usec" / "bear" - * @param difficulty what difficulty to retrieve - * @returns Difficulty object - */ - getPmcDifficultySettings(type: string, difficulty: string): Difficulty; - /** - * Translate chosen value from pre-raid difficulty dropdown into bot difficulty value - * @param dropDownDifficulty Dropdown difficulty value to convert - * @returns bot difficulty - */ - convertBotDifficultyDropdownToBotDifficulty(dropDownDifficulty: string): string; - /** - * Choose a random difficulty from - easy/normal/hard/impossible - * @returns random difficulty - */ - chooseRandomDifficulty(): string; /** * Randomise the chance the PMC will attack their own side * Look up value in bot.json/chanceSameSideIsHostilePercent * @param difficultySettings pmc difficulty settings */ randomisePmcHostility(difficultySettings: Difficulty): void; + /** + * Is the passed in bot role a PMC (usec/bear/pmc) + * @param botRole bot role to check + * @returns true if is pmc + */ isBotPmc(botRole: string): boolean; isBotBoss(botRole: string): boolean; isBotFollower(botRole: string): boolean; diff --git a/TypeScript/13AddTrader/types/helpers/GameEventHelper.d.ts b/TypeScript/13AddTrader/types/helpers/GameEventHelper.d.ts index fca87be..fa25eff 100644 --- a/TypeScript/13AddTrader/types/helpers/GameEventHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/GameEventHelper.d.ts @@ -15,4 +15,15 @@ export declare class GameEventHelper { * @returns Record with event name + start/end date */ getEventDetails(): ISeasonalEvent[]; + /** + * Is detection of seasonal events enabled (halloween / christmas) + * @returns true if seasonal events should be checked for + */ + isAutomaticEventDetectionEnabled(): boolean; + /** + * Get a dictionary of gear changes to apply to bots for a specific event e.g. Christmas/Halloween + * @param eventName Name of event to get gear changes for + * @returns bots with equipment changes + */ + getEventBotGear(eventName: string): Record>>; } diff --git a/TypeScript/13AddTrader/types/helpers/HideoutHelper.d.ts b/TypeScript/13AddTrader/types/helpers/HideoutHelper.d.ts index 5f7e3b7..9d51fed 100644 --- a/TypeScript/13AddTrader/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/HideoutHelper.d.ts @@ -11,6 +11,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { PlayerService } from "../services/PlayerService"; import { HashUtil } from "../utils/HashUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; @@ -29,13 +30,14 @@ export declare class HideoutHelper { protected profileHelper: ProfileHelper; protected inventoryHelper: InventoryHelper; protected playerService: PlayerService; + protected localisationService: LocalisationService; protected configServer: ConfigServer; static bitcoinFarm: string; static waterCollector: string; static bitcoin: string; static expeditionaryFuelTank: string; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, localisationService: LocalisationService, configServer: ConfigServer); registerProduction(pmcData: IPmcData, body: IHideoutSingleProductionStartRequestData | IHideoutContinousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; /** * This convinience function intialies new Production Object diff --git a/TypeScript/13AddTrader/types/helpers/InventoryHelper.d.ts b/TypeScript/13AddTrader/types/helpers/InventoryHelper.d.ts index b8e5c9d..6419f93 100644 --- a/TypeScript/13AddTrader/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/InventoryHelper.d.ts @@ -5,11 +5,12 @@ import { IInventoryMergeRequestData } from "../models/eft/inventory/IInventoryMe import { IInventoryMoveRequestData } from "../models/eft/inventory/IInventoryMoveRequestData"; import { IInventorySplitRequestData } from "../models/eft/inventory/IInventorySplitRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { IInventoryConfig } from "../models/spt/config/IInventoryConfig"; +import { IInventoryConfig, RewardDetails } from "../models/spt/config/IInventoryConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { JsonUtil } from "../utils/JsonUtil"; @@ -38,9 +39,10 @@ export declare class InventoryHelper { protected itemHelper: ItemHelper; protected containerHelper: ContainerHelper; protected profileHelper: ProfileHelper; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected inventoryConfig: IInventoryConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); addItem(pmcData: IPmcData, body: IAddItemRequestData, output: IItemEventRouterResponse, sessionID: string, callback: any, foundInRaid?: boolean, addUpd?: any): IItemEventRouterResponse; removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; removeItemByCount(pmcData: IPmcData, itemId: string, count: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; @@ -76,6 +78,12 @@ export declare class InventoryHelper { * Internal helper function to handle cartridges in inventory if any of them exist. */ protected handleCartridges(items: Item[], body: IInventoryMoveRequestData): void; + /** + * Get details for how a random loot container should be handled, max rewards, possible reward tpls + * @param itemTpl Container being opened + * @returns Reward details + */ + getRandomLootContainerRewardDetails(itemTpl: string): RewardDetails; } declare namespace InventoryHelper { interface InventoryItemHash { diff --git a/TypeScript/13AddTrader/types/helpers/ItemHelper.d.ts b/TypeScript/13AddTrader/types/helpers/ItemHelper.d.ts index 0effaf2..fc88a46 100644 --- a/TypeScript/13AddTrader/types/helpers/ItemHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/ItemHelper.d.ts @@ -5,6 +5,7 @@ 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 { LocaleService } from "../services/LocaleService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; @@ -18,7 +19,8 @@ declare class ItemHelper { protected objectId: ObjectId; protected mathUtil: MathUtil; protected databaseServer: DatabaseServer; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer); + protected localeService: LocaleService; + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, localeService: LocaleService); /** * Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash * @param {string} tpl the template id / tpl @@ -212,6 +214,12 @@ declare class ItemHelper { * @returns size of stack */ getItemStackSize(item: Item): number; + /** + * Get the name of an item from the locale file using the item tpl + * @param itemTpl Tpl of item to get name of + * @returns Name of item + */ + getItemName(itemTpl: string): string; } declare namespace ItemHelper { interface ItemSize { diff --git a/TypeScript/13AddTrader/types/helpers/QuestHelper.d.ts b/TypeScript/13AddTrader/types/helpers/QuestHelper.d.ts index a6b4892..edbd2e1 100644 --- a/TypeScript/13AddTrader/types/helpers/QuestHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/QuestHelper.d.ts @@ -50,6 +50,12 @@ export declare class QuestHelper { * @returns true if player level is greater than or equal to quest */ doesPlayerLevelFulfilCondition(playerLevel: number, condition: AvailableForConditions): boolean; + /** + * Get the quests found in both arrays (inner join) + * @param before Array of qeusts #1 + * @param after Array of quests #2 + * @returns Reduction of cartesian product between two quest arrays + */ getDeltaQuests(before: IQuest[], after: IQuest[]): IQuest[]; /** * Increase skill points of a skill on player profile @@ -66,38 +72,85 @@ export declare class QuestHelper { * quest list in question. */ dumpQuests(quests: any): void; - loyaltyRequirementCheck(loyaltyRequirementProperties: AvailableForProps, profile: IPmcData): boolean; - protected processReward(reward: Reward): any[]; + /** + * Check if trader has sufficient loyalty to fullfill quest requirement + * @param questProperties Quest props + * @param profile Player profile + * @returns true if loyalty is high enough to fulfil quest requirement + */ + traderStandingRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; + protected processReward(reward: Reward): Reward[]; + /** + * Gets a flat list of reward items for the given quest at a specific state (e.g. Fail/Success) + * @param quest quest to get rewards for + * @param state Quest status that holds the items (Started, Success, Fail) + * @returns array of items with the correct maxStack + */ getQuestRewardItems(quest: IQuest, state: QuestStatus): Reward[]; /** - * Add quest with new state value to pmc profile + * Update player profile with quest status (e.g. Fail/Success) * @param pmcData profile to add quest to * @param newState state the new quest should be in when added * @param acceptedQuest Details of quest being added */ addQuestToPMCData(pmcData: IPmcData, newState: QuestStatus, acceptedQuest: IAcceptQuestRequestData): void; - acceptedUnlocked(acceptedQuestId: string, sessionID: string): IQuest[]; - failedUnlocked(failedQuestId: string, sessionID: string): IQuest[]; - applyMoneyBoost(quest: IQuest, moneyBoost: number): IQuest; - changeItemStack(pmcData: IPmcData, id: string, value: number, sessionID: string, output: any): void; /** - * Get List of All Quests as an array + * TODO: what is going on here + * @param acceptedQuestId Quest to add to profile + * @param sessionID Session id + * @returns Array of quests in profile + quest passed in as param + */ + acceptedUnlocked(acceptedQuestId: string, sessionID: string): IQuest[]; + /** + * TODO: what is going on here + * @param failedQuestId + * @param sessionID Session id + * @returns + */ + failedUnlocked(failedQuestId: string, sessionID: string): IQuest[]; + /** + * Adjust quest money rewards by passed in multipler + * @param quest Quest to multiple money rewards + * @param multipler Value to adjust money rewards by + * @returns Updated quest + */ + applyMoneyBoost(quest: IQuest, multipler: number): IQuest; + /** + * Sets the item stack to new value, or delete the item if value <= 0 + * // TODO maybe merge this function and the one from customization + * @param pmcData Profile + * @param itemId id of item to adjust stack size of + * @param newStackSize Stack size to adjust to + * @param sessionID Session id + * @param output ItemEvent router response + */ + changeItemStack(pmcData: IPmcData, itemId: string, newStackSize: number, sessionID: string, output: IItemEventRouterResponse): void; + /** + * Get List of All Quests from db + * NOT CLONED * @returns Array of IQuest objects */ - questValues(): IQuest[]; + getQuestsFromDb(): IQuest[]; /** - * Reest AvailableForStart conditions for quests - * @param quests queststo clean + * Get quests, strip all requirement conditions except level + * @param quests quests to process * @returns quest array without conditions */ - protected cleanQuestList(quests: IQuest[]): IQuest[]; + protected getQuestsWithOnlyLevelRequirementStartCondition(quests: IQuest[]): IQuest[]; /** - * Reset AvailableForStart conditions on a quest + * Remove all quest conditions except for level requirement * @param quest quest to clean * @returns reset IQuest object */ - cleanQuestConditions(quest: IQuest): IQuest; - failQuest(pmcData: IPmcData, body: any, sessionID: string): any; + getQuestWithOnlyLevelRequirementStartCondition(quest: IQuest): IQuest; + /** + * Fail a quest in a player profile + * @param pmcData Profile + * @param failRequest fail quest request data + * @param sessionID Session id + * @returns Item event router response + */ + failQuest(pmcData: IPmcData, failRequest: any, sessionID: string): IItemEventRouterResponse; /** * Get quest by id from database * @param questId questid to look for @@ -105,7 +158,12 @@ export declare class QuestHelper { * @returns IQuest object */ getQuestFromDb(questId: string, pmcData: IPmcData): IQuest; - getQuestLocaleIdFromDb(messageId: string): string; + /** + * Get the locale Id from locale db for a quest message + * @param questMessageId Quest mesage id to look up + * @returns Locale Id from locale db + */ + getQuestLocaleIdFromDb(questMessageId: string): string; /** * Alter a quests state + Add a record to tis status timers object * @param pmcData Profile to update @@ -128,5 +186,10 @@ export declare class QuestHelper { * @returns bonus in percent */ protected getIntelCenterRewardBonus(pmcData: IPmcData): number; - getFindItemIdForQuestItem(itemTpl: string): string; + /** + * Find quest with 'findItem' requirement that needs the item tpl be handed in + * @param itemTpl item tpl to look for + * @returns 'FindItem' condition id + */ + getFindItemIdForQuestHandIn(itemTpl: string): string; } diff --git a/TypeScript/13AddTrader/types/helpers/RagfairServerHelper.d.ts b/TypeScript/13AddTrader/types/helpers/RagfairServerHelper.d.ts index a03cdda..ec388d8 100644 --- a/TypeScript/13AddTrader/types/helpers/RagfairServerHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/RagfairServerHelper.d.ts @@ -44,10 +44,20 @@ export declare class RagfairServerHelper { isPlayer(userID: string): boolean; returnItems(sessionID: string, items: any[]): void; calculateDynamicStackCount(tplId: string, isWeaponPreset: boolean): number; + /** + * Choose a currency at random with bias + * @returns currency tpl + */ getDynamicOfferCurrency(): string; getMemberType(userID: string): MemberCategory; getNickname(userID: string): string; getPresetItems(item: any): Item[]; getPresetItemsByTpl(item: Item): Item[]; + /** + * Generate new unique ids for the children while preserving hierarchy + * @param item base item + * @param preset + * @returns Item array with new IDs + */ reparentPresets(item: Item, preset: Item[]): Item[]; } diff --git a/TypeScript/13AddTrader/types/helpers/RagfairSortHelper.d.ts b/TypeScript/13AddTrader/types/helpers/RagfairSortHelper.d.ts index 28d1d38..4669ce6 100644 --- a/TypeScript/13AddTrader/types/helpers/RagfairSortHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/RagfairSortHelper.d.ts @@ -18,7 +18,7 @@ export declare class RagfairSortHelper { protected sortOffersByRating(a: IRagfairOffer, b: IRagfairOffer): number; protected sortOffersByName(a: IRagfairOffer, b: IRagfairOffer): number; /** - * Order two offers by price value + * Order two offers by rouble price value * @param a Offer a * @param b Offer b * @returns diff --git a/TypeScript/13AddTrader/types/loaders/PreAkiModLoader.d.ts b/TypeScript/13AddTrader/types/loaders/PreAkiModLoader.d.ts index 7a687a5..f486a28 100644 --- a/TypeScript/13AddTrader/types/loaders/PreAkiModLoader.d.ts +++ b/TypeScript/13AddTrader/types/loaders/PreAkiModLoader.d.ts @@ -1,29 +1,31 @@ import { DependencyContainer } from "tsyringe"; +import { IPostAkiLoadMod } from "../models/external/IPostAkiLoadMod"; +import { IPostDBLoadMod } from "../models/external/IPostDBLoadMod"; +import { IPreAkiLoadMod } from "../models/external/IPreAkiLoadMod"; import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { ModLoader } from "../models/spt/mod/IMod"; import { IModLoader } from "../models/spt/mod/IModLoader"; import { IPackageJsonData } from "../models/spt/mod/IPackageJsonData"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { LocalisationService } from "../services/LocalisationService"; import { ModCompilerService } from "../services/ModCompilerService"; import { JsonUtil } from "../utils/JsonUtil"; import { VFS } from "../utils/VFS"; import { BundleLoader } from "./BundleLoader"; -import { IPostAkiLoadMod } from "../models/external/IPostAkiLoadMod"; -import { IPreAkiLoadMod } from "../models/external/IPreAkiLoadMod"; -import { IPostDBLoadMod } from "../models/external/IPostDBLoadMod"; export declare class PreAkiModLoader implements IModLoader { protected logger: ILogger; protected vfs: VFS; protected jsonUtil: JsonUtil; protected modCompilerService: ModCompilerService; protected bundleLoader: BundleLoader; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected static container: DependencyContainer; protected readonly basepath = "user/mods/"; protected imported: Record; protected akiConfig: ICoreConfig; - constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, modCompilerService: ModCompilerService, bundleLoader: BundleLoader, configServer: ConfigServer); + constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, modCompilerService: ModCompilerService, bundleLoader: BundleLoader, localisationService: LocalisationService, configServer: ConfigServer); load(container: DependencyContainer): Promise; getBundles(local: boolean): string; getBundle(key: string, local: boolean): void; diff --git a/TypeScript/13AddTrader/types/models/eft/bot/IGenerateBotsRequestData.d.ts b/TypeScript/13AddTrader/types/models/eft/bot/IGenerateBotsRequestData.d.ts index c49cef7..f1f7013 100644 --- a/TypeScript/13AddTrader/types/models/eft/bot/IGenerateBotsRequestData.d.ts +++ b/TypeScript/13AddTrader/types/models/eft/bot/IGenerateBotsRequestData.d.ts @@ -2,6 +2,7 @@ export interface IGenerateBotsRequestData { conditions: Condition[]; } export interface Condition { + /** e.g. assault/pmcBot/bossKilla */ Role: string; Limit: number; Difficulty: string; diff --git a/TypeScript/13AddTrader/types/models/eft/common/IGlobals.d.ts b/TypeScript/13AddTrader/types/models/eft/common/IGlobals.d.ts index 81e2023..b53f106 100644 --- a/TypeScript/13AddTrader/types/models/eft/common/IGlobals.d.ts +++ b/TypeScript/13AddTrader/types/models/eft/common/IGlobals.d.ts @@ -591,6 +591,7 @@ export interface HealPrice { export interface ProfileHealthSettings { BodyPartsSettings: BodyPartsSettings; HealthFactorsSettings: HealthFactorsSettings; + DefaultStimulatorBuff: string; } export interface BodyPartsSettings { Head: BodyPartsSetting; diff --git a/TypeScript/13AddTrader/types/models/eft/common/tables/IBotBase.d.ts b/TypeScript/13AddTrader/types/models/eft/common/tables/IBotBase.d.ts index 1c28ae0..2b418c1 100644 --- a/TypeScript/13AddTrader/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/13AddTrader/types/models/eft/common/tables/IBotBase.d.ts @@ -107,6 +107,7 @@ export interface CurrentMax { Maximum: number; } export interface Inventory { + discardLimits: Record; items: Item[]; equipment: string; stash: string; diff --git a/TypeScript/13AddTrader/types/models/eft/common/tables/IBotType.d.ts b/TypeScript/13AddTrader/types/models/eft/common/tables/IBotType.d.ts index c1fe579..55b4bd9 100644 --- a/TypeScript/13AddTrader/types/models/eft/common/tables/IBotType.d.ts +++ b/TypeScript/13AddTrader/types/models/eft/common/tables/IBotType.d.ts @@ -13,8 +13,8 @@ export interface IBotType { skills: Skills; } export interface Appearance { - body: string[]; - feet: string[]; + body: Record; + feet: Record; hands: string[]; head: string[]; voice: string[]; diff --git a/TypeScript/13AddTrader/types/models/eft/common/tables/ITemplateItem.d.ts b/TypeScript/13AddTrader/types/models/eft/common/tables/ITemplateItem.d.ts index 8569e61..0fa7e18 100644 --- a/TypeScript/13AddTrader/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/TypeScript/13AddTrader/types/models/eft/common/tables/ITemplateItem.d.ts @@ -254,7 +254,7 @@ export interface Props { foodUseTime?: number; foodEffectType?: string; StimulatorBuffs?: string; - effects_health?: any; + effects_health?: IHealthEffect[] | Record>; effects_damage?: any; MaximumNumberOfUsage?: number; knifeHitDelay?: number; @@ -366,6 +366,10 @@ export interface Props { MinTimeToContactExplode?: number; ExplosionEffectType?: string; } +export interface IHealthEffect { + type: string; + value: number; +} export interface Prefab { path: string; rcid: string; diff --git a/TypeScript/13AddTrader/types/models/eft/customization/IGetSuitsResponse.d.ts b/TypeScript/13AddTrader/types/models/eft/customization/IGetSuitsResponse.d.ts new file mode 100644 index 0000000..fe6888c --- /dev/null +++ b/TypeScript/13AddTrader/types/models/eft/customization/IGetSuitsResponse.d.ts @@ -0,0 +1,4 @@ +export interface IGetSuitsResponse { + _id: string; + suits: string[]; +} diff --git a/TypeScript/13AddTrader/types/models/eft/game/IGameKeepAliveResponse.d.ts b/TypeScript/13AddTrader/types/models/eft/game/IGameKeepAliveResponse.d.ts new file mode 100644 index 0000000..170ce6a --- /dev/null +++ b/TypeScript/13AddTrader/types/models/eft/game/IGameKeepAliveResponse.d.ts @@ -0,0 +1,4 @@ +export interface IGameKeepAliveResponse { + msg: string; + utc_time: number; +} diff --git a/TypeScript/13AddTrader/types/models/eft/game/IGameLogoutResponseData.d.ts b/TypeScript/13AddTrader/types/models/eft/game/IGameLogoutResponseData.d.ts new file mode 100644 index 0000000..0f52050 --- /dev/null +++ b/TypeScript/13AddTrader/types/models/eft/game/IGameLogoutResponseData.d.ts @@ -0,0 +1,3 @@ +export interface IGameLogoutResponseData { + status: string; +} diff --git a/TypeScript/13AddTrader/types/models/eft/game/IGameStartResponse.d.ts b/TypeScript/13AddTrader/types/models/eft/game/IGameStartResponse.d.ts new file mode 100644 index 0000000..9f0ab6d --- /dev/null +++ b/TypeScript/13AddTrader/types/models/eft/game/IGameStartResponse.d.ts @@ -0,0 +1,3 @@ +export interface IGameStartResponse { + utc_time: number; +} diff --git a/TypeScript/13AddTrader/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts b/TypeScript/13AddTrader/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts new file mode 100644 index 0000000..3c45124 --- /dev/null +++ b/TypeScript/13AddTrader/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts @@ -0,0 +1,11 @@ +import { IInventoryBaseActionRequestData } from "./IInventoryBaseActionRequestData"; +export interface IOpenRandomLootContainerRequestData extends IInventoryBaseActionRequestData { + Action: "OpenRandomLootContainer"; + /** Container item opened */ + item: string; + to: To[]; +} +export interface To { + /** Player character (pmc/scav) id items will be sent to */ + id: string; +} diff --git a/TypeScript/13AddTrader/types/models/eft/itemEvent/IItemEventRouterBase.d.ts b/TypeScript/13AddTrader/types/models/eft/itemEvent/IItemEventRouterBase.d.ts index 4841cfd..60ab284 100644 --- a/TypeScript/13AddTrader/types/models/eft/itemEvent/IItemEventRouterBase.d.ts +++ b/TypeScript/13AddTrader/types/models/eft/itemEvent/IItemEventRouterBase.d.ts @@ -10,8 +10,9 @@ export interface IItemEventRouterBase { export declare type TProfileChanges = Record; export interface Warning { index: number; - err: string; errmsg: string; + code?: string; + data?: any; } export interface ProfileChange { _id: string; diff --git a/TypeScript/13AddTrader/types/models/eft/match/IStartOffineRaidRequestData.d.ts b/TypeScript/13AddTrader/types/models/eft/match/IStartOffineRaidRequestData.d.ts index af0625e..1983728 100644 --- a/TypeScript/13AddTrader/types/models/eft/match/IStartOffineRaidRequestData.d.ts +++ b/TypeScript/13AddTrader/types/models/eft/match/IStartOffineRaidRequestData.d.ts @@ -2,8 +2,10 @@ import { BotAmount } from "../../enums/BotAmount"; import { BotDifficulty } from "../../enums/BotDifficulty"; export interface IStartOfflineRaidRequestData { locationName: string; + /** Current time, not in-game time */ startTime: number; - dateTime: string; + /** CURR = am, past = pm */ + dateTime: "CURR" | "PAST"; gameSettings: GameSettings; } export interface GameSettings { diff --git a/TypeScript/13AddTrader/types/models/eft/notifier/ISelectProfileResponse.d.ts b/TypeScript/13AddTrader/types/models/eft/notifier/ISelectProfileResponse.d.ts new file mode 100644 index 0000000..ecb668a --- /dev/null +++ b/TypeScript/13AddTrader/types/models/eft/notifier/ISelectProfileResponse.d.ts @@ -0,0 +1,6 @@ +import { INotifierChannel } from "./INotifier"; +export interface ISelectProfileResponse { + status: string; + notifier: INotifierChannel; + notifierServer: string; +} diff --git a/TypeScript/13AddTrader/types/models/eft/ragfair/IRagfairOffer.d.ts b/TypeScript/13AddTrader/types/models/eft/ragfair/IRagfairOffer.d.ts index 3251a37..792ec7d 100644 --- a/TypeScript/13AddTrader/types/models/eft/ragfair/IRagfairOffer.d.ts +++ b/TypeScript/13AddTrader/types/models/eft/ragfair/IRagfairOffer.d.ts @@ -7,19 +7,19 @@ export interface IRagfairOffer { requirements: OfferRequirement[]; root: string; intId: number; + /** Handbook price */ itemsCost: number; + /** Rouble price */ requirementsCost: number; - sptRequirementsCostRouble: number; startTime: number; endTime: number; sellInOnePiece: boolean; - name?: string; - shortName?: string; loyaltyLevel: number; buyRestrictionMax?: number; buyRestrictionCurrent?: number; locked: boolean; unlimitedCount: boolean; + /** Rouble price */ summaryCost: number; user: IRagfairOfferUser; notAvailable: boolean; @@ -33,11 +33,11 @@ export interface OfferRequirement { } export interface IRagfairOfferUser { id: string; - nickname: string; - rating: number; + nickname?: string; + rating?: number; memberType: MemberCategory; - avatar: string; - isRatingGrowing: boolean; + avatar?: string; + isRatingGrowing?: boolean; } export interface SellResult { sellTime: number; diff --git a/TypeScript/13AddTrader/types/models/eft/weather/IWeatherData.d.ts b/TypeScript/13AddTrader/types/models/eft/weather/IWeatherData.d.ts index ecc96ce..1f5d5b5 100644 --- a/TypeScript/13AddTrader/types/models/eft/weather/IWeatherData.d.ts +++ b/TypeScript/13AddTrader/types/models/eft/weather/IWeatherData.d.ts @@ -1,17 +1,18 @@ +import { WindDirection } from "../../../models/enums/WindDirection"; export interface IWeatherData { acceleration: number; time: string; date: string; - weather: IWeather; + weather?: IWeather; } export interface IWeather { pressure: number; temp: number; - fog: string; + fog: number; rain_intensity: number; - rain: any; + rain: number; wind_gustiness: number; - wind_direction: any; + wind_direction: WindDirection; wind_speed: number; cloud: number; time: string; diff --git a/TypeScript/13AddTrader/types/models/enums/BackendErrorCodes.d.ts b/TypeScript/13AddTrader/types/models/enums/BackendErrorCodes.d.ts new file mode 100644 index 0000000..6614b75 --- /dev/null +++ b/TypeScript/13AddTrader/types/models/enums/BackendErrorCodes.d.ts @@ -0,0 +1,67 @@ +export declare enum BackendErrorCodes { + NONE = 0, + UNKNOWN_ERROR = 200, + NOT_AUTHORIZED = 201, + NEED_AUTHORIZATION_CODE = 209, + WRONG_AUTHORIZATION_CODE = 211, + NEED_CAPTCHA = 214, + NO_NEED_CAPTCHA = 215, + CAPTCHA_FAILED = 218, + CAPTCHA_BRUTE_FORCED = 219, + NO_ROOM_IN_STASH = 223, + NICKNAME_NOT_UNIQUE = 225, + NICKNAME_NOT_VALID = 226, + UNSUPPORTED_CLIENT_VERSION = 232, + REPORT_NOT_ALLOWED = 238, + NICKNAME_IS_ABUSIVE = 241, + NICKNAME_CHANGE_TIMEOUT = 242, + NOT_MODIFIED = 304, + HTTP_BAD_REQUEST = 400, + HTTP_NOT_AUTHORIZED = 401, + HTTP_FORBIDDEN = 403, + HTTP_NOT_FOUND = 404, + HTTP_METHOD_NOT_ALLOWED = 405, + UNKNOWN_TRADING_ERROR = 500, + HTTPNOTIMPLEMENTED = 501, + HTTPBADGATEWAY = 502, + HTTPSERVICEUNAVAILABLE = 503, + HTTPGATEWAYTIMEOUT = 504, + TRADEROUTOFMONEY = 505, + HTTPVARIANTALSONEGOTIATES = 506, + PRICECHANGED = 509, + TRADERDISABLED = 512, + ITEMHASBEENSOLD = 513, + NOTENOUGHSPACEFORMONEY = 518, + HTTPINVALIDSSLCERTIFICATE = 526, + UNKNOWNRAGFAIRERROR = 550, + UNKNOWNRAGFAIRERROR2 = 551, + UNKNOWNMATCHMAKERERROR = 600, + SESSIONPARAMETERSERROR = 601, + SESSIONLOST = 602, + SERVERNOTREGISTERED = 604, + UNKNOWNQUESTERROR = 700, + QUESTBADPARAM = 702, + QUESTNOTFOUND = 703, + QUESTISUNAVAILABLE = 704, + NOFREESPACEFORREWARDS = 705, + WRONGQUESTSTATUS = 706, + CANTCOMPLETEQUEST = 707, + UNKNOWNMAILERROR = 900, + TOOMANYFRIENDREQUESTS = 925, + UNKNOWNSCRIPTEXECUTIONERROR = 1000, + UNKNOWNREPAIRINGERROR = 1200, + UNKNOWNINSURANCEERROR = 1300, + UNKNOWNCURRENCYEXCHANGEERROR = 1400, + OFFERNOTFOUND = 1503, + NOTENOUGHSPACE = 1505, + OFFEROUTOFSTOCK = 1506, + OFFERSOLD = 1507, + RAGFAIRUNAVAILABLE = 1511, + BANNEDERRORCODE = 1513, + INSUFFICIENTNUMBERINSTOCK = 1516, + TOOMANYITEMSTOSELL = 1517, + EXAMINATIONFAILED = 22001, + ITEMALREADYEXAMINED = 22002, + UNKNOWNNGINXERROR = 9000, + PARSERESPONSEERROR = 9001 +} diff --git a/TypeScript/13AddTrader/types/models/enums/HideoutEventActions.d.ts b/TypeScript/13AddTrader/types/models/enums/HideoutEventActions.d.ts new file mode 100644 index 0000000..e441477 --- /dev/null +++ b/TypeScript/13AddTrader/types/models/enums/HideoutEventActions.d.ts @@ -0,0 +1,11 @@ +export declare enum HideoutEventActions { + HIDEOUT_UPGRADE = "HideoutUpgrade", + HIDEOUT_UPGRADE_COMPLETE = "HideoutUpgradeComplete", + HIDEOUT_PUT_ITEMS_IN_AREA_SLOTS = "HideoutPutItemsInAreaSlots", + HIDEOUT_TAKE_ITEMS_FROM_AREA_SLOTS = "HideoutTakeItemsFromAreaSlots", + HIDEOUT_TOGGLE_AREA = "HideoutToggleArea", + HIDEOUT_SINGLE_PRODUCTION_START = "HideoutSingleProductionStart", + HIDEOUT_SCAV_CASE_PRODUCTION_START = "HideoutScavCaseProductionStart", + HIDEOUT_CONTINUOUS_PRODUCTION_START = "HideoutContinuousProductionStart", + HIDEOUT_TAKE_PRODUCTION = "HideoutTakeProduction" +} diff --git a/TypeScript/13AddTrader/types/models/enums/ItemEventActions.d.ts b/TypeScript/13AddTrader/types/models/enums/ItemEventActions.d.ts new file mode 100644 index 0000000..0e65453 --- /dev/null +++ b/TypeScript/13AddTrader/types/models/enums/ItemEventActions.d.ts @@ -0,0 +1,19 @@ +export declare enum ItemEventActions { + MOVE = "Move", + REMOVE = "Remove", + SPLIT = "Split", + MERGE = "Merge", + TRANSFER = "Transfer", + SWAP = "Swap", + FOLD = "Fold", + TOGGLE = "Toggle", + TAG = "Tag", + BIND = "Bind", + EXAMINE = "Examine", + READ_ENCYCLOPEDIA = "ReadEncyclopedia", + APPLY_INVENTORY_CHANGES = "ApplyInventoryChanges", + CREATE_MAP_MARKER = "CreateMapMarker", + DELETE_MAP_MARKER = "DeleteMapMarker", + EDIT_MAP_MARKER = "EditMapMarker", + OPEN_RANDOM_LOOT_CONTAINER = "OpenRandomLootContainer" +} diff --git a/TypeScript/13AddTrader/types/models/enums/WeatherType.d.ts b/TypeScript/13AddTrader/types/models/enums/WeatherType.d.ts new file mode 100644 index 0000000..d31fefe --- /dev/null +++ b/TypeScript/13AddTrader/types/models/enums/WeatherType.d.ts @@ -0,0 +1,19 @@ +export declare enum WeatherType { + CLEAR_DAY = 1, + CLEAR_WIND = 2, + CLEAR_NIGHT = 3, + PARTLY_CLOUD_DAY = 4, + PARTLY_CLOUD_NIGHT = 5, + CLEAR_FOG_DAY = 6, + CLEAR_FOG_NIGHT = 7, + CLOUDFOG = 8, + FOG = 9, + MOSTLY_CLOUD = 10, + LIGHT_RAIN = 11, + RAIN = 12, + CLOUD_WIND = 13, + CLOUD_WIND_RAIN = 14, + FULL_CLOUD = 15, + THUNDER_CLOUD = 16, + NONE = 0 +} diff --git a/TypeScript/13AddTrader/types/models/enums/WildSpawnTypeNumber.d.ts b/TypeScript/13AddTrader/types/models/enums/WildSpawnTypeNumber.d.ts new file mode 100644 index 0000000..ff806fe --- /dev/null +++ b/TypeScript/13AddTrader/types/models/enums/WildSpawnTypeNumber.d.ts @@ -0,0 +1,33 @@ +export declare enum WildSpawnTypeNumber { + ASSAULT = 1, + MARKSMAN = 2, + BOSSTEST = 4, + BOSSBULLY = 8, + FOLLOWERTEST = 16, + FOLLOWERBULLY = 32, + BOSSKILLA = 64, + BOSSKOJANIY = 128, + FOLLOWERKOJANIY = 256, + PMCBOT = 512, + CURSEDASSAULT = 1024, + BOSSGLUHAR = 2048, + FOLLOWERGLUHARASSAULT = 4096, + FOLLOWERGLUHARSECURITY = 8192, + FOLLOWERGLUHARSCOUT = 16384, + FOLLOWERGLUHARSNIPE = 32768, + FOLLOWERSANITAR = 65536, + BOSSSANITAR = 131072, + TEST = 262144, + ASSAULTGROUP = 524288, + SECTANTWARRIOR = 1048576, + SECTANTPRIEST = 2097152, + BOSSTAGILLA = 4194304, + FOLLOWERTAGILLA = 8388608, + EXUSEC = 16777216, + GIFTER = 33554432, + BOSSKNIGHT = 67108864, + FOLLOWERBIGPIPE = 134217728, + FOLLOWERBIRDEYE = 268435456, + SPTUSEC = 536870912, + SPTBEAR = 1073741824 +} diff --git a/TypeScript/13AddTrader/types/models/enums/WindDirection.d.ts b/TypeScript/13AddTrader/types/models/enums/WindDirection.d.ts new file mode 100644 index 0000000..fb30b20 --- /dev/null +++ b/TypeScript/13AddTrader/types/models/enums/WindDirection.d.ts @@ -0,0 +1,10 @@ +export declare enum WindDirection { + EAST = 1, + NORTH = 2, + WEST = 3, + SOUTH = 4, + SE = 5, + SW = 6, + NW = 7, + NE = 8 +} diff --git a/TypeScript/13AddTrader/types/models/spt/config/IBotConfig.d.ts b/TypeScript/13AddTrader/types/models/spt/config/IBotConfig.d.ts index af8ceba..d6fa5e0 100644 --- a/TypeScript/13AddTrader/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/13AddTrader/types/models/spt/config/IBotConfig.d.ts @@ -27,6 +27,8 @@ export interface IBotConfig extends IBaseConfig { maxBotCap: Record; /** How many stacks of secret ammo should a bot have in its bot secure container */ secureContainerAmmoStackCount: number; + /** Batch generation size when type not available in cache */ + botGenerationBatchSizePerType: number; } export interface PresetBatch { assault: number; @@ -66,8 +68,12 @@ export interface EquipmentFilters { weaponModLimits: ModLimits; randomisedWeaponModSlots?: string[]; randomisedArmorSlots?: string[]; + faceShieldIsActiveChancePercent?: number; + lightLaserIsActiveChancePercent?: number; blacklist: EquipmentFilterDetails[]; whitelist: EquipmentFilterDetails[]; + clothing: WeightingAdjustmentDetails[]; + weightingAdjustments: WeightingAdjustmentDetails[]; } export interface ModLimits { /** How many scopes are allowed on a weapon - hard coded to work with OPTIC_SCOPE, ASSAULT_SCOPE, COLLIMATOR, COMPACT_COLLIMATOR */ @@ -80,3 +86,8 @@ export interface EquipmentFilterDetails { equipment: Record; cartridge: Record; } +export interface WeightingAdjustmentDetails { + levelRange: MinMax; + add: Record>; + edit: Record>; +} diff --git a/TypeScript/13AddTrader/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/13AddTrader/types/models/spt/config/IInventoryConfig.d.ts index ffffa41..4642b9b 100644 --- a/TypeScript/13AddTrader/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/13AddTrader/types/models/spt/config/IInventoryConfig.d.ts @@ -2,4 +2,10 @@ import { IBaseConfig } from "./IBaseConfig"; export interface IInventoryConfig extends IBaseConfig { kind: "aki-inventory"; newItemsMarkedFound: boolean; + randomLootContainers: Record; +} +export interface RewardDetails { + rewardCount: number; + foundInRaid: boolean; + rewardTplPool: Record; } diff --git a/TypeScript/13AddTrader/types/models/spt/config/ILocaleConfig.d.ts b/TypeScript/13AddTrader/types/models/spt/config/ILocaleConfig.d.ts index fe9abf7..0a8955c 100644 --- a/TypeScript/13AddTrader/types/models/spt/config/ILocaleConfig.d.ts +++ b/TypeScript/13AddTrader/types/models/spt/config/ILocaleConfig.d.ts @@ -1,5 +1,10 @@ import { IBaseConfig } from "./IBaseConfig"; export interface ILocaleConfig extends IBaseConfig { kind: "aki-locale"; - desiredLocale: string; + /** e.g. ru/en/cn/fr etc, or 'system', will take computer locale setting */ + gameLocale: string; + /** e.g. ru/en/cn/fr etc, or 'system', will take computer locale setting */ + serverLocale: string; + /** Languages server can be translated into */ + serverSupportedLocales: string[]; } diff --git a/TypeScript/13AddTrader/types/models/spt/config/IPmcConfig.d.ts b/TypeScript/13AddTrader/types/models/spt/config/IPmcConfig.d.ts index 9db2ba1..48601b2 100644 --- a/TypeScript/13AddTrader/types/models/spt/config/IPmcConfig.d.ts +++ b/TypeScript/13AddTrader/types/models/spt/config/IPmcConfig.d.ts @@ -6,9 +6,11 @@ export interface IPmcConfig { looseWeaponInBackpackChancePercent: number; looseWeaponInBackpackLootMinMax: MinMax; isUsec: number; + usecType: string; + bearType: string; chanceSameSideIsHostilePercent: number; /** key: location, value: type for usec/bear */ - pmcType: Record; + pmcType: Record>>; maxBackpackLootTotalRub: number; maxPocketLootTotalRub: number; maxVestLootTotalRub: number; diff --git a/TypeScript/13AddTrader/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/13AddTrader/types/models/spt/config/IRagfairConfig.d.ts index c1b8763..6786417 100644 --- a/TypeScript/13AddTrader/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/13AddTrader/types/models/spt/config/IRagfairConfig.d.ts @@ -28,12 +28,8 @@ export interface Reputation { gain: number; loss: number; } -export declare class OfferAdjustment { - maxPriceDifferenceBelowHandbookPercent: number; - handbookPriceMultipier: number; - priceThreshholdRub: number; -} export interface Dynamic { + barter: Barter; offerAdjustment: OfferAdjustment; expiredOfferThreshold: number; offerItemCount: MinMax; @@ -49,6 +45,20 @@ export interface Dynamic { showAsSingleStack: string[]; blacklist: Blacklist; } +export declare class Barter { + enable: boolean; + chancePercent: number; + itemCountMin: number; + itemCountMax: number; + priceRangeVariancePercent: number; + minRoubleCostToBecomeBarter: number; + itemTypeBlacklist: string[]; +} +export declare class OfferAdjustment { + maxPriceDifferenceBelowHandbookPercent: number; + handbookPriceMultipier: number; + priceThreshholdRub: number; +} export interface Condition { conditionChance: number; min: number; diff --git a/TypeScript/13AddTrader/types/models/spt/config/ISeasonalEventConfig.d.ts b/TypeScript/13AddTrader/types/models/spt/config/ISeasonalEventConfig.d.ts index bc60618..e410925 100644 --- a/TypeScript/13AddTrader/types/models/spt/config/ISeasonalEventConfig.d.ts +++ b/TypeScript/13AddTrader/types/models/spt/config/ISeasonalEventConfig.d.ts @@ -1,6 +1,9 @@ import { IBaseConfig } from "./IBaseConfig"; export interface ISeasonalEventConfig extends IBaseConfig { kind: "aki-seasonalevents"; + enableSeasonalEventDetection: boolean; + /** event / botType / equipSlot / itemid */ + eventGear: Record>>>; events: ISeasonalEvent[]; } export interface ISeasonalEvent { diff --git a/TypeScript/13AddTrader/types/models/spt/config/IWeatherConfig.d.ts b/TypeScript/13AddTrader/types/models/spt/config/IWeatherConfig.d.ts index bbdc43e..41a1c83 100644 --- a/TypeScript/13AddTrader/types/models/spt/config/IWeatherConfig.d.ts +++ b/TypeScript/13AddTrader/types/models/spt/config/IWeatherConfig.d.ts @@ -1,3 +1,4 @@ +import { WindDirection } from "../../../models/enums/WindDirection"; import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface IWeatherConfig extends IBaseConfig { @@ -7,12 +8,16 @@ export interface IWeatherConfig extends IBaseConfig { } export interface Weather { clouds: MinMax; - windSpeed: MinMax; - windDirection: MinMax; + windSpeed: WeatherSettings; + windDirection: WeatherSettings; windGustiness: MinMax; - rain: MinMax; + rain: WeatherSettings; rainIntensity: MinMax; - fog: MinMax; + fog: WeatherSettings; temp: MinMax; pressure: MinMax; } +export interface WeatherSettings { + values: T[]; + weights: number[]; +} diff --git a/TypeScript/13AddTrader/types/routers/item_events/HideoutItemEventRouter.d.ts b/TypeScript/13AddTrader/types/routers/item_events/HideoutItemEventRouter.d.ts index e1e98af..44bd1cd 100644 --- a/TypeScript/13AddTrader/types/routers/item_events/HideoutItemEventRouter.d.ts +++ b/TypeScript/13AddTrader/types/routers/item_events/HideoutItemEventRouter.d.ts @@ -1,7 +1,7 @@ -import { IPmcData } from "../../models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "../../models/eft/itemEvent/IItemEventRouterResponse"; import { HideoutCallbacks } from "../../callbacks/HideoutCallbacks"; import { HandledRoute, ItemEventRouterDefinition } from "../../di/Router"; +import { IPmcData } from "../../models/eft/common/IPmcData"; +import { IItemEventRouterResponse } from "../../models/eft/itemEvent/IItemEventRouterResponse"; export declare class HideoutItemEventRouter extends ItemEventRouterDefinition { protected hideoutCallbacks: HideoutCallbacks; constructor(hideoutCallbacks: HideoutCallbacks); diff --git a/TypeScript/13AddTrader/types/routers/item_events/InventoryItemEventRouter.d.ts b/TypeScript/13AddTrader/types/routers/item_events/InventoryItemEventRouter.d.ts index 2619bb9..953d322 100644 --- a/TypeScript/13AddTrader/types/routers/item_events/InventoryItemEventRouter.d.ts +++ b/TypeScript/13AddTrader/types/routers/item_events/InventoryItemEventRouter.d.ts @@ -1,7 +1,7 @@ -import { IPmcData } from "../../models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "../../models/eft/itemEvent/IItemEventRouterResponse"; import { InventoryCallbacks } from "../../callbacks/InventoryCallbacks"; import { HandledRoute, ItemEventRouterDefinition } from "../../di/Router"; +import { IPmcData } from "../../models/eft/common/IPmcData"; +import { IItemEventRouterResponse } from "../../models/eft/itemEvent/IItemEventRouterResponse"; export declare class InventoryItemEventRouter extends ItemEventRouterDefinition { protected inventoryCallbacks: InventoryCallbacks; constructor(inventoryCallbacks: InventoryCallbacks); diff --git a/TypeScript/13AddTrader/types/servers/HttpServer.d.ts b/TypeScript/13AddTrader/types/servers/HttpServer.d.ts index bbca8af..80c1d48 100644 --- a/TypeScript/13AddTrader/types/servers/HttpServer.d.ts +++ b/TypeScript/13AddTrader/types/servers/HttpServer.d.ts @@ -4,6 +4,7 @@ import { ApplicationContext } from "../context/ApplicationContext"; import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; import { ILogger } from "../models/spt/utils/ILogger"; +import { LocalisationService } from "../services/LocalisationService"; import { ConfigServer } from "./ConfigServer"; import { DatabaseServer } from "./DatabaseServer"; import { IHttpListener } from "./http/IHttpListener"; @@ -12,11 +13,12 @@ export declare class HttpServer { protected logger: ILogger; protected databaseServer: DatabaseServer; protected httpServerHelper: HttpServerHelper; + protected localisationService: LocalisationService; protected httpListeners: IHttpListener[]; protected configServer: ConfigServer; protected applicationContext: ApplicationContext; protected webSocketServer: WebSocketServer; - constructor(logger: ILogger, databaseServer: DatabaseServer, httpServerHelper: HttpServerHelper, httpListeners: IHttpListener[], configServer: ConfigServer, applicationContext: ApplicationContext, webSocketServer: WebSocketServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, httpServerHelper: HttpServerHelper, localisationService: LocalisationService, httpListeners: IHttpListener[], configServer: ConfigServer, applicationContext: ApplicationContext, webSocketServer: WebSocketServer); protected httpConfig: IHttpConfig; getCookies(req: http.IncomingMessage): any; handleRequest(req: IncomingMessage, resp: ServerResponse): void; diff --git a/TypeScript/13AddTrader/types/servers/SaveServer.d.ts b/TypeScript/13AddTrader/types/servers/SaveServer.d.ts index cb28f49..4dca514 100644 --- a/TypeScript/13AddTrader/types/servers/SaveServer.d.ts +++ b/TypeScript/13AddTrader/types/servers/SaveServer.d.ts @@ -1,20 +1,22 @@ +import { SaveLoadRouter } from "../di/Router"; import { IAkiProfile, Info } from "../models/eft/profile/IAkiProfile"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { VFS } from "../utils/VFS"; -import { SaveLoadRouter } from "../di/Router"; -import { ILogger } from "../models/spt/utils/ILogger"; export declare class SaveServer { protected vfs: VFS; protected saveLoadRouters: SaveLoadRouter[]; protected jsonUtil: JsonUtil; protected hashUtil: HashUtil; + protected localisationService: LocalisationService; protected logger: ILogger; protected profileFilepath: string; protected profiles: {}; protected onSave: {}; protected saveMd5: {}; - constructor(vfs: VFS, saveLoadRouters: SaveLoadRouter[], jsonUtil: JsonUtil, hashUtil: HashUtil, logger: ILogger); + constructor(vfs: VFS, saveLoadRouters: SaveLoadRouter[], jsonUtil: JsonUtil, hashUtil: HashUtil, localisationService: LocalisationService, logger: ILogger); load(): void; save(): void; getProfile(sessionId: string): IAkiProfile; diff --git a/TypeScript/13AddTrader/types/servers/WebSocketServer.d.ts b/TypeScript/13AddTrader/types/servers/WebSocketServer.d.ts index f33d214..5d40e6e 100644 --- a/TypeScript/13AddTrader/types/servers/WebSocketServer.d.ts +++ b/TypeScript/13AddTrader/types/servers/WebSocketServer.d.ts @@ -1,18 +1,20 @@ /// -import { HttpServerHelper } from "../helpers/HttpServerHelper"; -import WebSocket from "ws"; import http, { IncomingMessage } from "http"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { RandomUtil } from "../utils/RandomUtil"; +import WebSocket from "ws"; +import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { INotification } from "../models/eft/notifier/INotifier"; -import { ConfigServer } from "./ConfigServer"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { LocalisationService } from "../services/LocalisationService"; +import { RandomUtil } from "../utils/RandomUtil"; +import { ConfigServer } from "./ConfigServer"; export declare class WebSocketServer { protected logger: ILogger; protected randomUtil: RandomUtil; protected configServer: ConfigServer; + protected localisationService: LocalisationService; protected httpServerHelper: HttpServerHelper; - constructor(logger: ILogger, randomUtil: RandomUtil, configServer: ConfigServer, httpServerHelper: HttpServerHelper); + constructor(logger: ILogger, randomUtil: RandomUtil, configServer: ConfigServer, localisationService: LocalisationService, httpServerHelper: HttpServerHelper); protected httpConfig: IHttpConfig; protected defaultNotification: INotification; protected webSockets: Record; diff --git a/TypeScript/13AddTrader/types/servers/http/AkiHttpListener.d.ts b/TypeScript/13AddTrader/types/servers/http/AkiHttpListener.d.ts index 6f78939..acf92aa 100644 --- a/TypeScript/13AddTrader/types/servers/http/AkiHttpListener.d.ts +++ b/TypeScript/13AddTrader/types/servers/http/AkiHttpListener.d.ts @@ -1,22 +1,24 @@ /// /// import { IncomingMessage, ServerResponse } from "http"; -import { IHttpListener } from "./IHttpListener"; import { Serializer } from "../../di/Serializer"; import { ILogger } from "../../models/spt/utils/ILogger"; import { HttpRouter } from "../../routers/HttpRouter"; +import { LocalisationService } from "../../services/LocalisationService"; import { HttpResponseUtil } from "../../utils/HttpResponseUtil"; import { JsonUtil } from "../../utils/JsonUtil"; import { HttpBufferHandler } from "./HttpBufferHandler"; +import { IHttpListener } from "./IHttpListener"; export declare class AkiHttpListener implements IHttpListener { protected httpRouter: HttpRouter; protected serializers: Serializer[]; protected logger: ILogger; protected jsonUtil: JsonUtil; protected httpResponse: HttpResponseUtil; + protected localisationService: LocalisationService; protected httpBufferHandler: HttpBufferHandler; constructor(httpRouter: HttpRouter, // TODO: delay required - serializers: Serializer[], logger: ILogger, jsonUtil: JsonUtil, httpResponse: HttpResponseUtil, httpBufferHandler: HttpBufferHandler); + serializers: Serializer[], logger: ILogger, jsonUtil: JsonUtil, httpResponse: HttpResponseUtil, localisationService: LocalisationService, httpBufferHandler: HttpBufferHandler); canHandle(_: string, req: IncomingMessage): boolean; handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): void; sendResponse(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: Buffer, output: string): void; diff --git a/TypeScript/13AddTrader/types/services/BotEquipmentFilterService.d.ts b/TypeScript/13AddTrader/types/services/BotEquipmentFilterService.d.ts index 632f961..ae72cc3 100644 --- a/TypeScript/13AddTrader/types/services/BotEquipmentFilterService.d.ts +++ b/TypeScript/13AddTrader/types/services/BotEquipmentFilterService.d.ts @@ -1,12 +1,12 @@ import { IBotType } from "../models/eft/common/tables/IBotType"; -import { EquipmentFilters, EquipmentFilterDetails, IBotConfig } from "../models/spt/config/IBotConfig"; +import { EquipmentFilters, EquipmentFilterDetails, IBotConfig, WeightingAdjustmentDetails } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; export declare class BotEquipmentFilterService { protected logger: ILogger; protected configServer: ConfigServer; protected botConfig: IBotConfig; - protected botEquipmentFilterlists: Record; + protected botEquipmentConfig: Record; constructor(logger: ILogger, configServer: ConfigServer); /** * Filter a bots data to exclude equipment and cartridges defines in the botConfig @@ -30,6 +30,20 @@ export declare class BotEquipmentFilterService { * @returns EquipmentFilterDetails object */ protected getBotEquipmentWhitelist(botRole: string, playerLevel: number): EquipmentFilterDetails; + /** + * Retreive clothing weighting adjustments from bot.json config + * @param botRole Bot type to get adjustments for + * @param playerLevel level of player + * @returns Weighting adjustments for bots clothing + */ + protected getBotClothingAdjustments(botRole: string, playerLevel: number): WeightingAdjustmentDetails; + /** + * Retreive item weighting adjustments from bot.json config + * @param botRole Bot type to get adjustments for + * @param playerLevel level of player + * @returns Weighting adjustments for bot items + */ + protected getBotWeightingAdjustments(botRole: string, playerLevel: number): WeightingAdjustmentDetails; /** * Filter bot equipment based on blacklist and whitelist from config/bot.json * Prioritises whitelist first, if one is found blacklist is ignored @@ -47,4 +61,10 @@ export declare class BotEquipmentFilterService { * @returns Filtered bot file */ protected filterCartridges(baseBotNode: IBotType, blacklist: EquipmentFilterDetails, whitelist: EquipmentFilterDetails): void; + /** + * Add/Edit weighting changes to bot items using values from config/bot.json/equipment + * @param weightingAdjustments Weighting change to apply to bot + * @param botItemPool Bot item dictionary to adjust + */ + protected adjustWeighting(weightingAdjustments: WeightingAdjustmentDetails, botItemPool: Record): void; } diff --git a/TypeScript/13AddTrader/types/services/BotGenerationCacheService.d.ts b/TypeScript/13AddTrader/types/services/BotGenerationCacheService.d.ts index ba53fec..0be0576 100644 --- a/TypeScript/13AddTrader/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/13AddTrader/types/services/BotGenerationCacheService.d.ts @@ -8,11 +8,11 @@ export declare class BotGenerationCacheService { protected randomUtil: RandomUtil; protected jsonUtil: JsonUtil; protected botHelper: BotHelper; - protected storedBots: IBotBase[]; + protected storedBots: Map; constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, botHelper: BotHelper); /** * Store array of bots in cache, shuffle results before storage - * @param botsToStore + * @param botsToStore Bots we want to store in the cache */ storeBots(botsToStore: IBotBase[]): void; /** @@ -21,25 +21,7 @@ export declare class BotGenerationCacheService { * @param role role to retreive (assault/bossTagilla etc) * @returns IBotBase object */ - getBot(role: string): IBotBase[]; - /** - * Find a bot by its index from cache - * @param indexOfBotToReturn index to find bot by - * @returns bot profile - */ - protected getBotFromCache(indexOfBotToReturn: number): IBotBase; - /** - * Remove bot profile by index from cache - * @param indexOfBotToReturn Index of bot profile to remove - */ - protected removeBotFromCache(indexOfBotToReturn: number): void; - /** - * Get index of bot profile that matches criteria - * @param role Role of bot wanted - * @param getPmc Requested bot a pmc - * @returns index of found bot, -1 if not found - */ - protected getIndexOfBotToReturn(role: string, getPmc: boolean): number; + getBot(role: string): IBotBase; /** * Remove all cached bot profiles */ @@ -48,5 +30,5 @@ export declare class BotGenerationCacheService { * Does cache have bots * @returns true if empty */ - cacheIsEmpty(): boolean; + cacheHasBotOfRole(role: string): boolean; } diff --git a/TypeScript/13AddTrader/types/services/LocaleService.d.ts b/TypeScript/13AddTrader/types/services/LocaleService.d.ts index 33bea7b..8275b75 100644 --- a/TypeScript/13AddTrader/types/services/LocaleService.d.ts +++ b/TypeScript/13AddTrader/types/services/LocaleService.d.ts @@ -1,14 +1,42 @@ import { ILocaleConfig } from "../models/spt/config/ILocaleConfig"; +import { ILocaleGlobalBase } from "../models/spt/server/ILocaleBase"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +/** + * Handles getting locales from config or users machine + */ export declare class LocaleService { protected logger: ILogger; + protected databaseServer: DatabaseServer; protected configServer: ConfigServer; protected localeConfig: ILocaleConfig; - constructor(logger: ILogger, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, configServer: ConfigServer); /** - * Gets the locale key from the locale.json file + * Get the eft globals db file based on the configured locale in config/locale.json, if not found, fall back to 'en' + * @returns ILocaleGlobalBase + */ + getLocaleDb(): ILocaleGlobalBase; + /** + * Gets the game locale key from the locale.json file, + * if value is 'system' get system locale * @returns locale e.g en/ge/cz/cn */ - getDesiredLocale(): string; + getDesiredGameLocale(): string; + /** + * Gets the game locale key from the locale.json file, + * if value is 'system' get system locale + * @returns locale e.g en/ge/cz/cn + */ + getDesiredServerLocale(): string; + /** + * Get array of languages supported for localisation + * @returns array of locales e.g. en/fr/cn + */ + getServerSupportedLocales(): string[]; + /** + * Get the locale of the computer running the server + * @returns langage part of locale e.g. 'en' part of 'en-US' + */ + protected getPlatformLocale(): string; } diff --git a/TypeScript/13AddTrader/types/services/LocalisationService.d.ts b/TypeScript/13AddTrader/types/services/LocalisationService.d.ts new file mode 100644 index 0000000..519325d --- /dev/null +++ b/TypeScript/13AddTrader/types/services/LocalisationService.d.ts @@ -0,0 +1,21 @@ +import { I18n } from "i18n"; +import { ILocaleConfig } from "../models/spt/config/ILocaleConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { LocaleService } from "./LocaleService"; +/** + * Handles translating server text into different langauges + */ +export declare class LocalisationService { + protected logger: ILogger; + protected localeService: LocaleService; + protected localeConfig: ILocaleConfig; + protected i18n: I18n; + constructor(logger: ILogger, localeService: LocaleService); + /** + * Get a localised value using the passed in key + * @param key Key to loop up locale for + * @param args optional arguments + * @returns Localised string + */ + getText(key: string, args?: any): string; +} diff --git a/TypeScript/13AddTrader/types/services/PaymentService.d.ts b/TypeScript/13AddTrader/types/services/PaymentService.d.ts index a5e538f..c9ce95a 100644 --- a/TypeScript/13AddTrader/types/services/PaymentService.d.ts +++ b/TypeScript/13AddTrader/types/services/PaymentService.d.ts @@ -11,6 +11,7 @@ import { IProcessSellTradeRequestData } from "../models/eft/trade/IProcessSellTr import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +import { LocalisationService } from "./LocalisationService"; export declare class PaymentService { protected logger: ILogger; protected httpResponse: HttpResponseUtil; @@ -19,8 +20,9 @@ export declare class PaymentService { protected traderHelper: TraderHelper; protected itemHelper: ItemHelper; protected inventoryHelper: InventoryHelper; + protected localisationService: LocalisationService; protected paymentHelper: PaymentHelper; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, traderHelper: TraderHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper); + constructor(logger: ILogger, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, traderHelper: TraderHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, localisationService: LocalisationService, paymentHelper: PaymentHelper); /** * Take money and insert items into return to server request * @param {Object} pmcData @@ -50,7 +52,7 @@ export declare class PaymentService { * @param pmcData Player profile to find and remove currency from * @param currencyTpl Type of currency to pay * @param amountToPay money value to pay - * @param sessionID Sessino id + * @param sessionID Session id * @param output output object to send to client * @returns IItemEventRouterResponse */ diff --git a/TypeScript/13AddTrader/types/services/PlayerService.d.ts b/TypeScript/13AddTrader/types/services/PlayerService.d.ts index 519b7e5..2f364d5 100644 --- a/TypeScript/13AddTrader/types/services/PlayerService.d.ts +++ b/TypeScript/13AddTrader/types/services/PlayerService.d.ts @@ -2,10 +2,12 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { IPlayerIncrementSkillLevelRequestData } from "../models/eft/player/IPlayerIncrementSkillLevelRequestData"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "./LocalisationService"; export declare class PlayerService { protected logger: ILogger; + protected localisationService: LocalisationService; protected databaseServer: DatabaseServer; - constructor(logger: ILogger, databaseServer: DatabaseServer); + constructor(logger: ILogger, localisationService: LocalisationService, databaseServer: DatabaseServer); /** * increases the profile skill and updates any output * @param {Object} pmcData diff --git a/TypeScript/13AddTrader/types/services/PmcAiService.d.ts b/TypeScript/13AddTrader/types/services/PmcAiService.d.ts deleted file mode 100644 index 0690f1f..0000000 --- a/TypeScript/13AddTrader/types/services/PmcAiService.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { IBotConfig } from "../models/spt/config/IBotConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { ConfigServer } from "../servers/ConfigServer"; -/** Storing/retreving pmcRoles set at the start of a raid - its done at that point as we know what location the player is heading to */ -export declare class PmcAiService { - protected logger: ILogger; - protected configServer: ConfigServer; - protected botConfig: IBotConfig; - protected usecRole: string; - protected bearRole: string; - constructor(logger: ILogger, configServer: ConfigServer); - /** - * Convert from pmc side (usec/bear) to the side as defined in the bot config (usecType/bearType) - * @param pmcSide eft side (usec/bear) - * @returns pmc side as defined in config - */ - getPmcRole(pmcSide: "usec" | "bear" | string): string; - /** - * Set the roles for pmcs - * @param location map location to look up and use as pmc types - */ - setPmcRolesByLocation(location: string): void; - /** - * Clear the saved role from usec/bear PMCs - */ - clearPmcRoles(): void; -} diff --git a/TypeScript/13AddTrader/types/services/ProfileFixerService.d.ts b/TypeScript/13AddTrader/types/services/ProfileFixerService.d.ts index e772919..86a6af8 100644 --- a/TypeScript/13AddTrader/types/services/ProfileFixerService.d.ts +++ b/TypeScript/13AddTrader/types/services/ProfileFixerService.d.ts @@ -8,12 +8,14 @@ import { HideoutAreas } from "../models/enums/HideoutAreas"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { Watermark } from "../utils/Watermark"; +import { LocalisationService } from "./LocalisationService"; export declare class ProfileFixerService { protected logger: ILogger; protected watermark: Watermark; protected hideoutHelper: HideoutHelper; + protected localisationService: LocalisationService; protected databaseServer: DatabaseServer; - constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, databaseServer: DatabaseServer); + constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, localisationService: LocalisationService, databaseServer: DatabaseServer); /** * Find issues in the pmc profile data that may cause issues and fix them * @param pmcProfile profile to check and fix diff --git a/TypeScript/13AddTrader/types/services/RagfairOfferService.d.ts b/TypeScript/13AddTrader/types/services/RagfairOfferService.d.ts index a6f6b6d..86c1e52 100644 --- a/TypeScript/13AddTrader/types/services/RagfairOfferService.d.ts +++ b/TypeScript/13AddTrader/types/services/RagfairOfferService.d.ts @@ -11,6 +11,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { TimeUtil } from "../utils/TimeUtil"; +import { LocalisationService } from "./LocalisationService"; import { RagfairCategoriesService } from "./RagfairCategoriesService"; export declare class RagfairOfferService { protected logger: ILogger; @@ -22,12 +23,14 @@ export declare class RagfairOfferService { protected profileHelper: ProfileHelper; protected eventOutputHolder: EventOutputHolder; protected httpResponse: HttpResponseUtil; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected playerOffersLoaded: boolean; protected expiredOffers: Item[]; - protected offers: IRagfairOffer[]; + /** offerId, offer */ + protected offers: Record; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, databaseServer: DatabaseServer, saveServer: SaveServer, ragfairServerHelper: RagfairServerHelper, ragfairCategoriesService: RagfairCategoriesService, profileHelper: ProfileHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, databaseServer: DatabaseServer, saveServer: SaveServer, ragfairServerHelper: RagfairServerHelper, ragfairCategoriesService: RagfairCategoriesService, profileHelper: ProfileHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, localisationService: LocalisationService, configServer: ConfigServer); /** * Get all offers * @returns IRagfairOffer array diff --git a/TypeScript/13AddTrader/types/utils/App.d.ts b/TypeScript/13AddTrader/types/utils/App.d.ts index dcc2669..cc8a5af 100644 --- a/TypeScript/13AddTrader/types/utils/App.d.ts +++ b/TypeScript/13AddTrader/types/utils/App.d.ts @@ -1,14 +1,16 @@ -import { TimeUtil } from "./TimeUtil"; import { OnLoad } from "../di/OnLoad"; import { OnUpdate } from "../di/OnUpdate"; import { ILogger } from "../models/spt/utils/ILogger"; +import { LocalisationService } from "../services/LocalisationService"; +import { TimeUtil } from "./TimeUtil"; export declare class App { protected logger: ILogger; protected timeUtil: TimeUtil; + protected localisationService: LocalisationService; protected onLoadComponents: OnLoad[]; protected onUpdateComponents: OnUpdate[]; protected onUpdateLastRun: {}; - constructor(logger: ILogger, timeUtil: TimeUtil, onLoadComponents: OnLoad[], onUpdateComponents: OnUpdate[]); + constructor(logger: ILogger, timeUtil: TimeUtil, localisationService: LocalisationService, onLoadComponents: OnLoad[], onUpdateComponents: OnUpdate[]); load(): void; protected update(onUpdateComponents: OnUpdate[]): void; protected logUpdateException(err: any, updateable: OnUpdate): void; diff --git a/TypeScript/13AddTrader/types/utils/DatabaseImporter.d.ts b/TypeScript/13AddTrader/types/utils/DatabaseImporter.d.ts index 483e135..31670ae 100644 --- a/TypeScript/13AddTrader/types/utils/DatabaseImporter.d.ts +++ b/TypeScript/13AddTrader/types/utils/DatabaseImporter.d.ts @@ -3,15 +3,17 @@ import { IDatabaseTables } from "../models/spt/server/IDatabaseTables"; import { ILogger } from "../models/spt/utils/ILogger"; import { ImageRouter } from "../routers/ImageRouter"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { JsonUtil } from "./JsonUtil"; import { VFS } from "./VFS"; export declare class DatabaseImporter extends OnLoad { protected logger: ILogger; protected vfs: VFS; protected jsonUtil: JsonUtil; + protected localisationService: LocalisationService; protected databaseServer: DatabaseServer; protected imageRouter: ImageRouter; - constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, databaseServer: DatabaseServer, imageRouter: ImageRouter); + constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, localisationService: LocalisationService, databaseServer: DatabaseServer, imageRouter: ImageRouter); onLoad(): void; /** * Read all json files in database folder and map into a json object diff --git a/TypeScript/13AddTrader/types/utils/HttpResponseUtil.d.ts b/TypeScript/13AddTrader/types/utils/HttpResponseUtil.d.ts index 29502be..3a78618 100644 --- a/TypeScript/13AddTrader/types/utils/HttpResponseUtil.d.ts +++ b/TypeScript/13AddTrader/types/utils/HttpResponseUtil.d.ts @@ -1,10 +1,13 @@ -import { JsonUtil } from "./JsonUtil"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { INullResponseData } from "../models/eft/httpResponse/INullResponseData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; +import { BackendErrorCodes } from "../models/enums/BackendErrorCodes"; +import { LocalisationService } from "../services/LocalisationService"; +import { JsonUtil } from "./JsonUtil"; export declare class HttpResponseUtil { protected jsonUtil: JsonUtil; - constructor(jsonUtil: JsonUtil); + protected localisationService: LocalisationService; + constructor(jsonUtil: JsonUtil, localisationService: LocalisationService); protected clearString(s: string): any; noBody(data: any): any; getBody(data: T, err?: number, errmsg?: any): IGetBodyResponseData; @@ -12,5 +15,5 @@ export declare class HttpResponseUtil { emptyResponse(): IGetBodyResponseData; nullResponse(): INullResponseData; emptyArrayResponse(): IGetBodyResponseData; - appendErrorToOutput(output: IItemEventRouterResponse, message?: string, title?: string): IItemEventRouterResponse; + appendErrorToOutput(output: IItemEventRouterResponse, message?: string, errorCode?: BackendErrorCodes): IItemEventRouterResponse; } diff --git a/TypeScript/13AddTrader/types/utils/RandomUtil.d.ts b/TypeScript/13AddTrader/types/utils/RandomUtil.d.ts index 633e472..aa556e3 100644 --- a/TypeScript/13AddTrader/types/utils/RandomUtil.d.ts +++ b/TypeScript/13AddTrader/types/utils/RandomUtil.d.ts @@ -110,6 +110,12 @@ export declare class RandomUtil { getIntEx(max: number): number; getFloat(min: number, max: number): number; getBool(): boolean; + /** + * Check if number passes a check out of 100 + * @param chancePercent value check needs to be above + * @returns true if value passes check + */ + getChance100(chancePercent: number): boolean; getStringArrayValue(arr: string[]): string; getArrayValue(arr: T[]): T; getKey(node: any): string; diff --git a/TypeScript/13AddTrader/types/utils/Watermark.d.ts b/TypeScript/13AddTrader/types/utils/Watermark.d.ts index c6dc120..e02eba2 100644 --- a/TypeScript/13AddTrader/types/utils/Watermark.d.ts +++ b/TypeScript/13AddTrader/types/utils/Watermark.d.ts @@ -1,20 +1,15 @@ import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { LocalisationService } from "../services/LocalisationService"; export declare class WatermarkLocale { - protected locales: { - "en-US": { - description: string[]; - warning: string[]; - modding: string[]; - }; - "zh-CN": { - description: string[]; - warning: string[]; - modding: string[]; - }; + protected localisationService: LocalisationService; + constructor(localisationService: LocalisationService); + protected watermark: { + description: string[]; + warning: string[]; + modding: string[]; }; - getLocale(): string; getDescription(): string[]; getWarning(): string[]; getModding(): string[]; @@ -22,9 +17,10 @@ export declare class WatermarkLocale { export declare class Watermark { protected logger: ILogger; protected configServer: ConfigServer; + protected localisationService: LocalisationService; protected watermarkLocale?: WatermarkLocale; protected akiConfig: ICoreConfig; - constructor(logger: ILogger, configServer: ConfigServer, watermarkLocale?: WatermarkLocale); + constructor(logger: ILogger, configServer: ConfigServer, localisationService: LocalisationService, watermarkLocale?: WatermarkLocale); protected text: string[]; protected versionLabel: string; initialize(): void; diff --git a/TypeScript/14AfterDBLoadHook/types/callbacks/BotCallbacks.d.ts b/TypeScript/14AfterDBLoadHook/types/callbacks/BotCallbacks.d.ts index 2db60dc..827015e 100644 --- a/TypeScript/14AfterDBLoadHook/types/callbacks/BotCallbacks.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/callbacks/BotCallbacks.d.ts @@ -8,8 +8,29 @@ export declare class BotCallbacks { protected botController: BotController; protected httpResponse: HttpResponseUtil; constructor(botController: BotController, httpResponse: HttpResponseUtil); + /** + * Handle singleplayer/settings/bot/limit + * @returns string + */ getBotLimit(url: string, info: IEmptyRequestData, sessionID: string): string; + /** + * Handle singleplayer/settings/bot/difficulty + * @returns string + */ getBotDifficulty(url: string, info: IEmptyRequestData, sessionID: string): string; + /** + * Handle client/game/bot/generate + * @returns IGetBodyResponseData + */ generateBots(url: string, info: IGenerateBotsRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle singleplayer/settings/bot/maxCap + * @returns string + */ getBotCap(): string; + /** + * Handle singleplayer/settings/bot/getBotBehaviours + * @returns string + */ + getBotBehaviours(): string; } diff --git a/TypeScript/14AfterDBLoadHook/types/callbacks/CustomizationCallbacks.d.ts b/TypeScript/14AfterDBLoadHook/types/callbacks/CustomizationCallbacks.d.ts index 3bab8c0..75d5701 100644 --- a/TypeScript/14AfterDBLoadHook/types/callbacks/CustomizationCallbacks.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/callbacks/CustomizationCallbacks.d.ts @@ -3,6 +3,7 @@ import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { IPmcData } from "../models/eft/common/IPmcData"; import { ISuit } from "../models/eft/common/tables/ITrader"; import { IBuyClothingRequestData } from "../models/eft/customization/IBuyClothingRequestData"; +import { IGetSuitsResponse } from "../models/eft/customization/IGetSuitsResponse"; import { IWearClothingRequestData } from "../models/eft/customization/IWearClothingRequestData"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; @@ -13,10 +14,15 @@ export declare class CustomizationCallbacks { protected saveServer: SaveServer; protected httpResponse: HttpResponseUtil; constructor(customizationController: CustomizationController, saveServer: SaveServer, httpResponse: HttpResponseUtil); - getSuits(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<{ - _id: string; - suites: string[]; - }>; + /** + * Handles client/trading/customization/storage + * @returns + */ + getSuits(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handles client/trading/customization + * @returns ISuit[] + */ getTraderSuits(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; wearClothing(pmcData: IPmcData, body: IWearClothingRequestData, sessionID: string): IItemEventRouterResponse; buyClothing(pmcData: IPmcData, body: IBuyClothingRequestData, sessionID: string): IItemEventRouterResponse; diff --git a/TypeScript/14AfterDBLoadHook/types/callbacks/DataCallbacks.d.ts b/TypeScript/14AfterDBLoadHook/types/callbacks/DataCallbacks.d.ts index 04566ff..2efcf81 100644 --- a/TypeScript/14AfterDBLoadHook/types/callbacks/DataCallbacks.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/callbacks/DataCallbacks.d.ts @@ -12,15 +12,42 @@ import { ILanguageBase } from "../models/spt/server/ILocaleBase"; import { ISettingsBase } from "../models/spt/server/ISettingsBase"; import { DatabaseServer } from "../servers/DatabaseServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +/** + * Handle client requests + */ export declare class DataCallbacks { protected httpResponse: HttpResponseUtil; protected databaseServer: DatabaseServer; constructor(httpResponse: HttpResponseUtil, databaseServer: DatabaseServer); + /** + * Handles client/settings + * @returns ISettingsBase + */ getSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handles client/globals + * @returns IGlobals + */ getGlobals(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handles client/items + * @returns string + */ getTemplateItems(url: string, info: IEmptyRequestData, sessionID: string): string; + /** + * Handles client/handbook/templates + * @returns IHandbookBase + */ getTemplateHandbook(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handles client/customization + * @returns Record>; + /** + * Handles client/account/customization + * @returns string[] + */ getTemplateCharacter(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getTemplateQuests(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getHideoutSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; @@ -28,6 +55,6 @@ export declare class DataCallbacks { gethideoutProduction(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getHideoutScavcase(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getLocalesLanguages(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - getLocalesMenu(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + getLocalesMenu(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getLocalesGlobal(url: string, info: IEmptyRequestData, sessionID: string): string; } diff --git a/TypeScript/14AfterDBLoadHook/types/callbacks/DialogueCallbacks.d.ts b/TypeScript/14AfterDBLoadHook/types/callbacks/DialogueCallbacks.d.ts index 634f90b..7b2eeae 100644 --- a/TypeScript/14AfterDBLoadHook/types/callbacks/DialogueCallbacks.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/callbacks/DialogueCallbacks.d.ts @@ -26,15 +26,27 @@ export declare class DialogueCallbacks extends OnUpdate { protected httpResponse: HttpResponseUtil; protected dialogueController: DialogueController; constructor(hashUtil: HashUtil, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, dialogueController: DialogueController); + /** + * Handles client/friend/list + * @returns IGetFriendListDataResponse + */ getFriendList(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handles client/chatServer/list + * @returns + */ getChatServerList(url: string, info: IGetChatServerListRequestData, sessionID: string): IGetBodyResponseData; getMailDialogList(url: string, info: IGetMailDialogListRequestData, sessionID: string): IGetBodyResponseData; getMailDialogView(url: string, info: IGetMailDialogViewRequestData, sessionID: string): IGetBodyResponseData; - getMailDialogInfo(url: string, info: IGetMailDialogInfoRequestData, sessionID: string): IGetBodyResponseData; + getMailDialogInfo(url: string, info: IGetMailDialogInfoRequestData, sessionID: string): IGetBodyResponseData; removeDialog(url: string, info: IRemoveDialogRequestData, sessionID: string): IGetBodyResponseData; pinDialog(url: string, info: IPinDialogRequestData, sessionID: string): IGetBodyResponseData; unpinDialog(url: string, info: IPinDialogRequestData, sessionID: string): IGetBodyResponseData; setRead(url: string, info: ISetDialogReadRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handles client/mail/dialog/getAllAttachments + * @returns IGetAllAttachmentsResponse + */ getAllAttachments(url: string, info: IGetAllAttachmentsRequestData, sessionID: string): IGetBodyResponseData; listOutbox(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; listInbox(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; diff --git a/TypeScript/14AfterDBLoadHook/types/callbacks/GameCallbacks.d.ts b/TypeScript/14AfterDBLoadHook/types/callbacks/GameCallbacks.d.ts index 5e4c240..3a6b7e6 100644 --- a/TypeScript/14AfterDBLoadHook/types/callbacks/GameCallbacks.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/callbacks/GameCallbacks.d.ts @@ -3,6 +3,9 @@ import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { ICheckVersionResponse } from "../models/eft/game/ICheckVersionResponse"; import { IGameConfigResponse } from "../models/eft/game/IGameConfigResponse"; import { IGameEmptyCrcRequestData } from "../models/eft/game/IGameEmptyCrcRequestData"; +import { IGameKeepAliveResponse } from "../models/eft/game/IGameKeepAliveResponse"; +import { IGameLogoutResponseData } from "../models/eft/game/IGameLogoutResponseData"; +import { IGameStartResponse } from "../models/eft/game/IGameStartResponse"; import { IReportNicknameRequestData } from "../models/eft/game/IReportNicknameRequestData"; import { IServerDetails } from "../models/eft/game/IServerDetails"; import { IVersionValidateRequestData } from "../models/eft/game/IVersionValidateRequestData"; @@ -15,13 +18,37 @@ declare class GameCallbacks { protected watermark: Watermark; protected gameController: GameController; constructor(httpResponse: HttpResponseUtil, watermark: Watermark, gameController: GameController); + /** + * Handle client/game/version/validate + * @returns INullResponseData + */ versionValidate(url: string, info: IVersionValidateRequestData, sessionID: string): INullResponseData; - gameStart(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - gameLogout(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/game/start + * @returns IGameStartResponse + */ + gameStart(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/game/logout + * @returns IGameLogoutResponseData + */ + gameLogout(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/game/config + * @returns IGameConfigResponse + */ getGameConfig(url: string, info: IGameEmptyCrcRequestData, sessionID: string): IGetBodyResponseData; getServer(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; validateGameVersion(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - gameKeepalive(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/game/keepalive + * @returns IGameKeepAliveResponse + */ + gameKeepalive(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle singleplayer/settings/version + * @returns string + */ getVersion(url: string, info: IEmptyRequestData, sessionID: string): string; reportNickname(url: string, info: IReportNicknameRequestData, sessionID: string): INullResponseData; } diff --git a/TypeScript/14AfterDBLoadHook/types/callbacks/HealthCallbacks.d.ts b/TypeScript/14AfterDBLoadHook/types/callbacks/HealthCallbacks.d.ts index 8672be7..7edf03e 100644 --- a/TypeScript/14AfterDBLoadHook/types/callbacks/HealthCallbacks.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/callbacks/HealthCallbacks.d.ts @@ -21,7 +21,19 @@ export declare class HealthCallbacks { * @returns empty response, no data sent back to client */ syncHealth(url: string, info: ISyncHealthRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle Eat + * @returns IItemEventRouterResponse + */ offraidEat(pmcData: IPmcData, body: IOffraidEatRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle Heal + * @returns IItemEventRouterResponse + */ offraidHeal(pmcData: IPmcData, body: IOffraidHealRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle RestoreHealth + * @returns IItemEventRouterResponse + */ healthTreatment(pmcData: IPmcData, info: IHealthTreatmentRequestData, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/14AfterDBLoadHook/types/callbacks/HideoutCallbacks.d.ts b/TypeScript/14AfterDBLoadHook/types/callbacks/HideoutCallbacks.d.ts index 99ab4c9..e39e806 100644 --- a/TypeScript/14AfterDBLoadHook/types/callbacks/HideoutCallbacks.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/callbacks/HideoutCallbacks.d.ts @@ -19,14 +19,77 @@ export declare class HideoutCallbacks extends OnUpdate { protected hideoutConfig: IHideoutConfig; constructor(hideoutController: HideoutController, // TODO: delay needed configServer: ConfigServer); + /** + * Handle HideoutUpgrade + * @param pmcData + * @param body + * @param sessionID + * @returns + */ upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutUpgradeComplete + * @param pmcData + * @param body + * @param sessionID + * @returns + */ upgradeComplete(pmcData: IPmcData, body: IHideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutPutItemsInAreaSlots + * @param pmcData + * @param body + * @param sessionID + * @returns + */ putItemsInAreaSlots(pmcData: IPmcData, body: IHideoutPutItemInRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutTakeItemsFromAreaSlots + * @param pmcData + * @param body + * @param sessionID + * @returns + */ takeItemsFromAreaSlots(pmcData: IPmcData, body: IHideoutTakeItemOutRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutToggleArea + * @param pmcData + * @param body + * @param sessionID + * @returns + */ toggleArea(pmcData: IPmcData, body: IHideoutToggleAreaRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutSingleProductionStart + * @param pmcData + * @param body + * @param sessionID + * @returns + */ singleProductionStart(pmcData: IPmcData, body: IHideoutSingleProductionStartRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutScavCaseProductionStart + * @param pmcData + * @param body + * @param sessionID + * @returns + */ scavCaseProductionStart(pmcData: IPmcData, body: IHideoutScavCaseStartRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutContinuousProductionStart + * @param pmcData + * @param body + * @param sessionID + * @returns + */ continuousProductionStart(pmcData: IPmcData, body: IHideoutContinousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutTakeProduction + * @param pmcData + * @param body + * @param sessionID + * @returns + */ takeProduction(pmcData: IPmcData, body: IHideoutTakeProductionRequestData, sessionID: string): IItemEventRouterResponse; onUpdate(timeSinceLastRun: number): boolean; getRoute(): string; diff --git a/TypeScript/14AfterDBLoadHook/types/callbacks/InraidCallbacks.d.ts b/TypeScript/14AfterDBLoadHook/types/callbacks/InraidCallbacks.d.ts index 05bcce4..918bfaf 100644 --- a/TypeScript/14AfterDBLoadHook/types/callbacks/InraidCallbacks.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/callbacks/InraidCallbacks.d.ts @@ -1,23 +1,49 @@ import { InraidController } from "../controllers/InraidController"; -import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { INullResponseData } from "../models/eft/httpResponse/INullResponseData"; import { IRegisterPlayerRequestData } from "../models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; -import { IAirdropConfig } from "../models/spt/config/IAirdropConfig"; -import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; -import { ConfigServer } from "../servers/ConfigServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +/** + * Handle client requests + */ export declare class InraidCallbacks { protected inraidController: InraidController; protected httpResponse: HttpResponseUtil; - protected configServer: ConfigServer; - protected airdropConfig: IAirdropConfig; - protected inraidConfig: IInRaidConfig; - constructor(inraidController: InraidController, httpResponse: HttpResponseUtil, configServer: ConfigServer); + constructor(inraidController: InraidController, httpResponse: HttpResponseUtil); + /** + * Handle client/location/getLocalloot + * @param url + * @param info register player request + * @param sessionID Session id + * @returns Null http response + */ registerPlayer(url: string, info: IRegisterPlayerRequestData, sessionID: string): INullResponseData; + /** + * Handle raid/profile/save + * @param url + * @param info Save progress request + * @param sessionID Session id + * @returns Null http response + */ saveProgress(url: string, info: ISaveProgressRequestData, sessionID: string): INullResponseData; + /** + * Handle singleplayer/settings/raid/endstate + * @returns + */ getRaidEndState(): string; - getRaidMenuSettings(url: string, info: IEmptyRequestData, sessionID: string): string; - getWeaponDurability(url: string, info: any, sessionID: string): string; - getAirdropConfig(url: string, info: any, sessionID: string): string; + /** + * Handle singleplayer/settings/raid/menu + * @returns JSON as string + */ + getRaidMenuSettings(): string; + /** + * Handle singleplayer/settings/weapon/durability + * @returns + */ + getWeaponDurability(): string; + /** + * Handle singleplayer/airdrop/config + * @returns JSON as string + */ + getAirdropConfig(): string; } diff --git a/TypeScript/14AfterDBLoadHook/types/callbacks/InsuranceCallbacks.d.ts b/TypeScript/14AfterDBLoadHook/types/callbacks/InsuranceCallbacks.d.ts index 8835ba2..a171e1c 100644 --- a/TypeScript/14AfterDBLoadHook/types/callbacks/InsuranceCallbacks.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/callbacks/InsuranceCallbacks.d.ts @@ -17,7 +17,15 @@ export declare class InsuranceCallbacks extends OnUpdate { protected configServer: ConfigServer; protected insuranceConfig: IInsuranceConfig; constructor(insuranceController: InsuranceController, insuranceService: InsuranceService, httpResponse: HttpResponseUtil, configServer: ConfigServer); + /** + * Handle client/insurance/items/list/cost + * @returns IGetInsuranceCostResponseData + */ getInsuranceCost(url: string, info: IGetInsuranceCostRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle Insure + * @returns IItemEventRouterResponse + */ insure(pmcData: IPmcData, body: IInsureRequestData, sessionID: string): IItemEventRouterResponse; onUpdate(secondsSinceLastRun: number): boolean; getRoute(): string; diff --git a/TypeScript/14AfterDBLoadHook/types/callbacks/InventoryCallbacks.d.ts b/TypeScript/14AfterDBLoadHook/types/callbacks/InventoryCallbacks.d.ts index 9ab1486..46bf6fd 100644 --- a/TypeScript/14AfterDBLoadHook/types/callbacks/InventoryCallbacks.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/callbacks/InventoryCallbacks.d.ts @@ -16,6 +16,7 @@ import { IInventorySwapRequestData } from "../models/eft/inventory/IInventorySwa import { IInventoryTagRequestData } from "../models/eft/inventory/IInventoryTagRequestData"; import { IInventoryToggleRequestData } from "../models/eft/inventory/IInventoryToggleRequestData"; import { IInventoryTransferRequestData } from "../models/eft/inventory/IInventoryTransferRequestData"; +import { IOpenRandomLootContainerRequestData } from "../models/eft/inventory/IOpenRandomLootContainerRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; export declare class InventoryCallbacks { protected inventoryController: InventoryController; @@ -36,4 +37,5 @@ export declare class InventoryCallbacks { createMapMarker(pmcData: IPmcData, body: IInventoryCreateMarkerRequestData, sessionID: string): IItemEventRouterResponse; deleteMapMarker(pmcData: IPmcData, body: IInventoryDeleteMarkerRequestData, sessionID: string): IItemEventRouterResponse; editMapMarker(pmcData: IPmcData, body: IInventoryEditMarkerRequestData, sessionID: string): IItemEventRouterResponse; + openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/14AfterDBLoadHook/types/callbacks/ItemEventCallbacks.d.ts b/TypeScript/14AfterDBLoadHook/types/callbacks/ItemEventCallbacks.d.ts index f4f04f9..fbb0b5f 100644 --- a/TypeScript/14AfterDBLoadHook/types/callbacks/ItemEventCallbacks.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/callbacks/ItemEventCallbacks.d.ts @@ -1,4 +1,5 @@ import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; +import { Warning } from "../models/eft/itemEvent/IItemEventRouterBase"; import { IItemEventRouterRequest } from "../models/eft/itemEvent/IItemEventRouterRequest"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { ItemEventRouter } from "../routers/ItemEventRouter"; @@ -8,4 +9,5 @@ export declare class ItemEventCallbacks { protected itemEventRouter: ItemEventRouter; constructor(httpResponse: HttpResponseUtil, itemEventRouter: ItemEventRouter); handleEvents(url: string, info: IItemEventRouterRequest, sessionID: string): IGetBodyResponseData; + protected getErrorCode(warnings: Warning[]): number; } diff --git a/TypeScript/14AfterDBLoadHook/types/callbacks/MatchCallbacks.d.ts b/TypeScript/14AfterDBLoadHook/types/callbacks/MatchCallbacks.d.ts index 2a92ef5..10fbc44 100644 --- a/TypeScript/14AfterDBLoadHook/types/callbacks/MatchCallbacks.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/callbacks/MatchCallbacks.d.ts @@ -34,6 +34,10 @@ export declare class MatchCallbacks { serverAvailable(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData | IGetBodyResponseData; joinMatch(url: string, info: IJoinMatchRequestData, sessionID: string): IGetBodyResponseData; getMetrics(url: string, info: any, sessionID: string): IGetBodyResponseData; + /** + * Handle client/match/group/status + * @returns + */ getGroupStatus(url: string, info: IGetGroupStatusRequestData, sessionID: string): IGetBodyResponseData; createGroup(url: string, info: ICreateGroupRequestData, sessionID: string): IGetBodyResponseData; deleteGroup(url: string, info: any, sessionID: string): INullResponseData; diff --git a/TypeScript/14AfterDBLoadHook/types/callbacks/NotifierCallbacks.d.ts b/TypeScript/14AfterDBLoadHook/types/callbacks/NotifierCallbacks.d.ts index c42058f..fab325b 100644 --- a/TypeScript/14AfterDBLoadHook/types/callbacks/NotifierCallbacks.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/callbacks/NotifierCallbacks.d.ts @@ -4,6 +4,7 @@ import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { INotifierChannel } from "../models/eft/notifier/INotifier"; import { ISelectProfileRequestData } from "../models/eft/notifier/ISelectProfileRequestData"; +import { ISelectProfileResponse } from "../models/eft/notifier/ISelectProfileResponse"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; export declare class NotifierCallbacks { protected httpServerHelper: HttpServerHelper; @@ -19,6 +20,10 @@ export declare class NotifierCallbacks { sendNotification(sessionID: string, req: any, resp: any, data: any): void; getNotifier(url: string, info: any, sessionID: string): IGetBodyResponseData; createNotifierChannel(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - selectProfile(url: string, info: ISelectProfileRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/game/profile/select + * @returns ISelectProfileResponse + */ + selectProfile(url: string, info: ISelectProfileRequestData, sessionID: string): IGetBodyResponseData; notify(url: string, info: any, sessionID: string): string; } diff --git a/TypeScript/14AfterDBLoadHook/types/callbacks/QuestCallbacks.d.ts b/TypeScript/14AfterDBLoadHook/types/callbacks/QuestCallbacks.d.ts index 559c29e..2a3eb20 100644 --- a/TypeScript/14AfterDBLoadHook/types/callbacks/QuestCallbacks.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/callbacks/QuestCallbacks.d.ts @@ -21,6 +21,13 @@ export declare class QuestCallbacks { acceptQuest(pmcData: IPmcData, body: IAcceptQuestRequestData, sessionID: string): IItemEventRouterResponse; completeQuest(pmcData: IPmcData, body: ICompleteQuestRequestData, sessionID: string): IItemEventRouterResponse; handoverQuest(pmcData: IPmcData, body: IHandoverQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle client/quest/list + * @param url + * @param info + * @param sessionID + * @returns + */ listQuests(url: string, info: IListQuestsRequestData, sessionID: string): IGetBodyResponseData; activityPeriods(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; } diff --git a/TypeScript/14AfterDBLoadHook/types/callbacks/RagfairCallbacks.d.ts b/TypeScript/14AfterDBLoadHook/types/callbacks/RagfairCallbacks.d.ts index c609f2f..37f3807 100644 --- a/TypeScript/14AfterDBLoadHook/types/callbacks/RagfairCallbacks.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/callbacks/RagfairCallbacks.d.ts @@ -35,7 +35,7 @@ export declare class RagfairCallbacks extends OnLoadOnUpdate { getRoute(): string; search(url: string, info: ISearchRequestData, sessionID: string): IGetBodyResponseData; getMarketPrice(url: string, info: IGetMarketPriceRequestData, sessionID: string): IGetBodyResponseData; - getItemPrices(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + getItemPrices(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData>; addOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; removeOffer(pmcData: IPmcData, info: IRemoveOfferRequestData, sessionID: string): IItemEventRouterResponse; extendOffer(pmcData: IPmcData, info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; diff --git a/TypeScript/14AfterDBLoadHook/types/callbacks/TraderCallbacks.d.ts b/TypeScript/14AfterDBLoadHook/types/callbacks/TraderCallbacks.d.ts index e4fd099..40a1455 100644 --- a/TypeScript/14AfterDBLoadHook/types/callbacks/TraderCallbacks.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/callbacks/TraderCallbacks.d.ts @@ -12,6 +12,10 @@ export declare class TraderCallbacks extends OnLoadOnUpdate { onUpdate(): boolean; getRoute(): string; getTraderSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/trading/api/getUserAssortPrice/trader + * @returns + */ getProfilePurchases(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData>; getTrader(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getAssort(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; diff --git a/TypeScript/14AfterDBLoadHook/types/callbacks/WeatherCallbacks.d.ts b/TypeScript/14AfterDBLoadHook/types/callbacks/WeatherCallbacks.d.ts index ae784c8..f9d2002 100644 --- a/TypeScript/14AfterDBLoadHook/types/callbacks/WeatherCallbacks.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/callbacks/WeatherCallbacks.d.ts @@ -1,10 +1,15 @@ import { WeatherController } from "../controllers/WeatherController"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; +import { IWeatherData } from "../models/eft/weather/IWeatherData"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; export declare class WeatherCallbacks { protected httpResponse: HttpResponseUtil; protected weatherController: WeatherController; constructor(httpResponse: HttpResponseUtil, weatherController: WeatherController); - getWeather(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/weather + * @returns IWeatherData + */ + getWeather(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; } diff --git a/TypeScript/14AfterDBLoadHook/types/context/ContextVariableType.d.ts b/TypeScript/14AfterDBLoadHook/types/context/ContextVariableType.d.ts index 5fc1704..a7dd9b5 100644 --- a/TypeScript/14AfterDBLoadHook/types/context/ContextVariableType.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/context/ContextVariableType.d.ts @@ -1,4 +1,8 @@ export declare enum ContextVariableType { + /** Logged in users session id */ SESSION_ID = 0, - MATCH_INFO = 1 + /** Currently acive raid information */ + MATCH_INFO = 1, + /** Timestamp when client first connected */ + CLIENT_START_TIMESTAMP = 2 } diff --git a/TypeScript/14AfterDBLoadHook/types/controllers/BotController.d.ts b/TypeScript/14AfterDBLoadHook/types/controllers/BotController.d.ts index a5111d5..92317c3 100644 --- a/TypeScript/14AfterDBLoadHook/types/controllers/BotController.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/controllers/BotController.d.ts @@ -1,6 +1,8 @@ import { ApplicationContext } from "../context/ApplicationContext"; import { BotGenerator } from "../generators/BotGenerator"; +import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { IGenerateBotsRequestData } from "../models/eft/bot/IGenerateBotsRequestData"; import { IBotBase } from "../models/eft/common/tables/IBotBase"; import { IBotCore } from "../models/eft/common/tables/IBotCore"; @@ -10,18 +12,23 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; -import { PmcAiService } from "../services/PmcAiService"; +import { LocalisationService } from "../services/LocalisationService"; +import { JsonUtil } from "../utils/JsonUtil"; export declare class BotController { protected logger: ILogger; protected databaseServer: DatabaseServer; protected botGenerator: BotGenerator; protected botHelper: BotHelper; - protected pmcAiService: PmcAiService; + protected botDifficultyHelper: BotDifficultyHelper; protected botGenerationCacheService: BotGenerationCacheService; + protected localisationService: LocalisationService; + protected weightedRandomHelper: WeightedRandomHelper; protected configServer: ConfigServer; protected applicationContext: ApplicationContext; + protected jsonUtil: JsonUtil; protected botConfig: IBotConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, pmcAiService: PmcAiService, botGenerationCacheService: BotGenerationCacheService, configServer: ConfigServer, applicationContext: ApplicationContext); + static readonly pmcTypeLabel = "PMC"; + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); /** * Return the number of bot loadout varieties to be generated * @param type bot Type we want the loadout gen count for @@ -37,7 +44,6 @@ export declare class BotController { * @returns Difficulty object */ getBotDifficulty(type: string, difficulty: string): Difficulty; - protected getPmcDifficultySettings(pmcType: "bear" | "usec", difficulty: string, usecType: string, bearType: string): Difficulty; /** * Generate bot profiles and store in cache * @param sessionId Session id @@ -51,4 +57,5 @@ export declare class BotController { * @returns cap number */ getBotCap(): number; + getPmcBotTypes(): Record>>; } diff --git a/TypeScript/14AfterDBLoadHook/types/controllers/DialogueController.d.ts b/TypeScript/14AfterDBLoadHook/types/controllers/DialogueController.d.ts index 1b72522..9c8b728 100644 --- a/TypeScript/14AfterDBLoadHook/types/controllers/DialogueController.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/controllers/DialogueController.d.ts @@ -23,7 +23,7 @@ export declare class DialogueController { * Get the content of a dialogue * @param dialogueID Dialog id * @param sessionID Session Id - * @returns + * @returns DialogueInfo */ getDialogueInfo(dialogueID: string, sessionID: string): DialogueInfo; /** diff --git a/TypeScript/14AfterDBLoadHook/types/controllers/GameController.d.ts b/TypeScript/14AfterDBLoadHook/types/controllers/GameController.d.ts index 3bfbdb1..f4f5849 100644 --- a/TypeScript/14AfterDBLoadHook/types/controllers/GameController.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/controllers/GameController.d.ts @@ -1,3 +1,4 @@ +import { ApplicationContext } from "../context/ApplicationContext"; import { GameEventHelper } from "../helpers/GameEventHelper"; import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; @@ -14,6 +15,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; +import { LocalisationService } from "../services/LocalisationService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { Watermark } from "../utils/Watermark"; export declare class GameController { @@ -24,14 +26,33 @@ export declare class GameController { protected localeService: LocaleService; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; + protected localisationService: LocalisationService; protected gameEventHelper: GameEventHelper; + protected applicationContext: ApplicationContext; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; protected coreConfig: ICoreConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, gameEventHelper: GameEventHelper, configServer: ConfigServer); - gameStart(_url: string, _info: IEmptyRequestData, sessionID: string): void; + constructor(logger: ILogger, databaseServer: DatabaseServer, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, gameEventHelper: GameEventHelper, applicationContext: ApplicationContext, configServer: ConfigServer); + gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; + /** + * Check if current date falls inside any of the seasons events pased in, if so, handle them + * @param seasonalEvents events to check for + */ protected checkForAndEnableSeasonalEvents(seasonalEvents: ISeasonalEvent[]): void; + /** + * Make adjusted to server code based on the name of the event passed in + * @param globalConfig globals.json + * @param eventName Name of the event to enable. e.g. Christmas + */ protected updateGlobalEvents(globalConfig: Config, eventName: string): void; + /** + * Read in data from seasonalEvents.json and add found equipment items to bots + * @param eventName Name of the event to read equipment in from config + */ + protected addEventGearToScavs(eventName: string): void; + /** + * Set Khorovod(dancing tree) chance to 100% on all maps that support it + */ protected enableDancingTree(): void; /** * Make non-trigger-spawned raiders spawn earlier + always @@ -40,5 +61,6 @@ export declare class GameController { protected logProfileDetails(fullProfile: IAkiProfile): void; getGameConfig(sessionID: string): IGameConfigResponse; getServer(): IServerDetails[]; + protected addPumpkinsToScavBackpacks(): void; getValidGameVersion(): ICheckVersionResponse; } diff --git a/TypeScript/14AfterDBLoadHook/types/controllers/HideoutController.d.ts b/TypeScript/14AfterDBLoadHook/types/controllers/HideoutController.d.ts index ada5bd9..5b6507b 100644 --- a/TypeScript/14AfterDBLoadHook/types/controllers/HideoutController.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/controllers/HideoutController.d.ts @@ -23,12 +23,13 @@ import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; import { PlayerService } from "../services/PlayerService"; import { HashUtil } from "../utils/HashUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; -import { JsonUtil } from "../utils/JsonUtil"; export declare class HideoutController { protected logger: ILogger; protected hashUtil: HashUtil; @@ -45,11 +46,12 @@ export declare class HideoutController { protected profileHelper: ProfileHelper; protected hideoutHelper: HideoutHelper; protected scavCaseRewardGenerator: ScavCaseRewardGenerator; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected jsonUtil: JsonUtil; protected static nameBackendCountersCrafting: string; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, configServer: ConfigServer, jsonUtil: JsonUtil); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, localisationService: LocalisationService, configServer: ConfigServer, jsonUtil: JsonUtil); upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; upgradeComplete(pmcData: IPmcData, body: HideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; /** diff --git a/TypeScript/14AfterDBLoadHook/types/controllers/InraidController.d.ts b/TypeScript/14AfterDBLoadHook/types/controllers/InraidController.d.ts index e84eea1..39a6396 100644 --- a/TypeScript/14AfterDBLoadHook/types/controllers/InraidController.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/controllers/InraidController.d.ts @@ -6,6 +6,7 @@ import { ProfileHelper } from "../helpers/ProfileHelper"; import { QuestHelper } from "../helpers/QuestHelper"; import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; +import { Item } from "../models/eft/common/tables/IItem"; import { IRegisterPlayerRequestData } from "../models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; import { IAirdropConfig } from "../models/spt/config/IAirdropConfig"; @@ -17,6 +18,9 @@ import { SaveServer } from "../servers/SaveServer"; import { InsuranceService } from "../services/InsuranceService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; +/** + * Logic for handling In Raid callbacks + */ export declare class InraidController { protected logger: ILogger; protected saveServer: SaveServer; @@ -35,14 +39,42 @@ export declare class InraidController { protected airdropConfig: IAirdropConfig; protected inraidConfig: IInRaidConfig; 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 + * Save locationid to active profiles inraid object + * @param sessionID Session id + * @param info Register player request + */ + addPlayer(sessionID: string, info: IRegisterPlayerRequestData): void; + /** + * Save profile state to disk + * Handles pmc/pscav + * @param offraidData post-raid request data + * @param sessionID Session id + */ + savePostRaidProgress(offraidData: ISaveProgressRequestData, sessionID: string): void; + /** + * Handle updating player profile post-pmc raid * @param sessionID session id - * @param offraidData post-raid data of raid + * @param offraidData post-raid data */ protected savePmcProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; + /** + * Make changes to pmc profile after they left raid dead, + * alter bodypart hp, handle insurance, delete inventory items, remove carried quest items + * @param postRaidSaveRequest post-raid save request + * @param pmcData pmc profile + * @param insuranceEnabled is insurance enabled + * @param preRaidGear gear player had before raid + * @param sessionID Session id + * @returns Updated profile object + */ + protected performPostRaidActionsWhenDead(postRaidSaveRequest: ISaveProgressRequestData, pmcData: IPmcData, insuranceEnabled: boolean, preRaidGear: Item[], sessionID: string): IPmcData; + /** + * Adjust player characters bodypart hp if they left raid early + * @param postRaidSaveRequest post raid data + * @param pmcData player profile + */ + protected updatePmcHealthPostRaid(postRaidSaveRequest: ISaveProgressRequestData, pmcData: IPmcData): void; /** * Reduce body part hp to % of max * @param pmcData profile to edit @@ -68,7 +100,31 @@ export declare class InraidController { * @param isPlayerScav Was the player a pScav */ protected markOrRemoveFoundInRaidItems(offraidData: ISaveProgressRequestData, pmcData: IPmcData, isPlayerScav: boolean): void; + /** + * Update profile after player completes scav raid + * @param scavData Scav profile + * @param sessionID Session id + * @param offraidData Post-raid save request + * @param pmcData Pmc profile + * @param isDead Is player dead + */ protected handlePostRaidPlayerScavProcess(scavData: IPmcData, sessionID: string, offraidData: ISaveProgressRequestData, pmcData: IPmcData, isDead: boolean): void; + /** + * Update profile with scav karma values based on in-raid actions + * @param pmcData Pmc profile + * @param offraidData Post-raid save request + * @param scavData Scav profile + * @param sessionID Session id + */ protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData, scavData: IPmcData, sessionID: string): void; + /** + * Get the inraid config from configs/inraid.json + * @returns InRaid Config + */ + getInraidConfig(): IInRaidConfig; + /** + * Get airdrop config from configs/airdrop.json + * @returns Airdrop config + */ getAirdropConfig(): IAirdropConfig; } diff --git a/TypeScript/14AfterDBLoadHook/types/controllers/InsuranceController.d.ts b/TypeScript/14AfterDBLoadHook/types/controllers/InsuranceController.d.ts index 14bf129..54f31b5 100644 --- a/TypeScript/14AfterDBLoadHook/types/controllers/InsuranceController.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/controllers/InsuranceController.d.ts @@ -30,8 +30,7 @@ export declare class InsuranceController { protected insuranceService: InsuranceService; protected configServer: ConfigServer; protected insuranceConfig: IInsuranceConfig; - constructor(logger: ILogger, randomUtil: RandomUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, paymentService: PaymentService, // TODO: delay required - insuranceService: InsuranceService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, paymentService: PaymentService, insuranceService: InsuranceService, configServer: ConfigServer); processReturn(): void; insure(pmcData: IPmcData, body: IInsureRequestData, sessionID: string): IItemEventRouterResponse; /** diff --git a/TypeScript/14AfterDBLoadHook/types/controllers/InventoryController.d.ts b/TypeScript/14AfterDBLoadHook/types/controllers/InventoryController.d.ts index 6a1a21e..e1c08c0 100644 --- a/TypeScript/14AfterDBLoadHook/types/controllers/InventoryController.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/controllers/InventoryController.d.ts @@ -1,8 +1,8 @@ -import { EventOutputHolder } from "../routers/EventOutputHolder"; import { InventoryHelper } from "../helpers/InventoryHelper"; import { PaymentHelper } from "../helpers/PaymentHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IAddItemRequestData } from "../models/eft/inventory/IAddItemRequestData"; import { IInventoryBindRequestData } from "../models/eft/inventory/IInventoryBindRequestData"; @@ -21,33 +21,46 @@ import { IInventorySwapRequestData } from "../models/eft/inventory/IInventorySwa import { IInventoryTagRequestData } from "../models/eft/inventory/IInventoryTagRequestData"; import { IInventoryToggleRequestData } from "../models/eft/inventory/IInventoryToggleRequestData"; import { IInventoryTransferRequestData } from "../models/eft/inventory/IInventoryTransferRequestData"; +import { IOpenRandomLootContainerRequestData } from "../models/eft/inventory/IOpenRandomLootContainerRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { ILogger } from "../models/spt/utils/ILogger"; +import { EventOutputHolder } from "../routers/EventOutputHolder"; import { DatabaseServer } from "../servers/DatabaseServer"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { HashUtil } from "../utils/HashUtil"; +import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { JsonUtil } from "../utils/JsonUtil"; +import { RandomUtil } from "../utils/RandomUtil"; export declare class InventoryController { protected logger: ILogger; protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; + protected randomUtil: RandomUtil; protected databaseServer: DatabaseServer; protected fenceService: FenceService; protected presetHelper: PresetHelper; protected inventoryHelper: InventoryHelper; protected ragfairOfferService: RagfairOfferService; protected profileHelper: ProfileHelper; + protected weightedRandomHelper: WeightedRandomHelper; protected paymentHelper: PaymentHelper; + protected localisationService: LocalisationService; protected eventOutputHolder: EventOutputHolder; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder); + protected httpResponseUtil: HttpResponseUtil; + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, weightedRandomHelper: WeightedRandomHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); /** * Move Item * change location of item with parentId and slotId * transfers items from one profile to another if fromOwner/toOwner is set in the body. * otherwise, move is contained within the same profile_f. - */ - moveItem(pmcData: IPmcData, body: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; + * @param pmcData Profile + * @param moveRequest Move request data + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ + moveItem(pmcData: IPmcData, moveRequest: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; /** * Remove Item from Profile * Deep tree item deletion, also removes items from insurance list @@ -122,4 +135,12 @@ export declare class InventoryController { createMapMarker(pmcData: IPmcData, body: IInventoryCreateMarkerRequestData, sessionID: string): IItemEventRouterResponse; deleteMapMarker(pmcData: IPmcData, body: IInventoryDeleteMarkerRequestData, sessionID: string): IItemEventRouterResponse; editMapMarker(pmcData: IPmcData, body: IInventoryEditMarkerRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle event fired when a container is unpacked (currently only the halloween pumpkin) + * @param pmcData Profile data + * @param body open loot container request data + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ + openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/14AfterDBLoadHook/types/controllers/LocationController.d.ts b/TypeScript/14AfterDBLoadHook/types/controllers/LocationController.d.ts index 9db3205..b6feba8 100644 --- a/TypeScript/14AfterDBLoadHook/types/controllers/LocationController.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/controllers/LocationController.d.ts @@ -7,6 +7,7 @@ import { LootItem } from "../models/spt/services/LootItem"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -15,12 +16,13 @@ export declare class LocationController { protected hashUtil: HashUtil; protected logger: ILogger; protected locationGenerator: LocationGenerator; + protected localisationService: LocalisationService; protected lootGenerator: LootGenerator; protected databaseServer: DatabaseServer; protected timeUtil: TimeUtil; protected configServer: ConfigServer; protected airdropConfig: IAirdropConfig; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, logger: ILogger, locationGenerator: LocationGenerator, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer); + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer); get(location: string): ILocationBase; generate(name: string): ILocationBase; generateAll(): ILocationsGenerateAllResponse; diff --git a/TypeScript/14AfterDBLoadHook/types/controllers/MatchController.d.ts b/TypeScript/14AfterDBLoadHook/types/controllers/MatchController.d.ts index dac6a3f..2b0d150 100644 --- a/TypeScript/14AfterDBLoadHook/types/controllers/MatchController.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/controllers/MatchController.d.ts @@ -19,7 +19,6 @@ import { SaveServer } from "../servers/SaveServer"; import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; import { BotLootCacheService } from "../services/BotLootCacheService"; import { MatchLocationService } from "../services/MatchLocationService"; -import { PmcAiService } from "../services/PmcAiService"; import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; export declare class MatchController { protected logger: ILogger; @@ -30,13 +29,12 @@ export declare class MatchController { protected botLootCacheService: BotLootCacheService; protected configServer: ConfigServer; protected profileSnapshotService: ProfileSnapshotService; - protected pmcAiService: PmcAiService; protected botGenerationCacheService: BotGenerationCacheService; 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, pmcAiService: PmcAiService, botGenerationCacheService: BotGenerationCacheService, applicationContext: ApplicationContext); + constructor(logger: ILogger, saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, botGenerationCacheService: BotGenerationCacheService, applicationContext: ApplicationContext); getEnabled(): boolean; getProfile(info: IGetProfileRequestData): IPmcData[]; createGroup(sessionID: string, info: ICreateGroupRequestData): any; diff --git a/TypeScript/14AfterDBLoadHook/types/controllers/RagfairController.d.ts b/TypeScript/14AfterDBLoadHook/types/controllers/RagfairController.d.ts index 5440458..95702f2 100644 --- a/TypeScript/14AfterDBLoadHook/types/controllers/RagfairController.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/controllers/RagfairController.d.ts @@ -29,6 +29,7 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { RagfairServer } from "../servers/RagfairServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; import { PaymentService } from "../services/PaymentService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { RagfairPriceService } from "../services/RagfairPriceService"; @@ -62,9 +63,10 @@ export declare class RagfairController { protected ragfairOfferService: RagfairOfferService; protected ragfairRequiredItemsService: RagfairRequiredItemsService; protected ragfairOfferGenerator: RagfairOfferGenerator; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, eventOutputHolder: EventOutputHolder, ragfairServer: RagfairServer, ragfairPriceService: RagfairPriceService, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer, ragfairSellHelper: RagfairSellHelper, ragfairTaxHelper: RagfairTaxHelper, ragfairSortHelper: RagfairSortHelper, ragfairOfferHelper: RagfairOfferHelper, profileHelper: ProfileHelper, paymentService: PaymentService, handbookHelper: HandbookHelper, paymentHelper: PaymentHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, ragfairOfferGenerator: RagfairOfferGenerator, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, eventOutputHolder: EventOutputHolder, ragfairServer: RagfairServer, ragfairPriceService: RagfairPriceService, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer, ragfairSellHelper: RagfairSellHelper, ragfairTaxHelper: RagfairTaxHelper, ragfairSortHelper: RagfairSortHelper, ragfairOfferHelper: RagfairOfferHelper, profileHelper: ProfileHelper, paymentService: PaymentService, handbookHelper: HandbookHelper, paymentHelper: PaymentHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, ragfairOfferGenerator: RagfairOfferGenerator, localisationService: LocalisationService, configServer: ConfigServer); getOffers(sessionID: string, info: ISearchRequestData): IGetOffersResult; /** * Get offers for the client based on type of search being performed @@ -103,7 +105,12 @@ export declare class RagfairController { protected isLinkedSearch(info: ISearchRequestData): boolean; protected isRequiredSearch(info: ISearchRequestData): boolean; update(): void; - getItemPrice(info: IGetMarketPriceRequestData): IGetItemPriceResult; + /** + * Called when creating an offer on flea, fills values in top right corner + * @param getPriceRequest + * @returns min/avg/max values for an item based on flea offers available + */ + getItemMinAvgMaxFleaPriceValues(getPriceRequest: IGetMarketPriceRequestData): IGetItemPriceResult; addPlayerOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; createPlayerOffer(profile: IAkiProfile, requirements: Requirement[], items: Item[], sellInOnePiece: boolean, amountToSend: number): IRagfairOffer; getAllFleaPrices(): Record; diff --git a/TypeScript/14AfterDBLoadHook/types/controllers/RepeatableQuestController.d.ts b/TypeScript/14AfterDBLoadHook/types/controllers/RepeatableQuestController.d.ts index 7db5886..333583b 100644 --- a/TypeScript/14AfterDBLoadHook/types/controllers/RepeatableQuestController.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/controllers/RepeatableQuestController.d.ts @@ -17,6 +17,7 @@ import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { ItemFilterService } from "../services/ItemFilterService"; +import { LocalisationService } from "../services/LocalisationService"; import { PaymentService } from "../services/PaymentService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { JsonUtil } from "../utils/JsonUtil"; @@ -64,12 +65,13 @@ export declare class RepeatableQuestController { protected profileFixerService: ProfileFixerService; protected ragfairServerHelper: RagfairServerHelper; protected eventOutputHolder: EventOutputHolder; + protected localisationService: LocalisationService; protected paymentService: PaymentService; protected objectId: ObjectId; protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * This is the method reached by the /client/repeatalbeQuests/activityPeriods endpoint * Returns an array of objects in the format of repeatable quests to the client. diff --git a/TypeScript/14AfterDBLoadHook/types/controllers/WeatherController.d.ts b/TypeScript/14AfterDBLoadHook/types/controllers/WeatherController.d.ts index ca7f5eb..631a90c 100644 --- a/TypeScript/14AfterDBLoadHook/types/controllers/WeatherController.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/controllers/WeatherController.d.ts @@ -1,11 +1,18 @@ import { WeatherGenerator } from "../generators/WeatherGenerator"; import { IWeatherData } from "../models/eft/weather/IWeatherData"; import { IWeatherConfig } from "../models/spt/config/IWeatherConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; export declare class WeatherController { protected weatherGenerator: WeatherGenerator; + protected logger: ILogger; protected configServer: ConfigServer; protected weatherConfig: IWeatherConfig; - constructor(weatherGenerator: WeatherGenerator, configServer: ConfigServer); + constructor(weatherGenerator: WeatherGenerator, logger: ILogger, configServer: ConfigServer); generate(): IWeatherData; + /** + * Get the current in-raid time (MUST HAVE PLAYER LOGGED INTO CLIENT TO WORK) + * @returns Date object + */ + getCurrentInRaidTime(): Date; } diff --git a/TypeScript/14AfterDBLoadHook/types/generators/BotGenerator.d.ts b/TypeScript/14AfterDBLoadHook/types/generators/BotGenerator.d.ts index 2ac51db..a1ac9ed 100644 --- a/TypeScript/14AfterDBLoadHook/types/generators/BotGenerator.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/generators/BotGenerator.d.ts @@ -1,7 +1,8 @@ +import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; import { GameEventHelper } from "../helpers/GameEventHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; -import { IGenerateBotsRequestData } from "../models/eft/bot/IGenerateBotsRequestData"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { Health as PmcHealth, IBotBase, Skills } from "../models/eft/common/tables/IBotBase"; import { Health, IBotType, Inventory } from "../models/eft/common/tables/IBotType"; import { IBotConfig } from "../models/spt/config/IBotConfig"; @@ -9,7 +10,6 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; -import { PmcAiService } from "../services/PmcAiService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; @@ -29,12 +29,13 @@ export declare class BotGenerator { protected databaseServer: DatabaseServer; protected botInventoryGenerator: BotInventoryGenerator; protected botEquipmentFilterService: BotEquipmentFilterService; + protected weightedRandomHelper: WeightedRandomHelper; protected botHelper: BotHelper; + protected botDifficultyHelper: BotDifficultyHelper; protected gameEventHelper: GameEventHelper; - protected pmcAiService: PmcAiService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botEquipmentFilterService: BotEquipmentFilterService, botHelper: BotHelper, gameEventHelper: GameEventHelper, pmcAiService: PmcAiService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botEquipmentFilterService: BotEquipmentFilterService, weightedRandomHelper: WeightedRandomHelper, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, gameEventHelper: GameEventHelper, configServer: ConfigServer); /** * Generate a player scav bot object * @param role e.g. assault / pmcbot @@ -44,12 +45,18 @@ export declare class BotGenerator { */ generatePlayerScav(sessionId: string, role: string, difficulty: string, botTemplate: IBotType): IBotBase; /** - * Generate an array of bot objects for populate a raid with + * Generate an array of bot objects based on a condition for a raid with * @param sessionId session id - * @param info request object + * @param condition request condition * @returns bot array */ - generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; + generateByCondition(sessionId: string, botCountToGenerate: number, difficulty: string, role: string, isPmc: boolean): IBotBase[]; + /** + * Get the PMCs wildSpawnType value + * @param role "usec" / "bear" + * @returns wildSpawnType value as string + */ + protected getPmcRoleByDescription(role: string): string; /** * Get a randomised PMC side based on bot config value 'isUsec' * @returns pmc side as string @@ -64,13 +71,13 @@ export declare class BotGenerator { * Create a IBotBase object with equipment/loot/exp etc * @param sessionId Session id * @param bot bots base file - * @param role botRole bot will use + * @param botRole Role bot will use (bear/usec for PMCs) * @param node Bot template from db/bots/x.json * @param isPmc Is bot to be a PMC * @param isPlayerScav is bot to be a p scav bot * @returns IBotBase object */ - protected generateBot(sessionId: string, bot: IBotBase, role: string, node: IBotType, isPmc: boolean, isPlayerScav?: boolean): IBotBase; + protected generateBot(sessionId: string, bot: IBotBase, botRole: string, node: IBotType, isPmc: boolean, isPlayerScav?: boolean): IBotBase; /** * Log the number of PMCs generated to the debug console * @param output Generated bot array, ready to send to client diff --git a/TypeScript/14AfterDBLoadHook/types/generators/BotInventoryGenerator.d.ts b/TypeScript/14AfterDBLoadHook/types/generators/BotInventoryGenerator.d.ts index c5ed545..e1efaf2 100644 --- a/TypeScript/14AfterDBLoadHook/types/generators/BotInventoryGenerator.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/generators/BotInventoryGenerator.d.ts @@ -7,6 +7,7 @@ import { IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { BotLootGenerator } from "./BotLootGenerator"; @@ -20,14 +21,68 @@ export declare class BotInventoryGenerator { protected botLootGenerator: BotLootGenerator; protected botGeneratorHelper: BotGeneratorHelper; protected weightedRandomHelper: WeightedRandomHelper; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, configServer: ConfigServer); + /** + * Add equipment/weapons/loot to bot + * @param sessionId Session id + * @param templateInventory bot/x.json data from db + * @param equipmentChances Chances each item will be added to bot + * @param itemGenerationLimitsMinMax item gen limits for bot role + * @param botRole Role bot has (assault/pmcBot) + * @param isPmc Is bot being converted into a pmc + * @returns PmcInventory object with equipment/weapons/loot + */ generateInventory(sessionId: string, templateInventory: Inventory, equipmentChances: Chances, itemGenerationLimitsMinMax: Generation, botRole: string, isPmc: boolean): PmcInventory; + /** + * Create a pmcInventory object with all the base/generic items needed + * @returns PmcInventory object + */ + protected generateInventoryBase(): PmcInventory; + /** + * Add equipment to a bot + * @param templateInventory bot/x.json data from db + * @param equipmentChances Chances items will be added to bot + * @param botRole Role bot has (assault/pmcBot) + * @param botInventory Inventory to add equipment to + */ + protected generateAndAddEquipmentToBot(templateInventory: Inventory, equipmentChances: Chances, botRole: string, botInventory: PmcInventory): void; + protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory): void; + /** + * Work out what weapons bot should have equipped and add them to bot inventory + * @param templateInventory bot/x.json data from db + * @param equipmentChances Chances bot can have equipment equipped + * @param sessionId Session id + * @param botInventory Inventory to add weapons to + * @param botRole assault/pmcBot/bossTagilla etc + * @param isPmc Is the bot being generated as a pmc + * @param itemGenerationLimitsMinMax Limits for items the bot can have + */ + protected generateAndAddWeaponsToBot(templateInventory: Inventory, equipmentChances: Chances, sessionId: string, botInventory: PmcInventory, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation): void; + /** + * Calculate if the bot should have weapons in Primary/Secondary/Holster slots + * @param equipmentChances Chances bot has certain equipment + * @returns What slots bot should have weapons generated for + */ + protected getDesiredWeaponsForBot(equipmentChances: Chances): { + slot: EquipmentSlots; + shouldSpawn: boolean; + }[]; + /** + * Add weapon + spare mags/ammo to bots inventory + * @param sessionId Session id + * @param weaponSlot Weapon slot being generated + * @param templateInventory bot/x.json data from db + * @param botInventory Inventory to add weapon+mags/ammo to + * @param equipmentChances Chances bot can have equipment equipped + * @param botRole assault/pmcBot/bossTagilla etc + * @param isPmc Is the bot being generated as a pmc + * @param itemGenerationLimitsMinMax + */ protected addWeaponAndMagazinesToInventory(sessionId: string, weaponSlot: { slot: EquipmentSlots; shouldSpawn: boolean; }, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation): void; - protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory): void; - protected generateInventoryBase(): PmcInventory; } diff --git a/TypeScript/14AfterDBLoadHook/types/generators/BotLootGenerator.d.ts b/TypeScript/14AfterDBLoadHook/types/generators/BotLootGenerator.d.ts index c1f5310..3352a46 100644 --- a/TypeScript/14AfterDBLoadHook/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/generators/BotLootGenerator.d.ts @@ -10,6 +10,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotLootCacheService } from "../services/BotLootCacheService"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { BotWeaponGenerator } from "./BotWeaponGenerator"; @@ -23,9 +24,10 @@ export declare class BotLootGenerator { protected botWeaponGenerator: BotWeaponGenerator; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected botLootCacheService: BotLootCacheService; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, configServer: ConfigServer); generateLoot(sessionId: string, templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances): void; protected getRandomisedCount(min: number, max: number, nValue: number): number; /** @@ -113,7 +115,7 @@ export declare class BotLootGenerator { * If no limit found for a non pmc bot, fall back to defaults * @param isPmc is the bot we want limits for a pmc * @param botRole what role does the bot have - * @returns dictionary of tplIds and limit + * @returns Dictionary of tplIds and limit */ protected getItemSpawnLimitsForBotType(isPmc: boolean, botRole: string): Record; /** diff --git a/TypeScript/14AfterDBLoadHook/types/generators/BotWeaponGenerator.d.ts b/TypeScript/14AfterDBLoadHook/types/generators/BotWeaponGenerator.d.ts index 487901b..40284ea 100644 --- a/TypeScript/14AfterDBLoadHook/types/generators/BotWeaponGenerator.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/generators/BotWeaponGenerator.d.ts @@ -12,6 +12,7 @@ import { IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; @@ -27,10 +28,11 @@ export declare class BotWeaponGenerator { protected randomUtil: RandomUtil; protected configServer: ConfigServer; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected localisationService: LocalisationService; protected inventoryMagGenComponents: IInventoryMagGen[]; protected readonly modMagazineSlotId = "mod_magazine"; protected botConfig: IBotConfig; - constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil, configServer: ConfigServer, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, inventoryMagGenComponents: IInventoryMagGen[]); + constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil, configServer: ConfigServer, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, inventoryMagGenComponents: IInventoryMagGen[]); /** * Pick a random weapon based on weightings and generate a functional weapon * @param equipmentSlot Primary/secondary/holster diff --git a/TypeScript/14AfterDBLoadHook/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/14AfterDBLoadHook/types/generators/RagfairOfferGenerator.d.ts index b64a7e7..23882d2 100644 --- a/TypeScript/14AfterDBLoadHook/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/generators/RagfairOfferGenerator.d.ts @@ -1,16 +1,19 @@ +import { HandbookHelper } from "../helpers/HandbookHelper"; import { ItemHelper } from "../helpers/ItemHelper"; +import { PaymentHelper } from "../helpers/PaymentHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; import { Item } from "../models/eft/common/tables/IItem"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { IBarterScheme } from "../models/eft/common/tables/ITrader"; -import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; +import { IRagfairOffer, OfferRequirement } from "../models/eft/ragfair/IRagfairOffer"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { RagfairCategoriesService } from "../services/RagfairCategoriesService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { RagfairPriceService } from "../services/RagfairPriceService"; @@ -27,18 +30,31 @@ export declare class RagfairOfferGenerator { protected timeUtil: TimeUtil; protected databaseServer: DatabaseServer; protected ragfairServerHelper: RagfairServerHelper; + protected handbookHelper: HandbookHelper; protected saveServer: SaveServer; protected presetHelper: PresetHelper; protected ragfairAssortGenerator: RagfairAssortGenerator; protected ragfairOfferService: RagfairOfferService; protected ragfairPriceService: RagfairPriceService; + protected localisationService: LocalisationService; + protected paymentHelper: PaymentHelper; protected ragfairCategoriesService: RagfairCategoriesService; protected fenceService: FenceService; protected itemHelper: ItemHelper; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, ragfairServerHelper: RagfairServerHelper, saveServer: SaveServer, presetHelper: PresetHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferService: RagfairOfferService, ragfairPriceService: RagfairPriceService, ragfairCategoriesService: RagfairCategoriesService, fenceService: FenceService, itemHelper: ItemHelper, configServer: ConfigServer); + protected allowedFleaPriceItemsForBarter: { + tpl: string; + price: number; + }[]; + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, ragfairServerHelper: RagfairServerHelper, handbookHelper: HandbookHelper, saveServer: SaveServer, presetHelper: PresetHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferService: RagfairOfferService, ragfairPriceService: RagfairPriceService, localisationService: LocalisationService, paymentHelper: PaymentHelper, ragfairCategoriesService: RagfairCategoriesService, fenceService: FenceService, itemHelper: ItemHelper, configServer: ConfigServer); createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; + /** + * Calculate the offer price that's listed on the flea listing + * @param offerRequirements barter requirements for offer + * @returns rouble cost of offer + */ + protected calculateOfferListingPrice(offerRequirements: OfferRequirement[]): number; /** * Get avatar url from trader table in db * @param isTrader Is user we're getting avatar for a trader @@ -87,20 +103,36 @@ export declare class RagfairOfferGenerator { * @returns Item with conditions added */ protected addMissingCondition(item: Item): Item; - protected getOfferRequirements(items: Item[]): { - count: number; - _tpl: string; + /** + * Create a barter-based barter scheme, if not possible, fall back to making barter scheme currency based + * @param offerItems Items for sale in offer + * @returns barter scheme + */ + protected createBarterRequirement(offerItems: Item[]): IBarterScheme[]; + /** + * Get an array of flea prices + item tpl, cached in generator class + * @returns array with tpl/price values + */ + protected getFleaPricesAsArray(): { + tpl: string; + price: number; }[]; + /** + * Create a random currency-based barter scheme for an array of items + * @param offerItems Items on offer + * @returns Barter scheme for offer + */ + protected createCurrencyRequirement(offerItems: Item[]): IBarterScheme[]; /** * Create a flea offer and store it in the Ragfair server offers array * @param userID owner of the offer * @param time time offer is put up * @param items items in the offer - * @param barterScheme - * @param loyalLevel + * @param barterScheme cost of item (currency or barter) + * @param loyalLevel Loyalty level needed to buy item * @param price price of offer * @param sellInOnePiece - * @returns + * @returns Ragfair offer */ createFleaOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; } diff --git a/TypeScript/14AfterDBLoadHook/types/generators/WeatherGenerator.d.ts b/TypeScript/14AfterDBLoadHook/types/generators/WeatherGenerator.d.ts index 8ddbe49..65d2c76 100644 --- a/TypeScript/14AfterDBLoadHook/types/generators/WeatherGenerator.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/generators/WeatherGenerator.d.ts @@ -1,38 +1,54 @@ +import { ApplicationContext } from "../context/ApplicationContext"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; -import { IWeatherData } from "../models/eft/weather/IWeatherData"; +import { IWeather, IWeatherData } from "../models/eft/weather/IWeatherData"; +import { WindDirection } from "../models/enums/WindDirection"; import { IWeatherConfig } from "../models/spt/config/IWeatherConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class WeatherGenerator { protected weightedRandomHelper: WeightedRandomHelper; + protected logger: ILogger; protected randomUtil: RandomUtil; protected timeUtil: TimeUtil; + protected applicationContext: ApplicationContext; protected configServer: ConfigServer; protected weatherConfig: IWeatherConfig; - constructor(weightedRandomHelper: WeightedRandomHelper, randomUtil: RandomUtil, timeUtil: TimeUtil, configServer: ConfigServer); - calculateTime(data: IWeatherData): IWeatherData; + constructor(weightedRandomHelper: WeightedRandomHelper, logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, applicationContext: ApplicationContext, configServer: ConfigServer); + calculateGameTime(data: IWeatherData): IWeatherData; /** * Get server uptime seconds multiplied by a multiplier and add to current time as seconds * Format to BSGs requirements - * @param computedDate current date + * @param currentDate current date * @returns formatted time */ - protected getAcceleratedTime(computedDate: Date): string; + protected getBsgFormattedInRaidTime(currentDate: Date): string; + /** + * Get the current in-raid time + * @param currentDate (new Date()) + * @returns Date object of current in-raid time + */ + getInRaidTime(currentDate: Date): Date; /** * Get current time formatted to fit BSGs requirement - * @param computedDate date to format into bsg style + * @param date date to format into bsg style * @returns */ - protected getNormalTime(computedDate: Date): string; + protected getBSGFormattedTime(date: Date): string; /** - * Return randomised Weather data - * @param weatherData weather input data + * Return randomised Weather data with help of config/weather.json * @returns Randomised weather data */ - generateWeather(weatherData: IWeatherData): IWeatherData; - protected getWeightedFog(): string; + generateWeather(): IWeather; + /** + * Set IWeather date/time/timestamp values to now + * @param weather Object to update + */ + protected setCurrentDateTime(weather: IWeather): void; + protected getWeightedWindDirection(): WindDirection; + protected getWeightedWindSpeed(): number; + protected getWeightedFog(): number; protected getWeightedRain(): number; protected getRandomFloat(node: string): number; - protected getRandomInt(node: string): number; } diff --git a/TypeScript/14AfterDBLoadHook/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts b/TypeScript/14AfterDBLoadHook/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts index 4fcb1e2..1589707 100644 --- a/TypeScript/14AfterDBLoadHook/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts @@ -1,13 +1,15 @@ import { BotWeaponGeneratorHelper } from "../../../helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "../../../helpers/ItemHelper"; import { ILogger } from "../../../models/spt/utils/ILogger"; +import { LocalisationService } from "../../../services/LocalisationService"; import { IInventoryMagGen } from "../IInventoryMagGen"; import { InventoryMagGen } from "../InventoryMagGen"; export declare class ExternalInventoryMagGen implements IInventoryMagGen { protected logger: ILogger; protected itemHelper: ItemHelper; + protected localisationService: LocalisationService; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; - constructor(logger: ILogger, itemHelper: ItemHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper); + constructor(logger: ILogger, itemHelper: ItemHelper, localisationService: LocalisationService, botWeaponGeneratorHelper: BotWeaponGeneratorHelper); getPriority(): number; canHandleInventoryMagGen(inventoryMagGen: InventoryMagGen): boolean; process(inventoryMagGen: InventoryMagGen): void; diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/BotDifficultyHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/BotDifficultyHelper.d.ts new file mode 100644 index 0000000..a58ebdb --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/helpers/BotDifficultyHelper.d.ts @@ -0,0 +1,46 @@ +import { Difficulty } from "../models/eft/common/tables/IBotType"; +import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; +import { JsonUtil } from "../utils/JsonUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +import { BotHelper } from "./BotHelper"; +export declare class BotDifficultyHelper { + protected logger: ILogger; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected randomUtil: RandomUtil; + protected localisationService: LocalisationService; + protected botHelper: BotHelper; + protected configServer: ConfigServer; + protected botConfig: IBotConfig; + constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, localisationService: LocalisationService, botHelper: BotHelper, configServer: ConfigServer); + getPmcDifficultySettings(pmcType: "bear" | "usec", difficulty: string, usecType: string, bearType: string): Difficulty; + /** + * Get difficulty settings for desired bot type, if not found use assault bot types + * @param type bot type to retreive difficulty of + * @param difficulty difficulty to get settings for (easy/normal etc) + * @returns Difficulty object + */ + getBotDifficultySettings(type: string, difficulty: string): Difficulty; + /** + * Get difficulty settings for a PMC + * @param type "usec" / "bear" + * @param difficulty what difficulty to retrieve + * @returns Difficulty object + */ + protected getDifficultySettings(type: string, difficulty: string): Difficulty; + /** + * Translate chosen value from pre-raid difficulty dropdown into bot difficulty value + * @param dropDownDifficulty Dropdown difficulty value to convert + * @returns bot difficulty + */ + convertBotDifficultyDropdownToBotDifficulty(dropDownDifficulty: string): string; + /** + * Choose a random difficulty from - easy/normal/hard/impossible + * @returns random difficulty + */ + chooseRandomDifficulty(): string; +} diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/BotGeneratorHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/BotGeneratorHelper.d.ts index 5e3e501..899669e 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/BotGeneratorHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/BotGeneratorHelper.d.ts @@ -8,6 +8,7 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; import { ItemFilterService } from "../services/ItemFilterService"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; @@ -43,9 +44,10 @@ export declare class BotGeneratorHelper { protected itemFilterService: ItemFilterService; protected profileHelper: ProfileHelper; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Check mods are compatible and add to array * @param equipment Equipment item to add mods to @@ -53,9 +55,11 @@ export declare class BotGeneratorHelper { * @param parentId parentid of item to add mod to * @param parentTemplate template objet of item to add mods to * @param modSpawnChances dictionary of mod items and their chance to spawn for this bot type + * @param botRole the bot role being generated for + * @param forceSpawn should this mod be forced to spawn * @returns Item + compatible mods as an array */ - generateModsForEquipment(equipment: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances): Item[]; + generateModsForEquipment(equipment: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances, botRole: string, forceSpawn?: boolean): Item[]; /** * @param sessionId session id * @param weapon Weapon to add mods to @@ -70,15 +74,15 @@ export declare class BotGeneratorHelper { generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponParentId: string, parentWeaponTemplate: ITemplateItem, modSpawnChances: ModsChances, ammoTpl: string, botRole: string): Item[]; /** * - * @param modSlot - * @param isRandomisableSlot - * @param modsParent - * @param botEquipBlacklist - * @param itemModPool + * @param modSlot Slot mod will fit into + * @param isRandomisableSlot Will generate a randomised mod pool if true + * @param modsParent Parent slot the item will be a part of + * @param botEquipBlacklist Blacklist to prevent mods from being picked + * @param itemModPool Pool of items to pick from * @param weapon array with only weapon tpl in it, ready for mods to be added * @param ammoTpl ammo tpl to use if slot requires a cartridge to be added (e.g. mod_magazine) - * @param parentTemplate - * @returns + * @param parentTemplate Parent item the mod will go into + * @returns ITemplateItem */ protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, modsParent: Slot, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem): [boolean, ITemplateItem]; /** @@ -114,8 +118,10 @@ export declare class BotGeneratorHelper { * Find all compatible mods for equipment item and add to modPool * @param itemDetails item to find mods for * @param modPool ModPool to add mods to + * @param equipmentBlacklist equipment not allowed to be used by the bot + * @param botEquipmentRole bot type to generate pool for (e.g. assault, pmcBot, pmc for usec/bear) */ - generateDynamicModPool(itemDetails: ITemplateItem, modPool: Mods): void; + generateDynamicModPool(itemDetails: ITemplateItem, modPool: Mods, equipmentBlacklist: EquipmentFilterDetails[], botEquipmentRole: string): void; /** * Take a list of tpls and filter out blacklisted values using itemFilterService + botEquipmentBlacklist * @param allowedMods base mods to filter @@ -153,7 +159,7 @@ export declare class BotGeneratorHelper { * @param modTemplate Used to add additional properites in the upd object * @returns Item object */ - protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem): Item; + protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem, botRole: string): Item; /** * randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot * never return true for an item that has 0% spawn chance @@ -170,10 +176,10 @@ export declare class BotGeneratorHelper { */ protected getAmmoContainers(): string[]; /** - * Get the slot details for an item (chamber/cartridge/slot) + * Get a Slot property for an item (chamber/cartridge/slot) * @param modSlot e.g patron_in_weapon * @param parentTemplate item template - * @returns + * @returns Slot item */ protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; /** @@ -185,7 +191,6 @@ export declare class BotGeneratorHelper { * @param modPool modPool which should include available cartrigdes * @param parentId The CylinderMagazine's UID * @param parentTemplate The CylinderMagazine's template - * @returns */ protected fillCamora(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem): void; /** @@ -197,11 +202,11 @@ export declare class BotGeneratorHelper { /** * Adds properties to an item * e.g. Repairable / HasHinge / Foldable / MaxDurability - * @param itemTemplate - * @param botRole Used by weapons to randomise the durability values + * @param itemTemplate Item extra properties are being generated for + * @param botRole Used by weapons to randomise the durability values. Null for non-equipped items * @returns Item Upd object with extra properties */ - generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: any): { + generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: string): { upd?: Upd; }; /** @@ -220,21 +225,27 @@ export declare class BotGeneratorHelper { protected generateArmorRepairableProperties(itemTemplate: ITemplateItem, botRole: string): Repairable; /** * Get a random mod from an items compatible mods Filter array - * @param modTpl - * @param parentSlot - * @param modSlot - * @param items + * @param modTpl ???? + * @param parentSlot item mod will go into, used to get combatible items + * @param modSlot Slot to get mod to fill + * @param items items to ensure picked mod is compatible with * @returns item tpl */ protected getModTplFromItemDb(modTpl: string, parentSlot: Slot, modSlot: string, items: Item[]): string; /** * Can an item be added to an item without issue - * @param items - * @param tplToCheck - * @param equipmentSlot - * @returns true if possible + * @param items items to check compatiblilities with + * @param tplToCheck tpl of the item to check for incompatibilities + * @param equipmentSlot Slot the item will be placed into + * @returns false if no incompatibilties */ isItemIncompatibleWithCurrentItems(items: Item[], tplToCheck: string, equipmentSlot: string): boolean; + /** + * Convert a bots role to the equipment role used in config/bot.json + * @param botRole Role to convert + * @returns Equipment role (e.g. pmc / assault / bossTagilla) + */ + getBotEquipmentRole(botRole: string): string; } /** TODO - move into own class */ export declare class ExhaustableArray { diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/BotHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/BotHelper.d.ts index 67a6384..a7f779e 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/BotHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/BotHelper.d.ts @@ -3,6 +3,7 @@ import { IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; export declare class BotHelper { @@ -10,46 +11,27 @@ export declare class BotHelper { protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, configServer: ConfigServer); - /** - * Get difficulty settings for desired bot type, if not found use assault bot types - * @param type bot type to retreive difficulty of - * @param difficulty difficulty to get settings for (easy/normal etc) - * @returns Difficulty object - */ - getBotDifficultySettings(type: string, difficulty: string): Difficulty; + constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, localisationService: LocalisationService, configServer: ConfigServer); /** * Get a template object for the specified botRole from bots.types db * @param role botRole to get template for * @returns IBotType object */ getBotTemplate(role: string): IBotType; - /** - * Get difficulty settings for a PMC - * @param type "usec" / "bear" - * @param difficulty what difficulty to retrieve - * @returns Difficulty object - */ - getPmcDifficultySettings(type: string, difficulty: string): Difficulty; - /** - * Translate chosen value from pre-raid difficulty dropdown into bot difficulty value - * @param dropDownDifficulty Dropdown difficulty value to convert - * @returns bot difficulty - */ - convertBotDifficultyDropdownToBotDifficulty(dropDownDifficulty: string): string; - /** - * Choose a random difficulty from - easy/normal/hard/impossible - * @returns random difficulty - */ - chooseRandomDifficulty(): string; /** * Randomise the chance the PMC will attack their own side * Look up value in bot.json/chanceSameSideIsHostilePercent * @param difficultySettings pmc difficulty settings */ randomisePmcHostility(difficultySettings: Difficulty): void; + /** + * Is the passed in bot role a PMC (usec/bear/pmc) + * @param botRole bot role to check + * @returns true if is pmc + */ isBotPmc(botRole: string): boolean; isBotBoss(botRole: string): boolean; isBotFollower(botRole: string): boolean; diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/GameEventHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/GameEventHelper.d.ts index fca87be..fa25eff 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/GameEventHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/GameEventHelper.d.ts @@ -15,4 +15,15 @@ export declare class GameEventHelper { * @returns Record with event name + start/end date */ getEventDetails(): ISeasonalEvent[]; + /** + * Is detection of seasonal events enabled (halloween / christmas) + * @returns true if seasonal events should be checked for + */ + isAutomaticEventDetectionEnabled(): boolean; + /** + * Get a dictionary of gear changes to apply to bots for a specific event e.g. Christmas/Halloween + * @param eventName Name of event to get gear changes for + * @returns bots with equipment changes + */ + getEventBotGear(eventName: string): Record>>; } diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/HideoutHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/HideoutHelper.d.ts index 5f7e3b7..9d51fed 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/HideoutHelper.d.ts @@ -11,6 +11,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { PlayerService } from "../services/PlayerService"; import { HashUtil } from "../utils/HashUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; @@ -29,13 +30,14 @@ export declare class HideoutHelper { protected profileHelper: ProfileHelper; protected inventoryHelper: InventoryHelper; protected playerService: PlayerService; + protected localisationService: LocalisationService; protected configServer: ConfigServer; static bitcoinFarm: string; static waterCollector: string; static bitcoin: string; static expeditionaryFuelTank: string; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, localisationService: LocalisationService, configServer: ConfigServer); registerProduction(pmcData: IPmcData, body: IHideoutSingleProductionStartRequestData | IHideoutContinousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; /** * This convinience function intialies new Production Object diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/InventoryHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/InventoryHelper.d.ts index b8e5c9d..6419f93 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/InventoryHelper.d.ts @@ -5,11 +5,12 @@ import { IInventoryMergeRequestData } from "../models/eft/inventory/IInventoryMe import { IInventoryMoveRequestData } from "../models/eft/inventory/IInventoryMoveRequestData"; import { IInventorySplitRequestData } from "../models/eft/inventory/IInventorySplitRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { IInventoryConfig } from "../models/spt/config/IInventoryConfig"; +import { IInventoryConfig, RewardDetails } from "../models/spt/config/IInventoryConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { JsonUtil } from "../utils/JsonUtil"; @@ -38,9 +39,10 @@ export declare class InventoryHelper { protected itemHelper: ItemHelper; protected containerHelper: ContainerHelper; protected profileHelper: ProfileHelper; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected inventoryConfig: IInventoryConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); addItem(pmcData: IPmcData, body: IAddItemRequestData, output: IItemEventRouterResponse, sessionID: string, callback: any, foundInRaid?: boolean, addUpd?: any): IItemEventRouterResponse; removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; removeItemByCount(pmcData: IPmcData, itemId: string, count: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; @@ -76,6 +78,12 @@ export declare class InventoryHelper { * Internal helper function to handle cartridges in inventory if any of them exist. */ protected handleCartridges(items: Item[], body: IInventoryMoveRequestData): void; + /** + * Get details for how a random loot container should be handled, max rewards, possible reward tpls + * @param itemTpl Container being opened + * @returns Reward details + */ + getRandomLootContainerRewardDetails(itemTpl: string): RewardDetails; } declare namespace InventoryHelper { interface InventoryItemHash { diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/ItemHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/ItemHelper.d.ts index 0effaf2..fc88a46 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/ItemHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/ItemHelper.d.ts @@ -5,6 +5,7 @@ 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 { LocaleService } from "../services/LocaleService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; @@ -18,7 +19,8 @@ declare class ItemHelper { protected objectId: ObjectId; protected mathUtil: MathUtil; protected databaseServer: DatabaseServer; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer); + protected localeService: LocaleService; + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, localeService: LocaleService); /** * Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash * @param {string} tpl the template id / tpl @@ -212,6 +214,12 @@ declare class ItemHelper { * @returns size of stack */ getItemStackSize(item: Item): number; + /** + * Get the name of an item from the locale file using the item tpl + * @param itemTpl Tpl of item to get name of + * @returns Name of item + */ + getItemName(itemTpl: string): string; } declare namespace ItemHelper { interface ItemSize { diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/QuestHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/QuestHelper.d.ts index a6b4892..edbd2e1 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/QuestHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/QuestHelper.d.ts @@ -50,6 +50,12 @@ export declare class QuestHelper { * @returns true if player level is greater than or equal to quest */ doesPlayerLevelFulfilCondition(playerLevel: number, condition: AvailableForConditions): boolean; + /** + * Get the quests found in both arrays (inner join) + * @param before Array of qeusts #1 + * @param after Array of quests #2 + * @returns Reduction of cartesian product between two quest arrays + */ getDeltaQuests(before: IQuest[], after: IQuest[]): IQuest[]; /** * Increase skill points of a skill on player profile @@ -66,38 +72,85 @@ export declare class QuestHelper { * quest list in question. */ dumpQuests(quests: any): void; - loyaltyRequirementCheck(loyaltyRequirementProperties: AvailableForProps, profile: IPmcData): boolean; - protected processReward(reward: Reward): any[]; + /** + * Check if trader has sufficient loyalty to fullfill quest requirement + * @param questProperties Quest props + * @param profile Player profile + * @returns true if loyalty is high enough to fulfil quest requirement + */ + traderStandingRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; + protected processReward(reward: Reward): Reward[]; + /** + * Gets a flat list of reward items for the given quest at a specific state (e.g. Fail/Success) + * @param quest quest to get rewards for + * @param state Quest status that holds the items (Started, Success, Fail) + * @returns array of items with the correct maxStack + */ getQuestRewardItems(quest: IQuest, state: QuestStatus): Reward[]; /** - * Add quest with new state value to pmc profile + * Update player profile with quest status (e.g. Fail/Success) * @param pmcData profile to add quest to * @param newState state the new quest should be in when added * @param acceptedQuest Details of quest being added */ addQuestToPMCData(pmcData: IPmcData, newState: QuestStatus, acceptedQuest: IAcceptQuestRequestData): void; - acceptedUnlocked(acceptedQuestId: string, sessionID: string): IQuest[]; - failedUnlocked(failedQuestId: string, sessionID: string): IQuest[]; - applyMoneyBoost(quest: IQuest, moneyBoost: number): IQuest; - changeItemStack(pmcData: IPmcData, id: string, value: number, sessionID: string, output: any): void; /** - * Get List of All Quests as an array + * TODO: what is going on here + * @param acceptedQuestId Quest to add to profile + * @param sessionID Session id + * @returns Array of quests in profile + quest passed in as param + */ + acceptedUnlocked(acceptedQuestId: string, sessionID: string): IQuest[]; + /** + * TODO: what is going on here + * @param failedQuestId + * @param sessionID Session id + * @returns + */ + failedUnlocked(failedQuestId: string, sessionID: string): IQuest[]; + /** + * Adjust quest money rewards by passed in multipler + * @param quest Quest to multiple money rewards + * @param multipler Value to adjust money rewards by + * @returns Updated quest + */ + applyMoneyBoost(quest: IQuest, multipler: number): IQuest; + /** + * Sets the item stack to new value, or delete the item if value <= 0 + * // TODO maybe merge this function and the one from customization + * @param pmcData Profile + * @param itemId id of item to adjust stack size of + * @param newStackSize Stack size to adjust to + * @param sessionID Session id + * @param output ItemEvent router response + */ + changeItemStack(pmcData: IPmcData, itemId: string, newStackSize: number, sessionID: string, output: IItemEventRouterResponse): void; + /** + * Get List of All Quests from db + * NOT CLONED * @returns Array of IQuest objects */ - questValues(): IQuest[]; + getQuestsFromDb(): IQuest[]; /** - * Reest AvailableForStart conditions for quests - * @param quests queststo clean + * Get quests, strip all requirement conditions except level + * @param quests quests to process * @returns quest array without conditions */ - protected cleanQuestList(quests: IQuest[]): IQuest[]; + protected getQuestsWithOnlyLevelRequirementStartCondition(quests: IQuest[]): IQuest[]; /** - * Reset AvailableForStart conditions on a quest + * Remove all quest conditions except for level requirement * @param quest quest to clean * @returns reset IQuest object */ - cleanQuestConditions(quest: IQuest): IQuest; - failQuest(pmcData: IPmcData, body: any, sessionID: string): any; + getQuestWithOnlyLevelRequirementStartCondition(quest: IQuest): IQuest; + /** + * Fail a quest in a player profile + * @param pmcData Profile + * @param failRequest fail quest request data + * @param sessionID Session id + * @returns Item event router response + */ + failQuest(pmcData: IPmcData, failRequest: any, sessionID: string): IItemEventRouterResponse; /** * Get quest by id from database * @param questId questid to look for @@ -105,7 +158,12 @@ export declare class QuestHelper { * @returns IQuest object */ getQuestFromDb(questId: string, pmcData: IPmcData): IQuest; - getQuestLocaleIdFromDb(messageId: string): string; + /** + * Get the locale Id from locale db for a quest message + * @param questMessageId Quest mesage id to look up + * @returns Locale Id from locale db + */ + getQuestLocaleIdFromDb(questMessageId: string): string; /** * Alter a quests state + Add a record to tis status timers object * @param pmcData Profile to update @@ -128,5 +186,10 @@ export declare class QuestHelper { * @returns bonus in percent */ protected getIntelCenterRewardBonus(pmcData: IPmcData): number; - getFindItemIdForQuestItem(itemTpl: string): string; + /** + * Find quest with 'findItem' requirement that needs the item tpl be handed in + * @param itemTpl item tpl to look for + * @returns 'FindItem' condition id + */ + getFindItemIdForQuestHandIn(itemTpl: string): string; } diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/RagfairServerHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/RagfairServerHelper.d.ts index a03cdda..ec388d8 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/RagfairServerHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/RagfairServerHelper.d.ts @@ -44,10 +44,20 @@ export declare class RagfairServerHelper { isPlayer(userID: string): boolean; returnItems(sessionID: string, items: any[]): void; calculateDynamicStackCount(tplId: string, isWeaponPreset: boolean): number; + /** + * Choose a currency at random with bias + * @returns currency tpl + */ getDynamicOfferCurrency(): string; getMemberType(userID: string): MemberCategory; getNickname(userID: string): string; getPresetItems(item: any): Item[]; getPresetItemsByTpl(item: Item): Item[]; + /** + * Generate new unique ids for the children while preserving hierarchy + * @param item base item + * @param preset + * @returns Item array with new IDs + */ reparentPresets(item: Item, preset: Item[]): Item[]; } diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/RagfairSortHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/RagfairSortHelper.d.ts index 28d1d38..4669ce6 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/RagfairSortHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/RagfairSortHelper.d.ts @@ -18,7 +18,7 @@ export declare class RagfairSortHelper { protected sortOffersByRating(a: IRagfairOffer, b: IRagfairOffer): number; protected sortOffersByName(a: IRagfairOffer, b: IRagfairOffer): number; /** - * Order two offers by price value + * Order two offers by rouble price value * @param a Offer a * @param b Offer b * @returns diff --git a/TypeScript/14AfterDBLoadHook/types/loaders/PreAkiModLoader.d.ts b/TypeScript/14AfterDBLoadHook/types/loaders/PreAkiModLoader.d.ts index 7a687a5..f486a28 100644 --- a/TypeScript/14AfterDBLoadHook/types/loaders/PreAkiModLoader.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/loaders/PreAkiModLoader.d.ts @@ -1,29 +1,31 @@ import { DependencyContainer } from "tsyringe"; +import { IPostAkiLoadMod } from "../models/external/IPostAkiLoadMod"; +import { IPostDBLoadMod } from "../models/external/IPostDBLoadMod"; +import { IPreAkiLoadMod } from "../models/external/IPreAkiLoadMod"; import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { ModLoader } from "../models/spt/mod/IMod"; import { IModLoader } from "../models/spt/mod/IModLoader"; import { IPackageJsonData } from "../models/spt/mod/IPackageJsonData"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { LocalisationService } from "../services/LocalisationService"; import { ModCompilerService } from "../services/ModCompilerService"; import { JsonUtil } from "../utils/JsonUtil"; import { VFS } from "../utils/VFS"; import { BundleLoader } from "./BundleLoader"; -import { IPostAkiLoadMod } from "../models/external/IPostAkiLoadMod"; -import { IPreAkiLoadMod } from "../models/external/IPreAkiLoadMod"; -import { IPostDBLoadMod } from "../models/external/IPostDBLoadMod"; export declare class PreAkiModLoader implements IModLoader { protected logger: ILogger; protected vfs: VFS; protected jsonUtil: JsonUtil; protected modCompilerService: ModCompilerService; protected bundleLoader: BundleLoader; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected static container: DependencyContainer; protected readonly basepath = "user/mods/"; protected imported: Record; protected akiConfig: ICoreConfig; - constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, modCompilerService: ModCompilerService, bundleLoader: BundleLoader, configServer: ConfigServer); + constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, modCompilerService: ModCompilerService, bundleLoader: BundleLoader, localisationService: LocalisationService, configServer: ConfigServer); load(container: DependencyContainer): Promise; getBundles(local: boolean): string; getBundle(key: string, local: boolean): void; diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/bot/IGenerateBotsRequestData.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/bot/IGenerateBotsRequestData.d.ts index c49cef7..f1f7013 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/eft/bot/IGenerateBotsRequestData.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/bot/IGenerateBotsRequestData.d.ts @@ -2,6 +2,7 @@ export interface IGenerateBotsRequestData { conditions: Condition[]; } export interface Condition { + /** e.g. assault/pmcBot/bossKilla */ Role: string; Limit: number; Difficulty: string; diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/common/IGlobals.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/common/IGlobals.d.ts index 81e2023..b53f106 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/eft/common/IGlobals.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/common/IGlobals.d.ts @@ -591,6 +591,7 @@ export interface HealPrice { export interface ProfileHealthSettings { BodyPartsSettings: BodyPartsSettings; HealthFactorsSettings: HealthFactorsSettings; + DefaultStimulatorBuff: string; } export interface BodyPartsSettings { Head: BodyPartsSetting; diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/IBotBase.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/IBotBase.d.ts index 1c28ae0..2b418c1 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/IBotBase.d.ts @@ -107,6 +107,7 @@ export interface CurrentMax { Maximum: number; } export interface Inventory { + discardLimits: Record; items: Item[]; equipment: string; stash: string; diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/IBotType.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/IBotType.d.ts index c1fe579..55b4bd9 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/IBotType.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/IBotType.d.ts @@ -13,8 +13,8 @@ export interface IBotType { skills: Skills; } export interface Appearance { - body: string[]; - feet: string[]; + body: Record; + feet: Record; hands: string[]; head: string[]; voice: string[]; diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/ITemplateItem.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/ITemplateItem.d.ts index 8569e61..0fa7e18 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/common/tables/ITemplateItem.d.ts @@ -254,7 +254,7 @@ export interface Props { foodUseTime?: number; foodEffectType?: string; StimulatorBuffs?: string; - effects_health?: any; + effects_health?: IHealthEffect[] | Record>; effects_damage?: any; MaximumNumberOfUsage?: number; knifeHitDelay?: number; @@ -366,6 +366,10 @@ export interface Props { MinTimeToContactExplode?: number; ExplosionEffectType?: string; } +export interface IHealthEffect { + type: string; + value: number; +} export interface Prefab { path: string; rcid: string; diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/customization/IGetSuitsResponse.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/customization/IGetSuitsResponse.d.ts new file mode 100644 index 0000000..fe6888c --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/customization/IGetSuitsResponse.d.ts @@ -0,0 +1,4 @@ +export interface IGetSuitsResponse { + _id: string; + suits: string[]; +} diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/game/IGameKeepAliveResponse.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/game/IGameKeepAliveResponse.d.ts new file mode 100644 index 0000000..170ce6a --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/game/IGameKeepAliveResponse.d.ts @@ -0,0 +1,4 @@ +export interface IGameKeepAliveResponse { + msg: string; + utc_time: number; +} diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/game/IGameLogoutResponseData.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/game/IGameLogoutResponseData.d.ts new file mode 100644 index 0000000..0f52050 --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/game/IGameLogoutResponseData.d.ts @@ -0,0 +1,3 @@ +export interface IGameLogoutResponseData { + status: string; +} diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/game/IGameStartResponse.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/game/IGameStartResponse.d.ts new file mode 100644 index 0000000..9f0ab6d --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/game/IGameStartResponse.d.ts @@ -0,0 +1,3 @@ +export interface IGameStartResponse { + utc_time: number; +} diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts new file mode 100644 index 0000000..3c45124 --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts @@ -0,0 +1,11 @@ +import { IInventoryBaseActionRequestData } from "./IInventoryBaseActionRequestData"; +export interface IOpenRandomLootContainerRequestData extends IInventoryBaseActionRequestData { + Action: "OpenRandomLootContainer"; + /** Container item opened */ + item: string; + to: To[]; +} +export interface To { + /** Player character (pmc/scav) id items will be sent to */ + id: string; +} diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/itemEvent/IItemEventRouterBase.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/itemEvent/IItemEventRouterBase.d.ts index 4841cfd..60ab284 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/eft/itemEvent/IItemEventRouterBase.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/itemEvent/IItemEventRouterBase.d.ts @@ -10,8 +10,9 @@ export interface IItemEventRouterBase { export declare type TProfileChanges = Record; export interface Warning { index: number; - err: string; errmsg: string; + code?: string; + data?: any; } export interface ProfileChange { _id: string; diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/match/IStartOffineRaidRequestData.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/match/IStartOffineRaidRequestData.d.ts index af0625e..1983728 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/eft/match/IStartOffineRaidRequestData.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/match/IStartOffineRaidRequestData.d.ts @@ -2,8 +2,10 @@ import { BotAmount } from "../../enums/BotAmount"; import { BotDifficulty } from "../../enums/BotDifficulty"; export interface IStartOfflineRaidRequestData { locationName: string; + /** Current time, not in-game time */ startTime: number; - dateTime: string; + /** CURR = am, past = pm */ + dateTime: "CURR" | "PAST"; gameSettings: GameSettings; } export interface GameSettings { diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/notifier/ISelectProfileResponse.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/notifier/ISelectProfileResponse.d.ts new file mode 100644 index 0000000..ecb668a --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/notifier/ISelectProfileResponse.d.ts @@ -0,0 +1,6 @@ +import { INotifierChannel } from "./INotifier"; +export interface ISelectProfileResponse { + status: string; + notifier: INotifierChannel; + notifierServer: string; +} diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/ragfair/IRagfairOffer.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/ragfair/IRagfairOffer.d.ts index 3251a37..792ec7d 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/eft/ragfair/IRagfairOffer.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/ragfair/IRagfairOffer.d.ts @@ -7,19 +7,19 @@ export interface IRagfairOffer { requirements: OfferRequirement[]; root: string; intId: number; + /** Handbook price */ itemsCost: number; + /** Rouble price */ requirementsCost: number; - sptRequirementsCostRouble: number; startTime: number; endTime: number; sellInOnePiece: boolean; - name?: string; - shortName?: string; loyaltyLevel: number; buyRestrictionMax?: number; buyRestrictionCurrent?: number; locked: boolean; unlimitedCount: boolean; + /** Rouble price */ summaryCost: number; user: IRagfairOfferUser; notAvailable: boolean; @@ -33,11 +33,11 @@ export interface OfferRequirement { } export interface IRagfairOfferUser { id: string; - nickname: string; - rating: number; + nickname?: string; + rating?: number; memberType: MemberCategory; - avatar: string; - isRatingGrowing: boolean; + avatar?: string; + isRatingGrowing?: boolean; } export interface SellResult { sellTime: number; diff --git a/TypeScript/14AfterDBLoadHook/types/models/eft/weather/IWeatherData.d.ts b/TypeScript/14AfterDBLoadHook/types/models/eft/weather/IWeatherData.d.ts index ecc96ce..1f5d5b5 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/eft/weather/IWeatherData.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/eft/weather/IWeatherData.d.ts @@ -1,17 +1,18 @@ +import { WindDirection } from "../../../models/enums/WindDirection"; export interface IWeatherData { acceleration: number; time: string; date: string; - weather: IWeather; + weather?: IWeather; } export interface IWeather { pressure: number; temp: number; - fog: string; + fog: number; rain_intensity: number; - rain: any; + rain: number; wind_gustiness: number; - wind_direction: any; + wind_direction: WindDirection; wind_speed: number; cloud: number; time: string; diff --git a/TypeScript/14AfterDBLoadHook/types/models/enums/BackendErrorCodes.d.ts b/TypeScript/14AfterDBLoadHook/types/models/enums/BackendErrorCodes.d.ts new file mode 100644 index 0000000..6614b75 --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/models/enums/BackendErrorCodes.d.ts @@ -0,0 +1,67 @@ +export declare enum BackendErrorCodes { + NONE = 0, + UNKNOWN_ERROR = 200, + NOT_AUTHORIZED = 201, + NEED_AUTHORIZATION_CODE = 209, + WRONG_AUTHORIZATION_CODE = 211, + NEED_CAPTCHA = 214, + NO_NEED_CAPTCHA = 215, + CAPTCHA_FAILED = 218, + CAPTCHA_BRUTE_FORCED = 219, + NO_ROOM_IN_STASH = 223, + NICKNAME_NOT_UNIQUE = 225, + NICKNAME_NOT_VALID = 226, + UNSUPPORTED_CLIENT_VERSION = 232, + REPORT_NOT_ALLOWED = 238, + NICKNAME_IS_ABUSIVE = 241, + NICKNAME_CHANGE_TIMEOUT = 242, + NOT_MODIFIED = 304, + HTTP_BAD_REQUEST = 400, + HTTP_NOT_AUTHORIZED = 401, + HTTP_FORBIDDEN = 403, + HTTP_NOT_FOUND = 404, + HTTP_METHOD_NOT_ALLOWED = 405, + UNKNOWN_TRADING_ERROR = 500, + HTTPNOTIMPLEMENTED = 501, + HTTPBADGATEWAY = 502, + HTTPSERVICEUNAVAILABLE = 503, + HTTPGATEWAYTIMEOUT = 504, + TRADEROUTOFMONEY = 505, + HTTPVARIANTALSONEGOTIATES = 506, + PRICECHANGED = 509, + TRADERDISABLED = 512, + ITEMHASBEENSOLD = 513, + NOTENOUGHSPACEFORMONEY = 518, + HTTPINVALIDSSLCERTIFICATE = 526, + UNKNOWNRAGFAIRERROR = 550, + UNKNOWNRAGFAIRERROR2 = 551, + UNKNOWNMATCHMAKERERROR = 600, + SESSIONPARAMETERSERROR = 601, + SESSIONLOST = 602, + SERVERNOTREGISTERED = 604, + UNKNOWNQUESTERROR = 700, + QUESTBADPARAM = 702, + QUESTNOTFOUND = 703, + QUESTISUNAVAILABLE = 704, + NOFREESPACEFORREWARDS = 705, + WRONGQUESTSTATUS = 706, + CANTCOMPLETEQUEST = 707, + UNKNOWNMAILERROR = 900, + TOOMANYFRIENDREQUESTS = 925, + UNKNOWNSCRIPTEXECUTIONERROR = 1000, + UNKNOWNREPAIRINGERROR = 1200, + UNKNOWNINSURANCEERROR = 1300, + UNKNOWNCURRENCYEXCHANGEERROR = 1400, + OFFERNOTFOUND = 1503, + NOTENOUGHSPACE = 1505, + OFFEROUTOFSTOCK = 1506, + OFFERSOLD = 1507, + RAGFAIRUNAVAILABLE = 1511, + BANNEDERRORCODE = 1513, + INSUFFICIENTNUMBERINSTOCK = 1516, + TOOMANYITEMSTOSELL = 1517, + EXAMINATIONFAILED = 22001, + ITEMALREADYEXAMINED = 22002, + UNKNOWNNGINXERROR = 9000, + PARSERESPONSEERROR = 9001 +} diff --git a/TypeScript/14AfterDBLoadHook/types/models/enums/HideoutEventActions.d.ts b/TypeScript/14AfterDBLoadHook/types/models/enums/HideoutEventActions.d.ts new file mode 100644 index 0000000..e441477 --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/models/enums/HideoutEventActions.d.ts @@ -0,0 +1,11 @@ +export declare enum HideoutEventActions { + HIDEOUT_UPGRADE = "HideoutUpgrade", + HIDEOUT_UPGRADE_COMPLETE = "HideoutUpgradeComplete", + HIDEOUT_PUT_ITEMS_IN_AREA_SLOTS = "HideoutPutItemsInAreaSlots", + HIDEOUT_TAKE_ITEMS_FROM_AREA_SLOTS = "HideoutTakeItemsFromAreaSlots", + HIDEOUT_TOGGLE_AREA = "HideoutToggleArea", + HIDEOUT_SINGLE_PRODUCTION_START = "HideoutSingleProductionStart", + HIDEOUT_SCAV_CASE_PRODUCTION_START = "HideoutScavCaseProductionStart", + HIDEOUT_CONTINUOUS_PRODUCTION_START = "HideoutContinuousProductionStart", + HIDEOUT_TAKE_PRODUCTION = "HideoutTakeProduction" +} diff --git a/TypeScript/14AfterDBLoadHook/types/models/enums/ItemEventActions.d.ts b/TypeScript/14AfterDBLoadHook/types/models/enums/ItemEventActions.d.ts new file mode 100644 index 0000000..0e65453 --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/models/enums/ItemEventActions.d.ts @@ -0,0 +1,19 @@ +export declare enum ItemEventActions { + MOVE = "Move", + REMOVE = "Remove", + SPLIT = "Split", + MERGE = "Merge", + TRANSFER = "Transfer", + SWAP = "Swap", + FOLD = "Fold", + TOGGLE = "Toggle", + TAG = "Tag", + BIND = "Bind", + EXAMINE = "Examine", + READ_ENCYCLOPEDIA = "ReadEncyclopedia", + APPLY_INVENTORY_CHANGES = "ApplyInventoryChanges", + CREATE_MAP_MARKER = "CreateMapMarker", + DELETE_MAP_MARKER = "DeleteMapMarker", + EDIT_MAP_MARKER = "EditMapMarker", + OPEN_RANDOM_LOOT_CONTAINER = "OpenRandomLootContainer" +} diff --git a/TypeScript/14AfterDBLoadHook/types/models/enums/WeatherType.d.ts b/TypeScript/14AfterDBLoadHook/types/models/enums/WeatherType.d.ts new file mode 100644 index 0000000..d31fefe --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/models/enums/WeatherType.d.ts @@ -0,0 +1,19 @@ +export declare enum WeatherType { + CLEAR_DAY = 1, + CLEAR_WIND = 2, + CLEAR_NIGHT = 3, + PARTLY_CLOUD_DAY = 4, + PARTLY_CLOUD_NIGHT = 5, + CLEAR_FOG_DAY = 6, + CLEAR_FOG_NIGHT = 7, + CLOUDFOG = 8, + FOG = 9, + MOSTLY_CLOUD = 10, + LIGHT_RAIN = 11, + RAIN = 12, + CLOUD_WIND = 13, + CLOUD_WIND_RAIN = 14, + FULL_CLOUD = 15, + THUNDER_CLOUD = 16, + NONE = 0 +} diff --git a/TypeScript/14AfterDBLoadHook/types/models/enums/WildSpawnTypeNumber.d.ts b/TypeScript/14AfterDBLoadHook/types/models/enums/WildSpawnTypeNumber.d.ts new file mode 100644 index 0000000..ff806fe --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/models/enums/WildSpawnTypeNumber.d.ts @@ -0,0 +1,33 @@ +export declare enum WildSpawnTypeNumber { + ASSAULT = 1, + MARKSMAN = 2, + BOSSTEST = 4, + BOSSBULLY = 8, + FOLLOWERTEST = 16, + FOLLOWERBULLY = 32, + BOSSKILLA = 64, + BOSSKOJANIY = 128, + FOLLOWERKOJANIY = 256, + PMCBOT = 512, + CURSEDASSAULT = 1024, + BOSSGLUHAR = 2048, + FOLLOWERGLUHARASSAULT = 4096, + FOLLOWERGLUHARSECURITY = 8192, + FOLLOWERGLUHARSCOUT = 16384, + FOLLOWERGLUHARSNIPE = 32768, + FOLLOWERSANITAR = 65536, + BOSSSANITAR = 131072, + TEST = 262144, + ASSAULTGROUP = 524288, + SECTANTWARRIOR = 1048576, + SECTANTPRIEST = 2097152, + BOSSTAGILLA = 4194304, + FOLLOWERTAGILLA = 8388608, + EXUSEC = 16777216, + GIFTER = 33554432, + BOSSKNIGHT = 67108864, + FOLLOWERBIGPIPE = 134217728, + FOLLOWERBIRDEYE = 268435456, + SPTUSEC = 536870912, + SPTBEAR = 1073741824 +} diff --git a/TypeScript/14AfterDBLoadHook/types/models/enums/WindDirection.d.ts b/TypeScript/14AfterDBLoadHook/types/models/enums/WindDirection.d.ts new file mode 100644 index 0000000..fb30b20 --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/models/enums/WindDirection.d.ts @@ -0,0 +1,10 @@ +export declare enum WindDirection { + EAST = 1, + NORTH = 2, + WEST = 3, + SOUTH = 4, + SE = 5, + SW = 6, + NW = 7, + NE = 8 +} diff --git a/TypeScript/14AfterDBLoadHook/types/models/spt/config/IBotConfig.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IBotConfig.d.ts index af8ceba..d6fa5e0 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IBotConfig.d.ts @@ -27,6 +27,8 @@ export interface IBotConfig extends IBaseConfig { maxBotCap: Record; /** How many stacks of secret ammo should a bot have in its bot secure container */ secureContainerAmmoStackCount: number; + /** Batch generation size when type not available in cache */ + botGenerationBatchSizePerType: number; } export interface PresetBatch { assault: number; @@ -66,8 +68,12 @@ export interface EquipmentFilters { weaponModLimits: ModLimits; randomisedWeaponModSlots?: string[]; randomisedArmorSlots?: string[]; + faceShieldIsActiveChancePercent?: number; + lightLaserIsActiveChancePercent?: number; blacklist: EquipmentFilterDetails[]; whitelist: EquipmentFilterDetails[]; + clothing: WeightingAdjustmentDetails[]; + weightingAdjustments: WeightingAdjustmentDetails[]; } export interface ModLimits { /** How many scopes are allowed on a weapon - hard coded to work with OPTIC_SCOPE, ASSAULT_SCOPE, COLLIMATOR, COMPACT_COLLIMATOR */ @@ -80,3 +86,8 @@ export interface EquipmentFilterDetails { equipment: Record; cartridge: Record; } +export interface WeightingAdjustmentDetails { + levelRange: MinMax; + add: Record>; + edit: Record>; +} diff --git a/TypeScript/14AfterDBLoadHook/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IInventoryConfig.d.ts index ffffa41..4642b9b 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IInventoryConfig.d.ts @@ -2,4 +2,10 @@ import { IBaseConfig } from "./IBaseConfig"; export interface IInventoryConfig extends IBaseConfig { kind: "aki-inventory"; newItemsMarkedFound: boolean; + randomLootContainers: Record; +} +export interface RewardDetails { + rewardCount: number; + foundInRaid: boolean; + rewardTplPool: Record; } diff --git a/TypeScript/14AfterDBLoadHook/types/models/spt/config/ILocaleConfig.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/config/ILocaleConfig.d.ts index fe9abf7..0a8955c 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/spt/config/ILocaleConfig.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/spt/config/ILocaleConfig.d.ts @@ -1,5 +1,10 @@ import { IBaseConfig } from "./IBaseConfig"; export interface ILocaleConfig extends IBaseConfig { kind: "aki-locale"; - desiredLocale: string; + /** e.g. ru/en/cn/fr etc, or 'system', will take computer locale setting */ + gameLocale: string; + /** e.g. ru/en/cn/fr etc, or 'system', will take computer locale setting */ + serverLocale: string; + /** Languages server can be translated into */ + serverSupportedLocales: string[]; } diff --git a/TypeScript/14AfterDBLoadHook/types/models/spt/config/IPmcConfig.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IPmcConfig.d.ts index 9db2ba1..48601b2 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/spt/config/IPmcConfig.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IPmcConfig.d.ts @@ -6,9 +6,11 @@ export interface IPmcConfig { looseWeaponInBackpackChancePercent: number; looseWeaponInBackpackLootMinMax: MinMax; isUsec: number; + usecType: string; + bearType: string; chanceSameSideIsHostilePercent: number; /** key: location, value: type for usec/bear */ - pmcType: Record; + pmcType: Record>>; maxBackpackLootTotalRub: number; maxPocketLootTotalRub: number; maxVestLootTotalRub: number; diff --git a/TypeScript/14AfterDBLoadHook/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IRagfairConfig.d.ts index c1b8763..6786417 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IRagfairConfig.d.ts @@ -28,12 +28,8 @@ export interface Reputation { gain: number; loss: number; } -export declare class OfferAdjustment { - maxPriceDifferenceBelowHandbookPercent: number; - handbookPriceMultipier: number; - priceThreshholdRub: number; -} export interface Dynamic { + barter: Barter; offerAdjustment: OfferAdjustment; expiredOfferThreshold: number; offerItemCount: MinMax; @@ -49,6 +45,20 @@ export interface Dynamic { showAsSingleStack: string[]; blacklist: Blacklist; } +export declare class Barter { + enable: boolean; + chancePercent: number; + itemCountMin: number; + itemCountMax: number; + priceRangeVariancePercent: number; + minRoubleCostToBecomeBarter: number; + itemTypeBlacklist: string[]; +} +export declare class OfferAdjustment { + maxPriceDifferenceBelowHandbookPercent: number; + handbookPriceMultipier: number; + priceThreshholdRub: number; +} export interface Condition { conditionChance: number; min: number; diff --git a/TypeScript/14AfterDBLoadHook/types/models/spt/config/ISeasonalEventConfig.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/config/ISeasonalEventConfig.d.ts index bc60618..e410925 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/spt/config/ISeasonalEventConfig.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/spt/config/ISeasonalEventConfig.d.ts @@ -1,6 +1,9 @@ import { IBaseConfig } from "./IBaseConfig"; export interface ISeasonalEventConfig extends IBaseConfig { kind: "aki-seasonalevents"; + enableSeasonalEventDetection: boolean; + /** event / botType / equipSlot / itemid */ + eventGear: Record>>>; events: ISeasonalEvent[]; } export interface ISeasonalEvent { diff --git a/TypeScript/14AfterDBLoadHook/types/models/spt/config/IWeatherConfig.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IWeatherConfig.d.ts index bbdc43e..41a1c83 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/spt/config/IWeatherConfig.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IWeatherConfig.d.ts @@ -1,3 +1,4 @@ +import { WindDirection } from "../../../models/enums/WindDirection"; import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface IWeatherConfig extends IBaseConfig { @@ -7,12 +8,16 @@ export interface IWeatherConfig extends IBaseConfig { } export interface Weather { clouds: MinMax; - windSpeed: MinMax; - windDirection: MinMax; + windSpeed: WeatherSettings; + windDirection: WeatherSettings; windGustiness: MinMax; - rain: MinMax; + rain: WeatherSettings; rainIntensity: MinMax; - fog: MinMax; + fog: WeatherSettings; temp: MinMax; pressure: MinMax; } +export interface WeatherSettings { + values: T[]; + weights: number[]; +} diff --git a/TypeScript/14AfterDBLoadHook/types/routers/item_events/HideoutItemEventRouter.d.ts b/TypeScript/14AfterDBLoadHook/types/routers/item_events/HideoutItemEventRouter.d.ts index e1e98af..44bd1cd 100644 --- a/TypeScript/14AfterDBLoadHook/types/routers/item_events/HideoutItemEventRouter.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/routers/item_events/HideoutItemEventRouter.d.ts @@ -1,7 +1,7 @@ -import { IPmcData } from "../../models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "../../models/eft/itemEvent/IItemEventRouterResponse"; import { HideoutCallbacks } from "../../callbacks/HideoutCallbacks"; import { HandledRoute, ItemEventRouterDefinition } from "../../di/Router"; +import { IPmcData } from "../../models/eft/common/IPmcData"; +import { IItemEventRouterResponse } from "../../models/eft/itemEvent/IItemEventRouterResponse"; export declare class HideoutItemEventRouter extends ItemEventRouterDefinition { protected hideoutCallbacks: HideoutCallbacks; constructor(hideoutCallbacks: HideoutCallbacks); diff --git a/TypeScript/14AfterDBLoadHook/types/routers/item_events/InventoryItemEventRouter.d.ts b/TypeScript/14AfterDBLoadHook/types/routers/item_events/InventoryItemEventRouter.d.ts index 2619bb9..953d322 100644 --- a/TypeScript/14AfterDBLoadHook/types/routers/item_events/InventoryItemEventRouter.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/routers/item_events/InventoryItemEventRouter.d.ts @@ -1,7 +1,7 @@ -import { IPmcData } from "../../models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "../../models/eft/itemEvent/IItemEventRouterResponse"; import { InventoryCallbacks } from "../../callbacks/InventoryCallbacks"; import { HandledRoute, ItemEventRouterDefinition } from "../../di/Router"; +import { IPmcData } from "../../models/eft/common/IPmcData"; +import { IItemEventRouterResponse } from "../../models/eft/itemEvent/IItemEventRouterResponse"; export declare class InventoryItemEventRouter extends ItemEventRouterDefinition { protected inventoryCallbacks: InventoryCallbacks; constructor(inventoryCallbacks: InventoryCallbacks); diff --git a/TypeScript/14AfterDBLoadHook/types/servers/HttpServer.d.ts b/TypeScript/14AfterDBLoadHook/types/servers/HttpServer.d.ts index bbca8af..80c1d48 100644 --- a/TypeScript/14AfterDBLoadHook/types/servers/HttpServer.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/servers/HttpServer.d.ts @@ -4,6 +4,7 @@ import { ApplicationContext } from "../context/ApplicationContext"; import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; import { ILogger } from "../models/spt/utils/ILogger"; +import { LocalisationService } from "../services/LocalisationService"; import { ConfigServer } from "./ConfigServer"; import { DatabaseServer } from "./DatabaseServer"; import { IHttpListener } from "./http/IHttpListener"; @@ -12,11 +13,12 @@ export declare class HttpServer { protected logger: ILogger; protected databaseServer: DatabaseServer; protected httpServerHelper: HttpServerHelper; + protected localisationService: LocalisationService; protected httpListeners: IHttpListener[]; protected configServer: ConfigServer; protected applicationContext: ApplicationContext; protected webSocketServer: WebSocketServer; - constructor(logger: ILogger, databaseServer: DatabaseServer, httpServerHelper: HttpServerHelper, httpListeners: IHttpListener[], configServer: ConfigServer, applicationContext: ApplicationContext, webSocketServer: WebSocketServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, httpServerHelper: HttpServerHelper, localisationService: LocalisationService, httpListeners: IHttpListener[], configServer: ConfigServer, applicationContext: ApplicationContext, webSocketServer: WebSocketServer); protected httpConfig: IHttpConfig; getCookies(req: http.IncomingMessage): any; handleRequest(req: IncomingMessage, resp: ServerResponse): void; diff --git a/TypeScript/14AfterDBLoadHook/types/servers/SaveServer.d.ts b/TypeScript/14AfterDBLoadHook/types/servers/SaveServer.d.ts index cb28f49..4dca514 100644 --- a/TypeScript/14AfterDBLoadHook/types/servers/SaveServer.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/servers/SaveServer.d.ts @@ -1,20 +1,22 @@ +import { SaveLoadRouter } from "../di/Router"; import { IAkiProfile, Info } from "../models/eft/profile/IAkiProfile"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { VFS } from "../utils/VFS"; -import { SaveLoadRouter } from "../di/Router"; -import { ILogger } from "../models/spt/utils/ILogger"; export declare class SaveServer { protected vfs: VFS; protected saveLoadRouters: SaveLoadRouter[]; protected jsonUtil: JsonUtil; protected hashUtil: HashUtil; + protected localisationService: LocalisationService; protected logger: ILogger; protected profileFilepath: string; protected profiles: {}; protected onSave: {}; protected saveMd5: {}; - constructor(vfs: VFS, saveLoadRouters: SaveLoadRouter[], jsonUtil: JsonUtil, hashUtil: HashUtil, logger: ILogger); + constructor(vfs: VFS, saveLoadRouters: SaveLoadRouter[], jsonUtil: JsonUtil, hashUtil: HashUtil, localisationService: LocalisationService, logger: ILogger); load(): void; save(): void; getProfile(sessionId: string): IAkiProfile; diff --git a/TypeScript/14AfterDBLoadHook/types/servers/WebSocketServer.d.ts b/TypeScript/14AfterDBLoadHook/types/servers/WebSocketServer.d.ts index f33d214..5d40e6e 100644 --- a/TypeScript/14AfterDBLoadHook/types/servers/WebSocketServer.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/servers/WebSocketServer.d.ts @@ -1,18 +1,20 @@ /// -import { HttpServerHelper } from "../helpers/HttpServerHelper"; -import WebSocket from "ws"; import http, { IncomingMessage } from "http"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { RandomUtil } from "../utils/RandomUtil"; +import WebSocket from "ws"; +import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { INotification } from "../models/eft/notifier/INotifier"; -import { ConfigServer } from "./ConfigServer"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { LocalisationService } from "../services/LocalisationService"; +import { RandomUtil } from "../utils/RandomUtil"; +import { ConfigServer } from "./ConfigServer"; export declare class WebSocketServer { protected logger: ILogger; protected randomUtil: RandomUtil; protected configServer: ConfigServer; + protected localisationService: LocalisationService; protected httpServerHelper: HttpServerHelper; - constructor(logger: ILogger, randomUtil: RandomUtil, configServer: ConfigServer, httpServerHelper: HttpServerHelper); + constructor(logger: ILogger, randomUtil: RandomUtil, configServer: ConfigServer, localisationService: LocalisationService, httpServerHelper: HttpServerHelper); protected httpConfig: IHttpConfig; protected defaultNotification: INotification; protected webSockets: Record; diff --git a/TypeScript/14AfterDBLoadHook/types/servers/http/AkiHttpListener.d.ts b/TypeScript/14AfterDBLoadHook/types/servers/http/AkiHttpListener.d.ts index 6f78939..acf92aa 100644 --- a/TypeScript/14AfterDBLoadHook/types/servers/http/AkiHttpListener.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/servers/http/AkiHttpListener.d.ts @@ -1,22 +1,24 @@ /// /// import { IncomingMessage, ServerResponse } from "http"; -import { IHttpListener } from "./IHttpListener"; import { Serializer } from "../../di/Serializer"; import { ILogger } from "../../models/spt/utils/ILogger"; import { HttpRouter } from "../../routers/HttpRouter"; +import { LocalisationService } from "../../services/LocalisationService"; import { HttpResponseUtil } from "../../utils/HttpResponseUtil"; import { JsonUtil } from "../../utils/JsonUtil"; import { HttpBufferHandler } from "./HttpBufferHandler"; +import { IHttpListener } from "./IHttpListener"; export declare class AkiHttpListener implements IHttpListener { protected httpRouter: HttpRouter; protected serializers: Serializer[]; protected logger: ILogger; protected jsonUtil: JsonUtil; protected httpResponse: HttpResponseUtil; + protected localisationService: LocalisationService; protected httpBufferHandler: HttpBufferHandler; constructor(httpRouter: HttpRouter, // TODO: delay required - serializers: Serializer[], logger: ILogger, jsonUtil: JsonUtil, httpResponse: HttpResponseUtil, httpBufferHandler: HttpBufferHandler); + serializers: Serializer[], logger: ILogger, jsonUtil: JsonUtil, httpResponse: HttpResponseUtil, localisationService: LocalisationService, httpBufferHandler: HttpBufferHandler); canHandle(_: string, req: IncomingMessage): boolean; handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): void; sendResponse(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: Buffer, output: string): void; diff --git a/TypeScript/14AfterDBLoadHook/types/services/BotEquipmentFilterService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/BotEquipmentFilterService.d.ts index 632f961..ae72cc3 100644 --- a/TypeScript/14AfterDBLoadHook/types/services/BotEquipmentFilterService.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/services/BotEquipmentFilterService.d.ts @@ -1,12 +1,12 @@ import { IBotType } from "../models/eft/common/tables/IBotType"; -import { EquipmentFilters, EquipmentFilterDetails, IBotConfig } from "../models/spt/config/IBotConfig"; +import { EquipmentFilters, EquipmentFilterDetails, IBotConfig, WeightingAdjustmentDetails } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; export declare class BotEquipmentFilterService { protected logger: ILogger; protected configServer: ConfigServer; protected botConfig: IBotConfig; - protected botEquipmentFilterlists: Record; + protected botEquipmentConfig: Record; constructor(logger: ILogger, configServer: ConfigServer); /** * Filter a bots data to exclude equipment and cartridges defines in the botConfig @@ -30,6 +30,20 @@ export declare class BotEquipmentFilterService { * @returns EquipmentFilterDetails object */ protected getBotEquipmentWhitelist(botRole: string, playerLevel: number): EquipmentFilterDetails; + /** + * Retreive clothing weighting adjustments from bot.json config + * @param botRole Bot type to get adjustments for + * @param playerLevel level of player + * @returns Weighting adjustments for bots clothing + */ + protected getBotClothingAdjustments(botRole: string, playerLevel: number): WeightingAdjustmentDetails; + /** + * Retreive item weighting adjustments from bot.json config + * @param botRole Bot type to get adjustments for + * @param playerLevel level of player + * @returns Weighting adjustments for bot items + */ + protected getBotWeightingAdjustments(botRole: string, playerLevel: number): WeightingAdjustmentDetails; /** * Filter bot equipment based on blacklist and whitelist from config/bot.json * Prioritises whitelist first, if one is found blacklist is ignored @@ -47,4 +61,10 @@ export declare class BotEquipmentFilterService { * @returns Filtered bot file */ protected filterCartridges(baseBotNode: IBotType, blacklist: EquipmentFilterDetails, whitelist: EquipmentFilterDetails): void; + /** + * Add/Edit weighting changes to bot items using values from config/bot.json/equipment + * @param weightingAdjustments Weighting change to apply to bot + * @param botItemPool Bot item dictionary to adjust + */ + protected adjustWeighting(weightingAdjustments: WeightingAdjustmentDetails, botItemPool: Record): void; } diff --git a/TypeScript/14AfterDBLoadHook/types/services/BotGenerationCacheService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/BotGenerationCacheService.d.ts index ba53fec..0be0576 100644 --- a/TypeScript/14AfterDBLoadHook/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/services/BotGenerationCacheService.d.ts @@ -8,11 +8,11 @@ export declare class BotGenerationCacheService { protected randomUtil: RandomUtil; protected jsonUtil: JsonUtil; protected botHelper: BotHelper; - protected storedBots: IBotBase[]; + protected storedBots: Map; constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, botHelper: BotHelper); /** * Store array of bots in cache, shuffle results before storage - * @param botsToStore + * @param botsToStore Bots we want to store in the cache */ storeBots(botsToStore: IBotBase[]): void; /** @@ -21,25 +21,7 @@ export declare class BotGenerationCacheService { * @param role role to retreive (assault/bossTagilla etc) * @returns IBotBase object */ - getBot(role: string): IBotBase[]; - /** - * Find a bot by its index from cache - * @param indexOfBotToReturn index to find bot by - * @returns bot profile - */ - protected getBotFromCache(indexOfBotToReturn: number): IBotBase; - /** - * Remove bot profile by index from cache - * @param indexOfBotToReturn Index of bot profile to remove - */ - protected removeBotFromCache(indexOfBotToReturn: number): void; - /** - * Get index of bot profile that matches criteria - * @param role Role of bot wanted - * @param getPmc Requested bot a pmc - * @returns index of found bot, -1 if not found - */ - protected getIndexOfBotToReturn(role: string, getPmc: boolean): number; + getBot(role: string): IBotBase; /** * Remove all cached bot profiles */ @@ -48,5 +30,5 @@ export declare class BotGenerationCacheService { * Does cache have bots * @returns true if empty */ - cacheIsEmpty(): boolean; + cacheHasBotOfRole(role: string): boolean; } diff --git a/TypeScript/14AfterDBLoadHook/types/services/LocaleService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/LocaleService.d.ts index 33bea7b..8275b75 100644 --- a/TypeScript/14AfterDBLoadHook/types/services/LocaleService.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/services/LocaleService.d.ts @@ -1,14 +1,42 @@ import { ILocaleConfig } from "../models/spt/config/ILocaleConfig"; +import { ILocaleGlobalBase } from "../models/spt/server/ILocaleBase"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +/** + * Handles getting locales from config or users machine + */ export declare class LocaleService { protected logger: ILogger; + protected databaseServer: DatabaseServer; protected configServer: ConfigServer; protected localeConfig: ILocaleConfig; - constructor(logger: ILogger, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, configServer: ConfigServer); /** - * Gets the locale key from the locale.json file + * Get the eft globals db file based on the configured locale in config/locale.json, if not found, fall back to 'en' + * @returns ILocaleGlobalBase + */ + getLocaleDb(): ILocaleGlobalBase; + /** + * Gets the game locale key from the locale.json file, + * if value is 'system' get system locale * @returns locale e.g en/ge/cz/cn */ - getDesiredLocale(): string; + getDesiredGameLocale(): string; + /** + * Gets the game locale key from the locale.json file, + * if value is 'system' get system locale + * @returns locale e.g en/ge/cz/cn + */ + getDesiredServerLocale(): string; + /** + * Get array of languages supported for localisation + * @returns array of locales e.g. en/fr/cn + */ + getServerSupportedLocales(): string[]; + /** + * Get the locale of the computer running the server + * @returns langage part of locale e.g. 'en' part of 'en-US' + */ + protected getPlatformLocale(): string; } diff --git a/TypeScript/14AfterDBLoadHook/types/services/LocalisationService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/LocalisationService.d.ts new file mode 100644 index 0000000..519325d --- /dev/null +++ b/TypeScript/14AfterDBLoadHook/types/services/LocalisationService.d.ts @@ -0,0 +1,21 @@ +import { I18n } from "i18n"; +import { ILocaleConfig } from "../models/spt/config/ILocaleConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { LocaleService } from "./LocaleService"; +/** + * Handles translating server text into different langauges + */ +export declare class LocalisationService { + protected logger: ILogger; + protected localeService: LocaleService; + protected localeConfig: ILocaleConfig; + protected i18n: I18n; + constructor(logger: ILogger, localeService: LocaleService); + /** + * Get a localised value using the passed in key + * @param key Key to loop up locale for + * @param args optional arguments + * @returns Localised string + */ + getText(key: string, args?: any): string; +} diff --git a/TypeScript/14AfterDBLoadHook/types/services/PaymentService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/PaymentService.d.ts index a5e538f..c9ce95a 100644 --- a/TypeScript/14AfterDBLoadHook/types/services/PaymentService.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/services/PaymentService.d.ts @@ -11,6 +11,7 @@ import { IProcessSellTradeRequestData } from "../models/eft/trade/IProcessSellTr import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +import { LocalisationService } from "./LocalisationService"; export declare class PaymentService { protected logger: ILogger; protected httpResponse: HttpResponseUtil; @@ -19,8 +20,9 @@ export declare class PaymentService { protected traderHelper: TraderHelper; protected itemHelper: ItemHelper; protected inventoryHelper: InventoryHelper; + protected localisationService: LocalisationService; protected paymentHelper: PaymentHelper; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, traderHelper: TraderHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper); + constructor(logger: ILogger, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, traderHelper: TraderHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, localisationService: LocalisationService, paymentHelper: PaymentHelper); /** * Take money and insert items into return to server request * @param {Object} pmcData @@ -50,7 +52,7 @@ export declare class PaymentService { * @param pmcData Player profile to find and remove currency from * @param currencyTpl Type of currency to pay * @param amountToPay money value to pay - * @param sessionID Sessino id + * @param sessionID Session id * @param output output object to send to client * @returns IItemEventRouterResponse */ diff --git a/TypeScript/14AfterDBLoadHook/types/services/PlayerService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/PlayerService.d.ts index 519b7e5..2f364d5 100644 --- a/TypeScript/14AfterDBLoadHook/types/services/PlayerService.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/services/PlayerService.d.ts @@ -2,10 +2,12 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { IPlayerIncrementSkillLevelRequestData } from "../models/eft/player/IPlayerIncrementSkillLevelRequestData"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "./LocalisationService"; export declare class PlayerService { protected logger: ILogger; + protected localisationService: LocalisationService; protected databaseServer: DatabaseServer; - constructor(logger: ILogger, databaseServer: DatabaseServer); + constructor(logger: ILogger, localisationService: LocalisationService, databaseServer: DatabaseServer); /** * increases the profile skill and updates any output * @param {Object} pmcData diff --git a/TypeScript/14AfterDBLoadHook/types/services/PmcAiService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/PmcAiService.d.ts deleted file mode 100644 index 0690f1f..0000000 --- a/TypeScript/14AfterDBLoadHook/types/services/PmcAiService.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { IBotConfig } from "../models/spt/config/IBotConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { ConfigServer } from "../servers/ConfigServer"; -/** Storing/retreving pmcRoles set at the start of a raid - its done at that point as we know what location the player is heading to */ -export declare class PmcAiService { - protected logger: ILogger; - protected configServer: ConfigServer; - protected botConfig: IBotConfig; - protected usecRole: string; - protected bearRole: string; - constructor(logger: ILogger, configServer: ConfigServer); - /** - * Convert from pmc side (usec/bear) to the side as defined in the bot config (usecType/bearType) - * @param pmcSide eft side (usec/bear) - * @returns pmc side as defined in config - */ - getPmcRole(pmcSide: "usec" | "bear" | string): string; - /** - * Set the roles for pmcs - * @param location map location to look up and use as pmc types - */ - setPmcRolesByLocation(location: string): void; - /** - * Clear the saved role from usec/bear PMCs - */ - clearPmcRoles(): void; -} diff --git a/TypeScript/14AfterDBLoadHook/types/services/ProfileFixerService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/ProfileFixerService.d.ts index e772919..86a6af8 100644 --- a/TypeScript/14AfterDBLoadHook/types/services/ProfileFixerService.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/services/ProfileFixerService.d.ts @@ -8,12 +8,14 @@ import { HideoutAreas } from "../models/enums/HideoutAreas"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { Watermark } from "../utils/Watermark"; +import { LocalisationService } from "./LocalisationService"; export declare class ProfileFixerService { protected logger: ILogger; protected watermark: Watermark; protected hideoutHelper: HideoutHelper; + protected localisationService: LocalisationService; protected databaseServer: DatabaseServer; - constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, databaseServer: DatabaseServer); + constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, localisationService: LocalisationService, databaseServer: DatabaseServer); /** * Find issues in the pmc profile data that may cause issues and fix them * @param pmcProfile profile to check and fix diff --git a/TypeScript/14AfterDBLoadHook/types/services/RagfairOfferService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/RagfairOfferService.d.ts index a6f6b6d..86c1e52 100644 --- a/TypeScript/14AfterDBLoadHook/types/services/RagfairOfferService.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/services/RagfairOfferService.d.ts @@ -11,6 +11,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { TimeUtil } from "../utils/TimeUtil"; +import { LocalisationService } from "./LocalisationService"; import { RagfairCategoriesService } from "./RagfairCategoriesService"; export declare class RagfairOfferService { protected logger: ILogger; @@ -22,12 +23,14 @@ export declare class RagfairOfferService { protected profileHelper: ProfileHelper; protected eventOutputHolder: EventOutputHolder; protected httpResponse: HttpResponseUtil; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected playerOffersLoaded: boolean; protected expiredOffers: Item[]; - protected offers: IRagfairOffer[]; + /** offerId, offer */ + protected offers: Record; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, databaseServer: DatabaseServer, saveServer: SaveServer, ragfairServerHelper: RagfairServerHelper, ragfairCategoriesService: RagfairCategoriesService, profileHelper: ProfileHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, databaseServer: DatabaseServer, saveServer: SaveServer, ragfairServerHelper: RagfairServerHelper, ragfairCategoriesService: RagfairCategoriesService, profileHelper: ProfileHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, localisationService: LocalisationService, configServer: ConfigServer); /** * Get all offers * @returns IRagfairOffer array diff --git a/TypeScript/14AfterDBLoadHook/types/utils/App.d.ts b/TypeScript/14AfterDBLoadHook/types/utils/App.d.ts index dcc2669..cc8a5af 100644 --- a/TypeScript/14AfterDBLoadHook/types/utils/App.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/utils/App.d.ts @@ -1,14 +1,16 @@ -import { TimeUtil } from "./TimeUtil"; import { OnLoad } from "../di/OnLoad"; import { OnUpdate } from "../di/OnUpdate"; import { ILogger } from "../models/spt/utils/ILogger"; +import { LocalisationService } from "../services/LocalisationService"; +import { TimeUtil } from "./TimeUtil"; export declare class App { protected logger: ILogger; protected timeUtil: TimeUtil; + protected localisationService: LocalisationService; protected onLoadComponents: OnLoad[]; protected onUpdateComponents: OnUpdate[]; protected onUpdateLastRun: {}; - constructor(logger: ILogger, timeUtil: TimeUtil, onLoadComponents: OnLoad[], onUpdateComponents: OnUpdate[]); + constructor(logger: ILogger, timeUtil: TimeUtil, localisationService: LocalisationService, onLoadComponents: OnLoad[], onUpdateComponents: OnUpdate[]); load(): void; protected update(onUpdateComponents: OnUpdate[]): void; protected logUpdateException(err: any, updateable: OnUpdate): void; diff --git a/TypeScript/14AfterDBLoadHook/types/utils/DatabaseImporter.d.ts b/TypeScript/14AfterDBLoadHook/types/utils/DatabaseImporter.d.ts index 483e135..31670ae 100644 --- a/TypeScript/14AfterDBLoadHook/types/utils/DatabaseImporter.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/utils/DatabaseImporter.d.ts @@ -3,15 +3,17 @@ import { IDatabaseTables } from "../models/spt/server/IDatabaseTables"; import { ILogger } from "../models/spt/utils/ILogger"; import { ImageRouter } from "../routers/ImageRouter"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { JsonUtil } from "./JsonUtil"; import { VFS } from "./VFS"; export declare class DatabaseImporter extends OnLoad { protected logger: ILogger; protected vfs: VFS; protected jsonUtil: JsonUtil; + protected localisationService: LocalisationService; protected databaseServer: DatabaseServer; protected imageRouter: ImageRouter; - constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, databaseServer: DatabaseServer, imageRouter: ImageRouter); + constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, localisationService: LocalisationService, databaseServer: DatabaseServer, imageRouter: ImageRouter); onLoad(): void; /** * Read all json files in database folder and map into a json object diff --git a/TypeScript/14AfterDBLoadHook/types/utils/HttpResponseUtil.d.ts b/TypeScript/14AfterDBLoadHook/types/utils/HttpResponseUtil.d.ts index 29502be..3a78618 100644 --- a/TypeScript/14AfterDBLoadHook/types/utils/HttpResponseUtil.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/utils/HttpResponseUtil.d.ts @@ -1,10 +1,13 @@ -import { JsonUtil } from "./JsonUtil"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { INullResponseData } from "../models/eft/httpResponse/INullResponseData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; +import { BackendErrorCodes } from "../models/enums/BackendErrorCodes"; +import { LocalisationService } from "../services/LocalisationService"; +import { JsonUtil } from "./JsonUtil"; export declare class HttpResponseUtil { protected jsonUtil: JsonUtil; - constructor(jsonUtil: JsonUtil); + protected localisationService: LocalisationService; + constructor(jsonUtil: JsonUtil, localisationService: LocalisationService); protected clearString(s: string): any; noBody(data: any): any; getBody(data: T, err?: number, errmsg?: any): IGetBodyResponseData; @@ -12,5 +15,5 @@ export declare class HttpResponseUtil { emptyResponse(): IGetBodyResponseData; nullResponse(): INullResponseData; emptyArrayResponse(): IGetBodyResponseData; - appendErrorToOutput(output: IItemEventRouterResponse, message?: string, title?: string): IItemEventRouterResponse; + appendErrorToOutput(output: IItemEventRouterResponse, message?: string, errorCode?: BackendErrorCodes): IItemEventRouterResponse; } diff --git a/TypeScript/14AfterDBLoadHook/types/utils/RandomUtil.d.ts b/TypeScript/14AfterDBLoadHook/types/utils/RandomUtil.d.ts index 633e472..aa556e3 100644 --- a/TypeScript/14AfterDBLoadHook/types/utils/RandomUtil.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/utils/RandomUtil.d.ts @@ -110,6 +110,12 @@ export declare class RandomUtil { getIntEx(max: number): number; getFloat(min: number, max: number): number; getBool(): boolean; + /** + * Check if number passes a check out of 100 + * @param chancePercent value check needs to be above + * @returns true if value passes check + */ + getChance100(chancePercent: number): boolean; getStringArrayValue(arr: string[]): string; getArrayValue(arr: T[]): T; getKey(node: any): string; diff --git a/TypeScript/14AfterDBLoadHook/types/utils/Watermark.d.ts b/TypeScript/14AfterDBLoadHook/types/utils/Watermark.d.ts index c6dc120..e02eba2 100644 --- a/TypeScript/14AfterDBLoadHook/types/utils/Watermark.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/utils/Watermark.d.ts @@ -1,20 +1,15 @@ import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { LocalisationService } from "../services/LocalisationService"; export declare class WatermarkLocale { - protected locales: { - "en-US": { - description: string[]; - warning: string[]; - modding: string[]; - }; - "zh-CN": { - description: string[]; - warning: string[]; - modding: string[]; - }; + protected localisationService: LocalisationService; + constructor(localisationService: LocalisationService); + protected watermark: { + description: string[]; + warning: string[]; + modding: string[]; }; - getLocale(): string; getDescription(): string[]; getWarning(): string[]; getModding(): string[]; @@ -22,9 +17,10 @@ export declare class WatermarkLocale { export declare class Watermark { protected logger: ILogger; protected configServer: ConfigServer; + protected localisationService: LocalisationService; protected watermarkLocale?: WatermarkLocale; protected akiConfig: ICoreConfig; - constructor(logger: ILogger, configServer: ConfigServer, watermarkLocale?: WatermarkLocale); + constructor(logger: ILogger, configServer: ConfigServer, localisationService: LocalisationService, watermarkLocale?: WatermarkLocale); protected text: string[]; protected versionLabel: string; initialize(): void; diff --git a/TypeScript/15HttpListenerExample/types/callbacks/BotCallbacks.d.ts b/TypeScript/15HttpListenerExample/types/callbacks/BotCallbacks.d.ts index 2db60dc..827015e 100644 --- a/TypeScript/15HttpListenerExample/types/callbacks/BotCallbacks.d.ts +++ b/TypeScript/15HttpListenerExample/types/callbacks/BotCallbacks.d.ts @@ -8,8 +8,29 @@ export declare class BotCallbacks { protected botController: BotController; protected httpResponse: HttpResponseUtil; constructor(botController: BotController, httpResponse: HttpResponseUtil); + /** + * Handle singleplayer/settings/bot/limit + * @returns string + */ getBotLimit(url: string, info: IEmptyRequestData, sessionID: string): string; + /** + * Handle singleplayer/settings/bot/difficulty + * @returns string + */ getBotDifficulty(url: string, info: IEmptyRequestData, sessionID: string): string; + /** + * Handle client/game/bot/generate + * @returns IGetBodyResponseData + */ generateBots(url: string, info: IGenerateBotsRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle singleplayer/settings/bot/maxCap + * @returns string + */ getBotCap(): string; + /** + * Handle singleplayer/settings/bot/getBotBehaviours + * @returns string + */ + getBotBehaviours(): string; } diff --git a/TypeScript/15HttpListenerExample/types/callbacks/CustomizationCallbacks.d.ts b/TypeScript/15HttpListenerExample/types/callbacks/CustomizationCallbacks.d.ts index 3bab8c0..75d5701 100644 --- a/TypeScript/15HttpListenerExample/types/callbacks/CustomizationCallbacks.d.ts +++ b/TypeScript/15HttpListenerExample/types/callbacks/CustomizationCallbacks.d.ts @@ -3,6 +3,7 @@ import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { IPmcData } from "../models/eft/common/IPmcData"; import { ISuit } from "../models/eft/common/tables/ITrader"; import { IBuyClothingRequestData } from "../models/eft/customization/IBuyClothingRequestData"; +import { IGetSuitsResponse } from "../models/eft/customization/IGetSuitsResponse"; import { IWearClothingRequestData } from "../models/eft/customization/IWearClothingRequestData"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; @@ -13,10 +14,15 @@ export declare class CustomizationCallbacks { protected saveServer: SaveServer; protected httpResponse: HttpResponseUtil; constructor(customizationController: CustomizationController, saveServer: SaveServer, httpResponse: HttpResponseUtil); - getSuits(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<{ - _id: string; - suites: string[]; - }>; + /** + * Handles client/trading/customization/storage + * @returns + */ + getSuits(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handles client/trading/customization + * @returns ISuit[] + */ getTraderSuits(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; wearClothing(pmcData: IPmcData, body: IWearClothingRequestData, sessionID: string): IItemEventRouterResponse; buyClothing(pmcData: IPmcData, body: IBuyClothingRequestData, sessionID: string): IItemEventRouterResponse; diff --git a/TypeScript/15HttpListenerExample/types/callbacks/DataCallbacks.d.ts b/TypeScript/15HttpListenerExample/types/callbacks/DataCallbacks.d.ts index 04566ff..2efcf81 100644 --- a/TypeScript/15HttpListenerExample/types/callbacks/DataCallbacks.d.ts +++ b/TypeScript/15HttpListenerExample/types/callbacks/DataCallbacks.d.ts @@ -12,15 +12,42 @@ import { ILanguageBase } from "../models/spt/server/ILocaleBase"; import { ISettingsBase } from "../models/spt/server/ISettingsBase"; import { DatabaseServer } from "../servers/DatabaseServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +/** + * Handle client requests + */ export declare class DataCallbacks { protected httpResponse: HttpResponseUtil; protected databaseServer: DatabaseServer; constructor(httpResponse: HttpResponseUtil, databaseServer: DatabaseServer); + /** + * Handles client/settings + * @returns ISettingsBase + */ getSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handles client/globals + * @returns IGlobals + */ getGlobals(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handles client/items + * @returns string + */ getTemplateItems(url: string, info: IEmptyRequestData, sessionID: string): string; + /** + * Handles client/handbook/templates + * @returns IHandbookBase + */ getTemplateHandbook(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handles client/customization + * @returns Record>; + /** + * Handles client/account/customization + * @returns string[] + */ getTemplateCharacter(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getTemplateQuests(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getHideoutSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; @@ -28,6 +55,6 @@ export declare class DataCallbacks { gethideoutProduction(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getHideoutScavcase(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getLocalesLanguages(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - getLocalesMenu(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + getLocalesMenu(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getLocalesGlobal(url: string, info: IEmptyRequestData, sessionID: string): string; } diff --git a/TypeScript/15HttpListenerExample/types/callbacks/DialogueCallbacks.d.ts b/TypeScript/15HttpListenerExample/types/callbacks/DialogueCallbacks.d.ts index 634f90b..7b2eeae 100644 --- a/TypeScript/15HttpListenerExample/types/callbacks/DialogueCallbacks.d.ts +++ b/TypeScript/15HttpListenerExample/types/callbacks/DialogueCallbacks.d.ts @@ -26,15 +26,27 @@ export declare class DialogueCallbacks extends OnUpdate { protected httpResponse: HttpResponseUtil; protected dialogueController: DialogueController; constructor(hashUtil: HashUtil, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, dialogueController: DialogueController); + /** + * Handles client/friend/list + * @returns IGetFriendListDataResponse + */ getFriendList(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handles client/chatServer/list + * @returns + */ getChatServerList(url: string, info: IGetChatServerListRequestData, sessionID: string): IGetBodyResponseData; getMailDialogList(url: string, info: IGetMailDialogListRequestData, sessionID: string): IGetBodyResponseData; getMailDialogView(url: string, info: IGetMailDialogViewRequestData, sessionID: string): IGetBodyResponseData; - getMailDialogInfo(url: string, info: IGetMailDialogInfoRequestData, sessionID: string): IGetBodyResponseData; + getMailDialogInfo(url: string, info: IGetMailDialogInfoRequestData, sessionID: string): IGetBodyResponseData; removeDialog(url: string, info: IRemoveDialogRequestData, sessionID: string): IGetBodyResponseData; pinDialog(url: string, info: IPinDialogRequestData, sessionID: string): IGetBodyResponseData; unpinDialog(url: string, info: IPinDialogRequestData, sessionID: string): IGetBodyResponseData; setRead(url: string, info: ISetDialogReadRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handles client/mail/dialog/getAllAttachments + * @returns IGetAllAttachmentsResponse + */ getAllAttachments(url: string, info: IGetAllAttachmentsRequestData, sessionID: string): IGetBodyResponseData; listOutbox(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; listInbox(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; diff --git a/TypeScript/15HttpListenerExample/types/callbacks/GameCallbacks.d.ts b/TypeScript/15HttpListenerExample/types/callbacks/GameCallbacks.d.ts index 5e4c240..3a6b7e6 100644 --- a/TypeScript/15HttpListenerExample/types/callbacks/GameCallbacks.d.ts +++ b/TypeScript/15HttpListenerExample/types/callbacks/GameCallbacks.d.ts @@ -3,6 +3,9 @@ import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { ICheckVersionResponse } from "../models/eft/game/ICheckVersionResponse"; import { IGameConfigResponse } from "../models/eft/game/IGameConfigResponse"; import { IGameEmptyCrcRequestData } from "../models/eft/game/IGameEmptyCrcRequestData"; +import { IGameKeepAliveResponse } from "../models/eft/game/IGameKeepAliveResponse"; +import { IGameLogoutResponseData } from "../models/eft/game/IGameLogoutResponseData"; +import { IGameStartResponse } from "../models/eft/game/IGameStartResponse"; import { IReportNicknameRequestData } from "../models/eft/game/IReportNicknameRequestData"; import { IServerDetails } from "../models/eft/game/IServerDetails"; import { IVersionValidateRequestData } from "../models/eft/game/IVersionValidateRequestData"; @@ -15,13 +18,37 @@ declare class GameCallbacks { protected watermark: Watermark; protected gameController: GameController; constructor(httpResponse: HttpResponseUtil, watermark: Watermark, gameController: GameController); + /** + * Handle client/game/version/validate + * @returns INullResponseData + */ versionValidate(url: string, info: IVersionValidateRequestData, sessionID: string): INullResponseData; - gameStart(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - gameLogout(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/game/start + * @returns IGameStartResponse + */ + gameStart(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/game/logout + * @returns IGameLogoutResponseData + */ + gameLogout(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/game/config + * @returns IGameConfigResponse + */ getGameConfig(url: string, info: IGameEmptyCrcRequestData, sessionID: string): IGetBodyResponseData; getServer(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; validateGameVersion(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - gameKeepalive(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/game/keepalive + * @returns IGameKeepAliveResponse + */ + gameKeepalive(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle singleplayer/settings/version + * @returns string + */ getVersion(url: string, info: IEmptyRequestData, sessionID: string): string; reportNickname(url: string, info: IReportNicknameRequestData, sessionID: string): INullResponseData; } diff --git a/TypeScript/15HttpListenerExample/types/callbacks/HealthCallbacks.d.ts b/TypeScript/15HttpListenerExample/types/callbacks/HealthCallbacks.d.ts index 8672be7..7edf03e 100644 --- a/TypeScript/15HttpListenerExample/types/callbacks/HealthCallbacks.d.ts +++ b/TypeScript/15HttpListenerExample/types/callbacks/HealthCallbacks.d.ts @@ -21,7 +21,19 @@ export declare class HealthCallbacks { * @returns empty response, no data sent back to client */ syncHealth(url: string, info: ISyncHealthRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle Eat + * @returns IItemEventRouterResponse + */ offraidEat(pmcData: IPmcData, body: IOffraidEatRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle Heal + * @returns IItemEventRouterResponse + */ offraidHeal(pmcData: IPmcData, body: IOffraidHealRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle RestoreHealth + * @returns IItemEventRouterResponse + */ healthTreatment(pmcData: IPmcData, info: IHealthTreatmentRequestData, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/15HttpListenerExample/types/callbacks/HideoutCallbacks.d.ts b/TypeScript/15HttpListenerExample/types/callbacks/HideoutCallbacks.d.ts index 99ab4c9..e39e806 100644 --- a/TypeScript/15HttpListenerExample/types/callbacks/HideoutCallbacks.d.ts +++ b/TypeScript/15HttpListenerExample/types/callbacks/HideoutCallbacks.d.ts @@ -19,14 +19,77 @@ export declare class HideoutCallbacks extends OnUpdate { protected hideoutConfig: IHideoutConfig; constructor(hideoutController: HideoutController, // TODO: delay needed configServer: ConfigServer); + /** + * Handle HideoutUpgrade + * @param pmcData + * @param body + * @param sessionID + * @returns + */ upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutUpgradeComplete + * @param pmcData + * @param body + * @param sessionID + * @returns + */ upgradeComplete(pmcData: IPmcData, body: IHideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutPutItemsInAreaSlots + * @param pmcData + * @param body + * @param sessionID + * @returns + */ putItemsInAreaSlots(pmcData: IPmcData, body: IHideoutPutItemInRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutTakeItemsFromAreaSlots + * @param pmcData + * @param body + * @param sessionID + * @returns + */ takeItemsFromAreaSlots(pmcData: IPmcData, body: IHideoutTakeItemOutRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutToggleArea + * @param pmcData + * @param body + * @param sessionID + * @returns + */ toggleArea(pmcData: IPmcData, body: IHideoutToggleAreaRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutSingleProductionStart + * @param pmcData + * @param body + * @param sessionID + * @returns + */ singleProductionStart(pmcData: IPmcData, body: IHideoutSingleProductionStartRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutScavCaseProductionStart + * @param pmcData + * @param body + * @param sessionID + * @returns + */ scavCaseProductionStart(pmcData: IPmcData, body: IHideoutScavCaseStartRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutContinuousProductionStart + * @param pmcData + * @param body + * @param sessionID + * @returns + */ continuousProductionStart(pmcData: IPmcData, body: IHideoutContinousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutTakeProduction + * @param pmcData + * @param body + * @param sessionID + * @returns + */ takeProduction(pmcData: IPmcData, body: IHideoutTakeProductionRequestData, sessionID: string): IItemEventRouterResponse; onUpdate(timeSinceLastRun: number): boolean; getRoute(): string; diff --git a/TypeScript/15HttpListenerExample/types/callbacks/InraidCallbacks.d.ts b/TypeScript/15HttpListenerExample/types/callbacks/InraidCallbacks.d.ts index 05bcce4..918bfaf 100644 --- a/TypeScript/15HttpListenerExample/types/callbacks/InraidCallbacks.d.ts +++ b/TypeScript/15HttpListenerExample/types/callbacks/InraidCallbacks.d.ts @@ -1,23 +1,49 @@ import { InraidController } from "../controllers/InraidController"; -import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { INullResponseData } from "../models/eft/httpResponse/INullResponseData"; import { IRegisterPlayerRequestData } from "../models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; -import { IAirdropConfig } from "../models/spt/config/IAirdropConfig"; -import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; -import { ConfigServer } from "../servers/ConfigServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +/** + * Handle client requests + */ export declare class InraidCallbacks { protected inraidController: InraidController; protected httpResponse: HttpResponseUtil; - protected configServer: ConfigServer; - protected airdropConfig: IAirdropConfig; - protected inraidConfig: IInRaidConfig; - constructor(inraidController: InraidController, httpResponse: HttpResponseUtil, configServer: ConfigServer); + constructor(inraidController: InraidController, httpResponse: HttpResponseUtil); + /** + * Handle client/location/getLocalloot + * @param url + * @param info register player request + * @param sessionID Session id + * @returns Null http response + */ registerPlayer(url: string, info: IRegisterPlayerRequestData, sessionID: string): INullResponseData; + /** + * Handle raid/profile/save + * @param url + * @param info Save progress request + * @param sessionID Session id + * @returns Null http response + */ saveProgress(url: string, info: ISaveProgressRequestData, sessionID: string): INullResponseData; + /** + * Handle singleplayer/settings/raid/endstate + * @returns + */ getRaidEndState(): string; - getRaidMenuSettings(url: string, info: IEmptyRequestData, sessionID: string): string; - getWeaponDurability(url: string, info: any, sessionID: string): string; - getAirdropConfig(url: string, info: any, sessionID: string): string; + /** + * Handle singleplayer/settings/raid/menu + * @returns JSON as string + */ + getRaidMenuSettings(): string; + /** + * Handle singleplayer/settings/weapon/durability + * @returns + */ + getWeaponDurability(): string; + /** + * Handle singleplayer/airdrop/config + * @returns JSON as string + */ + getAirdropConfig(): string; } diff --git a/TypeScript/15HttpListenerExample/types/callbacks/InsuranceCallbacks.d.ts b/TypeScript/15HttpListenerExample/types/callbacks/InsuranceCallbacks.d.ts index 8835ba2..a171e1c 100644 --- a/TypeScript/15HttpListenerExample/types/callbacks/InsuranceCallbacks.d.ts +++ b/TypeScript/15HttpListenerExample/types/callbacks/InsuranceCallbacks.d.ts @@ -17,7 +17,15 @@ export declare class InsuranceCallbacks extends OnUpdate { protected configServer: ConfigServer; protected insuranceConfig: IInsuranceConfig; constructor(insuranceController: InsuranceController, insuranceService: InsuranceService, httpResponse: HttpResponseUtil, configServer: ConfigServer); + /** + * Handle client/insurance/items/list/cost + * @returns IGetInsuranceCostResponseData + */ getInsuranceCost(url: string, info: IGetInsuranceCostRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle Insure + * @returns IItemEventRouterResponse + */ insure(pmcData: IPmcData, body: IInsureRequestData, sessionID: string): IItemEventRouterResponse; onUpdate(secondsSinceLastRun: number): boolean; getRoute(): string; diff --git a/TypeScript/15HttpListenerExample/types/callbacks/InventoryCallbacks.d.ts b/TypeScript/15HttpListenerExample/types/callbacks/InventoryCallbacks.d.ts index 9ab1486..46bf6fd 100644 --- a/TypeScript/15HttpListenerExample/types/callbacks/InventoryCallbacks.d.ts +++ b/TypeScript/15HttpListenerExample/types/callbacks/InventoryCallbacks.d.ts @@ -16,6 +16,7 @@ import { IInventorySwapRequestData } from "../models/eft/inventory/IInventorySwa import { IInventoryTagRequestData } from "../models/eft/inventory/IInventoryTagRequestData"; import { IInventoryToggleRequestData } from "../models/eft/inventory/IInventoryToggleRequestData"; import { IInventoryTransferRequestData } from "../models/eft/inventory/IInventoryTransferRequestData"; +import { IOpenRandomLootContainerRequestData } from "../models/eft/inventory/IOpenRandomLootContainerRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; export declare class InventoryCallbacks { protected inventoryController: InventoryController; @@ -36,4 +37,5 @@ export declare class InventoryCallbacks { createMapMarker(pmcData: IPmcData, body: IInventoryCreateMarkerRequestData, sessionID: string): IItemEventRouterResponse; deleteMapMarker(pmcData: IPmcData, body: IInventoryDeleteMarkerRequestData, sessionID: string): IItemEventRouterResponse; editMapMarker(pmcData: IPmcData, body: IInventoryEditMarkerRequestData, sessionID: string): IItemEventRouterResponse; + openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/15HttpListenerExample/types/callbacks/ItemEventCallbacks.d.ts b/TypeScript/15HttpListenerExample/types/callbacks/ItemEventCallbacks.d.ts index f4f04f9..fbb0b5f 100644 --- a/TypeScript/15HttpListenerExample/types/callbacks/ItemEventCallbacks.d.ts +++ b/TypeScript/15HttpListenerExample/types/callbacks/ItemEventCallbacks.d.ts @@ -1,4 +1,5 @@ import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; +import { Warning } from "../models/eft/itemEvent/IItemEventRouterBase"; import { IItemEventRouterRequest } from "../models/eft/itemEvent/IItemEventRouterRequest"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { ItemEventRouter } from "../routers/ItemEventRouter"; @@ -8,4 +9,5 @@ export declare class ItemEventCallbacks { protected itemEventRouter: ItemEventRouter; constructor(httpResponse: HttpResponseUtil, itemEventRouter: ItemEventRouter); handleEvents(url: string, info: IItemEventRouterRequest, sessionID: string): IGetBodyResponseData; + protected getErrorCode(warnings: Warning[]): number; } diff --git a/TypeScript/15HttpListenerExample/types/callbacks/MatchCallbacks.d.ts b/TypeScript/15HttpListenerExample/types/callbacks/MatchCallbacks.d.ts index 2a92ef5..10fbc44 100644 --- a/TypeScript/15HttpListenerExample/types/callbacks/MatchCallbacks.d.ts +++ b/TypeScript/15HttpListenerExample/types/callbacks/MatchCallbacks.d.ts @@ -34,6 +34,10 @@ export declare class MatchCallbacks { serverAvailable(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData | IGetBodyResponseData; joinMatch(url: string, info: IJoinMatchRequestData, sessionID: string): IGetBodyResponseData; getMetrics(url: string, info: any, sessionID: string): IGetBodyResponseData; + /** + * Handle client/match/group/status + * @returns + */ getGroupStatus(url: string, info: IGetGroupStatusRequestData, sessionID: string): IGetBodyResponseData; createGroup(url: string, info: ICreateGroupRequestData, sessionID: string): IGetBodyResponseData; deleteGroup(url: string, info: any, sessionID: string): INullResponseData; diff --git a/TypeScript/15HttpListenerExample/types/callbacks/NotifierCallbacks.d.ts b/TypeScript/15HttpListenerExample/types/callbacks/NotifierCallbacks.d.ts index c42058f..fab325b 100644 --- a/TypeScript/15HttpListenerExample/types/callbacks/NotifierCallbacks.d.ts +++ b/TypeScript/15HttpListenerExample/types/callbacks/NotifierCallbacks.d.ts @@ -4,6 +4,7 @@ import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { INotifierChannel } from "../models/eft/notifier/INotifier"; import { ISelectProfileRequestData } from "../models/eft/notifier/ISelectProfileRequestData"; +import { ISelectProfileResponse } from "../models/eft/notifier/ISelectProfileResponse"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; export declare class NotifierCallbacks { protected httpServerHelper: HttpServerHelper; @@ -19,6 +20,10 @@ export declare class NotifierCallbacks { sendNotification(sessionID: string, req: any, resp: any, data: any): void; getNotifier(url: string, info: any, sessionID: string): IGetBodyResponseData; createNotifierChannel(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - selectProfile(url: string, info: ISelectProfileRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/game/profile/select + * @returns ISelectProfileResponse + */ + selectProfile(url: string, info: ISelectProfileRequestData, sessionID: string): IGetBodyResponseData; notify(url: string, info: any, sessionID: string): string; } diff --git a/TypeScript/15HttpListenerExample/types/callbacks/QuestCallbacks.d.ts b/TypeScript/15HttpListenerExample/types/callbacks/QuestCallbacks.d.ts index 559c29e..2a3eb20 100644 --- a/TypeScript/15HttpListenerExample/types/callbacks/QuestCallbacks.d.ts +++ b/TypeScript/15HttpListenerExample/types/callbacks/QuestCallbacks.d.ts @@ -21,6 +21,13 @@ export declare class QuestCallbacks { acceptQuest(pmcData: IPmcData, body: IAcceptQuestRequestData, sessionID: string): IItemEventRouterResponse; completeQuest(pmcData: IPmcData, body: ICompleteQuestRequestData, sessionID: string): IItemEventRouterResponse; handoverQuest(pmcData: IPmcData, body: IHandoverQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle client/quest/list + * @param url + * @param info + * @param sessionID + * @returns + */ listQuests(url: string, info: IListQuestsRequestData, sessionID: string): IGetBodyResponseData; activityPeriods(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; } diff --git a/TypeScript/15HttpListenerExample/types/callbacks/RagfairCallbacks.d.ts b/TypeScript/15HttpListenerExample/types/callbacks/RagfairCallbacks.d.ts index c609f2f..37f3807 100644 --- a/TypeScript/15HttpListenerExample/types/callbacks/RagfairCallbacks.d.ts +++ b/TypeScript/15HttpListenerExample/types/callbacks/RagfairCallbacks.d.ts @@ -35,7 +35,7 @@ export declare class RagfairCallbacks extends OnLoadOnUpdate { getRoute(): string; search(url: string, info: ISearchRequestData, sessionID: string): IGetBodyResponseData; getMarketPrice(url: string, info: IGetMarketPriceRequestData, sessionID: string): IGetBodyResponseData; - getItemPrices(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + getItemPrices(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData>; addOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; removeOffer(pmcData: IPmcData, info: IRemoveOfferRequestData, sessionID: string): IItemEventRouterResponse; extendOffer(pmcData: IPmcData, info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; diff --git a/TypeScript/15HttpListenerExample/types/callbacks/TraderCallbacks.d.ts b/TypeScript/15HttpListenerExample/types/callbacks/TraderCallbacks.d.ts index e4fd099..40a1455 100644 --- a/TypeScript/15HttpListenerExample/types/callbacks/TraderCallbacks.d.ts +++ b/TypeScript/15HttpListenerExample/types/callbacks/TraderCallbacks.d.ts @@ -12,6 +12,10 @@ export declare class TraderCallbacks extends OnLoadOnUpdate { onUpdate(): boolean; getRoute(): string; getTraderSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/trading/api/getUserAssortPrice/trader + * @returns + */ getProfilePurchases(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData>; getTrader(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getAssort(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; diff --git a/TypeScript/15HttpListenerExample/types/callbacks/WeatherCallbacks.d.ts b/TypeScript/15HttpListenerExample/types/callbacks/WeatherCallbacks.d.ts index ae784c8..f9d2002 100644 --- a/TypeScript/15HttpListenerExample/types/callbacks/WeatherCallbacks.d.ts +++ b/TypeScript/15HttpListenerExample/types/callbacks/WeatherCallbacks.d.ts @@ -1,10 +1,15 @@ import { WeatherController } from "../controllers/WeatherController"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; +import { IWeatherData } from "../models/eft/weather/IWeatherData"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; export declare class WeatherCallbacks { protected httpResponse: HttpResponseUtil; protected weatherController: WeatherController; constructor(httpResponse: HttpResponseUtil, weatherController: WeatherController); - getWeather(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/weather + * @returns IWeatherData + */ + getWeather(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; } diff --git a/TypeScript/15HttpListenerExample/types/context/ContextVariableType.d.ts b/TypeScript/15HttpListenerExample/types/context/ContextVariableType.d.ts index 5fc1704..a7dd9b5 100644 --- a/TypeScript/15HttpListenerExample/types/context/ContextVariableType.d.ts +++ b/TypeScript/15HttpListenerExample/types/context/ContextVariableType.d.ts @@ -1,4 +1,8 @@ export declare enum ContextVariableType { + /** Logged in users session id */ SESSION_ID = 0, - MATCH_INFO = 1 + /** Currently acive raid information */ + MATCH_INFO = 1, + /** Timestamp when client first connected */ + CLIENT_START_TIMESTAMP = 2 } diff --git a/TypeScript/15HttpListenerExample/types/controllers/BotController.d.ts b/TypeScript/15HttpListenerExample/types/controllers/BotController.d.ts index a5111d5..92317c3 100644 --- a/TypeScript/15HttpListenerExample/types/controllers/BotController.d.ts +++ b/TypeScript/15HttpListenerExample/types/controllers/BotController.d.ts @@ -1,6 +1,8 @@ import { ApplicationContext } from "../context/ApplicationContext"; import { BotGenerator } from "../generators/BotGenerator"; +import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { IGenerateBotsRequestData } from "../models/eft/bot/IGenerateBotsRequestData"; import { IBotBase } from "../models/eft/common/tables/IBotBase"; import { IBotCore } from "../models/eft/common/tables/IBotCore"; @@ -10,18 +12,23 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; -import { PmcAiService } from "../services/PmcAiService"; +import { LocalisationService } from "../services/LocalisationService"; +import { JsonUtil } from "../utils/JsonUtil"; export declare class BotController { protected logger: ILogger; protected databaseServer: DatabaseServer; protected botGenerator: BotGenerator; protected botHelper: BotHelper; - protected pmcAiService: PmcAiService; + protected botDifficultyHelper: BotDifficultyHelper; protected botGenerationCacheService: BotGenerationCacheService; + protected localisationService: LocalisationService; + protected weightedRandomHelper: WeightedRandomHelper; protected configServer: ConfigServer; protected applicationContext: ApplicationContext; + protected jsonUtil: JsonUtil; protected botConfig: IBotConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, pmcAiService: PmcAiService, botGenerationCacheService: BotGenerationCacheService, configServer: ConfigServer, applicationContext: ApplicationContext); + static readonly pmcTypeLabel = "PMC"; + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); /** * Return the number of bot loadout varieties to be generated * @param type bot Type we want the loadout gen count for @@ -37,7 +44,6 @@ export declare class BotController { * @returns Difficulty object */ getBotDifficulty(type: string, difficulty: string): Difficulty; - protected getPmcDifficultySettings(pmcType: "bear" | "usec", difficulty: string, usecType: string, bearType: string): Difficulty; /** * Generate bot profiles and store in cache * @param sessionId Session id @@ -51,4 +57,5 @@ export declare class BotController { * @returns cap number */ getBotCap(): number; + getPmcBotTypes(): Record>>; } diff --git a/TypeScript/15HttpListenerExample/types/controllers/DialogueController.d.ts b/TypeScript/15HttpListenerExample/types/controllers/DialogueController.d.ts index 1b72522..9c8b728 100644 --- a/TypeScript/15HttpListenerExample/types/controllers/DialogueController.d.ts +++ b/TypeScript/15HttpListenerExample/types/controllers/DialogueController.d.ts @@ -23,7 +23,7 @@ export declare class DialogueController { * Get the content of a dialogue * @param dialogueID Dialog id * @param sessionID Session Id - * @returns + * @returns DialogueInfo */ getDialogueInfo(dialogueID: string, sessionID: string): DialogueInfo; /** diff --git a/TypeScript/15HttpListenerExample/types/controllers/GameController.d.ts b/TypeScript/15HttpListenerExample/types/controllers/GameController.d.ts index 3bfbdb1..f4f5849 100644 --- a/TypeScript/15HttpListenerExample/types/controllers/GameController.d.ts +++ b/TypeScript/15HttpListenerExample/types/controllers/GameController.d.ts @@ -1,3 +1,4 @@ +import { ApplicationContext } from "../context/ApplicationContext"; import { GameEventHelper } from "../helpers/GameEventHelper"; import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; @@ -14,6 +15,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; +import { LocalisationService } from "../services/LocalisationService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { Watermark } from "../utils/Watermark"; export declare class GameController { @@ -24,14 +26,33 @@ export declare class GameController { protected localeService: LocaleService; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; + protected localisationService: LocalisationService; protected gameEventHelper: GameEventHelper; + protected applicationContext: ApplicationContext; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; protected coreConfig: ICoreConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, gameEventHelper: GameEventHelper, configServer: ConfigServer); - gameStart(_url: string, _info: IEmptyRequestData, sessionID: string): void; + constructor(logger: ILogger, databaseServer: DatabaseServer, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, gameEventHelper: GameEventHelper, applicationContext: ApplicationContext, configServer: ConfigServer); + gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; + /** + * Check if current date falls inside any of the seasons events pased in, if so, handle them + * @param seasonalEvents events to check for + */ protected checkForAndEnableSeasonalEvents(seasonalEvents: ISeasonalEvent[]): void; + /** + * Make adjusted to server code based on the name of the event passed in + * @param globalConfig globals.json + * @param eventName Name of the event to enable. e.g. Christmas + */ protected updateGlobalEvents(globalConfig: Config, eventName: string): void; + /** + * Read in data from seasonalEvents.json and add found equipment items to bots + * @param eventName Name of the event to read equipment in from config + */ + protected addEventGearToScavs(eventName: string): void; + /** + * Set Khorovod(dancing tree) chance to 100% on all maps that support it + */ protected enableDancingTree(): void; /** * Make non-trigger-spawned raiders spawn earlier + always @@ -40,5 +61,6 @@ export declare class GameController { protected logProfileDetails(fullProfile: IAkiProfile): void; getGameConfig(sessionID: string): IGameConfigResponse; getServer(): IServerDetails[]; + protected addPumpkinsToScavBackpacks(): void; getValidGameVersion(): ICheckVersionResponse; } diff --git a/TypeScript/15HttpListenerExample/types/controllers/HideoutController.d.ts b/TypeScript/15HttpListenerExample/types/controllers/HideoutController.d.ts index ada5bd9..5b6507b 100644 --- a/TypeScript/15HttpListenerExample/types/controllers/HideoutController.d.ts +++ b/TypeScript/15HttpListenerExample/types/controllers/HideoutController.d.ts @@ -23,12 +23,13 @@ import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; import { PlayerService } from "../services/PlayerService"; import { HashUtil } from "../utils/HashUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; -import { JsonUtil } from "../utils/JsonUtil"; export declare class HideoutController { protected logger: ILogger; protected hashUtil: HashUtil; @@ -45,11 +46,12 @@ export declare class HideoutController { protected profileHelper: ProfileHelper; protected hideoutHelper: HideoutHelper; protected scavCaseRewardGenerator: ScavCaseRewardGenerator; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected jsonUtil: JsonUtil; protected static nameBackendCountersCrafting: string; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, configServer: ConfigServer, jsonUtil: JsonUtil); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, localisationService: LocalisationService, configServer: ConfigServer, jsonUtil: JsonUtil); upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; upgradeComplete(pmcData: IPmcData, body: HideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; /** diff --git a/TypeScript/15HttpListenerExample/types/controllers/InraidController.d.ts b/TypeScript/15HttpListenerExample/types/controllers/InraidController.d.ts index e84eea1..39a6396 100644 --- a/TypeScript/15HttpListenerExample/types/controllers/InraidController.d.ts +++ b/TypeScript/15HttpListenerExample/types/controllers/InraidController.d.ts @@ -6,6 +6,7 @@ import { ProfileHelper } from "../helpers/ProfileHelper"; import { QuestHelper } from "../helpers/QuestHelper"; import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; +import { Item } from "../models/eft/common/tables/IItem"; import { IRegisterPlayerRequestData } from "../models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; import { IAirdropConfig } from "../models/spt/config/IAirdropConfig"; @@ -17,6 +18,9 @@ import { SaveServer } from "../servers/SaveServer"; import { InsuranceService } from "../services/InsuranceService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; +/** + * Logic for handling In Raid callbacks + */ export declare class InraidController { protected logger: ILogger; protected saveServer: SaveServer; @@ -35,14 +39,42 @@ export declare class InraidController { protected airdropConfig: IAirdropConfig; protected inraidConfig: IInRaidConfig; 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 + * Save locationid to active profiles inraid object + * @param sessionID Session id + * @param info Register player request + */ + addPlayer(sessionID: string, info: IRegisterPlayerRequestData): void; + /** + * Save profile state to disk + * Handles pmc/pscav + * @param offraidData post-raid request data + * @param sessionID Session id + */ + savePostRaidProgress(offraidData: ISaveProgressRequestData, sessionID: string): void; + /** + * Handle updating player profile post-pmc raid * @param sessionID session id - * @param offraidData post-raid data of raid + * @param offraidData post-raid data */ protected savePmcProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; + /** + * Make changes to pmc profile after they left raid dead, + * alter bodypart hp, handle insurance, delete inventory items, remove carried quest items + * @param postRaidSaveRequest post-raid save request + * @param pmcData pmc profile + * @param insuranceEnabled is insurance enabled + * @param preRaidGear gear player had before raid + * @param sessionID Session id + * @returns Updated profile object + */ + protected performPostRaidActionsWhenDead(postRaidSaveRequest: ISaveProgressRequestData, pmcData: IPmcData, insuranceEnabled: boolean, preRaidGear: Item[], sessionID: string): IPmcData; + /** + * Adjust player characters bodypart hp if they left raid early + * @param postRaidSaveRequest post raid data + * @param pmcData player profile + */ + protected updatePmcHealthPostRaid(postRaidSaveRequest: ISaveProgressRequestData, pmcData: IPmcData): void; /** * Reduce body part hp to % of max * @param pmcData profile to edit @@ -68,7 +100,31 @@ export declare class InraidController { * @param isPlayerScav Was the player a pScav */ protected markOrRemoveFoundInRaidItems(offraidData: ISaveProgressRequestData, pmcData: IPmcData, isPlayerScav: boolean): void; + /** + * Update profile after player completes scav raid + * @param scavData Scav profile + * @param sessionID Session id + * @param offraidData Post-raid save request + * @param pmcData Pmc profile + * @param isDead Is player dead + */ protected handlePostRaidPlayerScavProcess(scavData: IPmcData, sessionID: string, offraidData: ISaveProgressRequestData, pmcData: IPmcData, isDead: boolean): void; + /** + * Update profile with scav karma values based on in-raid actions + * @param pmcData Pmc profile + * @param offraidData Post-raid save request + * @param scavData Scav profile + * @param sessionID Session id + */ protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData, scavData: IPmcData, sessionID: string): void; + /** + * Get the inraid config from configs/inraid.json + * @returns InRaid Config + */ + getInraidConfig(): IInRaidConfig; + /** + * Get airdrop config from configs/airdrop.json + * @returns Airdrop config + */ getAirdropConfig(): IAirdropConfig; } diff --git a/TypeScript/15HttpListenerExample/types/controllers/InsuranceController.d.ts b/TypeScript/15HttpListenerExample/types/controllers/InsuranceController.d.ts index 14bf129..54f31b5 100644 --- a/TypeScript/15HttpListenerExample/types/controllers/InsuranceController.d.ts +++ b/TypeScript/15HttpListenerExample/types/controllers/InsuranceController.d.ts @@ -30,8 +30,7 @@ export declare class InsuranceController { protected insuranceService: InsuranceService; protected configServer: ConfigServer; protected insuranceConfig: IInsuranceConfig; - constructor(logger: ILogger, randomUtil: RandomUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, paymentService: PaymentService, // TODO: delay required - insuranceService: InsuranceService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, paymentService: PaymentService, insuranceService: InsuranceService, configServer: ConfigServer); processReturn(): void; insure(pmcData: IPmcData, body: IInsureRequestData, sessionID: string): IItemEventRouterResponse; /** diff --git a/TypeScript/15HttpListenerExample/types/controllers/InventoryController.d.ts b/TypeScript/15HttpListenerExample/types/controllers/InventoryController.d.ts index 6a1a21e..e1c08c0 100644 --- a/TypeScript/15HttpListenerExample/types/controllers/InventoryController.d.ts +++ b/TypeScript/15HttpListenerExample/types/controllers/InventoryController.d.ts @@ -1,8 +1,8 @@ -import { EventOutputHolder } from "../routers/EventOutputHolder"; import { InventoryHelper } from "../helpers/InventoryHelper"; import { PaymentHelper } from "../helpers/PaymentHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IAddItemRequestData } from "../models/eft/inventory/IAddItemRequestData"; import { IInventoryBindRequestData } from "../models/eft/inventory/IInventoryBindRequestData"; @@ -21,33 +21,46 @@ import { IInventorySwapRequestData } from "../models/eft/inventory/IInventorySwa import { IInventoryTagRequestData } from "../models/eft/inventory/IInventoryTagRequestData"; import { IInventoryToggleRequestData } from "../models/eft/inventory/IInventoryToggleRequestData"; import { IInventoryTransferRequestData } from "../models/eft/inventory/IInventoryTransferRequestData"; +import { IOpenRandomLootContainerRequestData } from "../models/eft/inventory/IOpenRandomLootContainerRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { ILogger } from "../models/spt/utils/ILogger"; +import { EventOutputHolder } from "../routers/EventOutputHolder"; import { DatabaseServer } from "../servers/DatabaseServer"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { HashUtil } from "../utils/HashUtil"; +import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { JsonUtil } from "../utils/JsonUtil"; +import { RandomUtil } from "../utils/RandomUtil"; export declare class InventoryController { protected logger: ILogger; protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; + protected randomUtil: RandomUtil; protected databaseServer: DatabaseServer; protected fenceService: FenceService; protected presetHelper: PresetHelper; protected inventoryHelper: InventoryHelper; protected ragfairOfferService: RagfairOfferService; protected profileHelper: ProfileHelper; + protected weightedRandomHelper: WeightedRandomHelper; protected paymentHelper: PaymentHelper; + protected localisationService: LocalisationService; protected eventOutputHolder: EventOutputHolder; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder); + protected httpResponseUtil: HttpResponseUtil; + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, weightedRandomHelper: WeightedRandomHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); /** * Move Item * change location of item with parentId and slotId * transfers items from one profile to another if fromOwner/toOwner is set in the body. * otherwise, move is contained within the same profile_f. - */ - moveItem(pmcData: IPmcData, body: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; + * @param pmcData Profile + * @param moveRequest Move request data + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ + moveItem(pmcData: IPmcData, moveRequest: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; /** * Remove Item from Profile * Deep tree item deletion, also removes items from insurance list @@ -122,4 +135,12 @@ export declare class InventoryController { createMapMarker(pmcData: IPmcData, body: IInventoryCreateMarkerRequestData, sessionID: string): IItemEventRouterResponse; deleteMapMarker(pmcData: IPmcData, body: IInventoryDeleteMarkerRequestData, sessionID: string): IItemEventRouterResponse; editMapMarker(pmcData: IPmcData, body: IInventoryEditMarkerRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle event fired when a container is unpacked (currently only the halloween pumpkin) + * @param pmcData Profile data + * @param body open loot container request data + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ + openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/15HttpListenerExample/types/controllers/LocationController.d.ts b/TypeScript/15HttpListenerExample/types/controllers/LocationController.d.ts index 9db3205..b6feba8 100644 --- a/TypeScript/15HttpListenerExample/types/controllers/LocationController.d.ts +++ b/TypeScript/15HttpListenerExample/types/controllers/LocationController.d.ts @@ -7,6 +7,7 @@ import { LootItem } from "../models/spt/services/LootItem"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -15,12 +16,13 @@ export declare class LocationController { protected hashUtil: HashUtil; protected logger: ILogger; protected locationGenerator: LocationGenerator; + protected localisationService: LocalisationService; protected lootGenerator: LootGenerator; protected databaseServer: DatabaseServer; protected timeUtil: TimeUtil; protected configServer: ConfigServer; protected airdropConfig: IAirdropConfig; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, logger: ILogger, locationGenerator: LocationGenerator, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer); + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer); get(location: string): ILocationBase; generate(name: string): ILocationBase; generateAll(): ILocationsGenerateAllResponse; diff --git a/TypeScript/15HttpListenerExample/types/controllers/MatchController.d.ts b/TypeScript/15HttpListenerExample/types/controllers/MatchController.d.ts index dac6a3f..2b0d150 100644 --- a/TypeScript/15HttpListenerExample/types/controllers/MatchController.d.ts +++ b/TypeScript/15HttpListenerExample/types/controllers/MatchController.d.ts @@ -19,7 +19,6 @@ import { SaveServer } from "../servers/SaveServer"; import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; import { BotLootCacheService } from "../services/BotLootCacheService"; import { MatchLocationService } from "../services/MatchLocationService"; -import { PmcAiService } from "../services/PmcAiService"; import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; export declare class MatchController { protected logger: ILogger; @@ -30,13 +29,12 @@ export declare class MatchController { protected botLootCacheService: BotLootCacheService; protected configServer: ConfigServer; protected profileSnapshotService: ProfileSnapshotService; - protected pmcAiService: PmcAiService; protected botGenerationCacheService: BotGenerationCacheService; 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, pmcAiService: PmcAiService, botGenerationCacheService: BotGenerationCacheService, applicationContext: ApplicationContext); + constructor(logger: ILogger, saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, botGenerationCacheService: BotGenerationCacheService, applicationContext: ApplicationContext); getEnabled(): boolean; getProfile(info: IGetProfileRequestData): IPmcData[]; createGroup(sessionID: string, info: ICreateGroupRequestData): any; diff --git a/TypeScript/15HttpListenerExample/types/controllers/RagfairController.d.ts b/TypeScript/15HttpListenerExample/types/controllers/RagfairController.d.ts index 5440458..95702f2 100644 --- a/TypeScript/15HttpListenerExample/types/controllers/RagfairController.d.ts +++ b/TypeScript/15HttpListenerExample/types/controllers/RagfairController.d.ts @@ -29,6 +29,7 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { RagfairServer } from "../servers/RagfairServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; import { PaymentService } from "../services/PaymentService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { RagfairPriceService } from "../services/RagfairPriceService"; @@ -62,9 +63,10 @@ export declare class RagfairController { protected ragfairOfferService: RagfairOfferService; protected ragfairRequiredItemsService: RagfairRequiredItemsService; protected ragfairOfferGenerator: RagfairOfferGenerator; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, eventOutputHolder: EventOutputHolder, ragfairServer: RagfairServer, ragfairPriceService: RagfairPriceService, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer, ragfairSellHelper: RagfairSellHelper, ragfairTaxHelper: RagfairTaxHelper, ragfairSortHelper: RagfairSortHelper, ragfairOfferHelper: RagfairOfferHelper, profileHelper: ProfileHelper, paymentService: PaymentService, handbookHelper: HandbookHelper, paymentHelper: PaymentHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, ragfairOfferGenerator: RagfairOfferGenerator, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, eventOutputHolder: EventOutputHolder, ragfairServer: RagfairServer, ragfairPriceService: RagfairPriceService, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer, ragfairSellHelper: RagfairSellHelper, ragfairTaxHelper: RagfairTaxHelper, ragfairSortHelper: RagfairSortHelper, ragfairOfferHelper: RagfairOfferHelper, profileHelper: ProfileHelper, paymentService: PaymentService, handbookHelper: HandbookHelper, paymentHelper: PaymentHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, ragfairOfferGenerator: RagfairOfferGenerator, localisationService: LocalisationService, configServer: ConfigServer); getOffers(sessionID: string, info: ISearchRequestData): IGetOffersResult; /** * Get offers for the client based on type of search being performed @@ -103,7 +105,12 @@ export declare class RagfairController { protected isLinkedSearch(info: ISearchRequestData): boolean; protected isRequiredSearch(info: ISearchRequestData): boolean; update(): void; - getItemPrice(info: IGetMarketPriceRequestData): IGetItemPriceResult; + /** + * Called when creating an offer on flea, fills values in top right corner + * @param getPriceRequest + * @returns min/avg/max values for an item based on flea offers available + */ + getItemMinAvgMaxFleaPriceValues(getPriceRequest: IGetMarketPriceRequestData): IGetItemPriceResult; addPlayerOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; createPlayerOffer(profile: IAkiProfile, requirements: Requirement[], items: Item[], sellInOnePiece: boolean, amountToSend: number): IRagfairOffer; getAllFleaPrices(): Record; diff --git a/TypeScript/15HttpListenerExample/types/controllers/RepeatableQuestController.d.ts b/TypeScript/15HttpListenerExample/types/controllers/RepeatableQuestController.d.ts index 7db5886..333583b 100644 --- a/TypeScript/15HttpListenerExample/types/controllers/RepeatableQuestController.d.ts +++ b/TypeScript/15HttpListenerExample/types/controllers/RepeatableQuestController.d.ts @@ -17,6 +17,7 @@ import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { ItemFilterService } from "../services/ItemFilterService"; +import { LocalisationService } from "../services/LocalisationService"; import { PaymentService } from "../services/PaymentService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { JsonUtil } from "../utils/JsonUtil"; @@ -64,12 +65,13 @@ export declare class RepeatableQuestController { protected profileFixerService: ProfileFixerService; protected ragfairServerHelper: RagfairServerHelper; protected eventOutputHolder: EventOutputHolder; + protected localisationService: LocalisationService; protected paymentService: PaymentService; protected objectId: ObjectId; protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * This is the method reached by the /client/repeatalbeQuests/activityPeriods endpoint * Returns an array of objects in the format of repeatable quests to the client. diff --git a/TypeScript/15HttpListenerExample/types/controllers/WeatherController.d.ts b/TypeScript/15HttpListenerExample/types/controllers/WeatherController.d.ts index ca7f5eb..631a90c 100644 --- a/TypeScript/15HttpListenerExample/types/controllers/WeatherController.d.ts +++ b/TypeScript/15HttpListenerExample/types/controllers/WeatherController.d.ts @@ -1,11 +1,18 @@ import { WeatherGenerator } from "../generators/WeatherGenerator"; import { IWeatherData } from "../models/eft/weather/IWeatherData"; import { IWeatherConfig } from "../models/spt/config/IWeatherConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; export declare class WeatherController { protected weatherGenerator: WeatherGenerator; + protected logger: ILogger; protected configServer: ConfigServer; protected weatherConfig: IWeatherConfig; - constructor(weatherGenerator: WeatherGenerator, configServer: ConfigServer); + constructor(weatherGenerator: WeatherGenerator, logger: ILogger, configServer: ConfigServer); generate(): IWeatherData; + /** + * Get the current in-raid time (MUST HAVE PLAYER LOGGED INTO CLIENT TO WORK) + * @returns Date object + */ + getCurrentInRaidTime(): Date; } diff --git a/TypeScript/15HttpListenerExample/types/generators/BotGenerator.d.ts b/TypeScript/15HttpListenerExample/types/generators/BotGenerator.d.ts index 2ac51db..a1ac9ed 100644 --- a/TypeScript/15HttpListenerExample/types/generators/BotGenerator.d.ts +++ b/TypeScript/15HttpListenerExample/types/generators/BotGenerator.d.ts @@ -1,7 +1,8 @@ +import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; import { GameEventHelper } from "../helpers/GameEventHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; -import { IGenerateBotsRequestData } from "../models/eft/bot/IGenerateBotsRequestData"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { Health as PmcHealth, IBotBase, Skills } from "../models/eft/common/tables/IBotBase"; import { Health, IBotType, Inventory } from "../models/eft/common/tables/IBotType"; import { IBotConfig } from "../models/spt/config/IBotConfig"; @@ -9,7 +10,6 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; -import { PmcAiService } from "../services/PmcAiService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; @@ -29,12 +29,13 @@ export declare class BotGenerator { protected databaseServer: DatabaseServer; protected botInventoryGenerator: BotInventoryGenerator; protected botEquipmentFilterService: BotEquipmentFilterService; + protected weightedRandomHelper: WeightedRandomHelper; protected botHelper: BotHelper; + protected botDifficultyHelper: BotDifficultyHelper; protected gameEventHelper: GameEventHelper; - protected pmcAiService: PmcAiService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botEquipmentFilterService: BotEquipmentFilterService, botHelper: BotHelper, gameEventHelper: GameEventHelper, pmcAiService: PmcAiService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botEquipmentFilterService: BotEquipmentFilterService, weightedRandomHelper: WeightedRandomHelper, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, gameEventHelper: GameEventHelper, configServer: ConfigServer); /** * Generate a player scav bot object * @param role e.g. assault / pmcbot @@ -44,12 +45,18 @@ export declare class BotGenerator { */ generatePlayerScav(sessionId: string, role: string, difficulty: string, botTemplate: IBotType): IBotBase; /** - * Generate an array of bot objects for populate a raid with + * Generate an array of bot objects based on a condition for a raid with * @param sessionId session id - * @param info request object + * @param condition request condition * @returns bot array */ - generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; + generateByCondition(sessionId: string, botCountToGenerate: number, difficulty: string, role: string, isPmc: boolean): IBotBase[]; + /** + * Get the PMCs wildSpawnType value + * @param role "usec" / "bear" + * @returns wildSpawnType value as string + */ + protected getPmcRoleByDescription(role: string): string; /** * Get a randomised PMC side based on bot config value 'isUsec' * @returns pmc side as string @@ -64,13 +71,13 @@ export declare class BotGenerator { * Create a IBotBase object with equipment/loot/exp etc * @param sessionId Session id * @param bot bots base file - * @param role botRole bot will use + * @param botRole Role bot will use (bear/usec for PMCs) * @param node Bot template from db/bots/x.json * @param isPmc Is bot to be a PMC * @param isPlayerScav is bot to be a p scav bot * @returns IBotBase object */ - protected generateBot(sessionId: string, bot: IBotBase, role: string, node: IBotType, isPmc: boolean, isPlayerScav?: boolean): IBotBase; + protected generateBot(sessionId: string, bot: IBotBase, botRole: string, node: IBotType, isPmc: boolean, isPlayerScav?: boolean): IBotBase; /** * Log the number of PMCs generated to the debug console * @param output Generated bot array, ready to send to client diff --git a/TypeScript/15HttpListenerExample/types/generators/BotInventoryGenerator.d.ts b/TypeScript/15HttpListenerExample/types/generators/BotInventoryGenerator.d.ts index c5ed545..e1efaf2 100644 --- a/TypeScript/15HttpListenerExample/types/generators/BotInventoryGenerator.d.ts +++ b/TypeScript/15HttpListenerExample/types/generators/BotInventoryGenerator.d.ts @@ -7,6 +7,7 @@ import { IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { BotLootGenerator } from "./BotLootGenerator"; @@ -20,14 +21,68 @@ export declare class BotInventoryGenerator { protected botLootGenerator: BotLootGenerator; protected botGeneratorHelper: BotGeneratorHelper; protected weightedRandomHelper: WeightedRandomHelper; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, configServer: ConfigServer); + /** + * Add equipment/weapons/loot to bot + * @param sessionId Session id + * @param templateInventory bot/x.json data from db + * @param equipmentChances Chances each item will be added to bot + * @param itemGenerationLimitsMinMax item gen limits for bot role + * @param botRole Role bot has (assault/pmcBot) + * @param isPmc Is bot being converted into a pmc + * @returns PmcInventory object with equipment/weapons/loot + */ generateInventory(sessionId: string, templateInventory: Inventory, equipmentChances: Chances, itemGenerationLimitsMinMax: Generation, botRole: string, isPmc: boolean): PmcInventory; + /** + * Create a pmcInventory object with all the base/generic items needed + * @returns PmcInventory object + */ + protected generateInventoryBase(): PmcInventory; + /** + * Add equipment to a bot + * @param templateInventory bot/x.json data from db + * @param equipmentChances Chances items will be added to bot + * @param botRole Role bot has (assault/pmcBot) + * @param botInventory Inventory to add equipment to + */ + protected generateAndAddEquipmentToBot(templateInventory: Inventory, equipmentChances: Chances, botRole: string, botInventory: PmcInventory): void; + protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory): void; + /** + * Work out what weapons bot should have equipped and add them to bot inventory + * @param templateInventory bot/x.json data from db + * @param equipmentChances Chances bot can have equipment equipped + * @param sessionId Session id + * @param botInventory Inventory to add weapons to + * @param botRole assault/pmcBot/bossTagilla etc + * @param isPmc Is the bot being generated as a pmc + * @param itemGenerationLimitsMinMax Limits for items the bot can have + */ + protected generateAndAddWeaponsToBot(templateInventory: Inventory, equipmentChances: Chances, sessionId: string, botInventory: PmcInventory, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation): void; + /** + * Calculate if the bot should have weapons in Primary/Secondary/Holster slots + * @param equipmentChances Chances bot has certain equipment + * @returns What slots bot should have weapons generated for + */ + protected getDesiredWeaponsForBot(equipmentChances: Chances): { + slot: EquipmentSlots; + shouldSpawn: boolean; + }[]; + /** + * Add weapon + spare mags/ammo to bots inventory + * @param sessionId Session id + * @param weaponSlot Weapon slot being generated + * @param templateInventory bot/x.json data from db + * @param botInventory Inventory to add weapon+mags/ammo to + * @param equipmentChances Chances bot can have equipment equipped + * @param botRole assault/pmcBot/bossTagilla etc + * @param isPmc Is the bot being generated as a pmc + * @param itemGenerationLimitsMinMax + */ protected addWeaponAndMagazinesToInventory(sessionId: string, weaponSlot: { slot: EquipmentSlots; shouldSpawn: boolean; }, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation): void; - protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory): void; - protected generateInventoryBase(): PmcInventory; } diff --git a/TypeScript/15HttpListenerExample/types/generators/BotLootGenerator.d.ts b/TypeScript/15HttpListenerExample/types/generators/BotLootGenerator.d.ts index c1f5310..3352a46 100644 --- a/TypeScript/15HttpListenerExample/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/15HttpListenerExample/types/generators/BotLootGenerator.d.ts @@ -10,6 +10,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotLootCacheService } from "../services/BotLootCacheService"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { BotWeaponGenerator } from "./BotWeaponGenerator"; @@ -23,9 +24,10 @@ export declare class BotLootGenerator { protected botWeaponGenerator: BotWeaponGenerator; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected botLootCacheService: BotLootCacheService; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, configServer: ConfigServer); generateLoot(sessionId: string, templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances): void; protected getRandomisedCount(min: number, max: number, nValue: number): number; /** @@ -113,7 +115,7 @@ export declare class BotLootGenerator { * If no limit found for a non pmc bot, fall back to defaults * @param isPmc is the bot we want limits for a pmc * @param botRole what role does the bot have - * @returns dictionary of tplIds and limit + * @returns Dictionary of tplIds and limit */ protected getItemSpawnLimitsForBotType(isPmc: boolean, botRole: string): Record; /** diff --git a/TypeScript/15HttpListenerExample/types/generators/BotWeaponGenerator.d.ts b/TypeScript/15HttpListenerExample/types/generators/BotWeaponGenerator.d.ts index 487901b..40284ea 100644 --- a/TypeScript/15HttpListenerExample/types/generators/BotWeaponGenerator.d.ts +++ b/TypeScript/15HttpListenerExample/types/generators/BotWeaponGenerator.d.ts @@ -12,6 +12,7 @@ import { IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; @@ -27,10 +28,11 @@ export declare class BotWeaponGenerator { protected randomUtil: RandomUtil; protected configServer: ConfigServer; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected localisationService: LocalisationService; protected inventoryMagGenComponents: IInventoryMagGen[]; protected readonly modMagazineSlotId = "mod_magazine"; protected botConfig: IBotConfig; - constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil, configServer: ConfigServer, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, inventoryMagGenComponents: IInventoryMagGen[]); + constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil, configServer: ConfigServer, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, inventoryMagGenComponents: IInventoryMagGen[]); /** * Pick a random weapon based on weightings and generate a functional weapon * @param equipmentSlot Primary/secondary/holster diff --git a/TypeScript/15HttpListenerExample/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/15HttpListenerExample/types/generators/RagfairOfferGenerator.d.ts index b64a7e7..23882d2 100644 --- a/TypeScript/15HttpListenerExample/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/15HttpListenerExample/types/generators/RagfairOfferGenerator.d.ts @@ -1,16 +1,19 @@ +import { HandbookHelper } from "../helpers/HandbookHelper"; import { ItemHelper } from "../helpers/ItemHelper"; +import { PaymentHelper } from "../helpers/PaymentHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; import { Item } from "../models/eft/common/tables/IItem"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { IBarterScheme } from "../models/eft/common/tables/ITrader"; -import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; +import { IRagfairOffer, OfferRequirement } from "../models/eft/ragfair/IRagfairOffer"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { RagfairCategoriesService } from "../services/RagfairCategoriesService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { RagfairPriceService } from "../services/RagfairPriceService"; @@ -27,18 +30,31 @@ export declare class RagfairOfferGenerator { protected timeUtil: TimeUtil; protected databaseServer: DatabaseServer; protected ragfairServerHelper: RagfairServerHelper; + protected handbookHelper: HandbookHelper; protected saveServer: SaveServer; protected presetHelper: PresetHelper; protected ragfairAssortGenerator: RagfairAssortGenerator; protected ragfairOfferService: RagfairOfferService; protected ragfairPriceService: RagfairPriceService; + protected localisationService: LocalisationService; + protected paymentHelper: PaymentHelper; protected ragfairCategoriesService: RagfairCategoriesService; protected fenceService: FenceService; protected itemHelper: ItemHelper; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, ragfairServerHelper: RagfairServerHelper, saveServer: SaveServer, presetHelper: PresetHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferService: RagfairOfferService, ragfairPriceService: RagfairPriceService, ragfairCategoriesService: RagfairCategoriesService, fenceService: FenceService, itemHelper: ItemHelper, configServer: ConfigServer); + protected allowedFleaPriceItemsForBarter: { + tpl: string; + price: number; + }[]; + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, ragfairServerHelper: RagfairServerHelper, handbookHelper: HandbookHelper, saveServer: SaveServer, presetHelper: PresetHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferService: RagfairOfferService, ragfairPriceService: RagfairPriceService, localisationService: LocalisationService, paymentHelper: PaymentHelper, ragfairCategoriesService: RagfairCategoriesService, fenceService: FenceService, itemHelper: ItemHelper, configServer: ConfigServer); createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; + /** + * Calculate the offer price that's listed on the flea listing + * @param offerRequirements barter requirements for offer + * @returns rouble cost of offer + */ + protected calculateOfferListingPrice(offerRequirements: OfferRequirement[]): number; /** * Get avatar url from trader table in db * @param isTrader Is user we're getting avatar for a trader @@ -87,20 +103,36 @@ export declare class RagfairOfferGenerator { * @returns Item with conditions added */ protected addMissingCondition(item: Item): Item; - protected getOfferRequirements(items: Item[]): { - count: number; - _tpl: string; + /** + * Create a barter-based barter scheme, if not possible, fall back to making barter scheme currency based + * @param offerItems Items for sale in offer + * @returns barter scheme + */ + protected createBarterRequirement(offerItems: Item[]): IBarterScheme[]; + /** + * Get an array of flea prices + item tpl, cached in generator class + * @returns array with tpl/price values + */ + protected getFleaPricesAsArray(): { + tpl: string; + price: number; }[]; + /** + * Create a random currency-based barter scheme for an array of items + * @param offerItems Items on offer + * @returns Barter scheme for offer + */ + protected createCurrencyRequirement(offerItems: Item[]): IBarterScheme[]; /** * Create a flea offer and store it in the Ragfair server offers array * @param userID owner of the offer * @param time time offer is put up * @param items items in the offer - * @param barterScheme - * @param loyalLevel + * @param barterScheme cost of item (currency or barter) + * @param loyalLevel Loyalty level needed to buy item * @param price price of offer * @param sellInOnePiece - * @returns + * @returns Ragfair offer */ createFleaOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; } diff --git a/TypeScript/15HttpListenerExample/types/generators/WeatherGenerator.d.ts b/TypeScript/15HttpListenerExample/types/generators/WeatherGenerator.d.ts index 8ddbe49..65d2c76 100644 --- a/TypeScript/15HttpListenerExample/types/generators/WeatherGenerator.d.ts +++ b/TypeScript/15HttpListenerExample/types/generators/WeatherGenerator.d.ts @@ -1,38 +1,54 @@ +import { ApplicationContext } from "../context/ApplicationContext"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; -import { IWeatherData } from "../models/eft/weather/IWeatherData"; +import { IWeather, IWeatherData } from "../models/eft/weather/IWeatherData"; +import { WindDirection } from "../models/enums/WindDirection"; import { IWeatherConfig } from "../models/spt/config/IWeatherConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class WeatherGenerator { protected weightedRandomHelper: WeightedRandomHelper; + protected logger: ILogger; protected randomUtil: RandomUtil; protected timeUtil: TimeUtil; + protected applicationContext: ApplicationContext; protected configServer: ConfigServer; protected weatherConfig: IWeatherConfig; - constructor(weightedRandomHelper: WeightedRandomHelper, randomUtil: RandomUtil, timeUtil: TimeUtil, configServer: ConfigServer); - calculateTime(data: IWeatherData): IWeatherData; + constructor(weightedRandomHelper: WeightedRandomHelper, logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, applicationContext: ApplicationContext, configServer: ConfigServer); + calculateGameTime(data: IWeatherData): IWeatherData; /** * Get server uptime seconds multiplied by a multiplier and add to current time as seconds * Format to BSGs requirements - * @param computedDate current date + * @param currentDate current date * @returns formatted time */ - protected getAcceleratedTime(computedDate: Date): string; + protected getBsgFormattedInRaidTime(currentDate: Date): string; + /** + * Get the current in-raid time + * @param currentDate (new Date()) + * @returns Date object of current in-raid time + */ + getInRaidTime(currentDate: Date): Date; /** * Get current time formatted to fit BSGs requirement - * @param computedDate date to format into bsg style + * @param date date to format into bsg style * @returns */ - protected getNormalTime(computedDate: Date): string; + protected getBSGFormattedTime(date: Date): string; /** - * Return randomised Weather data - * @param weatherData weather input data + * Return randomised Weather data with help of config/weather.json * @returns Randomised weather data */ - generateWeather(weatherData: IWeatherData): IWeatherData; - protected getWeightedFog(): string; + generateWeather(): IWeather; + /** + * Set IWeather date/time/timestamp values to now + * @param weather Object to update + */ + protected setCurrentDateTime(weather: IWeather): void; + protected getWeightedWindDirection(): WindDirection; + protected getWeightedWindSpeed(): number; + protected getWeightedFog(): number; protected getWeightedRain(): number; protected getRandomFloat(node: string): number; - protected getRandomInt(node: string): number; } diff --git a/TypeScript/15HttpListenerExample/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts b/TypeScript/15HttpListenerExample/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts index 4fcb1e2..1589707 100644 --- a/TypeScript/15HttpListenerExample/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts +++ b/TypeScript/15HttpListenerExample/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts @@ -1,13 +1,15 @@ import { BotWeaponGeneratorHelper } from "../../../helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "../../../helpers/ItemHelper"; import { ILogger } from "../../../models/spt/utils/ILogger"; +import { LocalisationService } from "../../../services/LocalisationService"; import { IInventoryMagGen } from "../IInventoryMagGen"; import { InventoryMagGen } from "../InventoryMagGen"; export declare class ExternalInventoryMagGen implements IInventoryMagGen { protected logger: ILogger; protected itemHelper: ItemHelper; + protected localisationService: LocalisationService; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; - constructor(logger: ILogger, itemHelper: ItemHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper); + constructor(logger: ILogger, itemHelper: ItemHelper, localisationService: LocalisationService, botWeaponGeneratorHelper: BotWeaponGeneratorHelper); getPriority(): number; canHandleInventoryMagGen(inventoryMagGen: InventoryMagGen): boolean; process(inventoryMagGen: InventoryMagGen): void; diff --git a/TypeScript/15HttpListenerExample/types/helpers/BotDifficultyHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/BotDifficultyHelper.d.ts new file mode 100644 index 0000000..a58ebdb --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/helpers/BotDifficultyHelper.d.ts @@ -0,0 +1,46 @@ +import { Difficulty } from "../models/eft/common/tables/IBotType"; +import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; +import { JsonUtil } from "../utils/JsonUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +import { BotHelper } from "./BotHelper"; +export declare class BotDifficultyHelper { + protected logger: ILogger; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected randomUtil: RandomUtil; + protected localisationService: LocalisationService; + protected botHelper: BotHelper; + protected configServer: ConfigServer; + protected botConfig: IBotConfig; + constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, localisationService: LocalisationService, botHelper: BotHelper, configServer: ConfigServer); + getPmcDifficultySettings(pmcType: "bear" | "usec", difficulty: string, usecType: string, bearType: string): Difficulty; + /** + * Get difficulty settings for desired bot type, if not found use assault bot types + * @param type bot type to retreive difficulty of + * @param difficulty difficulty to get settings for (easy/normal etc) + * @returns Difficulty object + */ + getBotDifficultySettings(type: string, difficulty: string): Difficulty; + /** + * Get difficulty settings for a PMC + * @param type "usec" / "bear" + * @param difficulty what difficulty to retrieve + * @returns Difficulty object + */ + protected getDifficultySettings(type: string, difficulty: string): Difficulty; + /** + * Translate chosen value from pre-raid difficulty dropdown into bot difficulty value + * @param dropDownDifficulty Dropdown difficulty value to convert + * @returns bot difficulty + */ + convertBotDifficultyDropdownToBotDifficulty(dropDownDifficulty: string): string; + /** + * Choose a random difficulty from - easy/normal/hard/impossible + * @returns random difficulty + */ + chooseRandomDifficulty(): string; +} diff --git a/TypeScript/15HttpListenerExample/types/helpers/BotGeneratorHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/BotGeneratorHelper.d.ts index 5e3e501..899669e 100644 --- a/TypeScript/15HttpListenerExample/types/helpers/BotGeneratorHelper.d.ts +++ b/TypeScript/15HttpListenerExample/types/helpers/BotGeneratorHelper.d.ts @@ -8,6 +8,7 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; import { ItemFilterService } from "../services/ItemFilterService"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; @@ -43,9 +44,10 @@ export declare class BotGeneratorHelper { protected itemFilterService: ItemFilterService; protected profileHelper: ProfileHelper; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Check mods are compatible and add to array * @param equipment Equipment item to add mods to @@ -53,9 +55,11 @@ export declare class BotGeneratorHelper { * @param parentId parentid of item to add mod to * @param parentTemplate template objet of item to add mods to * @param modSpawnChances dictionary of mod items and their chance to spawn for this bot type + * @param botRole the bot role being generated for + * @param forceSpawn should this mod be forced to spawn * @returns Item + compatible mods as an array */ - generateModsForEquipment(equipment: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances): Item[]; + generateModsForEquipment(equipment: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances, botRole: string, forceSpawn?: boolean): Item[]; /** * @param sessionId session id * @param weapon Weapon to add mods to @@ -70,15 +74,15 @@ export declare class BotGeneratorHelper { generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponParentId: string, parentWeaponTemplate: ITemplateItem, modSpawnChances: ModsChances, ammoTpl: string, botRole: string): Item[]; /** * - * @param modSlot - * @param isRandomisableSlot - * @param modsParent - * @param botEquipBlacklist - * @param itemModPool + * @param modSlot Slot mod will fit into + * @param isRandomisableSlot Will generate a randomised mod pool if true + * @param modsParent Parent slot the item will be a part of + * @param botEquipBlacklist Blacklist to prevent mods from being picked + * @param itemModPool Pool of items to pick from * @param weapon array with only weapon tpl in it, ready for mods to be added * @param ammoTpl ammo tpl to use if slot requires a cartridge to be added (e.g. mod_magazine) - * @param parentTemplate - * @returns + * @param parentTemplate Parent item the mod will go into + * @returns ITemplateItem */ protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, modsParent: Slot, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem): [boolean, ITemplateItem]; /** @@ -114,8 +118,10 @@ export declare class BotGeneratorHelper { * Find all compatible mods for equipment item and add to modPool * @param itemDetails item to find mods for * @param modPool ModPool to add mods to + * @param equipmentBlacklist equipment not allowed to be used by the bot + * @param botEquipmentRole bot type to generate pool for (e.g. assault, pmcBot, pmc for usec/bear) */ - generateDynamicModPool(itemDetails: ITemplateItem, modPool: Mods): void; + generateDynamicModPool(itemDetails: ITemplateItem, modPool: Mods, equipmentBlacklist: EquipmentFilterDetails[], botEquipmentRole: string): void; /** * Take a list of tpls and filter out blacklisted values using itemFilterService + botEquipmentBlacklist * @param allowedMods base mods to filter @@ -153,7 +159,7 @@ export declare class BotGeneratorHelper { * @param modTemplate Used to add additional properites in the upd object * @returns Item object */ - protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem): Item; + protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem, botRole: string): Item; /** * randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot * never return true for an item that has 0% spawn chance @@ -170,10 +176,10 @@ export declare class BotGeneratorHelper { */ protected getAmmoContainers(): string[]; /** - * Get the slot details for an item (chamber/cartridge/slot) + * Get a Slot property for an item (chamber/cartridge/slot) * @param modSlot e.g patron_in_weapon * @param parentTemplate item template - * @returns + * @returns Slot item */ protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; /** @@ -185,7 +191,6 @@ export declare class BotGeneratorHelper { * @param modPool modPool which should include available cartrigdes * @param parentId The CylinderMagazine's UID * @param parentTemplate The CylinderMagazine's template - * @returns */ protected fillCamora(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem): void; /** @@ -197,11 +202,11 @@ export declare class BotGeneratorHelper { /** * Adds properties to an item * e.g. Repairable / HasHinge / Foldable / MaxDurability - * @param itemTemplate - * @param botRole Used by weapons to randomise the durability values + * @param itemTemplate Item extra properties are being generated for + * @param botRole Used by weapons to randomise the durability values. Null for non-equipped items * @returns Item Upd object with extra properties */ - generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: any): { + generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: string): { upd?: Upd; }; /** @@ -220,21 +225,27 @@ export declare class BotGeneratorHelper { protected generateArmorRepairableProperties(itemTemplate: ITemplateItem, botRole: string): Repairable; /** * Get a random mod from an items compatible mods Filter array - * @param modTpl - * @param parentSlot - * @param modSlot - * @param items + * @param modTpl ???? + * @param parentSlot item mod will go into, used to get combatible items + * @param modSlot Slot to get mod to fill + * @param items items to ensure picked mod is compatible with * @returns item tpl */ protected getModTplFromItemDb(modTpl: string, parentSlot: Slot, modSlot: string, items: Item[]): string; /** * Can an item be added to an item without issue - * @param items - * @param tplToCheck - * @param equipmentSlot - * @returns true if possible + * @param items items to check compatiblilities with + * @param tplToCheck tpl of the item to check for incompatibilities + * @param equipmentSlot Slot the item will be placed into + * @returns false if no incompatibilties */ isItemIncompatibleWithCurrentItems(items: Item[], tplToCheck: string, equipmentSlot: string): boolean; + /** + * Convert a bots role to the equipment role used in config/bot.json + * @param botRole Role to convert + * @returns Equipment role (e.g. pmc / assault / bossTagilla) + */ + getBotEquipmentRole(botRole: string): string; } /** TODO - move into own class */ export declare class ExhaustableArray { diff --git a/TypeScript/15HttpListenerExample/types/helpers/BotHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/BotHelper.d.ts index 67a6384..a7f779e 100644 --- a/TypeScript/15HttpListenerExample/types/helpers/BotHelper.d.ts +++ b/TypeScript/15HttpListenerExample/types/helpers/BotHelper.d.ts @@ -3,6 +3,7 @@ import { IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; export declare class BotHelper { @@ -10,46 +11,27 @@ export declare class BotHelper { protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, configServer: ConfigServer); - /** - * Get difficulty settings for desired bot type, if not found use assault bot types - * @param type bot type to retreive difficulty of - * @param difficulty difficulty to get settings for (easy/normal etc) - * @returns Difficulty object - */ - getBotDifficultySettings(type: string, difficulty: string): Difficulty; + constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, localisationService: LocalisationService, configServer: ConfigServer); /** * Get a template object for the specified botRole from bots.types db * @param role botRole to get template for * @returns IBotType object */ getBotTemplate(role: string): IBotType; - /** - * Get difficulty settings for a PMC - * @param type "usec" / "bear" - * @param difficulty what difficulty to retrieve - * @returns Difficulty object - */ - getPmcDifficultySettings(type: string, difficulty: string): Difficulty; - /** - * Translate chosen value from pre-raid difficulty dropdown into bot difficulty value - * @param dropDownDifficulty Dropdown difficulty value to convert - * @returns bot difficulty - */ - convertBotDifficultyDropdownToBotDifficulty(dropDownDifficulty: string): string; - /** - * Choose a random difficulty from - easy/normal/hard/impossible - * @returns random difficulty - */ - chooseRandomDifficulty(): string; /** * Randomise the chance the PMC will attack their own side * Look up value in bot.json/chanceSameSideIsHostilePercent * @param difficultySettings pmc difficulty settings */ randomisePmcHostility(difficultySettings: Difficulty): void; + /** + * Is the passed in bot role a PMC (usec/bear/pmc) + * @param botRole bot role to check + * @returns true if is pmc + */ isBotPmc(botRole: string): boolean; isBotBoss(botRole: string): boolean; isBotFollower(botRole: string): boolean; diff --git a/TypeScript/15HttpListenerExample/types/helpers/GameEventHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/GameEventHelper.d.ts index fca87be..fa25eff 100644 --- a/TypeScript/15HttpListenerExample/types/helpers/GameEventHelper.d.ts +++ b/TypeScript/15HttpListenerExample/types/helpers/GameEventHelper.d.ts @@ -15,4 +15,15 @@ export declare class GameEventHelper { * @returns Record with event name + start/end date */ getEventDetails(): ISeasonalEvent[]; + /** + * Is detection of seasonal events enabled (halloween / christmas) + * @returns true if seasonal events should be checked for + */ + isAutomaticEventDetectionEnabled(): boolean; + /** + * Get a dictionary of gear changes to apply to bots for a specific event e.g. Christmas/Halloween + * @param eventName Name of event to get gear changes for + * @returns bots with equipment changes + */ + getEventBotGear(eventName: string): Record>>; } diff --git a/TypeScript/15HttpListenerExample/types/helpers/HideoutHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/HideoutHelper.d.ts index 5f7e3b7..9d51fed 100644 --- a/TypeScript/15HttpListenerExample/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/15HttpListenerExample/types/helpers/HideoutHelper.d.ts @@ -11,6 +11,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { PlayerService } from "../services/PlayerService"; import { HashUtil } from "../utils/HashUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; @@ -29,13 +30,14 @@ export declare class HideoutHelper { protected profileHelper: ProfileHelper; protected inventoryHelper: InventoryHelper; protected playerService: PlayerService; + protected localisationService: LocalisationService; protected configServer: ConfigServer; static bitcoinFarm: string; static waterCollector: string; static bitcoin: string; static expeditionaryFuelTank: string; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, localisationService: LocalisationService, configServer: ConfigServer); registerProduction(pmcData: IPmcData, body: IHideoutSingleProductionStartRequestData | IHideoutContinousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; /** * This convinience function intialies new Production Object diff --git a/TypeScript/15HttpListenerExample/types/helpers/InventoryHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/InventoryHelper.d.ts index b8e5c9d..6419f93 100644 --- a/TypeScript/15HttpListenerExample/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/15HttpListenerExample/types/helpers/InventoryHelper.d.ts @@ -5,11 +5,12 @@ import { IInventoryMergeRequestData } from "../models/eft/inventory/IInventoryMe import { IInventoryMoveRequestData } from "../models/eft/inventory/IInventoryMoveRequestData"; import { IInventorySplitRequestData } from "../models/eft/inventory/IInventorySplitRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { IInventoryConfig } from "../models/spt/config/IInventoryConfig"; +import { IInventoryConfig, RewardDetails } from "../models/spt/config/IInventoryConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { JsonUtil } from "../utils/JsonUtil"; @@ -38,9 +39,10 @@ export declare class InventoryHelper { protected itemHelper: ItemHelper; protected containerHelper: ContainerHelper; protected profileHelper: ProfileHelper; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected inventoryConfig: IInventoryConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); addItem(pmcData: IPmcData, body: IAddItemRequestData, output: IItemEventRouterResponse, sessionID: string, callback: any, foundInRaid?: boolean, addUpd?: any): IItemEventRouterResponse; removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; removeItemByCount(pmcData: IPmcData, itemId: string, count: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; @@ -76,6 +78,12 @@ export declare class InventoryHelper { * Internal helper function to handle cartridges in inventory if any of them exist. */ protected handleCartridges(items: Item[], body: IInventoryMoveRequestData): void; + /** + * Get details for how a random loot container should be handled, max rewards, possible reward tpls + * @param itemTpl Container being opened + * @returns Reward details + */ + getRandomLootContainerRewardDetails(itemTpl: string): RewardDetails; } declare namespace InventoryHelper { interface InventoryItemHash { diff --git a/TypeScript/15HttpListenerExample/types/helpers/ItemHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/ItemHelper.d.ts index 0effaf2..fc88a46 100644 --- a/TypeScript/15HttpListenerExample/types/helpers/ItemHelper.d.ts +++ b/TypeScript/15HttpListenerExample/types/helpers/ItemHelper.d.ts @@ -5,6 +5,7 @@ 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 { LocaleService } from "../services/LocaleService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; @@ -18,7 +19,8 @@ declare class ItemHelper { protected objectId: ObjectId; protected mathUtil: MathUtil; protected databaseServer: DatabaseServer; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer); + protected localeService: LocaleService; + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, localeService: LocaleService); /** * Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash * @param {string} tpl the template id / tpl @@ -212,6 +214,12 @@ declare class ItemHelper { * @returns size of stack */ getItemStackSize(item: Item): number; + /** + * Get the name of an item from the locale file using the item tpl + * @param itemTpl Tpl of item to get name of + * @returns Name of item + */ + getItemName(itemTpl: string): string; } declare namespace ItemHelper { interface ItemSize { diff --git a/TypeScript/15HttpListenerExample/types/helpers/QuestHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/QuestHelper.d.ts index a6b4892..edbd2e1 100644 --- a/TypeScript/15HttpListenerExample/types/helpers/QuestHelper.d.ts +++ b/TypeScript/15HttpListenerExample/types/helpers/QuestHelper.d.ts @@ -50,6 +50,12 @@ export declare class QuestHelper { * @returns true if player level is greater than or equal to quest */ doesPlayerLevelFulfilCondition(playerLevel: number, condition: AvailableForConditions): boolean; + /** + * Get the quests found in both arrays (inner join) + * @param before Array of qeusts #1 + * @param after Array of quests #2 + * @returns Reduction of cartesian product between two quest arrays + */ getDeltaQuests(before: IQuest[], after: IQuest[]): IQuest[]; /** * Increase skill points of a skill on player profile @@ -66,38 +72,85 @@ export declare class QuestHelper { * quest list in question. */ dumpQuests(quests: any): void; - loyaltyRequirementCheck(loyaltyRequirementProperties: AvailableForProps, profile: IPmcData): boolean; - protected processReward(reward: Reward): any[]; + /** + * Check if trader has sufficient loyalty to fullfill quest requirement + * @param questProperties Quest props + * @param profile Player profile + * @returns true if loyalty is high enough to fulfil quest requirement + */ + traderStandingRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; + protected processReward(reward: Reward): Reward[]; + /** + * Gets a flat list of reward items for the given quest at a specific state (e.g. Fail/Success) + * @param quest quest to get rewards for + * @param state Quest status that holds the items (Started, Success, Fail) + * @returns array of items with the correct maxStack + */ getQuestRewardItems(quest: IQuest, state: QuestStatus): Reward[]; /** - * Add quest with new state value to pmc profile + * Update player profile with quest status (e.g. Fail/Success) * @param pmcData profile to add quest to * @param newState state the new quest should be in when added * @param acceptedQuest Details of quest being added */ addQuestToPMCData(pmcData: IPmcData, newState: QuestStatus, acceptedQuest: IAcceptQuestRequestData): void; - acceptedUnlocked(acceptedQuestId: string, sessionID: string): IQuest[]; - failedUnlocked(failedQuestId: string, sessionID: string): IQuest[]; - applyMoneyBoost(quest: IQuest, moneyBoost: number): IQuest; - changeItemStack(pmcData: IPmcData, id: string, value: number, sessionID: string, output: any): void; /** - * Get List of All Quests as an array + * TODO: what is going on here + * @param acceptedQuestId Quest to add to profile + * @param sessionID Session id + * @returns Array of quests in profile + quest passed in as param + */ + acceptedUnlocked(acceptedQuestId: string, sessionID: string): IQuest[]; + /** + * TODO: what is going on here + * @param failedQuestId + * @param sessionID Session id + * @returns + */ + failedUnlocked(failedQuestId: string, sessionID: string): IQuest[]; + /** + * Adjust quest money rewards by passed in multipler + * @param quest Quest to multiple money rewards + * @param multipler Value to adjust money rewards by + * @returns Updated quest + */ + applyMoneyBoost(quest: IQuest, multipler: number): IQuest; + /** + * Sets the item stack to new value, or delete the item if value <= 0 + * // TODO maybe merge this function and the one from customization + * @param pmcData Profile + * @param itemId id of item to adjust stack size of + * @param newStackSize Stack size to adjust to + * @param sessionID Session id + * @param output ItemEvent router response + */ + changeItemStack(pmcData: IPmcData, itemId: string, newStackSize: number, sessionID: string, output: IItemEventRouterResponse): void; + /** + * Get List of All Quests from db + * NOT CLONED * @returns Array of IQuest objects */ - questValues(): IQuest[]; + getQuestsFromDb(): IQuest[]; /** - * Reest AvailableForStart conditions for quests - * @param quests queststo clean + * Get quests, strip all requirement conditions except level + * @param quests quests to process * @returns quest array without conditions */ - protected cleanQuestList(quests: IQuest[]): IQuest[]; + protected getQuestsWithOnlyLevelRequirementStartCondition(quests: IQuest[]): IQuest[]; /** - * Reset AvailableForStart conditions on a quest + * Remove all quest conditions except for level requirement * @param quest quest to clean * @returns reset IQuest object */ - cleanQuestConditions(quest: IQuest): IQuest; - failQuest(pmcData: IPmcData, body: any, sessionID: string): any; + getQuestWithOnlyLevelRequirementStartCondition(quest: IQuest): IQuest; + /** + * Fail a quest in a player profile + * @param pmcData Profile + * @param failRequest fail quest request data + * @param sessionID Session id + * @returns Item event router response + */ + failQuest(pmcData: IPmcData, failRequest: any, sessionID: string): IItemEventRouterResponse; /** * Get quest by id from database * @param questId questid to look for @@ -105,7 +158,12 @@ export declare class QuestHelper { * @returns IQuest object */ getQuestFromDb(questId: string, pmcData: IPmcData): IQuest; - getQuestLocaleIdFromDb(messageId: string): string; + /** + * Get the locale Id from locale db for a quest message + * @param questMessageId Quest mesage id to look up + * @returns Locale Id from locale db + */ + getQuestLocaleIdFromDb(questMessageId: string): string; /** * Alter a quests state + Add a record to tis status timers object * @param pmcData Profile to update @@ -128,5 +186,10 @@ export declare class QuestHelper { * @returns bonus in percent */ protected getIntelCenterRewardBonus(pmcData: IPmcData): number; - getFindItemIdForQuestItem(itemTpl: string): string; + /** + * Find quest with 'findItem' requirement that needs the item tpl be handed in + * @param itemTpl item tpl to look for + * @returns 'FindItem' condition id + */ + getFindItemIdForQuestHandIn(itemTpl: string): string; } diff --git a/TypeScript/15HttpListenerExample/types/helpers/RagfairServerHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/RagfairServerHelper.d.ts index a03cdda..ec388d8 100644 --- a/TypeScript/15HttpListenerExample/types/helpers/RagfairServerHelper.d.ts +++ b/TypeScript/15HttpListenerExample/types/helpers/RagfairServerHelper.d.ts @@ -44,10 +44,20 @@ export declare class RagfairServerHelper { isPlayer(userID: string): boolean; returnItems(sessionID: string, items: any[]): void; calculateDynamicStackCount(tplId: string, isWeaponPreset: boolean): number; + /** + * Choose a currency at random with bias + * @returns currency tpl + */ getDynamicOfferCurrency(): string; getMemberType(userID: string): MemberCategory; getNickname(userID: string): string; getPresetItems(item: any): Item[]; getPresetItemsByTpl(item: Item): Item[]; + /** + * Generate new unique ids for the children while preserving hierarchy + * @param item base item + * @param preset + * @returns Item array with new IDs + */ reparentPresets(item: Item, preset: Item[]): Item[]; } diff --git a/TypeScript/15HttpListenerExample/types/helpers/RagfairSortHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/RagfairSortHelper.d.ts index 28d1d38..4669ce6 100644 --- a/TypeScript/15HttpListenerExample/types/helpers/RagfairSortHelper.d.ts +++ b/TypeScript/15HttpListenerExample/types/helpers/RagfairSortHelper.d.ts @@ -18,7 +18,7 @@ export declare class RagfairSortHelper { protected sortOffersByRating(a: IRagfairOffer, b: IRagfairOffer): number; protected sortOffersByName(a: IRagfairOffer, b: IRagfairOffer): number; /** - * Order two offers by price value + * Order two offers by rouble price value * @param a Offer a * @param b Offer b * @returns diff --git a/TypeScript/15HttpListenerExample/types/loaders/PreAkiModLoader.d.ts b/TypeScript/15HttpListenerExample/types/loaders/PreAkiModLoader.d.ts index 7a687a5..f486a28 100644 --- a/TypeScript/15HttpListenerExample/types/loaders/PreAkiModLoader.d.ts +++ b/TypeScript/15HttpListenerExample/types/loaders/PreAkiModLoader.d.ts @@ -1,29 +1,31 @@ import { DependencyContainer } from "tsyringe"; +import { IPostAkiLoadMod } from "../models/external/IPostAkiLoadMod"; +import { IPostDBLoadMod } from "../models/external/IPostDBLoadMod"; +import { IPreAkiLoadMod } from "../models/external/IPreAkiLoadMod"; import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { ModLoader } from "../models/spt/mod/IMod"; import { IModLoader } from "../models/spt/mod/IModLoader"; import { IPackageJsonData } from "../models/spt/mod/IPackageJsonData"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { LocalisationService } from "../services/LocalisationService"; import { ModCompilerService } from "../services/ModCompilerService"; import { JsonUtil } from "../utils/JsonUtil"; import { VFS } from "../utils/VFS"; import { BundleLoader } from "./BundleLoader"; -import { IPostAkiLoadMod } from "../models/external/IPostAkiLoadMod"; -import { IPreAkiLoadMod } from "../models/external/IPreAkiLoadMod"; -import { IPostDBLoadMod } from "../models/external/IPostDBLoadMod"; export declare class PreAkiModLoader implements IModLoader { protected logger: ILogger; protected vfs: VFS; protected jsonUtil: JsonUtil; protected modCompilerService: ModCompilerService; protected bundleLoader: BundleLoader; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected static container: DependencyContainer; protected readonly basepath = "user/mods/"; protected imported: Record; protected akiConfig: ICoreConfig; - constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, modCompilerService: ModCompilerService, bundleLoader: BundleLoader, configServer: ConfigServer); + constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, modCompilerService: ModCompilerService, bundleLoader: BundleLoader, localisationService: LocalisationService, configServer: ConfigServer); load(container: DependencyContainer): Promise; getBundles(local: boolean): string; getBundle(key: string, local: boolean): void; diff --git a/TypeScript/15HttpListenerExample/types/models/eft/bot/IGenerateBotsRequestData.d.ts b/TypeScript/15HttpListenerExample/types/models/eft/bot/IGenerateBotsRequestData.d.ts index c49cef7..f1f7013 100644 --- a/TypeScript/15HttpListenerExample/types/models/eft/bot/IGenerateBotsRequestData.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/eft/bot/IGenerateBotsRequestData.d.ts @@ -2,6 +2,7 @@ export interface IGenerateBotsRequestData { conditions: Condition[]; } export interface Condition { + /** e.g. assault/pmcBot/bossKilla */ Role: string; Limit: number; Difficulty: string; diff --git a/TypeScript/15HttpListenerExample/types/models/eft/common/IGlobals.d.ts b/TypeScript/15HttpListenerExample/types/models/eft/common/IGlobals.d.ts index 81e2023..b53f106 100644 --- a/TypeScript/15HttpListenerExample/types/models/eft/common/IGlobals.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/eft/common/IGlobals.d.ts @@ -591,6 +591,7 @@ export interface HealPrice { export interface ProfileHealthSettings { BodyPartsSettings: BodyPartsSettings; HealthFactorsSettings: HealthFactorsSettings; + DefaultStimulatorBuff: string; } export interface BodyPartsSettings { Head: BodyPartsSetting; diff --git a/TypeScript/15HttpListenerExample/types/models/eft/common/tables/IBotBase.d.ts b/TypeScript/15HttpListenerExample/types/models/eft/common/tables/IBotBase.d.ts index 1c28ae0..2b418c1 100644 --- a/TypeScript/15HttpListenerExample/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/eft/common/tables/IBotBase.d.ts @@ -107,6 +107,7 @@ export interface CurrentMax { Maximum: number; } export interface Inventory { + discardLimits: Record; items: Item[]; equipment: string; stash: string; diff --git a/TypeScript/15HttpListenerExample/types/models/eft/common/tables/IBotType.d.ts b/TypeScript/15HttpListenerExample/types/models/eft/common/tables/IBotType.d.ts index c1fe579..55b4bd9 100644 --- a/TypeScript/15HttpListenerExample/types/models/eft/common/tables/IBotType.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/eft/common/tables/IBotType.d.ts @@ -13,8 +13,8 @@ export interface IBotType { skills: Skills; } export interface Appearance { - body: string[]; - feet: string[]; + body: Record; + feet: Record; hands: string[]; head: string[]; voice: string[]; diff --git a/TypeScript/15HttpListenerExample/types/models/eft/common/tables/ITemplateItem.d.ts b/TypeScript/15HttpListenerExample/types/models/eft/common/tables/ITemplateItem.d.ts index 8569e61..0fa7e18 100644 --- a/TypeScript/15HttpListenerExample/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/eft/common/tables/ITemplateItem.d.ts @@ -254,7 +254,7 @@ export interface Props { foodUseTime?: number; foodEffectType?: string; StimulatorBuffs?: string; - effects_health?: any; + effects_health?: IHealthEffect[] | Record>; effects_damage?: any; MaximumNumberOfUsage?: number; knifeHitDelay?: number; @@ -366,6 +366,10 @@ export interface Props { MinTimeToContactExplode?: number; ExplosionEffectType?: string; } +export interface IHealthEffect { + type: string; + value: number; +} export interface Prefab { path: string; rcid: string; diff --git a/TypeScript/15HttpListenerExample/types/models/eft/customization/IGetSuitsResponse.d.ts b/TypeScript/15HttpListenerExample/types/models/eft/customization/IGetSuitsResponse.d.ts new file mode 100644 index 0000000..fe6888c --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/models/eft/customization/IGetSuitsResponse.d.ts @@ -0,0 +1,4 @@ +export interface IGetSuitsResponse { + _id: string; + suits: string[]; +} diff --git a/TypeScript/15HttpListenerExample/types/models/eft/game/IGameKeepAliveResponse.d.ts b/TypeScript/15HttpListenerExample/types/models/eft/game/IGameKeepAliveResponse.d.ts new file mode 100644 index 0000000..170ce6a --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/models/eft/game/IGameKeepAliveResponse.d.ts @@ -0,0 +1,4 @@ +export interface IGameKeepAliveResponse { + msg: string; + utc_time: number; +} diff --git a/TypeScript/15HttpListenerExample/types/models/eft/game/IGameLogoutResponseData.d.ts b/TypeScript/15HttpListenerExample/types/models/eft/game/IGameLogoutResponseData.d.ts new file mode 100644 index 0000000..0f52050 --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/models/eft/game/IGameLogoutResponseData.d.ts @@ -0,0 +1,3 @@ +export interface IGameLogoutResponseData { + status: string; +} diff --git a/TypeScript/15HttpListenerExample/types/models/eft/game/IGameStartResponse.d.ts b/TypeScript/15HttpListenerExample/types/models/eft/game/IGameStartResponse.d.ts new file mode 100644 index 0000000..9f0ab6d --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/models/eft/game/IGameStartResponse.d.ts @@ -0,0 +1,3 @@ +export interface IGameStartResponse { + utc_time: number; +} diff --git a/TypeScript/15HttpListenerExample/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts b/TypeScript/15HttpListenerExample/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts new file mode 100644 index 0000000..3c45124 --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts @@ -0,0 +1,11 @@ +import { IInventoryBaseActionRequestData } from "./IInventoryBaseActionRequestData"; +export interface IOpenRandomLootContainerRequestData extends IInventoryBaseActionRequestData { + Action: "OpenRandomLootContainer"; + /** Container item opened */ + item: string; + to: To[]; +} +export interface To { + /** Player character (pmc/scav) id items will be sent to */ + id: string; +} diff --git a/TypeScript/15HttpListenerExample/types/models/eft/itemEvent/IItemEventRouterBase.d.ts b/TypeScript/15HttpListenerExample/types/models/eft/itemEvent/IItemEventRouterBase.d.ts index 4841cfd..60ab284 100644 --- a/TypeScript/15HttpListenerExample/types/models/eft/itemEvent/IItemEventRouterBase.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/eft/itemEvent/IItemEventRouterBase.d.ts @@ -10,8 +10,9 @@ export interface IItemEventRouterBase { export declare type TProfileChanges = Record; export interface Warning { index: number; - err: string; errmsg: string; + code?: string; + data?: any; } export interface ProfileChange { _id: string; diff --git a/TypeScript/15HttpListenerExample/types/models/eft/match/IStartOffineRaidRequestData.d.ts b/TypeScript/15HttpListenerExample/types/models/eft/match/IStartOffineRaidRequestData.d.ts index af0625e..1983728 100644 --- a/TypeScript/15HttpListenerExample/types/models/eft/match/IStartOffineRaidRequestData.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/eft/match/IStartOffineRaidRequestData.d.ts @@ -2,8 +2,10 @@ import { BotAmount } from "../../enums/BotAmount"; import { BotDifficulty } from "../../enums/BotDifficulty"; export interface IStartOfflineRaidRequestData { locationName: string; + /** Current time, not in-game time */ startTime: number; - dateTime: string; + /** CURR = am, past = pm */ + dateTime: "CURR" | "PAST"; gameSettings: GameSettings; } export interface GameSettings { diff --git a/TypeScript/15HttpListenerExample/types/models/eft/notifier/ISelectProfileResponse.d.ts b/TypeScript/15HttpListenerExample/types/models/eft/notifier/ISelectProfileResponse.d.ts new file mode 100644 index 0000000..ecb668a --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/models/eft/notifier/ISelectProfileResponse.d.ts @@ -0,0 +1,6 @@ +import { INotifierChannel } from "./INotifier"; +export interface ISelectProfileResponse { + status: string; + notifier: INotifierChannel; + notifierServer: string; +} diff --git a/TypeScript/15HttpListenerExample/types/models/eft/ragfair/IRagfairOffer.d.ts b/TypeScript/15HttpListenerExample/types/models/eft/ragfair/IRagfairOffer.d.ts index 3251a37..792ec7d 100644 --- a/TypeScript/15HttpListenerExample/types/models/eft/ragfair/IRagfairOffer.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/eft/ragfair/IRagfairOffer.d.ts @@ -7,19 +7,19 @@ export interface IRagfairOffer { requirements: OfferRequirement[]; root: string; intId: number; + /** Handbook price */ itemsCost: number; + /** Rouble price */ requirementsCost: number; - sptRequirementsCostRouble: number; startTime: number; endTime: number; sellInOnePiece: boolean; - name?: string; - shortName?: string; loyaltyLevel: number; buyRestrictionMax?: number; buyRestrictionCurrent?: number; locked: boolean; unlimitedCount: boolean; + /** Rouble price */ summaryCost: number; user: IRagfairOfferUser; notAvailable: boolean; @@ -33,11 +33,11 @@ export interface OfferRequirement { } export interface IRagfairOfferUser { id: string; - nickname: string; - rating: number; + nickname?: string; + rating?: number; memberType: MemberCategory; - avatar: string; - isRatingGrowing: boolean; + avatar?: string; + isRatingGrowing?: boolean; } export interface SellResult { sellTime: number; diff --git a/TypeScript/15HttpListenerExample/types/models/eft/weather/IWeatherData.d.ts b/TypeScript/15HttpListenerExample/types/models/eft/weather/IWeatherData.d.ts index ecc96ce..1f5d5b5 100644 --- a/TypeScript/15HttpListenerExample/types/models/eft/weather/IWeatherData.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/eft/weather/IWeatherData.d.ts @@ -1,17 +1,18 @@ +import { WindDirection } from "../../../models/enums/WindDirection"; export interface IWeatherData { acceleration: number; time: string; date: string; - weather: IWeather; + weather?: IWeather; } export interface IWeather { pressure: number; temp: number; - fog: string; + fog: number; rain_intensity: number; - rain: any; + rain: number; wind_gustiness: number; - wind_direction: any; + wind_direction: WindDirection; wind_speed: number; cloud: number; time: string; diff --git a/TypeScript/15HttpListenerExample/types/models/enums/BackendErrorCodes.d.ts b/TypeScript/15HttpListenerExample/types/models/enums/BackendErrorCodes.d.ts new file mode 100644 index 0000000..6614b75 --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/models/enums/BackendErrorCodes.d.ts @@ -0,0 +1,67 @@ +export declare enum BackendErrorCodes { + NONE = 0, + UNKNOWN_ERROR = 200, + NOT_AUTHORIZED = 201, + NEED_AUTHORIZATION_CODE = 209, + WRONG_AUTHORIZATION_CODE = 211, + NEED_CAPTCHA = 214, + NO_NEED_CAPTCHA = 215, + CAPTCHA_FAILED = 218, + CAPTCHA_BRUTE_FORCED = 219, + NO_ROOM_IN_STASH = 223, + NICKNAME_NOT_UNIQUE = 225, + NICKNAME_NOT_VALID = 226, + UNSUPPORTED_CLIENT_VERSION = 232, + REPORT_NOT_ALLOWED = 238, + NICKNAME_IS_ABUSIVE = 241, + NICKNAME_CHANGE_TIMEOUT = 242, + NOT_MODIFIED = 304, + HTTP_BAD_REQUEST = 400, + HTTP_NOT_AUTHORIZED = 401, + HTTP_FORBIDDEN = 403, + HTTP_NOT_FOUND = 404, + HTTP_METHOD_NOT_ALLOWED = 405, + UNKNOWN_TRADING_ERROR = 500, + HTTPNOTIMPLEMENTED = 501, + HTTPBADGATEWAY = 502, + HTTPSERVICEUNAVAILABLE = 503, + HTTPGATEWAYTIMEOUT = 504, + TRADEROUTOFMONEY = 505, + HTTPVARIANTALSONEGOTIATES = 506, + PRICECHANGED = 509, + TRADERDISABLED = 512, + ITEMHASBEENSOLD = 513, + NOTENOUGHSPACEFORMONEY = 518, + HTTPINVALIDSSLCERTIFICATE = 526, + UNKNOWNRAGFAIRERROR = 550, + UNKNOWNRAGFAIRERROR2 = 551, + UNKNOWNMATCHMAKERERROR = 600, + SESSIONPARAMETERSERROR = 601, + SESSIONLOST = 602, + SERVERNOTREGISTERED = 604, + UNKNOWNQUESTERROR = 700, + QUESTBADPARAM = 702, + QUESTNOTFOUND = 703, + QUESTISUNAVAILABLE = 704, + NOFREESPACEFORREWARDS = 705, + WRONGQUESTSTATUS = 706, + CANTCOMPLETEQUEST = 707, + UNKNOWNMAILERROR = 900, + TOOMANYFRIENDREQUESTS = 925, + UNKNOWNSCRIPTEXECUTIONERROR = 1000, + UNKNOWNREPAIRINGERROR = 1200, + UNKNOWNINSURANCEERROR = 1300, + UNKNOWNCURRENCYEXCHANGEERROR = 1400, + OFFERNOTFOUND = 1503, + NOTENOUGHSPACE = 1505, + OFFEROUTOFSTOCK = 1506, + OFFERSOLD = 1507, + RAGFAIRUNAVAILABLE = 1511, + BANNEDERRORCODE = 1513, + INSUFFICIENTNUMBERINSTOCK = 1516, + TOOMANYITEMSTOSELL = 1517, + EXAMINATIONFAILED = 22001, + ITEMALREADYEXAMINED = 22002, + UNKNOWNNGINXERROR = 9000, + PARSERESPONSEERROR = 9001 +} diff --git a/TypeScript/15HttpListenerExample/types/models/enums/HideoutEventActions.d.ts b/TypeScript/15HttpListenerExample/types/models/enums/HideoutEventActions.d.ts new file mode 100644 index 0000000..e441477 --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/models/enums/HideoutEventActions.d.ts @@ -0,0 +1,11 @@ +export declare enum HideoutEventActions { + HIDEOUT_UPGRADE = "HideoutUpgrade", + HIDEOUT_UPGRADE_COMPLETE = "HideoutUpgradeComplete", + HIDEOUT_PUT_ITEMS_IN_AREA_SLOTS = "HideoutPutItemsInAreaSlots", + HIDEOUT_TAKE_ITEMS_FROM_AREA_SLOTS = "HideoutTakeItemsFromAreaSlots", + HIDEOUT_TOGGLE_AREA = "HideoutToggleArea", + HIDEOUT_SINGLE_PRODUCTION_START = "HideoutSingleProductionStart", + HIDEOUT_SCAV_CASE_PRODUCTION_START = "HideoutScavCaseProductionStart", + HIDEOUT_CONTINUOUS_PRODUCTION_START = "HideoutContinuousProductionStart", + HIDEOUT_TAKE_PRODUCTION = "HideoutTakeProduction" +} diff --git a/TypeScript/15HttpListenerExample/types/models/enums/ItemEventActions.d.ts b/TypeScript/15HttpListenerExample/types/models/enums/ItemEventActions.d.ts new file mode 100644 index 0000000..0e65453 --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/models/enums/ItemEventActions.d.ts @@ -0,0 +1,19 @@ +export declare enum ItemEventActions { + MOVE = "Move", + REMOVE = "Remove", + SPLIT = "Split", + MERGE = "Merge", + TRANSFER = "Transfer", + SWAP = "Swap", + FOLD = "Fold", + TOGGLE = "Toggle", + TAG = "Tag", + BIND = "Bind", + EXAMINE = "Examine", + READ_ENCYCLOPEDIA = "ReadEncyclopedia", + APPLY_INVENTORY_CHANGES = "ApplyInventoryChanges", + CREATE_MAP_MARKER = "CreateMapMarker", + DELETE_MAP_MARKER = "DeleteMapMarker", + EDIT_MAP_MARKER = "EditMapMarker", + OPEN_RANDOM_LOOT_CONTAINER = "OpenRandomLootContainer" +} diff --git a/TypeScript/15HttpListenerExample/types/models/enums/WeatherType.d.ts b/TypeScript/15HttpListenerExample/types/models/enums/WeatherType.d.ts new file mode 100644 index 0000000..d31fefe --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/models/enums/WeatherType.d.ts @@ -0,0 +1,19 @@ +export declare enum WeatherType { + CLEAR_DAY = 1, + CLEAR_WIND = 2, + CLEAR_NIGHT = 3, + PARTLY_CLOUD_DAY = 4, + PARTLY_CLOUD_NIGHT = 5, + CLEAR_FOG_DAY = 6, + CLEAR_FOG_NIGHT = 7, + CLOUDFOG = 8, + FOG = 9, + MOSTLY_CLOUD = 10, + LIGHT_RAIN = 11, + RAIN = 12, + CLOUD_WIND = 13, + CLOUD_WIND_RAIN = 14, + FULL_CLOUD = 15, + THUNDER_CLOUD = 16, + NONE = 0 +} diff --git a/TypeScript/15HttpListenerExample/types/models/enums/WildSpawnTypeNumber.d.ts b/TypeScript/15HttpListenerExample/types/models/enums/WildSpawnTypeNumber.d.ts new file mode 100644 index 0000000..ff806fe --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/models/enums/WildSpawnTypeNumber.d.ts @@ -0,0 +1,33 @@ +export declare enum WildSpawnTypeNumber { + ASSAULT = 1, + MARKSMAN = 2, + BOSSTEST = 4, + BOSSBULLY = 8, + FOLLOWERTEST = 16, + FOLLOWERBULLY = 32, + BOSSKILLA = 64, + BOSSKOJANIY = 128, + FOLLOWERKOJANIY = 256, + PMCBOT = 512, + CURSEDASSAULT = 1024, + BOSSGLUHAR = 2048, + FOLLOWERGLUHARASSAULT = 4096, + FOLLOWERGLUHARSECURITY = 8192, + FOLLOWERGLUHARSCOUT = 16384, + FOLLOWERGLUHARSNIPE = 32768, + FOLLOWERSANITAR = 65536, + BOSSSANITAR = 131072, + TEST = 262144, + ASSAULTGROUP = 524288, + SECTANTWARRIOR = 1048576, + SECTANTPRIEST = 2097152, + BOSSTAGILLA = 4194304, + FOLLOWERTAGILLA = 8388608, + EXUSEC = 16777216, + GIFTER = 33554432, + BOSSKNIGHT = 67108864, + FOLLOWERBIGPIPE = 134217728, + FOLLOWERBIRDEYE = 268435456, + SPTUSEC = 536870912, + SPTBEAR = 1073741824 +} diff --git a/TypeScript/15HttpListenerExample/types/models/enums/WindDirection.d.ts b/TypeScript/15HttpListenerExample/types/models/enums/WindDirection.d.ts new file mode 100644 index 0000000..fb30b20 --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/models/enums/WindDirection.d.ts @@ -0,0 +1,10 @@ +export declare enum WindDirection { + EAST = 1, + NORTH = 2, + WEST = 3, + SOUTH = 4, + SE = 5, + SW = 6, + NW = 7, + NE = 8 +} diff --git a/TypeScript/15HttpListenerExample/types/models/spt/config/IBotConfig.d.ts b/TypeScript/15HttpListenerExample/types/models/spt/config/IBotConfig.d.ts index af8ceba..d6fa5e0 100644 --- a/TypeScript/15HttpListenerExample/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/spt/config/IBotConfig.d.ts @@ -27,6 +27,8 @@ export interface IBotConfig extends IBaseConfig { maxBotCap: Record; /** How many stacks of secret ammo should a bot have in its bot secure container */ secureContainerAmmoStackCount: number; + /** Batch generation size when type not available in cache */ + botGenerationBatchSizePerType: number; } export interface PresetBatch { assault: number; @@ -66,8 +68,12 @@ export interface EquipmentFilters { weaponModLimits: ModLimits; randomisedWeaponModSlots?: string[]; randomisedArmorSlots?: string[]; + faceShieldIsActiveChancePercent?: number; + lightLaserIsActiveChancePercent?: number; blacklist: EquipmentFilterDetails[]; whitelist: EquipmentFilterDetails[]; + clothing: WeightingAdjustmentDetails[]; + weightingAdjustments: WeightingAdjustmentDetails[]; } export interface ModLimits { /** How many scopes are allowed on a weapon - hard coded to work with OPTIC_SCOPE, ASSAULT_SCOPE, COLLIMATOR, COMPACT_COLLIMATOR */ @@ -80,3 +86,8 @@ export interface EquipmentFilterDetails { equipment: Record; cartridge: Record; } +export interface WeightingAdjustmentDetails { + levelRange: MinMax; + add: Record>; + edit: Record>; +} diff --git a/TypeScript/15HttpListenerExample/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/15HttpListenerExample/types/models/spt/config/IInventoryConfig.d.ts index ffffa41..4642b9b 100644 --- a/TypeScript/15HttpListenerExample/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/spt/config/IInventoryConfig.d.ts @@ -2,4 +2,10 @@ import { IBaseConfig } from "./IBaseConfig"; export interface IInventoryConfig extends IBaseConfig { kind: "aki-inventory"; newItemsMarkedFound: boolean; + randomLootContainers: Record; +} +export interface RewardDetails { + rewardCount: number; + foundInRaid: boolean; + rewardTplPool: Record; } diff --git a/TypeScript/15HttpListenerExample/types/models/spt/config/ILocaleConfig.d.ts b/TypeScript/15HttpListenerExample/types/models/spt/config/ILocaleConfig.d.ts index fe9abf7..0a8955c 100644 --- a/TypeScript/15HttpListenerExample/types/models/spt/config/ILocaleConfig.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/spt/config/ILocaleConfig.d.ts @@ -1,5 +1,10 @@ import { IBaseConfig } from "./IBaseConfig"; export interface ILocaleConfig extends IBaseConfig { kind: "aki-locale"; - desiredLocale: string; + /** e.g. ru/en/cn/fr etc, or 'system', will take computer locale setting */ + gameLocale: string; + /** e.g. ru/en/cn/fr etc, or 'system', will take computer locale setting */ + serverLocale: string; + /** Languages server can be translated into */ + serverSupportedLocales: string[]; } diff --git a/TypeScript/15HttpListenerExample/types/models/spt/config/IPmcConfig.d.ts b/TypeScript/15HttpListenerExample/types/models/spt/config/IPmcConfig.d.ts index 9db2ba1..48601b2 100644 --- a/TypeScript/15HttpListenerExample/types/models/spt/config/IPmcConfig.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/spt/config/IPmcConfig.d.ts @@ -6,9 +6,11 @@ export interface IPmcConfig { looseWeaponInBackpackChancePercent: number; looseWeaponInBackpackLootMinMax: MinMax; isUsec: number; + usecType: string; + bearType: string; chanceSameSideIsHostilePercent: number; /** key: location, value: type for usec/bear */ - pmcType: Record; + pmcType: Record>>; maxBackpackLootTotalRub: number; maxPocketLootTotalRub: number; maxVestLootTotalRub: number; diff --git a/TypeScript/15HttpListenerExample/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/15HttpListenerExample/types/models/spt/config/IRagfairConfig.d.ts index c1b8763..6786417 100644 --- a/TypeScript/15HttpListenerExample/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/spt/config/IRagfairConfig.d.ts @@ -28,12 +28,8 @@ export interface Reputation { gain: number; loss: number; } -export declare class OfferAdjustment { - maxPriceDifferenceBelowHandbookPercent: number; - handbookPriceMultipier: number; - priceThreshholdRub: number; -} export interface Dynamic { + barter: Barter; offerAdjustment: OfferAdjustment; expiredOfferThreshold: number; offerItemCount: MinMax; @@ -49,6 +45,20 @@ export interface Dynamic { showAsSingleStack: string[]; blacklist: Blacklist; } +export declare class Barter { + enable: boolean; + chancePercent: number; + itemCountMin: number; + itemCountMax: number; + priceRangeVariancePercent: number; + minRoubleCostToBecomeBarter: number; + itemTypeBlacklist: string[]; +} +export declare class OfferAdjustment { + maxPriceDifferenceBelowHandbookPercent: number; + handbookPriceMultipier: number; + priceThreshholdRub: number; +} export interface Condition { conditionChance: number; min: number; diff --git a/TypeScript/15HttpListenerExample/types/models/spt/config/ISeasonalEventConfig.d.ts b/TypeScript/15HttpListenerExample/types/models/spt/config/ISeasonalEventConfig.d.ts index bc60618..e410925 100644 --- a/TypeScript/15HttpListenerExample/types/models/spt/config/ISeasonalEventConfig.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/spt/config/ISeasonalEventConfig.d.ts @@ -1,6 +1,9 @@ import { IBaseConfig } from "./IBaseConfig"; export interface ISeasonalEventConfig extends IBaseConfig { kind: "aki-seasonalevents"; + enableSeasonalEventDetection: boolean; + /** event / botType / equipSlot / itemid */ + eventGear: Record>>>; events: ISeasonalEvent[]; } export interface ISeasonalEvent { diff --git a/TypeScript/15HttpListenerExample/types/models/spt/config/IWeatherConfig.d.ts b/TypeScript/15HttpListenerExample/types/models/spt/config/IWeatherConfig.d.ts index bbdc43e..41a1c83 100644 --- a/TypeScript/15HttpListenerExample/types/models/spt/config/IWeatherConfig.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/spt/config/IWeatherConfig.d.ts @@ -1,3 +1,4 @@ +import { WindDirection } from "../../../models/enums/WindDirection"; import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface IWeatherConfig extends IBaseConfig { @@ -7,12 +8,16 @@ export interface IWeatherConfig extends IBaseConfig { } export interface Weather { clouds: MinMax; - windSpeed: MinMax; - windDirection: MinMax; + windSpeed: WeatherSettings; + windDirection: WeatherSettings; windGustiness: MinMax; - rain: MinMax; + rain: WeatherSettings; rainIntensity: MinMax; - fog: MinMax; + fog: WeatherSettings; temp: MinMax; pressure: MinMax; } +export interface WeatherSettings { + values: T[]; + weights: number[]; +} diff --git a/TypeScript/15HttpListenerExample/types/routers/item_events/HideoutItemEventRouter.d.ts b/TypeScript/15HttpListenerExample/types/routers/item_events/HideoutItemEventRouter.d.ts index e1e98af..44bd1cd 100644 --- a/TypeScript/15HttpListenerExample/types/routers/item_events/HideoutItemEventRouter.d.ts +++ b/TypeScript/15HttpListenerExample/types/routers/item_events/HideoutItemEventRouter.d.ts @@ -1,7 +1,7 @@ -import { IPmcData } from "../../models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "../../models/eft/itemEvent/IItemEventRouterResponse"; import { HideoutCallbacks } from "../../callbacks/HideoutCallbacks"; import { HandledRoute, ItemEventRouterDefinition } from "../../di/Router"; +import { IPmcData } from "../../models/eft/common/IPmcData"; +import { IItemEventRouterResponse } from "../../models/eft/itemEvent/IItemEventRouterResponse"; export declare class HideoutItemEventRouter extends ItemEventRouterDefinition { protected hideoutCallbacks: HideoutCallbacks; constructor(hideoutCallbacks: HideoutCallbacks); diff --git a/TypeScript/15HttpListenerExample/types/routers/item_events/InventoryItemEventRouter.d.ts b/TypeScript/15HttpListenerExample/types/routers/item_events/InventoryItemEventRouter.d.ts index 2619bb9..953d322 100644 --- a/TypeScript/15HttpListenerExample/types/routers/item_events/InventoryItemEventRouter.d.ts +++ b/TypeScript/15HttpListenerExample/types/routers/item_events/InventoryItemEventRouter.d.ts @@ -1,7 +1,7 @@ -import { IPmcData } from "../../models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "../../models/eft/itemEvent/IItemEventRouterResponse"; import { InventoryCallbacks } from "../../callbacks/InventoryCallbacks"; import { HandledRoute, ItemEventRouterDefinition } from "../../di/Router"; +import { IPmcData } from "../../models/eft/common/IPmcData"; +import { IItemEventRouterResponse } from "../../models/eft/itemEvent/IItemEventRouterResponse"; export declare class InventoryItemEventRouter extends ItemEventRouterDefinition { protected inventoryCallbacks: InventoryCallbacks; constructor(inventoryCallbacks: InventoryCallbacks); diff --git a/TypeScript/15HttpListenerExample/types/servers/HttpServer.d.ts b/TypeScript/15HttpListenerExample/types/servers/HttpServer.d.ts index bbca8af..80c1d48 100644 --- a/TypeScript/15HttpListenerExample/types/servers/HttpServer.d.ts +++ b/TypeScript/15HttpListenerExample/types/servers/HttpServer.d.ts @@ -4,6 +4,7 @@ import { ApplicationContext } from "../context/ApplicationContext"; import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; import { ILogger } from "../models/spt/utils/ILogger"; +import { LocalisationService } from "../services/LocalisationService"; import { ConfigServer } from "./ConfigServer"; import { DatabaseServer } from "./DatabaseServer"; import { IHttpListener } from "./http/IHttpListener"; @@ -12,11 +13,12 @@ export declare class HttpServer { protected logger: ILogger; protected databaseServer: DatabaseServer; protected httpServerHelper: HttpServerHelper; + protected localisationService: LocalisationService; protected httpListeners: IHttpListener[]; protected configServer: ConfigServer; protected applicationContext: ApplicationContext; protected webSocketServer: WebSocketServer; - constructor(logger: ILogger, databaseServer: DatabaseServer, httpServerHelper: HttpServerHelper, httpListeners: IHttpListener[], configServer: ConfigServer, applicationContext: ApplicationContext, webSocketServer: WebSocketServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, httpServerHelper: HttpServerHelper, localisationService: LocalisationService, httpListeners: IHttpListener[], configServer: ConfigServer, applicationContext: ApplicationContext, webSocketServer: WebSocketServer); protected httpConfig: IHttpConfig; getCookies(req: http.IncomingMessage): any; handleRequest(req: IncomingMessage, resp: ServerResponse): void; diff --git a/TypeScript/15HttpListenerExample/types/servers/SaveServer.d.ts b/TypeScript/15HttpListenerExample/types/servers/SaveServer.d.ts index cb28f49..4dca514 100644 --- a/TypeScript/15HttpListenerExample/types/servers/SaveServer.d.ts +++ b/TypeScript/15HttpListenerExample/types/servers/SaveServer.d.ts @@ -1,20 +1,22 @@ +import { SaveLoadRouter } from "../di/Router"; import { IAkiProfile, Info } from "../models/eft/profile/IAkiProfile"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { VFS } from "../utils/VFS"; -import { SaveLoadRouter } from "../di/Router"; -import { ILogger } from "../models/spt/utils/ILogger"; export declare class SaveServer { protected vfs: VFS; protected saveLoadRouters: SaveLoadRouter[]; protected jsonUtil: JsonUtil; protected hashUtil: HashUtil; + protected localisationService: LocalisationService; protected logger: ILogger; protected profileFilepath: string; protected profiles: {}; protected onSave: {}; protected saveMd5: {}; - constructor(vfs: VFS, saveLoadRouters: SaveLoadRouter[], jsonUtil: JsonUtil, hashUtil: HashUtil, logger: ILogger); + constructor(vfs: VFS, saveLoadRouters: SaveLoadRouter[], jsonUtil: JsonUtil, hashUtil: HashUtil, localisationService: LocalisationService, logger: ILogger); load(): void; save(): void; getProfile(sessionId: string): IAkiProfile; diff --git a/TypeScript/15HttpListenerExample/types/servers/WebSocketServer.d.ts b/TypeScript/15HttpListenerExample/types/servers/WebSocketServer.d.ts index f33d214..5d40e6e 100644 --- a/TypeScript/15HttpListenerExample/types/servers/WebSocketServer.d.ts +++ b/TypeScript/15HttpListenerExample/types/servers/WebSocketServer.d.ts @@ -1,18 +1,20 @@ /// -import { HttpServerHelper } from "../helpers/HttpServerHelper"; -import WebSocket from "ws"; import http, { IncomingMessage } from "http"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { RandomUtil } from "../utils/RandomUtil"; +import WebSocket from "ws"; +import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { INotification } from "../models/eft/notifier/INotifier"; -import { ConfigServer } from "./ConfigServer"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { LocalisationService } from "../services/LocalisationService"; +import { RandomUtil } from "../utils/RandomUtil"; +import { ConfigServer } from "./ConfigServer"; export declare class WebSocketServer { protected logger: ILogger; protected randomUtil: RandomUtil; protected configServer: ConfigServer; + protected localisationService: LocalisationService; protected httpServerHelper: HttpServerHelper; - constructor(logger: ILogger, randomUtil: RandomUtil, configServer: ConfigServer, httpServerHelper: HttpServerHelper); + constructor(logger: ILogger, randomUtil: RandomUtil, configServer: ConfigServer, localisationService: LocalisationService, httpServerHelper: HttpServerHelper); protected httpConfig: IHttpConfig; protected defaultNotification: INotification; protected webSockets: Record; diff --git a/TypeScript/15HttpListenerExample/types/servers/http/AkiHttpListener.d.ts b/TypeScript/15HttpListenerExample/types/servers/http/AkiHttpListener.d.ts index 6f78939..acf92aa 100644 --- a/TypeScript/15HttpListenerExample/types/servers/http/AkiHttpListener.d.ts +++ b/TypeScript/15HttpListenerExample/types/servers/http/AkiHttpListener.d.ts @@ -1,22 +1,24 @@ /// /// import { IncomingMessage, ServerResponse } from "http"; -import { IHttpListener } from "./IHttpListener"; import { Serializer } from "../../di/Serializer"; import { ILogger } from "../../models/spt/utils/ILogger"; import { HttpRouter } from "../../routers/HttpRouter"; +import { LocalisationService } from "../../services/LocalisationService"; import { HttpResponseUtil } from "../../utils/HttpResponseUtil"; import { JsonUtil } from "../../utils/JsonUtil"; import { HttpBufferHandler } from "./HttpBufferHandler"; +import { IHttpListener } from "./IHttpListener"; export declare class AkiHttpListener implements IHttpListener { protected httpRouter: HttpRouter; protected serializers: Serializer[]; protected logger: ILogger; protected jsonUtil: JsonUtil; protected httpResponse: HttpResponseUtil; + protected localisationService: LocalisationService; protected httpBufferHandler: HttpBufferHandler; constructor(httpRouter: HttpRouter, // TODO: delay required - serializers: Serializer[], logger: ILogger, jsonUtil: JsonUtil, httpResponse: HttpResponseUtil, httpBufferHandler: HttpBufferHandler); + serializers: Serializer[], logger: ILogger, jsonUtil: JsonUtil, httpResponse: HttpResponseUtil, localisationService: LocalisationService, httpBufferHandler: HttpBufferHandler); canHandle(_: string, req: IncomingMessage): boolean; handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): void; sendResponse(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: Buffer, output: string): void; diff --git a/TypeScript/15HttpListenerExample/types/services/BotEquipmentFilterService.d.ts b/TypeScript/15HttpListenerExample/types/services/BotEquipmentFilterService.d.ts index 632f961..ae72cc3 100644 --- a/TypeScript/15HttpListenerExample/types/services/BotEquipmentFilterService.d.ts +++ b/TypeScript/15HttpListenerExample/types/services/BotEquipmentFilterService.d.ts @@ -1,12 +1,12 @@ import { IBotType } from "../models/eft/common/tables/IBotType"; -import { EquipmentFilters, EquipmentFilterDetails, IBotConfig } from "../models/spt/config/IBotConfig"; +import { EquipmentFilters, EquipmentFilterDetails, IBotConfig, WeightingAdjustmentDetails } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; export declare class BotEquipmentFilterService { protected logger: ILogger; protected configServer: ConfigServer; protected botConfig: IBotConfig; - protected botEquipmentFilterlists: Record; + protected botEquipmentConfig: Record; constructor(logger: ILogger, configServer: ConfigServer); /** * Filter a bots data to exclude equipment and cartridges defines in the botConfig @@ -30,6 +30,20 @@ export declare class BotEquipmentFilterService { * @returns EquipmentFilterDetails object */ protected getBotEquipmentWhitelist(botRole: string, playerLevel: number): EquipmentFilterDetails; + /** + * Retreive clothing weighting adjustments from bot.json config + * @param botRole Bot type to get adjustments for + * @param playerLevel level of player + * @returns Weighting adjustments for bots clothing + */ + protected getBotClothingAdjustments(botRole: string, playerLevel: number): WeightingAdjustmentDetails; + /** + * Retreive item weighting adjustments from bot.json config + * @param botRole Bot type to get adjustments for + * @param playerLevel level of player + * @returns Weighting adjustments for bot items + */ + protected getBotWeightingAdjustments(botRole: string, playerLevel: number): WeightingAdjustmentDetails; /** * Filter bot equipment based on blacklist and whitelist from config/bot.json * Prioritises whitelist first, if one is found blacklist is ignored @@ -47,4 +61,10 @@ export declare class BotEquipmentFilterService { * @returns Filtered bot file */ protected filterCartridges(baseBotNode: IBotType, blacklist: EquipmentFilterDetails, whitelist: EquipmentFilterDetails): void; + /** + * Add/Edit weighting changes to bot items using values from config/bot.json/equipment + * @param weightingAdjustments Weighting change to apply to bot + * @param botItemPool Bot item dictionary to adjust + */ + protected adjustWeighting(weightingAdjustments: WeightingAdjustmentDetails, botItemPool: Record): void; } diff --git a/TypeScript/15HttpListenerExample/types/services/BotGenerationCacheService.d.ts b/TypeScript/15HttpListenerExample/types/services/BotGenerationCacheService.d.ts index ba53fec..0be0576 100644 --- a/TypeScript/15HttpListenerExample/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/15HttpListenerExample/types/services/BotGenerationCacheService.d.ts @@ -8,11 +8,11 @@ export declare class BotGenerationCacheService { protected randomUtil: RandomUtil; protected jsonUtil: JsonUtil; protected botHelper: BotHelper; - protected storedBots: IBotBase[]; + protected storedBots: Map; constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, botHelper: BotHelper); /** * Store array of bots in cache, shuffle results before storage - * @param botsToStore + * @param botsToStore Bots we want to store in the cache */ storeBots(botsToStore: IBotBase[]): void; /** @@ -21,25 +21,7 @@ export declare class BotGenerationCacheService { * @param role role to retreive (assault/bossTagilla etc) * @returns IBotBase object */ - getBot(role: string): IBotBase[]; - /** - * Find a bot by its index from cache - * @param indexOfBotToReturn index to find bot by - * @returns bot profile - */ - protected getBotFromCache(indexOfBotToReturn: number): IBotBase; - /** - * Remove bot profile by index from cache - * @param indexOfBotToReturn Index of bot profile to remove - */ - protected removeBotFromCache(indexOfBotToReturn: number): void; - /** - * Get index of bot profile that matches criteria - * @param role Role of bot wanted - * @param getPmc Requested bot a pmc - * @returns index of found bot, -1 if not found - */ - protected getIndexOfBotToReturn(role: string, getPmc: boolean): number; + getBot(role: string): IBotBase; /** * Remove all cached bot profiles */ @@ -48,5 +30,5 @@ export declare class BotGenerationCacheService { * Does cache have bots * @returns true if empty */ - cacheIsEmpty(): boolean; + cacheHasBotOfRole(role: string): boolean; } diff --git a/TypeScript/15HttpListenerExample/types/services/LocaleService.d.ts b/TypeScript/15HttpListenerExample/types/services/LocaleService.d.ts index 33bea7b..8275b75 100644 --- a/TypeScript/15HttpListenerExample/types/services/LocaleService.d.ts +++ b/TypeScript/15HttpListenerExample/types/services/LocaleService.d.ts @@ -1,14 +1,42 @@ import { ILocaleConfig } from "../models/spt/config/ILocaleConfig"; +import { ILocaleGlobalBase } from "../models/spt/server/ILocaleBase"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +/** + * Handles getting locales from config or users machine + */ export declare class LocaleService { protected logger: ILogger; + protected databaseServer: DatabaseServer; protected configServer: ConfigServer; protected localeConfig: ILocaleConfig; - constructor(logger: ILogger, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, configServer: ConfigServer); /** - * Gets the locale key from the locale.json file + * Get the eft globals db file based on the configured locale in config/locale.json, if not found, fall back to 'en' + * @returns ILocaleGlobalBase + */ + getLocaleDb(): ILocaleGlobalBase; + /** + * Gets the game locale key from the locale.json file, + * if value is 'system' get system locale * @returns locale e.g en/ge/cz/cn */ - getDesiredLocale(): string; + getDesiredGameLocale(): string; + /** + * Gets the game locale key from the locale.json file, + * if value is 'system' get system locale + * @returns locale e.g en/ge/cz/cn + */ + getDesiredServerLocale(): string; + /** + * Get array of languages supported for localisation + * @returns array of locales e.g. en/fr/cn + */ + getServerSupportedLocales(): string[]; + /** + * Get the locale of the computer running the server + * @returns langage part of locale e.g. 'en' part of 'en-US' + */ + protected getPlatformLocale(): string; } diff --git a/TypeScript/15HttpListenerExample/types/services/LocalisationService.d.ts b/TypeScript/15HttpListenerExample/types/services/LocalisationService.d.ts new file mode 100644 index 0000000..519325d --- /dev/null +++ b/TypeScript/15HttpListenerExample/types/services/LocalisationService.d.ts @@ -0,0 +1,21 @@ +import { I18n } from "i18n"; +import { ILocaleConfig } from "../models/spt/config/ILocaleConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { LocaleService } from "./LocaleService"; +/** + * Handles translating server text into different langauges + */ +export declare class LocalisationService { + protected logger: ILogger; + protected localeService: LocaleService; + protected localeConfig: ILocaleConfig; + protected i18n: I18n; + constructor(logger: ILogger, localeService: LocaleService); + /** + * Get a localised value using the passed in key + * @param key Key to loop up locale for + * @param args optional arguments + * @returns Localised string + */ + getText(key: string, args?: any): string; +} diff --git a/TypeScript/15HttpListenerExample/types/services/PaymentService.d.ts b/TypeScript/15HttpListenerExample/types/services/PaymentService.d.ts index a5e538f..c9ce95a 100644 --- a/TypeScript/15HttpListenerExample/types/services/PaymentService.d.ts +++ b/TypeScript/15HttpListenerExample/types/services/PaymentService.d.ts @@ -11,6 +11,7 @@ import { IProcessSellTradeRequestData } from "../models/eft/trade/IProcessSellTr import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +import { LocalisationService } from "./LocalisationService"; export declare class PaymentService { protected logger: ILogger; protected httpResponse: HttpResponseUtil; @@ -19,8 +20,9 @@ export declare class PaymentService { protected traderHelper: TraderHelper; protected itemHelper: ItemHelper; protected inventoryHelper: InventoryHelper; + protected localisationService: LocalisationService; protected paymentHelper: PaymentHelper; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, traderHelper: TraderHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper); + constructor(logger: ILogger, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, traderHelper: TraderHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, localisationService: LocalisationService, paymentHelper: PaymentHelper); /** * Take money and insert items into return to server request * @param {Object} pmcData @@ -50,7 +52,7 @@ export declare class PaymentService { * @param pmcData Player profile to find and remove currency from * @param currencyTpl Type of currency to pay * @param amountToPay money value to pay - * @param sessionID Sessino id + * @param sessionID Session id * @param output output object to send to client * @returns IItemEventRouterResponse */ diff --git a/TypeScript/15HttpListenerExample/types/services/PlayerService.d.ts b/TypeScript/15HttpListenerExample/types/services/PlayerService.d.ts index 519b7e5..2f364d5 100644 --- a/TypeScript/15HttpListenerExample/types/services/PlayerService.d.ts +++ b/TypeScript/15HttpListenerExample/types/services/PlayerService.d.ts @@ -2,10 +2,12 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { IPlayerIncrementSkillLevelRequestData } from "../models/eft/player/IPlayerIncrementSkillLevelRequestData"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "./LocalisationService"; export declare class PlayerService { protected logger: ILogger; + protected localisationService: LocalisationService; protected databaseServer: DatabaseServer; - constructor(logger: ILogger, databaseServer: DatabaseServer); + constructor(logger: ILogger, localisationService: LocalisationService, databaseServer: DatabaseServer); /** * increases the profile skill and updates any output * @param {Object} pmcData diff --git a/TypeScript/15HttpListenerExample/types/services/PmcAiService.d.ts b/TypeScript/15HttpListenerExample/types/services/PmcAiService.d.ts deleted file mode 100644 index 0690f1f..0000000 --- a/TypeScript/15HttpListenerExample/types/services/PmcAiService.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { IBotConfig } from "../models/spt/config/IBotConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { ConfigServer } from "../servers/ConfigServer"; -/** Storing/retreving pmcRoles set at the start of a raid - its done at that point as we know what location the player is heading to */ -export declare class PmcAiService { - protected logger: ILogger; - protected configServer: ConfigServer; - protected botConfig: IBotConfig; - protected usecRole: string; - protected bearRole: string; - constructor(logger: ILogger, configServer: ConfigServer); - /** - * Convert from pmc side (usec/bear) to the side as defined in the bot config (usecType/bearType) - * @param pmcSide eft side (usec/bear) - * @returns pmc side as defined in config - */ - getPmcRole(pmcSide: "usec" | "bear" | string): string; - /** - * Set the roles for pmcs - * @param location map location to look up and use as pmc types - */ - setPmcRolesByLocation(location: string): void; - /** - * Clear the saved role from usec/bear PMCs - */ - clearPmcRoles(): void; -} diff --git a/TypeScript/15HttpListenerExample/types/services/ProfileFixerService.d.ts b/TypeScript/15HttpListenerExample/types/services/ProfileFixerService.d.ts index e772919..86a6af8 100644 --- a/TypeScript/15HttpListenerExample/types/services/ProfileFixerService.d.ts +++ b/TypeScript/15HttpListenerExample/types/services/ProfileFixerService.d.ts @@ -8,12 +8,14 @@ import { HideoutAreas } from "../models/enums/HideoutAreas"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { Watermark } from "../utils/Watermark"; +import { LocalisationService } from "./LocalisationService"; export declare class ProfileFixerService { protected logger: ILogger; protected watermark: Watermark; protected hideoutHelper: HideoutHelper; + protected localisationService: LocalisationService; protected databaseServer: DatabaseServer; - constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, databaseServer: DatabaseServer); + constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, localisationService: LocalisationService, databaseServer: DatabaseServer); /** * Find issues in the pmc profile data that may cause issues and fix them * @param pmcProfile profile to check and fix diff --git a/TypeScript/15HttpListenerExample/types/services/RagfairOfferService.d.ts b/TypeScript/15HttpListenerExample/types/services/RagfairOfferService.d.ts index a6f6b6d..86c1e52 100644 --- a/TypeScript/15HttpListenerExample/types/services/RagfairOfferService.d.ts +++ b/TypeScript/15HttpListenerExample/types/services/RagfairOfferService.d.ts @@ -11,6 +11,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { TimeUtil } from "../utils/TimeUtil"; +import { LocalisationService } from "./LocalisationService"; import { RagfairCategoriesService } from "./RagfairCategoriesService"; export declare class RagfairOfferService { protected logger: ILogger; @@ -22,12 +23,14 @@ export declare class RagfairOfferService { protected profileHelper: ProfileHelper; protected eventOutputHolder: EventOutputHolder; protected httpResponse: HttpResponseUtil; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected playerOffersLoaded: boolean; protected expiredOffers: Item[]; - protected offers: IRagfairOffer[]; + /** offerId, offer */ + protected offers: Record; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, databaseServer: DatabaseServer, saveServer: SaveServer, ragfairServerHelper: RagfairServerHelper, ragfairCategoriesService: RagfairCategoriesService, profileHelper: ProfileHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, databaseServer: DatabaseServer, saveServer: SaveServer, ragfairServerHelper: RagfairServerHelper, ragfairCategoriesService: RagfairCategoriesService, profileHelper: ProfileHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, localisationService: LocalisationService, configServer: ConfigServer); /** * Get all offers * @returns IRagfairOffer array diff --git a/TypeScript/15HttpListenerExample/types/utils/App.d.ts b/TypeScript/15HttpListenerExample/types/utils/App.d.ts index dcc2669..cc8a5af 100644 --- a/TypeScript/15HttpListenerExample/types/utils/App.d.ts +++ b/TypeScript/15HttpListenerExample/types/utils/App.d.ts @@ -1,14 +1,16 @@ -import { TimeUtil } from "./TimeUtil"; import { OnLoad } from "../di/OnLoad"; import { OnUpdate } from "../di/OnUpdate"; import { ILogger } from "../models/spt/utils/ILogger"; +import { LocalisationService } from "../services/LocalisationService"; +import { TimeUtil } from "./TimeUtil"; export declare class App { protected logger: ILogger; protected timeUtil: TimeUtil; + protected localisationService: LocalisationService; protected onLoadComponents: OnLoad[]; protected onUpdateComponents: OnUpdate[]; protected onUpdateLastRun: {}; - constructor(logger: ILogger, timeUtil: TimeUtil, onLoadComponents: OnLoad[], onUpdateComponents: OnUpdate[]); + constructor(logger: ILogger, timeUtil: TimeUtil, localisationService: LocalisationService, onLoadComponents: OnLoad[], onUpdateComponents: OnUpdate[]); load(): void; protected update(onUpdateComponents: OnUpdate[]): void; protected logUpdateException(err: any, updateable: OnUpdate): void; diff --git a/TypeScript/15HttpListenerExample/types/utils/DatabaseImporter.d.ts b/TypeScript/15HttpListenerExample/types/utils/DatabaseImporter.d.ts index 483e135..31670ae 100644 --- a/TypeScript/15HttpListenerExample/types/utils/DatabaseImporter.d.ts +++ b/TypeScript/15HttpListenerExample/types/utils/DatabaseImporter.d.ts @@ -3,15 +3,17 @@ import { IDatabaseTables } from "../models/spt/server/IDatabaseTables"; import { ILogger } from "../models/spt/utils/ILogger"; import { ImageRouter } from "../routers/ImageRouter"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { JsonUtil } from "./JsonUtil"; import { VFS } from "./VFS"; export declare class DatabaseImporter extends OnLoad { protected logger: ILogger; protected vfs: VFS; protected jsonUtil: JsonUtil; + protected localisationService: LocalisationService; protected databaseServer: DatabaseServer; protected imageRouter: ImageRouter; - constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, databaseServer: DatabaseServer, imageRouter: ImageRouter); + constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, localisationService: LocalisationService, databaseServer: DatabaseServer, imageRouter: ImageRouter); onLoad(): void; /** * Read all json files in database folder and map into a json object diff --git a/TypeScript/15HttpListenerExample/types/utils/HttpResponseUtil.d.ts b/TypeScript/15HttpListenerExample/types/utils/HttpResponseUtil.d.ts index 29502be..3a78618 100644 --- a/TypeScript/15HttpListenerExample/types/utils/HttpResponseUtil.d.ts +++ b/TypeScript/15HttpListenerExample/types/utils/HttpResponseUtil.d.ts @@ -1,10 +1,13 @@ -import { JsonUtil } from "./JsonUtil"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { INullResponseData } from "../models/eft/httpResponse/INullResponseData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; +import { BackendErrorCodes } from "../models/enums/BackendErrorCodes"; +import { LocalisationService } from "../services/LocalisationService"; +import { JsonUtil } from "./JsonUtil"; export declare class HttpResponseUtil { protected jsonUtil: JsonUtil; - constructor(jsonUtil: JsonUtil); + protected localisationService: LocalisationService; + constructor(jsonUtil: JsonUtil, localisationService: LocalisationService); protected clearString(s: string): any; noBody(data: any): any; getBody(data: T, err?: number, errmsg?: any): IGetBodyResponseData; @@ -12,5 +15,5 @@ export declare class HttpResponseUtil { emptyResponse(): IGetBodyResponseData; nullResponse(): INullResponseData; emptyArrayResponse(): IGetBodyResponseData; - appendErrorToOutput(output: IItemEventRouterResponse, message?: string, title?: string): IItemEventRouterResponse; + appendErrorToOutput(output: IItemEventRouterResponse, message?: string, errorCode?: BackendErrorCodes): IItemEventRouterResponse; } diff --git a/TypeScript/15HttpListenerExample/types/utils/RandomUtil.d.ts b/TypeScript/15HttpListenerExample/types/utils/RandomUtil.d.ts index 633e472..aa556e3 100644 --- a/TypeScript/15HttpListenerExample/types/utils/RandomUtil.d.ts +++ b/TypeScript/15HttpListenerExample/types/utils/RandomUtil.d.ts @@ -110,6 +110,12 @@ export declare class RandomUtil { getIntEx(max: number): number; getFloat(min: number, max: number): number; getBool(): boolean; + /** + * Check if number passes a check out of 100 + * @param chancePercent value check needs to be above + * @returns true if value passes check + */ + getChance100(chancePercent: number): boolean; getStringArrayValue(arr: string[]): string; getArrayValue(arr: T[]): T; getKey(node: any): string; diff --git a/TypeScript/15HttpListenerExample/types/utils/Watermark.d.ts b/TypeScript/15HttpListenerExample/types/utils/Watermark.d.ts index c6dc120..e02eba2 100644 --- a/TypeScript/15HttpListenerExample/types/utils/Watermark.d.ts +++ b/TypeScript/15HttpListenerExample/types/utils/Watermark.d.ts @@ -1,20 +1,15 @@ import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { LocalisationService } from "../services/LocalisationService"; export declare class WatermarkLocale { - protected locales: { - "en-US": { - description: string[]; - warning: string[]; - modding: string[]; - }; - "zh-CN": { - description: string[]; - warning: string[]; - modding: string[]; - }; + protected localisationService: LocalisationService; + constructor(localisationService: LocalisationService); + protected watermark: { + description: string[]; + warning: string[]; + modding: string[]; }; - getLocale(): string; getDescription(): string[]; getWarning(): string[]; getModding(): string[]; @@ -22,9 +17,10 @@ export declare class WatermarkLocale { export declare class Watermark { protected logger: ILogger; protected configServer: ConfigServer; + protected localisationService: LocalisationService; protected watermarkLocale?: WatermarkLocale; protected akiConfig: ICoreConfig; - constructor(logger: ILogger, configServer: ConfigServer, watermarkLocale?: WatermarkLocale); + constructor(logger: ILogger, configServer: ConfigServer, localisationService: LocalisationService, watermarkLocale?: WatermarkLocale); protected text: string[]; protected versionLabel: string; initialize(): void; diff --git a/TypeScript/1LogToConsole/types/models/eft/common/tables/IBotBase.d.ts b/TypeScript/1LogToConsole/types/models/eft/common/tables/IBotBase.d.ts index 1c28ae0..2b418c1 100644 --- a/TypeScript/1LogToConsole/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/1LogToConsole/types/models/eft/common/tables/IBotBase.d.ts @@ -107,6 +107,7 @@ export interface CurrentMax { Maximum: number; } export interface Inventory { + discardLimits: Record; items: Item[]; equipment: string; stash: string; diff --git a/TypeScript/2EditDatabase/types/callbacks/BotCallbacks.d.ts b/TypeScript/2EditDatabase/types/callbacks/BotCallbacks.d.ts index 2db60dc..827015e 100644 --- a/TypeScript/2EditDatabase/types/callbacks/BotCallbacks.d.ts +++ b/TypeScript/2EditDatabase/types/callbacks/BotCallbacks.d.ts @@ -8,8 +8,29 @@ export declare class BotCallbacks { protected botController: BotController; protected httpResponse: HttpResponseUtil; constructor(botController: BotController, httpResponse: HttpResponseUtil); + /** + * Handle singleplayer/settings/bot/limit + * @returns string + */ getBotLimit(url: string, info: IEmptyRequestData, sessionID: string): string; + /** + * Handle singleplayer/settings/bot/difficulty + * @returns string + */ getBotDifficulty(url: string, info: IEmptyRequestData, sessionID: string): string; + /** + * Handle client/game/bot/generate + * @returns IGetBodyResponseData + */ generateBots(url: string, info: IGenerateBotsRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle singleplayer/settings/bot/maxCap + * @returns string + */ getBotCap(): string; + /** + * Handle singleplayer/settings/bot/getBotBehaviours + * @returns string + */ + getBotBehaviours(): string; } diff --git a/TypeScript/2EditDatabase/types/callbacks/CustomizationCallbacks.d.ts b/TypeScript/2EditDatabase/types/callbacks/CustomizationCallbacks.d.ts index 3bab8c0..75d5701 100644 --- a/TypeScript/2EditDatabase/types/callbacks/CustomizationCallbacks.d.ts +++ b/TypeScript/2EditDatabase/types/callbacks/CustomizationCallbacks.d.ts @@ -3,6 +3,7 @@ import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { IPmcData } from "../models/eft/common/IPmcData"; import { ISuit } from "../models/eft/common/tables/ITrader"; import { IBuyClothingRequestData } from "../models/eft/customization/IBuyClothingRequestData"; +import { IGetSuitsResponse } from "../models/eft/customization/IGetSuitsResponse"; import { IWearClothingRequestData } from "../models/eft/customization/IWearClothingRequestData"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; @@ -13,10 +14,15 @@ export declare class CustomizationCallbacks { protected saveServer: SaveServer; protected httpResponse: HttpResponseUtil; constructor(customizationController: CustomizationController, saveServer: SaveServer, httpResponse: HttpResponseUtil); - getSuits(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<{ - _id: string; - suites: string[]; - }>; + /** + * Handles client/trading/customization/storage + * @returns + */ + getSuits(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handles client/trading/customization + * @returns ISuit[] + */ getTraderSuits(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; wearClothing(pmcData: IPmcData, body: IWearClothingRequestData, sessionID: string): IItemEventRouterResponse; buyClothing(pmcData: IPmcData, body: IBuyClothingRequestData, sessionID: string): IItemEventRouterResponse; diff --git a/TypeScript/2EditDatabase/types/callbacks/DataCallbacks.d.ts b/TypeScript/2EditDatabase/types/callbacks/DataCallbacks.d.ts index 04566ff..2efcf81 100644 --- a/TypeScript/2EditDatabase/types/callbacks/DataCallbacks.d.ts +++ b/TypeScript/2EditDatabase/types/callbacks/DataCallbacks.d.ts @@ -12,15 +12,42 @@ import { ILanguageBase } from "../models/spt/server/ILocaleBase"; import { ISettingsBase } from "../models/spt/server/ISettingsBase"; import { DatabaseServer } from "../servers/DatabaseServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +/** + * Handle client requests + */ export declare class DataCallbacks { protected httpResponse: HttpResponseUtil; protected databaseServer: DatabaseServer; constructor(httpResponse: HttpResponseUtil, databaseServer: DatabaseServer); + /** + * Handles client/settings + * @returns ISettingsBase + */ getSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handles client/globals + * @returns IGlobals + */ getGlobals(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handles client/items + * @returns string + */ getTemplateItems(url: string, info: IEmptyRequestData, sessionID: string): string; + /** + * Handles client/handbook/templates + * @returns IHandbookBase + */ getTemplateHandbook(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handles client/customization + * @returns Record>; + /** + * Handles client/account/customization + * @returns string[] + */ getTemplateCharacter(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getTemplateQuests(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getHideoutSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; @@ -28,6 +55,6 @@ export declare class DataCallbacks { gethideoutProduction(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getHideoutScavcase(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getLocalesLanguages(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - getLocalesMenu(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + getLocalesMenu(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getLocalesGlobal(url: string, info: IEmptyRequestData, sessionID: string): string; } diff --git a/TypeScript/2EditDatabase/types/callbacks/DialogueCallbacks.d.ts b/TypeScript/2EditDatabase/types/callbacks/DialogueCallbacks.d.ts index 634f90b..7b2eeae 100644 --- a/TypeScript/2EditDatabase/types/callbacks/DialogueCallbacks.d.ts +++ b/TypeScript/2EditDatabase/types/callbacks/DialogueCallbacks.d.ts @@ -26,15 +26,27 @@ export declare class DialogueCallbacks extends OnUpdate { protected httpResponse: HttpResponseUtil; protected dialogueController: DialogueController; constructor(hashUtil: HashUtil, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, dialogueController: DialogueController); + /** + * Handles client/friend/list + * @returns IGetFriendListDataResponse + */ getFriendList(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handles client/chatServer/list + * @returns + */ getChatServerList(url: string, info: IGetChatServerListRequestData, sessionID: string): IGetBodyResponseData; getMailDialogList(url: string, info: IGetMailDialogListRequestData, sessionID: string): IGetBodyResponseData; getMailDialogView(url: string, info: IGetMailDialogViewRequestData, sessionID: string): IGetBodyResponseData; - getMailDialogInfo(url: string, info: IGetMailDialogInfoRequestData, sessionID: string): IGetBodyResponseData; + getMailDialogInfo(url: string, info: IGetMailDialogInfoRequestData, sessionID: string): IGetBodyResponseData; removeDialog(url: string, info: IRemoveDialogRequestData, sessionID: string): IGetBodyResponseData; pinDialog(url: string, info: IPinDialogRequestData, sessionID: string): IGetBodyResponseData; unpinDialog(url: string, info: IPinDialogRequestData, sessionID: string): IGetBodyResponseData; setRead(url: string, info: ISetDialogReadRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handles client/mail/dialog/getAllAttachments + * @returns IGetAllAttachmentsResponse + */ getAllAttachments(url: string, info: IGetAllAttachmentsRequestData, sessionID: string): IGetBodyResponseData; listOutbox(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; listInbox(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; diff --git a/TypeScript/2EditDatabase/types/callbacks/GameCallbacks.d.ts b/TypeScript/2EditDatabase/types/callbacks/GameCallbacks.d.ts index 5e4c240..3a6b7e6 100644 --- a/TypeScript/2EditDatabase/types/callbacks/GameCallbacks.d.ts +++ b/TypeScript/2EditDatabase/types/callbacks/GameCallbacks.d.ts @@ -3,6 +3,9 @@ import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { ICheckVersionResponse } from "../models/eft/game/ICheckVersionResponse"; import { IGameConfigResponse } from "../models/eft/game/IGameConfigResponse"; import { IGameEmptyCrcRequestData } from "../models/eft/game/IGameEmptyCrcRequestData"; +import { IGameKeepAliveResponse } from "../models/eft/game/IGameKeepAliveResponse"; +import { IGameLogoutResponseData } from "../models/eft/game/IGameLogoutResponseData"; +import { IGameStartResponse } from "../models/eft/game/IGameStartResponse"; import { IReportNicknameRequestData } from "../models/eft/game/IReportNicknameRequestData"; import { IServerDetails } from "../models/eft/game/IServerDetails"; import { IVersionValidateRequestData } from "../models/eft/game/IVersionValidateRequestData"; @@ -15,13 +18,37 @@ declare class GameCallbacks { protected watermark: Watermark; protected gameController: GameController; constructor(httpResponse: HttpResponseUtil, watermark: Watermark, gameController: GameController); + /** + * Handle client/game/version/validate + * @returns INullResponseData + */ versionValidate(url: string, info: IVersionValidateRequestData, sessionID: string): INullResponseData; - gameStart(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - gameLogout(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/game/start + * @returns IGameStartResponse + */ + gameStart(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/game/logout + * @returns IGameLogoutResponseData + */ + gameLogout(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/game/config + * @returns IGameConfigResponse + */ getGameConfig(url: string, info: IGameEmptyCrcRequestData, sessionID: string): IGetBodyResponseData; getServer(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; validateGameVersion(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - gameKeepalive(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/game/keepalive + * @returns IGameKeepAliveResponse + */ + gameKeepalive(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle singleplayer/settings/version + * @returns string + */ getVersion(url: string, info: IEmptyRequestData, sessionID: string): string; reportNickname(url: string, info: IReportNicknameRequestData, sessionID: string): INullResponseData; } diff --git a/TypeScript/2EditDatabase/types/callbacks/HealthCallbacks.d.ts b/TypeScript/2EditDatabase/types/callbacks/HealthCallbacks.d.ts index 8672be7..7edf03e 100644 --- a/TypeScript/2EditDatabase/types/callbacks/HealthCallbacks.d.ts +++ b/TypeScript/2EditDatabase/types/callbacks/HealthCallbacks.d.ts @@ -21,7 +21,19 @@ export declare class HealthCallbacks { * @returns empty response, no data sent back to client */ syncHealth(url: string, info: ISyncHealthRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle Eat + * @returns IItemEventRouterResponse + */ offraidEat(pmcData: IPmcData, body: IOffraidEatRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle Heal + * @returns IItemEventRouterResponse + */ offraidHeal(pmcData: IPmcData, body: IOffraidHealRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle RestoreHealth + * @returns IItemEventRouterResponse + */ healthTreatment(pmcData: IPmcData, info: IHealthTreatmentRequestData, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/2EditDatabase/types/callbacks/HideoutCallbacks.d.ts b/TypeScript/2EditDatabase/types/callbacks/HideoutCallbacks.d.ts index 99ab4c9..e39e806 100644 --- a/TypeScript/2EditDatabase/types/callbacks/HideoutCallbacks.d.ts +++ b/TypeScript/2EditDatabase/types/callbacks/HideoutCallbacks.d.ts @@ -19,14 +19,77 @@ export declare class HideoutCallbacks extends OnUpdate { protected hideoutConfig: IHideoutConfig; constructor(hideoutController: HideoutController, // TODO: delay needed configServer: ConfigServer); + /** + * Handle HideoutUpgrade + * @param pmcData + * @param body + * @param sessionID + * @returns + */ upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutUpgradeComplete + * @param pmcData + * @param body + * @param sessionID + * @returns + */ upgradeComplete(pmcData: IPmcData, body: IHideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutPutItemsInAreaSlots + * @param pmcData + * @param body + * @param sessionID + * @returns + */ putItemsInAreaSlots(pmcData: IPmcData, body: IHideoutPutItemInRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutTakeItemsFromAreaSlots + * @param pmcData + * @param body + * @param sessionID + * @returns + */ takeItemsFromAreaSlots(pmcData: IPmcData, body: IHideoutTakeItemOutRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutToggleArea + * @param pmcData + * @param body + * @param sessionID + * @returns + */ toggleArea(pmcData: IPmcData, body: IHideoutToggleAreaRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutSingleProductionStart + * @param pmcData + * @param body + * @param sessionID + * @returns + */ singleProductionStart(pmcData: IPmcData, body: IHideoutSingleProductionStartRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutScavCaseProductionStart + * @param pmcData + * @param body + * @param sessionID + * @returns + */ scavCaseProductionStart(pmcData: IPmcData, body: IHideoutScavCaseStartRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutContinuousProductionStart + * @param pmcData + * @param body + * @param sessionID + * @returns + */ continuousProductionStart(pmcData: IPmcData, body: IHideoutContinousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutTakeProduction + * @param pmcData + * @param body + * @param sessionID + * @returns + */ takeProduction(pmcData: IPmcData, body: IHideoutTakeProductionRequestData, sessionID: string): IItemEventRouterResponse; onUpdate(timeSinceLastRun: number): boolean; getRoute(): string; diff --git a/TypeScript/2EditDatabase/types/callbacks/InraidCallbacks.d.ts b/TypeScript/2EditDatabase/types/callbacks/InraidCallbacks.d.ts index 05bcce4..918bfaf 100644 --- a/TypeScript/2EditDatabase/types/callbacks/InraidCallbacks.d.ts +++ b/TypeScript/2EditDatabase/types/callbacks/InraidCallbacks.d.ts @@ -1,23 +1,49 @@ import { InraidController } from "../controllers/InraidController"; -import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { INullResponseData } from "../models/eft/httpResponse/INullResponseData"; import { IRegisterPlayerRequestData } from "../models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; -import { IAirdropConfig } from "../models/spt/config/IAirdropConfig"; -import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; -import { ConfigServer } from "../servers/ConfigServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +/** + * Handle client requests + */ export declare class InraidCallbacks { protected inraidController: InraidController; protected httpResponse: HttpResponseUtil; - protected configServer: ConfigServer; - protected airdropConfig: IAirdropConfig; - protected inraidConfig: IInRaidConfig; - constructor(inraidController: InraidController, httpResponse: HttpResponseUtil, configServer: ConfigServer); + constructor(inraidController: InraidController, httpResponse: HttpResponseUtil); + /** + * Handle client/location/getLocalloot + * @param url + * @param info register player request + * @param sessionID Session id + * @returns Null http response + */ registerPlayer(url: string, info: IRegisterPlayerRequestData, sessionID: string): INullResponseData; + /** + * Handle raid/profile/save + * @param url + * @param info Save progress request + * @param sessionID Session id + * @returns Null http response + */ saveProgress(url: string, info: ISaveProgressRequestData, sessionID: string): INullResponseData; + /** + * Handle singleplayer/settings/raid/endstate + * @returns + */ getRaidEndState(): string; - getRaidMenuSettings(url: string, info: IEmptyRequestData, sessionID: string): string; - getWeaponDurability(url: string, info: any, sessionID: string): string; - getAirdropConfig(url: string, info: any, sessionID: string): string; + /** + * Handle singleplayer/settings/raid/menu + * @returns JSON as string + */ + getRaidMenuSettings(): string; + /** + * Handle singleplayer/settings/weapon/durability + * @returns + */ + getWeaponDurability(): string; + /** + * Handle singleplayer/airdrop/config + * @returns JSON as string + */ + getAirdropConfig(): string; } diff --git a/TypeScript/2EditDatabase/types/callbacks/InsuranceCallbacks.d.ts b/TypeScript/2EditDatabase/types/callbacks/InsuranceCallbacks.d.ts index 8835ba2..a171e1c 100644 --- a/TypeScript/2EditDatabase/types/callbacks/InsuranceCallbacks.d.ts +++ b/TypeScript/2EditDatabase/types/callbacks/InsuranceCallbacks.d.ts @@ -17,7 +17,15 @@ export declare class InsuranceCallbacks extends OnUpdate { protected configServer: ConfigServer; protected insuranceConfig: IInsuranceConfig; constructor(insuranceController: InsuranceController, insuranceService: InsuranceService, httpResponse: HttpResponseUtil, configServer: ConfigServer); + /** + * Handle client/insurance/items/list/cost + * @returns IGetInsuranceCostResponseData + */ getInsuranceCost(url: string, info: IGetInsuranceCostRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle Insure + * @returns IItemEventRouterResponse + */ insure(pmcData: IPmcData, body: IInsureRequestData, sessionID: string): IItemEventRouterResponse; onUpdate(secondsSinceLastRun: number): boolean; getRoute(): string; diff --git a/TypeScript/2EditDatabase/types/callbacks/InventoryCallbacks.d.ts b/TypeScript/2EditDatabase/types/callbacks/InventoryCallbacks.d.ts index 9ab1486..46bf6fd 100644 --- a/TypeScript/2EditDatabase/types/callbacks/InventoryCallbacks.d.ts +++ b/TypeScript/2EditDatabase/types/callbacks/InventoryCallbacks.d.ts @@ -16,6 +16,7 @@ import { IInventorySwapRequestData } from "../models/eft/inventory/IInventorySwa import { IInventoryTagRequestData } from "../models/eft/inventory/IInventoryTagRequestData"; import { IInventoryToggleRequestData } from "../models/eft/inventory/IInventoryToggleRequestData"; import { IInventoryTransferRequestData } from "../models/eft/inventory/IInventoryTransferRequestData"; +import { IOpenRandomLootContainerRequestData } from "../models/eft/inventory/IOpenRandomLootContainerRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; export declare class InventoryCallbacks { protected inventoryController: InventoryController; @@ -36,4 +37,5 @@ export declare class InventoryCallbacks { createMapMarker(pmcData: IPmcData, body: IInventoryCreateMarkerRequestData, sessionID: string): IItemEventRouterResponse; deleteMapMarker(pmcData: IPmcData, body: IInventoryDeleteMarkerRequestData, sessionID: string): IItemEventRouterResponse; editMapMarker(pmcData: IPmcData, body: IInventoryEditMarkerRequestData, sessionID: string): IItemEventRouterResponse; + openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/2EditDatabase/types/callbacks/ItemEventCallbacks.d.ts b/TypeScript/2EditDatabase/types/callbacks/ItemEventCallbacks.d.ts index f4f04f9..fbb0b5f 100644 --- a/TypeScript/2EditDatabase/types/callbacks/ItemEventCallbacks.d.ts +++ b/TypeScript/2EditDatabase/types/callbacks/ItemEventCallbacks.d.ts @@ -1,4 +1,5 @@ import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; +import { Warning } from "../models/eft/itemEvent/IItemEventRouterBase"; import { IItemEventRouterRequest } from "../models/eft/itemEvent/IItemEventRouterRequest"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { ItemEventRouter } from "../routers/ItemEventRouter"; @@ -8,4 +9,5 @@ export declare class ItemEventCallbacks { protected itemEventRouter: ItemEventRouter; constructor(httpResponse: HttpResponseUtil, itemEventRouter: ItemEventRouter); handleEvents(url: string, info: IItemEventRouterRequest, sessionID: string): IGetBodyResponseData; + protected getErrorCode(warnings: Warning[]): number; } diff --git a/TypeScript/2EditDatabase/types/callbacks/MatchCallbacks.d.ts b/TypeScript/2EditDatabase/types/callbacks/MatchCallbacks.d.ts index 2a92ef5..10fbc44 100644 --- a/TypeScript/2EditDatabase/types/callbacks/MatchCallbacks.d.ts +++ b/TypeScript/2EditDatabase/types/callbacks/MatchCallbacks.d.ts @@ -34,6 +34,10 @@ export declare class MatchCallbacks { serverAvailable(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData | IGetBodyResponseData; joinMatch(url: string, info: IJoinMatchRequestData, sessionID: string): IGetBodyResponseData; getMetrics(url: string, info: any, sessionID: string): IGetBodyResponseData; + /** + * Handle client/match/group/status + * @returns + */ getGroupStatus(url: string, info: IGetGroupStatusRequestData, sessionID: string): IGetBodyResponseData; createGroup(url: string, info: ICreateGroupRequestData, sessionID: string): IGetBodyResponseData; deleteGroup(url: string, info: any, sessionID: string): INullResponseData; diff --git a/TypeScript/2EditDatabase/types/callbacks/NotifierCallbacks.d.ts b/TypeScript/2EditDatabase/types/callbacks/NotifierCallbacks.d.ts index c42058f..fab325b 100644 --- a/TypeScript/2EditDatabase/types/callbacks/NotifierCallbacks.d.ts +++ b/TypeScript/2EditDatabase/types/callbacks/NotifierCallbacks.d.ts @@ -4,6 +4,7 @@ import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { INotifierChannel } from "../models/eft/notifier/INotifier"; import { ISelectProfileRequestData } from "../models/eft/notifier/ISelectProfileRequestData"; +import { ISelectProfileResponse } from "../models/eft/notifier/ISelectProfileResponse"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; export declare class NotifierCallbacks { protected httpServerHelper: HttpServerHelper; @@ -19,6 +20,10 @@ export declare class NotifierCallbacks { sendNotification(sessionID: string, req: any, resp: any, data: any): void; getNotifier(url: string, info: any, sessionID: string): IGetBodyResponseData; createNotifierChannel(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - selectProfile(url: string, info: ISelectProfileRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/game/profile/select + * @returns ISelectProfileResponse + */ + selectProfile(url: string, info: ISelectProfileRequestData, sessionID: string): IGetBodyResponseData; notify(url: string, info: any, sessionID: string): string; } diff --git a/TypeScript/2EditDatabase/types/callbacks/QuestCallbacks.d.ts b/TypeScript/2EditDatabase/types/callbacks/QuestCallbacks.d.ts index 559c29e..2a3eb20 100644 --- a/TypeScript/2EditDatabase/types/callbacks/QuestCallbacks.d.ts +++ b/TypeScript/2EditDatabase/types/callbacks/QuestCallbacks.d.ts @@ -21,6 +21,13 @@ export declare class QuestCallbacks { acceptQuest(pmcData: IPmcData, body: IAcceptQuestRequestData, sessionID: string): IItemEventRouterResponse; completeQuest(pmcData: IPmcData, body: ICompleteQuestRequestData, sessionID: string): IItemEventRouterResponse; handoverQuest(pmcData: IPmcData, body: IHandoverQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle client/quest/list + * @param url + * @param info + * @param sessionID + * @returns + */ listQuests(url: string, info: IListQuestsRequestData, sessionID: string): IGetBodyResponseData; activityPeriods(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; } diff --git a/TypeScript/2EditDatabase/types/callbacks/RagfairCallbacks.d.ts b/TypeScript/2EditDatabase/types/callbacks/RagfairCallbacks.d.ts index c609f2f..37f3807 100644 --- a/TypeScript/2EditDatabase/types/callbacks/RagfairCallbacks.d.ts +++ b/TypeScript/2EditDatabase/types/callbacks/RagfairCallbacks.d.ts @@ -35,7 +35,7 @@ export declare class RagfairCallbacks extends OnLoadOnUpdate { getRoute(): string; search(url: string, info: ISearchRequestData, sessionID: string): IGetBodyResponseData; getMarketPrice(url: string, info: IGetMarketPriceRequestData, sessionID: string): IGetBodyResponseData; - getItemPrices(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + getItemPrices(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData>; addOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; removeOffer(pmcData: IPmcData, info: IRemoveOfferRequestData, sessionID: string): IItemEventRouterResponse; extendOffer(pmcData: IPmcData, info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; diff --git a/TypeScript/2EditDatabase/types/callbacks/TraderCallbacks.d.ts b/TypeScript/2EditDatabase/types/callbacks/TraderCallbacks.d.ts index e4fd099..40a1455 100644 --- a/TypeScript/2EditDatabase/types/callbacks/TraderCallbacks.d.ts +++ b/TypeScript/2EditDatabase/types/callbacks/TraderCallbacks.d.ts @@ -12,6 +12,10 @@ export declare class TraderCallbacks extends OnLoadOnUpdate { onUpdate(): boolean; getRoute(): string; getTraderSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/trading/api/getUserAssortPrice/trader + * @returns + */ getProfilePurchases(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData>; getTrader(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getAssort(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; diff --git a/TypeScript/2EditDatabase/types/callbacks/WeatherCallbacks.d.ts b/TypeScript/2EditDatabase/types/callbacks/WeatherCallbacks.d.ts index ae784c8..f9d2002 100644 --- a/TypeScript/2EditDatabase/types/callbacks/WeatherCallbacks.d.ts +++ b/TypeScript/2EditDatabase/types/callbacks/WeatherCallbacks.d.ts @@ -1,10 +1,15 @@ import { WeatherController } from "../controllers/WeatherController"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; +import { IWeatherData } from "../models/eft/weather/IWeatherData"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; export declare class WeatherCallbacks { protected httpResponse: HttpResponseUtil; protected weatherController: WeatherController; constructor(httpResponse: HttpResponseUtil, weatherController: WeatherController); - getWeather(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/weather + * @returns IWeatherData + */ + getWeather(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; } diff --git a/TypeScript/2EditDatabase/types/context/ContextVariableType.d.ts b/TypeScript/2EditDatabase/types/context/ContextVariableType.d.ts index 5fc1704..a7dd9b5 100644 --- a/TypeScript/2EditDatabase/types/context/ContextVariableType.d.ts +++ b/TypeScript/2EditDatabase/types/context/ContextVariableType.d.ts @@ -1,4 +1,8 @@ export declare enum ContextVariableType { + /** Logged in users session id */ SESSION_ID = 0, - MATCH_INFO = 1 + /** Currently acive raid information */ + MATCH_INFO = 1, + /** Timestamp when client first connected */ + CLIENT_START_TIMESTAMP = 2 } diff --git a/TypeScript/2EditDatabase/types/controllers/BotController.d.ts b/TypeScript/2EditDatabase/types/controllers/BotController.d.ts index a5111d5..92317c3 100644 --- a/TypeScript/2EditDatabase/types/controllers/BotController.d.ts +++ b/TypeScript/2EditDatabase/types/controllers/BotController.d.ts @@ -1,6 +1,8 @@ import { ApplicationContext } from "../context/ApplicationContext"; import { BotGenerator } from "../generators/BotGenerator"; +import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { IGenerateBotsRequestData } from "../models/eft/bot/IGenerateBotsRequestData"; import { IBotBase } from "../models/eft/common/tables/IBotBase"; import { IBotCore } from "../models/eft/common/tables/IBotCore"; @@ -10,18 +12,23 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; -import { PmcAiService } from "../services/PmcAiService"; +import { LocalisationService } from "../services/LocalisationService"; +import { JsonUtil } from "../utils/JsonUtil"; export declare class BotController { protected logger: ILogger; protected databaseServer: DatabaseServer; protected botGenerator: BotGenerator; protected botHelper: BotHelper; - protected pmcAiService: PmcAiService; + protected botDifficultyHelper: BotDifficultyHelper; protected botGenerationCacheService: BotGenerationCacheService; + protected localisationService: LocalisationService; + protected weightedRandomHelper: WeightedRandomHelper; protected configServer: ConfigServer; protected applicationContext: ApplicationContext; + protected jsonUtil: JsonUtil; protected botConfig: IBotConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, pmcAiService: PmcAiService, botGenerationCacheService: BotGenerationCacheService, configServer: ConfigServer, applicationContext: ApplicationContext); + static readonly pmcTypeLabel = "PMC"; + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); /** * Return the number of bot loadout varieties to be generated * @param type bot Type we want the loadout gen count for @@ -37,7 +44,6 @@ export declare class BotController { * @returns Difficulty object */ getBotDifficulty(type: string, difficulty: string): Difficulty; - protected getPmcDifficultySettings(pmcType: "bear" | "usec", difficulty: string, usecType: string, bearType: string): Difficulty; /** * Generate bot profiles and store in cache * @param sessionId Session id @@ -51,4 +57,5 @@ export declare class BotController { * @returns cap number */ getBotCap(): number; + getPmcBotTypes(): Record>>; } diff --git a/TypeScript/2EditDatabase/types/controllers/DialogueController.d.ts b/TypeScript/2EditDatabase/types/controllers/DialogueController.d.ts index 1b72522..9c8b728 100644 --- a/TypeScript/2EditDatabase/types/controllers/DialogueController.d.ts +++ b/TypeScript/2EditDatabase/types/controllers/DialogueController.d.ts @@ -23,7 +23,7 @@ export declare class DialogueController { * Get the content of a dialogue * @param dialogueID Dialog id * @param sessionID Session Id - * @returns + * @returns DialogueInfo */ getDialogueInfo(dialogueID: string, sessionID: string): DialogueInfo; /** diff --git a/TypeScript/2EditDatabase/types/controllers/GameController.d.ts b/TypeScript/2EditDatabase/types/controllers/GameController.d.ts index 3bfbdb1..f4f5849 100644 --- a/TypeScript/2EditDatabase/types/controllers/GameController.d.ts +++ b/TypeScript/2EditDatabase/types/controllers/GameController.d.ts @@ -1,3 +1,4 @@ +import { ApplicationContext } from "../context/ApplicationContext"; import { GameEventHelper } from "../helpers/GameEventHelper"; import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; @@ -14,6 +15,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; +import { LocalisationService } from "../services/LocalisationService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { Watermark } from "../utils/Watermark"; export declare class GameController { @@ -24,14 +26,33 @@ export declare class GameController { protected localeService: LocaleService; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; + protected localisationService: LocalisationService; protected gameEventHelper: GameEventHelper; + protected applicationContext: ApplicationContext; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; protected coreConfig: ICoreConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, gameEventHelper: GameEventHelper, configServer: ConfigServer); - gameStart(_url: string, _info: IEmptyRequestData, sessionID: string): void; + constructor(logger: ILogger, databaseServer: DatabaseServer, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, gameEventHelper: GameEventHelper, applicationContext: ApplicationContext, configServer: ConfigServer); + gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; + /** + * Check if current date falls inside any of the seasons events pased in, if so, handle them + * @param seasonalEvents events to check for + */ protected checkForAndEnableSeasonalEvents(seasonalEvents: ISeasonalEvent[]): void; + /** + * Make adjusted to server code based on the name of the event passed in + * @param globalConfig globals.json + * @param eventName Name of the event to enable. e.g. Christmas + */ protected updateGlobalEvents(globalConfig: Config, eventName: string): void; + /** + * Read in data from seasonalEvents.json and add found equipment items to bots + * @param eventName Name of the event to read equipment in from config + */ + protected addEventGearToScavs(eventName: string): void; + /** + * Set Khorovod(dancing tree) chance to 100% on all maps that support it + */ protected enableDancingTree(): void; /** * Make non-trigger-spawned raiders spawn earlier + always @@ -40,5 +61,6 @@ export declare class GameController { protected logProfileDetails(fullProfile: IAkiProfile): void; getGameConfig(sessionID: string): IGameConfigResponse; getServer(): IServerDetails[]; + protected addPumpkinsToScavBackpacks(): void; getValidGameVersion(): ICheckVersionResponse; } diff --git a/TypeScript/2EditDatabase/types/controllers/HideoutController.d.ts b/TypeScript/2EditDatabase/types/controllers/HideoutController.d.ts index ada5bd9..5b6507b 100644 --- a/TypeScript/2EditDatabase/types/controllers/HideoutController.d.ts +++ b/TypeScript/2EditDatabase/types/controllers/HideoutController.d.ts @@ -23,12 +23,13 @@ import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; import { PlayerService } from "../services/PlayerService"; import { HashUtil } from "../utils/HashUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; -import { JsonUtil } from "../utils/JsonUtil"; export declare class HideoutController { protected logger: ILogger; protected hashUtil: HashUtil; @@ -45,11 +46,12 @@ export declare class HideoutController { protected profileHelper: ProfileHelper; protected hideoutHelper: HideoutHelper; protected scavCaseRewardGenerator: ScavCaseRewardGenerator; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected jsonUtil: JsonUtil; protected static nameBackendCountersCrafting: string; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, configServer: ConfigServer, jsonUtil: JsonUtil); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, localisationService: LocalisationService, configServer: ConfigServer, jsonUtil: JsonUtil); upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; upgradeComplete(pmcData: IPmcData, body: HideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; /** diff --git a/TypeScript/2EditDatabase/types/controllers/InraidController.d.ts b/TypeScript/2EditDatabase/types/controllers/InraidController.d.ts index e84eea1..39a6396 100644 --- a/TypeScript/2EditDatabase/types/controllers/InraidController.d.ts +++ b/TypeScript/2EditDatabase/types/controllers/InraidController.d.ts @@ -6,6 +6,7 @@ import { ProfileHelper } from "../helpers/ProfileHelper"; import { QuestHelper } from "../helpers/QuestHelper"; import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; +import { Item } from "../models/eft/common/tables/IItem"; import { IRegisterPlayerRequestData } from "../models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; import { IAirdropConfig } from "../models/spt/config/IAirdropConfig"; @@ -17,6 +18,9 @@ import { SaveServer } from "../servers/SaveServer"; import { InsuranceService } from "../services/InsuranceService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; +/** + * Logic for handling In Raid callbacks + */ export declare class InraidController { protected logger: ILogger; protected saveServer: SaveServer; @@ -35,14 +39,42 @@ export declare class InraidController { protected airdropConfig: IAirdropConfig; protected inraidConfig: IInRaidConfig; 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 + * Save locationid to active profiles inraid object + * @param sessionID Session id + * @param info Register player request + */ + addPlayer(sessionID: string, info: IRegisterPlayerRequestData): void; + /** + * Save profile state to disk + * Handles pmc/pscav + * @param offraidData post-raid request data + * @param sessionID Session id + */ + savePostRaidProgress(offraidData: ISaveProgressRequestData, sessionID: string): void; + /** + * Handle updating player profile post-pmc raid * @param sessionID session id - * @param offraidData post-raid data of raid + * @param offraidData post-raid data */ protected savePmcProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; + /** + * Make changes to pmc profile after they left raid dead, + * alter bodypart hp, handle insurance, delete inventory items, remove carried quest items + * @param postRaidSaveRequest post-raid save request + * @param pmcData pmc profile + * @param insuranceEnabled is insurance enabled + * @param preRaidGear gear player had before raid + * @param sessionID Session id + * @returns Updated profile object + */ + protected performPostRaidActionsWhenDead(postRaidSaveRequest: ISaveProgressRequestData, pmcData: IPmcData, insuranceEnabled: boolean, preRaidGear: Item[], sessionID: string): IPmcData; + /** + * Adjust player characters bodypart hp if they left raid early + * @param postRaidSaveRequest post raid data + * @param pmcData player profile + */ + protected updatePmcHealthPostRaid(postRaidSaveRequest: ISaveProgressRequestData, pmcData: IPmcData): void; /** * Reduce body part hp to % of max * @param pmcData profile to edit @@ -68,7 +100,31 @@ export declare class InraidController { * @param isPlayerScav Was the player a pScav */ protected markOrRemoveFoundInRaidItems(offraidData: ISaveProgressRequestData, pmcData: IPmcData, isPlayerScav: boolean): void; + /** + * Update profile after player completes scav raid + * @param scavData Scav profile + * @param sessionID Session id + * @param offraidData Post-raid save request + * @param pmcData Pmc profile + * @param isDead Is player dead + */ protected handlePostRaidPlayerScavProcess(scavData: IPmcData, sessionID: string, offraidData: ISaveProgressRequestData, pmcData: IPmcData, isDead: boolean): void; + /** + * Update profile with scav karma values based on in-raid actions + * @param pmcData Pmc profile + * @param offraidData Post-raid save request + * @param scavData Scav profile + * @param sessionID Session id + */ protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData, scavData: IPmcData, sessionID: string): void; + /** + * Get the inraid config from configs/inraid.json + * @returns InRaid Config + */ + getInraidConfig(): IInRaidConfig; + /** + * Get airdrop config from configs/airdrop.json + * @returns Airdrop config + */ getAirdropConfig(): IAirdropConfig; } diff --git a/TypeScript/2EditDatabase/types/controllers/InsuranceController.d.ts b/TypeScript/2EditDatabase/types/controllers/InsuranceController.d.ts index 14bf129..54f31b5 100644 --- a/TypeScript/2EditDatabase/types/controllers/InsuranceController.d.ts +++ b/TypeScript/2EditDatabase/types/controllers/InsuranceController.d.ts @@ -30,8 +30,7 @@ export declare class InsuranceController { protected insuranceService: InsuranceService; protected configServer: ConfigServer; protected insuranceConfig: IInsuranceConfig; - constructor(logger: ILogger, randomUtil: RandomUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, paymentService: PaymentService, // TODO: delay required - insuranceService: InsuranceService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, paymentService: PaymentService, insuranceService: InsuranceService, configServer: ConfigServer); processReturn(): void; insure(pmcData: IPmcData, body: IInsureRequestData, sessionID: string): IItemEventRouterResponse; /** diff --git a/TypeScript/2EditDatabase/types/controllers/InventoryController.d.ts b/TypeScript/2EditDatabase/types/controllers/InventoryController.d.ts index 6a1a21e..e1c08c0 100644 --- a/TypeScript/2EditDatabase/types/controllers/InventoryController.d.ts +++ b/TypeScript/2EditDatabase/types/controllers/InventoryController.d.ts @@ -1,8 +1,8 @@ -import { EventOutputHolder } from "../routers/EventOutputHolder"; import { InventoryHelper } from "../helpers/InventoryHelper"; import { PaymentHelper } from "../helpers/PaymentHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IAddItemRequestData } from "../models/eft/inventory/IAddItemRequestData"; import { IInventoryBindRequestData } from "../models/eft/inventory/IInventoryBindRequestData"; @@ -21,33 +21,46 @@ import { IInventorySwapRequestData } from "../models/eft/inventory/IInventorySwa import { IInventoryTagRequestData } from "../models/eft/inventory/IInventoryTagRequestData"; import { IInventoryToggleRequestData } from "../models/eft/inventory/IInventoryToggleRequestData"; import { IInventoryTransferRequestData } from "../models/eft/inventory/IInventoryTransferRequestData"; +import { IOpenRandomLootContainerRequestData } from "../models/eft/inventory/IOpenRandomLootContainerRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { ILogger } from "../models/spt/utils/ILogger"; +import { EventOutputHolder } from "../routers/EventOutputHolder"; import { DatabaseServer } from "../servers/DatabaseServer"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { HashUtil } from "../utils/HashUtil"; +import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { JsonUtil } from "../utils/JsonUtil"; +import { RandomUtil } from "../utils/RandomUtil"; export declare class InventoryController { protected logger: ILogger; protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; + protected randomUtil: RandomUtil; protected databaseServer: DatabaseServer; protected fenceService: FenceService; protected presetHelper: PresetHelper; protected inventoryHelper: InventoryHelper; protected ragfairOfferService: RagfairOfferService; protected profileHelper: ProfileHelper; + protected weightedRandomHelper: WeightedRandomHelper; protected paymentHelper: PaymentHelper; + protected localisationService: LocalisationService; protected eventOutputHolder: EventOutputHolder; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder); + protected httpResponseUtil: HttpResponseUtil; + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, weightedRandomHelper: WeightedRandomHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); /** * Move Item * change location of item with parentId and slotId * transfers items from one profile to another if fromOwner/toOwner is set in the body. * otherwise, move is contained within the same profile_f. - */ - moveItem(pmcData: IPmcData, body: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; + * @param pmcData Profile + * @param moveRequest Move request data + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ + moveItem(pmcData: IPmcData, moveRequest: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; /** * Remove Item from Profile * Deep tree item deletion, also removes items from insurance list @@ -122,4 +135,12 @@ export declare class InventoryController { createMapMarker(pmcData: IPmcData, body: IInventoryCreateMarkerRequestData, sessionID: string): IItemEventRouterResponse; deleteMapMarker(pmcData: IPmcData, body: IInventoryDeleteMarkerRequestData, sessionID: string): IItemEventRouterResponse; editMapMarker(pmcData: IPmcData, body: IInventoryEditMarkerRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle event fired when a container is unpacked (currently only the halloween pumpkin) + * @param pmcData Profile data + * @param body open loot container request data + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ + openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/2EditDatabase/types/controllers/LocationController.d.ts b/TypeScript/2EditDatabase/types/controllers/LocationController.d.ts index 9db3205..b6feba8 100644 --- a/TypeScript/2EditDatabase/types/controllers/LocationController.d.ts +++ b/TypeScript/2EditDatabase/types/controllers/LocationController.d.ts @@ -7,6 +7,7 @@ import { LootItem } from "../models/spt/services/LootItem"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -15,12 +16,13 @@ export declare class LocationController { protected hashUtil: HashUtil; protected logger: ILogger; protected locationGenerator: LocationGenerator; + protected localisationService: LocalisationService; protected lootGenerator: LootGenerator; protected databaseServer: DatabaseServer; protected timeUtil: TimeUtil; protected configServer: ConfigServer; protected airdropConfig: IAirdropConfig; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, logger: ILogger, locationGenerator: LocationGenerator, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer); + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer); get(location: string): ILocationBase; generate(name: string): ILocationBase; generateAll(): ILocationsGenerateAllResponse; diff --git a/TypeScript/2EditDatabase/types/controllers/MatchController.d.ts b/TypeScript/2EditDatabase/types/controllers/MatchController.d.ts index dac6a3f..2b0d150 100644 --- a/TypeScript/2EditDatabase/types/controllers/MatchController.d.ts +++ b/TypeScript/2EditDatabase/types/controllers/MatchController.d.ts @@ -19,7 +19,6 @@ import { SaveServer } from "../servers/SaveServer"; import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; import { BotLootCacheService } from "../services/BotLootCacheService"; import { MatchLocationService } from "../services/MatchLocationService"; -import { PmcAiService } from "../services/PmcAiService"; import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; export declare class MatchController { protected logger: ILogger; @@ -30,13 +29,12 @@ export declare class MatchController { protected botLootCacheService: BotLootCacheService; protected configServer: ConfigServer; protected profileSnapshotService: ProfileSnapshotService; - protected pmcAiService: PmcAiService; protected botGenerationCacheService: BotGenerationCacheService; 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, pmcAiService: PmcAiService, botGenerationCacheService: BotGenerationCacheService, applicationContext: ApplicationContext); + constructor(logger: ILogger, saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, botGenerationCacheService: BotGenerationCacheService, applicationContext: ApplicationContext); getEnabled(): boolean; getProfile(info: IGetProfileRequestData): IPmcData[]; createGroup(sessionID: string, info: ICreateGroupRequestData): any; diff --git a/TypeScript/2EditDatabase/types/controllers/RagfairController.d.ts b/TypeScript/2EditDatabase/types/controllers/RagfairController.d.ts index 5440458..95702f2 100644 --- a/TypeScript/2EditDatabase/types/controllers/RagfairController.d.ts +++ b/TypeScript/2EditDatabase/types/controllers/RagfairController.d.ts @@ -29,6 +29,7 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { RagfairServer } from "../servers/RagfairServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; import { PaymentService } from "../services/PaymentService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { RagfairPriceService } from "../services/RagfairPriceService"; @@ -62,9 +63,10 @@ export declare class RagfairController { protected ragfairOfferService: RagfairOfferService; protected ragfairRequiredItemsService: RagfairRequiredItemsService; protected ragfairOfferGenerator: RagfairOfferGenerator; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, eventOutputHolder: EventOutputHolder, ragfairServer: RagfairServer, ragfairPriceService: RagfairPriceService, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer, ragfairSellHelper: RagfairSellHelper, ragfairTaxHelper: RagfairTaxHelper, ragfairSortHelper: RagfairSortHelper, ragfairOfferHelper: RagfairOfferHelper, profileHelper: ProfileHelper, paymentService: PaymentService, handbookHelper: HandbookHelper, paymentHelper: PaymentHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, ragfairOfferGenerator: RagfairOfferGenerator, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, eventOutputHolder: EventOutputHolder, ragfairServer: RagfairServer, ragfairPriceService: RagfairPriceService, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer, ragfairSellHelper: RagfairSellHelper, ragfairTaxHelper: RagfairTaxHelper, ragfairSortHelper: RagfairSortHelper, ragfairOfferHelper: RagfairOfferHelper, profileHelper: ProfileHelper, paymentService: PaymentService, handbookHelper: HandbookHelper, paymentHelper: PaymentHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, ragfairOfferGenerator: RagfairOfferGenerator, localisationService: LocalisationService, configServer: ConfigServer); getOffers(sessionID: string, info: ISearchRequestData): IGetOffersResult; /** * Get offers for the client based on type of search being performed @@ -103,7 +105,12 @@ export declare class RagfairController { protected isLinkedSearch(info: ISearchRequestData): boolean; protected isRequiredSearch(info: ISearchRequestData): boolean; update(): void; - getItemPrice(info: IGetMarketPriceRequestData): IGetItemPriceResult; + /** + * Called when creating an offer on flea, fills values in top right corner + * @param getPriceRequest + * @returns min/avg/max values for an item based on flea offers available + */ + getItemMinAvgMaxFleaPriceValues(getPriceRequest: IGetMarketPriceRequestData): IGetItemPriceResult; addPlayerOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; createPlayerOffer(profile: IAkiProfile, requirements: Requirement[], items: Item[], sellInOnePiece: boolean, amountToSend: number): IRagfairOffer; getAllFleaPrices(): Record; diff --git a/TypeScript/2EditDatabase/types/controllers/RepeatableQuestController.d.ts b/TypeScript/2EditDatabase/types/controllers/RepeatableQuestController.d.ts index 7db5886..333583b 100644 --- a/TypeScript/2EditDatabase/types/controllers/RepeatableQuestController.d.ts +++ b/TypeScript/2EditDatabase/types/controllers/RepeatableQuestController.d.ts @@ -17,6 +17,7 @@ import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { ItemFilterService } from "../services/ItemFilterService"; +import { LocalisationService } from "../services/LocalisationService"; import { PaymentService } from "../services/PaymentService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { JsonUtil } from "../utils/JsonUtil"; @@ -64,12 +65,13 @@ export declare class RepeatableQuestController { protected profileFixerService: ProfileFixerService; protected ragfairServerHelper: RagfairServerHelper; protected eventOutputHolder: EventOutputHolder; + protected localisationService: LocalisationService; protected paymentService: PaymentService; protected objectId: ObjectId; protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * This is the method reached by the /client/repeatalbeQuests/activityPeriods endpoint * Returns an array of objects in the format of repeatable quests to the client. diff --git a/TypeScript/2EditDatabase/types/controllers/WeatherController.d.ts b/TypeScript/2EditDatabase/types/controllers/WeatherController.d.ts index ca7f5eb..631a90c 100644 --- a/TypeScript/2EditDatabase/types/controllers/WeatherController.d.ts +++ b/TypeScript/2EditDatabase/types/controllers/WeatherController.d.ts @@ -1,11 +1,18 @@ import { WeatherGenerator } from "../generators/WeatherGenerator"; import { IWeatherData } from "../models/eft/weather/IWeatherData"; import { IWeatherConfig } from "../models/spt/config/IWeatherConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; export declare class WeatherController { protected weatherGenerator: WeatherGenerator; + protected logger: ILogger; protected configServer: ConfigServer; protected weatherConfig: IWeatherConfig; - constructor(weatherGenerator: WeatherGenerator, configServer: ConfigServer); + constructor(weatherGenerator: WeatherGenerator, logger: ILogger, configServer: ConfigServer); generate(): IWeatherData; + /** + * Get the current in-raid time (MUST HAVE PLAYER LOGGED INTO CLIENT TO WORK) + * @returns Date object + */ + getCurrentInRaidTime(): Date; } diff --git a/TypeScript/2EditDatabase/types/generators/BotGenerator.d.ts b/TypeScript/2EditDatabase/types/generators/BotGenerator.d.ts index 2ac51db..a1ac9ed 100644 --- a/TypeScript/2EditDatabase/types/generators/BotGenerator.d.ts +++ b/TypeScript/2EditDatabase/types/generators/BotGenerator.d.ts @@ -1,7 +1,8 @@ +import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; import { GameEventHelper } from "../helpers/GameEventHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; -import { IGenerateBotsRequestData } from "../models/eft/bot/IGenerateBotsRequestData"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { Health as PmcHealth, IBotBase, Skills } from "../models/eft/common/tables/IBotBase"; import { Health, IBotType, Inventory } from "../models/eft/common/tables/IBotType"; import { IBotConfig } from "../models/spt/config/IBotConfig"; @@ -9,7 +10,6 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; -import { PmcAiService } from "../services/PmcAiService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; @@ -29,12 +29,13 @@ export declare class BotGenerator { protected databaseServer: DatabaseServer; protected botInventoryGenerator: BotInventoryGenerator; protected botEquipmentFilterService: BotEquipmentFilterService; + protected weightedRandomHelper: WeightedRandomHelper; protected botHelper: BotHelper; + protected botDifficultyHelper: BotDifficultyHelper; protected gameEventHelper: GameEventHelper; - protected pmcAiService: PmcAiService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botEquipmentFilterService: BotEquipmentFilterService, botHelper: BotHelper, gameEventHelper: GameEventHelper, pmcAiService: PmcAiService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botEquipmentFilterService: BotEquipmentFilterService, weightedRandomHelper: WeightedRandomHelper, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, gameEventHelper: GameEventHelper, configServer: ConfigServer); /** * Generate a player scav bot object * @param role e.g. assault / pmcbot @@ -44,12 +45,18 @@ export declare class BotGenerator { */ generatePlayerScav(sessionId: string, role: string, difficulty: string, botTemplate: IBotType): IBotBase; /** - * Generate an array of bot objects for populate a raid with + * Generate an array of bot objects based on a condition for a raid with * @param sessionId session id - * @param info request object + * @param condition request condition * @returns bot array */ - generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; + generateByCondition(sessionId: string, botCountToGenerate: number, difficulty: string, role: string, isPmc: boolean): IBotBase[]; + /** + * Get the PMCs wildSpawnType value + * @param role "usec" / "bear" + * @returns wildSpawnType value as string + */ + protected getPmcRoleByDescription(role: string): string; /** * Get a randomised PMC side based on bot config value 'isUsec' * @returns pmc side as string @@ -64,13 +71,13 @@ export declare class BotGenerator { * Create a IBotBase object with equipment/loot/exp etc * @param sessionId Session id * @param bot bots base file - * @param role botRole bot will use + * @param botRole Role bot will use (bear/usec for PMCs) * @param node Bot template from db/bots/x.json * @param isPmc Is bot to be a PMC * @param isPlayerScav is bot to be a p scav bot * @returns IBotBase object */ - protected generateBot(sessionId: string, bot: IBotBase, role: string, node: IBotType, isPmc: boolean, isPlayerScav?: boolean): IBotBase; + protected generateBot(sessionId: string, bot: IBotBase, botRole: string, node: IBotType, isPmc: boolean, isPlayerScav?: boolean): IBotBase; /** * Log the number of PMCs generated to the debug console * @param output Generated bot array, ready to send to client diff --git a/TypeScript/2EditDatabase/types/generators/BotInventoryGenerator.d.ts b/TypeScript/2EditDatabase/types/generators/BotInventoryGenerator.d.ts index c5ed545..e1efaf2 100644 --- a/TypeScript/2EditDatabase/types/generators/BotInventoryGenerator.d.ts +++ b/TypeScript/2EditDatabase/types/generators/BotInventoryGenerator.d.ts @@ -7,6 +7,7 @@ import { IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { BotLootGenerator } from "./BotLootGenerator"; @@ -20,14 +21,68 @@ export declare class BotInventoryGenerator { protected botLootGenerator: BotLootGenerator; protected botGeneratorHelper: BotGeneratorHelper; protected weightedRandomHelper: WeightedRandomHelper; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, configServer: ConfigServer); + /** + * Add equipment/weapons/loot to bot + * @param sessionId Session id + * @param templateInventory bot/x.json data from db + * @param equipmentChances Chances each item will be added to bot + * @param itemGenerationLimitsMinMax item gen limits for bot role + * @param botRole Role bot has (assault/pmcBot) + * @param isPmc Is bot being converted into a pmc + * @returns PmcInventory object with equipment/weapons/loot + */ generateInventory(sessionId: string, templateInventory: Inventory, equipmentChances: Chances, itemGenerationLimitsMinMax: Generation, botRole: string, isPmc: boolean): PmcInventory; + /** + * Create a pmcInventory object with all the base/generic items needed + * @returns PmcInventory object + */ + protected generateInventoryBase(): PmcInventory; + /** + * Add equipment to a bot + * @param templateInventory bot/x.json data from db + * @param equipmentChances Chances items will be added to bot + * @param botRole Role bot has (assault/pmcBot) + * @param botInventory Inventory to add equipment to + */ + protected generateAndAddEquipmentToBot(templateInventory: Inventory, equipmentChances: Chances, botRole: string, botInventory: PmcInventory): void; + protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory): void; + /** + * Work out what weapons bot should have equipped and add them to bot inventory + * @param templateInventory bot/x.json data from db + * @param equipmentChances Chances bot can have equipment equipped + * @param sessionId Session id + * @param botInventory Inventory to add weapons to + * @param botRole assault/pmcBot/bossTagilla etc + * @param isPmc Is the bot being generated as a pmc + * @param itemGenerationLimitsMinMax Limits for items the bot can have + */ + protected generateAndAddWeaponsToBot(templateInventory: Inventory, equipmentChances: Chances, sessionId: string, botInventory: PmcInventory, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation): void; + /** + * Calculate if the bot should have weapons in Primary/Secondary/Holster slots + * @param equipmentChances Chances bot has certain equipment + * @returns What slots bot should have weapons generated for + */ + protected getDesiredWeaponsForBot(equipmentChances: Chances): { + slot: EquipmentSlots; + shouldSpawn: boolean; + }[]; + /** + * Add weapon + spare mags/ammo to bots inventory + * @param sessionId Session id + * @param weaponSlot Weapon slot being generated + * @param templateInventory bot/x.json data from db + * @param botInventory Inventory to add weapon+mags/ammo to + * @param equipmentChances Chances bot can have equipment equipped + * @param botRole assault/pmcBot/bossTagilla etc + * @param isPmc Is the bot being generated as a pmc + * @param itemGenerationLimitsMinMax + */ protected addWeaponAndMagazinesToInventory(sessionId: string, weaponSlot: { slot: EquipmentSlots; shouldSpawn: boolean; }, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation): void; - protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory): void; - protected generateInventoryBase(): PmcInventory; } diff --git a/TypeScript/2EditDatabase/types/generators/BotLootGenerator.d.ts b/TypeScript/2EditDatabase/types/generators/BotLootGenerator.d.ts index c1f5310..3352a46 100644 --- a/TypeScript/2EditDatabase/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/2EditDatabase/types/generators/BotLootGenerator.d.ts @@ -10,6 +10,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotLootCacheService } from "../services/BotLootCacheService"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { BotWeaponGenerator } from "./BotWeaponGenerator"; @@ -23,9 +24,10 @@ export declare class BotLootGenerator { protected botWeaponGenerator: BotWeaponGenerator; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected botLootCacheService: BotLootCacheService; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, configServer: ConfigServer); generateLoot(sessionId: string, templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances): void; protected getRandomisedCount(min: number, max: number, nValue: number): number; /** @@ -113,7 +115,7 @@ export declare class BotLootGenerator { * If no limit found for a non pmc bot, fall back to defaults * @param isPmc is the bot we want limits for a pmc * @param botRole what role does the bot have - * @returns dictionary of tplIds and limit + * @returns Dictionary of tplIds and limit */ protected getItemSpawnLimitsForBotType(isPmc: boolean, botRole: string): Record; /** diff --git a/TypeScript/2EditDatabase/types/generators/BotWeaponGenerator.d.ts b/TypeScript/2EditDatabase/types/generators/BotWeaponGenerator.d.ts index 487901b..40284ea 100644 --- a/TypeScript/2EditDatabase/types/generators/BotWeaponGenerator.d.ts +++ b/TypeScript/2EditDatabase/types/generators/BotWeaponGenerator.d.ts @@ -12,6 +12,7 @@ import { IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; @@ -27,10 +28,11 @@ export declare class BotWeaponGenerator { protected randomUtil: RandomUtil; protected configServer: ConfigServer; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected localisationService: LocalisationService; protected inventoryMagGenComponents: IInventoryMagGen[]; protected readonly modMagazineSlotId = "mod_magazine"; protected botConfig: IBotConfig; - constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil, configServer: ConfigServer, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, inventoryMagGenComponents: IInventoryMagGen[]); + constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil, configServer: ConfigServer, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, inventoryMagGenComponents: IInventoryMagGen[]); /** * Pick a random weapon based on weightings and generate a functional weapon * @param equipmentSlot Primary/secondary/holster diff --git a/TypeScript/2EditDatabase/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/2EditDatabase/types/generators/RagfairOfferGenerator.d.ts index b64a7e7..23882d2 100644 --- a/TypeScript/2EditDatabase/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/2EditDatabase/types/generators/RagfairOfferGenerator.d.ts @@ -1,16 +1,19 @@ +import { HandbookHelper } from "../helpers/HandbookHelper"; import { ItemHelper } from "../helpers/ItemHelper"; +import { PaymentHelper } from "../helpers/PaymentHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; import { Item } from "../models/eft/common/tables/IItem"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { IBarterScheme } from "../models/eft/common/tables/ITrader"; -import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; +import { IRagfairOffer, OfferRequirement } from "../models/eft/ragfair/IRagfairOffer"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { RagfairCategoriesService } from "../services/RagfairCategoriesService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { RagfairPriceService } from "../services/RagfairPriceService"; @@ -27,18 +30,31 @@ export declare class RagfairOfferGenerator { protected timeUtil: TimeUtil; protected databaseServer: DatabaseServer; protected ragfairServerHelper: RagfairServerHelper; + protected handbookHelper: HandbookHelper; protected saveServer: SaveServer; protected presetHelper: PresetHelper; protected ragfairAssortGenerator: RagfairAssortGenerator; protected ragfairOfferService: RagfairOfferService; protected ragfairPriceService: RagfairPriceService; + protected localisationService: LocalisationService; + protected paymentHelper: PaymentHelper; protected ragfairCategoriesService: RagfairCategoriesService; protected fenceService: FenceService; protected itemHelper: ItemHelper; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, ragfairServerHelper: RagfairServerHelper, saveServer: SaveServer, presetHelper: PresetHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferService: RagfairOfferService, ragfairPriceService: RagfairPriceService, ragfairCategoriesService: RagfairCategoriesService, fenceService: FenceService, itemHelper: ItemHelper, configServer: ConfigServer); + protected allowedFleaPriceItemsForBarter: { + tpl: string; + price: number; + }[]; + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, ragfairServerHelper: RagfairServerHelper, handbookHelper: HandbookHelper, saveServer: SaveServer, presetHelper: PresetHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferService: RagfairOfferService, ragfairPriceService: RagfairPriceService, localisationService: LocalisationService, paymentHelper: PaymentHelper, ragfairCategoriesService: RagfairCategoriesService, fenceService: FenceService, itemHelper: ItemHelper, configServer: ConfigServer); createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; + /** + * Calculate the offer price that's listed on the flea listing + * @param offerRequirements barter requirements for offer + * @returns rouble cost of offer + */ + protected calculateOfferListingPrice(offerRequirements: OfferRequirement[]): number; /** * Get avatar url from trader table in db * @param isTrader Is user we're getting avatar for a trader @@ -87,20 +103,36 @@ export declare class RagfairOfferGenerator { * @returns Item with conditions added */ protected addMissingCondition(item: Item): Item; - protected getOfferRequirements(items: Item[]): { - count: number; - _tpl: string; + /** + * Create a barter-based barter scheme, if not possible, fall back to making barter scheme currency based + * @param offerItems Items for sale in offer + * @returns barter scheme + */ + protected createBarterRequirement(offerItems: Item[]): IBarterScheme[]; + /** + * Get an array of flea prices + item tpl, cached in generator class + * @returns array with tpl/price values + */ + protected getFleaPricesAsArray(): { + tpl: string; + price: number; }[]; + /** + * Create a random currency-based barter scheme for an array of items + * @param offerItems Items on offer + * @returns Barter scheme for offer + */ + protected createCurrencyRequirement(offerItems: Item[]): IBarterScheme[]; /** * Create a flea offer and store it in the Ragfair server offers array * @param userID owner of the offer * @param time time offer is put up * @param items items in the offer - * @param barterScheme - * @param loyalLevel + * @param barterScheme cost of item (currency or barter) + * @param loyalLevel Loyalty level needed to buy item * @param price price of offer * @param sellInOnePiece - * @returns + * @returns Ragfair offer */ createFleaOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; } diff --git a/TypeScript/2EditDatabase/types/generators/WeatherGenerator.d.ts b/TypeScript/2EditDatabase/types/generators/WeatherGenerator.d.ts index 8ddbe49..65d2c76 100644 --- a/TypeScript/2EditDatabase/types/generators/WeatherGenerator.d.ts +++ b/TypeScript/2EditDatabase/types/generators/WeatherGenerator.d.ts @@ -1,38 +1,54 @@ +import { ApplicationContext } from "../context/ApplicationContext"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; -import { IWeatherData } from "../models/eft/weather/IWeatherData"; +import { IWeather, IWeatherData } from "../models/eft/weather/IWeatherData"; +import { WindDirection } from "../models/enums/WindDirection"; import { IWeatherConfig } from "../models/spt/config/IWeatherConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class WeatherGenerator { protected weightedRandomHelper: WeightedRandomHelper; + protected logger: ILogger; protected randomUtil: RandomUtil; protected timeUtil: TimeUtil; + protected applicationContext: ApplicationContext; protected configServer: ConfigServer; protected weatherConfig: IWeatherConfig; - constructor(weightedRandomHelper: WeightedRandomHelper, randomUtil: RandomUtil, timeUtil: TimeUtil, configServer: ConfigServer); - calculateTime(data: IWeatherData): IWeatherData; + constructor(weightedRandomHelper: WeightedRandomHelper, logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, applicationContext: ApplicationContext, configServer: ConfigServer); + calculateGameTime(data: IWeatherData): IWeatherData; /** * Get server uptime seconds multiplied by a multiplier and add to current time as seconds * Format to BSGs requirements - * @param computedDate current date + * @param currentDate current date * @returns formatted time */ - protected getAcceleratedTime(computedDate: Date): string; + protected getBsgFormattedInRaidTime(currentDate: Date): string; + /** + * Get the current in-raid time + * @param currentDate (new Date()) + * @returns Date object of current in-raid time + */ + getInRaidTime(currentDate: Date): Date; /** * Get current time formatted to fit BSGs requirement - * @param computedDate date to format into bsg style + * @param date date to format into bsg style * @returns */ - protected getNormalTime(computedDate: Date): string; + protected getBSGFormattedTime(date: Date): string; /** - * Return randomised Weather data - * @param weatherData weather input data + * Return randomised Weather data with help of config/weather.json * @returns Randomised weather data */ - generateWeather(weatherData: IWeatherData): IWeatherData; - protected getWeightedFog(): string; + generateWeather(): IWeather; + /** + * Set IWeather date/time/timestamp values to now + * @param weather Object to update + */ + protected setCurrentDateTime(weather: IWeather): void; + protected getWeightedWindDirection(): WindDirection; + protected getWeightedWindSpeed(): number; + protected getWeightedFog(): number; protected getWeightedRain(): number; protected getRandomFloat(node: string): number; - protected getRandomInt(node: string): number; } diff --git a/TypeScript/2EditDatabase/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts b/TypeScript/2EditDatabase/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts index 4fcb1e2..1589707 100644 --- a/TypeScript/2EditDatabase/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts +++ b/TypeScript/2EditDatabase/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts @@ -1,13 +1,15 @@ import { BotWeaponGeneratorHelper } from "../../../helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "../../../helpers/ItemHelper"; import { ILogger } from "../../../models/spt/utils/ILogger"; +import { LocalisationService } from "../../../services/LocalisationService"; import { IInventoryMagGen } from "../IInventoryMagGen"; import { InventoryMagGen } from "../InventoryMagGen"; export declare class ExternalInventoryMagGen implements IInventoryMagGen { protected logger: ILogger; protected itemHelper: ItemHelper; + protected localisationService: LocalisationService; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; - constructor(logger: ILogger, itemHelper: ItemHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper); + constructor(logger: ILogger, itemHelper: ItemHelper, localisationService: LocalisationService, botWeaponGeneratorHelper: BotWeaponGeneratorHelper); getPriority(): number; canHandleInventoryMagGen(inventoryMagGen: InventoryMagGen): boolean; process(inventoryMagGen: InventoryMagGen): void; diff --git a/TypeScript/2EditDatabase/types/helpers/BotDifficultyHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/BotDifficultyHelper.d.ts new file mode 100644 index 0000000..a58ebdb --- /dev/null +++ b/TypeScript/2EditDatabase/types/helpers/BotDifficultyHelper.d.ts @@ -0,0 +1,46 @@ +import { Difficulty } from "../models/eft/common/tables/IBotType"; +import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; +import { JsonUtil } from "../utils/JsonUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +import { BotHelper } from "./BotHelper"; +export declare class BotDifficultyHelper { + protected logger: ILogger; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected randomUtil: RandomUtil; + protected localisationService: LocalisationService; + protected botHelper: BotHelper; + protected configServer: ConfigServer; + protected botConfig: IBotConfig; + constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, localisationService: LocalisationService, botHelper: BotHelper, configServer: ConfigServer); + getPmcDifficultySettings(pmcType: "bear" | "usec", difficulty: string, usecType: string, bearType: string): Difficulty; + /** + * Get difficulty settings for desired bot type, if not found use assault bot types + * @param type bot type to retreive difficulty of + * @param difficulty difficulty to get settings for (easy/normal etc) + * @returns Difficulty object + */ + getBotDifficultySettings(type: string, difficulty: string): Difficulty; + /** + * Get difficulty settings for a PMC + * @param type "usec" / "bear" + * @param difficulty what difficulty to retrieve + * @returns Difficulty object + */ + protected getDifficultySettings(type: string, difficulty: string): Difficulty; + /** + * Translate chosen value from pre-raid difficulty dropdown into bot difficulty value + * @param dropDownDifficulty Dropdown difficulty value to convert + * @returns bot difficulty + */ + convertBotDifficultyDropdownToBotDifficulty(dropDownDifficulty: string): string; + /** + * Choose a random difficulty from - easy/normal/hard/impossible + * @returns random difficulty + */ + chooseRandomDifficulty(): string; +} diff --git a/TypeScript/2EditDatabase/types/helpers/BotGeneratorHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/BotGeneratorHelper.d.ts index 5e3e501..899669e 100644 --- a/TypeScript/2EditDatabase/types/helpers/BotGeneratorHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/BotGeneratorHelper.d.ts @@ -8,6 +8,7 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; import { ItemFilterService } from "../services/ItemFilterService"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; @@ -43,9 +44,10 @@ export declare class BotGeneratorHelper { protected itemFilterService: ItemFilterService; protected profileHelper: ProfileHelper; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Check mods are compatible and add to array * @param equipment Equipment item to add mods to @@ -53,9 +55,11 @@ export declare class BotGeneratorHelper { * @param parentId parentid of item to add mod to * @param parentTemplate template objet of item to add mods to * @param modSpawnChances dictionary of mod items and their chance to spawn for this bot type + * @param botRole the bot role being generated for + * @param forceSpawn should this mod be forced to spawn * @returns Item + compatible mods as an array */ - generateModsForEquipment(equipment: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances): Item[]; + generateModsForEquipment(equipment: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances, botRole: string, forceSpawn?: boolean): Item[]; /** * @param sessionId session id * @param weapon Weapon to add mods to @@ -70,15 +74,15 @@ export declare class BotGeneratorHelper { generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponParentId: string, parentWeaponTemplate: ITemplateItem, modSpawnChances: ModsChances, ammoTpl: string, botRole: string): Item[]; /** * - * @param modSlot - * @param isRandomisableSlot - * @param modsParent - * @param botEquipBlacklist - * @param itemModPool + * @param modSlot Slot mod will fit into + * @param isRandomisableSlot Will generate a randomised mod pool if true + * @param modsParent Parent slot the item will be a part of + * @param botEquipBlacklist Blacklist to prevent mods from being picked + * @param itemModPool Pool of items to pick from * @param weapon array with only weapon tpl in it, ready for mods to be added * @param ammoTpl ammo tpl to use if slot requires a cartridge to be added (e.g. mod_magazine) - * @param parentTemplate - * @returns + * @param parentTemplate Parent item the mod will go into + * @returns ITemplateItem */ protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, modsParent: Slot, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem): [boolean, ITemplateItem]; /** @@ -114,8 +118,10 @@ export declare class BotGeneratorHelper { * Find all compatible mods for equipment item and add to modPool * @param itemDetails item to find mods for * @param modPool ModPool to add mods to + * @param equipmentBlacklist equipment not allowed to be used by the bot + * @param botEquipmentRole bot type to generate pool for (e.g. assault, pmcBot, pmc for usec/bear) */ - generateDynamicModPool(itemDetails: ITemplateItem, modPool: Mods): void; + generateDynamicModPool(itemDetails: ITemplateItem, modPool: Mods, equipmentBlacklist: EquipmentFilterDetails[], botEquipmentRole: string): void; /** * Take a list of tpls and filter out blacklisted values using itemFilterService + botEquipmentBlacklist * @param allowedMods base mods to filter @@ -153,7 +159,7 @@ export declare class BotGeneratorHelper { * @param modTemplate Used to add additional properites in the upd object * @returns Item object */ - protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem): Item; + protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem, botRole: string): Item; /** * randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot * never return true for an item that has 0% spawn chance @@ -170,10 +176,10 @@ export declare class BotGeneratorHelper { */ protected getAmmoContainers(): string[]; /** - * Get the slot details for an item (chamber/cartridge/slot) + * Get a Slot property for an item (chamber/cartridge/slot) * @param modSlot e.g patron_in_weapon * @param parentTemplate item template - * @returns + * @returns Slot item */ protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; /** @@ -185,7 +191,6 @@ export declare class BotGeneratorHelper { * @param modPool modPool which should include available cartrigdes * @param parentId The CylinderMagazine's UID * @param parentTemplate The CylinderMagazine's template - * @returns */ protected fillCamora(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem): void; /** @@ -197,11 +202,11 @@ export declare class BotGeneratorHelper { /** * Adds properties to an item * e.g. Repairable / HasHinge / Foldable / MaxDurability - * @param itemTemplate - * @param botRole Used by weapons to randomise the durability values + * @param itemTemplate Item extra properties are being generated for + * @param botRole Used by weapons to randomise the durability values. Null for non-equipped items * @returns Item Upd object with extra properties */ - generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: any): { + generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: string): { upd?: Upd; }; /** @@ -220,21 +225,27 @@ export declare class BotGeneratorHelper { protected generateArmorRepairableProperties(itemTemplate: ITemplateItem, botRole: string): Repairable; /** * Get a random mod from an items compatible mods Filter array - * @param modTpl - * @param parentSlot - * @param modSlot - * @param items + * @param modTpl ???? + * @param parentSlot item mod will go into, used to get combatible items + * @param modSlot Slot to get mod to fill + * @param items items to ensure picked mod is compatible with * @returns item tpl */ protected getModTplFromItemDb(modTpl: string, parentSlot: Slot, modSlot: string, items: Item[]): string; /** * Can an item be added to an item without issue - * @param items - * @param tplToCheck - * @param equipmentSlot - * @returns true if possible + * @param items items to check compatiblilities with + * @param tplToCheck tpl of the item to check for incompatibilities + * @param equipmentSlot Slot the item will be placed into + * @returns false if no incompatibilties */ isItemIncompatibleWithCurrentItems(items: Item[], tplToCheck: string, equipmentSlot: string): boolean; + /** + * Convert a bots role to the equipment role used in config/bot.json + * @param botRole Role to convert + * @returns Equipment role (e.g. pmc / assault / bossTagilla) + */ + getBotEquipmentRole(botRole: string): string; } /** TODO - move into own class */ export declare class ExhaustableArray { diff --git a/TypeScript/2EditDatabase/types/helpers/BotHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/BotHelper.d.ts index 67a6384..a7f779e 100644 --- a/TypeScript/2EditDatabase/types/helpers/BotHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/BotHelper.d.ts @@ -3,6 +3,7 @@ import { IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; export declare class BotHelper { @@ -10,46 +11,27 @@ export declare class BotHelper { protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, configServer: ConfigServer); - /** - * Get difficulty settings for desired bot type, if not found use assault bot types - * @param type bot type to retreive difficulty of - * @param difficulty difficulty to get settings for (easy/normal etc) - * @returns Difficulty object - */ - getBotDifficultySettings(type: string, difficulty: string): Difficulty; + constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, localisationService: LocalisationService, configServer: ConfigServer); /** * Get a template object for the specified botRole from bots.types db * @param role botRole to get template for * @returns IBotType object */ getBotTemplate(role: string): IBotType; - /** - * Get difficulty settings for a PMC - * @param type "usec" / "bear" - * @param difficulty what difficulty to retrieve - * @returns Difficulty object - */ - getPmcDifficultySettings(type: string, difficulty: string): Difficulty; - /** - * Translate chosen value from pre-raid difficulty dropdown into bot difficulty value - * @param dropDownDifficulty Dropdown difficulty value to convert - * @returns bot difficulty - */ - convertBotDifficultyDropdownToBotDifficulty(dropDownDifficulty: string): string; - /** - * Choose a random difficulty from - easy/normal/hard/impossible - * @returns random difficulty - */ - chooseRandomDifficulty(): string; /** * Randomise the chance the PMC will attack their own side * Look up value in bot.json/chanceSameSideIsHostilePercent * @param difficultySettings pmc difficulty settings */ randomisePmcHostility(difficultySettings: Difficulty): void; + /** + * Is the passed in bot role a PMC (usec/bear/pmc) + * @param botRole bot role to check + * @returns true if is pmc + */ isBotPmc(botRole: string): boolean; isBotBoss(botRole: string): boolean; isBotFollower(botRole: string): boolean; diff --git a/TypeScript/2EditDatabase/types/helpers/GameEventHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/GameEventHelper.d.ts index fca87be..fa25eff 100644 --- a/TypeScript/2EditDatabase/types/helpers/GameEventHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/GameEventHelper.d.ts @@ -15,4 +15,15 @@ export declare class GameEventHelper { * @returns Record with event name + start/end date */ getEventDetails(): ISeasonalEvent[]; + /** + * Is detection of seasonal events enabled (halloween / christmas) + * @returns true if seasonal events should be checked for + */ + isAutomaticEventDetectionEnabled(): boolean; + /** + * Get a dictionary of gear changes to apply to bots for a specific event e.g. Christmas/Halloween + * @param eventName Name of event to get gear changes for + * @returns bots with equipment changes + */ + getEventBotGear(eventName: string): Record>>; } diff --git a/TypeScript/2EditDatabase/types/helpers/HideoutHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/HideoutHelper.d.ts index 5f7e3b7..9d51fed 100644 --- a/TypeScript/2EditDatabase/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/HideoutHelper.d.ts @@ -11,6 +11,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { PlayerService } from "../services/PlayerService"; import { HashUtil } from "../utils/HashUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; @@ -29,13 +30,14 @@ export declare class HideoutHelper { protected profileHelper: ProfileHelper; protected inventoryHelper: InventoryHelper; protected playerService: PlayerService; + protected localisationService: LocalisationService; protected configServer: ConfigServer; static bitcoinFarm: string; static waterCollector: string; static bitcoin: string; static expeditionaryFuelTank: string; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, localisationService: LocalisationService, configServer: ConfigServer); registerProduction(pmcData: IPmcData, body: IHideoutSingleProductionStartRequestData | IHideoutContinousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; /** * This convinience function intialies new Production Object diff --git a/TypeScript/2EditDatabase/types/helpers/InventoryHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/InventoryHelper.d.ts index b8e5c9d..6419f93 100644 --- a/TypeScript/2EditDatabase/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/InventoryHelper.d.ts @@ -5,11 +5,12 @@ import { IInventoryMergeRequestData } from "../models/eft/inventory/IInventoryMe import { IInventoryMoveRequestData } from "../models/eft/inventory/IInventoryMoveRequestData"; import { IInventorySplitRequestData } from "../models/eft/inventory/IInventorySplitRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { IInventoryConfig } from "../models/spt/config/IInventoryConfig"; +import { IInventoryConfig, RewardDetails } from "../models/spt/config/IInventoryConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { JsonUtil } from "../utils/JsonUtil"; @@ -38,9 +39,10 @@ export declare class InventoryHelper { protected itemHelper: ItemHelper; protected containerHelper: ContainerHelper; protected profileHelper: ProfileHelper; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected inventoryConfig: IInventoryConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); addItem(pmcData: IPmcData, body: IAddItemRequestData, output: IItemEventRouterResponse, sessionID: string, callback: any, foundInRaid?: boolean, addUpd?: any): IItemEventRouterResponse; removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; removeItemByCount(pmcData: IPmcData, itemId: string, count: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; @@ -76,6 +78,12 @@ export declare class InventoryHelper { * Internal helper function to handle cartridges in inventory if any of them exist. */ protected handleCartridges(items: Item[], body: IInventoryMoveRequestData): void; + /** + * Get details for how a random loot container should be handled, max rewards, possible reward tpls + * @param itemTpl Container being opened + * @returns Reward details + */ + getRandomLootContainerRewardDetails(itemTpl: string): RewardDetails; } declare namespace InventoryHelper { interface InventoryItemHash { diff --git a/TypeScript/2EditDatabase/types/helpers/ItemHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/ItemHelper.d.ts index 0effaf2..fc88a46 100644 --- a/TypeScript/2EditDatabase/types/helpers/ItemHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/ItemHelper.d.ts @@ -5,6 +5,7 @@ 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 { LocaleService } from "../services/LocaleService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; @@ -18,7 +19,8 @@ declare class ItemHelper { protected objectId: ObjectId; protected mathUtil: MathUtil; protected databaseServer: DatabaseServer; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer); + protected localeService: LocaleService; + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, localeService: LocaleService); /** * Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash * @param {string} tpl the template id / tpl @@ -212,6 +214,12 @@ declare class ItemHelper { * @returns size of stack */ getItemStackSize(item: Item): number; + /** + * Get the name of an item from the locale file using the item tpl + * @param itemTpl Tpl of item to get name of + * @returns Name of item + */ + getItemName(itemTpl: string): string; } declare namespace ItemHelper { interface ItemSize { diff --git a/TypeScript/2EditDatabase/types/helpers/QuestHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/QuestHelper.d.ts index a6b4892..edbd2e1 100644 --- a/TypeScript/2EditDatabase/types/helpers/QuestHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/QuestHelper.d.ts @@ -50,6 +50,12 @@ export declare class QuestHelper { * @returns true if player level is greater than or equal to quest */ doesPlayerLevelFulfilCondition(playerLevel: number, condition: AvailableForConditions): boolean; + /** + * Get the quests found in both arrays (inner join) + * @param before Array of qeusts #1 + * @param after Array of quests #2 + * @returns Reduction of cartesian product between two quest arrays + */ getDeltaQuests(before: IQuest[], after: IQuest[]): IQuest[]; /** * Increase skill points of a skill on player profile @@ -66,38 +72,85 @@ export declare class QuestHelper { * quest list in question. */ dumpQuests(quests: any): void; - loyaltyRequirementCheck(loyaltyRequirementProperties: AvailableForProps, profile: IPmcData): boolean; - protected processReward(reward: Reward): any[]; + /** + * Check if trader has sufficient loyalty to fullfill quest requirement + * @param questProperties Quest props + * @param profile Player profile + * @returns true if loyalty is high enough to fulfil quest requirement + */ + traderStandingRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; + protected processReward(reward: Reward): Reward[]; + /** + * Gets a flat list of reward items for the given quest at a specific state (e.g. Fail/Success) + * @param quest quest to get rewards for + * @param state Quest status that holds the items (Started, Success, Fail) + * @returns array of items with the correct maxStack + */ getQuestRewardItems(quest: IQuest, state: QuestStatus): Reward[]; /** - * Add quest with new state value to pmc profile + * Update player profile with quest status (e.g. Fail/Success) * @param pmcData profile to add quest to * @param newState state the new quest should be in when added * @param acceptedQuest Details of quest being added */ addQuestToPMCData(pmcData: IPmcData, newState: QuestStatus, acceptedQuest: IAcceptQuestRequestData): void; - acceptedUnlocked(acceptedQuestId: string, sessionID: string): IQuest[]; - failedUnlocked(failedQuestId: string, sessionID: string): IQuest[]; - applyMoneyBoost(quest: IQuest, moneyBoost: number): IQuest; - changeItemStack(pmcData: IPmcData, id: string, value: number, sessionID: string, output: any): void; /** - * Get List of All Quests as an array + * TODO: what is going on here + * @param acceptedQuestId Quest to add to profile + * @param sessionID Session id + * @returns Array of quests in profile + quest passed in as param + */ + acceptedUnlocked(acceptedQuestId: string, sessionID: string): IQuest[]; + /** + * TODO: what is going on here + * @param failedQuestId + * @param sessionID Session id + * @returns + */ + failedUnlocked(failedQuestId: string, sessionID: string): IQuest[]; + /** + * Adjust quest money rewards by passed in multipler + * @param quest Quest to multiple money rewards + * @param multipler Value to adjust money rewards by + * @returns Updated quest + */ + applyMoneyBoost(quest: IQuest, multipler: number): IQuest; + /** + * Sets the item stack to new value, or delete the item if value <= 0 + * // TODO maybe merge this function and the one from customization + * @param pmcData Profile + * @param itemId id of item to adjust stack size of + * @param newStackSize Stack size to adjust to + * @param sessionID Session id + * @param output ItemEvent router response + */ + changeItemStack(pmcData: IPmcData, itemId: string, newStackSize: number, sessionID: string, output: IItemEventRouterResponse): void; + /** + * Get List of All Quests from db + * NOT CLONED * @returns Array of IQuest objects */ - questValues(): IQuest[]; + getQuestsFromDb(): IQuest[]; /** - * Reest AvailableForStart conditions for quests - * @param quests queststo clean + * Get quests, strip all requirement conditions except level + * @param quests quests to process * @returns quest array without conditions */ - protected cleanQuestList(quests: IQuest[]): IQuest[]; + protected getQuestsWithOnlyLevelRequirementStartCondition(quests: IQuest[]): IQuest[]; /** - * Reset AvailableForStart conditions on a quest + * Remove all quest conditions except for level requirement * @param quest quest to clean * @returns reset IQuest object */ - cleanQuestConditions(quest: IQuest): IQuest; - failQuest(pmcData: IPmcData, body: any, sessionID: string): any; + getQuestWithOnlyLevelRequirementStartCondition(quest: IQuest): IQuest; + /** + * Fail a quest in a player profile + * @param pmcData Profile + * @param failRequest fail quest request data + * @param sessionID Session id + * @returns Item event router response + */ + failQuest(pmcData: IPmcData, failRequest: any, sessionID: string): IItemEventRouterResponse; /** * Get quest by id from database * @param questId questid to look for @@ -105,7 +158,12 @@ export declare class QuestHelper { * @returns IQuest object */ getQuestFromDb(questId: string, pmcData: IPmcData): IQuest; - getQuestLocaleIdFromDb(messageId: string): string; + /** + * Get the locale Id from locale db for a quest message + * @param questMessageId Quest mesage id to look up + * @returns Locale Id from locale db + */ + getQuestLocaleIdFromDb(questMessageId: string): string; /** * Alter a quests state + Add a record to tis status timers object * @param pmcData Profile to update @@ -128,5 +186,10 @@ export declare class QuestHelper { * @returns bonus in percent */ protected getIntelCenterRewardBonus(pmcData: IPmcData): number; - getFindItemIdForQuestItem(itemTpl: string): string; + /** + * Find quest with 'findItem' requirement that needs the item tpl be handed in + * @param itemTpl item tpl to look for + * @returns 'FindItem' condition id + */ + getFindItemIdForQuestHandIn(itemTpl: string): string; } diff --git a/TypeScript/2EditDatabase/types/helpers/RagfairServerHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/RagfairServerHelper.d.ts index a03cdda..ec388d8 100644 --- a/TypeScript/2EditDatabase/types/helpers/RagfairServerHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/RagfairServerHelper.d.ts @@ -44,10 +44,20 @@ export declare class RagfairServerHelper { isPlayer(userID: string): boolean; returnItems(sessionID: string, items: any[]): void; calculateDynamicStackCount(tplId: string, isWeaponPreset: boolean): number; + /** + * Choose a currency at random with bias + * @returns currency tpl + */ getDynamicOfferCurrency(): string; getMemberType(userID: string): MemberCategory; getNickname(userID: string): string; getPresetItems(item: any): Item[]; getPresetItemsByTpl(item: Item): Item[]; + /** + * Generate new unique ids for the children while preserving hierarchy + * @param item base item + * @param preset + * @returns Item array with new IDs + */ reparentPresets(item: Item, preset: Item[]): Item[]; } diff --git a/TypeScript/2EditDatabase/types/helpers/RagfairSortHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/RagfairSortHelper.d.ts index 28d1d38..4669ce6 100644 --- a/TypeScript/2EditDatabase/types/helpers/RagfairSortHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/RagfairSortHelper.d.ts @@ -18,7 +18,7 @@ export declare class RagfairSortHelper { protected sortOffersByRating(a: IRagfairOffer, b: IRagfairOffer): number; protected sortOffersByName(a: IRagfairOffer, b: IRagfairOffer): number; /** - * Order two offers by price value + * Order two offers by rouble price value * @param a Offer a * @param b Offer b * @returns diff --git a/TypeScript/2EditDatabase/types/loaders/PreAkiModLoader.d.ts b/TypeScript/2EditDatabase/types/loaders/PreAkiModLoader.d.ts index 7a687a5..f486a28 100644 --- a/TypeScript/2EditDatabase/types/loaders/PreAkiModLoader.d.ts +++ b/TypeScript/2EditDatabase/types/loaders/PreAkiModLoader.d.ts @@ -1,29 +1,31 @@ import { DependencyContainer } from "tsyringe"; +import { IPostAkiLoadMod } from "../models/external/IPostAkiLoadMod"; +import { IPostDBLoadMod } from "../models/external/IPostDBLoadMod"; +import { IPreAkiLoadMod } from "../models/external/IPreAkiLoadMod"; import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { ModLoader } from "../models/spt/mod/IMod"; import { IModLoader } from "../models/spt/mod/IModLoader"; import { IPackageJsonData } from "../models/spt/mod/IPackageJsonData"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { LocalisationService } from "../services/LocalisationService"; import { ModCompilerService } from "../services/ModCompilerService"; import { JsonUtil } from "../utils/JsonUtil"; import { VFS } from "../utils/VFS"; import { BundleLoader } from "./BundleLoader"; -import { IPostAkiLoadMod } from "../models/external/IPostAkiLoadMod"; -import { IPreAkiLoadMod } from "../models/external/IPreAkiLoadMod"; -import { IPostDBLoadMod } from "../models/external/IPostDBLoadMod"; export declare class PreAkiModLoader implements IModLoader { protected logger: ILogger; protected vfs: VFS; protected jsonUtil: JsonUtil; protected modCompilerService: ModCompilerService; protected bundleLoader: BundleLoader; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected static container: DependencyContainer; protected readonly basepath = "user/mods/"; protected imported: Record; protected akiConfig: ICoreConfig; - constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, modCompilerService: ModCompilerService, bundleLoader: BundleLoader, configServer: ConfigServer); + constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, modCompilerService: ModCompilerService, bundleLoader: BundleLoader, localisationService: LocalisationService, configServer: ConfigServer); load(container: DependencyContainer): Promise; getBundles(local: boolean): string; getBundle(key: string, local: boolean): void; diff --git a/TypeScript/2EditDatabase/types/models/eft/bot/IGenerateBotsRequestData.d.ts b/TypeScript/2EditDatabase/types/models/eft/bot/IGenerateBotsRequestData.d.ts index c49cef7..f1f7013 100644 --- a/TypeScript/2EditDatabase/types/models/eft/bot/IGenerateBotsRequestData.d.ts +++ b/TypeScript/2EditDatabase/types/models/eft/bot/IGenerateBotsRequestData.d.ts @@ -2,6 +2,7 @@ export interface IGenerateBotsRequestData { conditions: Condition[]; } export interface Condition { + /** e.g. assault/pmcBot/bossKilla */ Role: string; Limit: number; Difficulty: string; diff --git a/TypeScript/2EditDatabase/types/models/eft/common/IGlobals.d.ts b/TypeScript/2EditDatabase/types/models/eft/common/IGlobals.d.ts index 81e2023..b53f106 100644 --- a/TypeScript/2EditDatabase/types/models/eft/common/IGlobals.d.ts +++ b/TypeScript/2EditDatabase/types/models/eft/common/IGlobals.d.ts @@ -591,6 +591,7 @@ export interface HealPrice { export interface ProfileHealthSettings { BodyPartsSettings: BodyPartsSettings; HealthFactorsSettings: HealthFactorsSettings; + DefaultStimulatorBuff: string; } export interface BodyPartsSettings { Head: BodyPartsSetting; diff --git a/TypeScript/2EditDatabase/types/models/eft/common/tables/IBotBase.d.ts b/TypeScript/2EditDatabase/types/models/eft/common/tables/IBotBase.d.ts index 1c28ae0..2b418c1 100644 --- a/TypeScript/2EditDatabase/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/2EditDatabase/types/models/eft/common/tables/IBotBase.d.ts @@ -107,6 +107,7 @@ export interface CurrentMax { Maximum: number; } export interface Inventory { + discardLimits: Record; items: Item[]; equipment: string; stash: string; diff --git a/TypeScript/2EditDatabase/types/models/eft/common/tables/IBotType.d.ts b/TypeScript/2EditDatabase/types/models/eft/common/tables/IBotType.d.ts index c1fe579..55b4bd9 100644 --- a/TypeScript/2EditDatabase/types/models/eft/common/tables/IBotType.d.ts +++ b/TypeScript/2EditDatabase/types/models/eft/common/tables/IBotType.d.ts @@ -13,8 +13,8 @@ export interface IBotType { skills: Skills; } export interface Appearance { - body: string[]; - feet: string[]; + body: Record; + feet: Record; hands: string[]; head: string[]; voice: string[]; diff --git a/TypeScript/2EditDatabase/types/models/eft/common/tables/ITemplateItem.d.ts b/TypeScript/2EditDatabase/types/models/eft/common/tables/ITemplateItem.d.ts index 8569e61..0fa7e18 100644 --- a/TypeScript/2EditDatabase/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/TypeScript/2EditDatabase/types/models/eft/common/tables/ITemplateItem.d.ts @@ -254,7 +254,7 @@ export interface Props { foodUseTime?: number; foodEffectType?: string; StimulatorBuffs?: string; - effects_health?: any; + effects_health?: IHealthEffect[] | Record>; effects_damage?: any; MaximumNumberOfUsage?: number; knifeHitDelay?: number; @@ -366,6 +366,10 @@ export interface Props { MinTimeToContactExplode?: number; ExplosionEffectType?: string; } +export interface IHealthEffect { + type: string; + value: number; +} export interface Prefab { path: string; rcid: string; diff --git a/TypeScript/2EditDatabase/types/models/eft/customization/IGetSuitsResponse.d.ts b/TypeScript/2EditDatabase/types/models/eft/customization/IGetSuitsResponse.d.ts new file mode 100644 index 0000000..fe6888c --- /dev/null +++ b/TypeScript/2EditDatabase/types/models/eft/customization/IGetSuitsResponse.d.ts @@ -0,0 +1,4 @@ +export interface IGetSuitsResponse { + _id: string; + suits: string[]; +} diff --git a/TypeScript/2EditDatabase/types/models/eft/game/IGameKeepAliveResponse.d.ts b/TypeScript/2EditDatabase/types/models/eft/game/IGameKeepAliveResponse.d.ts new file mode 100644 index 0000000..170ce6a --- /dev/null +++ b/TypeScript/2EditDatabase/types/models/eft/game/IGameKeepAliveResponse.d.ts @@ -0,0 +1,4 @@ +export interface IGameKeepAliveResponse { + msg: string; + utc_time: number; +} diff --git a/TypeScript/2EditDatabase/types/models/eft/game/IGameLogoutResponseData.d.ts b/TypeScript/2EditDatabase/types/models/eft/game/IGameLogoutResponseData.d.ts new file mode 100644 index 0000000..0f52050 --- /dev/null +++ b/TypeScript/2EditDatabase/types/models/eft/game/IGameLogoutResponseData.d.ts @@ -0,0 +1,3 @@ +export interface IGameLogoutResponseData { + status: string; +} diff --git a/TypeScript/2EditDatabase/types/models/eft/game/IGameStartResponse.d.ts b/TypeScript/2EditDatabase/types/models/eft/game/IGameStartResponse.d.ts new file mode 100644 index 0000000..9f0ab6d --- /dev/null +++ b/TypeScript/2EditDatabase/types/models/eft/game/IGameStartResponse.d.ts @@ -0,0 +1,3 @@ +export interface IGameStartResponse { + utc_time: number; +} diff --git a/TypeScript/2EditDatabase/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts b/TypeScript/2EditDatabase/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts new file mode 100644 index 0000000..3c45124 --- /dev/null +++ b/TypeScript/2EditDatabase/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts @@ -0,0 +1,11 @@ +import { IInventoryBaseActionRequestData } from "./IInventoryBaseActionRequestData"; +export interface IOpenRandomLootContainerRequestData extends IInventoryBaseActionRequestData { + Action: "OpenRandomLootContainer"; + /** Container item opened */ + item: string; + to: To[]; +} +export interface To { + /** Player character (pmc/scav) id items will be sent to */ + id: string; +} diff --git a/TypeScript/2EditDatabase/types/models/eft/itemEvent/IItemEventRouterBase.d.ts b/TypeScript/2EditDatabase/types/models/eft/itemEvent/IItemEventRouterBase.d.ts index 4841cfd..60ab284 100644 --- a/TypeScript/2EditDatabase/types/models/eft/itemEvent/IItemEventRouterBase.d.ts +++ b/TypeScript/2EditDatabase/types/models/eft/itemEvent/IItemEventRouterBase.d.ts @@ -10,8 +10,9 @@ export interface IItemEventRouterBase { export declare type TProfileChanges = Record; export interface Warning { index: number; - err: string; errmsg: string; + code?: string; + data?: any; } export interface ProfileChange { _id: string; diff --git a/TypeScript/2EditDatabase/types/models/eft/match/IStartOffineRaidRequestData.d.ts b/TypeScript/2EditDatabase/types/models/eft/match/IStartOffineRaidRequestData.d.ts index af0625e..1983728 100644 --- a/TypeScript/2EditDatabase/types/models/eft/match/IStartOffineRaidRequestData.d.ts +++ b/TypeScript/2EditDatabase/types/models/eft/match/IStartOffineRaidRequestData.d.ts @@ -2,8 +2,10 @@ import { BotAmount } from "../../enums/BotAmount"; import { BotDifficulty } from "../../enums/BotDifficulty"; export interface IStartOfflineRaidRequestData { locationName: string; + /** Current time, not in-game time */ startTime: number; - dateTime: string; + /** CURR = am, past = pm */ + dateTime: "CURR" | "PAST"; gameSettings: GameSettings; } export interface GameSettings { diff --git a/TypeScript/2EditDatabase/types/models/eft/notifier/ISelectProfileResponse.d.ts b/TypeScript/2EditDatabase/types/models/eft/notifier/ISelectProfileResponse.d.ts new file mode 100644 index 0000000..ecb668a --- /dev/null +++ b/TypeScript/2EditDatabase/types/models/eft/notifier/ISelectProfileResponse.d.ts @@ -0,0 +1,6 @@ +import { INotifierChannel } from "./INotifier"; +export interface ISelectProfileResponse { + status: string; + notifier: INotifierChannel; + notifierServer: string; +} diff --git a/TypeScript/2EditDatabase/types/models/eft/ragfair/IRagfairOffer.d.ts b/TypeScript/2EditDatabase/types/models/eft/ragfair/IRagfairOffer.d.ts index 3251a37..792ec7d 100644 --- a/TypeScript/2EditDatabase/types/models/eft/ragfair/IRagfairOffer.d.ts +++ b/TypeScript/2EditDatabase/types/models/eft/ragfair/IRagfairOffer.d.ts @@ -7,19 +7,19 @@ export interface IRagfairOffer { requirements: OfferRequirement[]; root: string; intId: number; + /** Handbook price */ itemsCost: number; + /** Rouble price */ requirementsCost: number; - sptRequirementsCostRouble: number; startTime: number; endTime: number; sellInOnePiece: boolean; - name?: string; - shortName?: string; loyaltyLevel: number; buyRestrictionMax?: number; buyRestrictionCurrent?: number; locked: boolean; unlimitedCount: boolean; + /** Rouble price */ summaryCost: number; user: IRagfairOfferUser; notAvailable: boolean; @@ -33,11 +33,11 @@ export interface OfferRequirement { } export interface IRagfairOfferUser { id: string; - nickname: string; - rating: number; + nickname?: string; + rating?: number; memberType: MemberCategory; - avatar: string; - isRatingGrowing: boolean; + avatar?: string; + isRatingGrowing?: boolean; } export interface SellResult { sellTime: number; diff --git a/TypeScript/2EditDatabase/types/models/eft/weather/IWeatherData.d.ts b/TypeScript/2EditDatabase/types/models/eft/weather/IWeatherData.d.ts index ecc96ce..1f5d5b5 100644 --- a/TypeScript/2EditDatabase/types/models/eft/weather/IWeatherData.d.ts +++ b/TypeScript/2EditDatabase/types/models/eft/weather/IWeatherData.d.ts @@ -1,17 +1,18 @@ +import { WindDirection } from "../../../models/enums/WindDirection"; export interface IWeatherData { acceleration: number; time: string; date: string; - weather: IWeather; + weather?: IWeather; } export interface IWeather { pressure: number; temp: number; - fog: string; + fog: number; rain_intensity: number; - rain: any; + rain: number; wind_gustiness: number; - wind_direction: any; + wind_direction: WindDirection; wind_speed: number; cloud: number; time: string; diff --git a/TypeScript/2EditDatabase/types/models/enums/BackendErrorCodes.d.ts b/TypeScript/2EditDatabase/types/models/enums/BackendErrorCodes.d.ts new file mode 100644 index 0000000..6614b75 --- /dev/null +++ b/TypeScript/2EditDatabase/types/models/enums/BackendErrorCodes.d.ts @@ -0,0 +1,67 @@ +export declare enum BackendErrorCodes { + NONE = 0, + UNKNOWN_ERROR = 200, + NOT_AUTHORIZED = 201, + NEED_AUTHORIZATION_CODE = 209, + WRONG_AUTHORIZATION_CODE = 211, + NEED_CAPTCHA = 214, + NO_NEED_CAPTCHA = 215, + CAPTCHA_FAILED = 218, + CAPTCHA_BRUTE_FORCED = 219, + NO_ROOM_IN_STASH = 223, + NICKNAME_NOT_UNIQUE = 225, + NICKNAME_NOT_VALID = 226, + UNSUPPORTED_CLIENT_VERSION = 232, + REPORT_NOT_ALLOWED = 238, + NICKNAME_IS_ABUSIVE = 241, + NICKNAME_CHANGE_TIMEOUT = 242, + NOT_MODIFIED = 304, + HTTP_BAD_REQUEST = 400, + HTTP_NOT_AUTHORIZED = 401, + HTTP_FORBIDDEN = 403, + HTTP_NOT_FOUND = 404, + HTTP_METHOD_NOT_ALLOWED = 405, + UNKNOWN_TRADING_ERROR = 500, + HTTPNOTIMPLEMENTED = 501, + HTTPBADGATEWAY = 502, + HTTPSERVICEUNAVAILABLE = 503, + HTTPGATEWAYTIMEOUT = 504, + TRADEROUTOFMONEY = 505, + HTTPVARIANTALSONEGOTIATES = 506, + PRICECHANGED = 509, + TRADERDISABLED = 512, + ITEMHASBEENSOLD = 513, + NOTENOUGHSPACEFORMONEY = 518, + HTTPINVALIDSSLCERTIFICATE = 526, + UNKNOWNRAGFAIRERROR = 550, + UNKNOWNRAGFAIRERROR2 = 551, + UNKNOWNMATCHMAKERERROR = 600, + SESSIONPARAMETERSERROR = 601, + SESSIONLOST = 602, + SERVERNOTREGISTERED = 604, + UNKNOWNQUESTERROR = 700, + QUESTBADPARAM = 702, + QUESTNOTFOUND = 703, + QUESTISUNAVAILABLE = 704, + NOFREESPACEFORREWARDS = 705, + WRONGQUESTSTATUS = 706, + CANTCOMPLETEQUEST = 707, + UNKNOWNMAILERROR = 900, + TOOMANYFRIENDREQUESTS = 925, + UNKNOWNSCRIPTEXECUTIONERROR = 1000, + UNKNOWNREPAIRINGERROR = 1200, + UNKNOWNINSURANCEERROR = 1300, + UNKNOWNCURRENCYEXCHANGEERROR = 1400, + OFFERNOTFOUND = 1503, + NOTENOUGHSPACE = 1505, + OFFEROUTOFSTOCK = 1506, + OFFERSOLD = 1507, + RAGFAIRUNAVAILABLE = 1511, + BANNEDERRORCODE = 1513, + INSUFFICIENTNUMBERINSTOCK = 1516, + TOOMANYITEMSTOSELL = 1517, + EXAMINATIONFAILED = 22001, + ITEMALREADYEXAMINED = 22002, + UNKNOWNNGINXERROR = 9000, + PARSERESPONSEERROR = 9001 +} diff --git a/TypeScript/2EditDatabase/types/models/enums/HideoutEventActions.d.ts b/TypeScript/2EditDatabase/types/models/enums/HideoutEventActions.d.ts new file mode 100644 index 0000000..e441477 --- /dev/null +++ b/TypeScript/2EditDatabase/types/models/enums/HideoutEventActions.d.ts @@ -0,0 +1,11 @@ +export declare enum HideoutEventActions { + HIDEOUT_UPGRADE = "HideoutUpgrade", + HIDEOUT_UPGRADE_COMPLETE = "HideoutUpgradeComplete", + HIDEOUT_PUT_ITEMS_IN_AREA_SLOTS = "HideoutPutItemsInAreaSlots", + HIDEOUT_TAKE_ITEMS_FROM_AREA_SLOTS = "HideoutTakeItemsFromAreaSlots", + HIDEOUT_TOGGLE_AREA = "HideoutToggleArea", + HIDEOUT_SINGLE_PRODUCTION_START = "HideoutSingleProductionStart", + HIDEOUT_SCAV_CASE_PRODUCTION_START = "HideoutScavCaseProductionStart", + HIDEOUT_CONTINUOUS_PRODUCTION_START = "HideoutContinuousProductionStart", + HIDEOUT_TAKE_PRODUCTION = "HideoutTakeProduction" +} diff --git a/TypeScript/2EditDatabase/types/models/enums/ItemEventActions.d.ts b/TypeScript/2EditDatabase/types/models/enums/ItemEventActions.d.ts new file mode 100644 index 0000000..0e65453 --- /dev/null +++ b/TypeScript/2EditDatabase/types/models/enums/ItemEventActions.d.ts @@ -0,0 +1,19 @@ +export declare enum ItemEventActions { + MOVE = "Move", + REMOVE = "Remove", + SPLIT = "Split", + MERGE = "Merge", + TRANSFER = "Transfer", + SWAP = "Swap", + FOLD = "Fold", + TOGGLE = "Toggle", + TAG = "Tag", + BIND = "Bind", + EXAMINE = "Examine", + READ_ENCYCLOPEDIA = "ReadEncyclopedia", + APPLY_INVENTORY_CHANGES = "ApplyInventoryChanges", + CREATE_MAP_MARKER = "CreateMapMarker", + DELETE_MAP_MARKER = "DeleteMapMarker", + EDIT_MAP_MARKER = "EditMapMarker", + OPEN_RANDOM_LOOT_CONTAINER = "OpenRandomLootContainer" +} diff --git a/TypeScript/2EditDatabase/types/models/enums/WeatherType.d.ts b/TypeScript/2EditDatabase/types/models/enums/WeatherType.d.ts new file mode 100644 index 0000000..d31fefe --- /dev/null +++ b/TypeScript/2EditDatabase/types/models/enums/WeatherType.d.ts @@ -0,0 +1,19 @@ +export declare enum WeatherType { + CLEAR_DAY = 1, + CLEAR_WIND = 2, + CLEAR_NIGHT = 3, + PARTLY_CLOUD_DAY = 4, + PARTLY_CLOUD_NIGHT = 5, + CLEAR_FOG_DAY = 6, + CLEAR_FOG_NIGHT = 7, + CLOUDFOG = 8, + FOG = 9, + MOSTLY_CLOUD = 10, + LIGHT_RAIN = 11, + RAIN = 12, + CLOUD_WIND = 13, + CLOUD_WIND_RAIN = 14, + FULL_CLOUD = 15, + THUNDER_CLOUD = 16, + NONE = 0 +} diff --git a/TypeScript/2EditDatabase/types/models/enums/WildSpawnTypeNumber.d.ts b/TypeScript/2EditDatabase/types/models/enums/WildSpawnTypeNumber.d.ts new file mode 100644 index 0000000..ff806fe --- /dev/null +++ b/TypeScript/2EditDatabase/types/models/enums/WildSpawnTypeNumber.d.ts @@ -0,0 +1,33 @@ +export declare enum WildSpawnTypeNumber { + ASSAULT = 1, + MARKSMAN = 2, + BOSSTEST = 4, + BOSSBULLY = 8, + FOLLOWERTEST = 16, + FOLLOWERBULLY = 32, + BOSSKILLA = 64, + BOSSKOJANIY = 128, + FOLLOWERKOJANIY = 256, + PMCBOT = 512, + CURSEDASSAULT = 1024, + BOSSGLUHAR = 2048, + FOLLOWERGLUHARASSAULT = 4096, + FOLLOWERGLUHARSECURITY = 8192, + FOLLOWERGLUHARSCOUT = 16384, + FOLLOWERGLUHARSNIPE = 32768, + FOLLOWERSANITAR = 65536, + BOSSSANITAR = 131072, + TEST = 262144, + ASSAULTGROUP = 524288, + SECTANTWARRIOR = 1048576, + SECTANTPRIEST = 2097152, + BOSSTAGILLA = 4194304, + FOLLOWERTAGILLA = 8388608, + EXUSEC = 16777216, + GIFTER = 33554432, + BOSSKNIGHT = 67108864, + FOLLOWERBIGPIPE = 134217728, + FOLLOWERBIRDEYE = 268435456, + SPTUSEC = 536870912, + SPTBEAR = 1073741824 +} diff --git a/TypeScript/2EditDatabase/types/models/enums/WindDirection.d.ts b/TypeScript/2EditDatabase/types/models/enums/WindDirection.d.ts new file mode 100644 index 0000000..fb30b20 --- /dev/null +++ b/TypeScript/2EditDatabase/types/models/enums/WindDirection.d.ts @@ -0,0 +1,10 @@ +export declare enum WindDirection { + EAST = 1, + NORTH = 2, + WEST = 3, + SOUTH = 4, + SE = 5, + SW = 6, + NW = 7, + NE = 8 +} diff --git a/TypeScript/2EditDatabase/types/models/spt/config/IBotConfig.d.ts b/TypeScript/2EditDatabase/types/models/spt/config/IBotConfig.d.ts index af8ceba..d6fa5e0 100644 --- a/TypeScript/2EditDatabase/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/2EditDatabase/types/models/spt/config/IBotConfig.d.ts @@ -27,6 +27,8 @@ export interface IBotConfig extends IBaseConfig { maxBotCap: Record; /** How many stacks of secret ammo should a bot have in its bot secure container */ secureContainerAmmoStackCount: number; + /** Batch generation size when type not available in cache */ + botGenerationBatchSizePerType: number; } export interface PresetBatch { assault: number; @@ -66,8 +68,12 @@ export interface EquipmentFilters { weaponModLimits: ModLimits; randomisedWeaponModSlots?: string[]; randomisedArmorSlots?: string[]; + faceShieldIsActiveChancePercent?: number; + lightLaserIsActiveChancePercent?: number; blacklist: EquipmentFilterDetails[]; whitelist: EquipmentFilterDetails[]; + clothing: WeightingAdjustmentDetails[]; + weightingAdjustments: WeightingAdjustmentDetails[]; } export interface ModLimits { /** How many scopes are allowed on a weapon - hard coded to work with OPTIC_SCOPE, ASSAULT_SCOPE, COLLIMATOR, COMPACT_COLLIMATOR */ @@ -80,3 +86,8 @@ export interface EquipmentFilterDetails { equipment: Record; cartridge: Record; } +export interface WeightingAdjustmentDetails { + levelRange: MinMax; + add: Record>; + edit: Record>; +} diff --git a/TypeScript/2EditDatabase/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/2EditDatabase/types/models/spt/config/IInventoryConfig.d.ts index ffffa41..4642b9b 100644 --- a/TypeScript/2EditDatabase/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/2EditDatabase/types/models/spt/config/IInventoryConfig.d.ts @@ -2,4 +2,10 @@ import { IBaseConfig } from "./IBaseConfig"; export interface IInventoryConfig extends IBaseConfig { kind: "aki-inventory"; newItemsMarkedFound: boolean; + randomLootContainers: Record; +} +export interface RewardDetails { + rewardCount: number; + foundInRaid: boolean; + rewardTplPool: Record; } diff --git a/TypeScript/2EditDatabase/types/models/spt/config/ILocaleConfig.d.ts b/TypeScript/2EditDatabase/types/models/spt/config/ILocaleConfig.d.ts index fe9abf7..0a8955c 100644 --- a/TypeScript/2EditDatabase/types/models/spt/config/ILocaleConfig.d.ts +++ b/TypeScript/2EditDatabase/types/models/spt/config/ILocaleConfig.d.ts @@ -1,5 +1,10 @@ import { IBaseConfig } from "./IBaseConfig"; export interface ILocaleConfig extends IBaseConfig { kind: "aki-locale"; - desiredLocale: string; + /** e.g. ru/en/cn/fr etc, or 'system', will take computer locale setting */ + gameLocale: string; + /** e.g. ru/en/cn/fr etc, or 'system', will take computer locale setting */ + serverLocale: string; + /** Languages server can be translated into */ + serverSupportedLocales: string[]; } diff --git a/TypeScript/2EditDatabase/types/models/spt/config/IPmcConfig.d.ts b/TypeScript/2EditDatabase/types/models/spt/config/IPmcConfig.d.ts index 9db2ba1..48601b2 100644 --- a/TypeScript/2EditDatabase/types/models/spt/config/IPmcConfig.d.ts +++ b/TypeScript/2EditDatabase/types/models/spt/config/IPmcConfig.d.ts @@ -6,9 +6,11 @@ export interface IPmcConfig { looseWeaponInBackpackChancePercent: number; looseWeaponInBackpackLootMinMax: MinMax; isUsec: number; + usecType: string; + bearType: string; chanceSameSideIsHostilePercent: number; /** key: location, value: type for usec/bear */ - pmcType: Record; + pmcType: Record>>; maxBackpackLootTotalRub: number; maxPocketLootTotalRub: number; maxVestLootTotalRub: number; diff --git a/TypeScript/2EditDatabase/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/2EditDatabase/types/models/spt/config/IRagfairConfig.d.ts index c1b8763..6786417 100644 --- a/TypeScript/2EditDatabase/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/2EditDatabase/types/models/spt/config/IRagfairConfig.d.ts @@ -28,12 +28,8 @@ export interface Reputation { gain: number; loss: number; } -export declare class OfferAdjustment { - maxPriceDifferenceBelowHandbookPercent: number; - handbookPriceMultipier: number; - priceThreshholdRub: number; -} export interface Dynamic { + barter: Barter; offerAdjustment: OfferAdjustment; expiredOfferThreshold: number; offerItemCount: MinMax; @@ -49,6 +45,20 @@ export interface Dynamic { showAsSingleStack: string[]; blacklist: Blacklist; } +export declare class Barter { + enable: boolean; + chancePercent: number; + itemCountMin: number; + itemCountMax: number; + priceRangeVariancePercent: number; + minRoubleCostToBecomeBarter: number; + itemTypeBlacklist: string[]; +} +export declare class OfferAdjustment { + maxPriceDifferenceBelowHandbookPercent: number; + handbookPriceMultipier: number; + priceThreshholdRub: number; +} export interface Condition { conditionChance: number; min: number; diff --git a/TypeScript/2EditDatabase/types/models/spt/config/ISeasonalEventConfig.d.ts b/TypeScript/2EditDatabase/types/models/spt/config/ISeasonalEventConfig.d.ts index bc60618..e410925 100644 --- a/TypeScript/2EditDatabase/types/models/spt/config/ISeasonalEventConfig.d.ts +++ b/TypeScript/2EditDatabase/types/models/spt/config/ISeasonalEventConfig.d.ts @@ -1,6 +1,9 @@ import { IBaseConfig } from "./IBaseConfig"; export interface ISeasonalEventConfig extends IBaseConfig { kind: "aki-seasonalevents"; + enableSeasonalEventDetection: boolean; + /** event / botType / equipSlot / itemid */ + eventGear: Record>>>; events: ISeasonalEvent[]; } export interface ISeasonalEvent { diff --git a/TypeScript/2EditDatabase/types/models/spt/config/IWeatherConfig.d.ts b/TypeScript/2EditDatabase/types/models/spt/config/IWeatherConfig.d.ts index bbdc43e..41a1c83 100644 --- a/TypeScript/2EditDatabase/types/models/spt/config/IWeatherConfig.d.ts +++ b/TypeScript/2EditDatabase/types/models/spt/config/IWeatherConfig.d.ts @@ -1,3 +1,4 @@ +import { WindDirection } from "../../../models/enums/WindDirection"; import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface IWeatherConfig extends IBaseConfig { @@ -7,12 +8,16 @@ export interface IWeatherConfig extends IBaseConfig { } export interface Weather { clouds: MinMax; - windSpeed: MinMax; - windDirection: MinMax; + windSpeed: WeatherSettings; + windDirection: WeatherSettings; windGustiness: MinMax; - rain: MinMax; + rain: WeatherSettings; rainIntensity: MinMax; - fog: MinMax; + fog: WeatherSettings; temp: MinMax; pressure: MinMax; } +export interface WeatherSettings { + values: T[]; + weights: number[]; +} diff --git a/TypeScript/2EditDatabase/types/routers/item_events/HideoutItemEventRouter.d.ts b/TypeScript/2EditDatabase/types/routers/item_events/HideoutItemEventRouter.d.ts index e1e98af..44bd1cd 100644 --- a/TypeScript/2EditDatabase/types/routers/item_events/HideoutItemEventRouter.d.ts +++ b/TypeScript/2EditDatabase/types/routers/item_events/HideoutItemEventRouter.d.ts @@ -1,7 +1,7 @@ -import { IPmcData } from "../../models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "../../models/eft/itemEvent/IItemEventRouterResponse"; import { HideoutCallbacks } from "../../callbacks/HideoutCallbacks"; import { HandledRoute, ItemEventRouterDefinition } from "../../di/Router"; +import { IPmcData } from "../../models/eft/common/IPmcData"; +import { IItemEventRouterResponse } from "../../models/eft/itemEvent/IItemEventRouterResponse"; export declare class HideoutItemEventRouter extends ItemEventRouterDefinition { protected hideoutCallbacks: HideoutCallbacks; constructor(hideoutCallbacks: HideoutCallbacks); diff --git a/TypeScript/2EditDatabase/types/routers/item_events/InventoryItemEventRouter.d.ts b/TypeScript/2EditDatabase/types/routers/item_events/InventoryItemEventRouter.d.ts index 2619bb9..953d322 100644 --- a/TypeScript/2EditDatabase/types/routers/item_events/InventoryItemEventRouter.d.ts +++ b/TypeScript/2EditDatabase/types/routers/item_events/InventoryItemEventRouter.d.ts @@ -1,7 +1,7 @@ -import { IPmcData } from "../../models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "../../models/eft/itemEvent/IItemEventRouterResponse"; import { InventoryCallbacks } from "../../callbacks/InventoryCallbacks"; import { HandledRoute, ItemEventRouterDefinition } from "../../di/Router"; +import { IPmcData } from "../../models/eft/common/IPmcData"; +import { IItemEventRouterResponse } from "../../models/eft/itemEvent/IItemEventRouterResponse"; export declare class InventoryItemEventRouter extends ItemEventRouterDefinition { protected inventoryCallbacks: InventoryCallbacks; constructor(inventoryCallbacks: InventoryCallbacks); diff --git a/TypeScript/2EditDatabase/types/servers/HttpServer.d.ts b/TypeScript/2EditDatabase/types/servers/HttpServer.d.ts index bbca8af..80c1d48 100644 --- a/TypeScript/2EditDatabase/types/servers/HttpServer.d.ts +++ b/TypeScript/2EditDatabase/types/servers/HttpServer.d.ts @@ -4,6 +4,7 @@ import { ApplicationContext } from "../context/ApplicationContext"; import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; import { ILogger } from "../models/spt/utils/ILogger"; +import { LocalisationService } from "../services/LocalisationService"; import { ConfigServer } from "./ConfigServer"; import { DatabaseServer } from "./DatabaseServer"; import { IHttpListener } from "./http/IHttpListener"; @@ -12,11 +13,12 @@ export declare class HttpServer { protected logger: ILogger; protected databaseServer: DatabaseServer; protected httpServerHelper: HttpServerHelper; + protected localisationService: LocalisationService; protected httpListeners: IHttpListener[]; protected configServer: ConfigServer; protected applicationContext: ApplicationContext; protected webSocketServer: WebSocketServer; - constructor(logger: ILogger, databaseServer: DatabaseServer, httpServerHelper: HttpServerHelper, httpListeners: IHttpListener[], configServer: ConfigServer, applicationContext: ApplicationContext, webSocketServer: WebSocketServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, httpServerHelper: HttpServerHelper, localisationService: LocalisationService, httpListeners: IHttpListener[], configServer: ConfigServer, applicationContext: ApplicationContext, webSocketServer: WebSocketServer); protected httpConfig: IHttpConfig; getCookies(req: http.IncomingMessage): any; handleRequest(req: IncomingMessage, resp: ServerResponse): void; diff --git a/TypeScript/2EditDatabase/types/servers/SaveServer.d.ts b/TypeScript/2EditDatabase/types/servers/SaveServer.d.ts index cb28f49..4dca514 100644 --- a/TypeScript/2EditDatabase/types/servers/SaveServer.d.ts +++ b/TypeScript/2EditDatabase/types/servers/SaveServer.d.ts @@ -1,20 +1,22 @@ +import { SaveLoadRouter } from "../di/Router"; import { IAkiProfile, Info } from "../models/eft/profile/IAkiProfile"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { VFS } from "../utils/VFS"; -import { SaveLoadRouter } from "../di/Router"; -import { ILogger } from "../models/spt/utils/ILogger"; export declare class SaveServer { protected vfs: VFS; protected saveLoadRouters: SaveLoadRouter[]; protected jsonUtil: JsonUtil; protected hashUtil: HashUtil; + protected localisationService: LocalisationService; protected logger: ILogger; protected profileFilepath: string; protected profiles: {}; protected onSave: {}; protected saveMd5: {}; - constructor(vfs: VFS, saveLoadRouters: SaveLoadRouter[], jsonUtil: JsonUtil, hashUtil: HashUtil, logger: ILogger); + constructor(vfs: VFS, saveLoadRouters: SaveLoadRouter[], jsonUtil: JsonUtil, hashUtil: HashUtil, localisationService: LocalisationService, logger: ILogger); load(): void; save(): void; getProfile(sessionId: string): IAkiProfile; diff --git a/TypeScript/2EditDatabase/types/servers/WebSocketServer.d.ts b/TypeScript/2EditDatabase/types/servers/WebSocketServer.d.ts index f33d214..5d40e6e 100644 --- a/TypeScript/2EditDatabase/types/servers/WebSocketServer.d.ts +++ b/TypeScript/2EditDatabase/types/servers/WebSocketServer.d.ts @@ -1,18 +1,20 @@ /// -import { HttpServerHelper } from "../helpers/HttpServerHelper"; -import WebSocket from "ws"; import http, { IncomingMessage } from "http"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { RandomUtil } from "../utils/RandomUtil"; +import WebSocket from "ws"; +import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { INotification } from "../models/eft/notifier/INotifier"; -import { ConfigServer } from "./ConfigServer"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { LocalisationService } from "../services/LocalisationService"; +import { RandomUtil } from "../utils/RandomUtil"; +import { ConfigServer } from "./ConfigServer"; export declare class WebSocketServer { protected logger: ILogger; protected randomUtil: RandomUtil; protected configServer: ConfigServer; + protected localisationService: LocalisationService; protected httpServerHelper: HttpServerHelper; - constructor(logger: ILogger, randomUtil: RandomUtil, configServer: ConfigServer, httpServerHelper: HttpServerHelper); + constructor(logger: ILogger, randomUtil: RandomUtil, configServer: ConfigServer, localisationService: LocalisationService, httpServerHelper: HttpServerHelper); protected httpConfig: IHttpConfig; protected defaultNotification: INotification; protected webSockets: Record; diff --git a/TypeScript/2EditDatabase/types/servers/http/AkiHttpListener.d.ts b/TypeScript/2EditDatabase/types/servers/http/AkiHttpListener.d.ts index 6f78939..acf92aa 100644 --- a/TypeScript/2EditDatabase/types/servers/http/AkiHttpListener.d.ts +++ b/TypeScript/2EditDatabase/types/servers/http/AkiHttpListener.d.ts @@ -1,22 +1,24 @@ /// /// import { IncomingMessage, ServerResponse } from "http"; -import { IHttpListener } from "./IHttpListener"; import { Serializer } from "../../di/Serializer"; import { ILogger } from "../../models/spt/utils/ILogger"; import { HttpRouter } from "../../routers/HttpRouter"; +import { LocalisationService } from "../../services/LocalisationService"; import { HttpResponseUtil } from "../../utils/HttpResponseUtil"; import { JsonUtil } from "../../utils/JsonUtil"; import { HttpBufferHandler } from "./HttpBufferHandler"; +import { IHttpListener } from "./IHttpListener"; export declare class AkiHttpListener implements IHttpListener { protected httpRouter: HttpRouter; protected serializers: Serializer[]; protected logger: ILogger; protected jsonUtil: JsonUtil; protected httpResponse: HttpResponseUtil; + protected localisationService: LocalisationService; protected httpBufferHandler: HttpBufferHandler; constructor(httpRouter: HttpRouter, // TODO: delay required - serializers: Serializer[], logger: ILogger, jsonUtil: JsonUtil, httpResponse: HttpResponseUtil, httpBufferHandler: HttpBufferHandler); + serializers: Serializer[], logger: ILogger, jsonUtil: JsonUtil, httpResponse: HttpResponseUtil, localisationService: LocalisationService, httpBufferHandler: HttpBufferHandler); canHandle(_: string, req: IncomingMessage): boolean; handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): void; sendResponse(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: Buffer, output: string): void; diff --git a/TypeScript/2EditDatabase/types/services/BotEquipmentFilterService.d.ts b/TypeScript/2EditDatabase/types/services/BotEquipmentFilterService.d.ts index 632f961..ae72cc3 100644 --- a/TypeScript/2EditDatabase/types/services/BotEquipmentFilterService.d.ts +++ b/TypeScript/2EditDatabase/types/services/BotEquipmentFilterService.d.ts @@ -1,12 +1,12 @@ import { IBotType } from "../models/eft/common/tables/IBotType"; -import { EquipmentFilters, EquipmentFilterDetails, IBotConfig } from "../models/spt/config/IBotConfig"; +import { EquipmentFilters, EquipmentFilterDetails, IBotConfig, WeightingAdjustmentDetails } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; export declare class BotEquipmentFilterService { protected logger: ILogger; protected configServer: ConfigServer; protected botConfig: IBotConfig; - protected botEquipmentFilterlists: Record; + protected botEquipmentConfig: Record; constructor(logger: ILogger, configServer: ConfigServer); /** * Filter a bots data to exclude equipment and cartridges defines in the botConfig @@ -30,6 +30,20 @@ export declare class BotEquipmentFilterService { * @returns EquipmentFilterDetails object */ protected getBotEquipmentWhitelist(botRole: string, playerLevel: number): EquipmentFilterDetails; + /** + * Retreive clothing weighting adjustments from bot.json config + * @param botRole Bot type to get adjustments for + * @param playerLevel level of player + * @returns Weighting adjustments for bots clothing + */ + protected getBotClothingAdjustments(botRole: string, playerLevel: number): WeightingAdjustmentDetails; + /** + * Retreive item weighting adjustments from bot.json config + * @param botRole Bot type to get adjustments for + * @param playerLevel level of player + * @returns Weighting adjustments for bot items + */ + protected getBotWeightingAdjustments(botRole: string, playerLevel: number): WeightingAdjustmentDetails; /** * Filter bot equipment based on blacklist and whitelist from config/bot.json * Prioritises whitelist first, if one is found blacklist is ignored @@ -47,4 +61,10 @@ export declare class BotEquipmentFilterService { * @returns Filtered bot file */ protected filterCartridges(baseBotNode: IBotType, blacklist: EquipmentFilterDetails, whitelist: EquipmentFilterDetails): void; + /** + * Add/Edit weighting changes to bot items using values from config/bot.json/equipment + * @param weightingAdjustments Weighting change to apply to bot + * @param botItemPool Bot item dictionary to adjust + */ + protected adjustWeighting(weightingAdjustments: WeightingAdjustmentDetails, botItemPool: Record): void; } diff --git a/TypeScript/2EditDatabase/types/services/BotGenerationCacheService.d.ts b/TypeScript/2EditDatabase/types/services/BotGenerationCacheService.d.ts index ba53fec..0be0576 100644 --- a/TypeScript/2EditDatabase/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/2EditDatabase/types/services/BotGenerationCacheService.d.ts @@ -8,11 +8,11 @@ export declare class BotGenerationCacheService { protected randomUtil: RandomUtil; protected jsonUtil: JsonUtil; protected botHelper: BotHelper; - protected storedBots: IBotBase[]; + protected storedBots: Map; constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, botHelper: BotHelper); /** * Store array of bots in cache, shuffle results before storage - * @param botsToStore + * @param botsToStore Bots we want to store in the cache */ storeBots(botsToStore: IBotBase[]): void; /** @@ -21,25 +21,7 @@ export declare class BotGenerationCacheService { * @param role role to retreive (assault/bossTagilla etc) * @returns IBotBase object */ - getBot(role: string): IBotBase[]; - /** - * Find a bot by its index from cache - * @param indexOfBotToReturn index to find bot by - * @returns bot profile - */ - protected getBotFromCache(indexOfBotToReturn: number): IBotBase; - /** - * Remove bot profile by index from cache - * @param indexOfBotToReturn Index of bot profile to remove - */ - protected removeBotFromCache(indexOfBotToReturn: number): void; - /** - * Get index of bot profile that matches criteria - * @param role Role of bot wanted - * @param getPmc Requested bot a pmc - * @returns index of found bot, -1 if not found - */ - protected getIndexOfBotToReturn(role: string, getPmc: boolean): number; + getBot(role: string): IBotBase; /** * Remove all cached bot profiles */ @@ -48,5 +30,5 @@ export declare class BotGenerationCacheService { * Does cache have bots * @returns true if empty */ - cacheIsEmpty(): boolean; + cacheHasBotOfRole(role: string): boolean; } diff --git a/TypeScript/2EditDatabase/types/services/LocaleService.d.ts b/TypeScript/2EditDatabase/types/services/LocaleService.d.ts index 33bea7b..8275b75 100644 --- a/TypeScript/2EditDatabase/types/services/LocaleService.d.ts +++ b/TypeScript/2EditDatabase/types/services/LocaleService.d.ts @@ -1,14 +1,42 @@ import { ILocaleConfig } from "../models/spt/config/ILocaleConfig"; +import { ILocaleGlobalBase } from "../models/spt/server/ILocaleBase"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +/** + * Handles getting locales from config or users machine + */ export declare class LocaleService { protected logger: ILogger; + protected databaseServer: DatabaseServer; protected configServer: ConfigServer; protected localeConfig: ILocaleConfig; - constructor(logger: ILogger, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, configServer: ConfigServer); /** - * Gets the locale key from the locale.json file + * Get the eft globals db file based on the configured locale in config/locale.json, if not found, fall back to 'en' + * @returns ILocaleGlobalBase + */ + getLocaleDb(): ILocaleGlobalBase; + /** + * Gets the game locale key from the locale.json file, + * if value is 'system' get system locale * @returns locale e.g en/ge/cz/cn */ - getDesiredLocale(): string; + getDesiredGameLocale(): string; + /** + * Gets the game locale key from the locale.json file, + * if value is 'system' get system locale + * @returns locale e.g en/ge/cz/cn + */ + getDesiredServerLocale(): string; + /** + * Get array of languages supported for localisation + * @returns array of locales e.g. en/fr/cn + */ + getServerSupportedLocales(): string[]; + /** + * Get the locale of the computer running the server + * @returns langage part of locale e.g. 'en' part of 'en-US' + */ + protected getPlatformLocale(): string; } diff --git a/TypeScript/2EditDatabase/types/services/LocalisationService.d.ts b/TypeScript/2EditDatabase/types/services/LocalisationService.d.ts new file mode 100644 index 0000000..519325d --- /dev/null +++ b/TypeScript/2EditDatabase/types/services/LocalisationService.d.ts @@ -0,0 +1,21 @@ +import { I18n } from "i18n"; +import { ILocaleConfig } from "../models/spt/config/ILocaleConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { LocaleService } from "./LocaleService"; +/** + * Handles translating server text into different langauges + */ +export declare class LocalisationService { + protected logger: ILogger; + protected localeService: LocaleService; + protected localeConfig: ILocaleConfig; + protected i18n: I18n; + constructor(logger: ILogger, localeService: LocaleService); + /** + * Get a localised value using the passed in key + * @param key Key to loop up locale for + * @param args optional arguments + * @returns Localised string + */ + getText(key: string, args?: any): string; +} diff --git a/TypeScript/2EditDatabase/types/services/PaymentService.d.ts b/TypeScript/2EditDatabase/types/services/PaymentService.d.ts index a5e538f..c9ce95a 100644 --- a/TypeScript/2EditDatabase/types/services/PaymentService.d.ts +++ b/TypeScript/2EditDatabase/types/services/PaymentService.d.ts @@ -11,6 +11,7 @@ import { IProcessSellTradeRequestData } from "../models/eft/trade/IProcessSellTr import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +import { LocalisationService } from "./LocalisationService"; export declare class PaymentService { protected logger: ILogger; protected httpResponse: HttpResponseUtil; @@ -19,8 +20,9 @@ export declare class PaymentService { protected traderHelper: TraderHelper; protected itemHelper: ItemHelper; protected inventoryHelper: InventoryHelper; + protected localisationService: LocalisationService; protected paymentHelper: PaymentHelper; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, traderHelper: TraderHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper); + constructor(logger: ILogger, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, traderHelper: TraderHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, localisationService: LocalisationService, paymentHelper: PaymentHelper); /** * Take money and insert items into return to server request * @param {Object} pmcData @@ -50,7 +52,7 @@ export declare class PaymentService { * @param pmcData Player profile to find and remove currency from * @param currencyTpl Type of currency to pay * @param amountToPay money value to pay - * @param sessionID Sessino id + * @param sessionID Session id * @param output output object to send to client * @returns IItemEventRouterResponse */ diff --git a/TypeScript/2EditDatabase/types/services/PlayerService.d.ts b/TypeScript/2EditDatabase/types/services/PlayerService.d.ts index 519b7e5..2f364d5 100644 --- a/TypeScript/2EditDatabase/types/services/PlayerService.d.ts +++ b/TypeScript/2EditDatabase/types/services/PlayerService.d.ts @@ -2,10 +2,12 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { IPlayerIncrementSkillLevelRequestData } from "../models/eft/player/IPlayerIncrementSkillLevelRequestData"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "./LocalisationService"; export declare class PlayerService { protected logger: ILogger; + protected localisationService: LocalisationService; protected databaseServer: DatabaseServer; - constructor(logger: ILogger, databaseServer: DatabaseServer); + constructor(logger: ILogger, localisationService: LocalisationService, databaseServer: DatabaseServer); /** * increases the profile skill and updates any output * @param {Object} pmcData diff --git a/TypeScript/2EditDatabase/types/services/PmcAiService.d.ts b/TypeScript/2EditDatabase/types/services/PmcAiService.d.ts deleted file mode 100644 index 0690f1f..0000000 --- a/TypeScript/2EditDatabase/types/services/PmcAiService.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { IBotConfig } from "../models/spt/config/IBotConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { ConfigServer } from "../servers/ConfigServer"; -/** Storing/retreving pmcRoles set at the start of a raid - its done at that point as we know what location the player is heading to */ -export declare class PmcAiService { - protected logger: ILogger; - protected configServer: ConfigServer; - protected botConfig: IBotConfig; - protected usecRole: string; - protected bearRole: string; - constructor(logger: ILogger, configServer: ConfigServer); - /** - * Convert from pmc side (usec/bear) to the side as defined in the bot config (usecType/bearType) - * @param pmcSide eft side (usec/bear) - * @returns pmc side as defined in config - */ - getPmcRole(pmcSide: "usec" | "bear" | string): string; - /** - * Set the roles for pmcs - * @param location map location to look up and use as pmc types - */ - setPmcRolesByLocation(location: string): void; - /** - * Clear the saved role from usec/bear PMCs - */ - clearPmcRoles(): void; -} diff --git a/TypeScript/2EditDatabase/types/services/ProfileFixerService.d.ts b/TypeScript/2EditDatabase/types/services/ProfileFixerService.d.ts index e772919..86a6af8 100644 --- a/TypeScript/2EditDatabase/types/services/ProfileFixerService.d.ts +++ b/TypeScript/2EditDatabase/types/services/ProfileFixerService.d.ts @@ -8,12 +8,14 @@ import { HideoutAreas } from "../models/enums/HideoutAreas"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { Watermark } from "../utils/Watermark"; +import { LocalisationService } from "./LocalisationService"; export declare class ProfileFixerService { protected logger: ILogger; protected watermark: Watermark; protected hideoutHelper: HideoutHelper; + protected localisationService: LocalisationService; protected databaseServer: DatabaseServer; - constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, databaseServer: DatabaseServer); + constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, localisationService: LocalisationService, databaseServer: DatabaseServer); /** * Find issues in the pmc profile data that may cause issues and fix them * @param pmcProfile profile to check and fix diff --git a/TypeScript/2EditDatabase/types/services/RagfairOfferService.d.ts b/TypeScript/2EditDatabase/types/services/RagfairOfferService.d.ts index a6f6b6d..86c1e52 100644 --- a/TypeScript/2EditDatabase/types/services/RagfairOfferService.d.ts +++ b/TypeScript/2EditDatabase/types/services/RagfairOfferService.d.ts @@ -11,6 +11,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { TimeUtil } from "../utils/TimeUtil"; +import { LocalisationService } from "./LocalisationService"; import { RagfairCategoriesService } from "./RagfairCategoriesService"; export declare class RagfairOfferService { protected logger: ILogger; @@ -22,12 +23,14 @@ export declare class RagfairOfferService { protected profileHelper: ProfileHelper; protected eventOutputHolder: EventOutputHolder; protected httpResponse: HttpResponseUtil; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected playerOffersLoaded: boolean; protected expiredOffers: Item[]; - protected offers: IRagfairOffer[]; + /** offerId, offer */ + protected offers: Record; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, databaseServer: DatabaseServer, saveServer: SaveServer, ragfairServerHelper: RagfairServerHelper, ragfairCategoriesService: RagfairCategoriesService, profileHelper: ProfileHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, databaseServer: DatabaseServer, saveServer: SaveServer, ragfairServerHelper: RagfairServerHelper, ragfairCategoriesService: RagfairCategoriesService, profileHelper: ProfileHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, localisationService: LocalisationService, configServer: ConfigServer); /** * Get all offers * @returns IRagfairOffer array diff --git a/TypeScript/2EditDatabase/types/utils/App.d.ts b/TypeScript/2EditDatabase/types/utils/App.d.ts index dcc2669..cc8a5af 100644 --- a/TypeScript/2EditDatabase/types/utils/App.d.ts +++ b/TypeScript/2EditDatabase/types/utils/App.d.ts @@ -1,14 +1,16 @@ -import { TimeUtil } from "./TimeUtil"; import { OnLoad } from "../di/OnLoad"; import { OnUpdate } from "../di/OnUpdate"; import { ILogger } from "../models/spt/utils/ILogger"; +import { LocalisationService } from "../services/LocalisationService"; +import { TimeUtil } from "./TimeUtil"; export declare class App { protected logger: ILogger; protected timeUtil: TimeUtil; + protected localisationService: LocalisationService; protected onLoadComponents: OnLoad[]; protected onUpdateComponents: OnUpdate[]; protected onUpdateLastRun: {}; - constructor(logger: ILogger, timeUtil: TimeUtil, onLoadComponents: OnLoad[], onUpdateComponents: OnUpdate[]); + constructor(logger: ILogger, timeUtil: TimeUtil, localisationService: LocalisationService, onLoadComponents: OnLoad[], onUpdateComponents: OnUpdate[]); load(): void; protected update(onUpdateComponents: OnUpdate[]): void; protected logUpdateException(err: any, updateable: OnUpdate): void; diff --git a/TypeScript/2EditDatabase/types/utils/DatabaseImporter.d.ts b/TypeScript/2EditDatabase/types/utils/DatabaseImporter.d.ts index 483e135..31670ae 100644 --- a/TypeScript/2EditDatabase/types/utils/DatabaseImporter.d.ts +++ b/TypeScript/2EditDatabase/types/utils/DatabaseImporter.d.ts @@ -3,15 +3,17 @@ import { IDatabaseTables } from "../models/spt/server/IDatabaseTables"; import { ILogger } from "../models/spt/utils/ILogger"; import { ImageRouter } from "../routers/ImageRouter"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { JsonUtil } from "./JsonUtil"; import { VFS } from "./VFS"; export declare class DatabaseImporter extends OnLoad { protected logger: ILogger; protected vfs: VFS; protected jsonUtil: JsonUtil; + protected localisationService: LocalisationService; protected databaseServer: DatabaseServer; protected imageRouter: ImageRouter; - constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, databaseServer: DatabaseServer, imageRouter: ImageRouter); + constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, localisationService: LocalisationService, databaseServer: DatabaseServer, imageRouter: ImageRouter); onLoad(): void; /** * Read all json files in database folder and map into a json object diff --git a/TypeScript/2EditDatabase/types/utils/HttpResponseUtil.d.ts b/TypeScript/2EditDatabase/types/utils/HttpResponseUtil.d.ts index 29502be..3a78618 100644 --- a/TypeScript/2EditDatabase/types/utils/HttpResponseUtil.d.ts +++ b/TypeScript/2EditDatabase/types/utils/HttpResponseUtil.d.ts @@ -1,10 +1,13 @@ -import { JsonUtil } from "./JsonUtil"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { INullResponseData } from "../models/eft/httpResponse/INullResponseData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; +import { BackendErrorCodes } from "../models/enums/BackendErrorCodes"; +import { LocalisationService } from "../services/LocalisationService"; +import { JsonUtil } from "./JsonUtil"; export declare class HttpResponseUtil { protected jsonUtil: JsonUtil; - constructor(jsonUtil: JsonUtil); + protected localisationService: LocalisationService; + constructor(jsonUtil: JsonUtil, localisationService: LocalisationService); protected clearString(s: string): any; noBody(data: any): any; getBody(data: T, err?: number, errmsg?: any): IGetBodyResponseData; @@ -12,5 +15,5 @@ export declare class HttpResponseUtil { emptyResponse(): IGetBodyResponseData; nullResponse(): INullResponseData; emptyArrayResponse(): IGetBodyResponseData; - appendErrorToOutput(output: IItemEventRouterResponse, message?: string, title?: string): IItemEventRouterResponse; + appendErrorToOutput(output: IItemEventRouterResponse, message?: string, errorCode?: BackendErrorCodes): IItemEventRouterResponse; } diff --git a/TypeScript/2EditDatabase/types/utils/RandomUtil.d.ts b/TypeScript/2EditDatabase/types/utils/RandomUtil.d.ts index 633e472..aa556e3 100644 --- a/TypeScript/2EditDatabase/types/utils/RandomUtil.d.ts +++ b/TypeScript/2EditDatabase/types/utils/RandomUtil.d.ts @@ -110,6 +110,12 @@ export declare class RandomUtil { getIntEx(max: number): number; getFloat(min: number, max: number): number; getBool(): boolean; + /** + * Check if number passes a check out of 100 + * @param chancePercent value check needs to be above + * @returns true if value passes check + */ + getChance100(chancePercent: number): boolean; getStringArrayValue(arr: string[]): string; getArrayValue(arr: T[]): T; getKey(node: any): string; diff --git a/TypeScript/2EditDatabase/types/utils/Watermark.d.ts b/TypeScript/2EditDatabase/types/utils/Watermark.d.ts index c6dc120..e02eba2 100644 --- a/TypeScript/2EditDatabase/types/utils/Watermark.d.ts +++ b/TypeScript/2EditDatabase/types/utils/Watermark.d.ts @@ -1,20 +1,15 @@ import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { LocalisationService } from "../services/LocalisationService"; export declare class WatermarkLocale { - protected locales: { - "en-US": { - description: string[]; - warning: string[]; - modding: string[]; - }; - "zh-CN": { - description: string[]; - warning: string[]; - modding: string[]; - }; + protected localisationService: LocalisationService; + constructor(localisationService: LocalisationService); + protected watermark: { + description: string[]; + warning: string[]; + modding: string[]; }; - getLocale(): string; getDescription(): string[]; getWarning(): string[]; getModding(): string[]; @@ -22,9 +17,10 @@ export declare class WatermarkLocale { export declare class Watermark { protected logger: ILogger; protected configServer: ConfigServer; + protected localisationService: LocalisationService; protected watermarkLocale?: WatermarkLocale; protected akiConfig: ICoreConfig; - constructor(logger: ILogger, configServer: ConfigServer, watermarkLocale?: WatermarkLocale); + constructor(logger: ILogger, configServer: ConfigServer, localisationService: LocalisationService, watermarkLocale?: WatermarkLocale); protected text: string[]; protected versionLabel: string; initialize(): void; diff --git a/TypeScript/3GetSptConfigFile/types/callbacks/BotCallbacks.d.ts b/TypeScript/3GetSptConfigFile/types/callbacks/BotCallbacks.d.ts index 2db60dc..827015e 100644 --- a/TypeScript/3GetSptConfigFile/types/callbacks/BotCallbacks.d.ts +++ b/TypeScript/3GetSptConfigFile/types/callbacks/BotCallbacks.d.ts @@ -8,8 +8,29 @@ export declare class BotCallbacks { protected botController: BotController; protected httpResponse: HttpResponseUtil; constructor(botController: BotController, httpResponse: HttpResponseUtil); + /** + * Handle singleplayer/settings/bot/limit + * @returns string + */ getBotLimit(url: string, info: IEmptyRequestData, sessionID: string): string; + /** + * Handle singleplayer/settings/bot/difficulty + * @returns string + */ getBotDifficulty(url: string, info: IEmptyRequestData, sessionID: string): string; + /** + * Handle client/game/bot/generate + * @returns IGetBodyResponseData + */ generateBots(url: string, info: IGenerateBotsRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle singleplayer/settings/bot/maxCap + * @returns string + */ getBotCap(): string; + /** + * Handle singleplayer/settings/bot/getBotBehaviours + * @returns string + */ + getBotBehaviours(): string; } diff --git a/TypeScript/3GetSptConfigFile/types/callbacks/CustomizationCallbacks.d.ts b/TypeScript/3GetSptConfigFile/types/callbacks/CustomizationCallbacks.d.ts index 3bab8c0..75d5701 100644 --- a/TypeScript/3GetSptConfigFile/types/callbacks/CustomizationCallbacks.d.ts +++ b/TypeScript/3GetSptConfigFile/types/callbacks/CustomizationCallbacks.d.ts @@ -3,6 +3,7 @@ import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { IPmcData } from "../models/eft/common/IPmcData"; import { ISuit } from "../models/eft/common/tables/ITrader"; import { IBuyClothingRequestData } from "../models/eft/customization/IBuyClothingRequestData"; +import { IGetSuitsResponse } from "../models/eft/customization/IGetSuitsResponse"; import { IWearClothingRequestData } from "../models/eft/customization/IWearClothingRequestData"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; @@ -13,10 +14,15 @@ export declare class CustomizationCallbacks { protected saveServer: SaveServer; protected httpResponse: HttpResponseUtil; constructor(customizationController: CustomizationController, saveServer: SaveServer, httpResponse: HttpResponseUtil); - getSuits(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<{ - _id: string; - suites: string[]; - }>; + /** + * Handles client/trading/customization/storage + * @returns + */ + getSuits(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handles client/trading/customization + * @returns ISuit[] + */ getTraderSuits(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; wearClothing(pmcData: IPmcData, body: IWearClothingRequestData, sessionID: string): IItemEventRouterResponse; buyClothing(pmcData: IPmcData, body: IBuyClothingRequestData, sessionID: string): IItemEventRouterResponse; diff --git a/TypeScript/3GetSptConfigFile/types/callbacks/DataCallbacks.d.ts b/TypeScript/3GetSptConfigFile/types/callbacks/DataCallbacks.d.ts index 04566ff..2efcf81 100644 --- a/TypeScript/3GetSptConfigFile/types/callbacks/DataCallbacks.d.ts +++ b/TypeScript/3GetSptConfigFile/types/callbacks/DataCallbacks.d.ts @@ -12,15 +12,42 @@ import { ILanguageBase } from "../models/spt/server/ILocaleBase"; import { ISettingsBase } from "../models/spt/server/ISettingsBase"; import { DatabaseServer } from "../servers/DatabaseServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +/** + * Handle client requests + */ export declare class DataCallbacks { protected httpResponse: HttpResponseUtil; protected databaseServer: DatabaseServer; constructor(httpResponse: HttpResponseUtil, databaseServer: DatabaseServer); + /** + * Handles client/settings + * @returns ISettingsBase + */ getSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handles client/globals + * @returns IGlobals + */ getGlobals(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handles client/items + * @returns string + */ getTemplateItems(url: string, info: IEmptyRequestData, sessionID: string): string; + /** + * Handles client/handbook/templates + * @returns IHandbookBase + */ getTemplateHandbook(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handles client/customization + * @returns Record>; + /** + * Handles client/account/customization + * @returns string[] + */ getTemplateCharacter(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getTemplateQuests(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getHideoutSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; @@ -28,6 +55,6 @@ export declare class DataCallbacks { gethideoutProduction(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getHideoutScavcase(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getLocalesLanguages(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - getLocalesMenu(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + getLocalesMenu(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getLocalesGlobal(url: string, info: IEmptyRequestData, sessionID: string): string; } diff --git a/TypeScript/3GetSptConfigFile/types/callbacks/DialogueCallbacks.d.ts b/TypeScript/3GetSptConfigFile/types/callbacks/DialogueCallbacks.d.ts index 634f90b..7b2eeae 100644 --- a/TypeScript/3GetSptConfigFile/types/callbacks/DialogueCallbacks.d.ts +++ b/TypeScript/3GetSptConfigFile/types/callbacks/DialogueCallbacks.d.ts @@ -26,15 +26,27 @@ export declare class DialogueCallbacks extends OnUpdate { protected httpResponse: HttpResponseUtil; protected dialogueController: DialogueController; constructor(hashUtil: HashUtil, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, dialogueController: DialogueController); + /** + * Handles client/friend/list + * @returns IGetFriendListDataResponse + */ getFriendList(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handles client/chatServer/list + * @returns + */ getChatServerList(url: string, info: IGetChatServerListRequestData, sessionID: string): IGetBodyResponseData; getMailDialogList(url: string, info: IGetMailDialogListRequestData, sessionID: string): IGetBodyResponseData; getMailDialogView(url: string, info: IGetMailDialogViewRequestData, sessionID: string): IGetBodyResponseData; - getMailDialogInfo(url: string, info: IGetMailDialogInfoRequestData, sessionID: string): IGetBodyResponseData; + getMailDialogInfo(url: string, info: IGetMailDialogInfoRequestData, sessionID: string): IGetBodyResponseData; removeDialog(url: string, info: IRemoveDialogRequestData, sessionID: string): IGetBodyResponseData; pinDialog(url: string, info: IPinDialogRequestData, sessionID: string): IGetBodyResponseData; unpinDialog(url: string, info: IPinDialogRequestData, sessionID: string): IGetBodyResponseData; setRead(url: string, info: ISetDialogReadRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handles client/mail/dialog/getAllAttachments + * @returns IGetAllAttachmentsResponse + */ getAllAttachments(url: string, info: IGetAllAttachmentsRequestData, sessionID: string): IGetBodyResponseData; listOutbox(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; listInbox(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; diff --git a/TypeScript/3GetSptConfigFile/types/callbacks/GameCallbacks.d.ts b/TypeScript/3GetSptConfigFile/types/callbacks/GameCallbacks.d.ts index 5e4c240..3a6b7e6 100644 --- a/TypeScript/3GetSptConfigFile/types/callbacks/GameCallbacks.d.ts +++ b/TypeScript/3GetSptConfigFile/types/callbacks/GameCallbacks.d.ts @@ -3,6 +3,9 @@ import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { ICheckVersionResponse } from "../models/eft/game/ICheckVersionResponse"; import { IGameConfigResponse } from "../models/eft/game/IGameConfigResponse"; import { IGameEmptyCrcRequestData } from "../models/eft/game/IGameEmptyCrcRequestData"; +import { IGameKeepAliveResponse } from "../models/eft/game/IGameKeepAliveResponse"; +import { IGameLogoutResponseData } from "../models/eft/game/IGameLogoutResponseData"; +import { IGameStartResponse } from "../models/eft/game/IGameStartResponse"; import { IReportNicknameRequestData } from "../models/eft/game/IReportNicknameRequestData"; import { IServerDetails } from "../models/eft/game/IServerDetails"; import { IVersionValidateRequestData } from "../models/eft/game/IVersionValidateRequestData"; @@ -15,13 +18,37 @@ declare class GameCallbacks { protected watermark: Watermark; protected gameController: GameController; constructor(httpResponse: HttpResponseUtil, watermark: Watermark, gameController: GameController); + /** + * Handle client/game/version/validate + * @returns INullResponseData + */ versionValidate(url: string, info: IVersionValidateRequestData, sessionID: string): INullResponseData; - gameStart(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - gameLogout(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/game/start + * @returns IGameStartResponse + */ + gameStart(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/game/logout + * @returns IGameLogoutResponseData + */ + gameLogout(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/game/config + * @returns IGameConfigResponse + */ getGameConfig(url: string, info: IGameEmptyCrcRequestData, sessionID: string): IGetBodyResponseData; getServer(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; validateGameVersion(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - gameKeepalive(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/game/keepalive + * @returns IGameKeepAliveResponse + */ + gameKeepalive(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle singleplayer/settings/version + * @returns string + */ getVersion(url: string, info: IEmptyRequestData, sessionID: string): string; reportNickname(url: string, info: IReportNicknameRequestData, sessionID: string): INullResponseData; } diff --git a/TypeScript/3GetSptConfigFile/types/callbacks/HealthCallbacks.d.ts b/TypeScript/3GetSptConfigFile/types/callbacks/HealthCallbacks.d.ts index 8672be7..7edf03e 100644 --- a/TypeScript/3GetSptConfigFile/types/callbacks/HealthCallbacks.d.ts +++ b/TypeScript/3GetSptConfigFile/types/callbacks/HealthCallbacks.d.ts @@ -21,7 +21,19 @@ export declare class HealthCallbacks { * @returns empty response, no data sent back to client */ syncHealth(url: string, info: ISyncHealthRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle Eat + * @returns IItemEventRouterResponse + */ offraidEat(pmcData: IPmcData, body: IOffraidEatRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle Heal + * @returns IItemEventRouterResponse + */ offraidHeal(pmcData: IPmcData, body: IOffraidHealRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle RestoreHealth + * @returns IItemEventRouterResponse + */ healthTreatment(pmcData: IPmcData, info: IHealthTreatmentRequestData, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/3GetSptConfigFile/types/callbacks/HideoutCallbacks.d.ts b/TypeScript/3GetSptConfigFile/types/callbacks/HideoutCallbacks.d.ts index 99ab4c9..e39e806 100644 --- a/TypeScript/3GetSptConfigFile/types/callbacks/HideoutCallbacks.d.ts +++ b/TypeScript/3GetSptConfigFile/types/callbacks/HideoutCallbacks.d.ts @@ -19,14 +19,77 @@ export declare class HideoutCallbacks extends OnUpdate { protected hideoutConfig: IHideoutConfig; constructor(hideoutController: HideoutController, // TODO: delay needed configServer: ConfigServer); + /** + * Handle HideoutUpgrade + * @param pmcData + * @param body + * @param sessionID + * @returns + */ upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutUpgradeComplete + * @param pmcData + * @param body + * @param sessionID + * @returns + */ upgradeComplete(pmcData: IPmcData, body: IHideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutPutItemsInAreaSlots + * @param pmcData + * @param body + * @param sessionID + * @returns + */ putItemsInAreaSlots(pmcData: IPmcData, body: IHideoutPutItemInRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutTakeItemsFromAreaSlots + * @param pmcData + * @param body + * @param sessionID + * @returns + */ takeItemsFromAreaSlots(pmcData: IPmcData, body: IHideoutTakeItemOutRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutToggleArea + * @param pmcData + * @param body + * @param sessionID + * @returns + */ toggleArea(pmcData: IPmcData, body: IHideoutToggleAreaRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutSingleProductionStart + * @param pmcData + * @param body + * @param sessionID + * @returns + */ singleProductionStart(pmcData: IPmcData, body: IHideoutSingleProductionStartRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutScavCaseProductionStart + * @param pmcData + * @param body + * @param sessionID + * @returns + */ scavCaseProductionStart(pmcData: IPmcData, body: IHideoutScavCaseStartRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutContinuousProductionStart + * @param pmcData + * @param body + * @param sessionID + * @returns + */ continuousProductionStart(pmcData: IPmcData, body: IHideoutContinousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutTakeProduction + * @param pmcData + * @param body + * @param sessionID + * @returns + */ takeProduction(pmcData: IPmcData, body: IHideoutTakeProductionRequestData, sessionID: string): IItemEventRouterResponse; onUpdate(timeSinceLastRun: number): boolean; getRoute(): string; diff --git a/TypeScript/3GetSptConfigFile/types/callbacks/InraidCallbacks.d.ts b/TypeScript/3GetSptConfigFile/types/callbacks/InraidCallbacks.d.ts index 05bcce4..918bfaf 100644 --- a/TypeScript/3GetSptConfigFile/types/callbacks/InraidCallbacks.d.ts +++ b/TypeScript/3GetSptConfigFile/types/callbacks/InraidCallbacks.d.ts @@ -1,23 +1,49 @@ import { InraidController } from "../controllers/InraidController"; -import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { INullResponseData } from "../models/eft/httpResponse/INullResponseData"; import { IRegisterPlayerRequestData } from "../models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; -import { IAirdropConfig } from "../models/spt/config/IAirdropConfig"; -import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; -import { ConfigServer } from "../servers/ConfigServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +/** + * Handle client requests + */ export declare class InraidCallbacks { protected inraidController: InraidController; protected httpResponse: HttpResponseUtil; - protected configServer: ConfigServer; - protected airdropConfig: IAirdropConfig; - protected inraidConfig: IInRaidConfig; - constructor(inraidController: InraidController, httpResponse: HttpResponseUtil, configServer: ConfigServer); + constructor(inraidController: InraidController, httpResponse: HttpResponseUtil); + /** + * Handle client/location/getLocalloot + * @param url + * @param info register player request + * @param sessionID Session id + * @returns Null http response + */ registerPlayer(url: string, info: IRegisterPlayerRequestData, sessionID: string): INullResponseData; + /** + * Handle raid/profile/save + * @param url + * @param info Save progress request + * @param sessionID Session id + * @returns Null http response + */ saveProgress(url: string, info: ISaveProgressRequestData, sessionID: string): INullResponseData; + /** + * Handle singleplayer/settings/raid/endstate + * @returns + */ getRaidEndState(): string; - getRaidMenuSettings(url: string, info: IEmptyRequestData, sessionID: string): string; - getWeaponDurability(url: string, info: any, sessionID: string): string; - getAirdropConfig(url: string, info: any, sessionID: string): string; + /** + * Handle singleplayer/settings/raid/menu + * @returns JSON as string + */ + getRaidMenuSettings(): string; + /** + * Handle singleplayer/settings/weapon/durability + * @returns + */ + getWeaponDurability(): string; + /** + * Handle singleplayer/airdrop/config + * @returns JSON as string + */ + getAirdropConfig(): string; } diff --git a/TypeScript/3GetSptConfigFile/types/callbacks/InsuranceCallbacks.d.ts b/TypeScript/3GetSptConfigFile/types/callbacks/InsuranceCallbacks.d.ts index 8835ba2..a171e1c 100644 --- a/TypeScript/3GetSptConfigFile/types/callbacks/InsuranceCallbacks.d.ts +++ b/TypeScript/3GetSptConfigFile/types/callbacks/InsuranceCallbacks.d.ts @@ -17,7 +17,15 @@ export declare class InsuranceCallbacks extends OnUpdate { protected configServer: ConfigServer; protected insuranceConfig: IInsuranceConfig; constructor(insuranceController: InsuranceController, insuranceService: InsuranceService, httpResponse: HttpResponseUtil, configServer: ConfigServer); + /** + * Handle client/insurance/items/list/cost + * @returns IGetInsuranceCostResponseData + */ getInsuranceCost(url: string, info: IGetInsuranceCostRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle Insure + * @returns IItemEventRouterResponse + */ insure(pmcData: IPmcData, body: IInsureRequestData, sessionID: string): IItemEventRouterResponse; onUpdate(secondsSinceLastRun: number): boolean; getRoute(): string; diff --git a/TypeScript/3GetSptConfigFile/types/callbacks/InventoryCallbacks.d.ts b/TypeScript/3GetSptConfigFile/types/callbacks/InventoryCallbacks.d.ts index 9ab1486..46bf6fd 100644 --- a/TypeScript/3GetSptConfigFile/types/callbacks/InventoryCallbacks.d.ts +++ b/TypeScript/3GetSptConfigFile/types/callbacks/InventoryCallbacks.d.ts @@ -16,6 +16,7 @@ import { IInventorySwapRequestData } from "../models/eft/inventory/IInventorySwa import { IInventoryTagRequestData } from "../models/eft/inventory/IInventoryTagRequestData"; import { IInventoryToggleRequestData } from "../models/eft/inventory/IInventoryToggleRequestData"; import { IInventoryTransferRequestData } from "../models/eft/inventory/IInventoryTransferRequestData"; +import { IOpenRandomLootContainerRequestData } from "../models/eft/inventory/IOpenRandomLootContainerRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; export declare class InventoryCallbacks { protected inventoryController: InventoryController; @@ -36,4 +37,5 @@ export declare class InventoryCallbacks { createMapMarker(pmcData: IPmcData, body: IInventoryCreateMarkerRequestData, sessionID: string): IItemEventRouterResponse; deleteMapMarker(pmcData: IPmcData, body: IInventoryDeleteMarkerRequestData, sessionID: string): IItemEventRouterResponse; editMapMarker(pmcData: IPmcData, body: IInventoryEditMarkerRequestData, sessionID: string): IItemEventRouterResponse; + openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/3GetSptConfigFile/types/callbacks/ItemEventCallbacks.d.ts b/TypeScript/3GetSptConfigFile/types/callbacks/ItemEventCallbacks.d.ts index f4f04f9..fbb0b5f 100644 --- a/TypeScript/3GetSptConfigFile/types/callbacks/ItemEventCallbacks.d.ts +++ b/TypeScript/3GetSptConfigFile/types/callbacks/ItemEventCallbacks.d.ts @@ -1,4 +1,5 @@ import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; +import { Warning } from "../models/eft/itemEvent/IItemEventRouterBase"; import { IItemEventRouterRequest } from "../models/eft/itemEvent/IItemEventRouterRequest"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { ItemEventRouter } from "../routers/ItemEventRouter"; @@ -8,4 +9,5 @@ export declare class ItemEventCallbacks { protected itemEventRouter: ItemEventRouter; constructor(httpResponse: HttpResponseUtil, itemEventRouter: ItemEventRouter); handleEvents(url: string, info: IItemEventRouterRequest, sessionID: string): IGetBodyResponseData; + protected getErrorCode(warnings: Warning[]): number; } diff --git a/TypeScript/3GetSptConfigFile/types/callbacks/MatchCallbacks.d.ts b/TypeScript/3GetSptConfigFile/types/callbacks/MatchCallbacks.d.ts index 2a92ef5..10fbc44 100644 --- a/TypeScript/3GetSptConfigFile/types/callbacks/MatchCallbacks.d.ts +++ b/TypeScript/3GetSptConfigFile/types/callbacks/MatchCallbacks.d.ts @@ -34,6 +34,10 @@ export declare class MatchCallbacks { serverAvailable(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData | IGetBodyResponseData; joinMatch(url: string, info: IJoinMatchRequestData, sessionID: string): IGetBodyResponseData; getMetrics(url: string, info: any, sessionID: string): IGetBodyResponseData; + /** + * Handle client/match/group/status + * @returns + */ getGroupStatus(url: string, info: IGetGroupStatusRequestData, sessionID: string): IGetBodyResponseData; createGroup(url: string, info: ICreateGroupRequestData, sessionID: string): IGetBodyResponseData; deleteGroup(url: string, info: any, sessionID: string): INullResponseData; diff --git a/TypeScript/3GetSptConfigFile/types/callbacks/NotifierCallbacks.d.ts b/TypeScript/3GetSptConfigFile/types/callbacks/NotifierCallbacks.d.ts index c42058f..fab325b 100644 --- a/TypeScript/3GetSptConfigFile/types/callbacks/NotifierCallbacks.d.ts +++ b/TypeScript/3GetSptConfigFile/types/callbacks/NotifierCallbacks.d.ts @@ -4,6 +4,7 @@ import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { INotifierChannel } from "../models/eft/notifier/INotifier"; import { ISelectProfileRequestData } from "../models/eft/notifier/ISelectProfileRequestData"; +import { ISelectProfileResponse } from "../models/eft/notifier/ISelectProfileResponse"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; export declare class NotifierCallbacks { protected httpServerHelper: HttpServerHelper; @@ -19,6 +20,10 @@ export declare class NotifierCallbacks { sendNotification(sessionID: string, req: any, resp: any, data: any): void; getNotifier(url: string, info: any, sessionID: string): IGetBodyResponseData; createNotifierChannel(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - selectProfile(url: string, info: ISelectProfileRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/game/profile/select + * @returns ISelectProfileResponse + */ + selectProfile(url: string, info: ISelectProfileRequestData, sessionID: string): IGetBodyResponseData; notify(url: string, info: any, sessionID: string): string; } diff --git a/TypeScript/3GetSptConfigFile/types/callbacks/QuestCallbacks.d.ts b/TypeScript/3GetSptConfigFile/types/callbacks/QuestCallbacks.d.ts index 559c29e..2a3eb20 100644 --- a/TypeScript/3GetSptConfigFile/types/callbacks/QuestCallbacks.d.ts +++ b/TypeScript/3GetSptConfigFile/types/callbacks/QuestCallbacks.d.ts @@ -21,6 +21,13 @@ export declare class QuestCallbacks { acceptQuest(pmcData: IPmcData, body: IAcceptQuestRequestData, sessionID: string): IItemEventRouterResponse; completeQuest(pmcData: IPmcData, body: ICompleteQuestRequestData, sessionID: string): IItemEventRouterResponse; handoverQuest(pmcData: IPmcData, body: IHandoverQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle client/quest/list + * @param url + * @param info + * @param sessionID + * @returns + */ listQuests(url: string, info: IListQuestsRequestData, sessionID: string): IGetBodyResponseData; activityPeriods(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; } diff --git a/TypeScript/3GetSptConfigFile/types/callbacks/RagfairCallbacks.d.ts b/TypeScript/3GetSptConfigFile/types/callbacks/RagfairCallbacks.d.ts index c609f2f..37f3807 100644 --- a/TypeScript/3GetSptConfigFile/types/callbacks/RagfairCallbacks.d.ts +++ b/TypeScript/3GetSptConfigFile/types/callbacks/RagfairCallbacks.d.ts @@ -35,7 +35,7 @@ export declare class RagfairCallbacks extends OnLoadOnUpdate { getRoute(): string; search(url: string, info: ISearchRequestData, sessionID: string): IGetBodyResponseData; getMarketPrice(url: string, info: IGetMarketPriceRequestData, sessionID: string): IGetBodyResponseData; - getItemPrices(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + getItemPrices(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData>; addOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; removeOffer(pmcData: IPmcData, info: IRemoveOfferRequestData, sessionID: string): IItemEventRouterResponse; extendOffer(pmcData: IPmcData, info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; diff --git a/TypeScript/3GetSptConfigFile/types/callbacks/TraderCallbacks.d.ts b/TypeScript/3GetSptConfigFile/types/callbacks/TraderCallbacks.d.ts index e4fd099..40a1455 100644 --- a/TypeScript/3GetSptConfigFile/types/callbacks/TraderCallbacks.d.ts +++ b/TypeScript/3GetSptConfigFile/types/callbacks/TraderCallbacks.d.ts @@ -12,6 +12,10 @@ export declare class TraderCallbacks extends OnLoadOnUpdate { onUpdate(): boolean; getRoute(): string; getTraderSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/trading/api/getUserAssortPrice/trader + * @returns + */ getProfilePurchases(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData>; getTrader(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getAssort(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; diff --git a/TypeScript/3GetSptConfigFile/types/callbacks/WeatherCallbacks.d.ts b/TypeScript/3GetSptConfigFile/types/callbacks/WeatherCallbacks.d.ts index ae784c8..f9d2002 100644 --- a/TypeScript/3GetSptConfigFile/types/callbacks/WeatherCallbacks.d.ts +++ b/TypeScript/3GetSptConfigFile/types/callbacks/WeatherCallbacks.d.ts @@ -1,10 +1,15 @@ import { WeatherController } from "../controllers/WeatherController"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; +import { IWeatherData } from "../models/eft/weather/IWeatherData"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; export declare class WeatherCallbacks { protected httpResponse: HttpResponseUtil; protected weatherController: WeatherController; constructor(httpResponse: HttpResponseUtil, weatherController: WeatherController); - getWeather(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/weather + * @returns IWeatherData + */ + getWeather(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; } diff --git a/TypeScript/3GetSptConfigFile/types/context/ContextVariableType.d.ts b/TypeScript/3GetSptConfigFile/types/context/ContextVariableType.d.ts index 5fc1704..a7dd9b5 100644 --- a/TypeScript/3GetSptConfigFile/types/context/ContextVariableType.d.ts +++ b/TypeScript/3GetSptConfigFile/types/context/ContextVariableType.d.ts @@ -1,4 +1,8 @@ export declare enum ContextVariableType { + /** Logged in users session id */ SESSION_ID = 0, - MATCH_INFO = 1 + /** Currently acive raid information */ + MATCH_INFO = 1, + /** Timestamp when client first connected */ + CLIENT_START_TIMESTAMP = 2 } diff --git a/TypeScript/3GetSptConfigFile/types/controllers/BotController.d.ts b/TypeScript/3GetSptConfigFile/types/controllers/BotController.d.ts index a5111d5..92317c3 100644 --- a/TypeScript/3GetSptConfigFile/types/controllers/BotController.d.ts +++ b/TypeScript/3GetSptConfigFile/types/controllers/BotController.d.ts @@ -1,6 +1,8 @@ import { ApplicationContext } from "../context/ApplicationContext"; import { BotGenerator } from "../generators/BotGenerator"; +import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { IGenerateBotsRequestData } from "../models/eft/bot/IGenerateBotsRequestData"; import { IBotBase } from "../models/eft/common/tables/IBotBase"; import { IBotCore } from "../models/eft/common/tables/IBotCore"; @@ -10,18 +12,23 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; -import { PmcAiService } from "../services/PmcAiService"; +import { LocalisationService } from "../services/LocalisationService"; +import { JsonUtil } from "../utils/JsonUtil"; export declare class BotController { protected logger: ILogger; protected databaseServer: DatabaseServer; protected botGenerator: BotGenerator; protected botHelper: BotHelper; - protected pmcAiService: PmcAiService; + protected botDifficultyHelper: BotDifficultyHelper; protected botGenerationCacheService: BotGenerationCacheService; + protected localisationService: LocalisationService; + protected weightedRandomHelper: WeightedRandomHelper; protected configServer: ConfigServer; protected applicationContext: ApplicationContext; + protected jsonUtil: JsonUtil; protected botConfig: IBotConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, pmcAiService: PmcAiService, botGenerationCacheService: BotGenerationCacheService, configServer: ConfigServer, applicationContext: ApplicationContext); + static readonly pmcTypeLabel = "PMC"; + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); /** * Return the number of bot loadout varieties to be generated * @param type bot Type we want the loadout gen count for @@ -37,7 +44,6 @@ export declare class BotController { * @returns Difficulty object */ getBotDifficulty(type: string, difficulty: string): Difficulty; - protected getPmcDifficultySettings(pmcType: "bear" | "usec", difficulty: string, usecType: string, bearType: string): Difficulty; /** * Generate bot profiles and store in cache * @param sessionId Session id @@ -51,4 +57,5 @@ export declare class BotController { * @returns cap number */ getBotCap(): number; + getPmcBotTypes(): Record>>; } diff --git a/TypeScript/3GetSptConfigFile/types/controllers/DialogueController.d.ts b/TypeScript/3GetSptConfigFile/types/controllers/DialogueController.d.ts index 1b72522..9c8b728 100644 --- a/TypeScript/3GetSptConfigFile/types/controllers/DialogueController.d.ts +++ b/TypeScript/3GetSptConfigFile/types/controllers/DialogueController.d.ts @@ -23,7 +23,7 @@ export declare class DialogueController { * Get the content of a dialogue * @param dialogueID Dialog id * @param sessionID Session Id - * @returns + * @returns DialogueInfo */ getDialogueInfo(dialogueID: string, sessionID: string): DialogueInfo; /** diff --git a/TypeScript/3GetSptConfigFile/types/controllers/GameController.d.ts b/TypeScript/3GetSptConfigFile/types/controllers/GameController.d.ts index 3bfbdb1..f4f5849 100644 --- a/TypeScript/3GetSptConfigFile/types/controllers/GameController.d.ts +++ b/TypeScript/3GetSptConfigFile/types/controllers/GameController.d.ts @@ -1,3 +1,4 @@ +import { ApplicationContext } from "../context/ApplicationContext"; import { GameEventHelper } from "../helpers/GameEventHelper"; import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; @@ -14,6 +15,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; +import { LocalisationService } from "../services/LocalisationService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { Watermark } from "../utils/Watermark"; export declare class GameController { @@ -24,14 +26,33 @@ export declare class GameController { protected localeService: LocaleService; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; + protected localisationService: LocalisationService; protected gameEventHelper: GameEventHelper; + protected applicationContext: ApplicationContext; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; protected coreConfig: ICoreConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, gameEventHelper: GameEventHelper, configServer: ConfigServer); - gameStart(_url: string, _info: IEmptyRequestData, sessionID: string): void; + constructor(logger: ILogger, databaseServer: DatabaseServer, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, gameEventHelper: GameEventHelper, applicationContext: ApplicationContext, configServer: ConfigServer); + gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; + /** + * Check if current date falls inside any of the seasons events pased in, if so, handle them + * @param seasonalEvents events to check for + */ protected checkForAndEnableSeasonalEvents(seasonalEvents: ISeasonalEvent[]): void; + /** + * Make adjusted to server code based on the name of the event passed in + * @param globalConfig globals.json + * @param eventName Name of the event to enable. e.g. Christmas + */ protected updateGlobalEvents(globalConfig: Config, eventName: string): void; + /** + * Read in data from seasonalEvents.json and add found equipment items to bots + * @param eventName Name of the event to read equipment in from config + */ + protected addEventGearToScavs(eventName: string): void; + /** + * Set Khorovod(dancing tree) chance to 100% on all maps that support it + */ protected enableDancingTree(): void; /** * Make non-trigger-spawned raiders spawn earlier + always @@ -40,5 +61,6 @@ export declare class GameController { protected logProfileDetails(fullProfile: IAkiProfile): void; getGameConfig(sessionID: string): IGameConfigResponse; getServer(): IServerDetails[]; + protected addPumpkinsToScavBackpacks(): void; getValidGameVersion(): ICheckVersionResponse; } diff --git a/TypeScript/3GetSptConfigFile/types/controllers/HideoutController.d.ts b/TypeScript/3GetSptConfigFile/types/controllers/HideoutController.d.ts index ada5bd9..5b6507b 100644 --- a/TypeScript/3GetSptConfigFile/types/controllers/HideoutController.d.ts +++ b/TypeScript/3GetSptConfigFile/types/controllers/HideoutController.d.ts @@ -23,12 +23,13 @@ import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; import { PlayerService } from "../services/PlayerService"; import { HashUtil } from "../utils/HashUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; -import { JsonUtil } from "../utils/JsonUtil"; export declare class HideoutController { protected logger: ILogger; protected hashUtil: HashUtil; @@ -45,11 +46,12 @@ export declare class HideoutController { protected profileHelper: ProfileHelper; protected hideoutHelper: HideoutHelper; protected scavCaseRewardGenerator: ScavCaseRewardGenerator; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected jsonUtil: JsonUtil; protected static nameBackendCountersCrafting: string; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, configServer: ConfigServer, jsonUtil: JsonUtil); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, localisationService: LocalisationService, configServer: ConfigServer, jsonUtil: JsonUtil); upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; upgradeComplete(pmcData: IPmcData, body: HideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; /** diff --git a/TypeScript/3GetSptConfigFile/types/controllers/InraidController.d.ts b/TypeScript/3GetSptConfigFile/types/controllers/InraidController.d.ts index e84eea1..39a6396 100644 --- a/TypeScript/3GetSptConfigFile/types/controllers/InraidController.d.ts +++ b/TypeScript/3GetSptConfigFile/types/controllers/InraidController.d.ts @@ -6,6 +6,7 @@ import { ProfileHelper } from "../helpers/ProfileHelper"; import { QuestHelper } from "../helpers/QuestHelper"; import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; +import { Item } from "../models/eft/common/tables/IItem"; import { IRegisterPlayerRequestData } from "../models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; import { IAirdropConfig } from "../models/spt/config/IAirdropConfig"; @@ -17,6 +18,9 @@ import { SaveServer } from "../servers/SaveServer"; import { InsuranceService } from "../services/InsuranceService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; +/** + * Logic for handling In Raid callbacks + */ export declare class InraidController { protected logger: ILogger; protected saveServer: SaveServer; @@ -35,14 +39,42 @@ export declare class InraidController { protected airdropConfig: IAirdropConfig; protected inraidConfig: IInRaidConfig; 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 + * Save locationid to active profiles inraid object + * @param sessionID Session id + * @param info Register player request + */ + addPlayer(sessionID: string, info: IRegisterPlayerRequestData): void; + /** + * Save profile state to disk + * Handles pmc/pscav + * @param offraidData post-raid request data + * @param sessionID Session id + */ + savePostRaidProgress(offraidData: ISaveProgressRequestData, sessionID: string): void; + /** + * Handle updating player profile post-pmc raid * @param sessionID session id - * @param offraidData post-raid data of raid + * @param offraidData post-raid data */ protected savePmcProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; + /** + * Make changes to pmc profile after they left raid dead, + * alter bodypart hp, handle insurance, delete inventory items, remove carried quest items + * @param postRaidSaveRequest post-raid save request + * @param pmcData pmc profile + * @param insuranceEnabled is insurance enabled + * @param preRaidGear gear player had before raid + * @param sessionID Session id + * @returns Updated profile object + */ + protected performPostRaidActionsWhenDead(postRaidSaveRequest: ISaveProgressRequestData, pmcData: IPmcData, insuranceEnabled: boolean, preRaidGear: Item[], sessionID: string): IPmcData; + /** + * Adjust player characters bodypart hp if they left raid early + * @param postRaidSaveRequest post raid data + * @param pmcData player profile + */ + protected updatePmcHealthPostRaid(postRaidSaveRequest: ISaveProgressRequestData, pmcData: IPmcData): void; /** * Reduce body part hp to % of max * @param pmcData profile to edit @@ -68,7 +100,31 @@ export declare class InraidController { * @param isPlayerScav Was the player a pScav */ protected markOrRemoveFoundInRaidItems(offraidData: ISaveProgressRequestData, pmcData: IPmcData, isPlayerScav: boolean): void; + /** + * Update profile after player completes scav raid + * @param scavData Scav profile + * @param sessionID Session id + * @param offraidData Post-raid save request + * @param pmcData Pmc profile + * @param isDead Is player dead + */ protected handlePostRaidPlayerScavProcess(scavData: IPmcData, sessionID: string, offraidData: ISaveProgressRequestData, pmcData: IPmcData, isDead: boolean): void; + /** + * Update profile with scav karma values based on in-raid actions + * @param pmcData Pmc profile + * @param offraidData Post-raid save request + * @param scavData Scav profile + * @param sessionID Session id + */ protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData, scavData: IPmcData, sessionID: string): void; + /** + * Get the inraid config from configs/inraid.json + * @returns InRaid Config + */ + getInraidConfig(): IInRaidConfig; + /** + * Get airdrop config from configs/airdrop.json + * @returns Airdrop config + */ getAirdropConfig(): IAirdropConfig; } diff --git a/TypeScript/3GetSptConfigFile/types/controllers/InsuranceController.d.ts b/TypeScript/3GetSptConfigFile/types/controllers/InsuranceController.d.ts index 14bf129..54f31b5 100644 --- a/TypeScript/3GetSptConfigFile/types/controllers/InsuranceController.d.ts +++ b/TypeScript/3GetSptConfigFile/types/controllers/InsuranceController.d.ts @@ -30,8 +30,7 @@ export declare class InsuranceController { protected insuranceService: InsuranceService; protected configServer: ConfigServer; protected insuranceConfig: IInsuranceConfig; - constructor(logger: ILogger, randomUtil: RandomUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, paymentService: PaymentService, // TODO: delay required - insuranceService: InsuranceService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, paymentService: PaymentService, insuranceService: InsuranceService, configServer: ConfigServer); processReturn(): void; insure(pmcData: IPmcData, body: IInsureRequestData, sessionID: string): IItemEventRouterResponse; /** diff --git a/TypeScript/3GetSptConfigFile/types/controllers/InventoryController.d.ts b/TypeScript/3GetSptConfigFile/types/controllers/InventoryController.d.ts index 6a1a21e..e1c08c0 100644 --- a/TypeScript/3GetSptConfigFile/types/controllers/InventoryController.d.ts +++ b/TypeScript/3GetSptConfigFile/types/controllers/InventoryController.d.ts @@ -1,8 +1,8 @@ -import { EventOutputHolder } from "../routers/EventOutputHolder"; import { InventoryHelper } from "../helpers/InventoryHelper"; import { PaymentHelper } from "../helpers/PaymentHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IAddItemRequestData } from "../models/eft/inventory/IAddItemRequestData"; import { IInventoryBindRequestData } from "../models/eft/inventory/IInventoryBindRequestData"; @@ -21,33 +21,46 @@ import { IInventorySwapRequestData } from "../models/eft/inventory/IInventorySwa import { IInventoryTagRequestData } from "../models/eft/inventory/IInventoryTagRequestData"; import { IInventoryToggleRequestData } from "../models/eft/inventory/IInventoryToggleRequestData"; import { IInventoryTransferRequestData } from "../models/eft/inventory/IInventoryTransferRequestData"; +import { IOpenRandomLootContainerRequestData } from "../models/eft/inventory/IOpenRandomLootContainerRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { ILogger } from "../models/spt/utils/ILogger"; +import { EventOutputHolder } from "../routers/EventOutputHolder"; import { DatabaseServer } from "../servers/DatabaseServer"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { HashUtil } from "../utils/HashUtil"; +import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { JsonUtil } from "../utils/JsonUtil"; +import { RandomUtil } from "../utils/RandomUtil"; export declare class InventoryController { protected logger: ILogger; protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; + protected randomUtil: RandomUtil; protected databaseServer: DatabaseServer; protected fenceService: FenceService; protected presetHelper: PresetHelper; protected inventoryHelper: InventoryHelper; protected ragfairOfferService: RagfairOfferService; protected profileHelper: ProfileHelper; + protected weightedRandomHelper: WeightedRandomHelper; protected paymentHelper: PaymentHelper; + protected localisationService: LocalisationService; protected eventOutputHolder: EventOutputHolder; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder); + protected httpResponseUtil: HttpResponseUtil; + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, weightedRandomHelper: WeightedRandomHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); /** * Move Item * change location of item with parentId and slotId * transfers items from one profile to another if fromOwner/toOwner is set in the body. * otherwise, move is contained within the same profile_f. - */ - moveItem(pmcData: IPmcData, body: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; + * @param pmcData Profile + * @param moveRequest Move request data + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ + moveItem(pmcData: IPmcData, moveRequest: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; /** * Remove Item from Profile * Deep tree item deletion, also removes items from insurance list @@ -122,4 +135,12 @@ export declare class InventoryController { createMapMarker(pmcData: IPmcData, body: IInventoryCreateMarkerRequestData, sessionID: string): IItemEventRouterResponse; deleteMapMarker(pmcData: IPmcData, body: IInventoryDeleteMarkerRequestData, sessionID: string): IItemEventRouterResponse; editMapMarker(pmcData: IPmcData, body: IInventoryEditMarkerRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle event fired when a container is unpacked (currently only the halloween pumpkin) + * @param pmcData Profile data + * @param body open loot container request data + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ + openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/3GetSptConfigFile/types/controllers/LocationController.d.ts b/TypeScript/3GetSptConfigFile/types/controllers/LocationController.d.ts index 9db3205..b6feba8 100644 --- a/TypeScript/3GetSptConfigFile/types/controllers/LocationController.d.ts +++ b/TypeScript/3GetSptConfigFile/types/controllers/LocationController.d.ts @@ -7,6 +7,7 @@ import { LootItem } from "../models/spt/services/LootItem"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -15,12 +16,13 @@ export declare class LocationController { protected hashUtil: HashUtil; protected logger: ILogger; protected locationGenerator: LocationGenerator; + protected localisationService: LocalisationService; protected lootGenerator: LootGenerator; protected databaseServer: DatabaseServer; protected timeUtil: TimeUtil; protected configServer: ConfigServer; protected airdropConfig: IAirdropConfig; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, logger: ILogger, locationGenerator: LocationGenerator, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer); + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer); get(location: string): ILocationBase; generate(name: string): ILocationBase; generateAll(): ILocationsGenerateAllResponse; diff --git a/TypeScript/3GetSptConfigFile/types/controllers/MatchController.d.ts b/TypeScript/3GetSptConfigFile/types/controllers/MatchController.d.ts index dac6a3f..2b0d150 100644 --- a/TypeScript/3GetSptConfigFile/types/controllers/MatchController.d.ts +++ b/TypeScript/3GetSptConfigFile/types/controllers/MatchController.d.ts @@ -19,7 +19,6 @@ import { SaveServer } from "../servers/SaveServer"; import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; import { BotLootCacheService } from "../services/BotLootCacheService"; import { MatchLocationService } from "../services/MatchLocationService"; -import { PmcAiService } from "../services/PmcAiService"; import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; export declare class MatchController { protected logger: ILogger; @@ -30,13 +29,12 @@ export declare class MatchController { protected botLootCacheService: BotLootCacheService; protected configServer: ConfigServer; protected profileSnapshotService: ProfileSnapshotService; - protected pmcAiService: PmcAiService; protected botGenerationCacheService: BotGenerationCacheService; 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, pmcAiService: PmcAiService, botGenerationCacheService: BotGenerationCacheService, applicationContext: ApplicationContext); + constructor(logger: ILogger, saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, botGenerationCacheService: BotGenerationCacheService, applicationContext: ApplicationContext); getEnabled(): boolean; getProfile(info: IGetProfileRequestData): IPmcData[]; createGroup(sessionID: string, info: ICreateGroupRequestData): any; diff --git a/TypeScript/3GetSptConfigFile/types/controllers/RagfairController.d.ts b/TypeScript/3GetSptConfigFile/types/controllers/RagfairController.d.ts index 5440458..95702f2 100644 --- a/TypeScript/3GetSptConfigFile/types/controllers/RagfairController.d.ts +++ b/TypeScript/3GetSptConfigFile/types/controllers/RagfairController.d.ts @@ -29,6 +29,7 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { RagfairServer } from "../servers/RagfairServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; import { PaymentService } from "../services/PaymentService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { RagfairPriceService } from "../services/RagfairPriceService"; @@ -62,9 +63,10 @@ export declare class RagfairController { protected ragfairOfferService: RagfairOfferService; protected ragfairRequiredItemsService: RagfairRequiredItemsService; protected ragfairOfferGenerator: RagfairOfferGenerator; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, eventOutputHolder: EventOutputHolder, ragfairServer: RagfairServer, ragfairPriceService: RagfairPriceService, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer, ragfairSellHelper: RagfairSellHelper, ragfairTaxHelper: RagfairTaxHelper, ragfairSortHelper: RagfairSortHelper, ragfairOfferHelper: RagfairOfferHelper, profileHelper: ProfileHelper, paymentService: PaymentService, handbookHelper: HandbookHelper, paymentHelper: PaymentHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, ragfairOfferGenerator: RagfairOfferGenerator, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, eventOutputHolder: EventOutputHolder, ragfairServer: RagfairServer, ragfairPriceService: RagfairPriceService, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer, ragfairSellHelper: RagfairSellHelper, ragfairTaxHelper: RagfairTaxHelper, ragfairSortHelper: RagfairSortHelper, ragfairOfferHelper: RagfairOfferHelper, profileHelper: ProfileHelper, paymentService: PaymentService, handbookHelper: HandbookHelper, paymentHelper: PaymentHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, ragfairOfferGenerator: RagfairOfferGenerator, localisationService: LocalisationService, configServer: ConfigServer); getOffers(sessionID: string, info: ISearchRequestData): IGetOffersResult; /** * Get offers for the client based on type of search being performed @@ -103,7 +105,12 @@ export declare class RagfairController { protected isLinkedSearch(info: ISearchRequestData): boolean; protected isRequiredSearch(info: ISearchRequestData): boolean; update(): void; - getItemPrice(info: IGetMarketPriceRequestData): IGetItemPriceResult; + /** + * Called when creating an offer on flea, fills values in top right corner + * @param getPriceRequest + * @returns min/avg/max values for an item based on flea offers available + */ + getItemMinAvgMaxFleaPriceValues(getPriceRequest: IGetMarketPriceRequestData): IGetItemPriceResult; addPlayerOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; createPlayerOffer(profile: IAkiProfile, requirements: Requirement[], items: Item[], sellInOnePiece: boolean, amountToSend: number): IRagfairOffer; getAllFleaPrices(): Record; diff --git a/TypeScript/3GetSptConfigFile/types/controllers/RepeatableQuestController.d.ts b/TypeScript/3GetSptConfigFile/types/controllers/RepeatableQuestController.d.ts index 7db5886..333583b 100644 --- a/TypeScript/3GetSptConfigFile/types/controllers/RepeatableQuestController.d.ts +++ b/TypeScript/3GetSptConfigFile/types/controllers/RepeatableQuestController.d.ts @@ -17,6 +17,7 @@ import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { ItemFilterService } from "../services/ItemFilterService"; +import { LocalisationService } from "../services/LocalisationService"; import { PaymentService } from "../services/PaymentService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { JsonUtil } from "../utils/JsonUtil"; @@ -64,12 +65,13 @@ export declare class RepeatableQuestController { protected profileFixerService: ProfileFixerService; protected ragfairServerHelper: RagfairServerHelper; protected eventOutputHolder: EventOutputHolder; + protected localisationService: LocalisationService; protected paymentService: PaymentService; protected objectId: ObjectId; protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * This is the method reached by the /client/repeatalbeQuests/activityPeriods endpoint * Returns an array of objects in the format of repeatable quests to the client. diff --git a/TypeScript/3GetSptConfigFile/types/controllers/WeatherController.d.ts b/TypeScript/3GetSptConfigFile/types/controllers/WeatherController.d.ts index ca7f5eb..631a90c 100644 --- a/TypeScript/3GetSptConfigFile/types/controllers/WeatherController.d.ts +++ b/TypeScript/3GetSptConfigFile/types/controllers/WeatherController.d.ts @@ -1,11 +1,18 @@ import { WeatherGenerator } from "../generators/WeatherGenerator"; import { IWeatherData } from "../models/eft/weather/IWeatherData"; import { IWeatherConfig } from "../models/spt/config/IWeatherConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; export declare class WeatherController { protected weatherGenerator: WeatherGenerator; + protected logger: ILogger; protected configServer: ConfigServer; protected weatherConfig: IWeatherConfig; - constructor(weatherGenerator: WeatherGenerator, configServer: ConfigServer); + constructor(weatherGenerator: WeatherGenerator, logger: ILogger, configServer: ConfigServer); generate(): IWeatherData; + /** + * Get the current in-raid time (MUST HAVE PLAYER LOGGED INTO CLIENT TO WORK) + * @returns Date object + */ + getCurrentInRaidTime(): Date; } diff --git a/TypeScript/3GetSptConfigFile/types/generators/BotGenerator.d.ts b/TypeScript/3GetSptConfigFile/types/generators/BotGenerator.d.ts index 2ac51db..a1ac9ed 100644 --- a/TypeScript/3GetSptConfigFile/types/generators/BotGenerator.d.ts +++ b/TypeScript/3GetSptConfigFile/types/generators/BotGenerator.d.ts @@ -1,7 +1,8 @@ +import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; import { GameEventHelper } from "../helpers/GameEventHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; -import { IGenerateBotsRequestData } from "../models/eft/bot/IGenerateBotsRequestData"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { Health as PmcHealth, IBotBase, Skills } from "../models/eft/common/tables/IBotBase"; import { Health, IBotType, Inventory } from "../models/eft/common/tables/IBotType"; import { IBotConfig } from "../models/spt/config/IBotConfig"; @@ -9,7 +10,6 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; -import { PmcAiService } from "../services/PmcAiService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; @@ -29,12 +29,13 @@ export declare class BotGenerator { protected databaseServer: DatabaseServer; protected botInventoryGenerator: BotInventoryGenerator; protected botEquipmentFilterService: BotEquipmentFilterService; + protected weightedRandomHelper: WeightedRandomHelper; protected botHelper: BotHelper; + protected botDifficultyHelper: BotDifficultyHelper; protected gameEventHelper: GameEventHelper; - protected pmcAiService: PmcAiService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botEquipmentFilterService: BotEquipmentFilterService, botHelper: BotHelper, gameEventHelper: GameEventHelper, pmcAiService: PmcAiService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botEquipmentFilterService: BotEquipmentFilterService, weightedRandomHelper: WeightedRandomHelper, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, gameEventHelper: GameEventHelper, configServer: ConfigServer); /** * Generate a player scav bot object * @param role e.g. assault / pmcbot @@ -44,12 +45,18 @@ export declare class BotGenerator { */ generatePlayerScav(sessionId: string, role: string, difficulty: string, botTemplate: IBotType): IBotBase; /** - * Generate an array of bot objects for populate a raid with + * Generate an array of bot objects based on a condition for a raid with * @param sessionId session id - * @param info request object + * @param condition request condition * @returns bot array */ - generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; + generateByCondition(sessionId: string, botCountToGenerate: number, difficulty: string, role: string, isPmc: boolean): IBotBase[]; + /** + * Get the PMCs wildSpawnType value + * @param role "usec" / "bear" + * @returns wildSpawnType value as string + */ + protected getPmcRoleByDescription(role: string): string; /** * Get a randomised PMC side based on bot config value 'isUsec' * @returns pmc side as string @@ -64,13 +71,13 @@ export declare class BotGenerator { * Create a IBotBase object with equipment/loot/exp etc * @param sessionId Session id * @param bot bots base file - * @param role botRole bot will use + * @param botRole Role bot will use (bear/usec for PMCs) * @param node Bot template from db/bots/x.json * @param isPmc Is bot to be a PMC * @param isPlayerScav is bot to be a p scav bot * @returns IBotBase object */ - protected generateBot(sessionId: string, bot: IBotBase, role: string, node: IBotType, isPmc: boolean, isPlayerScav?: boolean): IBotBase; + protected generateBot(sessionId: string, bot: IBotBase, botRole: string, node: IBotType, isPmc: boolean, isPlayerScav?: boolean): IBotBase; /** * Log the number of PMCs generated to the debug console * @param output Generated bot array, ready to send to client diff --git a/TypeScript/3GetSptConfigFile/types/generators/BotInventoryGenerator.d.ts b/TypeScript/3GetSptConfigFile/types/generators/BotInventoryGenerator.d.ts index c5ed545..e1efaf2 100644 --- a/TypeScript/3GetSptConfigFile/types/generators/BotInventoryGenerator.d.ts +++ b/TypeScript/3GetSptConfigFile/types/generators/BotInventoryGenerator.d.ts @@ -7,6 +7,7 @@ import { IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { BotLootGenerator } from "./BotLootGenerator"; @@ -20,14 +21,68 @@ export declare class BotInventoryGenerator { protected botLootGenerator: BotLootGenerator; protected botGeneratorHelper: BotGeneratorHelper; protected weightedRandomHelper: WeightedRandomHelper; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, configServer: ConfigServer); + /** + * Add equipment/weapons/loot to bot + * @param sessionId Session id + * @param templateInventory bot/x.json data from db + * @param equipmentChances Chances each item will be added to bot + * @param itemGenerationLimitsMinMax item gen limits for bot role + * @param botRole Role bot has (assault/pmcBot) + * @param isPmc Is bot being converted into a pmc + * @returns PmcInventory object with equipment/weapons/loot + */ generateInventory(sessionId: string, templateInventory: Inventory, equipmentChances: Chances, itemGenerationLimitsMinMax: Generation, botRole: string, isPmc: boolean): PmcInventory; + /** + * Create a pmcInventory object with all the base/generic items needed + * @returns PmcInventory object + */ + protected generateInventoryBase(): PmcInventory; + /** + * Add equipment to a bot + * @param templateInventory bot/x.json data from db + * @param equipmentChances Chances items will be added to bot + * @param botRole Role bot has (assault/pmcBot) + * @param botInventory Inventory to add equipment to + */ + protected generateAndAddEquipmentToBot(templateInventory: Inventory, equipmentChances: Chances, botRole: string, botInventory: PmcInventory): void; + protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory): void; + /** + * Work out what weapons bot should have equipped and add them to bot inventory + * @param templateInventory bot/x.json data from db + * @param equipmentChances Chances bot can have equipment equipped + * @param sessionId Session id + * @param botInventory Inventory to add weapons to + * @param botRole assault/pmcBot/bossTagilla etc + * @param isPmc Is the bot being generated as a pmc + * @param itemGenerationLimitsMinMax Limits for items the bot can have + */ + protected generateAndAddWeaponsToBot(templateInventory: Inventory, equipmentChances: Chances, sessionId: string, botInventory: PmcInventory, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation): void; + /** + * Calculate if the bot should have weapons in Primary/Secondary/Holster slots + * @param equipmentChances Chances bot has certain equipment + * @returns What slots bot should have weapons generated for + */ + protected getDesiredWeaponsForBot(equipmentChances: Chances): { + slot: EquipmentSlots; + shouldSpawn: boolean; + }[]; + /** + * Add weapon + spare mags/ammo to bots inventory + * @param sessionId Session id + * @param weaponSlot Weapon slot being generated + * @param templateInventory bot/x.json data from db + * @param botInventory Inventory to add weapon+mags/ammo to + * @param equipmentChances Chances bot can have equipment equipped + * @param botRole assault/pmcBot/bossTagilla etc + * @param isPmc Is the bot being generated as a pmc + * @param itemGenerationLimitsMinMax + */ protected addWeaponAndMagazinesToInventory(sessionId: string, weaponSlot: { slot: EquipmentSlots; shouldSpawn: boolean; }, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation): void; - protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory): void; - protected generateInventoryBase(): PmcInventory; } diff --git a/TypeScript/3GetSptConfigFile/types/generators/BotLootGenerator.d.ts b/TypeScript/3GetSptConfigFile/types/generators/BotLootGenerator.d.ts index c1f5310..3352a46 100644 --- a/TypeScript/3GetSptConfigFile/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/3GetSptConfigFile/types/generators/BotLootGenerator.d.ts @@ -10,6 +10,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotLootCacheService } from "../services/BotLootCacheService"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { BotWeaponGenerator } from "./BotWeaponGenerator"; @@ -23,9 +24,10 @@ export declare class BotLootGenerator { protected botWeaponGenerator: BotWeaponGenerator; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected botLootCacheService: BotLootCacheService; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, configServer: ConfigServer); generateLoot(sessionId: string, templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances): void; protected getRandomisedCount(min: number, max: number, nValue: number): number; /** @@ -113,7 +115,7 @@ export declare class BotLootGenerator { * If no limit found for a non pmc bot, fall back to defaults * @param isPmc is the bot we want limits for a pmc * @param botRole what role does the bot have - * @returns dictionary of tplIds and limit + * @returns Dictionary of tplIds and limit */ protected getItemSpawnLimitsForBotType(isPmc: boolean, botRole: string): Record; /** diff --git a/TypeScript/3GetSptConfigFile/types/generators/BotWeaponGenerator.d.ts b/TypeScript/3GetSptConfigFile/types/generators/BotWeaponGenerator.d.ts index 487901b..40284ea 100644 --- a/TypeScript/3GetSptConfigFile/types/generators/BotWeaponGenerator.d.ts +++ b/TypeScript/3GetSptConfigFile/types/generators/BotWeaponGenerator.d.ts @@ -12,6 +12,7 @@ import { IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; @@ -27,10 +28,11 @@ export declare class BotWeaponGenerator { protected randomUtil: RandomUtil; protected configServer: ConfigServer; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected localisationService: LocalisationService; protected inventoryMagGenComponents: IInventoryMagGen[]; protected readonly modMagazineSlotId = "mod_magazine"; protected botConfig: IBotConfig; - constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil, configServer: ConfigServer, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, inventoryMagGenComponents: IInventoryMagGen[]); + constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil, configServer: ConfigServer, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, inventoryMagGenComponents: IInventoryMagGen[]); /** * Pick a random weapon based on weightings and generate a functional weapon * @param equipmentSlot Primary/secondary/holster diff --git a/TypeScript/3GetSptConfigFile/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/3GetSptConfigFile/types/generators/RagfairOfferGenerator.d.ts index b64a7e7..23882d2 100644 --- a/TypeScript/3GetSptConfigFile/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/3GetSptConfigFile/types/generators/RagfairOfferGenerator.d.ts @@ -1,16 +1,19 @@ +import { HandbookHelper } from "../helpers/HandbookHelper"; import { ItemHelper } from "../helpers/ItemHelper"; +import { PaymentHelper } from "../helpers/PaymentHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; import { Item } from "../models/eft/common/tables/IItem"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { IBarterScheme } from "../models/eft/common/tables/ITrader"; -import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; +import { IRagfairOffer, OfferRequirement } from "../models/eft/ragfair/IRagfairOffer"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { RagfairCategoriesService } from "../services/RagfairCategoriesService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { RagfairPriceService } from "../services/RagfairPriceService"; @@ -27,18 +30,31 @@ export declare class RagfairOfferGenerator { protected timeUtil: TimeUtil; protected databaseServer: DatabaseServer; protected ragfairServerHelper: RagfairServerHelper; + protected handbookHelper: HandbookHelper; protected saveServer: SaveServer; protected presetHelper: PresetHelper; protected ragfairAssortGenerator: RagfairAssortGenerator; protected ragfairOfferService: RagfairOfferService; protected ragfairPriceService: RagfairPriceService; + protected localisationService: LocalisationService; + protected paymentHelper: PaymentHelper; protected ragfairCategoriesService: RagfairCategoriesService; protected fenceService: FenceService; protected itemHelper: ItemHelper; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, ragfairServerHelper: RagfairServerHelper, saveServer: SaveServer, presetHelper: PresetHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferService: RagfairOfferService, ragfairPriceService: RagfairPriceService, ragfairCategoriesService: RagfairCategoriesService, fenceService: FenceService, itemHelper: ItemHelper, configServer: ConfigServer); + protected allowedFleaPriceItemsForBarter: { + tpl: string; + price: number; + }[]; + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, ragfairServerHelper: RagfairServerHelper, handbookHelper: HandbookHelper, saveServer: SaveServer, presetHelper: PresetHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferService: RagfairOfferService, ragfairPriceService: RagfairPriceService, localisationService: LocalisationService, paymentHelper: PaymentHelper, ragfairCategoriesService: RagfairCategoriesService, fenceService: FenceService, itemHelper: ItemHelper, configServer: ConfigServer); createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; + /** + * Calculate the offer price that's listed on the flea listing + * @param offerRequirements barter requirements for offer + * @returns rouble cost of offer + */ + protected calculateOfferListingPrice(offerRequirements: OfferRequirement[]): number; /** * Get avatar url from trader table in db * @param isTrader Is user we're getting avatar for a trader @@ -87,20 +103,36 @@ export declare class RagfairOfferGenerator { * @returns Item with conditions added */ protected addMissingCondition(item: Item): Item; - protected getOfferRequirements(items: Item[]): { - count: number; - _tpl: string; + /** + * Create a barter-based barter scheme, if not possible, fall back to making barter scheme currency based + * @param offerItems Items for sale in offer + * @returns barter scheme + */ + protected createBarterRequirement(offerItems: Item[]): IBarterScheme[]; + /** + * Get an array of flea prices + item tpl, cached in generator class + * @returns array with tpl/price values + */ + protected getFleaPricesAsArray(): { + tpl: string; + price: number; }[]; + /** + * Create a random currency-based barter scheme for an array of items + * @param offerItems Items on offer + * @returns Barter scheme for offer + */ + protected createCurrencyRequirement(offerItems: Item[]): IBarterScheme[]; /** * Create a flea offer and store it in the Ragfair server offers array * @param userID owner of the offer * @param time time offer is put up * @param items items in the offer - * @param barterScheme - * @param loyalLevel + * @param barterScheme cost of item (currency or barter) + * @param loyalLevel Loyalty level needed to buy item * @param price price of offer * @param sellInOnePiece - * @returns + * @returns Ragfair offer */ createFleaOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; } diff --git a/TypeScript/3GetSptConfigFile/types/generators/WeatherGenerator.d.ts b/TypeScript/3GetSptConfigFile/types/generators/WeatherGenerator.d.ts index 8ddbe49..65d2c76 100644 --- a/TypeScript/3GetSptConfigFile/types/generators/WeatherGenerator.d.ts +++ b/TypeScript/3GetSptConfigFile/types/generators/WeatherGenerator.d.ts @@ -1,38 +1,54 @@ +import { ApplicationContext } from "../context/ApplicationContext"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; -import { IWeatherData } from "../models/eft/weather/IWeatherData"; +import { IWeather, IWeatherData } from "../models/eft/weather/IWeatherData"; +import { WindDirection } from "../models/enums/WindDirection"; import { IWeatherConfig } from "../models/spt/config/IWeatherConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class WeatherGenerator { protected weightedRandomHelper: WeightedRandomHelper; + protected logger: ILogger; protected randomUtil: RandomUtil; protected timeUtil: TimeUtil; + protected applicationContext: ApplicationContext; protected configServer: ConfigServer; protected weatherConfig: IWeatherConfig; - constructor(weightedRandomHelper: WeightedRandomHelper, randomUtil: RandomUtil, timeUtil: TimeUtil, configServer: ConfigServer); - calculateTime(data: IWeatherData): IWeatherData; + constructor(weightedRandomHelper: WeightedRandomHelper, logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, applicationContext: ApplicationContext, configServer: ConfigServer); + calculateGameTime(data: IWeatherData): IWeatherData; /** * Get server uptime seconds multiplied by a multiplier and add to current time as seconds * Format to BSGs requirements - * @param computedDate current date + * @param currentDate current date * @returns formatted time */ - protected getAcceleratedTime(computedDate: Date): string; + protected getBsgFormattedInRaidTime(currentDate: Date): string; + /** + * Get the current in-raid time + * @param currentDate (new Date()) + * @returns Date object of current in-raid time + */ + getInRaidTime(currentDate: Date): Date; /** * Get current time formatted to fit BSGs requirement - * @param computedDate date to format into bsg style + * @param date date to format into bsg style * @returns */ - protected getNormalTime(computedDate: Date): string; + protected getBSGFormattedTime(date: Date): string; /** - * Return randomised Weather data - * @param weatherData weather input data + * Return randomised Weather data with help of config/weather.json * @returns Randomised weather data */ - generateWeather(weatherData: IWeatherData): IWeatherData; - protected getWeightedFog(): string; + generateWeather(): IWeather; + /** + * Set IWeather date/time/timestamp values to now + * @param weather Object to update + */ + protected setCurrentDateTime(weather: IWeather): void; + protected getWeightedWindDirection(): WindDirection; + protected getWeightedWindSpeed(): number; + protected getWeightedFog(): number; protected getWeightedRain(): number; protected getRandomFloat(node: string): number; - protected getRandomInt(node: string): number; } diff --git a/TypeScript/3GetSptConfigFile/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts b/TypeScript/3GetSptConfigFile/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts index 4fcb1e2..1589707 100644 --- a/TypeScript/3GetSptConfigFile/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts +++ b/TypeScript/3GetSptConfigFile/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts @@ -1,13 +1,15 @@ import { BotWeaponGeneratorHelper } from "../../../helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "../../../helpers/ItemHelper"; import { ILogger } from "../../../models/spt/utils/ILogger"; +import { LocalisationService } from "../../../services/LocalisationService"; import { IInventoryMagGen } from "../IInventoryMagGen"; import { InventoryMagGen } from "../InventoryMagGen"; export declare class ExternalInventoryMagGen implements IInventoryMagGen { protected logger: ILogger; protected itemHelper: ItemHelper; + protected localisationService: LocalisationService; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; - constructor(logger: ILogger, itemHelper: ItemHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper); + constructor(logger: ILogger, itemHelper: ItemHelper, localisationService: LocalisationService, botWeaponGeneratorHelper: BotWeaponGeneratorHelper); getPriority(): number; canHandleInventoryMagGen(inventoryMagGen: InventoryMagGen): boolean; process(inventoryMagGen: InventoryMagGen): void; diff --git a/TypeScript/3GetSptConfigFile/types/helpers/BotDifficultyHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/BotDifficultyHelper.d.ts new file mode 100644 index 0000000..a58ebdb --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/helpers/BotDifficultyHelper.d.ts @@ -0,0 +1,46 @@ +import { Difficulty } from "../models/eft/common/tables/IBotType"; +import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; +import { JsonUtil } from "../utils/JsonUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +import { BotHelper } from "./BotHelper"; +export declare class BotDifficultyHelper { + protected logger: ILogger; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected randomUtil: RandomUtil; + protected localisationService: LocalisationService; + protected botHelper: BotHelper; + protected configServer: ConfigServer; + protected botConfig: IBotConfig; + constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, localisationService: LocalisationService, botHelper: BotHelper, configServer: ConfigServer); + getPmcDifficultySettings(pmcType: "bear" | "usec", difficulty: string, usecType: string, bearType: string): Difficulty; + /** + * Get difficulty settings for desired bot type, if not found use assault bot types + * @param type bot type to retreive difficulty of + * @param difficulty difficulty to get settings for (easy/normal etc) + * @returns Difficulty object + */ + getBotDifficultySettings(type: string, difficulty: string): Difficulty; + /** + * Get difficulty settings for a PMC + * @param type "usec" / "bear" + * @param difficulty what difficulty to retrieve + * @returns Difficulty object + */ + protected getDifficultySettings(type: string, difficulty: string): Difficulty; + /** + * Translate chosen value from pre-raid difficulty dropdown into bot difficulty value + * @param dropDownDifficulty Dropdown difficulty value to convert + * @returns bot difficulty + */ + convertBotDifficultyDropdownToBotDifficulty(dropDownDifficulty: string): string; + /** + * Choose a random difficulty from - easy/normal/hard/impossible + * @returns random difficulty + */ + chooseRandomDifficulty(): string; +} diff --git a/TypeScript/3GetSptConfigFile/types/helpers/BotGeneratorHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/BotGeneratorHelper.d.ts index 5e3e501..899669e 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/BotGeneratorHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/BotGeneratorHelper.d.ts @@ -8,6 +8,7 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; import { ItemFilterService } from "../services/ItemFilterService"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; @@ -43,9 +44,10 @@ export declare class BotGeneratorHelper { protected itemFilterService: ItemFilterService; protected profileHelper: ProfileHelper; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Check mods are compatible and add to array * @param equipment Equipment item to add mods to @@ -53,9 +55,11 @@ export declare class BotGeneratorHelper { * @param parentId parentid of item to add mod to * @param parentTemplate template objet of item to add mods to * @param modSpawnChances dictionary of mod items and their chance to spawn for this bot type + * @param botRole the bot role being generated for + * @param forceSpawn should this mod be forced to spawn * @returns Item + compatible mods as an array */ - generateModsForEquipment(equipment: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances): Item[]; + generateModsForEquipment(equipment: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances, botRole: string, forceSpawn?: boolean): Item[]; /** * @param sessionId session id * @param weapon Weapon to add mods to @@ -70,15 +74,15 @@ export declare class BotGeneratorHelper { generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponParentId: string, parentWeaponTemplate: ITemplateItem, modSpawnChances: ModsChances, ammoTpl: string, botRole: string): Item[]; /** * - * @param modSlot - * @param isRandomisableSlot - * @param modsParent - * @param botEquipBlacklist - * @param itemModPool + * @param modSlot Slot mod will fit into + * @param isRandomisableSlot Will generate a randomised mod pool if true + * @param modsParent Parent slot the item will be a part of + * @param botEquipBlacklist Blacklist to prevent mods from being picked + * @param itemModPool Pool of items to pick from * @param weapon array with only weapon tpl in it, ready for mods to be added * @param ammoTpl ammo tpl to use if slot requires a cartridge to be added (e.g. mod_magazine) - * @param parentTemplate - * @returns + * @param parentTemplate Parent item the mod will go into + * @returns ITemplateItem */ protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, modsParent: Slot, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem): [boolean, ITemplateItem]; /** @@ -114,8 +118,10 @@ export declare class BotGeneratorHelper { * Find all compatible mods for equipment item and add to modPool * @param itemDetails item to find mods for * @param modPool ModPool to add mods to + * @param equipmentBlacklist equipment not allowed to be used by the bot + * @param botEquipmentRole bot type to generate pool for (e.g. assault, pmcBot, pmc for usec/bear) */ - generateDynamicModPool(itemDetails: ITemplateItem, modPool: Mods): void; + generateDynamicModPool(itemDetails: ITemplateItem, modPool: Mods, equipmentBlacklist: EquipmentFilterDetails[], botEquipmentRole: string): void; /** * Take a list of tpls and filter out blacklisted values using itemFilterService + botEquipmentBlacklist * @param allowedMods base mods to filter @@ -153,7 +159,7 @@ export declare class BotGeneratorHelper { * @param modTemplate Used to add additional properites in the upd object * @returns Item object */ - protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem): Item; + protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem, botRole: string): Item; /** * randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot * never return true for an item that has 0% spawn chance @@ -170,10 +176,10 @@ export declare class BotGeneratorHelper { */ protected getAmmoContainers(): string[]; /** - * Get the slot details for an item (chamber/cartridge/slot) + * Get a Slot property for an item (chamber/cartridge/slot) * @param modSlot e.g patron_in_weapon * @param parentTemplate item template - * @returns + * @returns Slot item */ protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; /** @@ -185,7 +191,6 @@ export declare class BotGeneratorHelper { * @param modPool modPool which should include available cartrigdes * @param parentId The CylinderMagazine's UID * @param parentTemplate The CylinderMagazine's template - * @returns */ protected fillCamora(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem): void; /** @@ -197,11 +202,11 @@ export declare class BotGeneratorHelper { /** * Adds properties to an item * e.g. Repairable / HasHinge / Foldable / MaxDurability - * @param itemTemplate - * @param botRole Used by weapons to randomise the durability values + * @param itemTemplate Item extra properties are being generated for + * @param botRole Used by weapons to randomise the durability values. Null for non-equipped items * @returns Item Upd object with extra properties */ - generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: any): { + generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: string): { upd?: Upd; }; /** @@ -220,21 +225,27 @@ export declare class BotGeneratorHelper { protected generateArmorRepairableProperties(itemTemplate: ITemplateItem, botRole: string): Repairable; /** * Get a random mod from an items compatible mods Filter array - * @param modTpl - * @param parentSlot - * @param modSlot - * @param items + * @param modTpl ???? + * @param parentSlot item mod will go into, used to get combatible items + * @param modSlot Slot to get mod to fill + * @param items items to ensure picked mod is compatible with * @returns item tpl */ protected getModTplFromItemDb(modTpl: string, parentSlot: Slot, modSlot: string, items: Item[]): string; /** * Can an item be added to an item without issue - * @param items - * @param tplToCheck - * @param equipmentSlot - * @returns true if possible + * @param items items to check compatiblilities with + * @param tplToCheck tpl of the item to check for incompatibilities + * @param equipmentSlot Slot the item will be placed into + * @returns false if no incompatibilties */ isItemIncompatibleWithCurrentItems(items: Item[], tplToCheck: string, equipmentSlot: string): boolean; + /** + * Convert a bots role to the equipment role used in config/bot.json + * @param botRole Role to convert + * @returns Equipment role (e.g. pmc / assault / bossTagilla) + */ + getBotEquipmentRole(botRole: string): string; } /** TODO - move into own class */ export declare class ExhaustableArray { diff --git a/TypeScript/3GetSptConfigFile/types/helpers/BotHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/BotHelper.d.ts index 67a6384..a7f779e 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/BotHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/BotHelper.d.ts @@ -3,6 +3,7 @@ import { IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; export declare class BotHelper { @@ -10,46 +11,27 @@ export declare class BotHelper { protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, configServer: ConfigServer); - /** - * Get difficulty settings for desired bot type, if not found use assault bot types - * @param type bot type to retreive difficulty of - * @param difficulty difficulty to get settings for (easy/normal etc) - * @returns Difficulty object - */ - getBotDifficultySettings(type: string, difficulty: string): Difficulty; + constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, localisationService: LocalisationService, configServer: ConfigServer); /** * Get a template object for the specified botRole from bots.types db * @param role botRole to get template for * @returns IBotType object */ getBotTemplate(role: string): IBotType; - /** - * Get difficulty settings for a PMC - * @param type "usec" / "bear" - * @param difficulty what difficulty to retrieve - * @returns Difficulty object - */ - getPmcDifficultySettings(type: string, difficulty: string): Difficulty; - /** - * Translate chosen value from pre-raid difficulty dropdown into bot difficulty value - * @param dropDownDifficulty Dropdown difficulty value to convert - * @returns bot difficulty - */ - convertBotDifficultyDropdownToBotDifficulty(dropDownDifficulty: string): string; - /** - * Choose a random difficulty from - easy/normal/hard/impossible - * @returns random difficulty - */ - chooseRandomDifficulty(): string; /** * Randomise the chance the PMC will attack their own side * Look up value in bot.json/chanceSameSideIsHostilePercent * @param difficultySettings pmc difficulty settings */ randomisePmcHostility(difficultySettings: Difficulty): void; + /** + * Is the passed in bot role a PMC (usec/bear/pmc) + * @param botRole bot role to check + * @returns true if is pmc + */ isBotPmc(botRole: string): boolean; isBotBoss(botRole: string): boolean; isBotFollower(botRole: string): boolean; diff --git a/TypeScript/3GetSptConfigFile/types/helpers/GameEventHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/GameEventHelper.d.ts index fca87be..fa25eff 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/GameEventHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/GameEventHelper.d.ts @@ -15,4 +15,15 @@ export declare class GameEventHelper { * @returns Record with event name + start/end date */ getEventDetails(): ISeasonalEvent[]; + /** + * Is detection of seasonal events enabled (halloween / christmas) + * @returns true if seasonal events should be checked for + */ + isAutomaticEventDetectionEnabled(): boolean; + /** + * Get a dictionary of gear changes to apply to bots for a specific event e.g. Christmas/Halloween + * @param eventName Name of event to get gear changes for + * @returns bots with equipment changes + */ + getEventBotGear(eventName: string): Record>>; } diff --git a/TypeScript/3GetSptConfigFile/types/helpers/HideoutHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/HideoutHelper.d.ts index 5f7e3b7..9d51fed 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/HideoutHelper.d.ts @@ -11,6 +11,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { PlayerService } from "../services/PlayerService"; import { HashUtil } from "../utils/HashUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; @@ -29,13 +30,14 @@ export declare class HideoutHelper { protected profileHelper: ProfileHelper; protected inventoryHelper: InventoryHelper; protected playerService: PlayerService; + protected localisationService: LocalisationService; protected configServer: ConfigServer; static bitcoinFarm: string; static waterCollector: string; static bitcoin: string; static expeditionaryFuelTank: string; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, localisationService: LocalisationService, configServer: ConfigServer); registerProduction(pmcData: IPmcData, body: IHideoutSingleProductionStartRequestData | IHideoutContinousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; /** * This convinience function intialies new Production Object diff --git a/TypeScript/3GetSptConfigFile/types/helpers/InventoryHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/InventoryHelper.d.ts index b8e5c9d..6419f93 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/InventoryHelper.d.ts @@ -5,11 +5,12 @@ import { IInventoryMergeRequestData } from "../models/eft/inventory/IInventoryMe import { IInventoryMoveRequestData } from "../models/eft/inventory/IInventoryMoveRequestData"; import { IInventorySplitRequestData } from "../models/eft/inventory/IInventorySplitRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { IInventoryConfig } from "../models/spt/config/IInventoryConfig"; +import { IInventoryConfig, RewardDetails } from "../models/spt/config/IInventoryConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { JsonUtil } from "../utils/JsonUtil"; @@ -38,9 +39,10 @@ export declare class InventoryHelper { protected itemHelper: ItemHelper; protected containerHelper: ContainerHelper; protected profileHelper: ProfileHelper; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected inventoryConfig: IInventoryConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); addItem(pmcData: IPmcData, body: IAddItemRequestData, output: IItemEventRouterResponse, sessionID: string, callback: any, foundInRaid?: boolean, addUpd?: any): IItemEventRouterResponse; removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; removeItemByCount(pmcData: IPmcData, itemId: string, count: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; @@ -76,6 +78,12 @@ export declare class InventoryHelper { * Internal helper function to handle cartridges in inventory if any of them exist. */ protected handleCartridges(items: Item[], body: IInventoryMoveRequestData): void; + /** + * Get details for how a random loot container should be handled, max rewards, possible reward tpls + * @param itemTpl Container being opened + * @returns Reward details + */ + getRandomLootContainerRewardDetails(itemTpl: string): RewardDetails; } declare namespace InventoryHelper { interface InventoryItemHash { diff --git a/TypeScript/3GetSptConfigFile/types/helpers/ItemHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/ItemHelper.d.ts index 0effaf2..fc88a46 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/ItemHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/ItemHelper.d.ts @@ -5,6 +5,7 @@ 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 { LocaleService } from "../services/LocaleService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; @@ -18,7 +19,8 @@ declare class ItemHelper { protected objectId: ObjectId; protected mathUtil: MathUtil; protected databaseServer: DatabaseServer; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer); + protected localeService: LocaleService; + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, localeService: LocaleService); /** * Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash * @param {string} tpl the template id / tpl @@ -212,6 +214,12 @@ declare class ItemHelper { * @returns size of stack */ getItemStackSize(item: Item): number; + /** + * Get the name of an item from the locale file using the item tpl + * @param itemTpl Tpl of item to get name of + * @returns Name of item + */ + getItemName(itemTpl: string): string; } declare namespace ItemHelper { interface ItemSize { diff --git a/TypeScript/3GetSptConfigFile/types/helpers/QuestHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/QuestHelper.d.ts index a6b4892..edbd2e1 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/QuestHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/QuestHelper.d.ts @@ -50,6 +50,12 @@ export declare class QuestHelper { * @returns true if player level is greater than or equal to quest */ doesPlayerLevelFulfilCondition(playerLevel: number, condition: AvailableForConditions): boolean; + /** + * Get the quests found in both arrays (inner join) + * @param before Array of qeusts #1 + * @param after Array of quests #2 + * @returns Reduction of cartesian product between two quest arrays + */ getDeltaQuests(before: IQuest[], after: IQuest[]): IQuest[]; /** * Increase skill points of a skill on player profile @@ -66,38 +72,85 @@ export declare class QuestHelper { * quest list in question. */ dumpQuests(quests: any): void; - loyaltyRequirementCheck(loyaltyRequirementProperties: AvailableForProps, profile: IPmcData): boolean; - protected processReward(reward: Reward): any[]; + /** + * Check if trader has sufficient loyalty to fullfill quest requirement + * @param questProperties Quest props + * @param profile Player profile + * @returns true if loyalty is high enough to fulfil quest requirement + */ + traderStandingRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; + protected processReward(reward: Reward): Reward[]; + /** + * Gets a flat list of reward items for the given quest at a specific state (e.g. Fail/Success) + * @param quest quest to get rewards for + * @param state Quest status that holds the items (Started, Success, Fail) + * @returns array of items with the correct maxStack + */ getQuestRewardItems(quest: IQuest, state: QuestStatus): Reward[]; /** - * Add quest with new state value to pmc profile + * Update player profile with quest status (e.g. Fail/Success) * @param pmcData profile to add quest to * @param newState state the new quest should be in when added * @param acceptedQuest Details of quest being added */ addQuestToPMCData(pmcData: IPmcData, newState: QuestStatus, acceptedQuest: IAcceptQuestRequestData): void; - acceptedUnlocked(acceptedQuestId: string, sessionID: string): IQuest[]; - failedUnlocked(failedQuestId: string, sessionID: string): IQuest[]; - applyMoneyBoost(quest: IQuest, moneyBoost: number): IQuest; - changeItemStack(pmcData: IPmcData, id: string, value: number, sessionID: string, output: any): void; /** - * Get List of All Quests as an array + * TODO: what is going on here + * @param acceptedQuestId Quest to add to profile + * @param sessionID Session id + * @returns Array of quests in profile + quest passed in as param + */ + acceptedUnlocked(acceptedQuestId: string, sessionID: string): IQuest[]; + /** + * TODO: what is going on here + * @param failedQuestId + * @param sessionID Session id + * @returns + */ + failedUnlocked(failedQuestId: string, sessionID: string): IQuest[]; + /** + * Adjust quest money rewards by passed in multipler + * @param quest Quest to multiple money rewards + * @param multipler Value to adjust money rewards by + * @returns Updated quest + */ + applyMoneyBoost(quest: IQuest, multipler: number): IQuest; + /** + * Sets the item stack to new value, or delete the item if value <= 0 + * // TODO maybe merge this function and the one from customization + * @param pmcData Profile + * @param itemId id of item to adjust stack size of + * @param newStackSize Stack size to adjust to + * @param sessionID Session id + * @param output ItemEvent router response + */ + changeItemStack(pmcData: IPmcData, itemId: string, newStackSize: number, sessionID: string, output: IItemEventRouterResponse): void; + /** + * Get List of All Quests from db + * NOT CLONED * @returns Array of IQuest objects */ - questValues(): IQuest[]; + getQuestsFromDb(): IQuest[]; /** - * Reest AvailableForStart conditions for quests - * @param quests queststo clean + * Get quests, strip all requirement conditions except level + * @param quests quests to process * @returns quest array without conditions */ - protected cleanQuestList(quests: IQuest[]): IQuest[]; + protected getQuestsWithOnlyLevelRequirementStartCondition(quests: IQuest[]): IQuest[]; /** - * Reset AvailableForStart conditions on a quest + * Remove all quest conditions except for level requirement * @param quest quest to clean * @returns reset IQuest object */ - cleanQuestConditions(quest: IQuest): IQuest; - failQuest(pmcData: IPmcData, body: any, sessionID: string): any; + getQuestWithOnlyLevelRequirementStartCondition(quest: IQuest): IQuest; + /** + * Fail a quest in a player profile + * @param pmcData Profile + * @param failRequest fail quest request data + * @param sessionID Session id + * @returns Item event router response + */ + failQuest(pmcData: IPmcData, failRequest: any, sessionID: string): IItemEventRouterResponse; /** * Get quest by id from database * @param questId questid to look for @@ -105,7 +158,12 @@ export declare class QuestHelper { * @returns IQuest object */ getQuestFromDb(questId: string, pmcData: IPmcData): IQuest; - getQuestLocaleIdFromDb(messageId: string): string; + /** + * Get the locale Id from locale db for a quest message + * @param questMessageId Quest mesage id to look up + * @returns Locale Id from locale db + */ + getQuestLocaleIdFromDb(questMessageId: string): string; /** * Alter a quests state + Add a record to tis status timers object * @param pmcData Profile to update @@ -128,5 +186,10 @@ export declare class QuestHelper { * @returns bonus in percent */ protected getIntelCenterRewardBonus(pmcData: IPmcData): number; - getFindItemIdForQuestItem(itemTpl: string): string; + /** + * Find quest with 'findItem' requirement that needs the item tpl be handed in + * @param itemTpl item tpl to look for + * @returns 'FindItem' condition id + */ + getFindItemIdForQuestHandIn(itemTpl: string): string; } diff --git a/TypeScript/3GetSptConfigFile/types/helpers/RagfairServerHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/RagfairServerHelper.d.ts index a03cdda..ec388d8 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/RagfairServerHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/RagfairServerHelper.d.ts @@ -44,10 +44,20 @@ export declare class RagfairServerHelper { isPlayer(userID: string): boolean; returnItems(sessionID: string, items: any[]): void; calculateDynamicStackCount(tplId: string, isWeaponPreset: boolean): number; + /** + * Choose a currency at random with bias + * @returns currency tpl + */ getDynamicOfferCurrency(): string; getMemberType(userID: string): MemberCategory; getNickname(userID: string): string; getPresetItems(item: any): Item[]; getPresetItemsByTpl(item: Item): Item[]; + /** + * Generate new unique ids for the children while preserving hierarchy + * @param item base item + * @param preset + * @returns Item array with new IDs + */ reparentPresets(item: Item, preset: Item[]): Item[]; } diff --git a/TypeScript/3GetSptConfigFile/types/helpers/RagfairSortHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/RagfairSortHelper.d.ts index 28d1d38..4669ce6 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/RagfairSortHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/RagfairSortHelper.d.ts @@ -18,7 +18,7 @@ export declare class RagfairSortHelper { protected sortOffersByRating(a: IRagfairOffer, b: IRagfairOffer): number; protected sortOffersByName(a: IRagfairOffer, b: IRagfairOffer): number; /** - * Order two offers by price value + * Order two offers by rouble price value * @param a Offer a * @param b Offer b * @returns diff --git a/TypeScript/3GetSptConfigFile/types/loaders/PreAkiModLoader.d.ts b/TypeScript/3GetSptConfigFile/types/loaders/PreAkiModLoader.d.ts index 7a687a5..f486a28 100644 --- a/TypeScript/3GetSptConfigFile/types/loaders/PreAkiModLoader.d.ts +++ b/TypeScript/3GetSptConfigFile/types/loaders/PreAkiModLoader.d.ts @@ -1,29 +1,31 @@ import { DependencyContainer } from "tsyringe"; +import { IPostAkiLoadMod } from "../models/external/IPostAkiLoadMod"; +import { IPostDBLoadMod } from "../models/external/IPostDBLoadMod"; +import { IPreAkiLoadMod } from "../models/external/IPreAkiLoadMod"; import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { ModLoader } from "../models/spt/mod/IMod"; import { IModLoader } from "../models/spt/mod/IModLoader"; import { IPackageJsonData } from "../models/spt/mod/IPackageJsonData"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { LocalisationService } from "../services/LocalisationService"; import { ModCompilerService } from "../services/ModCompilerService"; import { JsonUtil } from "../utils/JsonUtil"; import { VFS } from "../utils/VFS"; import { BundleLoader } from "./BundleLoader"; -import { IPostAkiLoadMod } from "../models/external/IPostAkiLoadMod"; -import { IPreAkiLoadMod } from "../models/external/IPreAkiLoadMod"; -import { IPostDBLoadMod } from "../models/external/IPostDBLoadMod"; export declare class PreAkiModLoader implements IModLoader { protected logger: ILogger; protected vfs: VFS; protected jsonUtil: JsonUtil; protected modCompilerService: ModCompilerService; protected bundleLoader: BundleLoader; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected static container: DependencyContainer; protected readonly basepath = "user/mods/"; protected imported: Record; protected akiConfig: ICoreConfig; - constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, modCompilerService: ModCompilerService, bundleLoader: BundleLoader, configServer: ConfigServer); + constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, modCompilerService: ModCompilerService, bundleLoader: BundleLoader, localisationService: LocalisationService, configServer: ConfigServer); load(container: DependencyContainer): Promise; getBundles(local: boolean): string; getBundle(key: string, local: boolean): void; diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/bot/IGenerateBotsRequestData.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/bot/IGenerateBotsRequestData.d.ts index c49cef7..f1f7013 100644 --- a/TypeScript/3GetSptConfigFile/types/models/eft/bot/IGenerateBotsRequestData.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/eft/bot/IGenerateBotsRequestData.d.ts @@ -2,6 +2,7 @@ export interface IGenerateBotsRequestData { conditions: Condition[]; } export interface Condition { + /** e.g. assault/pmcBot/bossKilla */ Role: string; Limit: number; Difficulty: string; diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/common/IGlobals.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/common/IGlobals.d.ts index 81e2023..b53f106 100644 --- a/TypeScript/3GetSptConfigFile/types/models/eft/common/IGlobals.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/eft/common/IGlobals.d.ts @@ -591,6 +591,7 @@ export interface HealPrice { export interface ProfileHealthSettings { BodyPartsSettings: BodyPartsSettings; HealthFactorsSettings: HealthFactorsSettings; + DefaultStimulatorBuff: string; } export interface BodyPartsSettings { Head: BodyPartsSetting; diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/IBotBase.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/IBotBase.d.ts index 1c28ae0..2b418c1 100644 --- a/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/IBotBase.d.ts @@ -107,6 +107,7 @@ export interface CurrentMax { Maximum: number; } export interface Inventory { + discardLimits: Record; items: Item[]; equipment: string; stash: string; diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/IBotType.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/IBotType.d.ts index c1fe579..55b4bd9 100644 --- a/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/IBotType.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/IBotType.d.ts @@ -13,8 +13,8 @@ export interface IBotType { skills: Skills; } export interface Appearance { - body: string[]; - feet: string[]; + body: Record; + feet: Record; hands: string[]; head: string[]; voice: string[]; diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/ITemplateItem.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/ITemplateItem.d.ts index 8569e61..0fa7e18 100644 --- a/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/eft/common/tables/ITemplateItem.d.ts @@ -254,7 +254,7 @@ export interface Props { foodUseTime?: number; foodEffectType?: string; StimulatorBuffs?: string; - effects_health?: any; + effects_health?: IHealthEffect[] | Record>; effects_damage?: any; MaximumNumberOfUsage?: number; knifeHitDelay?: number; @@ -366,6 +366,10 @@ export interface Props { MinTimeToContactExplode?: number; ExplosionEffectType?: string; } +export interface IHealthEffect { + type: string; + value: number; +} export interface Prefab { path: string; rcid: string; diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/customization/IGetSuitsResponse.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/customization/IGetSuitsResponse.d.ts new file mode 100644 index 0000000..fe6888c --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/models/eft/customization/IGetSuitsResponse.d.ts @@ -0,0 +1,4 @@ +export interface IGetSuitsResponse { + _id: string; + suits: string[]; +} diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/game/IGameKeepAliveResponse.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/game/IGameKeepAliveResponse.d.ts new file mode 100644 index 0000000..170ce6a --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/models/eft/game/IGameKeepAliveResponse.d.ts @@ -0,0 +1,4 @@ +export interface IGameKeepAliveResponse { + msg: string; + utc_time: number; +} diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/game/IGameLogoutResponseData.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/game/IGameLogoutResponseData.d.ts new file mode 100644 index 0000000..0f52050 --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/models/eft/game/IGameLogoutResponseData.d.ts @@ -0,0 +1,3 @@ +export interface IGameLogoutResponseData { + status: string; +} diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/game/IGameStartResponse.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/game/IGameStartResponse.d.ts new file mode 100644 index 0000000..9f0ab6d --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/models/eft/game/IGameStartResponse.d.ts @@ -0,0 +1,3 @@ +export interface IGameStartResponse { + utc_time: number; +} diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts new file mode 100644 index 0000000..3c45124 --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts @@ -0,0 +1,11 @@ +import { IInventoryBaseActionRequestData } from "./IInventoryBaseActionRequestData"; +export interface IOpenRandomLootContainerRequestData extends IInventoryBaseActionRequestData { + Action: "OpenRandomLootContainer"; + /** Container item opened */ + item: string; + to: To[]; +} +export interface To { + /** Player character (pmc/scav) id items will be sent to */ + id: string; +} diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/itemEvent/IItemEventRouterBase.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/itemEvent/IItemEventRouterBase.d.ts index 4841cfd..60ab284 100644 --- a/TypeScript/3GetSptConfigFile/types/models/eft/itemEvent/IItemEventRouterBase.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/eft/itemEvent/IItemEventRouterBase.d.ts @@ -10,8 +10,9 @@ export interface IItemEventRouterBase { export declare type TProfileChanges = Record; export interface Warning { index: number; - err: string; errmsg: string; + code?: string; + data?: any; } export interface ProfileChange { _id: string; diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/match/IStartOffineRaidRequestData.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/match/IStartOffineRaidRequestData.d.ts index af0625e..1983728 100644 --- a/TypeScript/3GetSptConfigFile/types/models/eft/match/IStartOffineRaidRequestData.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/eft/match/IStartOffineRaidRequestData.d.ts @@ -2,8 +2,10 @@ import { BotAmount } from "../../enums/BotAmount"; import { BotDifficulty } from "../../enums/BotDifficulty"; export interface IStartOfflineRaidRequestData { locationName: string; + /** Current time, not in-game time */ startTime: number; - dateTime: string; + /** CURR = am, past = pm */ + dateTime: "CURR" | "PAST"; gameSettings: GameSettings; } export interface GameSettings { diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/notifier/ISelectProfileResponse.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/notifier/ISelectProfileResponse.d.ts new file mode 100644 index 0000000..ecb668a --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/models/eft/notifier/ISelectProfileResponse.d.ts @@ -0,0 +1,6 @@ +import { INotifierChannel } from "./INotifier"; +export interface ISelectProfileResponse { + status: string; + notifier: INotifierChannel; + notifierServer: string; +} diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/ragfair/IRagfairOffer.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/ragfair/IRagfairOffer.d.ts index 3251a37..792ec7d 100644 --- a/TypeScript/3GetSptConfigFile/types/models/eft/ragfair/IRagfairOffer.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/eft/ragfair/IRagfairOffer.d.ts @@ -7,19 +7,19 @@ export interface IRagfairOffer { requirements: OfferRequirement[]; root: string; intId: number; + /** Handbook price */ itemsCost: number; + /** Rouble price */ requirementsCost: number; - sptRequirementsCostRouble: number; startTime: number; endTime: number; sellInOnePiece: boolean; - name?: string; - shortName?: string; loyaltyLevel: number; buyRestrictionMax?: number; buyRestrictionCurrent?: number; locked: boolean; unlimitedCount: boolean; + /** Rouble price */ summaryCost: number; user: IRagfairOfferUser; notAvailable: boolean; @@ -33,11 +33,11 @@ export interface OfferRequirement { } export interface IRagfairOfferUser { id: string; - nickname: string; - rating: number; + nickname?: string; + rating?: number; memberType: MemberCategory; - avatar: string; - isRatingGrowing: boolean; + avatar?: string; + isRatingGrowing?: boolean; } export interface SellResult { sellTime: number; diff --git a/TypeScript/3GetSptConfigFile/types/models/eft/weather/IWeatherData.d.ts b/TypeScript/3GetSptConfigFile/types/models/eft/weather/IWeatherData.d.ts index ecc96ce..1f5d5b5 100644 --- a/TypeScript/3GetSptConfigFile/types/models/eft/weather/IWeatherData.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/eft/weather/IWeatherData.d.ts @@ -1,17 +1,18 @@ +import { WindDirection } from "../../../models/enums/WindDirection"; export interface IWeatherData { acceleration: number; time: string; date: string; - weather: IWeather; + weather?: IWeather; } export interface IWeather { pressure: number; temp: number; - fog: string; + fog: number; rain_intensity: number; - rain: any; + rain: number; wind_gustiness: number; - wind_direction: any; + wind_direction: WindDirection; wind_speed: number; cloud: number; time: string; diff --git a/TypeScript/3GetSptConfigFile/types/models/enums/BackendErrorCodes.d.ts b/TypeScript/3GetSptConfigFile/types/models/enums/BackendErrorCodes.d.ts new file mode 100644 index 0000000..6614b75 --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/models/enums/BackendErrorCodes.d.ts @@ -0,0 +1,67 @@ +export declare enum BackendErrorCodes { + NONE = 0, + UNKNOWN_ERROR = 200, + NOT_AUTHORIZED = 201, + NEED_AUTHORIZATION_CODE = 209, + WRONG_AUTHORIZATION_CODE = 211, + NEED_CAPTCHA = 214, + NO_NEED_CAPTCHA = 215, + CAPTCHA_FAILED = 218, + CAPTCHA_BRUTE_FORCED = 219, + NO_ROOM_IN_STASH = 223, + NICKNAME_NOT_UNIQUE = 225, + NICKNAME_NOT_VALID = 226, + UNSUPPORTED_CLIENT_VERSION = 232, + REPORT_NOT_ALLOWED = 238, + NICKNAME_IS_ABUSIVE = 241, + NICKNAME_CHANGE_TIMEOUT = 242, + NOT_MODIFIED = 304, + HTTP_BAD_REQUEST = 400, + HTTP_NOT_AUTHORIZED = 401, + HTTP_FORBIDDEN = 403, + HTTP_NOT_FOUND = 404, + HTTP_METHOD_NOT_ALLOWED = 405, + UNKNOWN_TRADING_ERROR = 500, + HTTPNOTIMPLEMENTED = 501, + HTTPBADGATEWAY = 502, + HTTPSERVICEUNAVAILABLE = 503, + HTTPGATEWAYTIMEOUT = 504, + TRADEROUTOFMONEY = 505, + HTTPVARIANTALSONEGOTIATES = 506, + PRICECHANGED = 509, + TRADERDISABLED = 512, + ITEMHASBEENSOLD = 513, + NOTENOUGHSPACEFORMONEY = 518, + HTTPINVALIDSSLCERTIFICATE = 526, + UNKNOWNRAGFAIRERROR = 550, + UNKNOWNRAGFAIRERROR2 = 551, + UNKNOWNMATCHMAKERERROR = 600, + SESSIONPARAMETERSERROR = 601, + SESSIONLOST = 602, + SERVERNOTREGISTERED = 604, + UNKNOWNQUESTERROR = 700, + QUESTBADPARAM = 702, + QUESTNOTFOUND = 703, + QUESTISUNAVAILABLE = 704, + NOFREESPACEFORREWARDS = 705, + WRONGQUESTSTATUS = 706, + CANTCOMPLETEQUEST = 707, + UNKNOWNMAILERROR = 900, + TOOMANYFRIENDREQUESTS = 925, + UNKNOWNSCRIPTEXECUTIONERROR = 1000, + UNKNOWNREPAIRINGERROR = 1200, + UNKNOWNINSURANCEERROR = 1300, + UNKNOWNCURRENCYEXCHANGEERROR = 1400, + OFFERNOTFOUND = 1503, + NOTENOUGHSPACE = 1505, + OFFEROUTOFSTOCK = 1506, + OFFERSOLD = 1507, + RAGFAIRUNAVAILABLE = 1511, + BANNEDERRORCODE = 1513, + INSUFFICIENTNUMBERINSTOCK = 1516, + TOOMANYITEMSTOSELL = 1517, + EXAMINATIONFAILED = 22001, + ITEMALREADYEXAMINED = 22002, + UNKNOWNNGINXERROR = 9000, + PARSERESPONSEERROR = 9001 +} diff --git a/TypeScript/3GetSptConfigFile/types/models/enums/HideoutEventActions.d.ts b/TypeScript/3GetSptConfigFile/types/models/enums/HideoutEventActions.d.ts new file mode 100644 index 0000000..e441477 --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/models/enums/HideoutEventActions.d.ts @@ -0,0 +1,11 @@ +export declare enum HideoutEventActions { + HIDEOUT_UPGRADE = "HideoutUpgrade", + HIDEOUT_UPGRADE_COMPLETE = "HideoutUpgradeComplete", + HIDEOUT_PUT_ITEMS_IN_AREA_SLOTS = "HideoutPutItemsInAreaSlots", + HIDEOUT_TAKE_ITEMS_FROM_AREA_SLOTS = "HideoutTakeItemsFromAreaSlots", + HIDEOUT_TOGGLE_AREA = "HideoutToggleArea", + HIDEOUT_SINGLE_PRODUCTION_START = "HideoutSingleProductionStart", + HIDEOUT_SCAV_CASE_PRODUCTION_START = "HideoutScavCaseProductionStart", + HIDEOUT_CONTINUOUS_PRODUCTION_START = "HideoutContinuousProductionStart", + HIDEOUT_TAKE_PRODUCTION = "HideoutTakeProduction" +} diff --git a/TypeScript/3GetSptConfigFile/types/models/enums/ItemEventActions.d.ts b/TypeScript/3GetSptConfigFile/types/models/enums/ItemEventActions.d.ts new file mode 100644 index 0000000..0e65453 --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/models/enums/ItemEventActions.d.ts @@ -0,0 +1,19 @@ +export declare enum ItemEventActions { + MOVE = "Move", + REMOVE = "Remove", + SPLIT = "Split", + MERGE = "Merge", + TRANSFER = "Transfer", + SWAP = "Swap", + FOLD = "Fold", + TOGGLE = "Toggle", + TAG = "Tag", + BIND = "Bind", + EXAMINE = "Examine", + READ_ENCYCLOPEDIA = "ReadEncyclopedia", + APPLY_INVENTORY_CHANGES = "ApplyInventoryChanges", + CREATE_MAP_MARKER = "CreateMapMarker", + DELETE_MAP_MARKER = "DeleteMapMarker", + EDIT_MAP_MARKER = "EditMapMarker", + OPEN_RANDOM_LOOT_CONTAINER = "OpenRandomLootContainer" +} diff --git a/TypeScript/3GetSptConfigFile/types/models/enums/WeatherType.d.ts b/TypeScript/3GetSptConfigFile/types/models/enums/WeatherType.d.ts new file mode 100644 index 0000000..d31fefe --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/models/enums/WeatherType.d.ts @@ -0,0 +1,19 @@ +export declare enum WeatherType { + CLEAR_DAY = 1, + CLEAR_WIND = 2, + CLEAR_NIGHT = 3, + PARTLY_CLOUD_DAY = 4, + PARTLY_CLOUD_NIGHT = 5, + CLEAR_FOG_DAY = 6, + CLEAR_FOG_NIGHT = 7, + CLOUDFOG = 8, + FOG = 9, + MOSTLY_CLOUD = 10, + LIGHT_RAIN = 11, + RAIN = 12, + CLOUD_WIND = 13, + CLOUD_WIND_RAIN = 14, + FULL_CLOUD = 15, + THUNDER_CLOUD = 16, + NONE = 0 +} diff --git a/TypeScript/3GetSptConfigFile/types/models/enums/WildSpawnTypeNumber.d.ts b/TypeScript/3GetSptConfigFile/types/models/enums/WildSpawnTypeNumber.d.ts new file mode 100644 index 0000000..ff806fe --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/models/enums/WildSpawnTypeNumber.d.ts @@ -0,0 +1,33 @@ +export declare enum WildSpawnTypeNumber { + ASSAULT = 1, + MARKSMAN = 2, + BOSSTEST = 4, + BOSSBULLY = 8, + FOLLOWERTEST = 16, + FOLLOWERBULLY = 32, + BOSSKILLA = 64, + BOSSKOJANIY = 128, + FOLLOWERKOJANIY = 256, + PMCBOT = 512, + CURSEDASSAULT = 1024, + BOSSGLUHAR = 2048, + FOLLOWERGLUHARASSAULT = 4096, + FOLLOWERGLUHARSECURITY = 8192, + FOLLOWERGLUHARSCOUT = 16384, + FOLLOWERGLUHARSNIPE = 32768, + FOLLOWERSANITAR = 65536, + BOSSSANITAR = 131072, + TEST = 262144, + ASSAULTGROUP = 524288, + SECTANTWARRIOR = 1048576, + SECTANTPRIEST = 2097152, + BOSSTAGILLA = 4194304, + FOLLOWERTAGILLA = 8388608, + EXUSEC = 16777216, + GIFTER = 33554432, + BOSSKNIGHT = 67108864, + FOLLOWERBIGPIPE = 134217728, + FOLLOWERBIRDEYE = 268435456, + SPTUSEC = 536870912, + SPTBEAR = 1073741824 +} diff --git a/TypeScript/3GetSptConfigFile/types/models/enums/WindDirection.d.ts b/TypeScript/3GetSptConfigFile/types/models/enums/WindDirection.d.ts new file mode 100644 index 0000000..fb30b20 --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/models/enums/WindDirection.d.ts @@ -0,0 +1,10 @@ +export declare enum WindDirection { + EAST = 1, + NORTH = 2, + WEST = 3, + SOUTH = 4, + SE = 5, + SW = 6, + NW = 7, + NE = 8 +} diff --git a/TypeScript/3GetSptConfigFile/types/models/spt/config/IBotConfig.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/config/IBotConfig.d.ts index af8ceba..d6fa5e0 100644 --- a/TypeScript/3GetSptConfigFile/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/spt/config/IBotConfig.d.ts @@ -27,6 +27,8 @@ export interface IBotConfig extends IBaseConfig { maxBotCap: Record; /** How many stacks of secret ammo should a bot have in its bot secure container */ secureContainerAmmoStackCount: number; + /** Batch generation size when type not available in cache */ + botGenerationBatchSizePerType: number; } export interface PresetBatch { assault: number; @@ -66,8 +68,12 @@ export interface EquipmentFilters { weaponModLimits: ModLimits; randomisedWeaponModSlots?: string[]; randomisedArmorSlots?: string[]; + faceShieldIsActiveChancePercent?: number; + lightLaserIsActiveChancePercent?: number; blacklist: EquipmentFilterDetails[]; whitelist: EquipmentFilterDetails[]; + clothing: WeightingAdjustmentDetails[]; + weightingAdjustments: WeightingAdjustmentDetails[]; } export interface ModLimits { /** How many scopes are allowed on a weapon - hard coded to work with OPTIC_SCOPE, ASSAULT_SCOPE, COLLIMATOR, COMPACT_COLLIMATOR */ @@ -80,3 +86,8 @@ export interface EquipmentFilterDetails { equipment: Record; cartridge: Record; } +export interface WeightingAdjustmentDetails { + levelRange: MinMax; + add: Record>; + edit: Record>; +} diff --git a/TypeScript/3GetSptConfigFile/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/config/IInventoryConfig.d.ts index ffffa41..4642b9b 100644 --- a/TypeScript/3GetSptConfigFile/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/spt/config/IInventoryConfig.d.ts @@ -2,4 +2,10 @@ import { IBaseConfig } from "./IBaseConfig"; export interface IInventoryConfig extends IBaseConfig { kind: "aki-inventory"; newItemsMarkedFound: boolean; + randomLootContainers: Record; +} +export interface RewardDetails { + rewardCount: number; + foundInRaid: boolean; + rewardTplPool: Record; } diff --git a/TypeScript/3GetSptConfigFile/types/models/spt/config/ILocaleConfig.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/config/ILocaleConfig.d.ts index fe9abf7..0a8955c 100644 --- a/TypeScript/3GetSptConfigFile/types/models/spt/config/ILocaleConfig.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/spt/config/ILocaleConfig.d.ts @@ -1,5 +1,10 @@ import { IBaseConfig } from "./IBaseConfig"; export interface ILocaleConfig extends IBaseConfig { kind: "aki-locale"; - desiredLocale: string; + /** e.g. ru/en/cn/fr etc, or 'system', will take computer locale setting */ + gameLocale: string; + /** e.g. ru/en/cn/fr etc, or 'system', will take computer locale setting */ + serverLocale: string; + /** Languages server can be translated into */ + serverSupportedLocales: string[]; } diff --git a/TypeScript/3GetSptConfigFile/types/models/spt/config/IPmcConfig.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/config/IPmcConfig.d.ts index 9db2ba1..48601b2 100644 --- a/TypeScript/3GetSptConfigFile/types/models/spt/config/IPmcConfig.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/spt/config/IPmcConfig.d.ts @@ -6,9 +6,11 @@ export interface IPmcConfig { looseWeaponInBackpackChancePercent: number; looseWeaponInBackpackLootMinMax: MinMax; isUsec: number; + usecType: string; + bearType: string; chanceSameSideIsHostilePercent: number; /** key: location, value: type for usec/bear */ - pmcType: Record; + pmcType: Record>>; maxBackpackLootTotalRub: number; maxPocketLootTotalRub: number; maxVestLootTotalRub: number; diff --git a/TypeScript/3GetSptConfigFile/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/config/IRagfairConfig.d.ts index c1b8763..6786417 100644 --- a/TypeScript/3GetSptConfigFile/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/spt/config/IRagfairConfig.d.ts @@ -28,12 +28,8 @@ export interface Reputation { gain: number; loss: number; } -export declare class OfferAdjustment { - maxPriceDifferenceBelowHandbookPercent: number; - handbookPriceMultipier: number; - priceThreshholdRub: number; -} export interface Dynamic { + barter: Barter; offerAdjustment: OfferAdjustment; expiredOfferThreshold: number; offerItemCount: MinMax; @@ -49,6 +45,20 @@ export interface Dynamic { showAsSingleStack: string[]; blacklist: Blacklist; } +export declare class Barter { + enable: boolean; + chancePercent: number; + itemCountMin: number; + itemCountMax: number; + priceRangeVariancePercent: number; + minRoubleCostToBecomeBarter: number; + itemTypeBlacklist: string[]; +} +export declare class OfferAdjustment { + maxPriceDifferenceBelowHandbookPercent: number; + handbookPriceMultipier: number; + priceThreshholdRub: number; +} export interface Condition { conditionChance: number; min: number; diff --git a/TypeScript/3GetSptConfigFile/types/models/spt/config/ISeasonalEventConfig.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/config/ISeasonalEventConfig.d.ts index bc60618..e410925 100644 --- a/TypeScript/3GetSptConfigFile/types/models/spt/config/ISeasonalEventConfig.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/spt/config/ISeasonalEventConfig.d.ts @@ -1,6 +1,9 @@ import { IBaseConfig } from "./IBaseConfig"; export interface ISeasonalEventConfig extends IBaseConfig { kind: "aki-seasonalevents"; + enableSeasonalEventDetection: boolean; + /** event / botType / equipSlot / itemid */ + eventGear: Record>>>; events: ISeasonalEvent[]; } export interface ISeasonalEvent { diff --git a/TypeScript/3GetSptConfigFile/types/models/spt/config/IWeatherConfig.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/config/IWeatherConfig.d.ts index bbdc43e..41a1c83 100644 --- a/TypeScript/3GetSptConfigFile/types/models/spt/config/IWeatherConfig.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/spt/config/IWeatherConfig.d.ts @@ -1,3 +1,4 @@ +import { WindDirection } from "../../../models/enums/WindDirection"; import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface IWeatherConfig extends IBaseConfig { @@ -7,12 +8,16 @@ export interface IWeatherConfig extends IBaseConfig { } export interface Weather { clouds: MinMax; - windSpeed: MinMax; - windDirection: MinMax; + windSpeed: WeatherSettings; + windDirection: WeatherSettings; windGustiness: MinMax; - rain: MinMax; + rain: WeatherSettings; rainIntensity: MinMax; - fog: MinMax; + fog: WeatherSettings; temp: MinMax; pressure: MinMax; } +export interface WeatherSettings { + values: T[]; + weights: number[]; +} diff --git a/TypeScript/3GetSptConfigFile/types/routers/item_events/HideoutItemEventRouter.d.ts b/TypeScript/3GetSptConfigFile/types/routers/item_events/HideoutItemEventRouter.d.ts index e1e98af..44bd1cd 100644 --- a/TypeScript/3GetSptConfigFile/types/routers/item_events/HideoutItemEventRouter.d.ts +++ b/TypeScript/3GetSptConfigFile/types/routers/item_events/HideoutItemEventRouter.d.ts @@ -1,7 +1,7 @@ -import { IPmcData } from "../../models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "../../models/eft/itemEvent/IItemEventRouterResponse"; import { HideoutCallbacks } from "../../callbacks/HideoutCallbacks"; import { HandledRoute, ItemEventRouterDefinition } from "../../di/Router"; +import { IPmcData } from "../../models/eft/common/IPmcData"; +import { IItemEventRouterResponse } from "../../models/eft/itemEvent/IItemEventRouterResponse"; export declare class HideoutItemEventRouter extends ItemEventRouterDefinition { protected hideoutCallbacks: HideoutCallbacks; constructor(hideoutCallbacks: HideoutCallbacks); diff --git a/TypeScript/3GetSptConfigFile/types/routers/item_events/InventoryItemEventRouter.d.ts b/TypeScript/3GetSptConfigFile/types/routers/item_events/InventoryItemEventRouter.d.ts index 2619bb9..953d322 100644 --- a/TypeScript/3GetSptConfigFile/types/routers/item_events/InventoryItemEventRouter.d.ts +++ b/TypeScript/3GetSptConfigFile/types/routers/item_events/InventoryItemEventRouter.d.ts @@ -1,7 +1,7 @@ -import { IPmcData } from "../../models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "../../models/eft/itemEvent/IItemEventRouterResponse"; import { InventoryCallbacks } from "../../callbacks/InventoryCallbacks"; import { HandledRoute, ItemEventRouterDefinition } from "../../di/Router"; +import { IPmcData } from "../../models/eft/common/IPmcData"; +import { IItemEventRouterResponse } from "../../models/eft/itemEvent/IItemEventRouterResponse"; export declare class InventoryItemEventRouter extends ItemEventRouterDefinition { protected inventoryCallbacks: InventoryCallbacks; constructor(inventoryCallbacks: InventoryCallbacks); diff --git a/TypeScript/3GetSptConfigFile/types/servers/HttpServer.d.ts b/TypeScript/3GetSptConfigFile/types/servers/HttpServer.d.ts index bbca8af..80c1d48 100644 --- a/TypeScript/3GetSptConfigFile/types/servers/HttpServer.d.ts +++ b/TypeScript/3GetSptConfigFile/types/servers/HttpServer.d.ts @@ -4,6 +4,7 @@ import { ApplicationContext } from "../context/ApplicationContext"; import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; import { ILogger } from "../models/spt/utils/ILogger"; +import { LocalisationService } from "../services/LocalisationService"; import { ConfigServer } from "./ConfigServer"; import { DatabaseServer } from "./DatabaseServer"; import { IHttpListener } from "./http/IHttpListener"; @@ -12,11 +13,12 @@ export declare class HttpServer { protected logger: ILogger; protected databaseServer: DatabaseServer; protected httpServerHelper: HttpServerHelper; + protected localisationService: LocalisationService; protected httpListeners: IHttpListener[]; protected configServer: ConfigServer; protected applicationContext: ApplicationContext; protected webSocketServer: WebSocketServer; - constructor(logger: ILogger, databaseServer: DatabaseServer, httpServerHelper: HttpServerHelper, httpListeners: IHttpListener[], configServer: ConfigServer, applicationContext: ApplicationContext, webSocketServer: WebSocketServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, httpServerHelper: HttpServerHelper, localisationService: LocalisationService, httpListeners: IHttpListener[], configServer: ConfigServer, applicationContext: ApplicationContext, webSocketServer: WebSocketServer); protected httpConfig: IHttpConfig; getCookies(req: http.IncomingMessage): any; handleRequest(req: IncomingMessage, resp: ServerResponse): void; diff --git a/TypeScript/3GetSptConfigFile/types/servers/SaveServer.d.ts b/TypeScript/3GetSptConfigFile/types/servers/SaveServer.d.ts index cb28f49..4dca514 100644 --- a/TypeScript/3GetSptConfigFile/types/servers/SaveServer.d.ts +++ b/TypeScript/3GetSptConfigFile/types/servers/SaveServer.d.ts @@ -1,20 +1,22 @@ +import { SaveLoadRouter } from "../di/Router"; import { IAkiProfile, Info } from "../models/eft/profile/IAkiProfile"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { VFS } from "../utils/VFS"; -import { SaveLoadRouter } from "../di/Router"; -import { ILogger } from "../models/spt/utils/ILogger"; export declare class SaveServer { protected vfs: VFS; protected saveLoadRouters: SaveLoadRouter[]; protected jsonUtil: JsonUtil; protected hashUtil: HashUtil; + protected localisationService: LocalisationService; protected logger: ILogger; protected profileFilepath: string; protected profiles: {}; protected onSave: {}; protected saveMd5: {}; - constructor(vfs: VFS, saveLoadRouters: SaveLoadRouter[], jsonUtil: JsonUtil, hashUtil: HashUtil, logger: ILogger); + constructor(vfs: VFS, saveLoadRouters: SaveLoadRouter[], jsonUtil: JsonUtil, hashUtil: HashUtil, localisationService: LocalisationService, logger: ILogger); load(): void; save(): void; getProfile(sessionId: string): IAkiProfile; diff --git a/TypeScript/3GetSptConfigFile/types/servers/WebSocketServer.d.ts b/TypeScript/3GetSptConfigFile/types/servers/WebSocketServer.d.ts index f33d214..5d40e6e 100644 --- a/TypeScript/3GetSptConfigFile/types/servers/WebSocketServer.d.ts +++ b/TypeScript/3GetSptConfigFile/types/servers/WebSocketServer.d.ts @@ -1,18 +1,20 @@ /// -import { HttpServerHelper } from "../helpers/HttpServerHelper"; -import WebSocket from "ws"; import http, { IncomingMessage } from "http"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { RandomUtil } from "../utils/RandomUtil"; +import WebSocket from "ws"; +import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { INotification } from "../models/eft/notifier/INotifier"; -import { ConfigServer } from "./ConfigServer"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { LocalisationService } from "../services/LocalisationService"; +import { RandomUtil } from "../utils/RandomUtil"; +import { ConfigServer } from "./ConfigServer"; export declare class WebSocketServer { protected logger: ILogger; protected randomUtil: RandomUtil; protected configServer: ConfigServer; + protected localisationService: LocalisationService; protected httpServerHelper: HttpServerHelper; - constructor(logger: ILogger, randomUtil: RandomUtil, configServer: ConfigServer, httpServerHelper: HttpServerHelper); + constructor(logger: ILogger, randomUtil: RandomUtil, configServer: ConfigServer, localisationService: LocalisationService, httpServerHelper: HttpServerHelper); protected httpConfig: IHttpConfig; protected defaultNotification: INotification; protected webSockets: Record; diff --git a/TypeScript/3GetSptConfigFile/types/servers/http/AkiHttpListener.d.ts b/TypeScript/3GetSptConfigFile/types/servers/http/AkiHttpListener.d.ts index 6f78939..acf92aa 100644 --- a/TypeScript/3GetSptConfigFile/types/servers/http/AkiHttpListener.d.ts +++ b/TypeScript/3GetSptConfigFile/types/servers/http/AkiHttpListener.d.ts @@ -1,22 +1,24 @@ /// /// import { IncomingMessage, ServerResponse } from "http"; -import { IHttpListener } from "./IHttpListener"; import { Serializer } from "../../di/Serializer"; import { ILogger } from "../../models/spt/utils/ILogger"; import { HttpRouter } from "../../routers/HttpRouter"; +import { LocalisationService } from "../../services/LocalisationService"; import { HttpResponseUtil } from "../../utils/HttpResponseUtil"; import { JsonUtil } from "../../utils/JsonUtil"; import { HttpBufferHandler } from "./HttpBufferHandler"; +import { IHttpListener } from "./IHttpListener"; export declare class AkiHttpListener implements IHttpListener { protected httpRouter: HttpRouter; protected serializers: Serializer[]; protected logger: ILogger; protected jsonUtil: JsonUtil; protected httpResponse: HttpResponseUtil; + protected localisationService: LocalisationService; protected httpBufferHandler: HttpBufferHandler; constructor(httpRouter: HttpRouter, // TODO: delay required - serializers: Serializer[], logger: ILogger, jsonUtil: JsonUtil, httpResponse: HttpResponseUtil, httpBufferHandler: HttpBufferHandler); + serializers: Serializer[], logger: ILogger, jsonUtil: JsonUtil, httpResponse: HttpResponseUtil, localisationService: LocalisationService, httpBufferHandler: HttpBufferHandler); canHandle(_: string, req: IncomingMessage): boolean; handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): void; sendResponse(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: Buffer, output: string): void; diff --git a/TypeScript/3GetSptConfigFile/types/services/BotEquipmentFilterService.d.ts b/TypeScript/3GetSptConfigFile/types/services/BotEquipmentFilterService.d.ts index 632f961..ae72cc3 100644 --- a/TypeScript/3GetSptConfigFile/types/services/BotEquipmentFilterService.d.ts +++ b/TypeScript/3GetSptConfigFile/types/services/BotEquipmentFilterService.d.ts @@ -1,12 +1,12 @@ import { IBotType } from "../models/eft/common/tables/IBotType"; -import { EquipmentFilters, EquipmentFilterDetails, IBotConfig } from "../models/spt/config/IBotConfig"; +import { EquipmentFilters, EquipmentFilterDetails, IBotConfig, WeightingAdjustmentDetails } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; export declare class BotEquipmentFilterService { protected logger: ILogger; protected configServer: ConfigServer; protected botConfig: IBotConfig; - protected botEquipmentFilterlists: Record; + protected botEquipmentConfig: Record; constructor(logger: ILogger, configServer: ConfigServer); /** * Filter a bots data to exclude equipment and cartridges defines in the botConfig @@ -30,6 +30,20 @@ export declare class BotEquipmentFilterService { * @returns EquipmentFilterDetails object */ protected getBotEquipmentWhitelist(botRole: string, playerLevel: number): EquipmentFilterDetails; + /** + * Retreive clothing weighting adjustments from bot.json config + * @param botRole Bot type to get adjustments for + * @param playerLevel level of player + * @returns Weighting adjustments for bots clothing + */ + protected getBotClothingAdjustments(botRole: string, playerLevel: number): WeightingAdjustmentDetails; + /** + * Retreive item weighting adjustments from bot.json config + * @param botRole Bot type to get adjustments for + * @param playerLevel level of player + * @returns Weighting adjustments for bot items + */ + protected getBotWeightingAdjustments(botRole: string, playerLevel: number): WeightingAdjustmentDetails; /** * Filter bot equipment based on blacklist and whitelist from config/bot.json * Prioritises whitelist first, if one is found blacklist is ignored @@ -47,4 +61,10 @@ export declare class BotEquipmentFilterService { * @returns Filtered bot file */ protected filterCartridges(baseBotNode: IBotType, blacklist: EquipmentFilterDetails, whitelist: EquipmentFilterDetails): void; + /** + * Add/Edit weighting changes to bot items using values from config/bot.json/equipment + * @param weightingAdjustments Weighting change to apply to bot + * @param botItemPool Bot item dictionary to adjust + */ + protected adjustWeighting(weightingAdjustments: WeightingAdjustmentDetails, botItemPool: Record): void; } diff --git a/TypeScript/3GetSptConfigFile/types/services/BotGenerationCacheService.d.ts b/TypeScript/3GetSptConfigFile/types/services/BotGenerationCacheService.d.ts index ba53fec..0be0576 100644 --- a/TypeScript/3GetSptConfigFile/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/3GetSptConfigFile/types/services/BotGenerationCacheService.d.ts @@ -8,11 +8,11 @@ export declare class BotGenerationCacheService { protected randomUtil: RandomUtil; protected jsonUtil: JsonUtil; protected botHelper: BotHelper; - protected storedBots: IBotBase[]; + protected storedBots: Map; constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, botHelper: BotHelper); /** * Store array of bots in cache, shuffle results before storage - * @param botsToStore + * @param botsToStore Bots we want to store in the cache */ storeBots(botsToStore: IBotBase[]): void; /** @@ -21,25 +21,7 @@ export declare class BotGenerationCacheService { * @param role role to retreive (assault/bossTagilla etc) * @returns IBotBase object */ - getBot(role: string): IBotBase[]; - /** - * Find a bot by its index from cache - * @param indexOfBotToReturn index to find bot by - * @returns bot profile - */ - protected getBotFromCache(indexOfBotToReturn: number): IBotBase; - /** - * Remove bot profile by index from cache - * @param indexOfBotToReturn Index of bot profile to remove - */ - protected removeBotFromCache(indexOfBotToReturn: number): void; - /** - * Get index of bot profile that matches criteria - * @param role Role of bot wanted - * @param getPmc Requested bot a pmc - * @returns index of found bot, -1 if not found - */ - protected getIndexOfBotToReturn(role: string, getPmc: boolean): number; + getBot(role: string): IBotBase; /** * Remove all cached bot profiles */ @@ -48,5 +30,5 @@ export declare class BotGenerationCacheService { * Does cache have bots * @returns true if empty */ - cacheIsEmpty(): boolean; + cacheHasBotOfRole(role: string): boolean; } diff --git a/TypeScript/3GetSptConfigFile/types/services/LocaleService.d.ts b/TypeScript/3GetSptConfigFile/types/services/LocaleService.d.ts index 33bea7b..8275b75 100644 --- a/TypeScript/3GetSptConfigFile/types/services/LocaleService.d.ts +++ b/TypeScript/3GetSptConfigFile/types/services/LocaleService.d.ts @@ -1,14 +1,42 @@ import { ILocaleConfig } from "../models/spt/config/ILocaleConfig"; +import { ILocaleGlobalBase } from "../models/spt/server/ILocaleBase"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +/** + * Handles getting locales from config or users machine + */ export declare class LocaleService { protected logger: ILogger; + protected databaseServer: DatabaseServer; protected configServer: ConfigServer; protected localeConfig: ILocaleConfig; - constructor(logger: ILogger, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, configServer: ConfigServer); /** - * Gets the locale key from the locale.json file + * Get the eft globals db file based on the configured locale in config/locale.json, if not found, fall back to 'en' + * @returns ILocaleGlobalBase + */ + getLocaleDb(): ILocaleGlobalBase; + /** + * Gets the game locale key from the locale.json file, + * if value is 'system' get system locale * @returns locale e.g en/ge/cz/cn */ - getDesiredLocale(): string; + getDesiredGameLocale(): string; + /** + * Gets the game locale key from the locale.json file, + * if value is 'system' get system locale + * @returns locale e.g en/ge/cz/cn + */ + getDesiredServerLocale(): string; + /** + * Get array of languages supported for localisation + * @returns array of locales e.g. en/fr/cn + */ + getServerSupportedLocales(): string[]; + /** + * Get the locale of the computer running the server + * @returns langage part of locale e.g. 'en' part of 'en-US' + */ + protected getPlatformLocale(): string; } diff --git a/TypeScript/3GetSptConfigFile/types/services/LocalisationService.d.ts b/TypeScript/3GetSptConfigFile/types/services/LocalisationService.d.ts new file mode 100644 index 0000000..519325d --- /dev/null +++ b/TypeScript/3GetSptConfigFile/types/services/LocalisationService.d.ts @@ -0,0 +1,21 @@ +import { I18n } from "i18n"; +import { ILocaleConfig } from "../models/spt/config/ILocaleConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { LocaleService } from "./LocaleService"; +/** + * Handles translating server text into different langauges + */ +export declare class LocalisationService { + protected logger: ILogger; + protected localeService: LocaleService; + protected localeConfig: ILocaleConfig; + protected i18n: I18n; + constructor(logger: ILogger, localeService: LocaleService); + /** + * Get a localised value using the passed in key + * @param key Key to loop up locale for + * @param args optional arguments + * @returns Localised string + */ + getText(key: string, args?: any): string; +} diff --git a/TypeScript/3GetSptConfigFile/types/services/PaymentService.d.ts b/TypeScript/3GetSptConfigFile/types/services/PaymentService.d.ts index a5e538f..c9ce95a 100644 --- a/TypeScript/3GetSptConfigFile/types/services/PaymentService.d.ts +++ b/TypeScript/3GetSptConfigFile/types/services/PaymentService.d.ts @@ -11,6 +11,7 @@ import { IProcessSellTradeRequestData } from "../models/eft/trade/IProcessSellTr import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +import { LocalisationService } from "./LocalisationService"; export declare class PaymentService { protected logger: ILogger; protected httpResponse: HttpResponseUtil; @@ -19,8 +20,9 @@ export declare class PaymentService { protected traderHelper: TraderHelper; protected itemHelper: ItemHelper; protected inventoryHelper: InventoryHelper; + protected localisationService: LocalisationService; protected paymentHelper: PaymentHelper; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, traderHelper: TraderHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper); + constructor(logger: ILogger, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, traderHelper: TraderHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, localisationService: LocalisationService, paymentHelper: PaymentHelper); /** * Take money and insert items into return to server request * @param {Object} pmcData @@ -50,7 +52,7 @@ export declare class PaymentService { * @param pmcData Player profile to find and remove currency from * @param currencyTpl Type of currency to pay * @param amountToPay money value to pay - * @param sessionID Sessino id + * @param sessionID Session id * @param output output object to send to client * @returns IItemEventRouterResponse */ diff --git a/TypeScript/3GetSptConfigFile/types/services/PlayerService.d.ts b/TypeScript/3GetSptConfigFile/types/services/PlayerService.d.ts index 519b7e5..2f364d5 100644 --- a/TypeScript/3GetSptConfigFile/types/services/PlayerService.d.ts +++ b/TypeScript/3GetSptConfigFile/types/services/PlayerService.d.ts @@ -2,10 +2,12 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { IPlayerIncrementSkillLevelRequestData } from "../models/eft/player/IPlayerIncrementSkillLevelRequestData"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "./LocalisationService"; export declare class PlayerService { protected logger: ILogger; + protected localisationService: LocalisationService; protected databaseServer: DatabaseServer; - constructor(logger: ILogger, databaseServer: DatabaseServer); + constructor(logger: ILogger, localisationService: LocalisationService, databaseServer: DatabaseServer); /** * increases the profile skill and updates any output * @param {Object} pmcData diff --git a/TypeScript/3GetSptConfigFile/types/services/PmcAiService.d.ts b/TypeScript/3GetSptConfigFile/types/services/PmcAiService.d.ts deleted file mode 100644 index 0690f1f..0000000 --- a/TypeScript/3GetSptConfigFile/types/services/PmcAiService.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { IBotConfig } from "../models/spt/config/IBotConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { ConfigServer } from "../servers/ConfigServer"; -/** Storing/retreving pmcRoles set at the start of a raid - its done at that point as we know what location the player is heading to */ -export declare class PmcAiService { - protected logger: ILogger; - protected configServer: ConfigServer; - protected botConfig: IBotConfig; - protected usecRole: string; - protected bearRole: string; - constructor(logger: ILogger, configServer: ConfigServer); - /** - * Convert from pmc side (usec/bear) to the side as defined in the bot config (usecType/bearType) - * @param pmcSide eft side (usec/bear) - * @returns pmc side as defined in config - */ - getPmcRole(pmcSide: "usec" | "bear" | string): string; - /** - * Set the roles for pmcs - * @param location map location to look up and use as pmc types - */ - setPmcRolesByLocation(location: string): void; - /** - * Clear the saved role from usec/bear PMCs - */ - clearPmcRoles(): void; -} diff --git a/TypeScript/3GetSptConfigFile/types/services/ProfileFixerService.d.ts b/TypeScript/3GetSptConfigFile/types/services/ProfileFixerService.d.ts index e772919..86a6af8 100644 --- a/TypeScript/3GetSptConfigFile/types/services/ProfileFixerService.d.ts +++ b/TypeScript/3GetSptConfigFile/types/services/ProfileFixerService.d.ts @@ -8,12 +8,14 @@ import { HideoutAreas } from "../models/enums/HideoutAreas"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { Watermark } from "../utils/Watermark"; +import { LocalisationService } from "./LocalisationService"; export declare class ProfileFixerService { protected logger: ILogger; protected watermark: Watermark; protected hideoutHelper: HideoutHelper; + protected localisationService: LocalisationService; protected databaseServer: DatabaseServer; - constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, databaseServer: DatabaseServer); + constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, localisationService: LocalisationService, databaseServer: DatabaseServer); /** * Find issues in the pmc profile data that may cause issues and fix them * @param pmcProfile profile to check and fix diff --git a/TypeScript/3GetSptConfigFile/types/services/RagfairOfferService.d.ts b/TypeScript/3GetSptConfigFile/types/services/RagfairOfferService.d.ts index a6f6b6d..86c1e52 100644 --- a/TypeScript/3GetSptConfigFile/types/services/RagfairOfferService.d.ts +++ b/TypeScript/3GetSptConfigFile/types/services/RagfairOfferService.d.ts @@ -11,6 +11,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { TimeUtil } from "../utils/TimeUtil"; +import { LocalisationService } from "./LocalisationService"; import { RagfairCategoriesService } from "./RagfairCategoriesService"; export declare class RagfairOfferService { protected logger: ILogger; @@ -22,12 +23,14 @@ export declare class RagfairOfferService { protected profileHelper: ProfileHelper; protected eventOutputHolder: EventOutputHolder; protected httpResponse: HttpResponseUtil; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected playerOffersLoaded: boolean; protected expiredOffers: Item[]; - protected offers: IRagfairOffer[]; + /** offerId, offer */ + protected offers: Record; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, databaseServer: DatabaseServer, saveServer: SaveServer, ragfairServerHelper: RagfairServerHelper, ragfairCategoriesService: RagfairCategoriesService, profileHelper: ProfileHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, databaseServer: DatabaseServer, saveServer: SaveServer, ragfairServerHelper: RagfairServerHelper, ragfairCategoriesService: RagfairCategoriesService, profileHelper: ProfileHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, localisationService: LocalisationService, configServer: ConfigServer); /** * Get all offers * @returns IRagfairOffer array diff --git a/TypeScript/3GetSptConfigFile/types/utils/App.d.ts b/TypeScript/3GetSptConfigFile/types/utils/App.d.ts index dcc2669..cc8a5af 100644 --- a/TypeScript/3GetSptConfigFile/types/utils/App.d.ts +++ b/TypeScript/3GetSptConfigFile/types/utils/App.d.ts @@ -1,14 +1,16 @@ -import { TimeUtil } from "./TimeUtil"; import { OnLoad } from "../di/OnLoad"; import { OnUpdate } from "../di/OnUpdate"; import { ILogger } from "../models/spt/utils/ILogger"; +import { LocalisationService } from "../services/LocalisationService"; +import { TimeUtil } from "./TimeUtil"; export declare class App { protected logger: ILogger; protected timeUtil: TimeUtil; + protected localisationService: LocalisationService; protected onLoadComponents: OnLoad[]; protected onUpdateComponents: OnUpdate[]; protected onUpdateLastRun: {}; - constructor(logger: ILogger, timeUtil: TimeUtil, onLoadComponents: OnLoad[], onUpdateComponents: OnUpdate[]); + constructor(logger: ILogger, timeUtil: TimeUtil, localisationService: LocalisationService, onLoadComponents: OnLoad[], onUpdateComponents: OnUpdate[]); load(): void; protected update(onUpdateComponents: OnUpdate[]): void; protected logUpdateException(err: any, updateable: OnUpdate): void; diff --git a/TypeScript/3GetSptConfigFile/types/utils/DatabaseImporter.d.ts b/TypeScript/3GetSptConfigFile/types/utils/DatabaseImporter.d.ts index 483e135..31670ae 100644 --- a/TypeScript/3GetSptConfigFile/types/utils/DatabaseImporter.d.ts +++ b/TypeScript/3GetSptConfigFile/types/utils/DatabaseImporter.d.ts @@ -3,15 +3,17 @@ import { IDatabaseTables } from "../models/spt/server/IDatabaseTables"; import { ILogger } from "../models/spt/utils/ILogger"; import { ImageRouter } from "../routers/ImageRouter"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { JsonUtil } from "./JsonUtil"; import { VFS } from "./VFS"; export declare class DatabaseImporter extends OnLoad { protected logger: ILogger; protected vfs: VFS; protected jsonUtil: JsonUtil; + protected localisationService: LocalisationService; protected databaseServer: DatabaseServer; protected imageRouter: ImageRouter; - constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, databaseServer: DatabaseServer, imageRouter: ImageRouter); + constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, localisationService: LocalisationService, databaseServer: DatabaseServer, imageRouter: ImageRouter); onLoad(): void; /** * Read all json files in database folder and map into a json object diff --git a/TypeScript/3GetSptConfigFile/types/utils/HttpResponseUtil.d.ts b/TypeScript/3GetSptConfigFile/types/utils/HttpResponseUtil.d.ts index 29502be..3a78618 100644 --- a/TypeScript/3GetSptConfigFile/types/utils/HttpResponseUtil.d.ts +++ b/TypeScript/3GetSptConfigFile/types/utils/HttpResponseUtil.d.ts @@ -1,10 +1,13 @@ -import { JsonUtil } from "./JsonUtil"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { INullResponseData } from "../models/eft/httpResponse/INullResponseData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; +import { BackendErrorCodes } from "../models/enums/BackendErrorCodes"; +import { LocalisationService } from "../services/LocalisationService"; +import { JsonUtil } from "./JsonUtil"; export declare class HttpResponseUtil { protected jsonUtil: JsonUtil; - constructor(jsonUtil: JsonUtil); + protected localisationService: LocalisationService; + constructor(jsonUtil: JsonUtil, localisationService: LocalisationService); protected clearString(s: string): any; noBody(data: any): any; getBody(data: T, err?: number, errmsg?: any): IGetBodyResponseData; @@ -12,5 +15,5 @@ export declare class HttpResponseUtil { emptyResponse(): IGetBodyResponseData; nullResponse(): INullResponseData; emptyArrayResponse(): IGetBodyResponseData; - appendErrorToOutput(output: IItemEventRouterResponse, message?: string, title?: string): IItemEventRouterResponse; + appendErrorToOutput(output: IItemEventRouterResponse, message?: string, errorCode?: BackendErrorCodes): IItemEventRouterResponse; } diff --git a/TypeScript/3GetSptConfigFile/types/utils/RandomUtil.d.ts b/TypeScript/3GetSptConfigFile/types/utils/RandomUtil.d.ts index 633e472..aa556e3 100644 --- a/TypeScript/3GetSptConfigFile/types/utils/RandomUtil.d.ts +++ b/TypeScript/3GetSptConfigFile/types/utils/RandomUtil.d.ts @@ -110,6 +110,12 @@ export declare class RandomUtil { getIntEx(max: number): number; getFloat(min: number, max: number): number; getBool(): boolean; + /** + * Check if number passes a check out of 100 + * @param chancePercent value check needs to be above + * @returns true if value passes check + */ + getChance100(chancePercent: number): boolean; getStringArrayValue(arr: string[]): string; getArrayValue(arr: T[]): T; getKey(node: any): string; diff --git a/TypeScript/3GetSptConfigFile/types/utils/Watermark.d.ts b/TypeScript/3GetSptConfigFile/types/utils/Watermark.d.ts index c6dc120..e02eba2 100644 --- a/TypeScript/3GetSptConfigFile/types/utils/Watermark.d.ts +++ b/TypeScript/3GetSptConfigFile/types/utils/Watermark.d.ts @@ -1,20 +1,15 @@ import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { LocalisationService } from "../services/LocalisationService"; export declare class WatermarkLocale { - protected locales: { - "en-US": { - description: string[]; - warning: string[]; - modding: string[]; - }; - "zh-CN": { - description: string[]; - warning: string[]; - modding: string[]; - }; + protected localisationService: LocalisationService; + constructor(localisationService: LocalisationService); + protected watermark: { + description: string[]; + warning: string[]; + modding: string[]; }; - getLocale(): string; getDescription(): string[]; getWarning(): string[]; getModding(): string[]; @@ -22,9 +17,10 @@ export declare class WatermarkLocale { export declare class Watermark { protected logger: ILogger; protected configServer: ConfigServer; + protected localisationService: LocalisationService; protected watermarkLocale?: WatermarkLocale; protected akiConfig: ICoreConfig; - constructor(logger: ILogger, configServer: ConfigServer, watermarkLocale?: WatermarkLocale); + constructor(logger: ILogger, configServer: ConfigServer, localisationService: LocalisationService, watermarkLocale?: WatermarkLocale); protected text: string[]; protected versionLabel: string; initialize(): void; diff --git a/TypeScript/4UseACustomConfigFile/types/callbacks/BotCallbacks.d.ts b/TypeScript/4UseACustomConfigFile/types/callbacks/BotCallbacks.d.ts index 2db60dc..827015e 100644 --- a/TypeScript/4UseACustomConfigFile/types/callbacks/BotCallbacks.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/callbacks/BotCallbacks.d.ts @@ -8,8 +8,29 @@ export declare class BotCallbacks { protected botController: BotController; protected httpResponse: HttpResponseUtil; constructor(botController: BotController, httpResponse: HttpResponseUtil); + /** + * Handle singleplayer/settings/bot/limit + * @returns string + */ getBotLimit(url: string, info: IEmptyRequestData, sessionID: string): string; + /** + * Handle singleplayer/settings/bot/difficulty + * @returns string + */ getBotDifficulty(url: string, info: IEmptyRequestData, sessionID: string): string; + /** + * Handle client/game/bot/generate + * @returns IGetBodyResponseData + */ generateBots(url: string, info: IGenerateBotsRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle singleplayer/settings/bot/maxCap + * @returns string + */ getBotCap(): string; + /** + * Handle singleplayer/settings/bot/getBotBehaviours + * @returns string + */ + getBotBehaviours(): string; } diff --git a/TypeScript/4UseACustomConfigFile/types/callbacks/CustomizationCallbacks.d.ts b/TypeScript/4UseACustomConfigFile/types/callbacks/CustomizationCallbacks.d.ts index 3bab8c0..75d5701 100644 --- a/TypeScript/4UseACustomConfigFile/types/callbacks/CustomizationCallbacks.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/callbacks/CustomizationCallbacks.d.ts @@ -3,6 +3,7 @@ import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { IPmcData } from "../models/eft/common/IPmcData"; import { ISuit } from "../models/eft/common/tables/ITrader"; import { IBuyClothingRequestData } from "../models/eft/customization/IBuyClothingRequestData"; +import { IGetSuitsResponse } from "../models/eft/customization/IGetSuitsResponse"; import { IWearClothingRequestData } from "../models/eft/customization/IWearClothingRequestData"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; @@ -13,10 +14,15 @@ export declare class CustomizationCallbacks { protected saveServer: SaveServer; protected httpResponse: HttpResponseUtil; constructor(customizationController: CustomizationController, saveServer: SaveServer, httpResponse: HttpResponseUtil); - getSuits(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<{ - _id: string; - suites: string[]; - }>; + /** + * Handles client/trading/customization/storage + * @returns + */ + getSuits(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handles client/trading/customization + * @returns ISuit[] + */ getTraderSuits(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; wearClothing(pmcData: IPmcData, body: IWearClothingRequestData, sessionID: string): IItemEventRouterResponse; buyClothing(pmcData: IPmcData, body: IBuyClothingRequestData, sessionID: string): IItemEventRouterResponse; diff --git a/TypeScript/4UseACustomConfigFile/types/callbacks/DataCallbacks.d.ts b/TypeScript/4UseACustomConfigFile/types/callbacks/DataCallbacks.d.ts index 04566ff..2efcf81 100644 --- a/TypeScript/4UseACustomConfigFile/types/callbacks/DataCallbacks.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/callbacks/DataCallbacks.d.ts @@ -12,15 +12,42 @@ import { ILanguageBase } from "../models/spt/server/ILocaleBase"; import { ISettingsBase } from "../models/spt/server/ISettingsBase"; import { DatabaseServer } from "../servers/DatabaseServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +/** + * Handle client requests + */ export declare class DataCallbacks { protected httpResponse: HttpResponseUtil; protected databaseServer: DatabaseServer; constructor(httpResponse: HttpResponseUtil, databaseServer: DatabaseServer); + /** + * Handles client/settings + * @returns ISettingsBase + */ getSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handles client/globals + * @returns IGlobals + */ getGlobals(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handles client/items + * @returns string + */ getTemplateItems(url: string, info: IEmptyRequestData, sessionID: string): string; + /** + * Handles client/handbook/templates + * @returns IHandbookBase + */ getTemplateHandbook(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handles client/customization + * @returns Record>; + /** + * Handles client/account/customization + * @returns string[] + */ getTemplateCharacter(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getTemplateQuests(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getHideoutSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; @@ -28,6 +55,6 @@ export declare class DataCallbacks { gethideoutProduction(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getHideoutScavcase(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getLocalesLanguages(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - getLocalesMenu(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + getLocalesMenu(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getLocalesGlobal(url: string, info: IEmptyRequestData, sessionID: string): string; } diff --git a/TypeScript/4UseACustomConfigFile/types/callbacks/DialogueCallbacks.d.ts b/TypeScript/4UseACustomConfigFile/types/callbacks/DialogueCallbacks.d.ts index 634f90b..7b2eeae 100644 --- a/TypeScript/4UseACustomConfigFile/types/callbacks/DialogueCallbacks.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/callbacks/DialogueCallbacks.d.ts @@ -26,15 +26,27 @@ export declare class DialogueCallbacks extends OnUpdate { protected httpResponse: HttpResponseUtil; protected dialogueController: DialogueController; constructor(hashUtil: HashUtil, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, dialogueController: DialogueController); + /** + * Handles client/friend/list + * @returns IGetFriendListDataResponse + */ getFriendList(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handles client/chatServer/list + * @returns + */ getChatServerList(url: string, info: IGetChatServerListRequestData, sessionID: string): IGetBodyResponseData; getMailDialogList(url: string, info: IGetMailDialogListRequestData, sessionID: string): IGetBodyResponseData; getMailDialogView(url: string, info: IGetMailDialogViewRequestData, sessionID: string): IGetBodyResponseData; - getMailDialogInfo(url: string, info: IGetMailDialogInfoRequestData, sessionID: string): IGetBodyResponseData; + getMailDialogInfo(url: string, info: IGetMailDialogInfoRequestData, sessionID: string): IGetBodyResponseData; removeDialog(url: string, info: IRemoveDialogRequestData, sessionID: string): IGetBodyResponseData; pinDialog(url: string, info: IPinDialogRequestData, sessionID: string): IGetBodyResponseData; unpinDialog(url: string, info: IPinDialogRequestData, sessionID: string): IGetBodyResponseData; setRead(url: string, info: ISetDialogReadRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handles client/mail/dialog/getAllAttachments + * @returns IGetAllAttachmentsResponse + */ getAllAttachments(url: string, info: IGetAllAttachmentsRequestData, sessionID: string): IGetBodyResponseData; listOutbox(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; listInbox(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; diff --git a/TypeScript/4UseACustomConfigFile/types/callbacks/GameCallbacks.d.ts b/TypeScript/4UseACustomConfigFile/types/callbacks/GameCallbacks.d.ts index 5e4c240..3a6b7e6 100644 --- a/TypeScript/4UseACustomConfigFile/types/callbacks/GameCallbacks.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/callbacks/GameCallbacks.d.ts @@ -3,6 +3,9 @@ import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { ICheckVersionResponse } from "../models/eft/game/ICheckVersionResponse"; import { IGameConfigResponse } from "../models/eft/game/IGameConfigResponse"; import { IGameEmptyCrcRequestData } from "../models/eft/game/IGameEmptyCrcRequestData"; +import { IGameKeepAliveResponse } from "../models/eft/game/IGameKeepAliveResponse"; +import { IGameLogoutResponseData } from "../models/eft/game/IGameLogoutResponseData"; +import { IGameStartResponse } from "../models/eft/game/IGameStartResponse"; import { IReportNicknameRequestData } from "../models/eft/game/IReportNicknameRequestData"; import { IServerDetails } from "../models/eft/game/IServerDetails"; import { IVersionValidateRequestData } from "../models/eft/game/IVersionValidateRequestData"; @@ -15,13 +18,37 @@ declare class GameCallbacks { protected watermark: Watermark; protected gameController: GameController; constructor(httpResponse: HttpResponseUtil, watermark: Watermark, gameController: GameController); + /** + * Handle client/game/version/validate + * @returns INullResponseData + */ versionValidate(url: string, info: IVersionValidateRequestData, sessionID: string): INullResponseData; - gameStart(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - gameLogout(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/game/start + * @returns IGameStartResponse + */ + gameStart(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/game/logout + * @returns IGameLogoutResponseData + */ + gameLogout(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/game/config + * @returns IGameConfigResponse + */ getGameConfig(url: string, info: IGameEmptyCrcRequestData, sessionID: string): IGetBodyResponseData; getServer(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; validateGameVersion(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - gameKeepalive(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/game/keepalive + * @returns IGameKeepAliveResponse + */ + gameKeepalive(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle singleplayer/settings/version + * @returns string + */ getVersion(url: string, info: IEmptyRequestData, sessionID: string): string; reportNickname(url: string, info: IReportNicknameRequestData, sessionID: string): INullResponseData; } diff --git a/TypeScript/4UseACustomConfigFile/types/callbacks/HealthCallbacks.d.ts b/TypeScript/4UseACustomConfigFile/types/callbacks/HealthCallbacks.d.ts index 8672be7..7edf03e 100644 --- a/TypeScript/4UseACustomConfigFile/types/callbacks/HealthCallbacks.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/callbacks/HealthCallbacks.d.ts @@ -21,7 +21,19 @@ export declare class HealthCallbacks { * @returns empty response, no data sent back to client */ syncHealth(url: string, info: ISyncHealthRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle Eat + * @returns IItemEventRouterResponse + */ offraidEat(pmcData: IPmcData, body: IOffraidEatRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle Heal + * @returns IItemEventRouterResponse + */ offraidHeal(pmcData: IPmcData, body: IOffraidHealRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle RestoreHealth + * @returns IItemEventRouterResponse + */ healthTreatment(pmcData: IPmcData, info: IHealthTreatmentRequestData, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/4UseACustomConfigFile/types/callbacks/HideoutCallbacks.d.ts b/TypeScript/4UseACustomConfigFile/types/callbacks/HideoutCallbacks.d.ts index 99ab4c9..e39e806 100644 --- a/TypeScript/4UseACustomConfigFile/types/callbacks/HideoutCallbacks.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/callbacks/HideoutCallbacks.d.ts @@ -19,14 +19,77 @@ export declare class HideoutCallbacks extends OnUpdate { protected hideoutConfig: IHideoutConfig; constructor(hideoutController: HideoutController, // TODO: delay needed configServer: ConfigServer); + /** + * Handle HideoutUpgrade + * @param pmcData + * @param body + * @param sessionID + * @returns + */ upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutUpgradeComplete + * @param pmcData + * @param body + * @param sessionID + * @returns + */ upgradeComplete(pmcData: IPmcData, body: IHideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutPutItemsInAreaSlots + * @param pmcData + * @param body + * @param sessionID + * @returns + */ putItemsInAreaSlots(pmcData: IPmcData, body: IHideoutPutItemInRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutTakeItemsFromAreaSlots + * @param pmcData + * @param body + * @param sessionID + * @returns + */ takeItemsFromAreaSlots(pmcData: IPmcData, body: IHideoutTakeItemOutRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutToggleArea + * @param pmcData + * @param body + * @param sessionID + * @returns + */ toggleArea(pmcData: IPmcData, body: IHideoutToggleAreaRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutSingleProductionStart + * @param pmcData + * @param body + * @param sessionID + * @returns + */ singleProductionStart(pmcData: IPmcData, body: IHideoutSingleProductionStartRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutScavCaseProductionStart + * @param pmcData + * @param body + * @param sessionID + * @returns + */ scavCaseProductionStart(pmcData: IPmcData, body: IHideoutScavCaseStartRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutContinuousProductionStart + * @param pmcData + * @param body + * @param sessionID + * @returns + */ continuousProductionStart(pmcData: IPmcData, body: IHideoutContinousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutTakeProduction + * @param pmcData + * @param body + * @param sessionID + * @returns + */ takeProduction(pmcData: IPmcData, body: IHideoutTakeProductionRequestData, sessionID: string): IItemEventRouterResponse; onUpdate(timeSinceLastRun: number): boolean; getRoute(): string; diff --git a/TypeScript/4UseACustomConfigFile/types/callbacks/InraidCallbacks.d.ts b/TypeScript/4UseACustomConfigFile/types/callbacks/InraidCallbacks.d.ts index 05bcce4..918bfaf 100644 --- a/TypeScript/4UseACustomConfigFile/types/callbacks/InraidCallbacks.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/callbacks/InraidCallbacks.d.ts @@ -1,23 +1,49 @@ import { InraidController } from "../controllers/InraidController"; -import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { INullResponseData } from "../models/eft/httpResponse/INullResponseData"; import { IRegisterPlayerRequestData } from "../models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; -import { IAirdropConfig } from "../models/spt/config/IAirdropConfig"; -import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; -import { ConfigServer } from "../servers/ConfigServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +/** + * Handle client requests + */ export declare class InraidCallbacks { protected inraidController: InraidController; protected httpResponse: HttpResponseUtil; - protected configServer: ConfigServer; - protected airdropConfig: IAirdropConfig; - protected inraidConfig: IInRaidConfig; - constructor(inraidController: InraidController, httpResponse: HttpResponseUtil, configServer: ConfigServer); + constructor(inraidController: InraidController, httpResponse: HttpResponseUtil); + /** + * Handle client/location/getLocalloot + * @param url + * @param info register player request + * @param sessionID Session id + * @returns Null http response + */ registerPlayer(url: string, info: IRegisterPlayerRequestData, sessionID: string): INullResponseData; + /** + * Handle raid/profile/save + * @param url + * @param info Save progress request + * @param sessionID Session id + * @returns Null http response + */ saveProgress(url: string, info: ISaveProgressRequestData, sessionID: string): INullResponseData; + /** + * Handle singleplayer/settings/raid/endstate + * @returns + */ getRaidEndState(): string; - getRaidMenuSettings(url: string, info: IEmptyRequestData, sessionID: string): string; - getWeaponDurability(url: string, info: any, sessionID: string): string; - getAirdropConfig(url: string, info: any, sessionID: string): string; + /** + * Handle singleplayer/settings/raid/menu + * @returns JSON as string + */ + getRaidMenuSettings(): string; + /** + * Handle singleplayer/settings/weapon/durability + * @returns + */ + getWeaponDurability(): string; + /** + * Handle singleplayer/airdrop/config + * @returns JSON as string + */ + getAirdropConfig(): string; } diff --git a/TypeScript/4UseACustomConfigFile/types/callbacks/InsuranceCallbacks.d.ts b/TypeScript/4UseACustomConfigFile/types/callbacks/InsuranceCallbacks.d.ts index 8835ba2..a171e1c 100644 --- a/TypeScript/4UseACustomConfigFile/types/callbacks/InsuranceCallbacks.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/callbacks/InsuranceCallbacks.d.ts @@ -17,7 +17,15 @@ export declare class InsuranceCallbacks extends OnUpdate { protected configServer: ConfigServer; protected insuranceConfig: IInsuranceConfig; constructor(insuranceController: InsuranceController, insuranceService: InsuranceService, httpResponse: HttpResponseUtil, configServer: ConfigServer); + /** + * Handle client/insurance/items/list/cost + * @returns IGetInsuranceCostResponseData + */ getInsuranceCost(url: string, info: IGetInsuranceCostRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle Insure + * @returns IItemEventRouterResponse + */ insure(pmcData: IPmcData, body: IInsureRequestData, sessionID: string): IItemEventRouterResponse; onUpdate(secondsSinceLastRun: number): boolean; getRoute(): string; diff --git a/TypeScript/4UseACustomConfigFile/types/callbacks/InventoryCallbacks.d.ts b/TypeScript/4UseACustomConfigFile/types/callbacks/InventoryCallbacks.d.ts index 9ab1486..46bf6fd 100644 --- a/TypeScript/4UseACustomConfigFile/types/callbacks/InventoryCallbacks.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/callbacks/InventoryCallbacks.d.ts @@ -16,6 +16,7 @@ import { IInventorySwapRequestData } from "../models/eft/inventory/IInventorySwa import { IInventoryTagRequestData } from "../models/eft/inventory/IInventoryTagRequestData"; import { IInventoryToggleRequestData } from "../models/eft/inventory/IInventoryToggleRequestData"; import { IInventoryTransferRequestData } from "../models/eft/inventory/IInventoryTransferRequestData"; +import { IOpenRandomLootContainerRequestData } from "../models/eft/inventory/IOpenRandomLootContainerRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; export declare class InventoryCallbacks { protected inventoryController: InventoryController; @@ -36,4 +37,5 @@ export declare class InventoryCallbacks { createMapMarker(pmcData: IPmcData, body: IInventoryCreateMarkerRequestData, sessionID: string): IItemEventRouterResponse; deleteMapMarker(pmcData: IPmcData, body: IInventoryDeleteMarkerRequestData, sessionID: string): IItemEventRouterResponse; editMapMarker(pmcData: IPmcData, body: IInventoryEditMarkerRequestData, sessionID: string): IItemEventRouterResponse; + openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/4UseACustomConfigFile/types/callbacks/ItemEventCallbacks.d.ts b/TypeScript/4UseACustomConfigFile/types/callbacks/ItemEventCallbacks.d.ts index f4f04f9..fbb0b5f 100644 --- a/TypeScript/4UseACustomConfigFile/types/callbacks/ItemEventCallbacks.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/callbacks/ItemEventCallbacks.d.ts @@ -1,4 +1,5 @@ import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; +import { Warning } from "../models/eft/itemEvent/IItemEventRouterBase"; import { IItemEventRouterRequest } from "../models/eft/itemEvent/IItemEventRouterRequest"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { ItemEventRouter } from "../routers/ItemEventRouter"; @@ -8,4 +9,5 @@ export declare class ItemEventCallbacks { protected itemEventRouter: ItemEventRouter; constructor(httpResponse: HttpResponseUtil, itemEventRouter: ItemEventRouter); handleEvents(url: string, info: IItemEventRouterRequest, sessionID: string): IGetBodyResponseData; + protected getErrorCode(warnings: Warning[]): number; } diff --git a/TypeScript/4UseACustomConfigFile/types/callbacks/MatchCallbacks.d.ts b/TypeScript/4UseACustomConfigFile/types/callbacks/MatchCallbacks.d.ts index 2a92ef5..10fbc44 100644 --- a/TypeScript/4UseACustomConfigFile/types/callbacks/MatchCallbacks.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/callbacks/MatchCallbacks.d.ts @@ -34,6 +34,10 @@ export declare class MatchCallbacks { serverAvailable(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData | IGetBodyResponseData; joinMatch(url: string, info: IJoinMatchRequestData, sessionID: string): IGetBodyResponseData; getMetrics(url: string, info: any, sessionID: string): IGetBodyResponseData; + /** + * Handle client/match/group/status + * @returns + */ getGroupStatus(url: string, info: IGetGroupStatusRequestData, sessionID: string): IGetBodyResponseData; createGroup(url: string, info: ICreateGroupRequestData, sessionID: string): IGetBodyResponseData; deleteGroup(url: string, info: any, sessionID: string): INullResponseData; diff --git a/TypeScript/4UseACustomConfigFile/types/callbacks/NotifierCallbacks.d.ts b/TypeScript/4UseACustomConfigFile/types/callbacks/NotifierCallbacks.d.ts index c42058f..fab325b 100644 --- a/TypeScript/4UseACustomConfigFile/types/callbacks/NotifierCallbacks.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/callbacks/NotifierCallbacks.d.ts @@ -4,6 +4,7 @@ import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { INotifierChannel } from "../models/eft/notifier/INotifier"; import { ISelectProfileRequestData } from "../models/eft/notifier/ISelectProfileRequestData"; +import { ISelectProfileResponse } from "../models/eft/notifier/ISelectProfileResponse"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; export declare class NotifierCallbacks { protected httpServerHelper: HttpServerHelper; @@ -19,6 +20,10 @@ export declare class NotifierCallbacks { sendNotification(sessionID: string, req: any, resp: any, data: any): void; getNotifier(url: string, info: any, sessionID: string): IGetBodyResponseData; createNotifierChannel(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - selectProfile(url: string, info: ISelectProfileRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/game/profile/select + * @returns ISelectProfileResponse + */ + selectProfile(url: string, info: ISelectProfileRequestData, sessionID: string): IGetBodyResponseData; notify(url: string, info: any, sessionID: string): string; } diff --git a/TypeScript/4UseACustomConfigFile/types/callbacks/QuestCallbacks.d.ts b/TypeScript/4UseACustomConfigFile/types/callbacks/QuestCallbacks.d.ts index 559c29e..2a3eb20 100644 --- a/TypeScript/4UseACustomConfigFile/types/callbacks/QuestCallbacks.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/callbacks/QuestCallbacks.d.ts @@ -21,6 +21,13 @@ export declare class QuestCallbacks { acceptQuest(pmcData: IPmcData, body: IAcceptQuestRequestData, sessionID: string): IItemEventRouterResponse; completeQuest(pmcData: IPmcData, body: ICompleteQuestRequestData, sessionID: string): IItemEventRouterResponse; handoverQuest(pmcData: IPmcData, body: IHandoverQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle client/quest/list + * @param url + * @param info + * @param sessionID + * @returns + */ listQuests(url: string, info: IListQuestsRequestData, sessionID: string): IGetBodyResponseData; activityPeriods(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; } diff --git a/TypeScript/4UseACustomConfigFile/types/callbacks/RagfairCallbacks.d.ts b/TypeScript/4UseACustomConfigFile/types/callbacks/RagfairCallbacks.d.ts index c609f2f..37f3807 100644 --- a/TypeScript/4UseACustomConfigFile/types/callbacks/RagfairCallbacks.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/callbacks/RagfairCallbacks.d.ts @@ -35,7 +35,7 @@ export declare class RagfairCallbacks extends OnLoadOnUpdate { getRoute(): string; search(url: string, info: ISearchRequestData, sessionID: string): IGetBodyResponseData; getMarketPrice(url: string, info: IGetMarketPriceRequestData, sessionID: string): IGetBodyResponseData; - getItemPrices(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + getItemPrices(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData>; addOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; removeOffer(pmcData: IPmcData, info: IRemoveOfferRequestData, sessionID: string): IItemEventRouterResponse; extendOffer(pmcData: IPmcData, info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; diff --git a/TypeScript/4UseACustomConfigFile/types/callbacks/TraderCallbacks.d.ts b/TypeScript/4UseACustomConfigFile/types/callbacks/TraderCallbacks.d.ts index e4fd099..40a1455 100644 --- a/TypeScript/4UseACustomConfigFile/types/callbacks/TraderCallbacks.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/callbacks/TraderCallbacks.d.ts @@ -12,6 +12,10 @@ export declare class TraderCallbacks extends OnLoadOnUpdate { onUpdate(): boolean; getRoute(): string; getTraderSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/trading/api/getUserAssortPrice/trader + * @returns + */ getProfilePurchases(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData>; getTrader(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getAssort(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; diff --git a/TypeScript/4UseACustomConfigFile/types/callbacks/WeatherCallbacks.d.ts b/TypeScript/4UseACustomConfigFile/types/callbacks/WeatherCallbacks.d.ts index ae784c8..f9d2002 100644 --- a/TypeScript/4UseACustomConfigFile/types/callbacks/WeatherCallbacks.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/callbacks/WeatherCallbacks.d.ts @@ -1,10 +1,15 @@ import { WeatherController } from "../controllers/WeatherController"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; +import { IWeatherData } from "../models/eft/weather/IWeatherData"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; export declare class WeatherCallbacks { protected httpResponse: HttpResponseUtil; protected weatherController: WeatherController; constructor(httpResponse: HttpResponseUtil, weatherController: WeatherController); - getWeather(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/weather + * @returns IWeatherData + */ + getWeather(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; } diff --git a/TypeScript/4UseACustomConfigFile/types/context/ContextVariableType.d.ts b/TypeScript/4UseACustomConfigFile/types/context/ContextVariableType.d.ts index 5fc1704..a7dd9b5 100644 --- a/TypeScript/4UseACustomConfigFile/types/context/ContextVariableType.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/context/ContextVariableType.d.ts @@ -1,4 +1,8 @@ export declare enum ContextVariableType { + /** Logged in users session id */ SESSION_ID = 0, - MATCH_INFO = 1 + /** Currently acive raid information */ + MATCH_INFO = 1, + /** Timestamp when client first connected */ + CLIENT_START_TIMESTAMP = 2 } diff --git a/TypeScript/4UseACustomConfigFile/types/controllers/BotController.d.ts b/TypeScript/4UseACustomConfigFile/types/controllers/BotController.d.ts index a5111d5..92317c3 100644 --- a/TypeScript/4UseACustomConfigFile/types/controllers/BotController.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/controllers/BotController.d.ts @@ -1,6 +1,8 @@ import { ApplicationContext } from "../context/ApplicationContext"; import { BotGenerator } from "../generators/BotGenerator"; +import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { IGenerateBotsRequestData } from "../models/eft/bot/IGenerateBotsRequestData"; import { IBotBase } from "../models/eft/common/tables/IBotBase"; import { IBotCore } from "../models/eft/common/tables/IBotCore"; @@ -10,18 +12,23 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; -import { PmcAiService } from "../services/PmcAiService"; +import { LocalisationService } from "../services/LocalisationService"; +import { JsonUtil } from "../utils/JsonUtil"; export declare class BotController { protected logger: ILogger; protected databaseServer: DatabaseServer; protected botGenerator: BotGenerator; protected botHelper: BotHelper; - protected pmcAiService: PmcAiService; + protected botDifficultyHelper: BotDifficultyHelper; protected botGenerationCacheService: BotGenerationCacheService; + protected localisationService: LocalisationService; + protected weightedRandomHelper: WeightedRandomHelper; protected configServer: ConfigServer; protected applicationContext: ApplicationContext; + protected jsonUtil: JsonUtil; protected botConfig: IBotConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, pmcAiService: PmcAiService, botGenerationCacheService: BotGenerationCacheService, configServer: ConfigServer, applicationContext: ApplicationContext); + static readonly pmcTypeLabel = "PMC"; + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); /** * Return the number of bot loadout varieties to be generated * @param type bot Type we want the loadout gen count for @@ -37,7 +44,6 @@ export declare class BotController { * @returns Difficulty object */ getBotDifficulty(type: string, difficulty: string): Difficulty; - protected getPmcDifficultySettings(pmcType: "bear" | "usec", difficulty: string, usecType: string, bearType: string): Difficulty; /** * Generate bot profiles and store in cache * @param sessionId Session id @@ -51,4 +57,5 @@ export declare class BotController { * @returns cap number */ getBotCap(): number; + getPmcBotTypes(): Record>>; } diff --git a/TypeScript/4UseACustomConfigFile/types/controllers/DialogueController.d.ts b/TypeScript/4UseACustomConfigFile/types/controllers/DialogueController.d.ts index 1b72522..9c8b728 100644 --- a/TypeScript/4UseACustomConfigFile/types/controllers/DialogueController.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/controllers/DialogueController.d.ts @@ -23,7 +23,7 @@ export declare class DialogueController { * Get the content of a dialogue * @param dialogueID Dialog id * @param sessionID Session Id - * @returns + * @returns DialogueInfo */ getDialogueInfo(dialogueID: string, sessionID: string): DialogueInfo; /** diff --git a/TypeScript/4UseACustomConfigFile/types/controllers/GameController.d.ts b/TypeScript/4UseACustomConfigFile/types/controllers/GameController.d.ts index 3bfbdb1..f4f5849 100644 --- a/TypeScript/4UseACustomConfigFile/types/controllers/GameController.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/controllers/GameController.d.ts @@ -1,3 +1,4 @@ +import { ApplicationContext } from "../context/ApplicationContext"; import { GameEventHelper } from "../helpers/GameEventHelper"; import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; @@ -14,6 +15,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; +import { LocalisationService } from "../services/LocalisationService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { Watermark } from "../utils/Watermark"; export declare class GameController { @@ -24,14 +26,33 @@ export declare class GameController { protected localeService: LocaleService; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; + protected localisationService: LocalisationService; protected gameEventHelper: GameEventHelper; + protected applicationContext: ApplicationContext; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; protected coreConfig: ICoreConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, gameEventHelper: GameEventHelper, configServer: ConfigServer); - gameStart(_url: string, _info: IEmptyRequestData, sessionID: string): void; + constructor(logger: ILogger, databaseServer: DatabaseServer, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, gameEventHelper: GameEventHelper, applicationContext: ApplicationContext, configServer: ConfigServer); + gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; + /** + * Check if current date falls inside any of the seasons events pased in, if so, handle them + * @param seasonalEvents events to check for + */ protected checkForAndEnableSeasonalEvents(seasonalEvents: ISeasonalEvent[]): void; + /** + * Make adjusted to server code based on the name of the event passed in + * @param globalConfig globals.json + * @param eventName Name of the event to enable. e.g. Christmas + */ protected updateGlobalEvents(globalConfig: Config, eventName: string): void; + /** + * Read in data from seasonalEvents.json and add found equipment items to bots + * @param eventName Name of the event to read equipment in from config + */ + protected addEventGearToScavs(eventName: string): void; + /** + * Set Khorovod(dancing tree) chance to 100% on all maps that support it + */ protected enableDancingTree(): void; /** * Make non-trigger-spawned raiders spawn earlier + always @@ -40,5 +61,6 @@ export declare class GameController { protected logProfileDetails(fullProfile: IAkiProfile): void; getGameConfig(sessionID: string): IGameConfigResponse; getServer(): IServerDetails[]; + protected addPumpkinsToScavBackpacks(): void; getValidGameVersion(): ICheckVersionResponse; } diff --git a/TypeScript/4UseACustomConfigFile/types/controllers/HideoutController.d.ts b/TypeScript/4UseACustomConfigFile/types/controllers/HideoutController.d.ts index ada5bd9..5b6507b 100644 --- a/TypeScript/4UseACustomConfigFile/types/controllers/HideoutController.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/controllers/HideoutController.d.ts @@ -23,12 +23,13 @@ import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; import { PlayerService } from "../services/PlayerService"; import { HashUtil } from "../utils/HashUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; -import { JsonUtil } from "../utils/JsonUtil"; export declare class HideoutController { protected logger: ILogger; protected hashUtil: HashUtil; @@ -45,11 +46,12 @@ export declare class HideoutController { protected profileHelper: ProfileHelper; protected hideoutHelper: HideoutHelper; protected scavCaseRewardGenerator: ScavCaseRewardGenerator; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected jsonUtil: JsonUtil; protected static nameBackendCountersCrafting: string; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, configServer: ConfigServer, jsonUtil: JsonUtil); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, localisationService: LocalisationService, configServer: ConfigServer, jsonUtil: JsonUtil); upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; upgradeComplete(pmcData: IPmcData, body: HideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; /** diff --git a/TypeScript/4UseACustomConfigFile/types/controllers/InraidController.d.ts b/TypeScript/4UseACustomConfigFile/types/controllers/InraidController.d.ts index e84eea1..39a6396 100644 --- a/TypeScript/4UseACustomConfigFile/types/controllers/InraidController.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/controllers/InraidController.d.ts @@ -6,6 +6,7 @@ import { ProfileHelper } from "../helpers/ProfileHelper"; import { QuestHelper } from "../helpers/QuestHelper"; import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; +import { Item } from "../models/eft/common/tables/IItem"; import { IRegisterPlayerRequestData } from "../models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; import { IAirdropConfig } from "../models/spt/config/IAirdropConfig"; @@ -17,6 +18,9 @@ import { SaveServer } from "../servers/SaveServer"; import { InsuranceService } from "../services/InsuranceService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; +/** + * Logic for handling In Raid callbacks + */ export declare class InraidController { protected logger: ILogger; protected saveServer: SaveServer; @@ -35,14 +39,42 @@ export declare class InraidController { protected airdropConfig: IAirdropConfig; protected inraidConfig: IInRaidConfig; 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 + * Save locationid to active profiles inraid object + * @param sessionID Session id + * @param info Register player request + */ + addPlayer(sessionID: string, info: IRegisterPlayerRequestData): void; + /** + * Save profile state to disk + * Handles pmc/pscav + * @param offraidData post-raid request data + * @param sessionID Session id + */ + savePostRaidProgress(offraidData: ISaveProgressRequestData, sessionID: string): void; + /** + * Handle updating player profile post-pmc raid * @param sessionID session id - * @param offraidData post-raid data of raid + * @param offraidData post-raid data */ protected savePmcProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; + /** + * Make changes to pmc profile after they left raid dead, + * alter bodypart hp, handle insurance, delete inventory items, remove carried quest items + * @param postRaidSaveRequest post-raid save request + * @param pmcData pmc profile + * @param insuranceEnabled is insurance enabled + * @param preRaidGear gear player had before raid + * @param sessionID Session id + * @returns Updated profile object + */ + protected performPostRaidActionsWhenDead(postRaidSaveRequest: ISaveProgressRequestData, pmcData: IPmcData, insuranceEnabled: boolean, preRaidGear: Item[], sessionID: string): IPmcData; + /** + * Adjust player characters bodypart hp if they left raid early + * @param postRaidSaveRequest post raid data + * @param pmcData player profile + */ + protected updatePmcHealthPostRaid(postRaidSaveRequest: ISaveProgressRequestData, pmcData: IPmcData): void; /** * Reduce body part hp to % of max * @param pmcData profile to edit @@ -68,7 +100,31 @@ export declare class InraidController { * @param isPlayerScav Was the player a pScav */ protected markOrRemoveFoundInRaidItems(offraidData: ISaveProgressRequestData, pmcData: IPmcData, isPlayerScav: boolean): void; + /** + * Update profile after player completes scav raid + * @param scavData Scav profile + * @param sessionID Session id + * @param offraidData Post-raid save request + * @param pmcData Pmc profile + * @param isDead Is player dead + */ protected handlePostRaidPlayerScavProcess(scavData: IPmcData, sessionID: string, offraidData: ISaveProgressRequestData, pmcData: IPmcData, isDead: boolean): void; + /** + * Update profile with scav karma values based on in-raid actions + * @param pmcData Pmc profile + * @param offraidData Post-raid save request + * @param scavData Scav profile + * @param sessionID Session id + */ protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData, scavData: IPmcData, sessionID: string): void; + /** + * Get the inraid config from configs/inraid.json + * @returns InRaid Config + */ + getInraidConfig(): IInRaidConfig; + /** + * Get airdrop config from configs/airdrop.json + * @returns Airdrop config + */ getAirdropConfig(): IAirdropConfig; } diff --git a/TypeScript/4UseACustomConfigFile/types/controllers/InsuranceController.d.ts b/TypeScript/4UseACustomConfigFile/types/controllers/InsuranceController.d.ts index 14bf129..54f31b5 100644 --- a/TypeScript/4UseACustomConfigFile/types/controllers/InsuranceController.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/controllers/InsuranceController.d.ts @@ -30,8 +30,7 @@ export declare class InsuranceController { protected insuranceService: InsuranceService; protected configServer: ConfigServer; protected insuranceConfig: IInsuranceConfig; - constructor(logger: ILogger, randomUtil: RandomUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, paymentService: PaymentService, // TODO: delay required - insuranceService: InsuranceService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, paymentService: PaymentService, insuranceService: InsuranceService, configServer: ConfigServer); processReturn(): void; insure(pmcData: IPmcData, body: IInsureRequestData, sessionID: string): IItemEventRouterResponse; /** diff --git a/TypeScript/4UseACustomConfigFile/types/controllers/InventoryController.d.ts b/TypeScript/4UseACustomConfigFile/types/controllers/InventoryController.d.ts index 6a1a21e..e1c08c0 100644 --- a/TypeScript/4UseACustomConfigFile/types/controllers/InventoryController.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/controllers/InventoryController.d.ts @@ -1,8 +1,8 @@ -import { EventOutputHolder } from "../routers/EventOutputHolder"; import { InventoryHelper } from "../helpers/InventoryHelper"; import { PaymentHelper } from "../helpers/PaymentHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IAddItemRequestData } from "../models/eft/inventory/IAddItemRequestData"; import { IInventoryBindRequestData } from "../models/eft/inventory/IInventoryBindRequestData"; @@ -21,33 +21,46 @@ import { IInventorySwapRequestData } from "../models/eft/inventory/IInventorySwa import { IInventoryTagRequestData } from "../models/eft/inventory/IInventoryTagRequestData"; import { IInventoryToggleRequestData } from "../models/eft/inventory/IInventoryToggleRequestData"; import { IInventoryTransferRequestData } from "../models/eft/inventory/IInventoryTransferRequestData"; +import { IOpenRandomLootContainerRequestData } from "../models/eft/inventory/IOpenRandomLootContainerRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { ILogger } from "../models/spt/utils/ILogger"; +import { EventOutputHolder } from "../routers/EventOutputHolder"; import { DatabaseServer } from "../servers/DatabaseServer"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { HashUtil } from "../utils/HashUtil"; +import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { JsonUtil } from "../utils/JsonUtil"; +import { RandomUtil } from "../utils/RandomUtil"; export declare class InventoryController { protected logger: ILogger; protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; + protected randomUtil: RandomUtil; protected databaseServer: DatabaseServer; protected fenceService: FenceService; protected presetHelper: PresetHelper; protected inventoryHelper: InventoryHelper; protected ragfairOfferService: RagfairOfferService; protected profileHelper: ProfileHelper; + protected weightedRandomHelper: WeightedRandomHelper; protected paymentHelper: PaymentHelper; + protected localisationService: LocalisationService; protected eventOutputHolder: EventOutputHolder; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder); + protected httpResponseUtil: HttpResponseUtil; + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, weightedRandomHelper: WeightedRandomHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); /** * Move Item * change location of item with parentId and slotId * transfers items from one profile to another if fromOwner/toOwner is set in the body. * otherwise, move is contained within the same profile_f. - */ - moveItem(pmcData: IPmcData, body: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; + * @param pmcData Profile + * @param moveRequest Move request data + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ + moveItem(pmcData: IPmcData, moveRequest: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; /** * Remove Item from Profile * Deep tree item deletion, also removes items from insurance list @@ -122,4 +135,12 @@ export declare class InventoryController { createMapMarker(pmcData: IPmcData, body: IInventoryCreateMarkerRequestData, sessionID: string): IItemEventRouterResponse; deleteMapMarker(pmcData: IPmcData, body: IInventoryDeleteMarkerRequestData, sessionID: string): IItemEventRouterResponse; editMapMarker(pmcData: IPmcData, body: IInventoryEditMarkerRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle event fired when a container is unpacked (currently only the halloween pumpkin) + * @param pmcData Profile data + * @param body open loot container request data + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ + openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/4UseACustomConfigFile/types/controllers/LocationController.d.ts b/TypeScript/4UseACustomConfigFile/types/controllers/LocationController.d.ts index 9db3205..b6feba8 100644 --- a/TypeScript/4UseACustomConfigFile/types/controllers/LocationController.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/controllers/LocationController.d.ts @@ -7,6 +7,7 @@ import { LootItem } from "../models/spt/services/LootItem"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -15,12 +16,13 @@ export declare class LocationController { protected hashUtil: HashUtil; protected logger: ILogger; protected locationGenerator: LocationGenerator; + protected localisationService: LocalisationService; protected lootGenerator: LootGenerator; protected databaseServer: DatabaseServer; protected timeUtil: TimeUtil; protected configServer: ConfigServer; protected airdropConfig: IAirdropConfig; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, logger: ILogger, locationGenerator: LocationGenerator, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer); + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer); get(location: string): ILocationBase; generate(name: string): ILocationBase; generateAll(): ILocationsGenerateAllResponse; diff --git a/TypeScript/4UseACustomConfigFile/types/controllers/MatchController.d.ts b/TypeScript/4UseACustomConfigFile/types/controllers/MatchController.d.ts index dac6a3f..2b0d150 100644 --- a/TypeScript/4UseACustomConfigFile/types/controllers/MatchController.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/controllers/MatchController.d.ts @@ -19,7 +19,6 @@ import { SaveServer } from "../servers/SaveServer"; import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; import { BotLootCacheService } from "../services/BotLootCacheService"; import { MatchLocationService } from "../services/MatchLocationService"; -import { PmcAiService } from "../services/PmcAiService"; import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; export declare class MatchController { protected logger: ILogger; @@ -30,13 +29,12 @@ export declare class MatchController { protected botLootCacheService: BotLootCacheService; protected configServer: ConfigServer; protected profileSnapshotService: ProfileSnapshotService; - protected pmcAiService: PmcAiService; protected botGenerationCacheService: BotGenerationCacheService; 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, pmcAiService: PmcAiService, botGenerationCacheService: BotGenerationCacheService, applicationContext: ApplicationContext); + constructor(logger: ILogger, saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, botGenerationCacheService: BotGenerationCacheService, applicationContext: ApplicationContext); getEnabled(): boolean; getProfile(info: IGetProfileRequestData): IPmcData[]; createGroup(sessionID: string, info: ICreateGroupRequestData): any; diff --git a/TypeScript/4UseACustomConfigFile/types/controllers/RagfairController.d.ts b/TypeScript/4UseACustomConfigFile/types/controllers/RagfairController.d.ts index 5440458..95702f2 100644 --- a/TypeScript/4UseACustomConfigFile/types/controllers/RagfairController.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/controllers/RagfairController.d.ts @@ -29,6 +29,7 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { RagfairServer } from "../servers/RagfairServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; import { PaymentService } from "../services/PaymentService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { RagfairPriceService } from "../services/RagfairPriceService"; @@ -62,9 +63,10 @@ export declare class RagfairController { protected ragfairOfferService: RagfairOfferService; protected ragfairRequiredItemsService: RagfairRequiredItemsService; protected ragfairOfferGenerator: RagfairOfferGenerator; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, eventOutputHolder: EventOutputHolder, ragfairServer: RagfairServer, ragfairPriceService: RagfairPriceService, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer, ragfairSellHelper: RagfairSellHelper, ragfairTaxHelper: RagfairTaxHelper, ragfairSortHelper: RagfairSortHelper, ragfairOfferHelper: RagfairOfferHelper, profileHelper: ProfileHelper, paymentService: PaymentService, handbookHelper: HandbookHelper, paymentHelper: PaymentHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, ragfairOfferGenerator: RagfairOfferGenerator, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, eventOutputHolder: EventOutputHolder, ragfairServer: RagfairServer, ragfairPriceService: RagfairPriceService, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer, ragfairSellHelper: RagfairSellHelper, ragfairTaxHelper: RagfairTaxHelper, ragfairSortHelper: RagfairSortHelper, ragfairOfferHelper: RagfairOfferHelper, profileHelper: ProfileHelper, paymentService: PaymentService, handbookHelper: HandbookHelper, paymentHelper: PaymentHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, ragfairOfferGenerator: RagfairOfferGenerator, localisationService: LocalisationService, configServer: ConfigServer); getOffers(sessionID: string, info: ISearchRequestData): IGetOffersResult; /** * Get offers for the client based on type of search being performed @@ -103,7 +105,12 @@ export declare class RagfairController { protected isLinkedSearch(info: ISearchRequestData): boolean; protected isRequiredSearch(info: ISearchRequestData): boolean; update(): void; - getItemPrice(info: IGetMarketPriceRequestData): IGetItemPriceResult; + /** + * Called when creating an offer on flea, fills values in top right corner + * @param getPriceRequest + * @returns min/avg/max values for an item based on flea offers available + */ + getItemMinAvgMaxFleaPriceValues(getPriceRequest: IGetMarketPriceRequestData): IGetItemPriceResult; addPlayerOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; createPlayerOffer(profile: IAkiProfile, requirements: Requirement[], items: Item[], sellInOnePiece: boolean, amountToSend: number): IRagfairOffer; getAllFleaPrices(): Record; diff --git a/TypeScript/4UseACustomConfigFile/types/controllers/RepeatableQuestController.d.ts b/TypeScript/4UseACustomConfigFile/types/controllers/RepeatableQuestController.d.ts index 7db5886..333583b 100644 --- a/TypeScript/4UseACustomConfigFile/types/controllers/RepeatableQuestController.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/controllers/RepeatableQuestController.d.ts @@ -17,6 +17,7 @@ import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { ItemFilterService } from "../services/ItemFilterService"; +import { LocalisationService } from "../services/LocalisationService"; import { PaymentService } from "../services/PaymentService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { JsonUtil } from "../utils/JsonUtil"; @@ -64,12 +65,13 @@ export declare class RepeatableQuestController { protected profileFixerService: ProfileFixerService; protected ragfairServerHelper: RagfairServerHelper; protected eventOutputHolder: EventOutputHolder; + protected localisationService: LocalisationService; protected paymentService: PaymentService; protected objectId: ObjectId; protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * This is the method reached by the /client/repeatalbeQuests/activityPeriods endpoint * Returns an array of objects in the format of repeatable quests to the client. diff --git a/TypeScript/4UseACustomConfigFile/types/controllers/WeatherController.d.ts b/TypeScript/4UseACustomConfigFile/types/controllers/WeatherController.d.ts index ca7f5eb..631a90c 100644 --- a/TypeScript/4UseACustomConfigFile/types/controllers/WeatherController.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/controllers/WeatherController.d.ts @@ -1,11 +1,18 @@ import { WeatherGenerator } from "../generators/WeatherGenerator"; import { IWeatherData } from "../models/eft/weather/IWeatherData"; import { IWeatherConfig } from "../models/spt/config/IWeatherConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; export declare class WeatherController { protected weatherGenerator: WeatherGenerator; + protected logger: ILogger; protected configServer: ConfigServer; protected weatherConfig: IWeatherConfig; - constructor(weatherGenerator: WeatherGenerator, configServer: ConfigServer); + constructor(weatherGenerator: WeatherGenerator, logger: ILogger, configServer: ConfigServer); generate(): IWeatherData; + /** + * Get the current in-raid time (MUST HAVE PLAYER LOGGED INTO CLIENT TO WORK) + * @returns Date object + */ + getCurrentInRaidTime(): Date; } diff --git a/TypeScript/4UseACustomConfigFile/types/generators/BotGenerator.d.ts b/TypeScript/4UseACustomConfigFile/types/generators/BotGenerator.d.ts index 2ac51db..a1ac9ed 100644 --- a/TypeScript/4UseACustomConfigFile/types/generators/BotGenerator.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/generators/BotGenerator.d.ts @@ -1,7 +1,8 @@ +import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; import { GameEventHelper } from "../helpers/GameEventHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; -import { IGenerateBotsRequestData } from "../models/eft/bot/IGenerateBotsRequestData"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { Health as PmcHealth, IBotBase, Skills } from "../models/eft/common/tables/IBotBase"; import { Health, IBotType, Inventory } from "../models/eft/common/tables/IBotType"; import { IBotConfig } from "../models/spt/config/IBotConfig"; @@ -9,7 +10,6 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; -import { PmcAiService } from "../services/PmcAiService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; @@ -29,12 +29,13 @@ export declare class BotGenerator { protected databaseServer: DatabaseServer; protected botInventoryGenerator: BotInventoryGenerator; protected botEquipmentFilterService: BotEquipmentFilterService; + protected weightedRandomHelper: WeightedRandomHelper; protected botHelper: BotHelper; + protected botDifficultyHelper: BotDifficultyHelper; protected gameEventHelper: GameEventHelper; - protected pmcAiService: PmcAiService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botEquipmentFilterService: BotEquipmentFilterService, botHelper: BotHelper, gameEventHelper: GameEventHelper, pmcAiService: PmcAiService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botEquipmentFilterService: BotEquipmentFilterService, weightedRandomHelper: WeightedRandomHelper, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, gameEventHelper: GameEventHelper, configServer: ConfigServer); /** * Generate a player scav bot object * @param role e.g. assault / pmcbot @@ -44,12 +45,18 @@ export declare class BotGenerator { */ generatePlayerScav(sessionId: string, role: string, difficulty: string, botTemplate: IBotType): IBotBase; /** - * Generate an array of bot objects for populate a raid with + * Generate an array of bot objects based on a condition for a raid with * @param sessionId session id - * @param info request object + * @param condition request condition * @returns bot array */ - generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; + generateByCondition(sessionId: string, botCountToGenerate: number, difficulty: string, role: string, isPmc: boolean): IBotBase[]; + /** + * Get the PMCs wildSpawnType value + * @param role "usec" / "bear" + * @returns wildSpawnType value as string + */ + protected getPmcRoleByDescription(role: string): string; /** * Get a randomised PMC side based on bot config value 'isUsec' * @returns pmc side as string @@ -64,13 +71,13 @@ export declare class BotGenerator { * Create a IBotBase object with equipment/loot/exp etc * @param sessionId Session id * @param bot bots base file - * @param role botRole bot will use + * @param botRole Role bot will use (bear/usec for PMCs) * @param node Bot template from db/bots/x.json * @param isPmc Is bot to be a PMC * @param isPlayerScav is bot to be a p scav bot * @returns IBotBase object */ - protected generateBot(sessionId: string, bot: IBotBase, role: string, node: IBotType, isPmc: boolean, isPlayerScav?: boolean): IBotBase; + protected generateBot(sessionId: string, bot: IBotBase, botRole: string, node: IBotType, isPmc: boolean, isPlayerScav?: boolean): IBotBase; /** * Log the number of PMCs generated to the debug console * @param output Generated bot array, ready to send to client diff --git a/TypeScript/4UseACustomConfigFile/types/generators/BotInventoryGenerator.d.ts b/TypeScript/4UseACustomConfigFile/types/generators/BotInventoryGenerator.d.ts index c5ed545..e1efaf2 100644 --- a/TypeScript/4UseACustomConfigFile/types/generators/BotInventoryGenerator.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/generators/BotInventoryGenerator.d.ts @@ -7,6 +7,7 @@ import { IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { BotLootGenerator } from "./BotLootGenerator"; @@ -20,14 +21,68 @@ export declare class BotInventoryGenerator { protected botLootGenerator: BotLootGenerator; protected botGeneratorHelper: BotGeneratorHelper; protected weightedRandomHelper: WeightedRandomHelper; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, configServer: ConfigServer); + /** + * Add equipment/weapons/loot to bot + * @param sessionId Session id + * @param templateInventory bot/x.json data from db + * @param equipmentChances Chances each item will be added to bot + * @param itemGenerationLimitsMinMax item gen limits for bot role + * @param botRole Role bot has (assault/pmcBot) + * @param isPmc Is bot being converted into a pmc + * @returns PmcInventory object with equipment/weapons/loot + */ generateInventory(sessionId: string, templateInventory: Inventory, equipmentChances: Chances, itemGenerationLimitsMinMax: Generation, botRole: string, isPmc: boolean): PmcInventory; + /** + * Create a pmcInventory object with all the base/generic items needed + * @returns PmcInventory object + */ + protected generateInventoryBase(): PmcInventory; + /** + * Add equipment to a bot + * @param templateInventory bot/x.json data from db + * @param equipmentChances Chances items will be added to bot + * @param botRole Role bot has (assault/pmcBot) + * @param botInventory Inventory to add equipment to + */ + protected generateAndAddEquipmentToBot(templateInventory: Inventory, equipmentChances: Chances, botRole: string, botInventory: PmcInventory): void; + protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory): void; + /** + * Work out what weapons bot should have equipped and add them to bot inventory + * @param templateInventory bot/x.json data from db + * @param equipmentChances Chances bot can have equipment equipped + * @param sessionId Session id + * @param botInventory Inventory to add weapons to + * @param botRole assault/pmcBot/bossTagilla etc + * @param isPmc Is the bot being generated as a pmc + * @param itemGenerationLimitsMinMax Limits for items the bot can have + */ + protected generateAndAddWeaponsToBot(templateInventory: Inventory, equipmentChances: Chances, sessionId: string, botInventory: PmcInventory, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation): void; + /** + * Calculate if the bot should have weapons in Primary/Secondary/Holster slots + * @param equipmentChances Chances bot has certain equipment + * @returns What slots bot should have weapons generated for + */ + protected getDesiredWeaponsForBot(equipmentChances: Chances): { + slot: EquipmentSlots; + shouldSpawn: boolean; + }[]; + /** + * Add weapon + spare mags/ammo to bots inventory + * @param sessionId Session id + * @param weaponSlot Weapon slot being generated + * @param templateInventory bot/x.json data from db + * @param botInventory Inventory to add weapon+mags/ammo to + * @param equipmentChances Chances bot can have equipment equipped + * @param botRole assault/pmcBot/bossTagilla etc + * @param isPmc Is the bot being generated as a pmc + * @param itemGenerationLimitsMinMax + */ protected addWeaponAndMagazinesToInventory(sessionId: string, weaponSlot: { slot: EquipmentSlots; shouldSpawn: boolean; }, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation): void; - protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory): void; - protected generateInventoryBase(): PmcInventory; } diff --git a/TypeScript/4UseACustomConfigFile/types/generators/BotLootGenerator.d.ts b/TypeScript/4UseACustomConfigFile/types/generators/BotLootGenerator.d.ts index c1f5310..3352a46 100644 --- a/TypeScript/4UseACustomConfigFile/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/generators/BotLootGenerator.d.ts @@ -10,6 +10,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotLootCacheService } from "../services/BotLootCacheService"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { BotWeaponGenerator } from "./BotWeaponGenerator"; @@ -23,9 +24,10 @@ export declare class BotLootGenerator { protected botWeaponGenerator: BotWeaponGenerator; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected botLootCacheService: BotLootCacheService; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, configServer: ConfigServer); generateLoot(sessionId: string, templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances): void; protected getRandomisedCount(min: number, max: number, nValue: number): number; /** @@ -113,7 +115,7 @@ export declare class BotLootGenerator { * If no limit found for a non pmc bot, fall back to defaults * @param isPmc is the bot we want limits for a pmc * @param botRole what role does the bot have - * @returns dictionary of tplIds and limit + * @returns Dictionary of tplIds and limit */ protected getItemSpawnLimitsForBotType(isPmc: boolean, botRole: string): Record; /** diff --git a/TypeScript/4UseACustomConfigFile/types/generators/BotWeaponGenerator.d.ts b/TypeScript/4UseACustomConfigFile/types/generators/BotWeaponGenerator.d.ts index 487901b..40284ea 100644 --- a/TypeScript/4UseACustomConfigFile/types/generators/BotWeaponGenerator.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/generators/BotWeaponGenerator.d.ts @@ -12,6 +12,7 @@ import { IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; @@ -27,10 +28,11 @@ export declare class BotWeaponGenerator { protected randomUtil: RandomUtil; protected configServer: ConfigServer; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected localisationService: LocalisationService; protected inventoryMagGenComponents: IInventoryMagGen[]; protected readonly modMagazineSlotId = "mod_magazine"; protected botConfig: IBotConfig; - constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil, configServer: ConfigServer, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, inventoryMagGenComponents: IInventoryMagGen[]); + constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil, configServer: ConfigServer, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, inventoryMagGenComponents: IInventoryMagGen[]); /** * Pick a random weapon based on weightings and generate a functional weapon * @param equipmentSlot Primary/secondary/holster diff --git a/TypeScript/4UseACustomConfigFile/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/4UseACustomConfigFile/types/generators/RagfairOfferGenerator.d.ts index b64a7e7..23882d2 100644 --- a/TypeScript/4UseACustomConfigFile/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/generators/RagfairOfferGenerator.d.ts @@ -1,16 +1,19 @@ +import { HandbookHelper } from "../helpers/HandbookHelper"; import { ItemHelper } from "../helpers/ItemHelper"; +import { PaymentHelper } from "../helpers/PaymentHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; import { Item } from "../models/eft/common/tables/IItem"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { IBarterScheme } from "../models/eft/common/tables/ITrader"; -import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; +import { IRagfairOffer, OfferRequirement } from "../models/eft/ragfair/IRagfairOffer"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { RagfairCategoriesService } from "../services/RagfairCategoriesService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { RagfairPriceService } from "../services/RagfairPriceService"; @@ -27,18 +30,31 @@ export declare class RagfairOfferGenerator { protected timeUtil: TimeUtil; protected databaseServer: DatabaseServer; protected ragfairServerHelper: RagfairServerHelper; + protected handbookHelper: HandbookHelper; protected saveServer: SaveServer; protected presetHelper: PresetHelper; protected ragfairAssortGenerator: RagfairAssortGenerator; protected ragfairOfferService: RagfairOfferService; protected ragfairPriceService: RagfairPriceService; + protected localisationService: LocalisationService; + protected paymentHelper: PaymentHelper; protected ragfairCategoriesService: RagfairCategoriesService; protected fenceService: FenceService; protected itemHelper: ItemHelper; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, ragfairServerHelper: RagfairServerHelper, saveServer: SaveServer, presetHelper: PresetHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferService: RagfairOfferService, ragfairPriceService: RagfairPriceService, ragfairCategoriesService: RagfairCategoriesService, fenceService: FenceService, itemHelper: ItemHelper, configServer: ConfigServer); + protected allowedFleaPriceItemsForBarter: { + tpl: string; + price: number; + }[]; + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, ragfairServerHelper: RagfairServerHelper, handbookHelper: HandbookHelper, saveServer: SaveServer, presetHelper: PresetHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferService: RagfairOfferService, ragfairPriceService: RagfairPriceService, localisationService: LocalisationService, paymentHelper: PaymentHelper, ragfairCategoriesService: RagfairCategoriesService, fenceService: FenceService, itemHelper: ItemHelper, configServer: ConfigServer); createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; + /** + * Calculate the offer price that's listed on the flea listing + * @param offerRequirements barter requirements for offer + * @returns rouble cost of offer + */ + protected calculateOfferListingPrice(offerRequirements: OfferRequirement[]): number; /** * Get avatar url from trader table in db * @param isTrader Is user we're getting avatar for a trader @@ -87,20 +103,36 @@ export declare class RagfairOfferGenerator { * @returns Item with conditions added */ protected addMissingCondition(item: Item): Item; - protected getOfferRequirements(items: Item[]): { - count: number; - _tpl: string; + /** + * Create a barter-based barter scheme, if not possible, fall back to making barter scheme currency based + * @param offerItems Items for sale in offer + * @returns barter scheme + */ + protected createBarterRequirement(offerItems: Item[]): IBarterScheme[]; + /** + * Get an array of flea prices + item tpl, cached in generator class + * @returns array with tpl/price values + */ + protected getFleaPricesAsArray(): { + tpl: string; + price: number; }[]; + /** + * Create a random currency-based barter scheme for an array of items + * @param offerItems Items on offer + * @returns Barter scheme for offer + */ + protected createCurrencyRequirement(offerItems: Item[]): IBarterScheme[]; /** * Create a flea offer and store it in the Ragfair server offers array * @param userID owner of the offer * @param time time offer is put up * @param items items in the offer - * @param barterScheme - * @param loyalLevel + * @param barterScheme cost of item (currency or barter) + * @param loyalLevel Loyalty level needed to buy item * @param price price of offer * @param sellInOnePiece - * @returns + * @returns Ragfair offer */ createFleaOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; } diff --git a/TypeScript/4UseACustomConfigFile/types/generators/WeatherGenerator.d.ts b/TypeScript/4UseACustomConfigFile/types/generators/WeatherGenerator.d.ts index 8ddbe49..65d2c76 100644 --- a/TypeScript/4UseACustomConfigFile/types/generators/WeatherGenerator.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/generators/WeatherGenerator.d.ts @@ -1,38 +1,54 @@ +import { ApplicationContext } from "../context/ApplicationContext"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; -import { IWeatherData } from "../models/eft/weather/IWeatherData"; +import { IWeather, IWeatherData } from "../models/eft/weather/IWeatherData"; +import { WindDirection } from "../models/enums/WindDirection"; import { IWeatherConfig } from "../models/spt/config/IWeatherConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class WeatherGenerator { protected weightedRandomHelper: WeightedRandomHelper; + protected logger: ILogger; protected randomUtil: RandomUtil; protected timeUtil: TimeUtil; + protected applicationContext: ApplicationContext; protected configServer: ConfigServer; protected weatherConfig: IWeatherConfig; - constructor(weightedRandomHelper: WeightedRandomHelper, randomUtil: RandomUtil, timeUtil: TimeUtil, configServer: ConfigServer); - calculateTime(data: IWeatherData): IWeatherData; + constructor(weightedRandomHelper: WeightedRandomHelper, logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, applicationContext: ApplicationContext, configServer: ConfigServer); + calculateGameTime(data: IWeatherData): IWeatherData; /** * Get server uptime seconds multiplied by a multiplier and add to current time as seconds * Format to BSGs requirements - * @param computedDate current date + * @param currentDate current date * @returns formatted time */ - protected getAcceleratedTime(computedDate: Date): string; + protected getBsgFormattedInRaidTime(currentDate: Date): string; + /** + * Get the current in-raid time + * @param currentDate (new Date()) + * @returns Date object of current in-raid time + */ + getInRaidTime(currentDate: Date): Date; /** * Get current time formatted to fit BSGs requirement - * @param computedDate date to format into bsg style + * @param date date to format into bsg style * @returns */ - protected getNormalTime(computedDate: Date): string; + protected getBSGFormattedTime(date: Date): string; /** - * Return randomised Weather data - * @param weatherData weather input data + * Return randomised Weather data with help of config/weather.json * @returns Randomised weather data */ - generateWeather(weatherData: IWeatherData): IWeatherData; - protected getWeightedFog(): string; + generateWeather(): IWeather; + /** + * Set IWeather date/time/timestamp values to now + * @param weather Object to update + */ + protected setCurrentDateTime(weather: IWeather): void; + protected getWeightedWindDirection(): WindDirection; + protected getWeightedWindSpeed(): number; + protected getWeightedFog(): number; protected getWeightedRain(): number; protected getRandomFloat(node: string): number; - protected getRandomInt(node: string): number; } diff --git a/TypeScript/4UseACustomConfigFile/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts b/TypeScript/4UseACustomConfigFile/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts index 4fcb1e2..1589707 100644 --- a/TypeScript/4UseACustomConfigFile/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts @@ -1,13 +1,15 @@ import { BotWeaponGeneratorHelper } from "../../../helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "../../../helpers/ItemHelper"; import { ILogger } from "../../../models/spt/utils/ILogger"; +import { LocalisationService } from "../../../services/LocalisationService"; import { IInventoryMagGen } from "../IInventoryMagGen"; import { InventoryMagGen } from "../InventoryMagGen"; export declare class ExternalInventoryMagGen implements IInventoryMagGen { protected logger: ILogger; protected itemHelper: ItemHelper; + protected localisationService: LocalisationService; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; - constructor(logger: ILogger, itemHelper: ItemHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper); + constructor(logger: ILogger, itemHelper: ItemHelper, localisationService: LocalisationService, botWeaponGeneratorHelper: BotWeaponGeneratorHelper); getPriority(): number; canHandleInventoryMagGen(inventoryMagGen: InventoryMagGen): boolean; process(inventoryMagGen: InventoryMagGen): void; diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/BotDifficultyHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/BotDifficultyHelper.d.ts new file mode 100644 index 0000000..a58ebdb --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/helpers/BotDifficultyHelper.d.ts @@ -0,0 +1,46 @@ +import { Difficulty } from "../models/eft/common/tables/IBotType"; +import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; +import { JsonUtil } from "../utils/JsonUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +import { BotHelper } from "./BotHelper"; +export declare class BotDifficultyHelper { + protected logger: ILogger; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected randomUtil: RandomUtil; + protected localisationService: LocalisationService; + protected botHelper: BotHelper; + protected configServer: ConfigServer; + protected botConfig: IBotConfig; + constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, localisationService: LocalisationService, botHelper: BotHelper, configServer: ConfigServer); + getPmcDifficultySettings(pmcType: "bear" | "usec", difficulty: string, usecType: string, bearType: string): Difficulty; + /** + * Get difficulty settings for desired bot type, if not found use assault bot types + * @param type bot type to retreive difficulty of + * @param difficulty difficulty to get settings for (easy/normal etc) + * @returns Difficulty object + */ + getBotDifficultySettings(type: string, difficulty: string): Difficulty; + /** + * Get difficulty settings for a PMC + * @param type "usec" / "bear" + * @param difficulty what difficulty to retrieve + * @returns Difficulty object + */ + protected getDifficultySettings(type: string, difficulty: string): Difficulty; + /** + * Translate chosen value from pre-raid difficulty dropdown into bot difficulty value + * @param dropDownDifficulty Dropdown difficulty value to convert + * @returns bot difficulty + */ + convertBotDifficultyDropdownToBotDifficulty(dropDownDifficulty: string): string; + /** + * Choose a random difficulty from - easy/normal/hard/impossible + * @returns random difficulty + */ + chooseRandomDifficulty(): string; +} diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/BotGeneratorHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/BotGeneratorHelper.d.ts index 5e3e501..899669e 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/BotGeneratorHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/BotGeneratorHelper.d.ts @@ -8,6 +8,7 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; import { ItemFilterService } from "../services/ItemFilterService"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; @@ -43,9 +44,10 @@ export declare class BotGeneratorHelper { protected itemFilterService: ItemFilterService; protected profileHelper: ProfileHelper; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Check mods are compatible and add to array * @param equipment Equipment item to add mods to @@ -53,9 +55,11 @@ export declare class BotGeneratorHelper { * @param parentId parentid of item to add mod to * @param parentTemplate template objet of item to add mods to * @param modSpawnChances dictionary of mod items and their chance to spawn for this bot type + * @param botRole the bot role being generated for + * @param forceSpawn should this mod be forced to spawn * @returns Item + compatible mods as an array */ - generateModsForEquipment(equipment: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances): Item[]; + generateModsForEquipment(equipment: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances, botRole: string, forceSpawn?: boolean): Item[]; /** * @param sessionId session id * @param weapon Weapon to add mods to @@ -70,15 +74,15 @@ export declare class BotGeneratorHelper { generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponParentId: string, parentWeaponTemplate: ITemplateItem, modSpawnChances: ModsChances, ammoTpl: string, botRole: string): Item[]; /** * - * @param modSlot - * @param isRandomisableSlot - * @param modsParent - * @param botEquipBlacklist - * @param itemModPool + * @param modSlot Slot mod will fit into + * @param isRandomisableSlot Will generate a randomised mod pool if true + * @param modsParent Parent slot the item will be a part of + * @param botEquipBlacklist Blacklist to prevent mods from being picked + * @param itemModPool Pool of items to pick from * @param weapon array with only weapon tpl in it, ready for mods to be added * @param ammoTpl ammo tpl to use if slot requires a cartridge to be added (e.g. mod_magazine) - * @param parentTemplate - * @returns + * @param parentTemplate Parent item the mod will go into + * @returns ITemplateItem */ protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, modsParent: Slot, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem): [boolean, ITemplateItem]; /** @@ -114,8 +118,10 @@ export declare class BotGeneratorHelper { * Find all compatible mods for equipment item and add to modPool * @param itemDetails item to find mods for * @param modPool ModPool to add mods to + * @param equipmentBlacklist equipment not allowed to be used by the bot + * @param botEquipmentRole bot type to generate pool for (e.g. assault, pmcBot, pmc for usec/bear) */ - generateDynamicModPool(itemDetails: ITemplateItem, modPool: Mods): void; + generateDynamicModPool(itemDetails: ITemplateItem, modPool: Mods, equipmentBlacklist: EquipmentFilterDetails[], botEquipmentRole: string): void; /** * Take a list of tpls and filter out blacklisted values using itemFilterService + botEquipmentBlacklist * @param allowedMods base mods to filter @@ -153,7 +159,7 @@ export declare class BotGeneratorHelper { * @param modTemplate Used to add additional properites in the upd object * @returns Item object */ - protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem): Item; + protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem, botRole: string): Item; /** * randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot * never return true for an item that has 0% spawn chance @@ -170,10 +176,10 @@ export declare class BotGeneratorHelper { */ protected getAmmoContainers(): string[]; /** - * Get the slot details for an item (chamber/cartridge/slot) + * Get a Slot property for an item (chamber/cartridge/slot) * @param modSlot e.g patron_in_weapon * @param parentTemplate item template - * @returns + * @returns Slot item */ protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; /** @@ -185,7 +191,6 @@ export declare class BotGeneratorHelper { * @param modPool modPool which should include available cartrigdes * @param parentId The CylinderMagazine's UID * @param parentTemplate The CylinderMagazine's template - * @returns */ protected fillCamora(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem): void; /** @@ -197,11 +202,11 @@ export declare class BotGeneratorHelper { /** * Adds properties to an item * e.g. Repairable / HasHinge / Foldable / MaxDurability - * @param itemTemplate - * @param botRole Used by weapons to randomise the durability values + * @param itemTemplate Item extra properties are being generated for + * @param botRole Used by weapons to randomise the durability values. Null for non-equipped items * @returns Item Upd object with extra properties */ - generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: any): { + generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: string): { upd?: Upd; }; /** @@ -220,21 +225,27 @@ export declare class BotGeneratorHelper { protected generateArmorRepairableProperties(itemTemplate: ITemplateItem, botRole: string): Repairable; /** * Get a random mod from an items compatible mods Filter array - * @param modTpl - * @param parentSlot - * @param modSlot - * @param items + * @param modTpl ???? + * @param parentSlot item mod will go into, used to get combatible items + * @param modSlot Slot to get mod to fill + * @param items items to ensure picked mod is compatible with * @returns item tpl */ protected getModTplFromItemDb(modTpl: string, parentSlot: Slot, modSlot: string, items: Item[]): string; /** * Can an item be added to an item without issue - * @param items - * @param tplToCheck - * @param equipmentSlot - * @returns true if possible + * @param items items to check compatiblilities with + * @param tplToCheck tpl of the item to check for incompatibilities + * @param equipmentSlot Slot the item will be placed into + * @returns false if no incompatibilties */ isItemIncompatibleWithCurrentItems(items: Item[], tplToCheck: string, equipmentSlot: string): boolean; + /** + * Convert a bots role to the equipment role used in config/bot.json + * @param botRole Role to convert + * @returns Equipment role (e.g. pmc / assault / bossTagilla) + */ + getBotEquipmentRole(botRole: string): string; } /** TODO - move into own class */ export declare class ExhaustableArray { diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/BotHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/BotHelper.d.ts index 67a6384..a7f779e 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/BotHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/BotHelper.d.ts @@ -3,6 +3,7 @@ import { IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; export declare class BotHelper { @@ -10,46 +11,27 @@ export declare class BotHelper { protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, configServer: ConfigServer); - /** - * Get difficulty settings for desired bot type, if not found use assault bot types - * @param type bot type to retreive difficulty of - * @param difficulty difficulty to get settings for (easy/normal etc) - * @returns Difficulty object - */ - getBotDifficultySettings(type: string, difficulty: string): Difficulty; + constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, localisationService: LocalisationService, configServer: ConfigServer); /** * Get a template object for the specified botRole from bots.types db * @param role botRole to get template for * @returns IBotType object */ getBotTemplate(role: string): IBotType; - /** - * Get difficulty settings for a PMC - * @param type "usec" / "bear" - * @param difficulty what difficulty to retrieve - * @returns Difficulty object - */ - getPmcDifficultySettings(type: string, difficulty: string): Difficulty; - /** - * Translate chosen value from pre-raid difficulty dropdown into bot difficulty value - * @param dropDownDifficulty Dropdown difficulty value to convert - * @returns bot difficulty - */ - convertBotDifficultyDropdownToBotDifficulty(dropDownDifficulty: string): string; - /** - * Choose a random difficulty from - easy/normal/hard/impossible - * @returns random difficulty - */ - chooseRandomDifficulty(): string; /** * Randomise the chance the PMC will attack their own side * Look up value in bot.json/chanceSameSideIsHostilePercent * @param difficultySettings pmc difficulty settings */ randomisePmcHostility(difficultySettings: Difficulty): void; + /** + * Is the passed in bot role a PMC (usec/bear/pmc) + * @param botRole bot role to check + * @returns true if is pmc + */ isBotPmc(botRole: string): boolean; isBotBoss(botRole: string): boolean; isBotFollower(botRole: string): boolean; diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/GameEventHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/GameEventHelper.d.ts index fca87be..fa25eff 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/GameEventHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/GameEventHelper.d.ts @@ -15,4 +15,15 @@ export declare class GameEventHelper { * @returns Record with event name + start/end date */ getEventDetails(): ISeasonalEvent[]; + /** + * Is detection of seasonal events enabled (halloween / christmas) + * @returns true if seasonal events should be checked for + */ + isAutomaticEventDetectionEnabled(): boolean; + /** + * Get a dictionary of gear changes to apply to bots for a specific event e.g. Christmas/Halloween + * @param eventName Name of event to get gear changes for + * @returns bots with equipment changes + */ + getEventBotGear(eventName: string): Record>>; } diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/HideoutHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/HideoutHelper.d.ts index 5f7e3b7..9d51fed 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/HideoutHelper.d.ts @@ -11,6 +11,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { PlayerService } from "../services/PlayerService"; import { HashUtil } from "../utils/HashUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; @@ -29,13 +30,14 @@ export declare class HideoutHelper { protected profileHelper: ProfileHelper; protected inventoryHelper: InventoryHelper; protected playerService: PlayerService; + protected localisationService: LocalisationService; protected configServer: ConfigServer; static bitcoinFarm: string; static waterCollector: string; static bitcoin: string; static expeditionaryFuelTank: string; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, localisationService: LocalisationService, configServer: ConfigServer); registerProduction(pmcData: IPmcData, body: IHideoutSingleProductionStartRequestData | IHideoutContinousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; /** * This convinience function intialies new Production Object diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/InventoryHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/InventoryHelper.d.ts index b8e5c9d..6419f93 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/InventoryHelper.d.ts @@ -5,11 +5,12 @@ import { IInventoryMergeRequestData } from "../models/eft/inventory/IInventoryMe import { IInventoryMoveRequestData } from "../models/eft/inventory/IInventoryMoveRequestData"; import { IInventorySplitRequestData } from "../models/eft/inventory/IInventorySplitRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { IInventoryConfig } from "../models/spt/config/IInventoryConfig"; +import { IInventoryConfig, RewardDetails } from "../models/spt/config/IInventoryConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { JsonUtil } from "../utils/JsonUtil"; @@ -38,9 +39,10 @@ export declare class InventoryHelper { protected itemHelper: ItemHelper; protected containerHelper: ContainerHelper; protected profileHelper: ProfileHelper; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected inventoryConfig: IInventoryConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); addItem(pmcData: IPmcData, body: IAddItemRequestData, output: IItemEventRouterResponse, sessionID: string, callback: any, foundInRaid?: boolean, addUpd?: any): IItemEventRouterResponse; removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; removeItemByCount(pmcData: IPmcData, itemId: string, count: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; @@ -76,6 +78,12 @@ export declare class InventoryHelper { * Internal helper function to handle cartridges in inventory if any of them exist. */ protected handleCartridges(items: Item[], body: IInventoryMoveRequestData): void; + /** + * Get details for how a random loot container should be handled, max rewards, possible reward tpls + * @param itemTpl Container being opened + * @returns Reward details + */ + getRandomLootContainerRewardDetails(itemTpl: string): RewardDetails; } declare namespace InventoryHelper { interface InventoryItemHash { diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/ItemHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/ItemHelper.d.ts index 0effaf2..fc88a46 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/ItemHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/ItemHelper.d.ts @@ -5,6 +5,7 @@ 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 { LocaleService } from "../services/LocaleService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; @@ -18,7 +19,8 @@ declare class ItemHelper { protected objectId: ObjectId; protected mathUtil: MathUtil; protected databaseServer: DatabaseServer; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer); + protected localeService: LocaleService; + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, localeService: LocaleService); /** * Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash * @param {string} tpl the template id / tpl @@ -212,6 +214,12 @@ declare class ItemHelper { * @returns size of stack */ getItemStackSize(item: Item): number; + /** + * Get the name of an item from the locale file using the item tpl + * @param itemTpl Tpl of item to get name of + * @returns Name of item + */ + getItemName(itemTpl: string): string; } declare namespace ItemHelper { interface ItemSize { diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/QuestHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/QuestHelper.d.ts index a6b4892..edbd2e1 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/QuestHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/QuestHelper.d.ts @@ -50,6 +50,12 @@ export declare class QuestHelper { * @returns true if player level is greater than or equal to quest */ doesPlayerLevelFulfilCondition(playerLevel: number, condition: AvailableForConditions): boolean; + /** + * Get the quests found in both arrays (inner join) + * @param before Array of qeusts #1 + * @param after Array of quests #2 + * @returns Reduction of cartesian product between two quest arrays + */ getDeltaQuests(before: IQuest[], after: IQuest[]): IQuest[]; /** * Increase skill points of a skill on player profile @@ -66,38 +72,85 @@ export declare class QuestHelper { * quest list in question. */ dumpQuests(quests: any): void; - loyaltyRequirementCheck(loyaltyRequirementProperties: AvailableForProps, profile: IPmcData): boolean; - protected processReward(reward: Reward): any[]; + /** + * Check if trader has sufficient loyalty to fullfill quest requirement + * @param questProperties Quest props + * @param profile Player profile + * @returns true if loyalty is high enough to fulfil quest requirement + */ + traderStandingRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; + protected processReward(reward: Reward): Reward[]; + /** + * Gets a flat list of reward items for the given quest at a specific state (e.g. Fail/Success) + * @param quest quest to get rewards for + * @param state Quest status that holds the items (Started, Success, Fail) + * @returns array of items with the correct maxStack + */ getQuestRewardItems(quest: IQuest, state: QuestStatus): Reward[]; /** - * Add quest with new state value to pmc profile + * Update player profile with quest status (e.g. Fail/Success) * @param pmcData profile to add quest to * @param newState state the new quest should be in when added * @param acceptedQuest Details of quest being added */ addQuestToPMCData(pmcData: IPmcData, newState: QuestStatus, acceptedQuest: IAcceptQuestRequestData): void; - acceptedUnlocked(acceptedQuestId: string, sessionID: string): IQuest[]; - failedUnlocked(failedQuestId: string, sessionID: string): IQuest[]; - applyMoneyBoost(quest: IQuest, moneyBoost: number): IQuest; - changeItemStack(pmcData: IPmcData, id: string, value: number, sessionID: string, output: any): void; /** - * Get List of All Quests as an array + * TODO: what is going on here + * @param acceptedQuestId Quest to add to profile + * @param sessionID Session id + * @returns Array of quests in profile + quest passed in as param + */ + acceptedUnlocked(acceptedQuestId: string, sessionID: string): IQuest[]; + /** + * TODO: what is going on here + * @param failedQuestId + * @param sessionID Session id + * @returns + */ + failedUnlocked(failedQuestId: string, sessionID: string): IQuest[]; + /** + * Adjust quest money rewards by passed in multipler + * @param quest Quest to multiple money rewards + * @param multipler Value to adjust money rewards by + * @returns Updated quest + */ + applyMoneyBoost(quest: IQuest, multipler: number): IQuest; + /** + * Sets the item stack to new value, or delete the item if value <= 0 + * // TODO maybe merge this function and the one from customization + * @param pmcData Profile + * @param itemId id of item to adjust stack size of + * @param newStackSize Stack size to adjust to + * @param sessionID Session id + * @param output ItemEvent router response + */ + changeItemStack(pmcData: IPmcData, itemId: string, newStackSize: number, sessionID: string, output: IItemEventRouterResponse): void; + /** + * Get List of All Quests from db + * NOT CLONED * @returns Array of IQuest objects */ - questValues(): IQuest[]; + getQuestsFromDb(): IQuest[]; /** - * Reest AvailableForStart conditions for quests - * @param quests queststo clean + * Get quests, strip all requirement conditions except level + * @param quests quests to process * @returns quest array without conditions */ - protected cleanQuestList(quests: IQuest[]): IQuest[]; + protected getQuestsWithOnlyLevelRequirementStartCondition(quests: IQuest[]): IQuest[]; /** - * Reset AvailableForStart conditions on a quest + * Remove all quest conditions except for level requirement * @param quest quest to clean * @returns reset IQuest object */ - cleanQuestConditions(quest: IQuest): IQuest; - failQuest(pmcData: IPmcData, body: any, sessionID: string): any; + getQuestWithOnlyLevelRequirementStartCondition(quest: IQuest): IQuest; + /** + * Fail a quest in a player profile + * @param pmcData Profile + * @param failRequest fail quest request data + * @param sessionID Session id + * @returns Item event router response + */ + failQuest(pmcData: IPmcData, failRequest: any, sessionID: string): IItemEventRouterResponse; /** * Get quest by id from database * @param questId questid to look for @@ -105,7 +158,12 @@ export declare class QuestHelper { * @returns IQuest object */ getQuestFromDb(questId: string, pmcData: IPmcData): IQuest; - getQuestLocaleIdFromDb(messageId: string): string; + /** + * Get the locale Id from locale db for a quest message + * @param questMessageId Quest mesage id to look up + * @returns Locale Id from locale db + */ + getQuestLocaleIdFromDb(questMessageId: string): string; /** * Alter a quests state + Add a record to tis status timers object * @param pmcData Profile to update @@ -128,5 +186,10 @@ export declare class QuestHelper { * @returns bonus in percent */ protected getIntelCenterRewardBonus(pmcData: IPmcData): number; - getFindItemIdForQuestItem(itemTpl: string): string; + /** + * Find quest with 'findItem' requirement that needs the item tpl be handed in + * @param itemTpl item tpl to look for + * @returns 'FindItem' condition id + */ + getFindItemIdForQuestHandIn(itemTpl: string): string; } diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/RagfairServerHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/RagfairServerHelper.d.ts index a03cdda..ec388d8 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/RagfairServerHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/RagfairServerHelper.d.ts @@ -44,10 +44,20 @@ export declare class RagfairServerHelper { isPlayer(userID: string): boolean; returnItems(sessionID: string, items: any[]): void; calculateDynamicStackCount(tplId: string, isWeaponPreset: boolean): number; + /** + * Choose a currency at random with bias + * @returns currency tpl + */ getDynamicOfferCurrency(): string; getMemberType(userID: string): MemberCategory; getNickname(userID: string): string; getPresetItems(item: any): Item[]; getPresetItemsByTpl(item: Item): Item[]; + /** + * Generate new unique ids for the children while preserving hierarchy + * @param item base item + * @param preset + * @returns Item array with new IDs + */ reparentPresets(item: Item, preset: Item[]): Item[]; } diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/RagfairSortHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/RagfairSortHelper.d.ts index 28d1d38..4669ce6 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/RagfairSortHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/RagfairSortHelper.d.ts @@ -18,7 +18,7 @@ export declare class RagfairSortHelper { protected sortOffersByRating(a: IRagfairOffer, b: IRagfairOffer): number; protected sortOffersByName(a: IRagfairOffer, b: IRagfairOffer): number; /** - * Order two offers by price value + * Order two offers by rouble price value * @param a Offer a * @param b Offer b * @returns diff --git a/TypeScript/4UseACustomConfigFile/types/loaders/PreAkiModLoader.d.ts b/TypeScript/4UseACustomConfigFile/types/loaders/PreAkiModLoader.d.ts index 7a687a5..f486a28 100644 --- a/TypeScript/4UseACustomConfigFile/types/loaders/PreAkiModLoader.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/loaders/PreAkiModLoader.d.ts @@ -1,29 +1,31 @@ import { DependencyContainer } from "tsyringe"; +import { IPostAkiLoadMod } from "../models/external/IPostAkiLoadMod"; +import { IPostDBLoadMod } from "../models/external/IPostDBLoadMod"; +import { IPreAkiLoadMod } from "../models/external/IPreAkiLoadMod"; import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { ModLoader } from "../models/spt/mod/IMod"; import { IModLoader } from "../models/spt/mod/IModLoader"; import { IPackageJsonData } from "../models/spt/mod/IPackageJsonData"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { LocalisationService } from "../services/LocalisationService"; import { ModCompilerService } from "../services/ModCompilerService"; import { JsonUtil } from "../utils/JsonUtil"; import { VFS } from "../utils/VFS"; import { BundleLoader } from "./BundleLoader"; -import { IPostAkiLoadMod } from "../models/external/IPostAkiLoadMod"; -import { IPreAkiLoadMod } from "../models/external/IPreAkiLoadMod"; -import { IPostDBLoadMod } from "../models/external/IPostDBLoadMod"; export declare class PreAkiModLoader implements IModLoader { protected logger: ILogger; protected vfs: VFS; protected jsonUtil: JsonUtil; protected modCompilerService: ModCompilerService; protected bundleLoader: BundleLoader; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected static container: DependencyContainer; protected readonly basepath = "user/mods/"; protected imported: Record; protected akiConfig: ICoreConfig; - constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, modCompilerService: ModCompilerService, bundleLoader: BundleLoader, configServer: ConfigServer); + constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, modCompilerService: ModCompilerService, bundleLoader: BundleLoader, localisationService: LocalisationService, configServer: ConfigServer); load(container: DependencyContainer): Promise; getBundles(local: boolean): string; getBundle(key: string, local: boolean): void; diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/bot/IGenerateBotsRequestData.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/bot/IGenerateBotsRequestData.d.ts index c49cef7..f1f7013 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/eft/bot/IGenerateBotsRequestData.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/bot/IGenerateBotsRequestData.d.ts @@ -2,6 +2,7 @@ export interface IGenerateBotsRequestData { conditions: Condition[]; } export interface Condition { + /** e.g. assault/pmcBot/bossKilla */ Role: string; Limit: number; Difficulty: string; diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/common/IGlobals.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/common/IGlobals.d.ts index 81e2023..b53f106 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/eft/common/IGlobals.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/common/IGlobals.d.ts @@ -591,6 +591,7 @@ export interface HealPrice { export interface ProfileHealthSettings { BodyPartsSettings: BodyPartsSettings; HealthFactorsSettings: HealthFactorsSettings; + DefaultStimulatorBuff: string; } export interface BodyPartsSettings { Head: BodyPartsSetting; diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/IBotBase.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/IBotBase.d.ts index 1c28ae0..2b418c1 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/IBotBase.d.ts @@ -107,6 +107,7 @@ export interface CurrentMax { Maximum: number; } export interface Inventory { + discardLimits: Record; items: Item[]; equipment: string; stash: string; diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/IBotType.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/IBotType.d.ts index c1fe579..55b4bd9 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/IBotType.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/IBotType.d.ts @@ -13,8 +13,8 @@ export interface IBotType { skills: Skills; } export interface Appearance { - body: string[]; - feet: string[]; + body: Record; + feet: Record; hands: string[]; head: string[]; voice: string[]; diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/ITemplateItem.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/ITemplateItem.d.ts index 8569e61..0fa7e18 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/common/tables/ITemplateItem.d.ts @@ -254,7 +254,7 @@ export interface Props { foodUseTime?: number; foodEffectType?: string; StimulatorBuffs?: string; - effects_health?: any; + effects_health?: IHealthEffect[] | Record>; effects_damage?: any; MaximumNumberOfUsage?: number; knifeHitDelay?: number; @@ -366,6 +366,10 @@ export interface Props { MinTimeToContactExplode?: number; ExplosionEffectType?: string; } +export interface IHealthEffect { + type: string; + value: number; +} export interface Prefab { path: string; rcid: string; diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/customization/IGetSuitsResponse.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/customization/IGetSuitsResponse.d.ts new file mode 100644 index 0000000..fe6888c --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/customization/IGetSuitsResponse.d.ts @@ -0,0 +1,4 @@ +export interface IGetSuitsResponse { + _id: string; + suits: string[]; +} diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/game/IGameKeepAliveResponse.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/game/IGameKeepAliveResponse.d.ts new file mode 100644 index 0000000..170ce6a --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/game/IGameKeepAliveResponse.d.ts @@ -0,0 +1,4 @@ +export interface IGameKeepAliveResponse { + msg: string; + utc_time: number; +} diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/game/IGameLogoutResponseData.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/game/IGameLogoutResponseData.d.ts new file mode 100644 index 0000000..0f52050 --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/game/IGameLogoutResponseData.d.ts @@ -0,0 +1,3 @@ +export interface IGameLogoutResponseData { + status: string; +} diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/game/IGameStartResponse.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/game/IGameStartResponse.d.ts new file mode 100644 index 0000000..9f0ab6d --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/game/IGameStartResponse.d.ts @@ -0,0 +1,3 @@ +export interface IGameStartResponse { + utc_time: number; +} diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts new file mode 100644 index 0000000..3c45124 --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts @@ -0,0 +1,11 @@ +import { IInventoryBaseActionRequestData } from "./IInventoryBaseActionRequestData"; +export interface IOpenRandomLootContainerRequestData extends IInventoryBaseActionRequestData { + Action: "OpenRandomLootContainer"; + /** Container item opened */ + item: string; + to: To[]; +} +export interface To { + /** Player character (pmc/scav) id items will be sent to */ + id: string; +} diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/itemEvent/IItemEventRouterBase.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/itemEvent/IItemEventRouterBase.d.ts index 4841cfd..60ab284 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/eft/itemEvent/IItemEventRouterBase.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/itemEvent/IItemEventRouterBase.d.ts @@ -10,8 +10,9 @@ export interface IItemEventRouterBase { export declare type TProfileChanges = Record; export interface Warning { index: number; - err: string; errmsg: string; + code?: string; + data?: any; } export interface ProfileChange { _id: string; diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/match/IStartOffineRaidRequestData.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/match/IStartOffineRaidRequestData.d.ts index af0625e..1983728 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/eft/match/IStartOffineRaidRequestData.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/match/IStartOffineRaidRequestData.d.ts @@ -2,8 +2,10 @@ import { BotAmount } from "../../enums/BotAmount"; import { BotDifficulty } from "../../enums/BotDifficulty"; export interface IStartOfflineRaidRequestData { locationName: string; + /** Current time, not in-game time */ startTime: number; - dateTime: string; + /** CURR = am, past = pm */ + dateTime: "CURR" | "PAST"; gameSettings: GameSettings; } export interface GameSettings { diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/notifier/ISelectProfileResponse.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/notifier/ISelectProfileResponse.d.ts new file mode 100644 index 0000000..ecb668a --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/notifier/ISelectProfileResponse.d.ts @@ -0,0 +1,6 @@ +import { INotifierChannel } from "./INotifier"; +export interface ISelectProfileResponse { + status: string; + notifier: INotifierChannel; + notifierServer: string; +} diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/ragfair/IRagfairOffer.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/ragfair/IRagfairOffer.d.ts index 3251a37..792ec7d 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/eft/ragfair/IRagfairOffer.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/ragfair/IRagfairOffer.d.ts @@ -7,19 +7,19 @@ export interface IRagfairOffer { requirements: OfferRequirement[]; root: string; intId: number; + /** Handbook price */ itemsCost: number; + /** Rouble price */ requirementsCost: number; - sptRequirementsCostRouble: number; startTime: number; endTime: number; sellInOnePiece: boolean; - name?: string; - shortName?: string; loyaltyLevel: number; buyRestrictionMax?: number; buyRestrictionCurrent?: number; locked: boolean; unlimitedCount: boolean; + /** Rouble price */ summaryCost: number; user: IRagfairOfferUser; notAvailable: boolean; @@ -33,11 +33,11 @@ export interface OfferRequirement { } export interface IRagfairOfferUser { id: string; - nickname: string; - rating: number; + nickname?: string; + rating?: number; memberType: MemberCategory; - avatar: string; - isRatingGrowing: boolean; + avatar?: string; + isRatingGrowing?: boolean; } export interface SellResult { sellTime: number; diff --git a/TypeScript/4UseACustomConfigFile/types/models/eft/weather/IWeatherData.d.ts b/TypeScript/4UseACustomConfigFile/types/models/eft/weather/IWeatherData.d.ts index ecc96ce..1f5d5b5 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/eft/weather/IWeatherData.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/eft/weather/IWeatherData.d.ts @@ -1,17 +1,18 @@ +import { WindDirection } from "../../../models/enums/WindDirection"; export interface IWeatherData { acceleration: number; time: string; date: string; - weather: IWeather; + weather?: IWeather; } export interface IWeather { pressure: number; temp: number; - fog: string; + fog: number; rain_intensity: number; - rain: any; + rain: number; wind_gustiness: number; - wind_direction: any; + wind_direction: WindDirection; wind_speed: number; cloud: number; time: string; diff --git a/TypeScript/4UseACustomConfigFile/types/models/enums/BackendErrorCodes.d.ts b/TypeScript/4UseACustomConfigFile/types/models/enums/BackendErrorCodes.d.ts new file mode 100644 index 0000000..6614b75 --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/models/enums/BackendErrorCodes.d.ts @@ -0,0 +1,67 @@ +export declare enum BackendErrorCodes { + NONE = 0, + UNKNOWN_ERROR = 200, + NOT_AUTHORIZED = 201, + NEED_AUTHORIZATION_CODE = 209, + WRONG_AUTHORIZATION_CODE = 211, + NEED_CAPTCHA = 214, + NO_NEED_CAPTCHA = 215, + CAPTCHA_FAILED = 218, + CAPTCHA_BRUTE_FORCED = 219, + NO_ROOM_IN_STASH = 223, + NICKNAME_NOT_UNIQUE = 225, + NICKNAME_NOT_VALID = 226, + UNSUPPORTED_CLIENT_VERSION = 232, + REPORT_NOT_ALLOWED = 238, + NICKNAME_IS_ABUSIVE = 241, + NICKNAME_CHANGE_TIMEOUT = 242, + NOT_MODIFIED = 304, + HTTP_BAD_REQUEST = 400, + HTTP_NOT_AUTHORIZED = 401, + HTTP_FORBIDDEN = 403, + HTTP_NOT_FOUND = 404, + HTTP_METHOD_NOT_ALLOWED = 405, + UNKNOWN_TRADING_ERROR = 500, + HTTPNOTIMPLEMENTED = 501, + HTTPBADGATEWAY = 502, + HTTPSERVICEUNAVAILABLE = 503, + HTTPGATEWAYTIMEOUT = 504, + TRADEROUTOFMONEY = 505, + HTTPVARIANTALSONEGOTIATES = 506, + PRICECHANGED = 509, + TRADERDISABLED = 512, + ITEMHASBEENSOLD = 513, + NOTENOUGHSPACEFORMONEY = 518, + HTTPINVALIDSSLCERTIFICATE = 526, + UNKNOWNRAGFAIRERROR = 550, + UNKNOWNRAGFAIRERROR2 = 551, + UNKNOWNMATCHMAKERERROR = 600, + SESSIONPARAMETERSERROR = 601, + SESSIONLOST = 602, + SERVERNOTREGISTERED = 604, + UNKNOWNQUESTERROR = 700, + QUESTBADPARAM = 702, + QUESTNOTFOUND = 703, + QUESTISUNAVAILABLE = 704, + NOFREESPACEFORREWARDS = 705, + WRONGQUESTSTATUS = 706, + CANTCOMPLETEQUEST = 707, + UNKNOWNMAILERROR = 900, + TOOMANYFRIENDREQUESTS = 925, + UNKNOWNSCRIPTEXECUTIONERROR = 1000, + UNKNOWNREPAIRINGERROR = 1200, + UNKNOWNINSURANCEERROR = 1300, + UNKNOWNCURRENCYEXCHANGEERROR = 1400, + OFFERNOTFOUND = 1503, + NOTENOUGHSPACE = 1505, + OFFEROUTOFSTOCK = 1506, + OFFERSOLD = 1507, + RAGFAIRUNAVAILABLE = 1511, + BANNEDERRORCODE = 1513, + INSUFFICIENTNUMBERINSTOCK = 1516, + TOOMANYITEMSTOSELL = 1517, + EXAMINATIONFAILED = 22001, + ITEMALREADYEXAMINED = 22002, + UNKNOWNNGINXERROR = 9000, + PARSERESPONSEERROR = 9001 +} diff --git a/TypeScript/4UseACustomConfigFile/types/models/enums/HideoutEventActions.d.ts b/TypeScript/4UseACustomConfigFile/types/models/enums/HideoutEventActions.d.ts new file mode 100644 index 0000000..e441477 --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/models/enums/HideoutEventActions.d.ts @@ -0,0 +1,11 @@ +export declare enum HideoutEventActions { + HIDEOUT_UPGRADE = "HideoutUpgrade", + HIDEOUT_UPGRADE_COMPLETE = "HideoutUpgradeComplete", + HIDEOUT_PUT_ITEMS_IN_AREA_SLOTS = "HideoutPutItemsInAreaSlots", + HIDEOUT_TAKE_ITEMS_FROM_AREA_SLOTS = "HideoutTakeItemsFromAreaSlots", + HIDEOUT_TOGGLE_AREA = "HideoutToggleArea", + HIDEOUT_SINGLE_PRODUCTION_START = "HideoutSingleProductionStart", + HIDEOUT_SCAV_CASE_PRODUCTION_START = "HideoutScavCaseProductionStart", + HIDEOUT_CONTINUOUS_PRODUCTION_START = "HideoutContinuousProductionStart", + HIDEOUT_TAKE_PRODUCTION = "HideoutTakeProduction" +} diff --git a/TypeScript/4UseACustomConfigFile/types/models/enums/ItemEventActions.d.ts b/TypeScript/4UseACustomConfigFile/types/models/enums/ItemEventActions.d.ts new file mode 100644 index 0000000..0e65453 --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/models/enums/ItemEventActions.d.ts @@ -0,0 +1,19 @@ +export declare enum ItemEventActions { + MOVE = "Move", + REMOVE = "Remove", + SPLIT = "Split", + MERGE = "Merge", + TRANSFER = "Transfer", + SWAP = "Swap", + FOLD = "Fold", + TOGGLE = "Toggle", + TAG = "Tag", + BIND = "Bind", + EXAMINE = "Examine", + READ_ENCYCLOPEDIA = "ReadEncyclopedia", + APPLY_INVENTORY_CHANGES = "ApplyInventoryChanges", + CREATE_MAP_MARKER = "CreateMapMarker", + DELETE_MAP_MARKER = "DeleteMapMarker", + EDIT_MAP_MARKER = "EditMapMarker", + OPEN_RANDOM_LOOT_CONTAINER = "OpenRandomLootContainer" +} diff --git a/TypeScript/4UseACustomConfigFile/types/models/enums/WeatherType.d.ts b/TypeScript/4UseACustomConfigFile/types/models/enums/WeatherType.d.ts new file mode 100644 index 0000000..d31fefe --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/models/enums/WeatherType.d.ts @@ -0,0 +1,19 @@ +export declare enum WeatherType { + CLEAR_DAY = 1, + CLEAR_WIND = 2, + CLEAR_NIGHT = 3, + PARTLY_CLOUD_DAY = 4, + PARTLY_CLOUD_NIGHT = 5, + CLEAR_FOG_DAY = 6, + CLEAR_FOG_NIGHT = 7, + CLOUDFOG = 8, + FOG = 9, + MOSTLY_CLOUD = 10, + LIGHT_RAIN = 11, + RAIN = 12, + CLOUD_WIND = 13, + CLOUD_WIND_RAIN = 14, + FULL_CLOUD = 15, + THUNDER_CLOUD = 16, + NONE = 0 +} diff --git a/TypeScript/4UseACustomConfigFile/types/models/enums/WildSpawnTypeNumber.d.ts b/TypeScript/4UseACustomConfigFile/types/models/enums/WildSpawnTypeNumber.d.ts new file mode 100644 index 0000000..ff806fe --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/models/enums/WildSpawnTypeNumber.d.ts @@ -0,0 +1,33 @@ +export declare enum WildSpawnTypeNumber { + ASSAULT = 1, + MARKSMAN = 2, + BOSSTEST = 4, + BOSSBULLY = 8, + FOLLOWERTEST = 16, + FOLLOWERBULLY = 32, + BOSSKILLA = 64, + BOSSKOJANIY = 128, + FOLLOWERKOJANIY = 256, + PMCBOT = 512, + CURSEDASSAULT = 1024, + BOSSGLUHAR = 2048, + FOLLOWERGLUHARASSAULT = 4096, + FOLLOWERGLUHARSECURITY = 8192, + FOLLOWERGLUHARSCOUT = 16384, + FOLLOWERGLUHARSNIPE = 32768, + FOLLOWERSANITAR = 65536, + BOSSSANITAR = 131072, + TEST = 262144, + ASSAULTGROUP = 524288, + SECTANTWARRIOR = 1048576, + SECTANTPRIEST = 2097152, + BOSSTAGILLA = 4194304, + FOLLOWERTAGILLA = 8388608, + EXUSEC = 16777216, + GIFTER = 33554432, + BOSSKNIGHT = 67108864, + FOLLOWERBIGPIPE = 134217728, + FOLLOWERBIRDEYE = 268435456, + SPTUSEC = 536870912, + SPTBEAR = 1073741824 +} diff --git a/TypeScript/4UseACustomConfigFile/types/models/enums/WindDirection.d.ts b/TypeScript/4UseACustomConfigFile/types/models/enums/WindDirection.d.ts new file mode 100644 index 0000000..fb30b20 --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/models/enums/WindDirection.d.ts @@ -0,0 +1,10 @@ +export declare enum WindDirection { + EAST = 1, + NORTH = 2, + WEST = 3, + SOUTH = 4, + SE = 5, + SW = 6, + NW = 7, + NE = 8 +} diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/config/IBotConfig.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IBotConfig.d.ts index af8ceba..d6fa5e0 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IBotConfig.d.ts @@ -27,6 +27,8 @@ export interface IBotConfig extends IBaseConfig { maxBotCap: Record; /** How many stacks of secret ammo should a bot have in its bot secure container */ secureContainerAmmoStackCount: number; + /** Batch generation size when type not available in cache */ + botGenerationBatchSizePerType: number; } export interface PresetBatch { assault: number; @@ -66,8 +68,12 @@ export interface EquipmentFilters { weaponModLimits: ModLimits; randomisedWeaponModSlots?: string[]; randomisedArmorSlots?: string[]; + faceShieldIsActiveChancePercent?: number; + lightLaserIsActiveChancePercent?: number; blacklist: EquipmentFilterDetails[]; whitelist: EquipmentFilterDetails[]; + clothing: WeightingAdjustmentDetails[]; + weightingAdjustments: WeightingAdjustmentDetails[]; } export interface ModLimits { /** How many scopes are allowed on a weapon - hard coded to work with OPTIC_SCOPE, ASSAULT_SCOPE, COLLIMATOR, COMPACT_COLLIMATOR */ @@ -80,3 +86,8 @@ export interface EquipmentFilterDetails { equipment: Record; cartridge: Record; } +export interface WeightingAdjustmentDetails { + levelRange: MinMax; + add: Record>; + edit: Record>; +} diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IInventoryConfig.d.ts index ffffa41..4642b9b 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IInventoryConfig.d.ts @@ -2,4 +2,10 @@ import { IBaseConfig } from "./IBaseConfig"; export interface IInventoryConfig extends IBaseConfig { kind: "aki-inventory"; newItemsMarkedFound: boolean; + randomLootContainers: Record; +} +export interface RewardDetails { + rewardCount: number; + foundInRaid: boolean; + rewardTplPool: Record; } diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/config/ILocaleConfig.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/config/ILocaleConfig.d.ts index fe9abf7..0a8955c 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/spt/config/ILocaleConfig.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/config/ILocaleConfig.d.ts @@ -1,5 +1,10 @@ import { IBaseConfig } from "./IBaseConfig"; export interface ILocaleConfig extends IBaseConfig { kind: "aki-locale"; - desiredLocale: string; + /** e.g. ru/en/cn/fr etc, or 'system', will take computer locale setting */ + gameLocale: string; + /** e.g. ru/en/cn/fr etc, or 'system', will take computer locale setting */ + serverLocale: string; + /** Languages server can be translated into */ + serverSupportedLocales: string[]; } diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/config/IPmcConfig.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IPmcConfig.d.ts index 9db2ba1..48601b2 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/spt/config/IPmcConfig.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IPmcConfig.d.ts @@ -6,9 +6,11 @@ export interface IPmcConfig { looseWeaponInBackpackChancePercent: number; looseWeaponInBackpackLootMinMax: MinMax; isUsec: number; + usecType: string; + bearType: string; chanceSameSideIsHostilePercent: number; /** key: location, value: type for usec/bear */ - pmcType: Record; + pmcType: Record>>; maxBackpackLootTotalRub: number; maxPocketLootTotalRub: number; maxVestLootTotalRub: number; diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IRagfairConfig.d.ts index c1b8763..6786417 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IRagfairConfig.d.ts @@ -28,12 +28,8 @@ export interface Reputation { gain: number; loss: number; } -export declare class OfferAdjustment { - maxPriceDifferenceBelowHandbookPercent: number; - handbookPriceMultipier: number; - priceThreshholdRub: number; -} export interface Dynamic { + barter: Barter; offerAdjustment: OfferAdjustment; expiredOfferThreshold: number; offerItemCount: MinMax; @@ -49,6 +45,20 @@ export interface Dynamic { showAsSingleStack: string[]; blacklist: Blacklist; } +export declare class Barter { + enable: boolean; + chancePercent: number; + itemCountMin: number; + itemCountMax: number; + priceRangeVariancePercent: number; + minRoubleCostToBecomeBarter: number; + itemTypeBlacklist: string[]; +} +export declare class OfferAdjustment { + maxPriceDifferenceBelowHandbookPercent: number; + handbookPriceMultipier: number; + priceThreshholdRub: number; +} export interface Condition { conditionChance: number; min: number; diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/config/ISeasonalEventConfig.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/config/ISeasonalEventConfig.d.ts index bc60618..e410925 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/spt/config/ISeasonalEventConfig.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/config/ISeasonalEventConfig.d.ts @@ -1,6 +1,9 @@ import { IBaseConfig } from "./IBaseConfig"; export interface ISeasonalEventConfig extends IBaseConfig { kind: "aki-seasonalevents"; + enableSeasonalEventDetection: boolean; + /** event / botType / equipSlot / itemid */ + eventGear: Record>>>; events: ISeasonalEvent[]; } export interface ISeasonalEvent { diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/config/IWeatherConfig.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IWeatherConfig.d.ts index bbdc43e..41a1c83 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/spt/config/IWeatherConfig.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IWeatherConfig.d.ts @@ -1,3 +1,4 @@ +import { WindDirection } from "../../../models/enums/WindDirection"; import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface IWeatherConfig extends IBaseConfig { @@ -7,12 +8,16 @@ export interface IWeatherConfig extends IBaseConfig { } export interface Weather { clouds: MinMax; - windSpeed: MinMax; - windDirection: MinMax; + windSpeed: WeatherSettings; + windDirection: WeatherSettings; windGustiness: MinMax; - rain: MinMax; + rain: WeatherSettings; rainIntensity: MinMax; - fog: MinMax; + fog: WeatherSettings; temp: MinMax; pressure: MinMax; } +export interface WeatherSettings { + values: T[]; + weights: number[]; +} diff --git a/TypeScript/4UseACustomConfigFile/types/routers/item_events/HideoutItemEventRouter.d.ts b/TypeScript/4UseACustomConfigFile/types/routers/item_events/HideoutItemEventRouter.d.ts index e1e98af..44bd1cd 100644 --- a/TypeScript/4UseACustomConfigFile/types/routers/item_events/HideoutItemEventRouter.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/routers/item_events/HideoutItemEventRouter.d.ts @@ -1,7 +1,7 @@ -import { IPmcData } from "../../models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "../../models/eft/itemEvent/IItemEventRouterResponse"; import { HideoutCallbacks } from "../../callbacks/HideoutCallbacks"; import { HandledRoute, ItemEventRouterDefinition } from "../../di/Router"; +import { IPmcData } from "../../models/eft/common/IPmcData"; +import { IItemEventRouterResponse } from "../../models/eft/itemEvent/IItemEventRouterResponse"; export declare class HideoutItemEventRouter extends ItemEventRouterDefinition { protected hideoutCallbacks: HideoutCallbacks; constructor(hideoutCallbacks: HideoutCallbacks); diff --git a/TypeScript/4UseACustomConfigFile/types/routers/item_events/InventoryItemEventRouter.d.ts b/TypeScript/4UseACustomConfigFile/types/routers/item_events/InventoryItemEventRouter.d.ts index 2619bb9..953d322 100644 --- a/TypeScript/4UseACustomConfigFile/types/routers/item_events/InventoryItemEventRouter.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/routers/item_events/InventoryItemEventRouter.d.ts @@ -1,7 +1,7 @@ -import { IPmcData } from "../../models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "../../models/eft/itemEvent/IItemEventRouterResponse"; import { InventoryCallbacks } from "../../callbacks/InventoryCallbacks"; import { HandledRoute, ItemEventRouterDefinition } from "../../di/Router"; +import { IPmcData } from "../../models/eft/common/IPmcData"; +import { IItemEventRouterResponse } from "../../models/eft/itemEvent/IItemEventRouterResponse"; export declare class InventoryItemEventRouter extends ItemEventRouterDefinition { protected inventoryCallbacks: InventoryCallbacks; constructor(inventoryCallbacks: InventoryCallbacks); diff --git a/TypeScript/4UseACustomConfigFile/types/servers/HttpServer.d.ts b/TypeScript/4UseACustomConfigFile/types/servers/HttpServer.d.ts index bbca8af..80c1d48 100644 --- a/TypeScript/4UseACustomConfigFile/types/servers/HttpServer.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/servers/HttpServer.d.ts @@ -4,6 +4,7 @@ import { ApplicationContext } from "../context/ApplicationContext"; import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; import { ILogger } from "../models/spt/utils/ILogger"; +import { LocalisationService } from "../services/LocalisationService"; import { ConfigServer } from "./ConfigServer"; import { DatabaseServer } from "./DatabaseServer"; import { IHttpListener } from "./http/IHttpListener"; @@ -12,11 +13,12 @@ export declare class HttpServer { protected logger: ILogger; protected databaseServer: DatabaseServer; protected httpServerHelper: HttpServerHelper; + protected localisationService: LocalisationService; protected httpListeners: IHttpListener[]; protected configServer: ConfigServer; protected applicationContext: ApplicationContext; protected webSocketServer: WebSocketServer; - constructor(logger: ILogger, databaseServer: DatabaseServer, httpServerHelper: HttpServerHelper, httpListeners: IHttpListener[], configServer: ConfigServer, applicationContext: ApplicationContext, webSocketServer: WebSocketServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, httpServerHelper: HttpServerHelper, localisationService: LocalisationService, httpListeners: IHttpListener[], configServer: ConfigServer, applicationContext: ApplicationContext, webSocketServer: WebSocketServer); protected httpConfig: IHttpConfig; getCookies(req: http.IncomingMessage): any; handleRequest(req: IncomingMessage, resp: ServerResponse): void; diff --git a/TypeScript/4UseACustomConfigFile/types/servers/SaveServer.d.ts b/TypeScript/4UseACustomConfigFile/types/servers/SaveServer.d.ts index cb28f49..4dca514 100644 --- a/TypeScript/4UseACustomConfigFile/types/servers/SaveServer.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/servers/SaveServer.d.ts @@ -1,20 +1,22 @@ +import { SaveLoadRouter } from "../di/Router"; import { IAkiProfile, Info } from "../models/eft/profile/IAkiProfile"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { VFS } from "../utils/VFS"; -import { SaveLoadRouter } from "../di/Router"; -import { ILogger } from "../models/spt/utils/ILogger"; export declare class SaveServer { protected vfs: VFS; protected saveLoadRouters: SaveLoadRouter[]; protected jsonUtil: JsonUtil; protected hashUtil: HashUtil; + protected localisationService: LocalisationService; protected logger: ILogger; protected profileFilepath: string; protected profiles: {}; protected onSave: {}; protected saveMd5: {}; - constructor(vfs: VFS, saveLoadRouters: SaveLoadRouter[], jsonUtil: JsonUtil, hashUtil: HashUtil, logger: ILogger); + constructor(vfs: VFS, saveLoadRouters: SaveLoadRouter[], jsonUtil: JsonUtil, hashUtil: HashUtil, localisationService: LocalisationService, logger: ILogger); load(): void; save(): void; getProfile(sessionId: string): IAkiProfile; diff --git a/TypeScript/4UseACustomConfigFile/types/servers/WebSocketServer.d.ts b/TypeScript/4UseACustomConfigFile/types/servers/WebSocketServer.d.ts index f33d214..5d40e6e 100644 --- a/TypeScript/4UseACustomConfigFile/types/servers/WebSocketServer.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/servers/WebSocketServer.d.ts @@ -1,18 +1,20 @@ /// -import { HttpServerHelper } from "../helpers/HttpServerHelper"; -import WebSocket from "ws"; import http, { IncomingMessage } from "http"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { RandomUtil } from "../utils/RandomUtil"; +import WebSocket from "ws"; +import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { INotification } from "../models/eft/notifier/INotifier"; -import { ConfigServer } from "./ConfigServer"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { LocalisationService } from "../services/LocalisationService"; +import { RandomUtil } from "../utils/RandomUtil"; +import { ConfigServer } from "./ConfigServer"; export declare class WebSocketServer { protected logger: ILogger; protected randomUtil: RandomUtil; protected configServer: ConfigServer; + protected localisationService: LocalisationService; protected httpServerHelper: HttpServerHelper; - constructor(logger: ILogger, randomUtil: RandomUtil, configServer: ConfigServer, httpServerHelper: HttpServerHelper); + constructor(logger: ILogger, randomUtil: RandomUtil, configServer: ConfigServer, localisationService: LocalisationService, httpServerHelper: HttpServerHelper); protected httpConfig: IHttpConfig; protected defaultNotification: INotification; protected webSockets: Record; diff --git a/TypeScript/4UseACustomConfigFile/types/servers/http/AkiHttpListener.d.ts b/TypeScript/4UseACustomConfigFile/types/servers/http/AkiHttpListener.d.ts index 6f78939..acf92aa 100644 --- a/TypeScript/4UseACustomConfigFile/types/servers/http/AkiHttpListener.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/servers/http/AkiHttpListener.d.ts @@ -1,22 +1,24 @@ /// /// import { IncomingMessage, ServerResponse } from "http"; -import { IHttpListener } from "./IHttpListener"; import { Serializer } from "../../di/Serializer"; import { ILogger } from "../../models/spt/utils/ILogger"; import { HttpRouter } from "../../routers/HttpRouter"; +import { LocalisationService } from "../../services/LocalisationService"; import { HttpResponseUtil } from "../../utils/HttpResponseUtil"; import { JsonUtil } from "../../utils/JsonUtil"; import { HttpBufferHandler } from "./HttpBufferHandler"; +import { IHttpListener } from "./IHttpListener"; export declare class AkiHttpListener implements IHttpListener { protected httpRouter: HttpRouter; protected serializers: Serializer[]; protected logger: ILogger; protected jsonUtil: JsonUtil; protected httpResponse: HttpResponseUtil; + protected localisationService: LocalisationService; protected httpBufferHandler: HttpBufferHandler; constructor(httpRouter: HttpRouter, // TODO: delay required - serializers: Serializer[], logger: ILogger, jsonUtil: JsonUtil, httpResponse: HttpResponseUtil, httpBufferHandler: HttpBufferHandler); + serializers: Serializer[], logger: ILogger, jsonUtil: JsonUtil, httpResponse: HttpResponseUtil, localisationService: LocalisationService, httpBufferHandler: HttpBufferHandler); canHandle(_: string, req: IncomingMessage): boolean; handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): void; sendResponse(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: Buffer, output: string): void; diff --git a/TypeScript/4UseACustomConfigFile/types/services/BotEquipmentFilterService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/BotEquipmentFilterService.d.ts index 632f961..ae72cc3 100644 --- a/TypeScript/4UseACustomConfigFile/types/services/BotEquipmentFilterService.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/services/BotEquipmentFilterService.d.ts @@ -1,12 +1,12 @@ import { IBotType } from "../models/eft/common/tables/IBotType"; -import { EquipmentFilters, EquipmentFilterDetails, IBotConfig } from "../models/spt/config/IBotConfig"; +import { EquipmentFilters, EquipmentFilterDetails, IBotConfig, WeightingAdjustmentDetails } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; export declare class BotEquipmentFilterService { protected logger: ILogger; protected configServer: ConfigServer; protected botConfig: IBotConfig; - protected botEquipmentFilterlists: Record; + protected botEquipmentConfig: Record; constructor(logger: ILogger, configServer: ConfigServer); /** * Filter a bots data to exclude equipment and cartridges defines in the botConfig @@ -30,6 +30,20 @@ export declare class BotEquipmentFilterService { * @returns EquipmentFilterDetails object */ protected getBotEquipmentWhitelist(botRole: string, playerLevel: number): EquipmentFilterDetails; + /** + * Retreive clothing weighting adjustments from bot.json config + * @param botRole Bot type to get adjustments for + * @param playerLevel level of player + * @returns Weighting adjustments for bots clothing + */ + protected getBotClothingAdjustments(botRole: string, playerLevel: number): WeightingAdjustmentDetails; + /** + * Retreive item weighting adjustments from bot.json config + * @param botRole Bot type to get adjustments for + * @param playerLevel level of player + * @returns Weighting adjustments for bot items + */ + protected getBotWeightingAdjustments(botRole: string, playerLevel: number): WeightingAdjustmentDetails; /** * Filter bot equipment based on blacklist and whitelist from config/bot.json * Prioritises whitelist first, if one is found blacklist is ignored @@ -47,4 +61,10 @@ export declare class BotEquipmentFilterService { * @returns Filtered bot file */ protected filterCartridges(baseBotNode: IBotType, blacklist: EquipmentFilterDetails, whitelist: EquipmentFilterDetails): void; + /** + * Add/Edit weighting changes to bot items using values from config/bot.json/equipment + * @param weightingAdjustments Weighting change to apply to bot + * @param botItemPool Bot item dictionary to adjust + */ + protected adjustWeighting(weightingAdjustments: WeightingAdjustmentDetails, botItemPool: Record): void; } diff --git a/TypeScript/4UseACustomConfigFile/types/services/BotGenerationCacheService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/BotGenerationCacheService.d.ts index ba53fec..0be0576 100644 --- a/TypeScript/4UseACustomConfigFile/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/services/BotGenerationCacheService.d.ts @@ -8,11 +8,11 @@ export declare class BotGenerationCacheService { protected randomUtil: RandomUtil; protected jsonUtil: JsonUtil; protected botHelper: BotHelper; - protected storedBots: IBotBase[]; + protected storedBots: Map; constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, botHelper: BotHelper); /** * Store array of bots in cache, shuffle results before storage - * @param botsToStore + * @param botsToStore Bots we want to store in the cache */ storeBots(botsToStore: IBotBase[]): void; /** @@ -21,25 +21,7 @@ export declare class BotGenerationCacheService { * @param role role to retreive (assault/bossTagilla etc) * @returns IBotBase object */ - getBot(role: string): IBotBase[]; - /** - * Find a bot by its index from cache - * @param indexOfBotToReturn index to find bot by - * @returns bot profile - */ - protected getBotFromCache(indexOfBotToReturn: number): IBotBase; - /** - * Remove bot profile by index from cache - * @param indexOfBotToReturn Index of bot profile to remove - */ - protected removeBotFromCache(indexOfBotToReturn: number): void; - /** - * Get index of bot profile that matches criteria - * @param role Role of bot wanted - * @param getPmc Requested bot a pmc - * @returns index of found bot, -1 if not found - */ - protected getIndexOfBotToReturn(role: string, getPmc: boolean): number; + getBot(role: string): IBotBase; /** * Remove all cached bot profiles */ @@ -48,5 +30,5 @@ export declare class BotGenerationCacheService { * Does cache have bots * @returns true if empty */ - cacheIsEmpty(): boolean; + cacheHasBotOfRole(role: string): boolean; } diff --git a/TypeScript/4UseACustomConfigFile/types/services/LocaleService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/LocaleService.d.ts index 33bea7b..8275b75 100644 --- a/TypeScript/4UseACustomConfigFile/types/services/LocaleService.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/services/LocaleService.d.ts @@ -1,14 +1,42 @@ import { ILocaleConfig } from "../models/spt/config/ILocaleConfig"; +import { ILocaleGlobalBase } from "../models/spt/server/ILocaleBase"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +/** + * Handles getting locales from config or users machine + */ export declare class LocaleService { protected logger: ILogger; + protected databaseServer: DatabaseServer; protected configServer: ConfigServer; protected localeConfig: ILocaleConfig; - constructor(logger: ILogger, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, configServer: ConfigServer); /** - * Gets the locale key from the locale.json file + * Get the eft globals db file based on the configured locale in config/locale.json, if not found, fall back to 'en' + * @returns ILocaleGlobalBase + */ + getLocaleDb(): ILocaleGlobalBase; + /** + * Gets the game locale key from the locale.json file, + * if value is 'system' get system locale * @returns locale e.g en/ge/cz/cn */ - getDesiredLocale(): string; + getDesiredGameLocale(): string; + /** + * Gets the game locale key from the locale.json file, + * if value is 'system' get system locale + * @returns locale e.g en/ge/cz/cn + */ + getDesiredServerLocale(): string; + /** + * Get array of languages supported for localisation + * @returns array of locales e.g. en/fr/cn + */ + getServerSupportedLocales(): string[]; + /** + * Get the locale of the computer running the server + * @returns langage part of locale e.g. 'en' part of 'en-US' + */ + protected getPlatformLocale(): string; } diff --git a/TypeScript/4UseACustomConfigFile/types/services/LocalisationService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/LocalisationService.d.ts new file mode 100644 index 0000000..519325d --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/services/LocalisationService.d.ts @@ -0,0 +1,21 @@ +import { I18n } from "i18n"; +import { ILocaleConfig } from "../models/spt/config/ILocaleConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { LocaleService } from "./LocaleService"; +/** + * Handles translating server text into different langauges + */ +export declare class LocalisationService { + protected logger: ILogger; + protected localeService: LocaleService; + protected localeConfig: ILocaleConfig; + protected i18n: I18n; + constructor(logger: ILogger, localeService: LocaleService); + /** + * Get a localised value using the passed in key + * @param key Key to loop up locale for + * @param args optional arguments + * @returns Localised string + */ + getText(key: string, args?: any): string; +} diff --git a/TypeScript/4UseACustomConfigFile/types/services/PaymentService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/PaymentService.d.ts index a5e538f..c9ce95a 100644 --- a/TypeScript/4UseACustomConfigFile/types/services/PaymentService.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/services/PaymentService.d.ts @@ -11,6 +11,7 @@ import { IProcessSellTradeRequestData } from "../models/eft/trade/IProcessSellTr import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +import { LocalisationService } from "./LocalisationService"; export declare class PaymentService { protected logger: ILogger; protected httpResponse: HttpResponseUtil; @@ -19,8 +20,9 @@ export declare class PaymentService { protected traderHelper: TraderHelper; protected itemHelper: ItemHelper; protected inventoryHelper: InventoryHelper; + protected localisationService: LocalisationService; protected paymentHelper: PaymentHelper; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, traderHelper: TraderHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper); + constructor(logger: ILogger, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, traderHelper: TraderHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, localisationService: LocalisationService, paymentHelper: PaymentHelper); /** * Take money and insert items into return to server request * @param {Object} pmcData @@ -50,7 +52,7 @@ export declare class PaymentService { * @param pmcData Player profile to find and remove currency from * @param currencyTpl Type of currency to pay * @param amountToPay money value to pay - * @param sessionID Sessino id + * @param sessionID Session id * @param output output object to send to client * @returns IItemEventRouterResponse */ diff --git a/TypeScript/4UseACustomConfigFile/types/services/PlayerService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/PlayerService.d.ts index 519b7e5..2f364d5 100644 --- a/TypeScript/4UseACustomConfigFile/types/services/PlayerService.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/services/PlayerService.d.ts @@ -2,10 +2,12 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { IPlayerIncrementSkillLevelRequestData } from "../models/eft/player/IPlayerIncrementSkillLevelRequestData"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "./LocalisationService"; export declare class PlayerService { protected logger: ILogger; + protected localisationService: LocalisationService; protected databaseServer: DatabaseServer; - constructor(logger: ILogger, databaseServer: DatabaseServer); + constructor(logger: ILogger, localisationService: LocalisationService, databaseServer: DatabaseServer); /** * increases the profile skill and updates any output * @param {Object} pmcData diff --git a/TypeScript/4UseACustomConfigFile/types/services/PmcAiService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/PmcAiService.d.ts deleted file mode 100644 index 0690f1f..0000000 --- a/TypeScript/4UseACustomConfigFile/types/services/PmcAiService.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { IBotConfig } from "../models/spt/config/IBotConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { ConfigServer } from "../servers/ConfigServer"; -/** Storing/retreving pmcRoles set at the start of a raid - its done at that point as we know what location the player is heading to */ -export declare class PmcAiService { - protected logger: ILogger; - protected configServer: ConfigServer; - protected botConfig: IBotConfig; - protected usecRole: string; - protected bearRole: string; - constructor(logger: ILogger, configServer: ConfigServer); - /** - * Convert from pmc side (usec/bear) to the side as defined in the bot config (usecType/bearType) - * @param pmcSide eft side (usec/bear) - * @returns pmc side as defined in config - */ - getPmcRole(pmcSide: "usec" | "bear" | string): string; - /** - * Set the roles for pmcs - * @param location map location to look up and use as pmc types - */ - setPmcRolesByLocation(location: string): void; - /** - * Clear the saved role from usec/bear PMCs - */ - clearPmcRoles(): void; -} diff --git a/TypeScript/4UseACustomConfigFile/types/services/ProfileFixerService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/ProfileFixerService.d.ts index e772919..86a6af8 100644 --- a/TypeScript/4UseACustomConfigFile/types/services/ProfileFixerService.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/services/ProfileFixerService.d.ts @@ -8,12 +8,14 @@ import { HideoutAreas } from "../models/enums/HideoutAreas"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { Watermark } from "../utils/Watermark"; +import { LocalisationService } from "./LocalisationService"; export declare class ProfileFixerService { protected logger: ILogger; protected watermark: Watermark; protected hideoutHelper: HideoutHelper; + protected localisationService: LocalisationService; protected databaseServer: DatabaseServer; - constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, databaseServer: DatabaseServer); + constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, localisationService: LocalisationService, databaseServer: DatabaseServer); /** * Find issues in the pmc profile data that may cause issues and fix them * @param pmcProfile profile to check and fix diff --git a/TypeScript/4UseACustomConfigFile/types/services/RagfairOfferService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/RagfairOfferService.d.ts index a6f6b6d..86c1e52 100644 --- a/TypeScript/4UseACustomConfigFile/types/services/RagfairOfferService.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/services/RagfairOfferService.d.ts @@ -11,6 +11,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { TimeUtil } from "../utils/TimeUtil"; +import { LocalisationService } from "./LocalisationService"; import { RagfairCategoriesService } from "./RagfairCategoriesService"; export declare class RagfairOfferService { protected logger: ILogger; @@ -22,12 +23,14 @@ export declare class RagfairOfferService { protected profileHelper: ProfileHelper; protected eventOutputHolder: EventOutputHolder; protected httpResponse: HttpResponseUtil; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected playerOffersLoaded: boolean; protected expiredOffers: Item[]; - protected offers: IRagfairOffer[]; + /** offerId, offer */ + protected offers: Record; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, databaseServer: DatabaseServer, saveServer: SaveServer, ragfairServerHelper: RagfairServerHelper, ragfairCategoriesService: RagfairCategoriesService, profileHelper: ProfileHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, databaseServer: DatabaseServer, saveServer: SaveServer, ragfairServerHelper: RagfairServerHelper, ragfairCategoriesService: RagfairCategoriesService, profileHelper: ProfileHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, localisationService: LocalisationService, configServer: ConfigServer); /** * Get all offers * @returns IRagfairOffer array diff --git a/TypeScript/4UseACustomConfigFile/types/utils/App.d.ts b/TypeScript/4UseACustomConfigFile/types/utils/App.d.ts index dcc2669..cc8a5af 100644 --- a/TypeScript/4UseACustomConfigFile/types/utils/App.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/utils/App.d.ts @@ -1,14 +1,16 @@ -import { TimeUtil } from "./TimeUtil"; import { OnLoad } from "../di/OnLoad"; import { OnUpdate } from "../di/OnUpdate"; import { ILogger } from "../models/spt/utils/ILogger"; +import { LocalisationService } from "../services/LocalisationService"; +import { TimeUtil } from "./TimeUtil"; export declare class App { protected logger: ILogger; protected timeUtil: TimeUtil; + protected localisationService: LocalisationService; protected onLoadComponents: OnLoad[]; protected onUpdateComponents: OnUpdate[]; protected onUpdateLastRun: {}; - constructor(logger: ILogger, timeUtil: TimeUtil, onLoadComponents: OnLoad[], onUpdateComponents: OnUpdate[]); + constructor(logger: ILogger, timeUtil: TimeUtil, localisationService: LocalisationService, onLoadComponents: OnLoad[], onUpdateComponents: OnUpdate[]); load(): void; protected update(onUpdateComponents: OnUpdate[]): void; protected logUpdateException(err: any, updateable: OnUpdate): void; diff --git a/TypeScript/4UseACustomConfigFile/types/utils/DatabaseImporter.d.ts b/TypeScript/4UseACustomConfigFile/types/utils/DatabaseImporter.d.ts index 483e135..31670ae 100644 --- a/TypeScript/4UseACustomConfigFile/types/utils/DatabaseImporter.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/utils/DatabaseImporter.d.ts @@ -3,15 +3,17 @@ import { IDatabaseTables } from "../models/spt/server/IDatabaseTables"; import { ILogger } from "../models/spt/utils/ILogger"; import { ImageRouter } from "../routers/ImageRouter"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { JsonUtil } from "./JsonUtil"; import { VFS } from "./VFS"; export declare class DatabaseImporter extends OnLoad { protected logger: ILogger; protected vfs: VFS; protected jsonUtil: JsonUtil; + protected localisationService: LocalisationService; protected databaseServer: DatabaseServer; protected imageRouter: ImageRouter; - constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, databaseServer: DatabaseServer, imageRouter: ImageRouter); + constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, localisationService: LocalisationService, databaseServer: DatabaseServer, imageRouter: ImageRouter); onLoad(): void; /** * Read all json files in database folder and map into a json object diff --git a/TypeScript/4UseACustomConfigFile/types/utils/HttpResponseUtil.d.ts b/TypeScript/4UseACustomConfigFile/types/utils/HttpResponseUtil.d.ts index 29502be..3a78618 100644 --- a/TypeScript/4UseACustomConfigFile/types/utils/HttpResponseUtil.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/utils/HttpResponseUtil.d.ts @@ -1,10 +1,13 @@ -import { JsonUtil } from "./JsonUtil"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { INullResponseData } from "../models/eft/httpResponse/INullResponseData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; +import { BackendErrorCodes } from "../models/enums/BackendErrorCodes"; +import { LocalisationService } from "../services/LocalisationService"; +import { JsonUtil } from "./JsonUtil"; export declare class HttpResponseUtil { protected jsonUtil: JsonUtil; - constructor(jsonUtil: JsonUtil); + protected localisationService: LocalisationService; + constructor(jsonUtil: JsonUtil, localisationService: LocalisationService); protected clearString(s: string): any; noBody(data: any): any; getBody(data: T, err?: number, errmsg?: any): IGetBodyResponseData; @@ -12,5 +15,5 @@ export declare class HttpResponseUtil { emptyResponse(): IGetBodyResponseData; nullResponse(): INullResponseData; emptyArrayResponse(): IGetBodyResponseData; - appendErrorToOutput(output: IItemEventRouterResponse, message?: string, title?: string): IItemEventRouterResponse; + appendErrorToOutput(output: IItemEventRouterResponse, message?: string, errorCode?: BackendErrorCodes): IItemEventRouterResponse; } diff --git a/TypeScript/4UseACustomConfigFile/types/utils/RandomUtil.d.ts b/TypeScript/4UseACustomConfigFile/types/utils/RandomUtil.d.ts index 633e472..aa556e3 100644 --- a/TypeScript/4UseACustomConfigFile/types/utils/RandomUtil.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/utils/RandomUtil.d.ts @@ -110,6 +110,12 @@ export declare class RandomUtil { getIntEx(max: number): number; getFloat(min: number, max: number): number; getBool(): boolean; + /** + * Check if number passes a check out of 100 + * @param chancePercent value check needs to be above + * @returns true if value passes check + */ + getChance100(chancePercent: number): boolean; getStringArrayValue(arr: string[]): string; getArrayValue(arr: T[]): T; getKey(node: any): string; diff --git a/TypeScript/4UseACustomConfigFile/types/utils/Watermark.d.ts b/TypeScript/4UseACustomConfigFile/types/utils/Watermark.d.ts index c6dc120..e02eba2 100644 --- a/TypeScript/4UseACustomConfigFile/types/utils/Watermark.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/utils/Watermark.d.ts @@ -1,20 +1,15 @@ import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { LocalisationService } from "../services/LocalisationService"; export declare class WatermarkLocale { - protected locales: { - "en-US": { - description: string[]; - warning: string[]; - modding: string[]; - }; - "zh-CN": { - description: string[]; - warning: string[]; - modding: string[]; - }; + protected localisationService: LocalisationService; + constructor(localisationService: LocalisationService); + protected watermark: { + description: string[]; + warning: string[]; + modding: string[]; }; - getLocale(): string; getDescription(): string[]; getWarning(): string[]; getModding(): string[]; @@ -22,9 +17,10 @@ export declare class WatermarkLocale { export declare class Watermark { protected logger: ILogger; protected configServer: ConfigServer; + protected localisationService: LocalisationService; protected watermarkLocale?: WatermarkLocale; protected akiConfig: ICoreConfig; - constructor(logger: ILogger, configServer: ConfigServer, watermarkLocale?: WatermarkLocale); + constructor(logger: ILogger, configServer: ConfigServer, localisationService: LocalisationService, watermarkLocale?: WatermarkLocale); protected text: string[]; protected versionLabel: string; initialize(): void; diff --git a/TypeScript/5ReplaceMethod/types/callbacks/BotCallbacks.d.ts b/TypeScript/5ReplaceMethod/types/callbacks/BotCallbacks.d.ts index 2db60dc..827015e 100644 --- a/TypeScript/5ReplaceMethod/types/callbacks/BotCallbacks.d.ts +++ b/TypeScript/5ReplaceMethod/types/callbacks/BotCallbacks.d.ts @@ -8,8 +8,29 @@ export declare class BotCallbacks { protected botController: BotController; protected httpResponse: HttpResponseUtil; constructor(botController: BotController, httpResponse: HttpResponseUtil); + /** + * Handle singleplayer/settings/bot/limit + * @returns string + */ getBotLimit(url: string, info: IEmptyRequestData, sessionID: string): string; + /** + * Handle singleplayer/settings/bot/difficulty + * @returns string + */ getBotDifficulty(url: string, info: IEmptyRequestData, sessionID: string): string; + /** + * Handle client/game/bot/generate + * @returns IGetBodyResponseData + */ generateBots(url: string, info: IGenerateBotsRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle singleplayer/settings/bot/maxCap + * @returns string + */ getBotCap(): string; + /** + * Handle singleplayer/settings/bot/getBotBehaviours + * @returns string + */ + getBotBehaviours(): string; } diff --git a/TypeScript/5ReplaceMethod/types/callbacks/CustomizationCallbacks.d.ts b/TypeScript/5ReplaceMethod/types/callbacks/CustomizationCallbacks.d.ts index 3bab8c0..75d5701 100644 --- a/TypeScript/5ReplaceMethod/types/callbacks/CustomizationCallbacks.d.ts +++ b/TypeScript/5ReplaceMethod/types/callbacks/CustomizationCallbacks.d.ts @@ -3,6 +3,7 @@ import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { IPmcData } from "../models/eft/common/IPmcData"; import { ISuit } from "../models/eft/common/tables/ITrader"; import { IBuyClothingRequestData } from "../models/eft/customization/IBuyClothingRequestData"; +import { IGetSuitsResponse } from "../models/eft/customization/IGetSuitsResponse"; import { IWearClothingRequestData } from "../models/eft/customization/IWearClothingRequestData"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; @@ -13,10 +14,15 @@ export declare class CustomizationCallbacks { protected saveServer: SaveServer; protected httpResponse: HttpResponseUtil; constructor(customizationController: CustomizationController, saveServer: SaveServer, httpResponse: HttpResponseUtil); - getSuits(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<{ - _id: string; - suites: string[]; - }>; + /** + * Handles client/trading/customization/storage + * @returns + */ + getSuits(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handles client/trading/customization + * @returns ISuit[] + */ getTraderSuits(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; wearClothing(pmcData: IPmcData, body: IWearClothingRequestData, sessionID: string): IItemEventRouterResponse; buyClothing(pmcData: IPmcData, body: IBuyClothingRequestData, sessionID: string): IItemEventRouterResponse; diff --git a/TypeScript/5ReplaceMethod/types/callbacks/DataCallbacks.d.ts b/TypeScript/5ReplaceMethod/types/callbacks/DataCallbacks.d.ts index 04566ff..2efcf81 100644 --- a/TypeScript/5ReplaceMethod/types/callbacks/DataCallbacks.d.ts +++ b/TypeScript/5ReplaceMethod/types/callbacks/DataCallbacks.d.ts @@ -12,15 +12,42 @@ import { ILanguageBase } from "../models/spt/server/ILocaleBase"; import { ISettingsBase } from "../models/spt/server/ISettingsBase"; import { DatabaseServer } from "../servers/DatabaseServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +/** + * Handle client requests + */ export declare class DataCallbacks { protected httpResponse: HttpResponseUtil; protected databaseServer: DatabaseServer; constructor(httpResponse: HttpResponseUtil, databaseServer: DatabaseServer); + /** + * Handles client/settings + * @returns ISettingsBase + */ getSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handles client/globals + * @returns IGlobals + */ getGlobals(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handles client/items + * @returns string + */ getTemplateItems(url: string, info: IEmptyRequestData, sessionID: string): string; + /** + * Handles client/handbook/templates + * @returns IHandbookBase + */ getTemplateHandbook(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handles client/customization + * @returns Record>; + /** + * Handles client/account/customization + * @returns string[] + */ getTemplateCharacter(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getTemplateQuests(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getHideoutSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; @@ -28,6 +55,6 @@ export declare class DataCallbacks { gethideoutProduction(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getHideoutScavcase(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getLocalesLanguages(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - getLocalesMenu(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + getLocalesMenu(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getLocalesGlobal(url: string, info: IEmptyRequestData, sessionID: string): string; } diff --git a/TypeScript/5ReplaceMethod/types/callbacks/DialogueCallbacks.d.ts b/TypeScript/5ReplaceMethod/types/callbacks/DialogueCallbacks.d.ts index 634f90b..7b2eeae 100644 --- a/TypeScript/5ReplaceMethod/types/callbacks/DialogueCallbacks.d.ts +++ b/TypeScript/5ReplaceMethod/types/callbacks/DialogueCallbacks.d.ts @@ -26,15 +26,27 @@ export declare class DialogueCallbacks extends OnUpdate { protected httpResponse: HttpResponseUtil; protected dialogueController: DialogueController; constructor(hashUtil: HashUtil, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, dialogueController: DialogueController); + /** + * Handles client/friend/list + * @returns IGetFriendListDataResponse + */ getFriendList(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handles client/chatServer/list + * @returns + */ getChatServerList(url: string, info: IGetChatServerListRequestData, sessionID: string): IGetBodyResponseData; getMailDialogList(url: string, info: IGetMailDialogListRequestData, sessionID: string): IGetBodyResponseData; getMailDialogView(url: string, info: IGetMailDialogViewRequestData, sessionID: string): IGetBodyResponseData; - getMailDialogInfo(url: string, info: IGetMailDialogInfoRequestData, sessionID: string): IGetBodyResponseData; + getMailDialogInfo(url: string, info: IGetMailDialogInfoRequestData, sessionID: string): IGetBodyResponseData; removeDialog(url: string, info: IRemoveDialogRequestData, sessionID: string): IGetBodyResponseData; pinDialog(url: string, info: IPinDialogRequestData, sessionID: string): IGetBodyResponseData; unpinDialog(url: string, info: IPinDialogRequestData, sessionID: string): IGetBodyResponseData; setRead(url: string, info: ISetDialogReadRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handles client/mail/dialog/getAllAttachments + * @returns IGetAllAttachmentsResponse + */ getAllAttachments(url: string, info: IGetAllAttachmentsRequestData, sessionID: string): IGetBodyResponseData; listOutbox(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; listInbox(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; diff --git a/TypeScript/5ReplaceMethod/types/callbacks/GameCallbacks.d.ts b/TypeScript/5ReplaceMethod/types/callbacks/GameCallbacks.d.ts index 5e4c240..3a6b7e6 100644 --- a/TypeScript/5ReplaceMethod/types/callbacks/GameCallbacks.d.ts +++ b/TypeScript/5ReplaceMethod/types/callbacks/GameCallbacks.d.ts @@ -3,6 +3,9 @@ import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { ICheckVersionResponse } from "../models/eft/game/ICheckVersionResponse"; import { IGameConfigResponse } from "../models/eft/game/IGameConfigResponse"; import { IGameEmptyCrcRequestData } from "../models/eft/game/IGameEmptyCrcRequestData"; +import { IGameKeepAliveResponse } from "../models/eft/game/IGameKeepAliveResponse"; +import { IGameLogoutResponseData } from "../models/eft/game/IGameLogoutResponseData"; +import { IGameStartResponse } from "../models/eft/game/IGameStartResponse"; import { IReportNicknameRequestData } from "../models/eft/game/IReportNicknameRequestData"; import { IServerDetails } from "../models/eft/game/IServerDetails"; import { IVersionValidateRequestData } from "../models/eft/game/IVersionValidateRequestData"; @@ -15,13 +18,37 @@ declare class GameCallbacks { protected watermark: Watermark; protected gameController: GameController; constructor(httpResponse: HttpResponseUtil, watermark: Watermark, gameController: GameController); + /** + * Handle client/game/version/validate + * @returns INullResponseData + */ versionValidate(url: string, info: IVersionValidateRequestData, sessionID: string): INullResponseData; - gameStart(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - gameLogout(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/game/start + * @returns IGameStartResponse + */ + gameStart(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/game/logout + * @returns IGameLogoutResponseData + */ + gameLogout(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/game/config + * @returns IGameConfigResponse + */ getGameConfig(url: string, info: IGameEmptyCrcRequestData, sessionID: string): IGetBodyResponseData; getServer(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; validateGameVersion(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - gameKeepalive(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/game/keepalive + * @returns IGameKeepAliveResponse + */ + gameKeepalive(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle singleplayer/settings/version + * @returns string + */ getVersion(url: string, info: IEmptyRequestData, sessionID: string): string; reportNickname(url: string, info: IReportNicknameRequestData, sessionID: string): INullResponseData; } diff --git a/TypeScript/5ReplaceMethod/types/callbacks/HealthCallbacks.d.ts b/TypeScript/5ReplaceMethod/types/callbacks/HealthCallbacks.d.ts index 8672be7..7edf03e 100644 --- a/TypeScript/5ReplaceMethod/types/callbacks/HealthCallbacks.d.ts +++ b/TypeScript/5ReplaceMethod/types/callbacks/HealthCallbacks.d.ts @@ -21,7 +21,19 @@ export declare class HealthCallbacks { * @returns empty response, no data sent back to client */ syncHealth(url: string, info: ISyncHealthRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle Eat + * @returns IItemEventRouterResponse + */ offraidEat(pmcData: IPmcData, body: IOffraidEatRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle Heal + * @returns IItemEventRouterResponse + */ offraidHeal(pmcData: IPmcData, body: IOffraidHealRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle RestoreHealth + * @returns IItemEventRouterResponse + */ healthTreatment(pmcData: IPmcData, info: IHealthTreatmentRequestData, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/5ReplaceMethod/types/callbacks/HideoutCallbacks.d.ts b/TypeScript/5ReplaceMethod/types/callbacks/HideoutCallbacks.d.ts index 99ab4c9..e39e806 100644 --- a/TypeScript/5ReplaceMethod/types/callbacks/HideoutCallbacks.d.ts +++ b/TypeScript/5ReplaceMethod/types/callbacks/HideoutCallbacks.d.ts @@ -19,14 +19,77 @@ export declare class HideoutCallbacks extends OnUpdate { protected hideoutConfig: IHideoutConfig; constructor(hideoutController: HideoutController, // TODO: delay needed configServer: ConfigServer); + /** + * Handle HideoutUpgrade + * @param pmcData + * @param body + * @param sessionID + * @returns + */ upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutUpgradeComplete + * @param pmcData + * @param body + * @param sessionID + * @returns + */ upgradeComplete(pmcData: IPmcData, body: IHideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutPutItemsInAreaSlots + * @param pmcData + * @param body + * @param sessionID + * @returns + */ putItemsInAreaSlots(pmcData: IPmcData, body: IHideoutPutItemInRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutTakeItemsFromAreaSlots + * @param pmcData + * @param body + * @param sessionID + * @returns + */ takeItemsFromAreaSlots(pmcData: IPmcData, body: IHideoutTakeItemOutRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutToggleArea + * @param pmcData + * @param body + * @param sessionID + * @returns + */ toggleArea(pmcData: IPmcData, body: IHideoutToggleAreaRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutSingleProductionStart + * @param pmcData + * @param body + * @param sessionID + * @returns + */ singleProductionStart(pmcData: IPmcData, body: IHideoutSingleProductionStartRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutScavCaseProductionStart + * @param pmcData + * @param body + * @param sessionID + * @returns + */ scavCaseProductionStart(pmcData: IPmcData, body: IHideoutScavCaseStartRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutContinuousProductionStart + * @param pmcData + * @param body + * @param sessionID + * @returns + */ continuousProductionStart(pmcData: IPmcData, body: IHideoutContinousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutTakeProduction + * @param pmcData + * @param body + * @param sessionID + * @returns + */ takeProduction(pmcData: IPmcData, body: IHideoutTakeProductionRequestData, sessionID: string): IItemEventRouterResponse; onUpdate(timeSinceLastRun: number): boolean; getRoute(): string; diff --git a/TypeScript/5ReplaceMethod/types/callbacks/InraidCallbacks.d.ts b/TypeScript/5ReplaceMethod/types/callbacks/InraidCallbacks.d.ts index 05bcce4..918bfaf 100644 --- a/TypeScript/5ReplaceMethod/types/callbacks/InraidCallbacks.d.ts +++ b/TypeScript/5ReplaceMethod/types/callbacks/InraidCallbacks.d.ts @@ -1,23 +1,49 @@ import { InraidController } from "../controllers/InraidController"; -import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { INullResponseData } from "../models/eft/httpResponse/INullResponseData"; import { IRegisterPlayerRequestData } from "../models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; -import { IAirdropConfig } from "../models/spt/config/IAirdropConfig"; -import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; -import { ConfigServer } from "../servers/ConfigServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +/** + * Handle client requests + */ export declare class InraidCallbacks { protected inraidController: InraidController; protected httpResponse: HttpResponseUtil; - protected configServer: ConfigServer; - protected airdropConfig: IAirdropConfig; - protected inraidConfig: IInRaidConfig; - constructor(inraidController: InraidController, httpResponse: HttpResponseUtil, configServer: ConfigServer); + constructor(inraidController: InraidController, httpResponse: HttpResponseUtil); + /** + * Handle client/location/getLocalloot + * @param url + * @param info register player request + * @param sessionID Session id + * @returns Null http response + */ registerPlayer(url: string, info: IRegisterPlayerRequestData, sessionID: string): INullResponseData; + /** + * Handle raid/profile/save + * @param url + * @param info Save progress request + * @param sessionID Session id + * @returns Null http response + */ saveProgress(url: string, info: ISaveProgressRequestData, sessionID: string): INullResponseData; + /** + * Handle singleplayer/settings/raid/endstate + * @returns + */ getRaidEndState(): string; - getRaidMenuSettings(url: string, info: IEmptyRequestData, sessionID: string): string; - getWeaponDurability(url: string, info: any, sessionID: string): string; - getAirdropConfig(url: string, info: any, sessionID: string): string; + /** + * Handle singleplayer/settings/raid/menu + * @returns JSON as string + */ + getRaidMenuSettings(): string; + /** + * Handle singleplayer/settings/weapon/durability + * @returns + */ + getWeaponDurability(): string; + /** + * Handle singleplayer/airdrop/config + * @returns JSON as string + */ + getAirdropConfig(): string; } diff --git a/TypeScript/5ReplaceMethod/types/callbacks/InsuranceCallbacks.d.ts b/TypeScript/5ReplaceMethod/types/callbacks/InsuranceCallbacks.d.ts index 8835ba2..a171e1c 100644 --- a/TypeScript/5ReplaceMethod/types/callbacks/InsuranceCallbacks.d.ts +++ b/TypeScript/5ReplaceMethod/types/callbacks/InsuranceCallbacks.d.ts @@ -17,7 +17,15 @@ export declare class InsuranceCallbacks extends OnUpdate { protected configServer: ConfigServer; protected insuranceConfig: IInsuranceConfig; constructor(insuranceController: InsuranceController, insuranceService: InsuranceService, httpResponse: HttpResponseUtil, configServer: ConfigServer); + /** + * Handle client/insurance/items/list/cost + * @returns IGetInsuranceCostResponseData + */ getInsuranceCost(url: string, info: IGetInsuranceCostRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle Insure + * @returns IItemEventRouterResponse + */ insure(pmcData: IPmcData, body: IInsureRequestData, sessionID: string): IItemEventRouterResponse; onUpdate(secondsSinceLastRun: number): boolean; getRoute(): string; diff --git a/TypeScript/5ReplaceMethod/types/callbacks/InventoryCallbacks.d.ts b/TypeScript/5ReplaceMethod/types/callbacks/InventoryCallbacks.d.ts index 9ab1486..46bf6fd 100644 --- a/TypeScript/5ReplaceMethod/types/callbacks/InventoryCallbacks.d.ts +++ b/TypeScript/5ReplaceMethod/types/callbacks/InventoryCallbacks.d.ts @@ -16,6 +16,7 @@ import { IInventorySwapRequestData } from "../models/eft/inventory/IInventorySwa import { IInventoryTagRequestData } from "../models/eft/inventory/IInventoryTagRequestData"; import { IInventoryToggleRequestData } from "../models/eft/inventory/IInventoryToggleRequestData"; import { IInventoryTransferRequestData } from "../models/eft/inventory/IInventoryTransferRequestData"; +import { IOpenRandomLootContainerRequestData } from "../models/eft/inventory/IOpenRandomLootContainerRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; export declare class InventoryCallbacks { protected inventoryController: InventoryController; @@ -36,4 +37,5 @@ export declare class InventoryCallbacks { createMapMarker(pmcData: IPmcData, body: IInventoryCreateMarkerRequestData, sessionID: string): IItemEventRouterResponse; deleteMapMarker(pmcData: IPmcData, body: IInventoryDeleteMarkerRequestData, sessionID: string): IItemEventRouterResponse; editMapMarker(pmcData: IPmcData, body: IInventoryEditMarkerRequestData, sessionID: string): IItemEventRouterResponse; + openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/5ReplaceMethod/types/callbacks/ItemEventCallbacks.d.ts b/TypeScript/5ReplaceMethod/types/callbacks/ItemEventCallbacks.d.ts index f4f04f9..fbb0b5f 100644 --- a/TypeScript/5ReplaceMethod/types/callbacks/ItemEventCallbacks.d.ts +++ b/TypeScript/5ReplaceMethod/types/callbacks/ItemEventCallbacks.d.ts @@ -1,4 +1,5 @@ import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; +import { Warning } from "../models/eft/itemEvent/IItemEventRouterBase"; import { IItemEventRouterRequest } from "../models/eft/itemEvent/IItemEventRouterRequest"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { ItemEventRouter } from "../routers/ItemEventRouter"; @@ -8,4 +9,5 @@ export declare class ItemEventCallbacks { protected itemEventRouter: ItemEventRouter; constructor(httpResponse: HttpResponseUtil, itemEventRouter: ItemEventRouter); handleEvents(url: string, info: IItemEventRouterRequest, sessionID: string): IGetBodyResponseData; + protected getErrorCode(warnings: Warning[]): number; } diff --git a/TypeScript/5ReplaceMethod/types/callbacks/MatchCallbacks.d.ts b/TypeScript/5ReplaceMethod/types/callbacks/MatchCallbacks.d.ts index 2a92ef5..10fbc44 100644 --- a/TypeScript/5ReplaceMethod/types/callbacks/MatchCallbacks.d.ts +++ b/TypeScript/5ReplaceMethod/types/callbacks/MatchCallbacks.d.ts @@ -34,6 +34,10 @@ export declare class MatchCallbacks { serverAvailable(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData | IGetBodyResponseData; joinMatch(url: string, info: IJoinMatchRequestData, sessionID: string): IGetBodyResponseData; getMetrics(url: string, info: any, sessionID: string): IGetBodyResponseData; + /** + * Handle client/match/group/status + * @returns + */ getGroupStatus(url: string, info: IGetGroupStatusRequestData, sessionID: string): IGetBodyResponseData; createGroup(url: string, info: ICreateGroupRequestData, sessionID: string): IGetBodyResponseData; deleteGroup(url: string, info: any, sessionID: string): INullResponseData; diff --git a/TypeScript/5ReplaceMethod/types/callbacks/NotifierCallbacks.d.ts b/TypeScript/5ReplaceMethod/types/callbacks/NotifierCallbacks.d.ts index c42058f..fab325b 100644 --- a/TypeScript/5ReplaceMethod/types/callbacks/NotifierCallbacks.d.ts +++ b/TypeScript/5ReplaceMethod/types/callbacks/NotifierCallbacks.d.ts @@ -4,6 +4,7 @@ import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { INotifierChannel } from "../models/eft/notifier/INotifier"; import { ISelectProfileRequestData } from "../models/eft/notifier/ISelectProfileRequestData"; +import { ISelectProfileResponse } from "../models/eft/notifier/ISelectProfileResponse"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; export declare class NotifierCallbacks { protected httpServerHelper: HttpServerHelper; @@ -19,6 +20,10 @@ export declare class NotifierCallbacks { sendNotification(sessionID: string, req: any, resp: any, data: any): void; getNotifier(url: string, info: any, sessionID: string): IGetBodyResponseData; createNotifierChannel(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - selectProfile(url: string, info: ISelectProfileRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/game/profile/select + * @returns ISelectProfileResponse + */ + selectProfile(url: string, info: ISelectProfileRequestData, sessionID: string): IGetBodyResponseData; notify(url: string, info: any, sessionID: string): string; } diff --git a/TypeScript/5ReplaceMethod/types/callbacks/QuestCallbacks.d.ts b/TypeScript/5ReplaceMethod/types/callbacks/QuestCallbacks.d.ts index 559c29e..2a3eb20 100644 --- a/TypeScript/5ReplaceMethod/types/callbacks/QuestCallbacks.d.ts +++ b/TypeScript/5ReplaceMethod/types/callbacks/QuestCallbacks.d.ts @@ -21,6 +21,13 @@ export declare class QuestCallbacks { acceptQuest(pmcData: IPmcData, body: IAcceptQuestRequestData, sessionID: string): IItemEventRouterResponse; completeQuest(pmcData: IPmcData, body: ICompleteQuestRequestData, sessionID: string): IItemEventRouterResponse; handoverQuest(pmcData: IPmcData, body: IHandoverQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle client/quest/list + * @param url + * @param info + * @param sessionID + * @returns + */ listQuests(url: string, info: IListQuestsRequestData, sessionID: string): IGetBodyResponseData; activityPeriods(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; } diff --git a/TypeScript/5ReplaceMethod/types/callbacks/RagfairCallbacks.d.ts b/TypeScript/5ReplaceMethod/types/callbacks/RagfairCallbacks.d.ts index c609f2f..37f3807 100644 --- a/TypeScript/5ReplaceMethod/types/callbacks/RagfairCallbacks.d.ts +++ b/TypeScript/5ReplaceMethod/types/callbacks/RagfairCallbacks.d.ts @@ -35,7 +35,7 @@ export declare class RagfairCallbacks extends OnLoadOnUpdate { getRoute(): string; search(url: string, info: ISearchRequestData, sessionID: string): IGetBodyResponseData; getMarketPrice(url: string, info: IGetMarketPriceRequestData, sessionID: string): IGetBodyResponseData; - getItemPrices(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + getItemPrices(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData>; addOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; removeOffer(pmcData: IPmcData, info: IRemoveOfferRequestData, sessionID: string): IItemEventRouterResponse; extendOffer(pmcData: IPmcData, info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; diff --git a/TypeScript/5ReplaceMethod/types/callbacks/TraderCallbacks.d.ts b/TypeScript/5ReplaceMethod/types/callbacks/TraderCallbacks.d.ts index e4fd099..40a1455 100644 --- a/TypeScript/5ReplaceMethod/types/callbacks/TraderCallbacks.d.ts +++ b/TypeScript/5ReplaceMethod/types/callbacks/TraderCallbacks.d.ts @@ -12,6 +12,10 @@ export declare class TraderCallbacks extends OnLoadOnUpdate { onUpdate(): boolean; getRoute(): string; getTraderSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/trading/api/getUserAssortPrice/trader + * @returns + */ getProfilePurchases(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData>; getTrader(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getAssort(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; diff --git a/TypeScript/5ReplaceMethod/types/callbacks/WeatherCallbacks.d.ts b/TypeScript/5ReplaceMethod/types/callbacks/WeatherCallbacks.d.ts index ae784c8..f9d2002 100644 --- a/TypeScript/5ReplaceMethod/types/callbacks/WeatherCallbacks.d.ts +++ b/TypeScript/5ReplaceMethod/types/callbacks/WeatherCallbacks.d.ts @@ -1,10 +1,15 @@ import { WeatherController } from "../controllers/WeatherController"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; +import { IWeatherData } from "../models/eft/weather/IWeatherData"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; export declare class WeatherCallbacks { protected httpResponse: HttpResponseUtil; protected weatherController: WeatherController; constructor(httpResponse: HttpResponseUtil, weatherController: WeatherController); - getWeather(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/weather + * @returns IWeatherData + */ + getWeather(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; } diff --git a/TypeScript/5ReplaceMethod/types/context/ContextVariableType.d.ts b/TypeScript/5ReplaceMethod/types/context/ContextVariableType.d.ts index 5fc1704..a7dd9b5 100644 --- a/TypeScript/5ReplaceMethod/types/context/ContextVariableType.d.ts +++ b/TypeScript/5ReplaceMethod/types/context/ContextVariableType.d.ts @@ -1,4 +1,8 @@ export declare enum ContextVariableType { + /** Logged in users session id */ SESSION_ID = 0, - MATCH_INFO = 1 + /** Currently acive raid information */ + MATCH_INFO = 1, + /** Timestamp when client first connected */ + CLIENT_START_TIMESTAMP = 2 } diff --git a/TypeScript/5ReplaceMethod/types/controllers/BotController.d.ts b/TypeScript/5ReplaceMethod/types/controllers/BotController.d.ts index a5111d5..92317c3 100644 --- a/TypeScript/5ReplaceMethod/types/controllers/BotController.d.ts +++ b/TypeScript/5ReplaceMethod/types/controllers/BotController.d.ts @@ -1,6 +1,8 @@ import { ApplicationContext } from "../context/ApplicationContext"; import { BotGenerator } from "../generators/BotGenerator"; +import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { IGenerateBotsRequestData } from "../models/eft/bot/IGenerateBotsRequestData"; import { IBotBase } from "../models/eft/common/tables/IBotBase"; import { IBotCore } from "../models/eft/common/tables/IBotCore"; @@ -10,18 +12,23 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; -import { PmcAiService } from "../services/PmcAiService"; +import { LocalisationService } from "../services/LocalisationService"; +import { JsonUtil } from "../utils/JsonUtil"; export declare class BotController { protected logger: ILogger; protected databaseServer: DatabaseServer; protected botGenerator: BotGenerator; protected botHelper: BotHelper; - protected pmcAiService: PmcAiService; + protected botDifficultyHelper: BotDifficultyHelper; protected botGenerationCacheService: BotGenerationCacheService; + protected localisationService: LocalisationService; + protected weightedRandomHelper: WeightedRandomHelper; protected configServer: ConfigServer; protected applicationContext: ApplicationContext; + protected jsonUtil: JsonUtil; protected botConfig: IBotConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, pmcAiService: PmcAiService, botGenerationCacheService: BotGenerationCacheService, configServer: ConfigServer, applicationContext: ApplicationContext); + static readonly pmcTypeLabel = "PMC"; + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); /** * Return the number of bot loadout varieties to be generated * @param type bot Type we want the loadout gen count for @@ -37,7 +44,6 @@ export declare class BotController { * @returns Difficulty object */ getBotDifficulty(type: string, difficulty: string): Difficulty; - protected getPmcDifficultySettings(pmcType: "bear" | "usec", difficulty: string, usecType: string, bearType: string): Difficulty; /** * Generate bot profiles and store in cache * @param sessionId Session id @@ -51,4 +57,5 @@ export declare class BotController { * @returns cap number */ getBotCap(): number; + getPmcBotTypes(): Record>>; } diff --git a/TypeScript/5ReplaceMethod/types/controllers/DialogueController.d.ts b/TypeScript/5ReplaceMethod/types/controllers/DialogueController.d.ts index 1b72522..9c8b728 100644 --- a/TypeScript/5ReplaceMethod/types/controllers/DialogueController.d.ts +++ b/TypeScript/5ReplaceMethod/types/controllers/DialogueController.d.ts @@ -23,7 +23,7 @@ export declare class DialogueController { * Get the content of a dialogue * @param dialogueID Dialog id * @param sessionID Session Id - * @returns + * @returns DialogueInfo */ getDialogueInfo(dialogueID: string, sessionID: string): DialogueInfo; /** diff --git a/TypeScript/5ReplaceMethod/types/controllers/GameController.d.ts b/TypeScript/5ReplaceMethod/types/controllers/GameController.d.ts index 3bfbdb1..f4f5849 100644 --- a/TypeScript/5ReplaceMethod/types/controllers/GameController.d.ts +++ b/TypeScript/5ReplaceMethod/types/controllers/GameController.d.ts @@ -1,3 +1,4 @@ +import { ApplicationContext } from "../context/ApplicationContext"; import { GameEventHelper } from "../helpers/GameEventHelper"; import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; @@ -14,6 +15,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; +import { LocalisationService } from "../services/LocalisationService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { Watermark } from "../utils/Watermark"; export declare class GameController { @@ -24,14 +26,33 @@ export declare class GameController { protected localeService: LocaleService; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; + protected localisationService: LocalisationService; protected gameEventHelper: GameEventHelper; + protected applicationContext: ApplicationContext; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; protected coreConfig: ICoreConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, gameEventHelper: GameEventHelper, configServer: ConfigServer); - gameStart(_url: string, _info: IEmptyRequestData, sessionID: string): void; + constructor(logger: ILogger, databaseServer: DatabaseServer, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, gameEventHelper: GameEventHelper, applicationContext: ApplicationContext, configServer: ConfigServer); + gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; + /** + * Check if current date falls inside any of the seasons events pased in, if so, handle them + * @param seasonalEvents events to check for + */ protected checkForAndEnableSeasonalEvents(seasonalEvents: ISeasonalEvent[]): void; + /** + * Make adjusted to server code based on the name of the event passed in + * @param globalConfig globals.json + * @param eventName Name of the event to enable. e.g. Christmas + */ protected updateGlobalEvents(globalConfig: Config, eventName: string): void; + /** + * Read in data from seasonalEvents.json and add found equipment items to bots + * @param eventName Name of the event to read equipment in from config + */ + protected addEventGearToScavs(eventName: string): void; + /** + * Set Khorovod(dancing tree) chance to 100% on all maps that support it + */ protected enableDancingTree(): void; /** * Make non-trigger-spawned raiders spawn earlier + always @@ -40,5 +61,6 @@ export declare class GameController { protected logProfileDetails(fullProfile: IAkiProfile): void; getGameConfig(sessionID: string): IGameConfigResponse; getServer(): IServerDetails[]; + protected addPumpkinsToScavBackpacks(): void; getValidGameVersion(): ICheckVersionResponse; } diff --git a/TypeScript/5ReplaceMethod/types/controllers/HideoutController.d.ts b/TypeScript/5ReplaceMethod/types/controllers/HideoutController.d.ts index ada5bd9..5b6507b 100644 --- a/TypeScript/5ReplaceMethod/types/controllers/HideoutController.d.ts +++ b/TypeScript/5ReplaceMethod/types/controllers/HideoutController.d.ts @@ -23,12 +23,13 @@ import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; import { PlayerService } from "../services/PlayerService"; import { HashUtil } from "../utils/HashUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; -import { JsonUtil } from "../utils/JsonUtil"; export declare class HideoutController { protected logger: ILogger; protected hashUtil: HashUtil; @@ -45,11 +46,12 @@ export declare class HideoutController { protected profileHelper: ProfileHelper; protected hideoutHelper: HideoutHelper; protected scavCaseRewardGenerator: ScavCaseRewardGenerator; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected jsonUtil: JsonUtil; protected static nameBackendCountersCrafting: string; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, configServer: ConfigServer, jsonUtil: JsonUtil); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, localisationService: LocalisationService, configServer: ConfigServer, jsonUtil: JsonUtil); upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; upgradeComplete(pmcData: IPmcData, body: HideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; /** diff --git a/TypeScript/5ReplaceMethod/types/controllers/InraidController.d.ts b/TypeScript/5ReplaceMethod/types/controllers/InraidController.d.ts index e84eea1..39a6396 100644 --- a/TypeScript/5ReplaceMethod/types/controllers/InraidController.d.ts +++ b/TypeScript/5ReplaceMethod/types/controllers/InraidController.d.ts @@ -6,6 +6,7 @@ import { ProfileHelper } from "../helpers/ProfileHelper"; import { QuestHelper } from "../helpers/QuestHelper"; import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; +import { Item } from "../models/eft/common/tables/IItem"; import { IRegisterPlayerRequestData } from "../models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; import { IAirdropConfig } from "../models/spt/config/IAirdropConfig"; @@ -17,6 +18,9 @@ import { SaveServer } from "../servers/SaveServer"; import { InsuranceService } from "../services/InsuranceService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; +/** + * Logic for handling In Raid callbacks + */ export declare class InraidController { protected logger: ILogger; protected saveServer: SaveServer; @@ -35,14 +39,42 @@ export declare class InraidController { protected airdropConfig: IAirdropConfig; protected inraidConfig: IInRaidConfig; 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 + * Save locationid to active profiles inraid object + * @param sessionID Session id + * @param info Register player request + */ + addPlayer(sessionID: string, info: IRegisterPlayerRequestData): void; + /** + * Save profile state to disk + * Handles pmc/pscav + * @param offraidData post-raid request data + * @param sessionID Session id + */ + savePostRaidProgress(offraidData: ISaveProgressRequestData, sessionID: string): void; + /** + * Handle updating player profile post-pmc raid * @param sessionID session id - * @param offraidData post-raid data of raid + * @param offraidData post-raid data */ protected savePmcProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; + /** + * Make changes to pmc profile after they left raid dead, + * alter bodypart hp, handle insurance, delete inventory items, remove carried quest items + * @param postRaidSaveRequest post-raid save request + * @param pmcData pmc profile + * @param insuranceEnabled is insurance enabled + * @param preRaidGear gear player had before raid + * @param sessionID Session id + * @returns Updated profile object + */ + protected performPostRaidActionsWhenDead(postRaidSaveRequest: ISaveProgressRequestData, pmcData: IPmcData, insuranceEnabled: boolean, preRaidGear: Item[], sessionID: string): IPmcData; + /** + * Adjust player characters bodypart hp if they left raid early + * @param postRaidSaveRequest post raid data + * @param pmcData player profile + */ + protected updatePmcHealthPostRaid(postRaidSaveRequest: ISaveProgressRequestData, pmcData: IPmcData): void; /** * Reduce body part hp to % of max * @param pmcData profile to edit @@ -68,7 +100,31 @@ export declare class InraidController { * @param isPlayerScav Was the player a pScav */ protected markOrRemoveFoundInRaidItems(offraidData: ISaveProgressRequestData, pmcData: IPmcData, isPlayerScav: boolean): void; + /** + * Update profile after player completes scav raid + * @param scavData Scav profile + * @param sessionID Session id + * @param offraidData Post-raid save request + * @param pmcData Pmc profile + * @param isDead Is player dead + */ protected handlePostRaidPlayerScavProcess(scavData: IPmcData, sessionID: string, offraidData: ISaveProgressRequestData, pmcData: IPmcData, isDead: boolean): void; + /** + * Update profile with scav karma values based on in-raid actions + * @param pmcData Pmc profile + * @param offraidData Post-raid save request + * @param scavData Scav profile + * @param sessionID Session id + */ protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData, scavData: IPmcData, sessionID: string): void; + /** + * Get the inraid config from configs/inraid.json + * @returns InRaid Config + */ + getInraidConfig(): IInRaidConfig; + /** + * Get airdrop config from configs/airdrop.json + * @returns Airdrop config + */ getAirdropConfig(): IAirdropConfig; } diff --git a/TypeScript/5ReplaceMethod/types/controllers/InsuranceController.d.ts b/TypeScript/5ReplaceMethod/types/controllers/InsuranceController.d.ts index 14bf129..54f31b5 100644 --- a/TypeScript/5ReplaceMethod/types/controllers/InsuranceController.d.ts +++ b/TypeScript/5ReplaceMethod/types/controllers/InsuranceController.d.ts @@ -30,8 +30,7 @@ export declare class InsuranceController { protected insuranceService: InsuranceService; protected configServer: ConfigServer; protected insuranceConfig: IInsuranceConfig; - constructor(logger: ILogger, randomUtil: RandomUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, paymentService: PaymentService, // TODO: delay required - insuranceService: InsuranceService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, paymentService: PaymentService, insuranceService: InsuranceService, configServer: ConfigServer); processReturn(): void; insure(pmcData: IPmcData, body: IInsureRequestData, sessionID: string): IItemEventRouterResponse; /** diff --git a/TypeScript/5ReplaceMethod/types/controllers/InventoryController.d.ts b/TypeScript/5ReplaceMethod/types/controllers/InventoryController.d.ts index 6a1a21e..e1c08c0 100644 --- a/TypeScript/5ReplaceMethod/types/controllers/InventoryController.d.ts +++ b/TypeScript/5ReplaceMethod/types/controllers/InventoryController.d.ts @@ -1,8 +1,8 @@ -import { EventOutputHolder } from "../routers/EventOutputHolder"; import { InventoryHelper } from "../helpers/InventoryHelper"; import { PaymentHelper } from "../helpers/PaymentHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IAddItemRequestData } from "../models/eft/inventory/IAddItemRequestData"; import { IInventoryBindRequestData } from "../models/eft/inventory/IInventoryBindRequestData"; @@ -21,33 +21,46 @@ import { IInventorySwapRequestData } from "../models/eft/inventory/IInventorySwa import { IInventoryTagRequestData } from "../models/eft/inventory/IInventoryTagRequestData"; import { IInventoryToggleRequestData } from "../models/eft/inventory/IInventoryToggleRequestData"; import { IInventoryTransferRequestData } from "../models/eft/inventory/IInventoryTransferRequestData"; +import { IOpenRandomLootContainerRequestData } from "../models/eft/inventory/IOpenRandomLootContainerRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { ILogger } from "../models/spt/utils/ILogger"; +import { EventOutputHolder } from "../routers/EventOutputHolder"; import { DatabaseServer } from "../servers/DatabaseServer"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { HashUtil } from "../utils/HashUtil"; +import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { JsonUtil } from "../utils/JsonUtil"; +import { RandomUtil } from "../utils/RandomUtil"; export declare class InventoryController { protected logger: ILogger; protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; + protected randomUtil: RandomUtil; protected databaseServer: DatabaseServer; protected fenceService: FenceService; protected presetHelper: PresetHelper; protected inventoryHelper: InventoryHelper; protected ragfairOfferService: RagfairOfferService; protected profileHelper: ProfileHelper; + protected weightedRandomHelper: WeightedRandomHelper; protected paymentHelper: PaymentHelper; + protected localisationService: LocalisationService; protected eventOutputHolder: EventOutputHolder; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder); + protected httpResponseUtil: HttpResponseUtil; + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, weightedRandomHelper: WeightedRandomHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); /** * Move Item * change location of item with parentId and slotId * transfers items from one profile to another if fromOwner/toOwner is set in the body. * otherwise, move is contained within the same profile_f. - */ - moveItem(pmcData: IPmcData, body: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; + * @param pmcData Profile + * @param moveRequest Move request data + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ + moveItem(pmcData: IPmcData, moveRequest: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; /** * Remove Item from Profile * Deep tree item deletion, also removes items from insurance list @@ -122,4 +135,12 @@ export declare class InventoryController { createMapMarker(pmcData: IPmcData, body: IInventoryCreateMarkerRequestData, sessionID: string): IItemEventRouterResponse; deleteMapMarker(pmcData: IPmcData, body: IInventoryDeleteMarkerRequestData, sessionID: string): IItemEventRouterResponse; editMapMarker(pmcData: IPmcData, body: IInventoryEditMarkerRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle event fired when a container is unpacked (currently only the halloween pumpkin) + * @param pmcData Profile data + * @param body open loot container request data + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ + openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/5ReplaceMethod/types/controllers/LocationController.d.ts b/TypeScript/5ReplaceMethod/types/controllers/LocationController.d.ts index 9db3205..b6feba8 100644 --- a/TypeScript/5ReplaceMethod/types/controllers/LocationController.d.ts +++ b/TypeScript/5ReplaceMethod/types/controllers/LocationController.d.ts @@ -7,6 +7,7 @@ import { LootItem } from "../models/spt/services/LootItem"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -15,12 +16,13 @@ export declare class LocationController { protected hashUtil: HashUtil; protected logger: ILogger; protected locationGenerator: LocationGenerator; + protected localisationService: LocalisationService; protected lootGenerator: LootGenerator; protected databaseServer: DatabaseServer; protected timeUtil: TimeUtil; protected configServer: ConfigServer; protected airdropConfig: IAirdropConfig; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, logger: ILogger, locationGenerator: LocationGenerator, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer); + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer); get(location: string): ILocationBase; generate(name: string): ILocationBase; generateAll(): ILocationsGenerateAllResponse; diff --git a/TypeScript/5ReplaceMethod/types/controllers/MatchController.d.ts b/TypeScript/5ReplaceMethod/types/controllers/MatchController.d.ts index dac6a3f..2b0d150 100644 --- a/TypeScript/5ReplaceMethod/types/controllers/MatchController.d.ts +++ b/TypeScript/5ReplaceMethod/types/controllers/MatchController.d.ts @@ -19,7 +19,6 @@ import { SaveServer } from "../servers/SaveServer"; import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; import { BotLootCacheService } from "../services/BotLootCacheService"; import { MatchLocationService } from "../services/MatchLocationService"; -import { PmcAiService } from "../services/PmcAiService"; import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; export declare class MatchController { protected logger: ILogger; @@ -30,13 +29,12 @@ export declare class MatchController { protected botLootCacheService: BotLootCacheService; protected configServer: ConfigServer; protected profileSnapshotService: ProfileSnapshotService; - protected pmcAiService: PmcAiService; protected botGenerationCacheService: BotGenerationCacheService; 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, pmcAiService: PmcAiService, botGenerationCacheService: BotGenerationCacheService, applicationContext: ApplicationContext); + constructor(logger: ILogger, saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, botGenerationCacheService: BotGenerationCacheService, applicationContext: ApplicationContext); getEnabled(): boolean; getProfile(info: IGetProfileRequestData): IPmcData[]; createGroup(sessionID: string, info: ICreateGroupRequestData): any; diff --git a/TypeScript/5ReplaceMethod/types/controllers/RagfairController.d.ts b/TypeScript/5ReplaceMethod/types/controllers/RagfairController.d.ts index 5440458..95702f2 100644 --- a/TypeScript/5ReplaceMethod/types/controllers/RagfairController.d.ts +++ b/TypeScript/5ReplaceMethod/types/controllers/RagfairController.d.ts @@ -29,6 +29,7 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { RagfairServer } from "../servers/RagfairServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; import { PaymentService } from "../services/PaymentService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { RagfairPriceService } from "../services/RagfairPriceService"; @@ -62,9 +63,10 @@ export declare class RagfairController { protected ragfairOfferService: RagfairOfferService; protected ragfairRequiredItemsService: RagfairRequiredItemsService; protected ragfairOfferGenerator: RagfairOfferGenerator; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, eventOutputHolder: EventOutputHolder, ragfairServer: RagfairServer, ragfairPriceService: RagfairPriceService, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer, ragfairSellHelper: RagfairSellHelper, ragfairTaxHelper: RagfairTaxHelper, ragfairSortHelper: RagfairSortHelper, ragfairOfferHelper: RagfairOfferHelper, profileHelper: ProfileHelper, paymentService: PaymentService, handbookHelper: HandbookHelper, paymentHelper: PaymentHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, ragfairOfferGenerator: RagfairOfferGenerator, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, eventOutputHolder: EventOutputHolder, ragfairServer: RagfairServer, ragfairPriceService: RagfairPriceService, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer, ragfairSellHelper: RagfairSellHelper, ragfairTaxHelper: RagfairTaxHelper, ragfairSortHelper: RagfairSortHelper, ragfairOfferHelper: RagfairOfferHelper, profileHelper: ProfileHelper, paymentService: PaymentService, handbookHelper: HandbookHelper, paymentHelper: PaymentHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, ragfairOfferGenerator: RagfairOfferGenerator, localisationService: LocalisationService, configServer: ConfigServer); getOffers(sessionID: string, info: ISearchRequestData): IGetOffersResult; /** * Get offers for the client based on type of search being performed @@ -103,7 +105,12 @@ export declare class RagfairController { protected isLinkedSearch(info: ISearchRequestData): boolean; protected isRequiredSearch(info: ISearchRequestData): boolean; update(): void; - getItemPrice(info: IGetMarketPriceRequestData): IGetItemPriceResult; + /** + * Called when creating an offer on flea, fills values in top right corner + * @param getPriceRequest + * @returns min/avg/max values for an item based on flea offers available + */ + getItemMinAvgMaxFleaPriceValues(getPriceRequest: IGetMarketPriceRequestData): IGetItemPriceResult; addPlayerOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; createPlayerOffer(profile: IAkiProfile, requirements: Requirement[], items: Item[], sellInOnePiece: boolean, amountToSend: number): IRagfairOffer; getAllFleaPrices(): Record; diff --git a/TypeScript/5ReplaceMethod/types/controllers/RepeatableQuestController.d.ts b/TypeScript/5ReplaceMethod/types/controllers/RepeatableQuestController.d.ts index 7db5886..333583b 100644 --- a/TypeScript/5ReplaceMethod/types/controllers/RepeatableQuestController.d.ts +++ b/TypeScript/5ReplaceMethod/types/controllers/RepeatableQuestController.d.ts @@ -17,6 +17,7 @@ import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { ItemFilterService } from "../services/ItemFilterService"; +import { LocalisationService } from "../services/LocalisationService"; import { PaymentService } from "../services/PaymentService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { JsonUtil } from "../utils/JsonUtil"; @@ -64,12 +65,13 @@ export declare class RepeatableQuestController { protected profileFixerService: ProfileFixerService; protected ragfairServerHelper: RagfairServerHelper; protected eventOutputHolder: EventOutputHolder; + protected localisationService: LocalisationService; protected paymentService: PaymentService; protected objectId: ObjectId; protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * This is the method reached by the /client/repeatalbeQuests/activityPeriods endpoint * Returns an array of objects in the format of repeatable quests to the client. diff --git a/TypeScript/5ReplaceMethod/types/controllers/WeatherController.d.ts b/TypeScript/5ReplaceMethod/types/controllers/WeatherController.d.ts index ca7f5eb..631a90c 100644 --- a/TypeScript/5ReplaceMethod/types/controllers/WeatherController.d.ts +++ b/TypeScript/5ReplaceMethod/types/controllers/WeatherController.d.ts @@ -1,11 +1,18 @@ import { WeatherGenerator } from "../generators/WeatherGenerator"; import { IWeatherData } from "../models/eft/weather/IWeatherData"; import { IWeatherConfig } from "../models/spt/config/IWeatherConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; export declare class WeatherController { protected weatherGenerator: WeatherGenerator; + protected logger: ILogger; protected configServer: ConfigServer; protected weatherConfig: IWeatherConfig; - constructor(weatherGenerator: WeatherGenerator, configServer: ConfigServer); + constructor(weatherGenerator: WeatherGenerator, logger: ILogger, configServer: ConfigServer); generate(): IWeatherData; + /** + * Get the current in-raid time (MUST HAVE PLAYER LOGGED INTO CLIENT TO WORK) + * @returns Date object + */ + getCurrentInRaidTime(): Date; } diff --git a/TypeScript/5ReplaceMethod/types/generators/BotGenerator.d.ts b/TypeScript/5ReplaceMethod/types/generators/BotGenerator.d.ts index 2ac51db..a1ac9ed 100644 --- a/TypeScript/5ReplaceMethod/types/generators/BotGenerator.d.ts +++ b/TypeScript/5ReplaceMethod/types/generators/BotGenerator.d.ts @@ -1,7 +1,8 @@ +import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; import { GameEventHelper } from "../helpers/GameEventHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; -import { IGenerateBotsRequestData } from "../models/eft/bot/IGenerateBotsRequestData"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { Health as PmcHealth, IBotBase, Skills } from "../models/eft/common/tables/IBotBase"; import { Health, IBotType, Inventory } from "../models/eft/common/tables/IBotType"; import { IBotConfig } from "../models/spt/config/IBotConfig"; @@ -9,7 +10,6 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; -import { PmcAiService } from "../services/PmcAiService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; @@ -29,12 +29,13 @@ export declare class BotGenerator { protected databaseServer: DatabaseServer; protected botInventoryGenerator: BotInventoryGenerator; protected botEquipmentFilterService: BotEquipmentFilterService; + protected weightedRandomHelper: WeightedRandomHelper; protected botHelper: BotHelper; + protected botDifficultyHelper: BotDifficultyHelper; protected gameEventHelper: GameEventHelper; - protected pmcAiService: PmcAiService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botEquipmentFilterService: BotEquipmentFilterService, botHelper: BotHelper, gameEventHelper: GameEventHelper, pmcAiService: PmcAiService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botEquipmentFilterService: BotEquipmentFilterService, weightedRandomHelper: WeightedRandomHelper, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, gameEventHelper: GameEventHelper, configServer: ConfigServer); /** * Generate a player scav bot object * @param role e.g. assault / pmcbot @@ -44,12 +45,18 @@ export declare class BotGenerator { */ generatePlayerScav(sessionId: string, role: string, difficulty: string, botTemplate: IBotType): IBotBase; /** - * Generate an array of bot objects for populate a raid with + * Generate an array of bot objects based on a condition for a raid with * @param sessionId session id - * @param info request object + * @param condition request condition * @returns bot array */ - generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; + generateByCondition(sessionId: string, botCountToGenerate: number, difficulty: string, role: string, isPmc: boolean): IBotBase[]; + /** + * Get the PMCs wildSpawnType value + * @param role "usec" / "bear" + * @returns wildSpawnType value as string + */ + protected getPmcRoleByDescription(role: string): string; /** * Get a randomised PMC side based on bot config value 'isUsec' * @returns pmc side as string @@ -64,13 +71,13 @@ export declare class BotGenerator { * Create a IBotBase object with equipment/loot/exp etc * @param sessionId Session id * @param bot bots base file - * @param role botRole bot will use + * @param botRole Role bot will use (bear/usec for PMCs) * @param node Bot template from db/bots/x.json * @param isPmc Is bot to be a PMC * @param isPlayerScav is bot to be a p scav bot * @returns IBotBase object */ - protected generateBot(sessionId: string, bot: IBotBase, role: string, node: IBotType, isPmc: boolean, isPlayerScav?: boolean): IBotBase; + protected generateBot(sessionId: string, bot: IBotBase, botRole: string, node: IBotType, isPmc: boolean, isPlayerScav?: boolean): IBotBase; /** * Log the number of PMCs generated to the debug console * @param output Generated bot array, ready to send to client diff --git a/TypeScript/5ReplaceMethod/types/generators/BotInventoryGenerator.d.ts b/TypeScript/5ReplaceMethod/types/generators/BotInventoryGenerator.d.ts index c5ed545..e1efaf2 100644 --- a/TypeScript/5ReplaceMethod/types/generators/BotInventoryGenerator.d.ts +++ b/TypeScript/5ReplaceMethod/types/generators/BotInventoryGenerator.d.ts @@ -7,6 +7,7 @@ import { IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { BotLootGenerator } from "./BotLootGenerator"; @@ -20,14 +21,68 @@ export declare class BotInventoryGenerator { protected botLootGenerator: BotLootGenerator; protected botGeneratorHelper: BotGeneratorHelper; protected weightedRandomHelper: WeightedRandomHelper; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, configServer: ConfigServer); + /** + * Add equipment/weapons/loot to bot + * @param sessionId Session id + * @param templateInventory bot/x.json data from db + * @param equipmentChances Chances each item will be added to bot + * @param itemGenerationLimitsMinMax item gen limits for bot role + * @param botRole Role bot has (assault/pmcBot) + * @param isPmc Is bot being converted into a pmc + * @returns PmcInventory object with equipment/weapons/loot + */ generateInventory(sessionId: string, templateInventory: Inventory, equipmentChances: Chances, itemGenerationLimitsMinMax: Generation, botRole: string, isPmc: boolean): PmcInventory; + /** + * Create a pmcInventory object with all the base/generic items needed + * @returns PmcInventory object + */ + protected generateInventoryBase(): PmcInventory; + /** + * Add equipment to a bot + * @param templateInventory bot/x.json data from db + * @param equipmentChances Chances items will be added to bot + * @param botRole Role bot has (assault/pmcBot) + * @param botInventory Inventory to add equipment to + */ + protected generateAndAddEquipmentToBot(templateInventory: Inventory, equipmentChances: Chances, botRole: string, botInventory: PmcInventory): void; + protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory): void; + /** + * Work out what weapons bot should have equipped and add them to bot inventory + * @param templateInventory bot/x.json data from db + * @param equipmentChances Chances bot can have equipment equipped + * @param sessionId Session id + * @param botInventory Inventory to add weapons to + * @param botRole assault/pmcBot/bossTagilla etc + * @param isPmc Is the bot being generated as a pmc + * @param itemGenerationLimitsMinMax Limits for items the bot can have + */ + protected generateAndAddWeaponsToBot(templateInventory: Inventory, equipmentChances: Chances, sessionId: string, botInventory: PmcInventory, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation): void; + /** + * Calculate if the bot should have weapons in Primary/Secondary/Holster slots + * @param equipmentChances Chances bot has certain equipment + * @returns What slots bot should have weapons generated for + */ + protected getDesiredWeaponsForBot(equipmentChances: Chances): { + slot: EquipmentSlots; + shouldSpawn: boolean; + }[]; + /** + * Add weapon + spare mags/ammo to bots inventory + * @param sessionId Session id + * @param weaponSlot Weapon slot being generated + * @param templateInventory bot/x.json data from db + * @param botInventory Inventory to add weapon+mags/ammo to + * @param equipmentChances Chances bot can have equipment equipped + * @param botRole assault/pmcBot/bossTagilla etc + * @param isPmc Is the bot being generated as a pmc + * @param itemGenerationLimitsMinMax + */ protected addWeaponAndMagazinesToInventory(sessionId: string, weaponSlot: { slot: EquipmentSlots; shouldSpawn: boolean; }, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation): void; - protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory): void; - protected generateInventoryBase(): PmcInventory; } diff --git a/TypeScript/5ReplaceMethod/types/generators/BotLootGenerator.d.ts b/TypeScript/5ReplaceMethod/types/generators/BotLootGenerator.d.ts index c1f5310..3352a46 100644 --- a/TypeScript/5ReplaceMethod/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/5ReplaceMethod/types/generators/BotLootGenerator.d.ts @@ -10,6 +10,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotLootCacheService } from "../services/BotLootCacheService"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { BotWeaponGenerator } from "./BotWeaponGenerator"; @@ -23,9 +24,10 @@ export declare class BotLootGenerator { protected botWeaponGenerator: BotWeaponGenerator; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected botLootCacheService: BotLootCacheService; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, configServer: ConfigServer); generateLoot(sessionId: string, templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances): void; protected getRandomisedCount(min: number, max: number, nValue: number): number; /** @@ -113,7 +115,7 @@ export declare class BotLootGenerator { * If no limit found for a non pmc bot, fall back to defaults * @param isPmc is the bot we want limits for a pmc * @param botRole what role does the bot have - * @returns dictionary of tplIds and limit + * @returns Dictionary of tplIds and limit */ protected getItemSpawnLimitsForBotType(isPmc: boolean, botRole: string): Record; /** diff --git a/TypeScript/5ReplaceMethod/types/generators/BotWeaponGenerator.d.ts b/TypeScript/5ReplaceMethod/types/generators/BotWeaponGenerator.d.ts index 487901b..40284ea 100644 --- a/TypeScript/5ReplaceMethod/types/generators/BotWeaponGenerator.d.ts +++ b/TypeScript/5ReplaceMethod/types/generators/BotWeaponGenerator.d.ts @@ -12,6 +12,7 @@ import { IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; @@ -27,10 +28,11 @@ export declare class BotWeaponGenerator { protected randomUtil: RandomUtil; protected configServer: ConfigServer; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected localisationService: LocalisationService; protected inventoryMagGenComponents: IInventoryMagGen[]; protected readonly modMagazineSlotId = "mod_magazine"; protected botConfig: IBotConfig; - constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil, configServer: ConfigServer, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, inventoryMagGenComponents: IInventoryMagGen[]); + constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil, configServer: ConfigServer, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, inventoryMagGenComponents: IInventoryMagGen[]); /** * Pick a random weapon based on weightings and generate a functional weapon * @param equipmentSlot Primary/secondary/holster diff --git a/TypeScript/5ReplaceMethod/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/5ReplaceMethod/types/generators/RagfairOfferGenerator.d.ts index b64a7e7..23882d2 100644 --- a/TypeScript/5ReplaceMethod/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/5ReplaceMethod/types/generators/RagfairOfferGenerator.d.ts @@ -1,16 +1,19 @@ +import { HandbookHelper } from "../helpers/HandbookHelper"; import { ItemHelper } from "../helpers/ItemHelper"; +import { PaymentHelper } from "../helpers/PaymentHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; import { Item } from "../models/eft/common/tables/IItem"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { IBarterScheme } from "../models/eft/common/tables/ITrader"; -import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; +import { IRagfairOffer, OfferRequirement } from "../models/eft/ragfair/IRagfairOffer"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { RagfairCategoriesService } from "../services/RagfairCategoriesService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { RagfairPriceService } from "../services/RagfairPriceService"; @@ -27,18 +30,31 @@ export declare class RagfairOfferGenerator { protected timeUtil: TimeUtil; protected databaseServer: DatabaseServer; protected ragfairServerHelper: RagfairServerHelper; + protected handbookHelper: HandbookHelper; protected saveServer: SaveServer; protected presetHelper: PresetHelper; protected ragfairAssortGenerator: RagfairAssortGenerator; protected ragfairOfferService: RagfairOfferService; protected ragfairPriceService: RagfairPriceService; + protected localisationService: LocalisationService; + protected paymentHelper: PaymentHelper; protected ragfairCategoriesService: RagfairCategoriesService; protected fenceService: FenceService; protected itemHelper: ItemHelper; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, ragfairServerHelper: RagfairServerHelper, saveServer: SaveServer, presetHelper: PresetHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferService: RagfairOfferService, ragfairPriceService: RagfairPriceService, ragfairCategoriesService: RagfairCategoriesService, fenceService: FenceService, itemHelper: ItemHelper, configServer: ConfigServer); + protected allowedFleaPriceItemsForBarter: { + tpl: string; + price: number; + }[]; + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, ragfairServerHelper: RagfairServerHelper, handbookHelper: HandbookHelper, saveServer: SaveServer, presetHelper: PresetHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferService: RagfairOfferService, ragfairPriceService: RagfairPriceService, localisationService: LocalisationService, paymentHelper: PaymentHelper, ragfairCategoriesService: RagfairCategoriesService, fenceService: FenceService, itemHelper: ItemHelper, configServer: ConfigServer); createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; + /** + * Calculate the offer price that's listed on the flea listing + * @param offerRequirements barter requirements for offer + * @returns rouble cost of offer + */ + protected calculateOfferListingPrice(offerRequirements: OfferRequirement[]): number; /** * Get avatar url from trader table in db * @param isTrader Is user we're getting avatar for a trader @@ -87,20 +103,36 @@ export declare class RagfairOfferGenerator { * @returns Item with conditions added */ protected addMissingCondition(item: Item): Item; - protected getOfferRequirements(items: Item[]): { - count: number; - _tpl: string; + /** + * Create a barter-based barter scheme, if not possible, fall back to making barter scheme currency based + * @param offerItems Items for sale in offer + * @returns barter scheme + */ + protected createBarterRequirement(offerItems: Item[]): IBarterScheme[]; + /** + * Get an array of flea prices + item tpl, cached in generator class + * @returns array with tpl/price values + */ + protected getFleaPricesAsArray(): { + tpl: string; + price: number; }[]; + /** + * Create a random currency-based barter scheme for an array of items + * @param offerItems Items on offer + * @returns Barter scheme for offer + */ + protected createCurrencyRequirement(offerItems: Item[]): IBarterScheme[]; /** * Create a flea offer and store it in the Ragfair server offers array * @param userID owner of the offer * @param time time offer is put up * @param items items in the offer - * @param barterScheme - * @param loyalLevel + * @param barterScheme cost of item (currency or barter) + * @param loyalLevel Loyalty level needed to buy item * @param price price of offer * @param sellInOnePiece - * @returns + * @returns Ragfair offer */ createFleaOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; } diff --git a/TypeScript/5ReplaceMethod/types/generators/WeatherGenerator.d.ts b/TypeScript/5ReplaceMethod/types/generators/WeatherGenerator.d.ts index 8ddbe49..65d2c76 100644 --- a/TypeScript/5ReplaceMethod/types/generators/WeatherGenerator.d.ts +++ b/TypeScript/5ReplaceMethod/types/generators/WeatherGenerator.d.ts @@ -1,38 +1,54 @@ +import { ApplicationContext } from "../context/ApplicationContext"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; -import { IWeatherData } from "../models/eft/weather/IWeatherData"; +import { IWeather, IWeatherData } from "../models/eft/weather/IWeatherData"; +import { WindDirection } from "../models/enums/WindDirection"; import { IWeatherConfig } from "../models/spt/config/IWeatherConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class WeatherGenerator { protected weightedRandomHelper: WeightedRandomHelper; + protected logger: ILogger; protected randomUtil: RandomUtil; protected timeUtil: TimeUtil; + protected applicationContext: ApplicationContext; protected configServer: ConfigServer; protected weatherConfig: IWeatherConfig; - constructor(weightedRandomHelper: WeightedRandomHelper, randomUtil: RandomUtil, timeUtil: TimeUtil, configServer: ConfigServer); - calculateTime(data: IWeatherData): IWeatherData; + constructor(weightedRandomHelper: WeightedRandomHelper, logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, applicationContext: ApplicationContext, configServer: ConfigServer); + calculateGameTime(data: IWeatherData): IWeatherData; /** * Get server uptime seconds multiplied by a multiplier and add to current time as seconds * Format to BSGs requirements - * @param computedDate current date + * @param currentDate current date * @returns formatted time */ - protected getAcceleratedTime(computedDate: Date): string; + protected getBsgFormattedInRaidTime(currentDate: Date): string; + /** + * Get the current in-raid time + * @param currentDate (new Date()) + * @returns Date object of current in-raid time + */ + getInRaidTime(currentDate: Date): Date; /** * Get current time formatted to fit BSGs requirement - * @param computedDate date to format into bsg style + * @param date date to format into bsg style * @returns */ - protected getNormalTime(computedDate: Date): string; + protected getBSGFormattedTime(date: Date): string; /** - * Return randomised Weather data - * @param weatherData weather input data + * Return randomised Weather data with help of config/weather.json * @returns Randomised weather data */ - generateWeather(weatherData: IWeatherData): IWeatherData; - protected getWeightedFog(): string; + generateWeather(): IWeather; + /** + * Set IWeather date/time/timestamp values to now + * @param weather Object to update + */ + protected setCurrentDateTime(weather: IWeather): void; + protected getWeightedWindDirection(): WindDirection; + protected getWeightedWindSpeed(): number; + protected getWeightedFog(): number; protected getWeightedRain(): number; protected getRandomFloat(node: string): number; - protected getRandomInt(node: string): number; } diff --git a/TypeScript/5ReplaceMethod/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts b/TypeScript/5ReplaceMethod/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts index 4fcb1e2..1589707 100644 --- a/TypeScript/5ReplaceMethod/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts +++ b/TypeScript/5ReplaceMethod/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts @@ -1,13 +1,15 @@ import { BotWeaponGeneratorHelper } from "../../../helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "../../../helpers/ItemHelper"; import { ILogger } from "../../../models/spt/utils/ILogger"; +import { LocalisationService } from "../../../services/LocalisationService"; import { IInventoryMagGen } from "../IInventoryMagGen"; import { InventoryMagGen } from "../InventoryMagGen"; export declare class ExternalInventoryMagGen implements IInventoryMagGen { protected logger: ILogger; protected itemHelper: ItemHelper; + protected localisationService: LocalisationService; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; - constructor(logger: ILogger, itemHelper: ItemHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper); + constructor(logger: ILogger, itemHelper: ItemHelper, localisationService: LocalisationService, botWeaponGeneratorHelper: BotWeaponGeneratorHelper); getPriority(): number; canHandleInventoryMagGen(inventoryMagGen: InventoryMagGen): boolean; process(inventoryMagGen: InventoryMagGen): void; diff --git a/TypeScript/5ReplaceMethod/types/helpers/BotDifficultyHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/BotDifficultyHelper.d.ts new file mode 100644 index 0000000..a58ebdb --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/helpers/BotDifficultyHelper.d.ts @@ -0,0 +1,46 @@ +import { Difficulty } from "../models/eft/common/tables/IBotType"; +import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; +import { JsonUtil } from "../utils/JsonUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +import { BotHelper } from "./BotHelper"; +export declare class BotDifficultyHelper { + protected logger: ILogger; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected randomUtil: RandomUtil; + protected localisationService: LocalisationService; + protected botHelper: BotHelper; + protected configServer: ConfigServer; + protected botConfig: IBotConfig; + constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, localisationService: LocalisationService, botHelper: BotHelper, configServer: ConfigServer); + getPmcDifficultySettings(pmcType: "bear" | "usec", difficulty: string, usecType: string, bearType: string): Difficulty; + /** + * Get difficulty settings for desired bot type, if not found use assault bot types + * @param type bot type to retreive difficulty of + * @param difficulty difficulty to get settings for (easy/normal etc) + * @returns Difficulty object + */ + getBotDifficultySettings(type: string, difficulty: string): Difficulty; + /** + * Get difficulty settings for a PMC + * @param type "usec" / "bear" + * @param difficulty what difficulty to retrieve + * @returns Difficulty object + */ + protected getDifficultySettings(type: string, difficulty: string): Difficulty; + /** + * Translate chosen value from pre-raid difficulty dropdown into bot difficulty value + * @param dropDownDifficulty Dropdown difficulty value to convert + * @returns bot difficulty + */ + convertBotDifficultyDropdownToBotDifficulty(dropDownDifficulty: string): string; + /** + * Choose a random difficulty from - easy/normal/hard/impossible + * @returns random difficulty + */ + chooseRandomDifficulty(): string; +} diff --git a/TypeScript/5ReplaceMethod/types/helpers/BotGeneratorHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/BotGeneratorHelper.d.ts index 5e3e501..899669e 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/BotGeneratorHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/BotGeneratorHelper.d.ts @@ -8,6 +8,7 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; import { ItemFilterService } from "../services/ItemFilterService"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; @@ -43,9 +44,10 @@ export declare class BotGeneratorHelper { protected itemFilterService: ItemFilterService; protected profileHelper: ProfileHelper; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Check mods are compatible and add to array * @param equipment Equipment item to add mods to @@ -53,9 +55,11 @@ export declare class BotGeneratorHelper { * @param parentId parentid of item to add mod to * @param parentTemplate template objet of item to add mods to * @param modSpawnChances dictionary of mod items and their chance to spawn for this bot type + * @param botRole the bot role being generated for + * @param forceSpawn should this mod be forced to spawn * @returns Item + compatible mods as an array */ - generateModsForEquipment(equipment: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances): Item[]; + generateModsForEquipment(equipment: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances, botRole: string, forceSpawn?: boolean): Item[]; /** * @param sessionId session id * @param weapon Weapon to add mods to @@ -70,15 +74,15 @@ export declare class BotGeneratorHelper { generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponParentId: string, parentWeaponTemplate: ITemplateItem, modSpawnChances: ModsChances, ammoTpl: string, botRole: string): Item[]; /** * - * @param modSlot - * @param isRandomisableSlot - * @param modsParent - * @param botEquipBlacklist - * @param itemModPool + * @param modSlot Slot mod will fit into + * @param isRandomisableSlot Will generate a randomised mod pool if true + * @param modsParent Parent slot the item will be a part of + * @param botEquipBlacklist Blacklist to prevent mods from being picked + * @param itemModPool Pool of items to pick from * @param weapon array with only weapon tpl in it, ready for mods to be added * @param ammoTpl ammo tpl to use if slot requires a cartridge to be added (e.g. mod_magazine) - * @param parentTemplate - * @returns + * @param parentTemplate Parent item the mod will go into + * @returns ITemplateItem */ protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, modsParent: Slot, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem): [boolean, ITemplateItem]; /** @@ -114,8 +118,10 @@ export declare class BotGeneratorHelper { * Find all compatible mods for equipment item and add to modPool * @param itemDetails item to find mods for * @param modPool ModPool to add mods to + * @param equipmentBlacklist equipment not allowed to be used by the bot + * @param botEquipmentRole bot type to generate pool for (e.g. assault, pmcBot, pmc for usec/bear) */ - generateDynamicModPool(itemDetails: ITemplateItem, modPool: Mods): void; + generateDynamicModPool(itemDetails: ITemplateItem, modPool: Mods, equipmentBlacklist: EquipmentFilterDetails[], botEquipmentRole: string): void; /** * Take a list of tpls and filter out blacklisted values using itemFilterService + botEquipmentBlacklist * @param allowedMods base mods to filter @@ -153,7 +159,7 @@ export declare class BotGeneratorHelper { * @param modTemplate Used to add additional properites in the upd object * @returns Item object */ - protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem): Item; + protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem, botRole: string): Item; /** * randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot * never return true for an item that has 0% spawn chance @@ -170,10 +176,10 @@ export declare class BotGeneratorHelper { */ protected getAmmoContainers(): string[]; /** - * Get the slot details for an item (chamber/cartridge/slot) + * Get a Slot property for an item (chamber/cartridge/slot) * @param modSlot e.g patron_in_weapon * @param parentTemplate item template - * @returns + * @returns Slot item */ protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; /** @@ -185,7 +191,6 @@ export declare class BotGeneratorHelper { * @param modPool modPool which should include available cartrigdes * @param parentId The CylinderMagazine's UID * @param parentTemplate The CylinderMagazine's template - * @returns */ protected fillCamora(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem): void; /** @@ -197,11 +202,11 @@ export declare class BotGeneratorHelper { /** * Adds properties to an item * e.g. Repairable / HasHinge / Foldable / MaxDurability - * @param itemTemplate - * @param botRole Used by weapons to randomise the durability values + * @param itemTemplate Item extra properties are being generated for + * @param botRole Used by weapons to randomise the durability values. Null for non-equipped items * @returns Item Upd object with extra properties */ - generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: any): { + generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: string): { upd?: Upd; }; /** @@ -220,21 +225,27 @@ export declare class BotGeneratorHelper { protected generateArmorRepairableProperties(itemTemplate: ITemplateItem, botRole: string): Repairable; /** * Get a random mod from an items compatible mods Filter array - * @param modTpl - * @param parentSlot - * @param modSlot - * @param items + * @param modTpl ???? + * @param parentSlot item mod will go into, used to get combatible items + * @param modSlot Slot to get mod to fill + * @param items items to ensure picked mod is compatible with * @returns item tpl */ protected getModTplFromItemDb(modTpl: string, parentSlot: Slot, modSlot: string, items: Item[]): string; /** * Can an item be added to an item without issue - * @param items - * @param tplToCheck - * @param equipmentSlot - * @returns true if possible + * @param items items to check compatiblilities with + * @param tplToCheck tpl of the item to check for incompatibilities + * @param equipmentSlot Slot the item will be placed into + * @returns false if no incompatibilties */ isItemIncompatibleWithCurrentItems(items: Item[], tplToCheck: string, equipmentSlot: string): boolean; + /** + * Convert a bots role to the equipment role used in config/bot.json + * @param botRole Role to convert + * @returns Equipment role (e.g. pmc / assault / bossTagilla) + */ + getBotEquipmentRole(botRole: string): string; } /** TODO - move into own class */ export declare class ExhaustableArray { diff --git a/TypeScript/5ReplaceMethod/types/helpers/BotHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/BotHelper.d.ts index 67a6384..a7f779e 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/BotHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/BotHelper.d.ts @@ -3,6 +3,7 @@ import { IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; export declare class BotHelper { @@ -10,46 +11,27 @@ export declare class BotHelper { protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, configServer: ConfigServer); - /** - * Get difficulty settings for desired bot type, if not found use assault bot types - * @param type bot type to retreive difficulty of - * @param difficulty difficulty to get settings for (easy/normal etc) - * @returns Difficulty object - */ - getBotDifficultySettings(type: string, difficulty: string): Difficulty; + constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, localisationService: LocalisationService, configServer: ConfigServer); /** * Get a template object for the specified botRole from bots.types db * @param role botRole to get template for * @returns IBotType object */ getBotTemplate(role: string): IBotType; - /** - * Get difficulty settings for a PMC - * @param type "usec" / "bear" - * @param difficulty what difficulty to retrieve - * @returns Difficulty object - */ - getPmcDifficultySettings(type: string, difficulty: string): Difficulty; - /** - * Translate chosen value from pre-raid difficulty dropdown into bot difficulty value - * @param dropDownDifficulty Dropdown difficulty value to convert - * @returns bot difficulty - */ - convertBotDifficultyDropdownToBotDifficulty(dropDownDifficulty: string): string; - /** - * Choose a random difficulty from - easy/normal/hard/impossible - * @returns random difficulty - */ - chooseRandomDifficulty(): string; /** * Randomise the chance the PMC will attack their own side * Look up value in bot.json/chanceSameSideIsHostilePercent * @param difficultySettings pmc difficulty settings */ randomisePmcHostility(difficultySettings: Difficulty): void; + /** + * Is the passed in bot role a PMC (usec/bear/pmc) + * @param botRole bot role to check + * @returns true if is pmc + */ isBotPmc(botRole: string): boolean; isBotBoss(botRole: string): boolean; isBotFollower(botRole: string): boolean; diff --git a/TypeScript/5ReplaceMethod/types/helpers/GameEventHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/GameEventHelper.d.ts index fca87be..fa25eff 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/GameEventHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/GameEventHelper.d.ts @@ -15,4 +15,15 @@ export declare class GameEventHelper { * @returns Record with event name + start/end date */ getEventDetails(): ISeasonalEvent[]; + /** + * Is detection of seasonal events enabled (halloween / christmas) + * @returns true if seasonal events should be checked for + */ + isAutomaticEventDetectionEnabled(): boolean; + /** + * Get a dictionary of gear changes to apply to bots for a specific event e.g. Christmas/Halloween + * @param eventName Name of event to get gear changes for + * @returns bots with equipment changes + */ + getEventBotGear(eventName: string): Record>>; } diff --git a/TypeScript/5ReplaceMethod/types/helpers/HideoutHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/HideoutHelper.d.ts index 5f7e3b7..9d51fed 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/HideoutHelper.d.ts @@ -11,6 +11,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { PlayerService } from "../services/PlayerService"; import { HashUtil } from "../utils/HashUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; @@ -29,13 +30,14 @@ export declare class HideoutHelper { protected profileHelper: ProfileHelper; protected inventoryHelper: InventoryHelper; protected playerService: PlayerService; + protected localisationService: LocalisationService; protected configServer: ConfigServer; static bitcoinFarm: string; static waterCollector: string; static bitcoin: string; static expeditionaryFuelTank: string; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, localisationService: LocalisationService, configServer: ConfigServer); registerProduction(pmcData: IPmcData, body: IHideoutSingleProductionStartRequestData | IHideoutContinousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; /** * This convinience function intialies new Production Object diff --git a/TypeScript/5ReplaceMethod/types/helpers/InventoryHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/InventoryHelper.d.ts index b8e5c9d..6419f93 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/InventoryHelper.d.ts @@ -5,11 +5,12 @@ import { IInventoryMergeRequestData } from "../models/eft/inventory/IInventoryMe import { IInventoryMoveRequestData } from "../models/eft/inventory/IInventoryMoveRequestData"; import { IInventorySplitRequestData } from "../models/eft/inventory/IInventorySplitRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { IInventoryConfig } from "../models/spt/config/IInventoryConfig"; +import { IInventoryConfig, RewardDetails } from "../models/spt/config/IInventoryConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { JsonUtil } from "../utils/JsonUtil"; @@ -38,9 +39,10 @@ export declare class InventoryHelper { protected itemHelper: ItemHelper; protected containerHelper: ContainerHelper; protected profileHelper: ProfileHelper; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected inventoryConfig: IInventoryConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); addItem(pmcData: IPmcData, body: IAddItemRequestData, output: IItemEventRouterResponse, sessionID: string, callback: any, foundInRaid?: boolean, addUpd?: any): IItemEventRouterResponse; removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; removeItemByCount(pmcData: IPmcData, itemId: string, count: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; @@ -76,6 +78,12 @@ export declare class InventoryHelper { * Internal helper function to handle cartridges in inventory if any of them exist. */ protected handleCartridges(items: Item[], body: IInventoryMoveRequestData): void; + /** + * Get details for how a random loot container should be handled, max rewards, possible reward tpls + * @param itemTpl Container being opened + * @returns Reward details + */ + getRandomLootContainerRewardDetails(itemTpl: string): RewardDetails; } declare namespace InventoryHelper { interface InventoryItemHash { diff --git a/TypeScript/5ReplaceMethod/types/helpers/ItemHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/ItemHelper.d.ts index 0effaf2..fc88a46 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/ItemHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/ItemHelper.d.ts @@ -5,6 +5,7 @@ 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 { LocaleService } from "../services/LocaleService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; @@ -18,7 +19,8 @@ declare class ItemHelper { protected objectId: ObjectId; protected mathUtil: MathUtil; protected databaseServer: DatabaseServer; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer); + protected localeService: LocaleService; + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, localeService: LocaleService); /** * Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash * @param {string} tpl the template id / tpl @@ -212,6 +214,12 @@ declare class ItemHelper { * @returns size of stack */ getItemStackSize(item: Item): number; + /** + * Get the name of an item from the locale file using the item tpl + * @param itemTpl Tpl of item to get name of + * @returns Name of item + */ + getItemName(itemTpl: string): string; } declare namespace ItemHelper { interface ItemSize { diff --git a/TypeScript/5ReplaceMethod/types/helpers/QuestHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/QuestHelper.d.ts index a6b4892..edbd2e1 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/QuestHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/QuestHelper.d.ts @@ -50,6 +50,12 @@ export declare class QuestHelper { * @returns true if player level is greater than or equal to quest */ doesPlayerLevelFulfilCondition(playerLevel: number, condition: AvailableForConditions): boolean; + /** + * Get the quests found in both arrays (inner join) + * @param before Array of qeusts #1 + * @param after Array of quests #2 + * @returns Reduction of cartesian product between two quest arrays + */ getDeltaQuests(before: IQuest[], after: IQuest[]): IQuest[]; /** * Increase skill points of a skill on player profile @@ -66,38 +72,85 @@ export declare class QuestHelper { * quest list in question. */ dumpQuests(quests: any): void; - loyaltyRequirementCheck(loyaltyRequirementProperties: AvailableForProps, profile: IPmcData): boolean; - protected processReward(reward: Reward): any[]; + /** + * Check if trader has sufficient loyalty to fullfill quest requirement + * @param questProperties Quest props + * @param profile Player profile + * @returns true if loyalty is high enough to fulfil quest requirement + */ + traderStandingRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; + protected processReward(reward: Reward): Reward[]; + /** + * Gets a flat list of reward items for the given quest at a specific state (e.g. Fail/Success) + * @param quest quest to get rewards for + * @param state Quest status that holds the items (Started, Success, Fail) + * @returns array of items with the correct maxStack + */ getQuestRewardItems(quest: IQuest, state: QuestStatus): Reward[]; /** - * Add quest with new state value to pmc profile + * Update player profile with quest status (e.g. Fail/Success) * @param pmcData profile to add quest to * @param newState state the new quest should be in when added * @param acceptedQuest Details of quest being added */ addQuestToPMCData(pmcData: IPmcData, newState: QuestStatus, acceptedQuest: IAcceptQuestRequestData): void; - acceptedUnlocked(acceptedQuestId: string, sessionID: string): IQuest[]; - failedUnlocked(failedQuestId: string, sessionID: string): IQuest[]; - applyMoneyBoost(quest: IQuest, moneyBoost: number): IQuest; - changeItemStack(pmcData: IPmcData, id: string, value: number, sessionID: string, output: any): void; /** - * Get List of All Quests as an array + * TODO: what is going on here + * @param acceptedQuestId Quest to add to profile + * @param sessionID Session id + * @returns Array of quests in profile + quest passed in as param + */ + acceptedUnlocked(acceptedQuestId: string, sessionID: string): IQuest[]; + /** + * TODO: what is going on here + * @param failedQuestId + * @param sessionID Session id + * @returns + */ + failedUnlocked(failedQuestId: string, sessionID: string): IQuest[]; + /** + * Adjust quest money rewards by passed in multipler + * @param quest Quest to multiple money rewards + * @param multipler Value to adjust money rewards by + * @returns Updated quest + */ + applyMoneyBoost(quest: IQuest, multipler: number): IQuest; + /** + * Sets the item stack to new value, or delete the item if value <= 0 + * // TODO maybe merge this function and the one from customization + * @param pmcData Profile + * @param itemId id of item to adjust stack size of + * @param newStackSize Stack size to adjust to + * @param sessionID Session id + * @param output ItemEvent router response + */ + changeItemStack(pmcData: IPmcData, itemId: string, newStackSize: number, sessionID: string, output: IItemEventRouterResponse): void; + /** + * Get List of All Quests from db + * NOT CLONED * @returns Array of IQuest objects */ - questValues(): IQuest[]; + getQuestsFromDb(): IQuest[]; /** - * Reest AvailableForStart conditions for quests - * @param quests queststo clean + * Get quests, strip all requirement conditions except level + * @param quests quests to process * @returns quest array without conditions */ - protected cleanQuestList(quests: IQuest[]): IQuest[]; + protected getQuestsWithOnlyLevelRequirementStartCondition(quests: IQuest[]): IQuest[]; /** - * Reset AvailableForStart conditions on a quest + * Remove all quest conditions except for level requirement * @param quest quest to clean * @returns reset IQuest object */ - cleanQuestConditions(quest: IQuest): IQuest; - failQuest(pmcData: IPmcData, body: any, sessionID: string): any; + getQuestWithOnlyLevelRequirementStartCondition(quest: IQuest): IQuest; + /** + * Fail a quest in a player profile + * @param pmcData Profile + * @param failRequest fail quest request data + * @param sessionID Session id + * @returns Item event router response + */ + failQuest(pmcData: IPmcData, failRequest: any, sessionID: string): IItemEventRouterResponse; /** * Get quest by id from database * @param questId questid to look for @@ -105,7 +158,12 @@ export declare class QuestHelper { * @returns IQuest object */ getQuestFromDb(questId: string, pmcData: IPmcData): IQuest; - getQuestLocaleIdFromDb(messageId: string): string; + /** + * Get the locale Id from locale db for a quest message + * @param questMessageId Quest mesage id to look up + * @returns Locale Id from locale db + */ + getQuestLocaleIdFromDb(questMessageId: string): string; /** * Alter a quests state + Add a record to tis status timers object * @param pmcData Profile to update @@ -128,5 +186,10 @@ export declare class QuestHelper { * @returns bonus in percent */ protected getIntelCenterRewardBonus(pmcData: IPmcData): number; - getFindItemIdForQuestItem(itemTpl: string): string; + /** + * Find quest with 'findItem' requirement that needs the item tpl be handed in + * @param itemTpl item tpl to look for + * @returns 'FindItem' condition id + */ + getFindItemIdForQuestHandIn(itemTpl: string): string; } diff --git a/TypeScript/5ReplaceMethod/types/helpers/RagfairServerHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/RagfairServerHelper.d.ts index a03cdda..ec388d8 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/RagfairServerHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/RagfairServerHelper.d.ts @@ -44,10 +44,20 @@ export declare class RagfairServerHelper { isPlayer(userID: string): boolean; returnItems(sessionID: string, items: any[]): void; calculateDynamicStackCount(tplId: string, isWeaponPreset: boolean): number; + /** + * Choose a currency at random with bias + * @returns currency tpl + */ getDynamicOfferCurrency(): string; getMemberType(userID: string): MemberCategory; getNickname(userID: string): string; getPresetItems(item: any): Item[]; getPresetItemsByTpl(item: Item): Item[]; + /** + * Generate new unique ids for the children while preserving hierarchy + * @param item base item + * @param preset + * @returns Item array with new IDs + */ reparentPresets(item: Item, preset: Item[]): Item[]; } diff --git a/TypeScript/5ReplaceMethod/types/helpers/RagfairSortHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/RagfairSortHelper.d.ts index 28d1d38..4669ce6 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/RagfairSortHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/RagfairSortHelper.d.ts @@ -18,7 +18,7 @@ export declare class RagfairSortHelper { protected sortOffersByRating(a: IRagfairOffer, b: IRagfairOffer): number; protected sortOffersByName(a: IRagfairOffer, b: IRagfairOffer): number; /** - * Order two offers by price value + * Order two offers by rouble price value * @param a Offer a * @param b Offer b * @returns diff --git a/TypeScript/5ReplaceMethod/types/loaders/PreAkiModLoader.d.ts b/TypeScript/5ReplaceMethod/types/loaders/PreAkiModLoader.d.ts index 7a687a5..f486a28 100644 --- a/TypeScript/5ReplaceMethod/types/loaders/PreAkiModLoader.d.ts +++ b/TypeScript/5ReplaceMethod/types/loaders/PreAkiModLoader.d.ts @@ -1,29 +1,31 @@ import { DependencyContainer } from "tsyringe"; +import { IPostAkiLoadMod } from "../models/external/IPostAkiLoadMod"; +import { IPostDBLoadMod } from "../models/external/IPostDBLoadMod"; +import { IPreAkiLoadMod } from "../models/external/IPreAkiLoadMod"; import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { ModLoader } from "../models/spt/mod/IMod"; import { IModLoader } from "../models/spt/mod/IModLoader"; import { IPackageJsonData } from "../models/spt/mod/IPackageJsonData"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { LocalisationService } from "../services/LocalisationService"; import { ModCompilerService } from "../services/ModCompilerService"; import { JsonUtil } from "../utils/JsonUtil"; import { VFS } from "../utils/VFS"; import { BundleLoader } from "./BundleLoader"; -import { IPostAkiLoadMod } from "../models/external/IPostAkiLoadMod"; -import { IPreAkiLoadMod } from "../models/external/IPreAkiLoadMod"; -import { IPostDBLoadMod } from "../models/external/IPostDBLoadMod"; export declare class PreAkiModLoader implements IModLoader { protected logger: ILogger; protected vfs: VFS; protected jsonUtil: JsonUtil; protected modCompilerService: ModCompilerService; protected bundleLoader: BundleLoader; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected static container: DependencyContainer; protected readonly basepath = "user/mods/"; protected imported: Record; protected akiConfig: ICoreConfig; - constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, modCompilerService: ModCompilerService, bundleLoader: BundleLoader, configServer: ConfigServer); + constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, modCompilerService: ModCompilerService, bundleLoader: BundleLoader, localisationService: LocalisationService, configServer: ConfigServer); load(container: DependencyContainer): Promise; getBundles(local: boolean): string; getBundle(key: string, local: boolean): void; diff --git a/TypeScript/5ReplaceMethod/types/models/eft/bot/IGenerateBotsRequestData.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/bot/IGenerateBotsRequestData.d.ts index c49cef7..f1f7013 100644 --- a/TypeScript/5ReplaceMethod/types/models/eft/bot/IGenerateBotsRequestData.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/eft/bot/IGenerateBotsRequestData.d.ts @@ -2,6 +2,7 @@ export interface IGenerateBotsRequestData { conditions: Condition[]; } export interface Condition { + /** e.g. assault/pmcBot/bossKilla */ Role: string; Limit: number; Difficulty: string; diff --git a/TypeScript/5ReplaceMethod/types/models/eft/common/IGlobals.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/common/IGlobals.d.ts index 81e2023..b53f106 100644 --- a/TypeScript/5ReplaceMethod/types/models/eft/common/IGlobals.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/eft/common/IGlobals.d.ts @@ -591,6 +591,7 @@ export interface HealPrice { export interface ProfileHealthSettings { BodyPartsSettings: BodyPartsSettings; HealthFactorsSettings: HealthFactorsSettings; + DefaultStimulatorBuff: string; } export interface BodyPartsSettings { Head: BodyPartsSetting; diff --git a/TypeScript/5ReplaceMethod/types/models/eft/common/tables/IBotBase.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/common/tables/IBotBase.d.ts index 1c28ae0..2b418c1 100644 --- a/TypeScript/5ReplaceMethod/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/eft/common/tables/IBotBase.d.ts @@ -107,6 +107,7 @@ export interface CurrentMax { Maximum: number; } export interface Inventory { + discardLimits: Record; items: Item[]; equipment: string; stash: string; diff --git a/TypeScript/5ReplaceMethod/types/models/eft/common/tables/IBotType.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/common/tables/IBotType.d.ts index c1fe579..55b4bd9 100644 --- a/TypeScript/5ReplaceMethod/types/models/eft/common/tables/IBotType.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/eft/common/tables/IBotType.d.ts @@ -13,8 +13,8 @@ export interface IBotType { skills: Skills; } export interface Appearance { - body: string[]; - feet: string[]; + body: Record; + feet: Record; hands: string[]; head: string[]; voice: string[]; diff --git a/TypeScript/5ReplaceMethod/types/models/eft/common/tables/ITemplateItem.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/common/tables/ITemplateItem.d.ts index 8569e61..0fa7e18 100644 --- a/TypeScript/5ReplaceMethod/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/eft/common/tables/ITemplateItem.d.ts @@ -254,7 +254,7 @@ export interface Props { foodUseTime?: number; foodEffectType?: string; StimulatorBuffs?: string; - effects_health?: any; + effects_health?: IHealthEffect[] | Record>; effects_damage?: any; MaximumNumberOfUsage?: number; knifeHitDelay?: number; @@ -366,6 +366,10 @@ export interface Props { MinTimeToContactExplode?: number; ExplosionEffectType?: string; } +export interface IHealthEffect { + type: string; + value: number; +} export interface Prefab { path: string; rcid: string; diff --git a/TypeScript/5ReplaceMethod/types/models/eft/customization/IGetSuitsResponse.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/customization/IGetSuitsResponse.d.ts new file mode 100644 index 0000000..fe6888c --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/models/eft/customization/IGetSuitsResponse.d.ts @@ -0,0 +1,4 @@ +export interface IGetSuitsResponse { + _id: string; + suits: string[]; +} diff --git a/TypeScript/5ReplaceMethod/types/models/eft/game/IGameKeepAliveResponse.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/game/IGameKeepAliveResponse.d.ts new file mode 100644 index 0000000..170ce6a --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/models/eft/game/IGameKeepAliveResponse.d.ts @@ -0,0 +1,4 @@ +export interface IGameKeepAliveResponse { + msg: string; + utc_time: number; +} diff --git a/TypeScript/5ReplaceMethod/types/models/eft/game/IGameLogoutResponseData.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/game/IGameLogoutResponseData.d.ts new file mode 100644 index 0000000..0f52050 --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/models/eft/game/IGameLogoutResponseData.d.ts @@ -0,0 +1,3 @@ +export interface IGameLogoutResponseData { + status: string; +} diff --git a/TypeScript/5ReplaceMethod/types/models/eft/game/IGameStartResponse.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/game/IGameStartResponse.d.ts new file mode 100644 index 0000000..9f0ab6d --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/models/eft/game/IGameStartResponse.d.ts @@ -0,0 +1,3 @@ +export interface IGameStartResponse { + utc_time: number; +} diff --git a/TypeScript/5ReplaceMethod/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts new file mode 100644 index 0000000..3c45124 --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts @@ -0,0 +1,11 @@ +import { IInventoryBaseActionRequestData } from "./IInventoryBaseActionRequestData"; +export interface IOpenRandomLootContainerRequestData extends IInventoryBaseActionRequestData { + Action: "OpenRandomLootContainer"; + /** Container item opened */ + item: string; + to: To[]; +} +export interface To { + /** Player character (pmc/scav) id items will be sent to */ + id: string; +} diff --git a/TypeScript/5ReplaceMethod/types/models/eft/itemEvent/IItemEventRouterBase.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/itemEvent/IItemEventRouterBase.d.ts index 4841cfd..60ab284 100644 --- a/TypeScript/5ReplaceMethod/types/models/eft/itemEvent/IItemEventRouterBase.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/eft/itemEvent/IItemEventRouterBase.d.ts @@ -10,8 +10,9 @@ export interface IItemEventRouterBase { export declare type TProfileChanges = Record; export interface Warning { index: number; - err: string; errmsg: string; + code?: string; + data?: any; } export interface ProfileChange { _id: string; diff --git a/TypeScript/5ReplaceMethod/types/models/eft/match/IStartOffineRaidRequestData.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/match/IStartOffineRaidRequestData.d.ts index af0625e..1983728 100644 --- a/TypeScript/5ReplaceMethod/types/models/eft/match/IStartOffineRaidRequestData.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/eft/match/IStartOffineRaidRequestData.d.ts @@ -2,8 +2,10 @@ import { BotAmount } from "../../enums/BotAmount"; import { BotDifficulty } from "../../enums/BotDifficulty"; export interface IStartOfflineRaidRequestData { locationName: string; + /** Current time, not in-game time */ startTime: number; - dateTime: string; + /** CURR = am, past = pm */ + dateTime: "CURR" | "PAST"; gameSettings: GameSettings; } export interface GameSettings { diff --git a/TypeScript/5ReplaceMethod/types/models/eft/notifier/ISelectProfileResponse.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/notifier/ISelectProfileResponse.d.ts new file mode 100644 index 0000000..ecb668a --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/models/eft/notifier/ISelectProfileResponse.d.ts @@ -0,0 +1,6 @@ +import { INotifierChannel } from "./INotifier"; +export interface ISelectProfileResponse { + status: string; + notifier: INotifierChannel; + notifierServer: string; +} diff --git a/TypeScript/5ReplaceMethod/types/models/eft/ragfair/IRagfairOffer.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/ragfair/IRagfairOffer.d.ts index 3251a37..792ec7d 100644 --- a/TypeScript/5ReplaceMethod/types/models/eft/ragfair/IRagfairOffer.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/eft/ragfair/IRagfairOffer.d.ts @@ -7,19 +7,19 @@ export interface IRagfairOffer { requirements: OfferRequirement[]; root: string; intId: number; + /** Handbook price */ itemsCost: number; + /** Rouble price */ requirementsCost: number; - sptRequirementsCostRouble: number; startTime: number; endTime: number; sellInOnePiece: boolean; - name?: string; - shortName?: string; loyaltyLevel: number; buyRestrictionMax?: number; buyRestrictionCurrent?: number; locked: boolean; unlimitedCount: boolean; + /** Rouble price */ summaryCost: number; user: IRagfairOfferUser; notAvailable: boolean; @@ -33,11 +33,11 @@ export interface OfferRequirement { } export interface IRagfairOfferUser { id: string; - nickname: string; - rating: number; + nickname?: string; + rating?: number; memberType: MemberCategory; - avatar: string; - isRatingGrowing: boolean; + avatar?: string; + isRatingGrowing?: boolean; } export interface SellResult { sellTime: number; diff --git a/TypeScript/5ReplaceMethod/types/models/eft/weather/IWeatherData.d.ts b/TypeScript/5ReplaceMethod/types/models/eft/weather/IWeatherData.d.ts index ecc96ce..1f5d5b5 100644 --- a/TypeScript/5ReplaceMethod/types/models/eft/weather/IWeatherData.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/eft/weather/IWeatherData.d.ts @@ -1,17 +1,18 @@ +import { WindDirection } from "../../../models/enums/WindDirection"; export interface IWeatherData { acceleration: number; time: string; date: string; - weather: IWeather; + weather?: IWeather; } export interface IWeather { pressure: number; temp: number; - fog: string; + fog: number; rain_intensity: number; - rain: any; + rain: number; wind_gustiness: number; - wind_direction: any; + wind_direction: WindDirection; wind_speed: number; cloud: number; time: string; diff --git a/TypeScript/5ReplaceMethod/types/models/enums/BackendErrorCodes.d.ts b/TypeScript/5ReplaceMethod/types/models/enums/BackendErrorCodes.d.ts new file mode 100644 index 0000000..6614b75 --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/models/enums/BackendErrorCodes.d.ts @@ -0,0 +1,67 @@ +export declare enum BackendErrorCodes { + NONE = 0, + UNKNOWN_ERROR = 200, + NOT_AUTHORIZED = 201, + NEED_AUTHORIZATION_CODE = 209, + WRONG_AUTHORIZATION_CODE = 211, + NEED_CAPTCHA = 214, + NO_NEED_CAPTCHA = 215, + CAPTCHA_FAILED = 218, + CAPTCHA_BRUTE_FORCED = 219, + NO_ROOM_IN_STASH = 223, + NICKNAME_NOT_UNIQUE = 225, + NICKNAME_NOT_VALID = 226, + UNSUPPORTED_CLIENT_VERSION = 232, + REPORT_NOT_ALLOWED = 238, + NICKNAME_IS_ABUSIVE = 241, + NICKNAME_CHANGE_TIMEOUT = 242, + NOT_MODIFIED = 304, + HTTP_BAD_REQUEST = 400, + HTTP_NOT_AUTHORIZED = 401, + HTTP_FORBIDDEN = 403, + HTTP_NOT_FOUND = 404, + HTTP_METHOD_NOT_ALLOWED = 405, + UNKNOWN_TRADING_ERROR = 500, + HTTPNOTIMPLEMENTED = 501, + HTTPBADGATEWAY = 502, + HTTPSERVICEUNAVAILABLE = 503, + HTTPGATEWAYTIMEOUT = 504, + TRADEROUTOFMONEY = 505, + HTTPVARIANTALSONEGOTIATES = 506, + PRICECHANGED = 509, + TRADERDISABLED = 512, + ITEMHASBEENSOLD = 513, + NOTENOUGHSPACEFORMONEY = 518, + HTTPINVALIDSSLCERTIFICATE = 526, + UNKNOWNRAGFAIRERROR = 550, + UNKNOWNRAGFAIRERROR2 = 551, + UNKNOWNMATCHMAKERERROR = 600, + SESSIONPARAMETERSERROR = 601, + SESSIONLOST = 602, + SERVERNOTREGISTERED = 604, + UNKNOWNQUESTERROR = 700, + QUESTBADPARAM = 702, + QUESTNOTFOUND = 703, + QUESTISUNAVAILABLE = 704, + NOFREESPACEFORREWARDS = 705, + WRONGQUESTSTATUS = 706, + CANTCOMPLETEQUEST = 707, + UNKNOWNMAILERROR = 900, + TOOMANYFRIENDREQUESTS = 925, + UNKNOWNSCRIPTEXECUTIONERROR = 1000, + UNKNOWNREPAIRINGERROR = 1200, + UNKNOWNINSURANCEERROR = 1300, + UNKNOWNCURRENCYEXCHANGEERROR = 1400, + OFFERNOTFOUND = 1503, + NOTENOUGHSPACE = 1505, + OFFEROUTOFSTOCK = 1506, + OFFERSOLD = 1507, + RAGFAIRUNAVAILABLE = 1511, + BANNEDERRORCODE = 1513, + INSUFFICIENTNUMBERINSTOCK = 1516, + TOOMANYITEMSTOSELL = 1517, + EXAMINATIONFAILED = 22001, + ITEMALREADYEXAMINED = 22002, + UNKNOWNNGINXERROR = 9000, + PARSERESPONSEERROR = 9001 +} diff --git a/TypeScript/5ReplaceMethod/types/models/enums/HideoutEventActions.d.ts b/TypeScript/5ReplaceMethod/types/models/enums/HideoutEventActions.d.ts new file mode 100644 index 0000000..e441477 --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/models/enums/HideoutEventActions.d.ts @@ -0,0 +1,11 @@ +export declare enum HideoutEventActions { + HIDEOUT_UPGRADE = "HideoutUpgrade", + HIDEOUT_UPGRADE_COMPLETE = "HideoutUpgradeComplete", + HIDEOUT_PUT_ITEMS_IN_AREA_SLOTS = "HideoutPutItemsInAreaSlots", + HIDEOUT_TAKE_ITEMS_FROM_AREA_SLOTS = "HideoutTakeItemsFromAreaSlots", + HIDEOUT_TOGGLE_AREA = "HideoutToggleArea", + HIDEOUT_SINGLE_PRODUCTION_START = "HideoutSingleProductionStart", + HIDEOUT_SCAV_CASE_PRODUCTION_START = "HideoutScavCaseProductionStart", + HIDEOUT_CONTINUOUS_PRODUCTION_START = "HideoutContinuousProductionStart", + HIDEOUT_TAKE_PRODUCTION = "HideoutTakeProduction" +} diff --git a/TypeScript/5ReplaceMethod/types/models/enums/ItemEventActions.d.ts b/TypeScript/5ReplaceMethod/types/models/enums/ItemEventActions.d.ts new file mode 100644 index 0000000..0e65453 --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/models/enums/ItemEventActions.d.ts @@ -0,0 +1,19 @@ +export declare enum ItemEventActions { + MOVE = "Move", + REMOVE = "Remove", + SPLIT = "Split", + MERGE = "Merge", + TRANSFER = "Transfer", + SWAP = "Swap", + FOLD = "Fold", + TOGGLE = "Toggle", + TAG = "Tag", + BIND = "Bind", + EXAMINE = "Examine", + READ_ENCYCLOPEDIA = "ReadEncyclopedia", + APPLY_INVENTORY_CHANGES = "ApplyInventoryChanges", + CREATE_MAP_MARKER = "CreateMapMarker", + DELETE_MAP_MARKER = "DeleteMapMarker", + EDIT_MAP_MARKER = "EditMapMarker", + OPEN_RANDOM_LOOT_CONTAINER = "OpenRandomLootContainer" +} diff --git a/TypeScript/5ReplaceMethod/types/models/enums/WeatherType.d.ts b/TypeScript/5ReplaceMethod/types/models/enums/WeatherType.d.ts new file mode 100644 index 0000000..d31fefe --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/models/enums/WeatherType.d.ts @@ -0,0 +1,19 @@ +export declare enum WeatherType { + CLEAR_DAY = 1, + CLEAR_WIND = 2, + CLEAR_NIGHT = 3, + PARTLY_CLOUD_DAY = 4, + PARTLY_CLOUD_NIGHT = 5, + CLEAR_FOG_DAY = 6, + CLEAR_FOG_NIGHT = 7, + CLOUDFOG = 8, + FOG = 9, + MOSTLY_CLOUD = 10, + LIGHT_RAIN = 11, + RAIN = 12, + CLOUD_WIND = 13, + CLOUD_WIND_RAIN = 14, + FULL_CLOUD = 15, + THUNDER_CLOUD = 16, + NONE = 0 +} diff --git a/TypeScript/5ReplaceMethod/types/models/enums/WildSpawnTypeNumber.d.ts b/TypeScript/5ReplaceMethod/types/models/enums/WildSpawnTypeNumber.d.ts new file mode 100644 index 0000000..ff806fe --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/models/enums/WildSpawnTypeNumber.d.ts @@ -0,0 +1,33 @@ +export declare enum WildSpawnTypeNumber { + ASSAULT = 1, + MARKSMAN = 2, + BOSSTEST = 4, + BOSSBULLY = 8, + FOLLOWERTEST = 16, + FOLLOWERBULLY = 32, + BOSSKILLA = 64, + BOSSKOJANIY = 128, + FOLLOWERKOJANIY = 256, + PMCBOT = 512, + CURSEDASSAULT = 1024, + BOSSGLUHAR = 2048, + FOLLOWERGLUHARASSAULT = 4096, + FOLLOWERGLUHARSECURITY = 8192, + FOLLOWERGLUHARSCOUT = 16384, + FOLLOWERGLUHARSNIPE = 32768, + FOLLOWERSANITAR = 65536, + BOSSSANITAR = 131072, + TEST = 262144, + ASSAULTGROUP = 524288, + SECTANTWARRIOR = 1048576, + SECTANTPRIEST = 2097152, + BOSSTAGILLA = 4194304, + FOLLOWERTAGILLA = 8388608, + EXUSEC = 16777216, + GIFTER = 33554432, + BOSSKNIGHT = 67108864, + FOLLOWERBIGPIPE = 134217728, + FOLLOWERBIRDEYE = 268435456, + SPTUSEC = 536870912, + SPTBEAR = 1073741824 +} diff --git a/TypeScript/5ReplaceMethod/types/models/enums/WindDirection.d.ts b/TypeScript/5ReplaceMethod/types/models/enums/WindDirection.d.ts new file mode 100644 index 0000000..fb30b20 --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/models/enums/WindDirection.d.ts @@ -0,0 +1,10 @@ +export declare enum WindDirection { + EAST = 1, + NORTH = 2, + WEST = 3, + SOUTH = 4, + SE = 5, + SW = 6, + NW = 7, + NE = 8 +} diff --git a/TypeScript/5ReplaceMethod/types/models/spt/config/IBotConfig.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/config/IBotConfig.d.ts index af8ceba..d6fa5e0 100644 --- a/TypeScript/5ReplaceMethod/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/spt/config/IBotConfig.d.ts @@ -27,6 +27,8 @@ export interface IBotConfig extends IBaseConfig { maxBotCap: Record; /** How many stacks of secret ammo should a bot have in its bot secure container */ secureContainerAmmoStackCount: number; + /** Batch generation size when type not available in cache */ + botGenerationBatchSizePerType: number; } export interface PresetBatch { assault: number; @@ -66,8 +68,12 @@ export interface EquipmentFilters { weaponModLimits: ModLimits; randomisedWeaponModSlots?: string[]; randomisedArmorSlots?: string[]; + faceShieldIsActiveChancePercent?: number; + lightLaserIsActiveChancePercent?: number; blacklist: EquipmentFilterDetails[]; whitelist: EquipmentFilterDetails[]; + clothing: WeightingAdjustmentDetails[]; + weightingAdjustments: WeightingAdjustmentDetails[]; } export interface ModLimits { /** How many scopes are allowed on a weapon - hard coded to work with OPTIC_SCOPE, ASSAULT_SCOPE, COLLIMATOR, COMPACT_COLLIMATOR */ @@ -80,3 +86,8 @@ export interface EquipmentFilterDetails { equipment: Record; cartridge: Record; } +export interface WeightingAdjustmentDetails { + levelRange: MinMax; + add: Record>; + edit: Record>; +} diff --git a/TypeScript/5ReplaceMethod/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/config/IInventoryConfig.d.ts index ffffa41..4642b9b 100644 --- a/TypeScript/5ReplaceMethod/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/spt/config/IInventoryConfig.d.ts @@ -2,4 +2,10 @@ import { IBaseConfig } from "./IBaseConfig"; export interface IInventoryConfig extends IBaseConfig { kind: "aki-inventory"; newItemsMarkedFound: boolean; + randomLootContainers: Record; +} +export interface RewardDetails { + rewardCount: number; + foundInRaid: boolean; + rewardTplPool: Record; } diff --git a/TypeScript/5ReplaceMethod/types/models/spt/config/ILocaleConfig.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/config/ILocaleConfig.d.ts index fe9abf7..0a8955c 100644 --- a/TypeScript/5ReplaceMethod/types/models/spt/config/ILocaleConfig.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/spt/config/ILocaleConfig.d.ts @@ -1,5 +1,10 @@ import { IBaseConfig } from "./IBaseConfig"; export interface ILocaleConfig extends IBaseConfig { kind: "aki-locale"; - desiredLocale: string; + /** e.g. ru/en/cn/fr etc, or 'system', will take computer locale setting */ + gameLocale: string; + /** e.g. ru/en/cn/fr etc, or 'system', will take computer locale setting */ + serverLocale: string; + /** Languages server can be translated into */ + serverSupportedLocales: string[]; } diff --git a/TypeScript/5ReplaceMethod/types/models/spt/config/IPmcConfig.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/config/IPmcConfig.d.ts index 9db2ba1..48601b2 100644 --- a/TypeScript/5ReplaceMethod/types/models/spt/config/IPmcConfig.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/spt/config/IPmcConfig.d.ts @@ -6,9 +6,11 @@ export interface IPmcConfig { looseWeaponInBackpackChancePercent: number; looseWeaponInBackpackLootMinMax: MinMax; isUsec: number; + usecType: string; + bearType: string; chanceSameSideIsHostilePercent: number; /** key: location, value: type for usec/bear */ - pmcType: Record; + pmcType: Record>>; maxBackpackLootTotalRub: number; maxPocketLootTotalRub: number; maxVestLootTotalRub: number; diff --git a/TypeScript/5ReplaceMethod/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/config/IRagfairConfig.d.ts index c1b8763..6786417 100644 --- a/TypeScript/5ReplaceMethod/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/spt/config/IRagfairConfig.d.ts @@ -28,12 +28,8 @@ export interface Reputation { gain: number; loss: number; } -export declare class OfferAdjustment { - maxPriceDifferenceBelowHandbookPercent: number; - handbookPriceMultipier: number; - priceThreshholdRub: number; -} export interface Dynamic { + barter: Barter; offerAdjustment: OfferAdjustment; expiredOfferThreshold: number; offerItemCount: MinMax; @@ -49,6 +45,20 @@ export interface Dynamic { showAsSingleStack: string[]; blacklist: Blacklist; } +export declare class Barter { + enable: boolean; + chancePercent: number; + itemCountMin: number; + itemCountMax: number; + priceRangeVariancePercent: number; + minRoubleCostToBecomeBarter: number; + itemTypeBlacklist: string[]; +} +export declare class OfferAdjustment { + maxPriceDifferenceBelowHandbookPercent: number; + handbookPriceMultipier: number; + priceThreshholdRub: number; +} export interface Condition { conditionChance: number; min: number; diff --git a/TypeScript/5ReplaceMethod/types/models/spt/config/ISeasonalEventConfig.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/config/ISeasonalEventConfig.d.ts index bc60618..e410925 100644 --- a/TypeScript/5ReplaceMethod/types/models/spt/config/ISeasonalEventConfig.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/spt/config/ISeasonalEventConfig.d.ts @@ -1,6 +1,9 @@ import { IBaseConfig } from "./IBaseConfig"; export interface ISeasonalEventConfig extends IBaseConfig { kind: "aki-seasonalevents"; + enableSeasonalEventDetection: boolean; + /** event / botType / equipSlot / itemid */ + eventGear: Record>>>; events: ISeasonalEvent[]; } export interface ISeasonalEvent { diff --git a/TypeScript/5ReplaceMethod/types/models/spt/config/IWeatherConfig.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/config/IWeatherConfig.d.ts index bbdc43e..41a1c83 100644 --- a/TypeScript/5ReplaceMethod/types/models/spt/config/IWeatherConfig.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/spt/config/IWeatherConfig.d.ts @@ -1,3 +1,4 @@ +import { WindDirection } from "../../../models/enums/WindDirection"; import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface IWeatherConfig extends IBaseConfig { @@ -7,12 +8,16 @@ export interface IWeatherConfig extends IBaseConfig { } export interface Weather { clouds: MinMax; - windSpeed: MinMax; - windDirection: MinMax; + windSpeed: WeatherSettings; + windDirection: WeatherSettings; windGustiness: MinMax; - rain: MinMax; + rain: WeatherSettings; rainIntensity: MinMax; - fog: MinMax; + fog: WeatherSettings; temp: MinMax; pressure: MinMax; } +export interface WeatherSettings { + values: T[]; + weights: number[]; +} diff --git a/TypeScript/5ReplaceMethod/types/routers/item_events/HideoutItemEventRouter.d.ts b/TypeScript/5ReplaceMethod/types/routers/item_events/HideoutItemEventRouter.d.ts index e1e98af..44bd1cd 100644 --- a/TypeScript/5ReplaceMethod/types/routers/item_events/HideoutItemEventRouter.d.ts +++ b/TypeScript/5ReplaceMethod/types/routers/item_events/HideoutItemEventRouter.d.ts @@ -1,7 +1,7 @@ -import { IPmcData } from "../../models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "../../models/eft/itemEvent/IItemEventRouterResponse"; import { HideoutCallbacks } from "../../callbacks/HideoutCallbacks"; import { HandledRoute, ItemEventRouterDefinition } from "../../di/Router"; +import { IPmcData } from "../../models/eft/common/IPmcData"; +import { IItemEventRouterResponse } from "../../models/eft/itemEvent/IItemEventRouterResponse"; export declare class HideoutItemEventRouter extends ItemEventRouterDefinition { protected hideoutCallbacks: HideoutCallbacks; constructor(hideoutCallbacks: HideoutCallbacks); diff --git a/TypeScript/5ReplaceMethod/types/routers/item_events/InventoryItemEventRouter.d.ts b/TypeScript/5ReplaceMethod/types/routers/item_events/InventoryItemEventRouter.d.ts index 2619bb9..953d322 100644 --- a/TypeScript/5ReplaceMethod/types/routers/item_events/InventoryItemEventRouter.d.ts +++ b/TypeScript/5ReplaceMethod/types/routers/item_events/InventoryItemEventRouter.d.ts @@ -1,7 +1,7 @@ -import { IPmcData } from "../../models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "../../models/eft/itemEvent/IItemEventRouterResponse"; import { InventoryCallbacks } from "../../callbacks/InventoryCallbacks"; import { HandledRoute, ItemEventRouterDefinition } from "../../di/Router"; +import { IPmcData } from "../../models/eft/common/IPmcData"; +import { IItemEventRouterResponse } from "../../models/eft/itemEvent/IItemEventRouterResponse"; export declare class InventoryItemEventRouter extends ItemEventRouterDefinition { protected inventoryCallbacks: InventoryCallbacks; constructor(inventoryCallbacks: InventoryCallbacks); diff --git a/TypeScript/5ReplaceMethod/types/servers/HttpServer.d.ts b/TypeScript/5ReplaceMethod/types/servers/HttpServer.d.ts index bbca8af..80c1d48 100644 --- a/TypeScript/5ReplaceMethod/types/servers/HttpServer.d.ts +++ b/TypeScript/5ReplaceMethod/types/servers/HttpServer.d.ts @@ -4,6 +4,7 @@ import { ApplicationContext } from "../context/ApplicationContext"; import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; import { ILogger } from "../models/spt/utils/ILogger"; +import { LocalisationService } from "../services/LocalisationService"; import { ConfigServer } from "./ConfigServer"; import { DatabaseServer } from "./DatabaseServer"; import { IHttpListener } from "./http/IHttpListener"; @@ -12,11 +13,12 @@ export declare class HttpServer { protected logger: ILogger; protected databaseServer: DatabaseServer; protected httpServerHelper: HttpServerHelper; + protected localisationService: LocalisationService; protected httpListeners: IHttpListener[]; protected configServer: ConfigServer; protected applicationContext: ApplicationContext; protected webSocketServer: WebSocketServer; - constructor(logger: ILogger, databaseServer: DatabaseServer, httpServerHelper: HttpServerHelper, httpListeners: IHttpListener[], configServer: ConfigServer, applicationContext: ApplicationContext, webSocketServer: WebSocketServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, httpServerHelper: HttpServerHelper, localisationService: LocalisationService, httpListeners: IHttpListener[], configServer: ConfigServer, applicationContext: ApplicationContext, webSocketServer: WebSocketServer); protected httpConfig: IHttpConfig; getCookies(req: http.IncomingMessage): any; handleRequest(req: IncomingMessage, resp: ServerResponse): void; diff --git a/TypeScript/5ReplaceMethod/types/servers/SaveServer.d.ts b/TypeScript/5ReplaceMethod/types/servers/SaveServer.d.ts index cb28f49..4dca514 100644 --- a/TypeScript/5ReplaceMethod/types/servers/SaveServer.d.ts +++ b/TypeScript/5ReplaceMethod/types/servers/SaveServer.d.ts @@ -1,20 +1,22 @@ +import { SaveLoadRouter } from "../di/Router"; import { IAkiProfile, Info } from "../models/eft/profile/IAkiProfile"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { VFS } from "../utils/VFS"; -import { SaveLoadRouter } from "../di/Router"; -import { ILogger } from "../models/spt/utils/ILogger"; export declare class SaveServer { protected vfs: VFS; protected saveLoadRouters: SaveLoadRouter[]; protected jsonUtil: JsonUtil; protected hashUtil: HashUtil; + protected localisationService: LocalisationService; protected logger: ILogger; protected profileFilepath: string; protected profiles: {}; protected onSave: {}; protected saveMd5: {}; - constructor(vfs: VFS, saveLoadRouters: SaveLoadRouter[], jsonUtil: JsonUtil, hashUtil: HashUtil, logger: ILogger); + constructor(vfs: VFS, saveLoadRouters: SaveLoadRouter[], jsonUtil: JsonUtil, hashUtil: HashUtil, localisationService: LocalisationService, logger: ILogger); load(): void; save(): void; getProfile(sessionId: string): IAkiProfile; diff --git a/TypeScript/5ReplaceMethod/types/servers/WebSocketServer.d.ts b/TypeScript/5ReplaceMethod/types/servers/WebSocketServer.d.ts index f33d214..5d40e6e 100644 --- a/TypeScript/5ReplaceMethod/types/servers/WebSocketServer.d.ts +++ b/TypeScript/5ReplaceMethod/types/servers/WebSocketServer.d.ts @@ -1,18 +1,20 @@ /// -import { HttpServerHelper } from "../helpers/HttpServerHelper"; -import WebSocket from "ws"; import http, { IncomingMessage } from "http"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { RandomUtil } from "../utils/RandomUtil"; +import WebSocket from "ws"; +import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { INotification } from "../models/eft/notifier/INotifier"; -import { ConfigServer } from "./ConfigServer"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { LocalisationService } from "../services/LocalisationService"; +import { RandomUtil } from "../utils/RandomUtil"; +import { ConfigServer } from "./ConfigServer"; export declare class WebSocketServer { protected logger: ILogger; protected randomUtil: RandomUtil; protected configServer: ConfigServer; + protected localisationService: LocalisationService; protected httpServerHelper: HttpServerHelper; - constructor(logger: ILogger, randomUtil: RandomUtil, configServer: ConfigServer, httpServerHelper: HttpServerHelper); + constructor(logger: ILogger, randomUtil: RandomUtil, configServer: ConfigServer, localisationService: LocalisationService, httpServerHelper: HttpServerHelper); protected httpConfig: IHttpConfig; protected defaultNotification: INotification; protected webSockets: Record; diff --git a/TypeScript/5ReplaceMethod/types/servers/http/AkiHttpListener.d.ts b/TypeScript/5ReplaceMethod/types/servers/http/AkiHttpListener.d.ts index 6f78939..acf92aa 100644 --- a/TypeScript/5ReplaceMethod/types/servers/http/AkiHttpListener.d.ts +++ b/TypeScript/5ReplaceMethod/types/servers/http/AkiHttpListener.d.ts @@ -1,22 +1,24 @@ /// /// import { IncomingMessage, ServerResponse } from "http"; -import { IHttpListener } from "./IHttpListener"; import { Serializer } from "../../di/Serializer"; import { ILogger } from "../../models/spt/utils/ILogger"; import { HttpRouter } from "../../routers/HttpRouter"; +import { LocalisationService } from "../../services/LocalisationService"; import { HttpResponseUtil } from "../../utils/HttpResponseUtil"; import { JsonUtil } from "../../utils/JsonUtil"; import { HttpBufferHandler } from "./HttpBufferHandler"; +import { IHttpListener } from "./IHttpListener"; export declare class AkiHttpListener implements IHttpListener { protected httpRouter: HttpRouter; protected serializers: Serializer[]; protected logger: ILogger; protected jsonUtil: JsonUtil; protected httpResponse: HttpResponseUtil; + protected localisationService: LocalisationService; protected httpBufferHandler: HttpBufferHandler; constructor(httpRouter: HttpRouter, // TODO: delay required - serializers: Serializer[], logger: ILogger, jsonUtil: JsonUtil, httpResponse: HttpResponseUtil, httpBufferHandler: HttpBufferHandler); + serializers: Serializer[], logger: ILogger, jsonUtil: JsonUtil, httpResponse: HttpResponseUtil, localisationService: LocalisationService, httpBufferHandler: HttpBufferHandler); canHandle(_: string, req: IncomingMessage): boolean; handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): void; sendResponse(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: Buffer, output: string): void; diff --git a/TypeScript/5ReplaceMethod/types/services/BotEquipmentFilterService.d.ts b/TypeScript/5ReplaceMethod/types/services/BotEquipmentFilterService.d.ts index 632f961..ae72cc3 100644 --- a/TypeScript/5ReplaceMethod/types/services/BotEquipmentFilterService.d.ts +++ b/TypeScript/5ReplaceMethod/types/services/BotEquipmentFilterService.d.ts @@ -1,12 +1,12 @@ import { IBotType } from "../models/eft/common/tables/IBotType"; -import { EquipmentFilters, EquipmentFilterDetails, IBotConfig } from "../models/spt/config/IBotConfig"; +import { EquipmentFilters, EquipmentFilterDetails, IBotConfig, WeightingAdjustmentDetails } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; export declare class BotEquipmentFilterService { protected logger: ILogger; protected configServer: ConfigServer; protected botConfig: IBotConfig; - protected botEquipmentFilterlists: Record; + protected botEquipmentConfig: Record; constructor(logger: ILogger, configServer: ConfigServer); /** * Filter a bots data to exclude equipment and cartridges defines in the botConfig @@ -30,6 +30,20 @@ export declare class BotEquipmentFilterService { * @returns EquipmentFilterDetails object */ protected getBotEquipmentWhitelist(botRole: string, playerLevel: number): EquipmentFilterDetails; + /** + * Retreive clothing weighting adjustments from bot.json config + * @param botRole Bot type to get adjustments for + * @param playerLevel level of player + * @returns Weighting adjustments for bots clothing + */ + protected getBotClothingAdjustments(botRole: string, playerLevel: number): WeightingAdjustmentDetails; + /** + * Retreive item weighting adjustments from bot.json config + * @param botRole Bot type to get adjustments for + * @param playerLevel level of player + * @returns Weighting adjustments for bot items + */ + protected getBotWeightingAdjustments(botRole: string, playerLevel: number): WeightingAdjustmentDetails; /** * Filter bot equipment based on blacklist and whitelist from config/bot.json * Prioritises whitelist first, if one is found blacklist is ignored @@ -47,4 +61,10 @@ export declare class BotEquipmentFilterService { * @returns Filtered bot file */ protected filterCartridges(baseBotNode: IBotType, blacklist: EquipmentFilterDetails, whitelist: EquipmentFilterDetails): void; + /** + * Add/Edit weighting changes to bot items using values from config/bot.json/equipment + * @param weightingAdjustments Weighting change to apply to bot + * @param botItemPool Bot item dictionary to adjust + */ + protected adjustWeighting(weightingAdjustments: WeightingAdjustmentDetails, botItemPool: Record): void; } diff --git a/TypeScript/5ReplaceMethod/types/services/BotGenerationCacheService.d.ts b/TypeScript/5ReplaceMethod/types/services/BotGenerationCacheService.d.ts index ba53fec..0be0576 100644 --- a/TypeScript/5ReplaceMethod/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/5ReplaceMethod/types/services/BotGenerationCacheService.d.ts @@ -8,11 +8,11 @@ export declare class BotGenerationCacheService { protected randomUtil: RandomUtil; protected jsonUtil: JsonUtil; protected botHelper: BotHelper; - protected storedBots: IBotBase[]; + protected storedBots: Map; constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, botHelper: BotHelper); /** * Store array of bots in cache, shuffle results before storage - * @param botsToStore + * @param botsToStore Bots we want to store in the cache */ storeBots(botsToStore: IBotBase[]): void; /** @@ -21,25 +21,7 @@ export declare class BotGenerationCacheService { * @param role role to retreive (assault/bossTagilla etc) * @returns IBotBase object */ - getBot(role: string): IBotBase[]; - /** - * Find a bot by its index from cache - * @param indexOfBotToReturn index to find bot by - * @returns bot profile - */ - protected getBotFromCache(indexOfBotToReturn: number): IBotBase; - /** - * Remove bot profile by index from cache - * @param indexOfBotToReturn Index of bot profile to remove - */ - protected removeBotFromCache(indexOfBotToReturn: number): void; - /** - * Get index of bot profile that matches criteria - * @param role Role of bot wanted - * @param getPmc Requested bot a pmc - * @returns index of found bot, -1 if not found - */ - protected getIndexOfBotToReturn(role: string, getPmc: boolean): number; + getBot(role: string): IBotBase; /** * Remove all cached bot profiles */ @@ -48,5 +30,5 @@ export declare class BotGenerationCacheService { * Does cache have bots * @returns true if empty */ - cacheIsEmpty(): boolean; + cacheHasBotOfRole(role: string): boolean; } diff --git a/TypeScript/5ReplaceMethod/types/services/LocaleService.d.ts b/TypeScript/5ReplaceMethod/types/services/LocaleService.d.ts index 33bea7b..8275b75 100644 --- a/TypeScript/5ReplaceMethod/types/services/LocaleService.d.ts +++ b/TypeScript/5ReplaceMethod/types/services/LocaleService.d.ts @@ -1,14 +1,42 @@ import { ILocaleConfig } from "../models/spt/config/ILocaleConfig"; +import { ILocaleGlobalBase } from "../models/spt/server/ILocaleBase"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +/** + * Handles getting locales from config or users machine + */ export declare class LocaleService { protected logger: ILogger; + protected databaseServer: DatabaseServer; protected configServer: ConfigServer; protected localeConfig: ILocaleConfig; - constructor(logger: ILogger, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, configServer: ConfigServer); /** - * Gets the locale key from the locale.json file + * Get the eft globals db file based on the configured locale in config/locale.json, if not found, fall back to 'en' + * @returns ILocaleGlobalBase + */ + getLocaleDb(): ILocaleGlobalBase; + /** + * Gets the game locale key from the locale.json file, + * if value is 'system' get system locale * @returns locale e.g en/ge/cz/cn */ - getDesiredLocale(): string; + getDesiredGameLocale(): string; + /** + * Gets the game locale key from the locale.json file, + * if value is 'system' get system locale + * @returns locale e.g en/ge/cz/cn + */ + getDesiredServerLocale(): string; + /** + * Get array of languages supported for localisation + * @returns array of locales e.g. en/fr/cn + */ + getServerSupportedLocales(): string[]; + /** + * Get the locale of the computer running the server + * @returns langage part of locale e.g. 'en' part of 'en-US' + */ + protected getPlatformLocale(): string; } diff --git a/TypeScript/5ReplaceMethod/types/services/LocalisationService.d.ts b/TypeScript/5ReplaceMethod/types/services/LocalisationService.d.ts new file mode 100644 index 0000000..519325d --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/services/LocalisationService.d.ts @@ -0,0 +1,21 @@ +import { I18n } from "i18n"; +import { ILocaleConfig } from "../models/spt/config/ILocaleConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { LocaleService } from "./LocaleService"; +/** + * Handles translating server text into different langauges + */ +export declare class LocalisationService { + protected logger: ILogger; + protected localeService: LocaleService; + protected localeConfig: ILocaleConfig; + protected i18n: I18n; + constructor(logger: ILogger, localeService: LocaleService); + /** + * Get a localised value using the passed in key + * @param key Key to loop up locale for + * @param args optional arguments + * @returns Localised string + */ + getText(key: string, args?: any): string; +} diff --git a/TypeScript/5ReplaceMethod/types/services/PaymentService.d.ts b/TypeScript/5ReplaceMethod/types/services/PaymentService.d.ts index a5e538f..c9ce95a 100644 --- a/TypeScript/5ReplaceMethod/types/services/PaymentService.d.ts +++ b/TypeScript/5ReplaceMethod/types/services/PaymentService.d.ts @@ -11,6 +11,7 @@ import { IProcessSellTradeRequestData } from "../models/eft/trade/IProcessSellTr import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +import { LocalisationService } from "./LocalisationService"; export declare class PaymentService { protected logger: ILogger; protected httpResponse: HttpResponseUtil; @@ -19,8 +20,9 @@ export declare class PaymentService { protected traderHelper: TraderHelper; protected itemHelper: ItemHelper; protected inventoryHelper: InventoryHelper; + protected localisationService: LocalisationService; protected paymentHelper: PaymentHelper; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, traderHelper: TraderHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper); + constructor(logger: ILogger, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, traderHelper: TraderHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, localisationService: LocalisationService, paymentHelper: PaymentHelper); /** * Take money and insert items into return to server request * @param {Object} pmcData @@ -50,7 +52,7 @@ export declare class PaymentService { * @param pmcData Player profile to find and remove currency from * @param currencyTpl Type of currency to pay * @param amountToPay money value to pay - * @param sessionID Sessino id + * @param sessionID Session id * @param output output object to send to client * @returns IItemEventRouterResponse */ diff --git a/TypeScript/5ReplaceMethod/types/services/PlayerService.d.ts b/TypeScript/5ReplaceMethod/types/services/PlayerService.d.ts index 519b7e5..2f364d5 100644 --- a/TypeScript/5ReplaceMethod/types/services/PlayerService.d.ts +++ b/TypeScript/5ReplaceMethod/types/services/PlayerService.d.ts @@ -2,10 +2,12 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { IPlayerIncrementSkillLevelRequestData } from "../models/eft/player/IPlayerIncrementSkillLevelRequestData"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "./LocalisationService"; export declare class PlayerService { protected logger: ILogger; + protected localisationService: LocalisationService; protected databaseServer: DatabaseServer; - constructor(logger: ILogger, databaseServer: DatabaseServer); + constructor(logger: ILogger, localisationService: LocalisationService, databaseServer: DatabaseServer); /** * increases the profile skill and updates any output * @param {Object} pmcData diff --git a/TypeScript/5ReplaceMethod/types/services/PmcAiService.d.ts b/TypeScript/5ReplaceMethod/types/services/PmcAiService.d.ts deleted file mode 100644 index 0690f1f..0000000 --- a/TypeScript/5ReplaceMethod/types/services/PmcAiService.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { IBotConfig } from "../models/spt/config/IBotConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { ConfigServer } from "../servers/ConfigServer"; -/** Storing/retreving pmcRoles set at the start of a raid - its done at that point as we know what location the player is heading to */ -export declare class PmcAiService { - protected logger: ILogger; - protected configServer: ConfigServer; - protected botConfig: IBotConfig; - protected usecRole: string; - protected bearRole: string; - constructor(logger: ILogger, configServer: ConfigServer); - /** - * Convert from pmc side (usec/bear) to the side as defined in the bot config (usecType/bearType) - * @param pmcSide eft side (usec/bear) - * @returns pmc side as defined in config - */ - getPmcRole(pmcSide: "usec" | "bear" | string): string; - /** - * Set the roles for pmcs - * @param location map location to look up and use as pmc types - */ - setPmcRolesByLocation(location: string): void; - /** - * Clear the saved role from usec/bear PMCs - */ - clearPmcRoles(): void; -} diff --git a/TypeScript/5ReplaceMethod/types/services/ProfileFixerService.d.ts b/TypeScript/5ReplaceMethod/types/services/ProfileFixerService.d.ts index e772919..86a6af8 100644 --- a/TypeScript/5ReplaceMethod/types/services/ProfileFixerService.d.ts +++ b/TypeScript/5ReplaceMethod/types/services/ProfileFixerService.d.ts @@ -8,12 +8,14 @@ import { HideoutAreas } from "../models/enums/HideoutAreas"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { Watermark } from "../utils/Watermark"; +import { LocalisationService } from "./LocalisationService"; export declare class ProfileFixerService { protected logger: ILogger; protected watermark: Watermark; protected hideoutHelper: HideoutHelper; + protected localisationService: LocalisationService; protected databaseServer: DatabaseServer; - constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, databaseServer: DatabaseServer); + constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, localisationService: LocalisationService, databaseServer: DatabaseServer); /** * Find issues in the pmc profile data that may cause issues and fix them * @param pmcProfile profile to check and fix diff --git a/TypeScript/5ReplaceMethod/types/services/RagfairOfferService.d.ts b/TypeScript/5ReplaceMethod/types/services/RagfairOfferService.d.ts index a6f6b6d..86c1e52 100644 --- a/TypeScript/5ReplaceMethod/types/services/RagfairOfferService.d.ts +++ b/TypeScript/5ReplaceMethod/types/services/RagfairOfferService.d.ts @@ -11,6 +11,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { TimeUtil } from "../utils/TimeUtil"; +import { LocalisationService } from "./LocalisationService"; import { RagfairCategoriesService } from "./RagfairCategoriesService"; export declare class RagfairOfferService { protected logger: ILogger; @@ -22,12 +23,14 @@ export declare class RagfairOfferService { protected profileHelper: ProfileHelper; protected eventOutputHolder: EventOutputHolder; protected httpResponse: HttpResponseUtil; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected playerOffersLoaded: boolean; protected expiredOffers: Item[]; - protected offers: IRagfairOffer[]; + /** offerId, offer */ + protected offers: Record; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, databaseServer: DatabaseServer, saveServer: SaveServer, ragfairServerHelper: RagfairServerHelper, ragfairCategoriesService: RagfairCategoriesService, profileHelper: ProfileHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, databaseServer: DatabaseServer, saveServer: SaveServer, ragfairServerHelper: RagfairServerHelper, ragfairCategoriesService: RagfairCategoriesService, profileHelper: ProfileHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, localisationService: LocalisationService, configServer: ConfigServer); /** * Get all offers * @returns IRagfairOffer array diff --git a/TypeScript/5ReplaceMethod/types/utils/App.d.ts b/TypeScript/5ReplaceMethod/types/utils/App.d.ts index dcc2669..cc8a5af 100644 --- a/TypeScript/5ReplaceMethod/types/utils/App.d.ts +++ b/TypeScript/5ReplaceMethod/types/utils/App.d.ts @@ -1,14 +1,16 @@ -import { TimeUtil } from "./TimeUtil"; import { OnLoad } from "../di/OnLoad"; import { OnUpdate } from "../di/OnUpdate"; import { ILogger } from "../models/spt/utils/ILogger"; +import { LocalisationService } from "../services/LocalisationService"; +import { TimeUtil } from "./TimeUtil"; export declare class App { protected logger: ILogger; protected timeUtil: TimeUtil; + protected localisationService: LocalisationService; protected onLoadComponents: OnLoad[]; protected onUpdateComponents: OnUpdate[]; protected onUpdateLastRun: {}; - constructor(logger: ILogger, timeUtil: TimeUtil, onLoadComponents: OnLoad[], onUpdateComponents: OnUpdate[]); + constructor(logger: ILogger, timeUtil: TimeUtil, localisationService: LocalisationService, onLoadComponents: OnLoad[], onUpdateComponents: OnUpdate[]); load(): void; protected update(onUpdateComponents: OnUpdate[]): void; protected logUpdateException(err: any, updateable: OnUpdate): void; diff --git a/TypeScript/5ReplaceMethod/types/utils/DatabaseImporter.d.ts b/TypeScript/5ReplaceMethod/types/utils/DatabaseImporter.d.ts index 483e135..31670ae 100644 --- a/TypeScript/5ReplaceMethod/types/utils/DatabaseImporter.d.ts +++ b/TypeScript/5ReplaceMethod/types/utils/DatabaseImporter.d.ts @@ -3,15 +3,17 @@ import { IDatabaseTables } from "../models/spt/server/IDatabaseTables"; import { ILogger } from "../models/spt/utils/ILogger"; import { ImageRouter } from "../routers/ImageRouter"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { JsonUtil } from "./JsonUtil"; import { VFS } from "./VFS"; export declare class DatabaseImporter extends OnLoad { protected logger: ILogger; protected vfs: VFS; protected jsonUtil: JsonUtil; + protected localisationService: LocalisationService; protected databaseServer: DatabaseServer; protected imageRouter: ImageRouter; - constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, databaseServer: DatabaseServer, imageRouter: ImageRouter); + constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, localisationService: LocalisationService, databaseServer: DatabaseServer, imageRouter: ImageRouter); onLoad(): void; /** * Read all json files in database folder and map into a json object diff --git a/TypeScript/5ReplaceMethod/types/utils/HttpResponseUtil.d.ts b/TypeScript/5ReplaceMethod/types/utils/HttpResponseUtil.d.ts index 29502be..3a78618 100644 --- a/TypeScript/5ReplaceMethod/types/utils/HttpResponseUtil.d.ts +++ b/TypeScript/5ReplaceMethod/types/utils/HttpResponseUtil.d.ts @@ -1,10 +1,13 @@ -import { JsonUtil } from "./JsonUtil"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { INullResponseData } from "../models/eft/httpResponse/INullResponseData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; +import { BackendErrorCodes } from "../models/enums/BackendErrorCodes"; +import { LocalisationService } from "../services/LocalisationService"; +import { JsonUtil } from "./JsonUtil"; export declare class HttpResponseUtil { protected jsonUtil: JsonUtil; - constructor(jsonUtil: JsonUtil); + protected localisationService: LocalisationService; + constructor(jsonUtil: JsonUtil, localisationService: LocalisationService); protected clearString(s: string): any; noBody(data: any): any; getBody(data: T, err?: number, errmsg?: any): IGetBodyResponseData; @@ -12,5 +15,5 @@ export declare class HttpResponseUtil { emptyResponse(): IGetBodyResponseData; nullResponse(): INullResponseData; emptyArrayResponse(): IGetBodyResponseData; - appendErrorToOutput(output: IItemEventRouterResponse, message?: string, title?: string): IItemEventRouterResponse; + appendErrorToOutput(output: IItemEventRouterResponse, message?: string, errorCode?: BackendErrorCodes): IItemEventRouterResponse; } diff --git a/TypeScript/5ReplaceMethod/types/utils/RandomUtil.d.ts b/TypeScript/5ReplaceMethod/types/utils/RandomUtil.d.ts index 633e472..aa556e3 100644 --- a/TypeScript/5ReplaceMethod/types/utils/RandomUtil.d.ts +++ b/TypeScript/5ReplaceMethod/types/utils/RandomUtil.d.ts @@ -110,6 +110,12 @@ export declare class RandomUtil { getIntEx(max: number): number; getFloat(min: number, max: number): number; getBool(): boolean; + /** + * Check if number passes a check out of 100 + * @param chancePercent value check needs to be above + * @returns true if value passes check + */ + getChance100(chancePercent: number): boolean; getStringArrayValue(arr: string[]): string; getArrayValue(arr: T[]): T; getKey(node: any): string; diff --git a/TypeScript/5ReplaceMethod/types/utils/Watermark.d.ts b/TypeScript/5ReplaceMethod/types/utils/Watermark.d.ts index c6dc120..e02eba2 100644 --- a/TypeScript/5ReplaceMethod/types/utils/Watermark.d.ts +++ b/TypeScript/5ReplaceMethod/types/utils/Watermark.d.ts @@ -1,20 +1,15 @@ import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { LocalisationService } from "../services/LocalisationService"; export declare class WatermarkLocale { - protected locales: { - "en-US": { - description: string[]; - warning: string[]; - modding: string[]; - }; - "zh-CN": { - description: string[]; - warning: string[]; - modding: string[]; - }; + protected localisationService: LocalisationService; + constructor(localisationService: LocalisationService); + protected watermark: { + description: string[]; + warning: string[]; + modding: string[]; }; - getLocale(): string; getDescription(): string[]; getWarning(): string[]; getModding(): string[]; @@ -22,9 +17,10 @@ export declare class WatermarkLocale { export declare class Watermark { protected logger: ILogger; protected configServer: ConfigServer; + protected localisationService: LocalisationService; protected watermarkLocale?: WatermarkLocale; protected akiConfig: ICoreConfig; - constructor(logger: ILogger, configServer: ConfigServer, watermarkLocale?: WatermarkLocale); + constructor(logger: ILogger, configServer: ConfigServer, localisationService: LocalisationService, watermarkLocale?: WatermarkLocale); protected text: string[]; protected versionLabel: string; initialize(): void; diff --git a/TypeScript/6ReferenceAnotherClass/types/callbacks/BotCallbacks.d.ts b/TypeScript/6ReferenceAnotherClass/types/callbacks/BotCallbacks.d.ts index 2db60dc..827015e 100644 --- a/TypeScript/6ReferenceAnotherClass/types/callbacks/BotCallbacks.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/callbacks/BotCallbacks.d.ts @@ -8,8 +8,29 @@ export declare class BotCallbacks { protected botController: BotController; protected httpResponse: HttpResponseUtil; constructor(botController: BotController, httpResponse: HttpResponseUtil); + /** + * Handle singleplayer/settings/bot/limit + * @returns string + */ getBotLimit(url: string, info: IEmptyRequestData, sessionID: string): string; + /** + * Handle singleplayer/settings/bot/difficulty + * @returns string + */ getBotDifficulty(url: string, info: IEmptyRequestData, sessionID: string): string; + /** + * Handle client/game/bot/generate + * @returns IGetBodyResponseData + */ generateBots(url: string, info: IGenerateBotsRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle singleplayer/settings/bot/maxCap + * @returns string + */ getBotCap(): string; + /** + * Handle singleplayer/settings/bot/getBotBehaviours + * @returns string + */ + getBotBehaviours(): string; } diff --git a/TypeScript/6ReferenceAnotherClass/types/callbacks/CustomizationCallbacks.d.ts b/TypeScript/6ReferenceAnotherClass/types/callbacks/CustomizationCallbacks.d.ts index 3bab8c0..75d5701 100644 --- a/TypeScript/6ReferenceAnotherClass/types/callbacks/CustomizationCallbacks.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/callbacks/CustomizationCallbacks.d.ts @@ -3,6 +3,7 @@ import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { IPmcData } from "../models/eft/common/IPmcData"; import { ISuit } from "../models/eft/common/tables/ITrader"; import { IBuyClothingRequestData } from "../models/eft/customization/IBuyClothingRequestData"; +import { IGetSuitsResponse } from "../models/eft/customization/IGetSuitsResponse"; import { IWearClothingRequestData } from "../models/eft/customization/IWearClothingRequestData"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; @@ -13,10 +14,15 @@ export declare class CustomizationCallbacks { protected saveServer: SaveServer; protected httpResponse: HttpResponseUtil; constructor(customizationController: CustomizationController, saveServer: SaveServer, httpResponse: HttpResponseUtil); - getSuits(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<{ - _id: string; - suites: string[]; - }>; + /** + * Handles client/trading/customization/storage + * @returns + */ + getSuits(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handles client/trading/customization + * @returns ISuit[] + */ getTraderSuits(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; wearClothing(pmcData: IPmcData, body: IWearClothingRequestData, sessionID: string): IItemEventRouterResponse; buyClothing(pmcData: IPmcData, body: IBuyClothingRequestData, sessionID: string): IItemEventRouterResponse; diff --git a/TypeScript/6ReferenceAnotherClass/types/callbacks/DataCallbacks.d.ts b/TypeScript/6ReferenceAnotherClass/types/callbacks/DataCallbacks.d.ts index 04566ff..2efcf81 100644 --- a/TypeScript/6ReferenceAnotherClass/types/callbacks/DataCallbacks.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/callbacks/DataCallbacks.d.ts @@ -12,15 +12,42 @@ import { ILanguageBase } from "../models/spt/server/ILocaleBase"; import { ISettingsBase } from "../models/spt/server/ISettingsBase"; import { DatabaseServer } from "../servers/DatabaseServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +/** + * Handle client requests + */ export declare class DataCallbacks { protected httpResponse: HttpResponseUtil; protected databaseServer: DatabaseServer; constructor(httpResponse: HttpResponseUtil, databaseServer: DatabaseServer); + /** + * Handles client/settings + * @returns ISettingsBase + */ getSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handles client/globals + * @returns IGlobals + */ getGlobals(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handles client/items + * @returns string + */ getTemplateItems(url: string, info: IEmptyRequestData, sessionID: string): string; + /** + * Handles client/handbook/templates + * @returns IHandbookBase + */ getTemplateHandbook(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handles client/customization + * @returns Record>; + /** + * Handles client/account/customization + * @returns string[] + */ getTemplateCharacter(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getTemplateQuests(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getHideoutSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; @@ -28,6 +55,6 @@ export declare class DataCallbacks { gethideoutProduction(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getHideoutScavcase(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getLocalesLanguages(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - getLocalesMenu(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + getLocalesMenu(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getLocalesGlobal(url: string, info: IEmptyRequestData, sessionID: string): string; } diff --git a/TypeScript/6ReferenceAnotherClass/types/callbacks/DialogueCallbacks.d.ts b/TypeScript/6ReferenceAnotherClass/types/callbacks/DialogueCallbacks.d.ts index 634f90b..7b2eeae 100644 --- a/TypeScript/6ReferenceAnotherClass/types/callbacks/DialogueCallbacks.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/callbacks/DialogueCallbacks.d.ts @@ -26,15 +26,27 @@ export declare class DialogueCallbacks extends OnUpdate { protected httpResponse: HttpResponseUtil; protected dialogueController: DialogueController; constructor(hashUtil: HashUtil, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, dialogueController: DialogueController); + /** + * Handles client/friend/list + * @returns IGetFriendListDataResponse + */ getFriendList(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handles client/chatServer/list + * @returns + */ getChatServerList(url: string, info: IGetChatServerListRequestData, sessionID: string): IGetBodyResponseData; getMailDialogList(url: string, info: IGetMailDialogListRequestData, sessionID: string): IGetBodyResponseData; getMailDialogView(url: string, info: IGetMailDialogViewRequestData, sessionID: string): IGetBodyResponseData; - getMailDialogInfo(url: string, info: IGetMailDialogInfoRequestData, sessionID: string): IGetBodyResponseData; + getMailDialogInfo(url: string, info: IGetMailDialogInfoRequestData, sessionID: string): IGetBodyResponseData; removeDialog(url: string, info: IRemoveDialogRequestData, sessionID: string): IGetBodyResponseData; pinDialog(url: string, info: IPinDialogRequestData, sessionID: string): IGetBodyResponseData; unpinDialog(url: string, info: IPinDialogRequestData, sessionID: string): IGetBodyResponseData; setRead(url: string, info: ISetDialogReadRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handles client/mail/dialog/getAllAttachments + * @returns IGetAllAttachmentsResponse + */ getAllAttachments(url: string, info: IGetAllAttachmentsRequestData, sessionID: string): IGetBodyResponseData; listOutbox(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; listInbox(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; diff --git a/TypeScript/6ReferenceAnotherClass/types/callbacks/GameCallbacks.d.ts b/TypeScript/6ReferenceAnotherClass/types/callbacks/GameCallbacks.d.ts index 5e4c240..3a6b7e6 100644 --- a/TypeScript/6ReferenceAnotherClass/types/callbacks/GameCallbacks.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/callbacks/GameCallbacks.d.ts @@ -3,6 +3,9 @@ import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { ICheckVersionResponse } from "../models/eft/game/ICheckVersionResponse"; import { IGameConfigResponse } from "../models/eft/game/IGameConfigResponse"; import { IGameEmptyCrcRequestData } from "../models/eft/game/IGameEmptyCrcRequestData"; +import { IGameKeepAliveResponse } from "../models/eft/game/IGameKeepAliveResponse"; +import { IGameLogoutResponseData } from "../models/eft/game/IGameLogoutResponseData"; +import { IGameStartResponse } from "../models/eft/game/IGameStartResponse"; import { IReportNicknameRequestData } from "../models/eft/game/IReportNicknameRequestData"; import { IServerDetails } from "../models/eft/game/IServerDetails"; import { IVersionValidateRequestData } from "../models/eft/game/IVersionValidateRequestData"; @@ -15,13 +18,37 @@ declare class GameCallbacks { protected watermark: Watermark; protected gameController: GameController; constructor(httpResponse: HttpResponseUtil, watermark: Watermark, gameController: GameController); + /** + * Handle client/game/version/validate + * @returns INullResponseData + */ versionValidate(url: string, info: IVersionValidateRequestData, sessionID: string): INullResponseData; - gameStart(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - gameLogout(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/game/start + * @returns IGameStartResponse + */ + gameStart(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/game/logout + * @returns IGameLogoutResponseData + */ + gameLogout(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/game/config + * @returns IGameConfigResponse + */ getGameConfig(url: string, info: IGameEmptyCrcRequestData, sessionID: string): IGetBodyResponseData; getServer(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; validateGameVersion(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - gameKeepalive(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/game/keepalive + * @returns IGameKeepAliveResponse + */ + gameKeepalive(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle singleplayer/settings/version + * @returns string + */ getVersion(url: string, info: IEmptyRequestData, sessionID: string): string; reportNickname(url: string, info: IReportNicknameRequestData, sessionID: string): INullResponseData; } diff --git a/TypeScript/6ReferenceAnotherClass/types/callbacks/HealthCallbacks.d.ts b/TypeScript/6ReferenceAnotherClass/types/callbacks/HealthCallbacks.d.ts index 8672be7..7edf03e 100644 --- a/TypeScript/6ReferenceAnotherClass/types/callbacks/HealthCallbacks.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/callbacks/HealthCallbacks.d.ts @@ -21,7 +21,19 @@ export declare class HealthCallbacks { * @returns empty response, no data sent back to client */ syncHealth(url: string, info: ISyncHealthRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle Eat + * @returns IItemEventRouterResponse + */ offraidEat(pmcData: IPmcData, body: IOffraidEatRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle Heal + * @returns IItemEventRouterResponse + */ offraidHeal(pmcData: IPmcData, body: IOffraidHealRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle RestoreHealth + * @returns IItemEventRouterResponse + */ healthTreatment(pmcData: IPmcData, info: IHealthTreatmentRequestData, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/6ReferenceAnotherClass/types/callbacks/HideoutCallbacks.d.ts b/TypeScript/6ReferenceAnotherClass/types/callbacks/HideoutCallbacks.d.ts index 99ab4c9..e39e806 100644 --- a/TypeScript/6ReferenceAnotherClass/types/callbacks/HideoutCallbacks.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/callbacks/HideoutCallbacks.d.ts @@ -19,14 +19,77 @@ export declare class HideoutCallbacks extends OnUpdate { protected hideoutConfig: IHideoutConfig; constructor(hideoutController: HideoutController, // TODO: delay needed configServer: ConfigServer); + /** + * Handle HideoutUpgrade + * @param pmcData + * @param body + * @param sessionID + * @returns + */ upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutUpgradeComplete + * @param pmcData + * @param body + * @param sessionID + * @returns + */ upgradeComplete(pmcData: IPmcData, body: IHideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutPutItemsInAreaSlots + * @param pmcData + * @param body + * @param sessionID + * @returns + */ putItemsInAreaSlots(pmcData: IPmcData, body: IHideoutPutItemInRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutTakeItemsFromAreaSlots + * @param pmcData + * @param body + * @param sessionID + * @returns + */ takeItemsFromAreaSlots(pmcData: IPmcData, body: IHideoutTakeItemOutRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutToggleArea + * @param pmcData + * @param body + * @param sessionID + * @returns + */ toggleArea(pmcData: IPmcData, body: IHideoutToggleAreaRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutSingleProductionStart + * @param pmcData + * @param body + * @param sessionID + * @returns + */ singleProductionStart(pmcData: IPmcData, body: IHideoutSingleProductionStartRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutScavCaseProductionStart + * @param pmcData + * @param body + * @param sessionID + * @returns + */ scavCaseProductionStart(pmcData: IPmcData, body: IHideoutScavCaseStartRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutContinuousProductionStart + * @param pmcData + * @param body + * @param sessionID + * @returns + */ continuousProductionStart(pmcData: IPmcData, body: IHideoutContinousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutTakeProduction + * @param pmcData + * @param body + * @param sessionID + * @returns + */ takeProduction(pmcData: IPmcData, body: IHideoutTakeProductionRequestData, sessionID: string): IItemEventRouterResponse; onUpdate(timeSinceLastRun: number): boolean; getRoute(): string; diff --git a/TypeScript/6ReferenceAnotherClass/types/callbacks/InraidCallbacks.d.ts b/TypeScript/6ReferenceAnotherClass/types/callbacks/InraidCallbacks.d.ts index 05bcce4..918bfaf 100644 --- a/TypeScript/6ReferenceAnotherClass/types/callbacks/InraidCallbacks.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/callbacks/InraidCallbacks.d.ts @@ -1,23 +1,49 @@ import { InraidController } from "../controllers/InraidController"; -import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { INullResponseData } from "../models/eft/httpResponse/INullResponseData"; import { IRegisterPlayerRequestData } from "../models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; -import { IAirdropConfig } from "../models/spt/config/IAirdropConfig"; -import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; -import { ConfigServer } from "../servers/ConfigServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +/** + * Handle client requests + */ export declare class InraidCallbacks { protected inraidController: InraidController; protected httpResponse: HttpResponseUtil; - protected configServer: ConfigServer; - protected airdropConfig: IAirdropConfig; - protected inraidConfig: IInRaidConfig; - constructor(inraidController: InraidController, httpResponse: HttpResponseUtil, configServer: ConfigServer); + constructor(inraidController: InraidController, httpResponse: HttpResponseUtil); + /** + * Handle client/location/getLocalloot + * @param url + * @param info register player request + * @param sessionID Session id + * @returns Null http response + */ registerPlayer(url: string, info: IRegisterPlayerRequestData, sessionID: string): INullResponseData; + /** + * Handle raid/profile/save + * @param url + * @param info Save progress request + * @param sessionID Session id + * @returns Null http response + */ saveProgress(url: string, info: ISaveProgressRequestData, sessionID: string): INullResponseData; + /** + * Handle singleplayer/settings/raid/endstate + * @returns + */ getRaidEndState(): string; - getRaidMenuSettings(url: string, info: IEmptyRequestData, sessionID: string): string; - getWeaponDurability(url: string, info: any, sessionID: string): string; - getAirdropConfig(url: string, info: any, sessionID: string): string; + /** + * Handle singleplayer/settings/raid/menu + * @returns JSON as string + */ + getRaidMenuSettings(): string; + /** + * Handle singleplayer/settings/weapon/durability + * @returns + */ + getWeaponDurability(): string; + /** + * Handle singleplayer/airdrop/config + * @returns JSON as string + */ + getAirdropConfig(): string; } diff --git a/TypeScript/6ReferenceAnotherClass/types/callbacks/InsuranceCallbacks.d.ts b/TypeScript/6ReferenceAnotherClass/types/callbacks/InsuranceCallbacks.d.ts index 8835ba2..a171e1c 100644 --- a/TypeScript/6ReferenceAnotherClass/types/callbacks/InsuranceCallbacks.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/callbacks/InsuranceCallbacks.d.ts @@ -17,7 +17,15 @@ export declare class InsuranceCallbacks extends OnUpdate { protected configServer: ConfigServer; protected insuranceConfig: IInsuranceConfig; constructor(insuranceController: InsuranceController, insuranceService: InsuranceService, httpResponse: HttpResponseUtil, configServer: ConfigServer); + /** + * Handle client/insurance/items/list/cost + * @returns IGetInsuranceCostResponseData + */ getInsuranceCost(url: string, info: IGetInsuranceCostRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle Insure + * @returns IItemEventRouterResponse + */ insure(pmcData: IPmcData, body: IInsureRequestData, sessionID: string): IItemEventRouterResponse; onUpdate(secondsSinceLastRun: number): boolean; getRoute(): string; diff --git a/TypeScript/6ReferenceAnotherClass/types/callbacks/InventoryCallbacks.d.ts b/TypeScript/6ReferenceAnotherClass/types/callbacks/InventoryCallbacks.d.ts index 9ab1486..46bf6fd 100644 --- a/TypeScript/6ReferenceAnotherClass/types/callbacks/InventoryCallbacks.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/callbacks/InventoryCallbacks.d.ts @@ -16,6 +16,7 @@ import { IInventorySwapRequestData } from "../models/eft/inventory/IInventorySwa import { IInventoryTagRequestData } from "../models/eft/inventory/IInventoryTagRequestData"; import { IInventoryToggleRequestData } from "../models/eft/inventory/IInventoryToggleRequestData"; import { IInventoryTransferRequestData } from "../models/eft/inventory/IInventoryTransferRequestData"; +import { IOpenRandomLootContainerRequestData } from "../models/eft/inventory/IOpenRandomLootContainerRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; export declare class InventoryCallbacks { protected inventoryController: InventoryController; @@ -36,4 +37,5 @@ export declare class InventoryCallbacks { createMapMarker(pmcData: IPmcData, body: IInventoryCreateMarkerRequestData, sessionID: string): IItemEventRouterResponse; deleteMapMarker(pmcData: IPmcData, body: IInventoryDeleteMarkerRequestData, sessionID: string): IItemEventRouterResponse; editMapMarker(pmcData: IPmcData, body: IInventoryEditMarkerRequestData, sessionID: string): IItemEventRouterResponse; + openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/6ReferenceAnotherClass/types/callbacks/ItemEventCallbacks.d.ts b/TypeScript/6ReferenceAnotherClass/types/callbacks/ItemEventCallbacks.d.ts index f4f04f9..fbb0b5f 100644 --- a/TypeScript/6ReferenceAnotherClass/types/callbacks/ItemEventCallbacks.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/callbacks/ItemEventCallbacks.d.ts @@ -1,4 +1,5 @@ import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; +import { Warning } from "../models/eft/itemEvent/IItemEventRouterBase"; import { IItemEventRouterRequest } from "../models/eft/itemEvent/IItemEventRouterRequest"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { ItemEventRouter } from "../routers/ItemEventRouter"; @@ -8,4 +9,5 @@ export declare class ItemEventCallbacks { protected itemEventRouter: ItemEventRouter; constructor(httpResponse: HttpResponseUtil, itemEventRouter: ItemEventRouter); handleEvents(url: string, info: IItemEventRouterRequest, sessionID: string): IGetBodyResponseData; + protected getErrorCode(warnings: Warning[]): number; } diff --git a/TypeScript/6ReferenceAnotherClass/types/callbacks/MatchCallbacks.d.ts b/TypeScript/6ReferenceAnotherClass/types/callbacks/MatchCallbacks.d.ts index 2a92ef5..10fbc44 100644 --- a/TypeScript/6ReferenceAnotherClass/types/callbacks/MatchCallbacks.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/callbacks/MatchCallbacks.d.ts @@ -34,6 +34,10 @@ export declare class MatchCallbacks { serverAvailable(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData | IGetBodyResponseData; joinMatch(url: string, info: IJoinMatchRequestData, sessionID: string): IGetBodyResponseData; getMetrics(url: string, info: any, sessionID: string): IGetBodyResponseData; + /** + * Handle client/match/group/status + * @returns + */ getGroupStatus(url: string, info: IGetGroupStatusRequestData, sessionID: string): IGetBodyResponseData; createGroup(url: string, info: ICreateGroupRequestData, sessionID: string): IGetBodyResponseData; deleteGroup(url: string, info: any, sessionID: string): INullResponseData; diff --git a/TypeScript/6ReferenceAnotherClass/types/callbacks/NotifierCallbacks.d.ts b/TypeScript/6ReferenceAnotherClass/types/callbacks/NotifierCallbacks.d.ts index c42058f..fab325b 100644 --- a/TypeScript/6ReferenceAnotherClass/types/callbacks/NotifierCallbacks.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/callbacks/NotifierCallbacks.d.ts @@ -4,6 +4,7 @@ import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { INotifierChannel } from "../models/eft/notifier/INotifier"; import { ISelectProfileRequestData } from "../models/eft/notifier/ISelectProfileRequestData"; +import { ISelectProfileResponse } from "../models/eft/notifier/ISelectProfileResponse"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; export declare class NotifierCallbacks { protected httpServerHelper: HttpServerHelper; @@ -19,6 +20,10 @@ export declare class NotifierCallbacks { sendNotification(sessionID: string, req: any, resp: any, data: any): void; getNotifier(url: string, info: any, sessionID: string): IGetBodyResponseData; createNotifierChannel(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - selectProfile(url: string, info: ISelectProfileRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/game/profile/select + * @returns ISelectProfileResponse + */ + selectProfile(url: string, info: ISelectProfileRequestData, sessionID: string): IGetBodyResponseData; notify(url: string, info: any, sessionID: string): string; } diff --git a/TypeScript/6ReferenceAnotherClass/types/callbacks/QuestCallbacks.d.ts b/TypeScript/6ReferenceAnotherClass/types/callbacks/QuestCallbacks.d.ts index 559c29e..2a3eb20 100644 --- a/TypeScript/6ReferenceAnotherClass/types/callbacks/QuestCallbacks.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/callbacks/QuestCallbacks.d.ts @@ -21,6 +21,13 @@ export declare class QuestCallbacks { acceptQuest(pmcData: IPmcData, body: IAcceptQuestRequestData, sessionID: string): IItemEventRouterResponse; completeQuest(pmcData: IPmcData, body: ICompleteQuestRequestData, sessionID: string): IItemEventRouterResponse; handoverQuest(pmcData: IPmcData, body: IHandoverQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle client/quest/list + * @param url + * @param info + * @param sessionID + * @returns + */ listQuests(url: string, info: IListQuestsRequestData, sessionID: string): IGetBodyResponseData; activityPeriods(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; } diff --git a/TypeScript/6ReferenceAnotherClass/types/callbacks/RagfairCallbacks.d.ts b/TypeScript/6ReferenceAnotherClass/types/callbacks/RagfairCallbacks.d.ts index c609f2f..37f3807 100644 --- a/TypeScript/6ReferenceAnotherClass/types/callbacks/RagfairCallbacks.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/callbacks/RagfairCallbacks.d.ts @@ -35,7 +35,7 @@ export declare class RagfairCallbacks extends OnLoadOnUpdate { getRoute(): string; search(url: string, info: ISearchRequestData, sessionID: string): IGetBodyResponseData; getMarketPrice(url: string, info: IGetMarketPriceRequestData, sessionID: string): IGetBodyResponseData; - getItemPrices(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + getItemPrices(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData>; addOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; removeOffer(pmcData: IPmcData, info: IRemoveOfferRequestData, sessionID: string): IItemEventRouterResponse; extendOffer(pmcData: IPmcData, info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; diff --git a/TypeScript/6ReferenceAnotherClass/types/callbacks/TraderCallbacks.d.ts b/TypeScript/6ReferenceAnotherClass/types/callbacks/TraderCallbacks.d.ts index e4fd099..40a1455 100644 --- a/TypeScript/6ReferenceAnotherClass/types/callbacks/TraderCallbacks.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/callbacks/TraderCallbacks.d.ts @@ -12,6 +12,10 @@ export declare class TraderCallbacks extends OnLoadOnUpdate { onUpdate(): boolean; getRoute(): string; getTraderSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/trading/api/getUserAssortPrice/trader + * @returns + */ getProfilePurchases(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData>; getTrader(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getAssort(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; diff --git a/TypeScript/6ReferenceAnotherClass/types/callbacks/WeatherCallbacks.d.ts b/TypeScript/6ReferenceAnotherClass/types/callbacks/WeatherCallbacks.d.ts index ae784c8..f9d2002 100644 --- a/TypeScript/6ReferenceAnotherClass/types/callbacks/WeatherCallbacks.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/callbacks/WeatherCallbacks.d.ts @@ -1,10 +1,15 @@ import { WeatherController } from "../controllers/WeatherController"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; +import { IWeatherData } from "../models/eft/weather/IWeatherData"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; export declare class WeatherCallbacks { protected httpResponse: HttpResponseUtil; protected weatherController: WeatherController; constructor(httpResponse: HttpResponseUtil, weatherController: WeatherController); - getWeather(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/weather + * @returns IWeatherData + */ + getWeather(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; } diff --git a/TypeScript/6ReferenceAnotherClass/types/context/ContextVariableType.d.ts b/TypeScript/6ReferenceAnotherClass/types/context/ContextVariableType.d.ts index 5fc1704..a7dd9b5 100644 --- a/TypeScript/6ReferenceAnotherClass/types/context/ContextVariableType.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/context/ContextVariableType.d.ts @@ -1,4 +1,8 @@ export declare enum ContextVariableType { + /** Logged in users session id */ SESSION_ID = 0, - MATCH_INFO = 1 + /** Currently acive raid information */ + MATCH_INFO = 1, + /** Timestamp when client first connected */ + CLIENT_START_TIMESTAMP = 2 } diff --git a/TypeScript/6ReferenceAnotherClass/types/controllers/BotController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/BotController.d.ts index a5111d5..92317c3 100644 --- a/TypeScript/6ReferenceAnotherClass/types/controllers/BotController.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/controllers/BotController.d.ts @@ -1,6 +1,8 @@ import { ApplicationContext } from "../context/ApplicationContext"; import { BotGenerator } from "../generators/BotGenerator"; +import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { IGenerateBotsRequestData } from "../models/eft/bot/IGenerateBotsRequestData"; import { IBotBase } from "../models/eft/common/tables/IBotBase"; import { IBotCore } from "../models/eft/common/tables/IBotCore"; @@ -10,18 +12,23 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; -import { PmcAiService } from "../services/PmcAiService"; +import { LocalisationService } from "../services/LocalisationService"; +import { JsonUtil } from "../utils/JsonUtil"; export declare class BotController { protected logger: ILogger; protected databaseServer: DatabaseServer; protected botGenerator: BotGenerator; protected botHelper: BotHelper; - protected pmcAiService: PmcAiService; + protected botDifficultyHelper: BotDifficultyHelper; protected botGenerationCacheService: BotGenerationCacheService; + protected localisationService: LocalisationService; + protected weightedRandomHelper: WeightedRandomHelper; protected configServer: ConfigServer; protected applicationContext: ApplicationContext; + protected jsonUtil: JsonUtil; protected botConfig: IBotConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, pmcAiService: PmcAiService, botGenerationCacheService: BotGenerationCacheService, configServer: ConfigServer, applicationContext: ApplicationContext); + static readonly pmcTypeLabel = "PMC"; + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); /** * Return the number of bot loadout varieties to be generated * @param type bot Type we want the loadout gen count for @@ -37,7 +44,6 @@ export declare class BotController { * @returns Difficulty object */ getBotDifficulty(type: string, difficulty: string): Difficulty; - protected getPmcDifficultySettings(pmcType: "bear" | "usec", difficulty: string, usecType: string, bearType: string): Difficulty; /** * Generate bot profiles and store in cache * @param sessionId Session id @@ -51,4 +57,5 @@ export declare class BotController { * @returns cap number */ getBotCap(): number; + getPmcBotTypes(): Record>>; } diff --git a/TypeScript/6ReferenceAnotherClass/types/controllers/DialogueController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/DialogueController.d.ts index 1b72522..9c8b728 100644 --- a/TypeScript/6ReferenceAnotherClass/types/controllers/DialogueController.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/controllers/DialogueController.d.ts @@ -23,7 +23,7 @@ export declare class DialogueController { * Get the content of a dialogue * @param dialogueID Dialog id * @param sessionID Session Id - * @returns + * @returns DialogueInfo */ getDialogueInfo(dialogueID: string, sessionID: string): DialogueInfo; /** diff --git a/TypeScript/6ReferenceAnotherClass/types/controllers/GameController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/GameController.d.ts index 3bfbdb1..f4f5849 100644 --- a/TypeScript/6ReferenceAnotherClass/types/controllers/GameController.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/controllers/GameController.d.ts @@ -1,3 +1,4 @@ +import { ApplicationContext } from "../context/ApplicationContext"; import { GameEventHelper } from "../helpers/GameEventHelper"; import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; @@ -14,6 +15,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; +import { LocalisationService } from "../services/LocalisationService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { Watermark } from "../utils/Watermark"; export declare class GameController { @@ -24,14 +26,33 @@ export declare class GameController { protected localeService: LocaleService; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; + protected localisationService: LocalisationService; protected gameEventHelper: GameEventHelper; + protected applicationContext: ApplicationContext; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; protected coreConfig: ICoreConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, gameEventHelper: GameEventHelper, configServer: ConfigServer); - gameStart(_url: string, _info: IEmptyRequestData, sessionID: string): void; + constructor(logger: ILogger, databaseServer: DatabaseServer, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, gameEventHelper: GameEventHelper, applicationContext: ApplicationContext, configServer: ConfigServer); + gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; + /** + * Check if current date falls inside any of the seasons events pased in, if so, handle them + * @param seasonalEvents events to check for + */ protected checkForAndEnableSeasonalEvents(seasonalEvents: ISeasonalEvent[]): void; + /** + * Make adjusted to server code based on the name of the event passed in + * @param globalConfig globals.json + * @param eventName Name of the event to enable. e.g. Christmas + */ protected updateGlobalEvents(globalConfig: Config, eventName: string): void; + /** + * Read in data from seasonalEvents.json and add found equipment items to bots + * @param eventName Name of the event to read equipment in from config + */ + protected addEventGearToScavs(eventName: string): void; + /** + * Set Khorovod(dancing tree) chance to 100% on all maps that support it + */ protected enableDancingTree(): void; /** * Make non-trigger-spawned raiders spawn earlier + always @@ -40,5 +61,6 @@ export declare class GameController { protected logProfileDetails(fullProfile: IAkiProfile): void; getGameConfig(sessionID: string): IGameConfigResponse; getServer(): IServerDetails[]; + protected addPumpkinsToScavBackpacks(): void; getValidGameVersion(): ICheckVersionResponse; } diff --git a/TypeScript/6ReferenceAnotherClass/types/controllers/HideoutController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/HideoutController.d.ts index ada5bd9..5b6507b 100644 --- a/TypeScript/6ReferenceAnotherClass/types/controllers/HideoutController.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/controllers/HideoutController.d.ts @@ -23,12 +23,13 @@ import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; import { PlayerService } from "../services/PlayerService"; import { HashUtil } from "../utils/HashUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; -import { JsonUtil } from "../utils/JsonUtil"; export declare class HideoutController { protected logger: ILogger; protected hashUtil: HashUtil; @@ -45,11 +46,12 @@ export declare class HideoutController { protected profileHelper: ProfileHelper; protected hideoutHelper: HideoutHelper; protected scavCaseRewardGenerator: ScavCaseRewardGenerator; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected jsonUtil: JsonUtil; protected static nameBackendCountersCrafting: string; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, configServer: ConfigServer, jsonUtil: JsonUtil); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, localisationService: LocalisationService, configServer: ConfigServer, jsonUtil: JsonUtil); upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; upgradeComplete(pmcData: IPmcData, body: HideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; /** diff --git a/TypeScript/6ReferenceAnotherClass/types/controllers/InraidController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/InraidController.d.ts index e84eea1..39a6396 100644 --- a/TypeScript/6ReferenceAnotherClass/types/controllers/InraidController.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/controllers/InraidController.d.ts @@ -6,6 +6,7 @@ import { ProfileHelper } from "../helpers/ProfileHelper"; import { QuestHelper } from "../helpers/QuestHelper"; import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; +import { Item } from "../models/eft/common/tables/IItem"; import { IRegisterPlayerRequestData } from "../models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; import { IAirdropConfig } from "../models/spt/config/IAirdropConfig"; @@ -17,6 +18,9 @@ import { SaveServer } from "../servers/SaveServer"; import { InsuranceService } from "../services/InsuranceService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; +/** + * Logic for handling In Raid callbacks + */ export declare class InraidController { protected logger: ILogger; protected saveServer: SaveServer; @@ -35,14 +39,42 @@ export declare class InraidController { protected airdropConfig: IAirdropConfig; protected inraidConfig: IInRaidConfig; 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 + * Save locationid to active profiles inraid object + * @param sessionID Session id + * @param info Register player request + */ + addPlayer(sessionID: string, info: IRegisterPlayerRequestData): void; + /** + * Save profile state to disk + * Handles pmc/pscav + * @param offraidData post-raid request data + * @param sessionID Session id + */ + savePostRaidProgress(offraidData: ISaveProgressRequestData, sessionID: string): void; + /** + * Handle updating player profile post-pmc raid * @param sessionID session id - * @param offraidData post-raid data of raid + * @param offraidData post-raid data */ protected savePmcProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; + /** + * Make changes to pmc profile after they left raid dead, + * alter bodypart hp, handle insurance, delete inventory items, remove carried quest items + * @param postRaidSaveRequest post-raid save request + * @param pmcData pmc profile + * @param insuranceEnabled is insurance enabled + * @param preRaidGear gear player had before raid + * @param sessionID Session id + * @returns Updated profile object + */ + protected performPostRaidActionsWhenDead(postRaidSaveRequest: ISaveProgressRequestData, pmcData: IPmcData, insuranceEnabled: boolean, preRaidGear: Item[], sessionID: string): IPmcData; + /** + * Adjust player characters bodypart hp if they left raid early + * @param postRaidSaveRequest post raid data + * @param pmcData player profile + */ + protected updatePmcHealthPostRaid(postRaidSaveRequest: ISaveProgressRequestData, pmcData: IPmcData): void; /** * Reduce body part hp to % of max * @param pmcData profile to edit @@ -68,7 +100,31 @@ export declare class InraidController { * @param isPlayerScav Was the player a pScav */ protected markOrRemoveFoundInRaidItems(offraidData: ISaveProgressRequestData, pmcData: IPmcData, isPlayerScav: boolean): void; + /** + * Update profile after player completes scav raid + * @param scavData Scav profile + * @param sessionID Session id + * @param offraidData Post-raid save request + * @param pmcData Pmc profile + * @param isDead Is player dead + */ protected handlePostRaidPlayerScavProcess(scavData: IPmcData, sessionID: string, offraidData: ISaveProgressRequestData, pmcData: IPmcData, isDead: boolean): void; + /** + * Update profile with scav karma values based on in-raid actions + * @param pmcData Pmc profile + * @param offraidData Post-raid save request + * @param scavData Scav profile + * @param sessionID Session id + */ protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData, scavData: IPmcData, sessionID: string): void; + /** + * Get the inraid config from configs/inraid.json + * @returns InRaid Config + */ + getInraidConfig(): IInRaidConfig; + /** + * Get airdrop config from configs/airdrop.json + * @returns Airdrop config + */ getAirdropConfig(): IAirdropConfig; } diff --git a/TypeScript/6ReferenceAnotherClass/types/controllers/InsuranceController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/InsuranceController.d.ts index 14bf129..54f31b5 100644 --- a/TypeScript/6ReferenceAnotherClass/types/controllers/InsuranceController.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/controllers/InsuranceController.d.ts @@ -30,8 +30,7 @@ export declare class InsuranceController { protected insuranceService: InsuranceService; protected configServer: ConfigServer; protected insuranceConfig: IInsuranceConfig; - constructor(logger: ILogger, randomUtil: RandomUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, paymentService: PaymentService, // TODO: delay required - insuranceService: InsuranceService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, paymentService: PaymentService, insuranceService: InsuranceService, configServer: ConfigServer); processReturn(): void; insure(pmcData: IPmcData, body: IInsureRequestData, sessionID: string): IItemEventRouterResponse; /** diff --git a/TypeScript/6ReferenceAnotherClass/types/controllers/InventoryController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/InventoryController.d.ts index 6a1a21e..e1c08c0 100644 --- a/TypeScript/6ReferenceAnotherClass/types/controllers/InventoryController.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/controllers/InventoryController.d.ts @@ -1,8 +1,8 @@ -import { EventOutputHolder } from "../routers/EventOutputHolder"; import { InventoryHelper } from "../helpers/InventoryHelper"; import { PaymentHelper } from "../helpers/PaymentHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IAddItemRequestData } from "../models/eft/inventory/IAddItemRequestData"; import { IInventoryBindRequestData } from "../models/eft/inventory/IInventoryBindRequestData"; @@ -21,33 +21,46 @@ import { IInventorySwapRequestData } from "../models/eft/inventory/IInventorySwa import { IInventoryTagRequestData } from "../models/eft/inventory/IInventoryTagRequestData"; import { IInventoryToggleRequestData } from "../models/eft/inventory/IInventoryToggleRequestData"; import { IInventoryTransferRequestData } from "../models/eft/inventory/IInventoryTransferRequestData"; +import { IOpenRandomLootContainerRequestData } from "../models/eft/inventory/IOpenRandomLootContainerRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { ILogger } from "../models/spt/utils/ILogger"; +import { EventOutputHolder } from "../routers/EventOutputHolder"; import { DatabaseServer } from "../servers/DatabaseServer"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { HashUtil } from "../utils/HashUtil"; +import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { JsonUtil } from "../utils/JsonUtil"; +import { RandomUtil } from "../utils/RandomUtil"; export declare class InventoryController { protected logger: ILogger; protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; + protected randomUtil: RandomUtil; protected databaseServer: DatabaseServer; protected fenceService: FenceService; protected presetHelper: PresetHelper; protected inventoryHelper: InventoryHelper; protected ragfairOfferService: RagfairOfferService; protected profileHelper: ProfileHelper; + protected weightedRandomHelper: WeightedRandomHelper; protected paymentHelper: PaymentHelper; + protected localisationService: LocalisationService; protected eventOutputHolder: EventOutputHolder; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder); + protected httpResponseUtil: HttpResponseUtil; + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, weightedRandomHelper: WeightedRandomHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); /** * Move Item * change location of item with parentId and slotId * transfers items from one profile to another if fromOwner/toOwner is set in the body. * otherwise, move is contained within the same profile_f. - */ - moveItem(pmcData: IPmcData, body: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; + * @param pmcData Profile + * @param moveRequest Move request data + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ + moveItem(pmcData: IPmcData, moveRequest: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; /** * Remove Item from Profile * Deep tree item deletion, also removes items from insurance list @@ -122,4 +135,12 @@ export declare class InventoryController { createMapMarker(pmcData: IPmcData, body: IInventoryCreateMarkerRequestData, sessionID: string): IItemEventRouterResponse; deleteMapMarker(pmcData: IPmcData, body: IInventoryDeleteMarkerRequestData, sessionID: string): IItemEventRouterResponse; editMapMarker(pmcData: IPmcData, body: IInventoryEditMarkerRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle event fired when a container is unpacked (currently only the halloween pumpkin) + * @param pmcData Profile data + * @param body open loot container request data + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ + openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/6ReferenceAnotherClass/types/controllers/LocationController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/LocationController.d.ts index 9db3205..b6feba8 100644 --- a/TypeScript/6ReferenceAnotherClass/types/controllers/LocationController.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/controllers/LocationController.d.ts @@ -7,6 +7,7 @@ import { LootItem } from "../models/spt/services/LootItem"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -15,12 +16,13 @@ export declare class LocationController { protected hashUtil: HashUtil; protected logger: ILogger; protected locationGenerator: LocationGenerator; + protected localisationService: LocalisationService; protected lootGenerator: LootGenerator; protected databaseServer: DatabaseServer; protected timeUtil: TimeUtil; protected configServer: ConfigServer; protected airdropConfig: IAirdropConfig; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, logger: ILogger, locationGenerator: LocationGenerator, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer); + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer); get(location: string): ILocationBase; generate(name: string): ILocationBase; generateAll(): ILocationsGenerateAllResponse; diff --git a/TypeScript/6ReferenceAnotherClass/types/controllers/MatchController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/MatchController.d.ts index dac6a3f..2b0d150 100644 --- a/TypeScript/6ReferenceAnotherClass/types/controllers/MatchController.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/controllers/MatchController.d.ts @@ -19,7 +19,6 @@ import { SaveServer } from "../servers/SaveServer"; import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; import { BotLootCacheService } from "../services/BotLootCacheService"; import { MatchLocationService } from "../services/MatchLocationService"; -import { PmcAiService } from "../services/PmcAiService"; import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; export declare class MatchController { protected logger: ILogger; @@ -30,13 +29,12 @@ export declare class MatchController { protected botLootCacheService: BotLootCacheService; protected configServer: ConfigServer; protected profileSnapshotService: ProfileSnapshotService; - protected pmcAiService: PmcAiService; protected botGenerationCacheService: BotGenerationCacheService; 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, pmcAiService: PmcAiService, botGenerationCacheService: BotGenerationCacheService, applicationContext: ApplicationContext); + constructor(logger: ILogger, saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, botGenerationCacheService: BotGenerationCacheService, applicationContext: ApplicationContext); getEnabled(): boolean; getProfile(info: IGetProfileRequestData): IPmcData[]; createGroup(sessionID: string, info: ICreateGroupRequestData): any; diff --git a/TypeScript/6ReferenceAnotherClass/types/controllers/RagfairController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/RagfairController.d.ts index 5440458..95702f2 100644 --- a/TypeScript/6ReferenceAnotherClass/types/controllers/RagfairController.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/controllers/RagfairController.d.ts @@ -29,6 +29,7 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { RagfairServer } from "../servers/RagfairServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; import { PaymentService } from "../services/PaymentService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { RagfairPriceService } from "../services/RagfairPriceService"; @@ -62,9 +63,10 @@ export declare class RagfairController { protected ragfairOfferService: RagfairOfferService; protected ragfairRequiredItemsService: RagfairRequiredItemsService; protected ragfairOfferGenerator: RagfairOfferGenerator; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, eventOutputHolder: EventOutputHolder, ragfairServer: RagfairServer, ragfairPriceService: RagfairPriceService, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer, ragfairSellHelper: RagfairSellHelper, ragfairTaxHelper: RagfairTaxHelper, ragfairSortHelper: RagfairSortHelper, ragfairOfferHelper: RagfairOfferHelper, profileHelper: ProfileHelper, paymentService: PaymentService, handbookHelper: HandbookHelper, paymentHelper: PaymentHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, ragfairOfferGenerator: RagfairOfferGenerator, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, eventOutputHolder: EventOutputHolder, ragfairServer: RagfairServer, ragfairPriceService: RagfairPriceService, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer, ragfairSellHelper: RagfairSellHelper, ragfairTaxHelper: RagfairTaxHelper, ragfairSortHelper: RagfairSortHelper, ragfairOfferHelper: RagfairOfferHelper, profileHelper: ProfileHelper, paymentService: PaymentService, handbookHelper: HandbookHelper, paymentHelper: PaymentHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, ragfairOfferGenerator: RagfairOfferGenerator, localisationService: LocalisationService, configServer: ConfigServer); getOffers(sessionID: string, info: ISearchRequestData): IGetOffersResult; /** * Get offers for the client based on type of search being performed @@ -103,7 +105,12 @@ export declare class RagfairController { protected isLinkedSearch(info: ISearchRequestData): boolean; protected isRequiredSearch(info: ISearchRequestData): boolean; update(): void; - getItemPrice(info: IGetMarketPriceRequestData): IGetItemPriceResult; + /** + * Called when creating an offer on flea, fills values in top right corner + * @param getPriceRequest + * @returns min/avg/max values for an item based on flea offers available + */ + getItemMinAvgMaxFleaPriceValues(getPriceRequest: IGetMarketPriceRequestData): IGetItemPriceResult; addPlayerOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; createPlayerOffer(profile: IAkiProfile, requirements: Requirement[], items: Item[], sellInOnePiece: boolean, amountToSend: number): IRagfairOffer; getAllFleaPrices(): Record; diff --git a/TypeScript/6ReferenceAnotherClass/types/controllers/RepeatableQuestController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/RepeatableQuestController.d.ts index 7db5886..333583b 100644 --- a/TypeScript/6ReferenceAnotherClass/types/controllers/RepeatableQuestController.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/controllers/RepeatableQuestController.d.ts @@ -17,6 +17,7 @@ import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { ItemFilterService } from "../services/ItemFilterService"; +import { LocalisationService } from "../services/LocalisationService"; import { PaymentService } from "../services/PaymentService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { JsonUtil } from "../utils/JsonUtil"; @@ -64,12 +65,13 @@ export declare class RepeatableQuestController { protected profileFixerService: ProfileFixerService; protected ragfairServerHelper: RagfairServerHelper; protected eventOutputHolder: EventOutputHolder; + protected localisationService: LocalisationService; protected paymentService: PaymentService; protected objectId: ObjectId; protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * This is the method reached by the /client/repeatalbeQuests/activityPeriods endpoint * Returns an array of objects in the format of repeatable quests to the client. diff --git a/TypeScript/6ReferenceAnotherClass/types/controllers/WeatherController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/WeatherController.d.ts index ca7f5eb..631a90c 100644 --- a/TypeScript/6ReferenceAnotherClass/types/controllers/WeatherController.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/controllers/WeatherController.d.ts @@ -1,11 +1,18 @@ import { WeatherGenerator } from "../generators/WeatherGenerator"; import { IWeatherData } from "../models/eft/weather/IWeatherData"; import { IWeatherConfig } from "../models/spt/config/IWeatherConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; export declare class WeatherController { protected weatherGenerator: WeatherGenerator; + protected logger: ILogger; protected configServer: ConfigServer; protected weatherConfig: IWeatherConfig; - constructor(weatherGenerator: WeatherGenerator, configServer: ConfigServer); + constructor(weatherGenerator: WeatherGenerator, logger: ILogger, configServer: ConfigServer); generate(): IWeatherData; + /** + * Get the current in-raid time (MUST HAVE PLAYER LOGGED INTO CLIENT TO WORK) + * @returns Date object + */ + getCurrentInRaidTime(): Date; } diff --git a/TypeScript/6ReferenceAnotherClass/types/generators/BotGenerator.d.ts b/TypeScript/6ReferenceAnotherClass/types/generators/BotGenerator.d.ts index 2ac51db..a1ac9ed 100644 --- a/TypeScript/6ReferenceAnotherClass/types/generators/BotGenerator.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/generators/BotGenerator.d.ts @@ -1,7 +1,8 @@ +import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; import { GameEventHelper } from "../helpers/GameEventHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; -import { IGenerateBotsRequestData } from "../models/eft/bot/IGenerateBotsRequestData"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { Health as PmcHealth, IBotBase, Skills } from "../models/eft/common/tables/IBotBase"; import { Health, IBotType, Inventory } from "../models/eft/common/tables/IBotType"; import { IBotConfig } from "../models/spt/config/IBotConfig"; @@ -9,7 +10,6 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; -import { PmcAiService } from "../services/PmcAiService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; @@ -29,12 +29,13 @@ export declare class BotGenerator { protected databaseServer: DatabaseServer; protected botInventoryGenerator: BotInventoryGenerator; protected botEquipmentFilterService: BotEquipmentFilterService; + protected weightedRandomHelper: WeightedRandomHelper; protected botHelper: BotHelper; + protected botDifficultyHelper: BotDifficultyHelper; protected gameEventHelper: GameEventHelper; - protected pmcAiService: PmcAiService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botEquipmentFilterService: BotEquipmentFilterService, botHelper: BotHelper, gameEventHelper: GameEventHelper, pmcAiService: PmcAiService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botEquipmentFilterService: BotEquipmentFilterService, weightedRandomHelper: WeightedRandomHelper, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, gameEventHelper: GameEventHelper, configServer: ConfigServer); /** * Generate a player scav bot object * @param role e.g. assault / pmcbot @@ -44,12 +45,18 @@ export declare class BotGenerator { */ generatePlayerScav(sessionId: string, role: string, difficulty: string, botTemplate: IBotType): IBotBase; /** - * Generate an array of bot objects for populate a raid with + * Generate an array of bot objects based on a condition for a raid with * @param sessionId session id - * @param info request object + * @param condition request condition * @returns bot array */ - generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; + generateByCondition(sessionId: string, botCountToGenerate: number, difficulty: string, role: string, isPmc: boolean): IBotBase[]; + /** + * Get the PMCs wildSpawnType value + * @param role "usec" / "bear" + * @returns wildSpawnType value as string + */ + protected getPmcRoleByDescription(role: string): string; /** * Get a randomised PMC side based on bot config value 'isUsec' * @returns pmc side as string @@ -64,13 +71,13 @@ export declare class BotGenerator { * Create a IBotBase object with equipment/loot/exp etc * @param sessionId Session id * @param bot bots base file - * @param role botRole bot will use + * @param botRole Role bot will use (bear/usec for PMCs) * @param node Bot template from db/bots/x.json * @param isPmc Is bot to be a PMC * @param isPlayerScav is bot to be a p scav bot * @returns IBotBase object */ - protected generateBot(sessionId: string, bot: IBotBase, role: string, node: IBotType, isPmc: boolean, isPlayerScav?: boolean): IBotBase; + protected generateBot(sessionId: string, bot: IBotBase, botRole: string, node: IBotType, isPmc: boolean, isPlayerScav?: boolean): IBotBase; /** * Log the number of PMCs generated to the debug console * @param output Generated bot array, ready to send to client diff --git a/TypeScript/6ReferenceAnotherClass/types/generators/BotInventoryGenerator.d.ts b/TypeScript/6ReferenceAnotherClass/types/generators/BotInventoryGenerator.d.ts index c5ed545..e1efaf2 100644 --- a/TypeScript/6ReferenceAnotherClass/types/generators/BotInventoryGenerator.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/generators/BotInventoryGenerator.d.ts @@ -7,6 +7,7 @@ import { IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { BotLootGenerator } from "./BotLootGenerator"; @@ -20,14 +21,68 @@ export declare class BotInventoryGenerator { protected botLootGenerator: BotLootGenerator; protected botGeneratorHelper: BotGeneratorHelper; protected weightedRandomHelper: WeightedRandomHelper; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, configServer: ConfigServer); + /** + * Add equipment/weapons/loot to bot + * @param sessionId Session id + * @param templateInventory bot/x.json data from db + * @param equipmentChances Chances each item will be added to bot + * @param itemGenerationLimitsMinMax item gen limits for bot role + * @param botRole Role bot has (assault/pmcBot) + * @param isPmc Is bot being converted into a pmc + * @returns PmcInventory object with equipment/weapons/loot + */ generateInventory(sessionId: string, templateInventory: Inventory, equipmentChances: Chances, itemGenerationLimitsMinMax: Generation, botRole: string, isPmc: boolean): PmcInventory; + /** + * Create a pmcInventory object with all the base/generic items needed + * @returns PmcInventory object + */ + protected generateInventoryBase(): PmcInventory; + /** + * Add equipment to a bot + * @param templateInventory bot/x.json data from db + * @param equipmentChances Chances items will be added to bot + * @param botRole Role bot has (assault/pmcBot) + * @param botInventory Inventory to add equipment to + */ + protected generateAndAddEquipmentToBot(templateInventory: Inventory, equipmentChances: Chances, botRole: string, botInventory: PmcInventory): void; + protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory): void; + /** + * Work out what weapons bot should have equipped and add them to bot inventory + * @param templateInventory bot/x.json data from db + * @param equipmentChances Chances bot can have equipment equipped + * @param sessionId Session id + * @param botInventory Inventory to add weapons to + * @param botRole assault/pmcBot/bossTagilla etc + * @param isPmc Is the bot being generated as a pmc + * @param itemGenerationLimitsMinMax Limits for items the bot can have + */ + protected generateAndAddWeaponsToBot(templateInventory: Inventory, equipmentChances: Chances, sessionId: string, botInventory: PmcInventory, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation): void; + /** + * Calculate if the bot should have weapons in Primary/Secondary/Holster slots + * @param equipmentChances Chances bot has certain equipment + * @returns What slots bot should have weapons generated for + */ + protected getDesiredWeaponsForBot(equipmentChances: Chances): { + slot: EquipmentSlots; + shouldSpawn: boolean; + }[]; + /** + * Add weapon + spare mags/ammo to bots inventory + * @param sessionId Session id + * @param weaponSlot Weapon slot being generated + * @param templateInventory bot/x.json data from db + * @param botInventory Inventory to add weapon+mags/ammo to + * @param equipmentChances Chances bot can have equipment equipped + * @param botRole assault/pmcBot/bossTagilla etc + * @param isPmc Is the bot being generated as a pmc + * @param itemGenerationLimitsMinMax + */ protected addWeaponAndMagazinesToInventory(sessionId: string, weaponSlot: { slot: EquipmentSlots; shouldSpawn: boolean; }, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation): void; - protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory): void; - protected generateInventoryBase(): PmcInventory; } diff --git a/TypeScript/6ReferenceAnotherClass/types/generators/BotLootGenerator.d.ts b/TypeScript/6ReferenceAnotherClass/types/generators/BotLootGenerator.d.ts index c1f5310..3352a46 100644 --- a/TypeScript/6ReferenceAnotherClass/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/generators/BotLootGenerator.d.ts @@ -10,6 +10,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotLootCacheService } from "../services/BotLootCacheService"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { BotWeaponGenerator } from "./BotWeaponGenerator"; @@ -23,9 +24,10 @@ export declare class BotLootGenerator { protected botWeaponGenerator: BotWeaponGenerator; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected botLootCacheService: BotLootCacheService; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, configServer: ConfigServer); generateLoot(sessionId: string, templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances): void; protected getRandomisedCount(min: number, max: number, nValue: number): number; /** @@ -113,7 +115,7 @@ export declare class BotLootGenerator { * If no limit found for a non pmc bot, fall back to defaults * @param isPmc is the bot we want limits for a pmc * @param botRole what role does the bot have - * @returns dictionary of tplIds and limit + * @returns Dictionary of tplIds and limit */ protected getItemSpawnLimitsForBotType(isPmc: boolean, botRole: string): Record; /** diff --git a/TypeScript/6ReferenceAnotherClass/types/generators/BotWeaponGenerator.d.ts b/TypeScript/6ReferenceAnotherClass/types/generators/BotWeaponGenerator.d.ts index 487901b..40284ea 100644 --- a/TypeScript/6ReferenceAnotherClass/types/generators/BotWeaponGenerator.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/generators/BotWeaponGenerator.d.ts @@ -12,6 +12,7 @@ import { IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; @@ -27,10 +28,11 @@ export declare class BotWeaponGenerator { protected randomUtil: RandomUtil; protected configServer: ConfigServer; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected localisationService: LocalisationService; protected inventoryMagGenComponents: IInventoryMagGen[]; protected readonly modMagazineSlotId = "mod_magazine"; protected botConfig: IBotConfig; - constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil, configServer: ConfigServer, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, inventoryMagGenComponents: IInventoryMagGen[]); + constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil, configServer: ConfigServer, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, inventoryMagGenComponents: IInventoryMagGen[]); /** * Pick a random weapon based on weightings and generate a functional weapon * @param equipmentSlot Primary/secondary/holster diff --git a/TypeScript/6ReferenceAnotherClass/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/6ReferenceAnotherClass/types/generators/RagfairOfferGenerator.d.ts index b64a7e7..23882d2 100644 --- a/TypeScript/6ReferenceAnotherClass/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/generators/RagfairOfferGenerator.d.ts @@ -1,16 +1,19 @@ +import { HandbookHelper } from "../helpers/HandbookHelper"; import { ItemHelper } from "../helpers/ItemHelper"; +import { PaymentHelper } from "../helpers/PaymentHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; import { Item } from "../models/eft/common/tables/IItem"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { IBarterScheme } from "../models/eft/common/tables/ITrader"; -import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; +import { IRagfairOffer, OfferRequirement } from "../models/eft/ragfair/IRagfairOffer"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { RagfairCategoriesService } from "../services/RagfairCategoriesService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { RagfairPriceService } from "../services/RagfairPriceService"; @@ -27,18 +30,31 @@ export declare class RagfairOfferGenerator { protected timeUtil: TimeUtil; protected databaseServer: DatabaseServer; protected ragfairServerHelper: RagfairServerHelper; + protected handbookHelper: HandbookHelper; protected saveServer: SaveServer; protected presetHelper: PresetHelper; protected ragfairAssortGenerator: RagfairAssortGenerator; protected ragfairOfferService: RagfairOfferService; protected ragfairPriceService: RagfairPriceService; + protected localisationService: LocalisationService; + protected paymentHelper: PaymentHelper; protected ragfairCategoriesService: RagfairCategoriesService; protected fenceService: FenceService; protected itemHelper: ItemHelper; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, ragfairServerHelper: RagfairServerHelper, saveServer: SaveServer, presetHelper: PresetHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferService: RagfairOfferService, ragfairPriceService: RagfairPriceService, ragfairCategoriesService: RagfairCategoriesService, fenceService: FenceService, itemHelper: ItemHelper, configServer: ConfigServer); + protected allowedFleaPriceItemsForBarter: { + tpl: string; + price: number; + }[]; + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, ragfairServerHelper: RagfairServerHelper, handbookHelper: HandbookHelper, saveServer: SaveServer, presetHelper: PresetHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferService: RagfairOfferService, ragfairPriceService: RagfairPriceService, localisationService: LocalisationService, paymentHelper: PaymentHelper, ragfairCategoriesService: RagfairCategoriesService, fenceService: FenceService, itemHelper: ItemHelper, configServer: ConfigServer); createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; + /** + * Calculate the offer price that's listed on the flea listing + * @param offerRequirements barter requirements for offer + * @returns rouble cost of offer + */ + protected calculateOfferListingPrice(offerRequirements: OfferRequirement[]): number; /** * Get avatar url from trader table in db * @param isTrader Is user we're getting avatar for a trader @@ -87,20 +103,36 @@ export declare class RagfairOfferGenerator { * @returns Item with conditions added */ protected addMissingCondition(item: Item): Item; - protected getOfferRequirements(items: Item[]): { - count: number; - _tpl: string; + /** + * Create a barter-based barter scheme, if not possible, fall back to making barter scheme currency based + * @param offerItems Items for sale in offer + * @returns barter scheme + */ + protected createBarterRequirement(offerItems: Item[]): IBarterScheme[]; + /** + * Get an array of flea prices + item tpl, cached in generator class + * @returns array with tpl/price values + */ + protected getFleaPricesAsArray(): { + tpl: string; + price: number; }[]; + /** + * Create a random currency-based barter scheme for an array of items + * @param offerItems Items on offer + * @returns Barter scheme for offer + */ + protected createCurrencyRequirement(offerItems: Item[]): IBarterScheme[]; /** * Create a flea offer and store it in the Ragfair server offers array * @param userID owner of the offer * @param time time offer is put up * @param items items in the offer - * @param barterScheme - * @param loyalLevel + * @param barterScheme cost of item (currency or barter) + * @param loyalLevel Loyalty level needed to buy item * @param price price of offer * @param sellInOnePiece - * @returns + * @returns Ragfair offer */ createFleaOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; } diff --git a/TypeScript/6ReferenceAnotherClass/types/generators/WeatherGenerator.d.ts b/TypeScript/6ReferenceAnotherClass/types/generators/WeatherGenerator.d.ts index 8ddbe49..65d2c76 100644 --- a/TypeScript/6ReferenceAnotherClass/types/generators/WeatherGenerator.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/generators/WeatherGenerator.d.ts @@ -1,38 +1,54 @@ +import { ApplicationContext } from "../context/ApplicationContext"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; -import { IWeatherData } from "../models/eft/weather/IWeatherData"; +import { IWeather, IWeatherData } from "../models/eft/weather/IWeatherData"; +import { WindDirection } from "../models/enums/WindDirection"; import { IWeatherConfig } from "../models/spt/config/IWeatherConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class WeatherGenerator { protected weightedRandomHelper: WeightedRandomHelper; + protected logger: ILogger; protected randomUtil: RandomUtil; protected timeUtil: TimeUtil; + protected applicationContext: ApplicationContext; protected configServer: ConfigServer; protected weatherConfig: IWeatherConfig; - constructor(weightedRandomHelper: WeightedRandomHelper, randomUtil: RandomUtil, timeUtil: TimeUtil, configServer: ConfigServer); - calculateTime(data: IWeatherData): IWeatherData; + constructor(weightedRandomHelper: WeightedRandomHelper, logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, applicationContext: ApplicationContext, configServer: ConfigServer); + calculateGameTime(data: IWeatherData): IWeatherData; /** * Get server uptime seconds multiplied by a multiplier and add to current time as seconds * Format to BSGs requirements - * @param computedDate current date + * @param currentDate current date * @returns formatted time */ - protected getAcceleratedTime(computedDate: Date): string; + protected getBsgFormattedInRaidTime(currentDate: Date): string; + /** + * Get the current in-raid time + * @param currentDate (new Date()) + * @returns Date object of current in-raid time + */ + getInRaidTime(currentDate: Date): Date; /** * Get current time formatted to fit BSGs requirement - * @param computedDate date to format into bsg style + * @param date date to format into bsg style * @returns */ - protected getNormalTime(computedDate: Date): string; + protected getBSGFormattedTime(date: Date): string; /** - * Return randomised Weather data - * @param weatherData weather input data + * Return randomised Weather data with help of config/weather.json * @returns Randomised weather data */ - generateWeather(weatherData: IWeatherData): IWeatherData; - protected getWeightedFog(): string; + generateWeather(): IWeather; + /** + * Set IWeather date/time/timestamp values to now + * @param weather Object to update + */ + protected setCurrentDateTime(weather: IWeather): void; + protected getWeightedWindDirection(): WindDirection; + protected getWeightedWindSpeed(): number; + protected getWeightedFog(): number; protected getWeightedRain(): number; protected getRandomFloat(node: string): number; - protected getRandomInt(node: string): number; } diff --git a/TypeScript/6ReferenceAnotherClass/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts b/TypeScript/6ReferenceAnotherClass/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts index 4fcb1e2..1589707 100644 --- a/TypeScript/6ReferenceAnotherClass/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts @@ -1,13 +1,15 @@ import { BotWeaponGeneratorHelper } from "../../../helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "../../../helpers/ItemHelper"; import { ILogger } from "../../../models/spt/utils/ILogger"; +import { LocalisationService } from "../../../services/LocalisationService"; import { IInventoryMagGen } from "../IInventoryMagGen"; import { InventoryMagGen } from "../InventoryMagGen"; export declare class ExternalInventoryMagGen implements IInventoryMagGen { protected logger: ILogger; protected itemHelper: ItemHelper; + protected localisationService: LocalisationService; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; - constructor(logger: ILogger, itemHelper: ItemHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper); + constructor(logger: ILogger, itemHelper: ItemHelper, localisationService: LocalisationService, botWeaponGeneratorHelper: BotWeaponGeneratorHelper); getPriority(): number; canHandleInventoryMagGen(inventoryMagGen: InventoryMagGen): boolean; process(inventoryMagGen: InventoryMagGen): void; diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/BotDifficultyHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/BotDifficultyHelper.d.ts new file mode 100644 index 0000000..a58ebdb --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/BotDifficultyHelper.d.ts @@ -0,0 +1,46 @@ +import { Difficulty } from "../models/eft/common/tables/IBotType"; +import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; +import { JsonUtil } from "../utils/JsonUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +import { BotHelper } from "./BotHelper"; +export declare class BotDifficultyHelper { + protected logger: ILogger; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected randomUtil: RandomUtil; + protected localisationService: LocalisationService; + protected botHelper: BotHelper; + protected configServer: ConfigServer; + protected botConfig: IBotConfig; + constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, localisationService: LocalisationService, botHelper: BotHelper, configServer: ConfigServer); + getPmcDifficultySettings(pmcType: "bear" | "usec", difficulty: string, usecType: string, bearType: string): Difficulty; + /** + * Get difficulty settings for desired bot type, if not found use assault bot types + * @param type bot type to retreive difficulty of + * @param difficulty difficulty to get settings for (easy/normal etc) + * @returns Difficulty object + */ + getBotDifficultySettings(type: string, difficulty: string): Difficulty; + /** + * Get difficulty settings for a PMC + * @param type "usec" / "bear" + * @param difficulty what difficulty to retrieve + * @returns Difficulty object + */ + protected getDifficultySettings(type: string, difficulty: string): Difficulty; + /** + * Translate chosen value from pre-raid difficulty dropdown into bot difficulty value + * @param dropDownDifficulty Dropdown difficulty value to convert + * @returns bot difficulty + */ + convertBotDifficultyDropdownToBotDifficulty(dropDownDifficulty: string): string; + /** + * Choose a random difficulty from - easy/normal/hard/impossible + * @returns random difficulty + */ + chooseRandomDifficulty(): string; +} diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/BotGeneratorHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/BotGeneratorHelper.d.ts index 5e3e501..899669e 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/BotGeneratorHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/BotGeneratorHelper.d.ts @@ -8,6 +8,7 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; import { ItemFilterService } from "../services/ItemFilterService"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; @@ -43,9 +44,10 @@ export declare class BotGeneratorHelper { protected itemFilterService: ItemFilterService; protected profileHelper: ProfileHelper; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Check mods are compatible and add to array * @param equipment Equipment item to add mods to @@ -53,9 +55,11 @@ export declare class BotGeneratorHelper { * @param parentId parentid of item to add mod to * @param parentTemplate template objet of item to add mods to * @param modSpawnChances dictionary of mod items and their chance to spawn for this bot type + * @param botRole the bot role being generated for + * @param forceSpawn should this mod be forced to spawn * @returns Item + compatible mods as an array */ - generateModsForEquipment(equipment: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances): Item[]; + generateModsForEquipment(equipment: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances, botRole: string, forceSpawn?: boolean): Item[]; /** * @param sessionId session id * @param weapon Weapon to add mods to @@ -70,15 +74,15 @@ export declare class BotGeneratorHelper { generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponParentId: string, parentWeaponTemplate: ITemplateItem, modSpawnChances: ModsChances, ammoTpl: string, botRole: string): Item[]; /** * - * @param modSlot - * @param isRandomisableSlot - * @param modsParent - * @param botEquipBlacklist - * @param itemModPool + * @param modSlot Slot mod will fit into + * @param isRandomisableSlot Will generate a randomised mod pool if true + * @param modsParent Parent slot the item will be a part of + * @param botEquipBlacklist Blacklist to prevent mods from being picked + * @param itemModPool Pool of items to pick from * @param weapon array with only weapon tpl in it, ready for mods to be added * @param ammoTpl ammo tpl to use if slot requires a cartridge to be added (e.g. mod_magazine) - * @param parentTemplate - * @returns + * @param parentTemplate Parent item the mod will go into + * @returns ITemplateItem */ protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, modsParent: Slot, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem): [boolean, ITemplateItem]; /** @@ -114,8 +118,10 @@ export declare class BotGeneratorHelper { * Find all compatible mods for equipment item and add to modPool * @param itemDetails item to find mods for * @param modPool ModPool to add mods to + * @param equipmentBlacklist equipment not allowed to be used by the bot + * @param botEquipmentRole bot type to generate pool for (e.g. assault, pmcBot, pmc for usec/bear) */ - generateDynamicModPool(itemDetails: ITemplateItem, modPool: Mods): void; + generateDynamicModPool(itemDetails: ITemplateItem, modPool: Mods, equipmentBlacklist: EquipmentFilterDetails[], botEquipmentRole: string): void; /** * Take a list of tpls and filter out blacklisted values using itemFilterService + botEquipmentBlacklist * @param allowedMods base mods to filter @@ -153,7 +159,7 @@ export declare class BotGeneratorHelper { * @param modTemplate Used to add additional properites in the upd object * @returns Item object */ - protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem): Item; + protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem, botRole: string): Item; /** * randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot * never return true for an item that has 0% spawn chance @@ -170,10 +176,10 @@ export declare class BotGeneratorHelper { */ protected getAmmoContainers(): string[]; /** - * Get the slot details for an item (chamber/cartridge/slot) + * Get a Slot property for an item (chamber/cartridge/slot) * @param modSlot e.g patron_in_weapon * @param parentTemplate item template - * @returns + * @returns Slot item */ protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; /** @@ -185,7 +191,6 @@ export declare class BotGeneratorHelper { * @param modPool modPool which should include available cartrigdes * @param parentId The CylinderMagazine's UID * @param parentTemplate The CylinderMagazine's template - * @returns */ protected fillCamora(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem): void; /** @@ -197,11 +202,11 @@ export declare class BotGeneratorHelper { /** * Adds properties to an item * e.g. Repairable / HasHinge / Foldable / MaxDurability - * @param itemTemplate - * @param botRole Used by weapons to randomise the durability values + * @param itemTemplate Item extra properties are being generated for + * @param botRole Used by weapons to randomise the durability values. Null for non-equipped items * @returns Item Upd object with extra properties */ - generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: any): { + generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: string): { upd?: Upd; }; /** @@ -220,21 +225,27 @@ export declare class BotGeneratorHelper { protected generateArmorRepairableProperties(itemTemplate: ITemplateItem, botRole: string): Repairable; /** * Get a random mod from an items compatible mods Filter array - * @param modTpl - * @param parentSlot - * @param modSlot - * @param items + * @param modTpl ???? + * @param parentSlot item mod will go into, used to get combatible items + * @param modSlot Slot to get mod to fill + * @param items items to ensure picked mod is compatible with * @returns item tpl */ protected getModTplFromItemDb(modTpl: string, parentSlot: Slot, modSlot: string, items: Item[]): string; /** * Can an item be added to an item without issue - * @param items - * @param tplToCheck - * @param equipmentSlot - * @returns true if possible + * @param items items to check compatiblilities with + * @param tplToCheck tpl of the item to check for incompatibilities + * @param equipmentSlot Slot the item will be placed into + * @returns false if no incompatibilties */ isItemIncompatibleWithCurrentItems(items: Item[], tplToCheck: string, equipmentSlot: string): boolean; + /** + * Convert a bots role to the equipment role used in config/bot.json + * @param botRole Role to convert + * @returns Equipment role (e.g. pmc / assault / bossTagilla) + */ + getBotEquipmentRole(botRole: string): string; } /** TODO - move into own class */ export declare class ExhaustableArray { diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/BotHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/BotHelper.d.ts index 67a6384..a7f779e 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/BotHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/BotHelper.d.ts @@ -3,6 +3,7 @@ import { IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; export declare class BotHelper { @@ -10,46 +11,27 @@ export declare class BotHelper { protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, configServer: ConfigServer); - /** - * Get difficulty settings for desired bot type, if not found use assault bot types - * @param type bot type to retreive difficulty of - * @param difficulty difficulty to get settings for (easy/normal etc) - * @returns Difficulty object - */ - getBotDifficultySettings(type: string, difficulty: string): Difficulty; + constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, localisationService: LocalisationService, configServer: ConfigServer); /** * Get a template object for the specified botRole from bots.types db * @param role botRole to get template for * @returns IBotType object */ getBotTemplate(role: string): IBotType; - /** - * Get difficulty settings for a PMC - * @param type "usec" / "bear" - * @param difficulty what difficulty to retrieve - * @returns Difficulty object - */ - getPmcDifficultySettings(type: string, difficulty: string): Difficulty; - /** - * Translate chosen value from pre-raid difficulty dropdown into bot difficulty value - * @param dropDownDifficulty Dropdown difficulty value to convert - * @returns bot difficulty - */ - convertBotDifficultyDropdownToBotDifficulty(dropDownDifficulty: string): string; - /** - * Choose a random difficulty from - easy/normal/hard/impossible - * @returns random difficulty - */ - chooseRandomDifficulty(): string; /** * Randomise the chance the PMC will attack their own side * Look up value in bot.json/chanceSameSideIsHostilePercent * @param difficultySettings pmc difficulty settings */ randomisePmcHostility(difficultySettings: Difficulty): void; + /** + * Is the passed in bot role a PMC (usec/bear/pmc) + * @param botRole bot role to check + * @returns true if is pmc + */ isBotPmc(botRole: string): boolean; isBotBoss(botRole: string): boolean; isBotFollower(botRole: string): boolean; diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/GameEventHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/GameEventHelper.d.ts index fca87be..fa25eff 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/GameEventHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/GameEventHelper.d.ts @@ -15,4 +15,15 @@ export declare class GameEventHelper { * @returns Record with event name + start/end date */ getEventDetails(): ISeasonalEvent[]; + /** + * Is detection of seasonal events enabled (halloween / christmas) + * @returns true if seasonal events should be checked for + */ + isAutomaticEventDetectionEnabled(): boolean; + /** + * Get a dictionary of gear changes to apply to bots for a specific event e.g. Christmas/Halloween + * @param eventName Name of event to get gear changes for + * @returns bots with equipment changes + */ + getEventBotGear(eventName: string): Record>>; } diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/HideoutHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/HideoutHelper.d.ts index 5f7e3b7..9d51fed 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/HideoutHelper.d.ts @@ -11,6 +11,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { PlayerService } from "../services/PlayerService"; import { HashUtil } from "../utils/HashUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; @@ -29,13 +30,14 @@ export declare class HideoutHelper { protected profileHelper: ProfileHelper; protected inventoryHelper: InventoryHelper; protected playerService: PlayerService; + protected localisationService: LocalisationService; protected configServer: ConfigServer; static bitcoinFarm: string; static waterCollector: string; static bitcoin: string; static expeditionaryFuelTank: string; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, localisationService: LocalisationService, configServer: ConfigServer); registerProduction(pmcData: IPmcData, body: IHideoutSingleProductionStartRequestData | IHideoutContinousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; /** * This convinience function intialies new Production Object diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/InventoryHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/InventoryHelper.d.ts index b8e5c9d..6419f93 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/InventoryHelper.d.ts @@ -5,11 +5,12 @@ import { IInventoryMergeRequestData } from "../models/eft/inventory/IInventoryMe import { IInventoryMoveRequestData } from "../models/eft/inventory/IInventoryMoveRequestData"; import { IInventorySplitRequestData } from "../models/eft/inventory/IInventorySplitRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { IInventoryConfig } from "../models/spt/config/IInventoryConfig"; +import { IInventoryConfig, RewardDetails } from "../models/spt/config/IInventoryConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { JsonUtil } from "../utils/JsonUtil"; @@ -38,9 +39,10 @@ export declare class InventoryHelper { protected itemHelper: ItemHelper; protected containerHelper: ContainerHelper; protected profileHelper: ProfileHelper; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected inventoryConfig: IInventoryConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); addItem(pmcData: IPmcData, body: IAddItemRequestData, output: IItemEventRouterResponse, sessionID: string, callback: any, foundInRaid?: boolean, addUpd?: any): IItemEventRouterResponse; removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; removeItemByCount(pmcData: IPmcData, itemId: string, count: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; @@ -76,6 +78,12 @@ export declare class InventoryHelper { * Internal helper function to handle cartridges in inventory if any of them exist. */ protected handleCartridges(items: Item[], body: IInventoryMoveRequestData): void; + /** + * Get details for how a random loot container should be handled, max rewards, possible reward tpls + * @param itemTpl Container being opened + * @returns Reward details + */ + getRandomLootContainerRewardDetails(itemTpl: string): RewardDetails; } declare namespace InventoryHelper { interface InventoryItemHash { diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/ItemHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/ItemHelper.d.ts index 0effaf2..fc88a46 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/ItemHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/ItemHelper.d.ts @@ -5,6 +5,7 @@ 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 { LocaleService } from "../services/LocaleService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; @@ -18,7 +19,8 @@ declare class ItemHelper { protected objectId: ObjectId; protected mathUtil: MathUtil; protected databaseServer: DatabaseServer; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer); + protected localeService: LocaleService; + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, localeService: LocaleService); /** * Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash * @param {string} tpl the template id / tpl @@ -212,6 +214,12 @@ declare class ItemHelper { * @returns size of stack */ getItemStackSize(item: Item): number; + /** + * Get the name of an item from the locale file using the item tpl + * @param itemTpl Tpl of item to get name of + * @returns Name of item + */ + getItemName(itemTpl: string): string; } declare namespace ItemHelper { interface ItemSize { diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/QuestHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/QuestHelper.d.ts index a6b4892..edbd2e1 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/QuestHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/QuestHelper.d.ts @@ -50,6 +50,12 @@ export declare class QuestHelper { * @returns true if player level is greater than or equal to quest */ doesPlayerLevelFulfilCondition(playerLevel: number, condition: AvailableForConditions): boolean; + /** + * Get the quests found in both arrays (inner join) + * @param before Array of qeusts #1 + * @param after Array of quests #2 + * @returns Reduction of cartesian product between two quest arrays + */ getDeltaQuests(before: IQuest[], after: IQuest[]): IQuest[]; /** * Increase skill points of a skill on player profile @@ -66,38 +72,85 @@ export declare class QuestHelper { * quest list in question. */ dumpQuests(quests: any): void; - loyaltyRequirementCheck(loyaltyRequirementProperties: AvailableForProps, profile: IPmcData): boolean; - protected processReward(reward: Reward): any[]; + /** + * Check if trader has sufficient loyalty to fullfill quest requirement + * @param questProperties Quest props + * @param profile Player profile + * @returns true if loyalty is high enough to fulfil quest requirement + */ + traderStandingRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; + protected processReward(reward: Reward): Reward[]; + /** + * Gets a flat list of reward items for the given quest at a specific state (e.g. Fail/Success) + * @param quest quest to get rewards for + * @param state Quest status that holds the items (Started, Success, Fail) + * @returns array of items with the correct maxStack + */ getQuestRewardItems(quest: IQuest, state: QuestStatus): Reward[]; /** - * Add quest with new state value to pmc profile + * Update player profile with quest status (e.g. Fail/Success) * @param pmcData profile to add quest to * @param newState state the new quest should be in when added * @param acceptedQuest Details of quest being added */ addQuestToPMCData(pmcData: IPmcData, newState: QuestStatus, acceptedQuest: IAcceptQuestRequestData): void; - acceptedUnlocked(acceptedQuestId: string, sessionID: string): IQuest[]; - failedUnlocked(failedQuestId: string, sessionID: string): IQuest[]; - applyMoneyBoost(quest: IQuest, moneyBoost: number): IQuest; - changeItemStack(pmcData: IPmcData, id: string, value: number, sessionID: string, output: any): void; /** - * Get List of All Quests as an array + * TODO: what is going on here + * @param acceptedQuestId Quest to add to profile + * @param sessionID Session id + * @returns Array of quests in profile + quest passed in as param + */ + acceptedUnlocked(acceptedQuestId: string, sessionID: string): IQuest[]; + /** + * TODO: what is going on here + * @param failedQuestId + * @param sessionID Session id + * @returns + */ + failedUnlocked(failedQuestId: string, sessionID: string): IQuest[]; + /** + * Adjust quest money rewards by passed in multipler + * @param quest Quest to multiple money rewards + * @param multipler Value to adjust money rewards by + * @returns Updated quest + */ + applyMoneyBoost(quest: IQuest, multipler: number): IQuest; + /** + * Sets the item stack to new value, or delete the item if value <= 0 + * // TODO maybe merge this function and the one from customization + * @param pmcData Profile + * @param itemId id of item to adjust stack size of + * @param newStackSize Stack size to adjust to + * @param sessionID Session id + * @param output ItemEvent router response + */ + changeItemStack(pmcData: IPmcData, itemId: string, newStackSize: number, sessionID: string, output: IItemEventRouterResponse): void; + /** + * Get List of All Quests from db + * NOT CLONED * @returns Array of IQuest objects */ - questValues(): IQuest[]; + getQuestsFromDb(): IQuest[]; /** - * Reest AvailableForStart conditions for quests - * @param quests queststo clean + * Get quests, strip all requirement conditions except level + * @param quests quests to process * @returns quest array without conditions */ - protected cleanQuestList(quests: IQuest[]): IQuest[]; + protected getQuestsWithOnlyLevelRequirementStartCondition(quests: IQuest[]): IQuest[]; /** - * Reset AvailableForStart conditions on a quest + * Remove all quest conditions except for level requirement * @param quest quest to clean * @returns reset IQuest object */ - cleanQuestConditions(quest: IQuest): IQuest; - failQuest(pmcData: IPmcData, body: any, sessionID: string): any; + getQuestWithOnlyLevelRequirementStartCondition(quest: IQuest): IQuest; + /** + * Fail a quest in a player profile + * @param pmcData Profile + * @param failRequest fail quest request data + * @param sessionID Session id + * @returns Item event router response + */ + failQuest(pmcData: IPmcData, failRequest: any, sessionID: string): IItemEventRouterResponse; /** * Get quest by id from database * @param questId questid to look for @@ -105,7 +158,12 @@ export declare class QuestHelper { * @returns IQuest object */ getQuestFromDb(questId: string, pmcData: IPmcData): IQuest; - getQuestLocaleIdFromDb(messageId: string): string; + /** + * Get the locale Id from locale db for a quest message + * @param questMessageId Quest mesage id to look up + * @returns Locale Id from locale db + */ + getQuestLocaleIdFromDb(questMessageId: string): string; /** * Alter a quests state + Add a record to tis status timers object * @param pmcData Profile to update @@ -128,5 +186,10 @@ export declare class QuestHelper { * @returns bonus in percent */ protected getIntelCenterRewardBonus(pmcData: IPmcData): number; - getFindItemIdForQuestItem(itemTpl: string): string; + /** + * Find quest with 'findItem' requirement that needs the item tpl be handed in + * @param itemTpl item tpl to look for + * @returns 'FindItem' condition id + */ + getFindItemIdForQuestHandIn(itemTpl: string): string; } diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/RagfairServerHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/RagfairServerHelper.d.ts index a03cdda..ec388d8 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/RagfairServerHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/RagfairServerHelper.d.ts @@ -44,10 +44,20 @@ export declare class RagfairServerHelper { isPlayer(userID: string): boolean; returnItems(sessionID: string, items: any[]): void; calculateDynamicStackCount(tplId: string, isWeaponPreset: boolean): number; + /** + * Choose a currency at random with bias + * @returns currency tpl + */ getDynamicOfferCurrency(): string; getMemberType(userID: string): MemberCategory; getNickname(userID: string): string; getPresetItems(item: any): Item[]; getPresetItemsByTpl(item: Item): Item[]; + /** + * Generate new unique ids for the children while preserving hierarchy + * @param item base item + * @param preset + * @returns Item array with new IDs + */ reparentPresets(item: Item, preset: Item[]): Item[]; } diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/RagfairSortHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/RagfairSortHelper.d.ts index 28d1d38..4669ce6 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/RagfairSortHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/RagfairSortHelper.d.ts @@ -18,7 +18,7 @@ export declare class RagfairSortHelper { protected sortOffersByRating(a: IRagfairOffer, b: IRagfairOffer): number; protected sortOffersByName(a: IRagfairOffer, b: IRagfairOffer): number; /** - * Order two offers by price value + * Order two offers by rouble price value * @param a Offer a * @param b Offer b * @returns diff --git a/TypeScript/6ReferenceAnotherClass/types/loaders/PreAkiModLoader.d.ts b/TypeScript/6ReferenceAnotherClass/types/loaders/PreAkiModLoader.d.ts index 7a687a5..f486a28 100644 --- a/TypeScript/6ReferenceAnotherClass/types/loaders/PreAkiModLoader.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/loaders/PreAkiModLoader.d.ts @@ -1,29 +1,31 @@ import { DependencyContainer } from "tsyringe"; +import { IPostAkiLoadMod } from "../models/external/IPostAkiLoadMod"; +import { IPostDBLoadMod } from "../models/external/IPostDBLoadMod"; +import { IPreAkiLoadMod } from "../models/external/IPreAkiLoadMod"; import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { ModLoader } from "../models/spt/mod/IMod"; import { IModLoader } from "../models/spt/mod/IModLoader"; import { IPackageJsonData } from "../models/spt/mod/IPackageJsonData"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { LocalisationService } from "../services/LocalisationService"; import { ModCompilerService } from "../services/ModCompilerService"; import { JsonUtil } from "../utils/JsonUtil"; import { VFS } from "../utils/VFS"; import { BundleLoader } from "./BundleLoader"; -import { IPostAkiLoadMod } from "../models/external/IPostAkiLoadMod"; -import { IPreAkiLoadMod } from "../models/external/IPreAkiLoadMod"; -import { IPostDBLoadMod } from "../models/external/IPostDBLoadMod"; export declare class PreAkiModLoader implements IModLoader { protected logger: ILogger; protected vfs: VFS; protected jsonUtil: JsonUtil; protected modCompilerService: ModCompilerService; protected bundleLoader: BundleLoader; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected static container: DependencyContainer; protected readonly basepath = "user/mods/"; protected imported: Record; protected akiConfig: ICoreConfig; - constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, modCompilerService: ModCompilerService, bundleLoader: BundleLoader, configServer: ConfigServer); + constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, modCompilerService: ModCompilerService, bundleLoader: BundleLoader, localisationService: LocalisationService, configServer: ConfigServer); load(container: DependencyContainer): Promise; getBundles(local: boolean): string; getBundle(key: string, local: boolean): void; diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/bot/IGenerateBotsRequestData.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/bot/IGenerateBotsRequestData.d.ts index c49cef7..f1f7013 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/eft/bot/IGenerateBotsRequestData.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/bot/IGenerateBotsRequestData.d.ts @@ -2,6 +2,7 @@ export interface IGenerateBotsRequestData { conditions: Condition[]; } export interface Condition { + /** e.g. assault/pmcBot/bossKilla */ Role: string; Limit: number; Difficulty: string; diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/common/IGlobals.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/common/IGlobals.d.ts index 81e2023..b53f106 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/eft/common/IGlobals.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/common/IGlobals.d.ts @@ -591,6 +591,7 @@ export interface HealPrice { export interface ProfileHealthSettings { BodyPartsSettings: BodyPartsSettings; HealthFactorsSettings: HealthFactorsSettings; + DefaultStimulatorBuff: string; } export interface BodyPartsSettings { Head: BodyPartsSetting; diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/IBotBase.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/IBotBase.d.ts index 1c28ae0..2b418c1 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/IBotBase.d.ts @@ -107,6 +107,7 @@ export interface CurrentMax { Maximum: number; } export interface Inventory { + discardLimits: Record; items: Item[]; equipment: string; stash: string; diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/IBotType.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/IBotType.d.ts index c1fe579..55b4bd9 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/IBotType.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/IBotType.d.ts @@ -13,8 +13,8 @@ export interface IBotType { skills: Skills; } export interface Appearance { - body: string[]; - feet: string[]; + body: Record; + feet: Record; hands: string[]; head: string[]; voice: string[]; diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/ITemplateItem.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/ITemplateItem.d.ts index 8569e61..0fa7e18 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/common/tables/ITemplateItem.d.ts @@ -254,7 +254,7 @@ export interface Props { foodUseTime?: number; foodEffectType?: string; StimulatorBuffs?: string; - effects_health?: any; + effects_health?: IHealthEffect[] | Record>; effects_damage?: any; MaximumNumberOfUsage?: number; knifeHitDelay?: number; @@ -366,6 +366,10 @@ export interface Props { MinTimeToContactExplode?: number; ExplosionEffectType?: string; } +export interface IHealthEffect { + type: string; + value: number; +} export interface Prefab { path: string; rcid: string; diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/customization/IGetSuitsResponse.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/customization/IGetSuitsResponse.d.ts new file mode 100644 index 0000000..fe6888c --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/customization/IGetSuitsResponse.d.ts @@ -0,0 +1,4 @@ +export interface IGetSuitsResponse { + _id: string; + suits: string[]; +} diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/game/IGameKeepAliveResponse.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/game/IGameKeepAliveResponse.d.ts new file mode 100644 index 0000000..170ce6a --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/game/IGameKeepAliveResponse.d.ts @@ -0,0 +1,4 @@ +export interface IGameKeepAliveResponse { + msg: string; + utc_time: number; +} diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/game/IGameLogoutResponseData.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/game/IGameLogoutResponseData.d.ts new file mode 100644 index 0000000..0f52050 --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/game/IGameLogoutResponseData.d.ts @@ -0,0 +1,3 @@ +export interface IGameLogoutResponseData { + status: string; +} diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/game/IGameStartResponse.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/game/IGameStartResponse.d.ts new file mode 100644 index 0000000..9f0ab6d --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/game/IGameStartResponse.d.ts @@ -0,0 +1,3 @@ +export interface IGameStartResponse { + utc_time: number; +} diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts new file mode 100644 index 0000000..3c45124 --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts @@ -0,0 +1,11 @@ +import { IInventoryBaseActionRequestData } from "./IInventoryBaseActionRequestData"; +export interface IOpenRandomLootContainerRequestData extends IInventoryBaseActionRequestData { + Action: "OpenRandomLootContainer"; + /** Container item opened */ + item: string; + to: To[]; +} +export interface To { + /** Player character (pmc/scav) id items will be sent to */ + id: string; +} diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/itemEvent/IItemEventRouterBase.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/itemEvent/IItemEventRouterBase.d.ts index 4841cfd..60ab284 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/eft/itemEvent/IItemEventRouterBase.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/itemEvent/IItemEventRouterBase.d.ts @@ -10,8 +10,9 @@ export interface IItemEventRouterBase { export declare type TProfileChanges = Record; export interface Warning { index: number; - err: string; errmsg: string; + code?: string; + data?: any; } export interface ProfileChange { _id: string; diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/match/IStartOffineRaidRequestData.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/match/IStartOffineRaidRequestData.d.ts index af0625e..1983728 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/eft/match/IStartOffineRaidRequestData.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/match/IStartOffineRaidRequestData.d.ts @@ -2,8 +2,10 @@ import { BotAmount } from "../../enums/BotAmount"; import { BotDifficulty } from "../../enums/BotDifficulty"; export interface IStartOfflineRaidRequestData { locationName: string; + /** Current time, not in-game time */ startTime: number; - dateTime: string; + /** CURR = am, past = pm */ + dateTime: "CURR" | "PAST"; gameSettings: GameSettings; } export interface GameSettings { diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/notifier/ISelectProfileResponse.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/notifier/ISelectProfileResponse.d.ts new file mode 100644 index 0000000..ecb668a --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/notifier/ISelectProfileResponse.d.ts @@ -0,0 +1,6 @@ +import { INotifierChannel } from "./INotifier"; +export interface ISelectProfileResponse { + status: string; + notifier: INotifierChannel; + notifierServer: string; +} diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/ragfair/IRagfairOffer.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/ragfair/IRagfairOffer.d.ts index 3251a37..792ec7d 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/eft/ragfair/IRagfairOffer.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/ragfair/IRagfairOffer.d.ts @@ -7,19 +7,19 @@ export interface IRagfairOffer { requirements: OfferRequirement[]; root: string; intId: number; + /** Handbook price */ itemsCost: number; + /** Rouble price */ requirementsCost: number; - sptRequirementsCostRouble: number; startTime: number; endTime: number; sellInOnePiece: boolean; - name?: string; - shortName?: string; loyaltyLevel: number; buyRestrictionMax?: number; buyRestrictionCurrent?: number; locked: boolean; unlimitedCount: boolean; + /** Rouble price */ summaryCost: number; user: IRagfairOfferUser; notAvailable: boolean; @@ -33,11 +33,11 @@ export interface OfferRequirement { } export interface IRagfairOfferUser { id: string; - nickname: string; - rating: number; + nickname?: string; + rating?: number; memberType: MemberCategory; - avatar: string; - isRatingGrowing: boolean; + avatar?: string; + isRatingGrowing?: boolean; } export interface SellResult { sellTime: number; diff --git a/TypeScript/6ReferenceAnotherClass/types/models/eft/weather/IWeatherData.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/eft/weather/IWeatherData.d.ts index ecc96ce..1f5d5b5 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/eft/weather/IWeatherData.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/eft/weather/IWeatherData.d.ts @@ -1,17 +1,18 @@ +import { WindDirection } from "../../../models/enums/WindDirection"; export interface IWeatherData { acceleration: number; time: string; date: string; - weather: IWeather; + weather?: IWeather; } export interface IWeather { pressure: number; temp: number; - fog: string; + fog: number; rain_intensity: number; - rain: any; + rain: number; wind_gustiness: number; - wind_direction: any; + wind_direction: WindDirection; wind_speed: number; cloud: number; time: string; diff --git a/TypeScript/6ReferenceAnotherClass/types/models/enums/BackendErrorCodes.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/enums/BackendErrorCodes.d.ts new file mode 100644 index 0000000..6614b75 --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/models/enums/BackendErrorCodes.d.ts @@ -0,0 +1,67 @@ +export declare enum BackendErrorCodes { + NONE = 0, + UNKNOWN_ERROR = 200, + NOT_AUTHORIZED = 201, + NEED_AUTHORIZATION_CODE = 209, + WRONG_AUTHORIZATION_CODE = 211, + NEED_CAPTCHA = 214, + NO_NEED_CAPTCHA = 215, + CAPTCHA_FAILED = 218, + CAPTCHA_BRUTE_FORCED = 219, + NO_ROOM_IN_STASH = 223, + NICKNAME_NOT_UNIQUE = 225, + NICKNAME_NOT_VALID = 226, + UNSUPPORTED_CLIENT_VERSION = 232, + REPORT_NOT_ALLOWED = 238, + NICKNAME_IS_ABUSIVE = 241, + NICKNAME_CHANGE_TIMEOUT = 242, + NOT_MODIFIED = 304, + HTTP_BAD_REQUEST = 400, + HTTP_NOT_AUTHORIZED = 401, + HTTP_FORBIDDEN = 403, + HTTP_NOT_FOUND = 404, + HTTP_METHOD_NOT_ALLOWED = 405, + UNKNOWN_TRADING_ERROR = 500, + HTTPNOTIMPLEMENTED = 501, + HTTPBADGATEWAY = 502, + HTTPSERVICEUNAVAILABLE = 503, + HTTPGATEWAYTIMEOUT = 504, + TRADEROUTOFMONEY = 505, + HTTPVARIANTALSONEGOTIATES = 506, + PRICECHANGED = 509, + TRADERDISABLED = 512, + ITEMHASBEENSOLD = 513, + NOTENOUGHSPACEFORMONEY = 518, + HTTPINVALIDSSLCERTIFICATE = 526, + UNKNOWNRAGFAIRERROR = 550, + UNKNOWNRAGFAIRERROR2 = 551, + UNKNOWNMATCHMAKERERROR = 600, + SESSIONPARAMETERSERROR = 601, + SESSIONLOST = 602, + SERVERNOTREGISTERED = 604, + UNKNOWNQUESTERROR = 700, + QUESTBADPARAM = 702, + QUESTNOTFOUND = 703, + QUESTISUNAVAILABLE = 704, + NOFREESPACEFORREWARDS = 705, + WRONGQUESTSTATUS = 706, + CANTCOMPLETEQUEST = 707, + UNKNOWNMAILERROR = 900, + TOOMANYFRIENDREQUESTS = 925, + UNKNOWNSCRIPTEXECUTIONERROR = 1000, + UNKNOWNREPAIRINGERROR = 1200, + UNKNOWNINSURANCEERROR = 1300, + UNKNOWNCURRENCYEXCHANGEERROR = 1400, + OFFERNOTFOUND = 1503, + NOTENOUGHSPACE = 1505, + OFFEROUTOFSTOCK = 1506, + OFFERSOLD = 1507, + RAGFAIRUNAVAILABLE = 1511, + BANNEDERRORCODE = 1513, + INSUFFICIENTNUMBERINSTOCK = 1516, + TOOMANYITEMSTOSELL = 1517, + EXAMINATIONFAILED = 22001, + ITEMALREADYEXAMINED = 22002, + UNKNOWNNGINXERROR = 9000, + PARSERESPONSEERROR = 9001 +} diff --git a/TypeScript/6ReferenceAnotherClass/types/models/enums/HideoutEventActions.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/enums/HideoutEventActions.d.ts new file mode 100644 index 0000000..e441477 --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/models/enums/HideoutEventActions.d.ts @@ -0,0 +1,11 @@ +export declare enum HideoutEventActions { + HIDEOUT_UPGRADE = "HideoutUpgrade", + HIDEOUT_UPGRADE_COMPLETE = "HideoutUpgradeComplete", + HIDEOUT_PUT_ITEMS_IN_AREA_SLOTS = "HideoutPutItemsInAreaSlots", + HIDEOUT_TAKE_ITEMS_FROM_AREA_SLOTS = "HideoutTakeItemsFromAreaSlots", + HIDEOUT_TOGGLE_AREA = "HideoutToggleArea", + HIDEOUT_SINGLE_PRODUCTION_START = "HideoutSingleProductionStart", + HIDEOUT_SCAV_CASE_PRODUCTION_START = "HideoutScavCaseProductionStart", + HIDEOUT_CONTINUOUS_PRODUCTION_START = "HideoutContinuousProductionStart", + HIDEOUT_TAKE_PRODUCTION = "HideoutTakeProduction" +} diff --git a/TypeScript/6ReferenceAnotherClass/types/models/enums/ItemEventActions.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/enums/ItemEventActions.d.ts new file mode 100644 index 0000000..0e65453 --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/models/enums/ItemEventActions.d.ts @@ -0,0 +1,19 @@ +export declare enum ItemEventActions { + MOVE = "Move", + REMOVE = "Remove", + SPLIT = "Split", + MERGE = "Merge", + TRANSFER = "Transfer", + SWAP = "Swap", + FOLD = "Fold", + TOGGLE = "Toggle", + TAG = "Tag", + BIND = "Bind", + EXAMINE = "Examine", + READ_ENCYCLOPEDIA = "ReadEncyclopedia", + APPLY_INVENTORY_CHANGES = "ApplyInventoryChanges", + CREATE_MAP_MARKER = "CreateMapMarker", + DELETE_MAP_MARKER = "DeleteMapMarker", + EDIT_MAP_MARKER = "EditMapMarker", + OPEN_RANDOM_LOOT_CONTAINER = "OpenRandomLootContainer" +} diff --git a/TypeScript/6ReferenceAnotherClass/types/models/enums/WeatherType.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/enums/WeatherType.d.ts new file mode 100644 index 0000000..d31fefe --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/models/enums/WeatherType.d.ts @@ -0,0 +1,19 @@ +export declare enum WeatherType { + CLEAR_DAY = 1, + CLEAR_WIND = 2, + CLEAR_NIGHT = 3, + PARTLY_CLOUD_DAY = 4, + PARTLY_CLOUD_NIGHT = 5, + CLEAR_FOG_DAY = 6, + CLEAR_FOG_NIGHT = 7, + CLOUDFOG = 8, + FOG = 9, + MOSTLY_CLOUD = 10, + LIGHT_RAIN = 11, + RAIN = 12, + CLOUD_WIND = 13, + CLOUD_WIND_RAIN = 14, + FULL_CLOUD = 15, + THUNDER_CLOUD = 16, + NONE = 0 +} diff --git a/TypeScript/6ReferenceAnotherClass/types/models/enums/WildSpawnTypeNumber.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/enums/WildSpawnTypeNumber.d.ts new file mode 100644 index 0000000..ff806fe --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/models/enums/WildSpawnTypeNumber.d.ts @@ -0,0 +1,33 @@ +export declare enum WildSpawnTypeNumber { + ASSAULT = 1, + MARKSMAN = 2, + BOSSTEST = 4, + BOSSBULLY = 8, + FOLLOWERTEST = 16, + FOLLOWERBULLY = 32, + BOSSKILLA = 64, + BOSSKOJANIY = 128, + FOLLOWERKOJANIY = 256, + PMCBOT = 512, + CURSEDASSAULT = 1024, + BOSSGLUHAR = 2048, + FOLLOWERGLUHARASSAULT = 4096, + FOLLOWERGLUHARSECURITY = 8192, + FOLLOWERGLUHARSCOUT = 16384, + FOLLOWERGLUHARSNIPE = 32768, + FOLLOWERSANITAR = 65536, + BOSSSANITAR = 131072, + TEST = 262144, + ASSAULTGROUP = 524288, + SECTANTWARRIOR = 1048576, + SECTANTPRIEST = 2097152, + BOSSTAGILLA = 4194304, + FOLLOWERTAGILLA = 8388608, + EXUSEC = 16777216, + GIFTER = 33554432, + BOSSKNIGHT = 67108864, + FOLLOWERBIGPIPE = 134217728, + FOLLOWERBIRDEYE = 268435456, + SPTUSEC = 536870912, + SPTBEAR = 1073741824 +} diff --git a/TypeScript/6ReferenceAnotherClass/types/models/enums/WindDirection.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/enums/WindDirection.d.ts new file mode 100644 index 0000000..fb30b20 --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/models/enums/WindDirection.d.ts @@ -0,0 +1,10 @@ +export declare enum WindDirection { + EAST = 1, + NORTH = 2, + WEST = 3, + SOUTH = 4, + SE = 5, + SW = 6, + NW = 7, + NE = 8 +} diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IBotConfig.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IBotConfig.d.ts index af8ceba..d6fa5e0 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IBotConfig.d.ts @@ -27,6 +27,8 @@ export interface IBotConfig extends IBaseConfig { maxBotCap: Record; /** How many stacks of secret ammo should a bot have in its bot secure container */ secureContainerAmmoStackCount: number; + /** Batch generation size when type not available in cache */ + botGenerationBatchSizePerType: number; } export interface PresetBatch { assault: number; @@ -66,8 +68,12 @@ export interface EquipmentFilters { weaponModLimits: ModLimits; randomisedWeaponModSlots?: string[]; randomisedArmorSlots?: string[]; + faceShieldIsActiveChancePercent?: number; + lightLaserIsActiveChancePercent?: number; blacklist: EquipmentFilterDetails[]; whitelist: EquipmentFilterDetails[]; + clothing: WeightingAdjustmentDetails[]; + weightingAdjustments: WeightingAdjustmentDetails[]; } export interface ModLimits { /** How many scopes are allowed on a weapon - hard coded to work with OPTIC_SCOPE, ASSAULT_SCOPE, COLLIMATOR, COMPACT_COLLIMATOR */ @@ -80,3 +86,8 @@ export interface EquipmentFilterDetails { equipment: Record; cartridge: Record; } +export interface WeightingAdjustmentDetails { + levelRange: MinMax; + add: Record>; + edit: Record>; +} diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IInventoryConfig.d.ts index ffffa41..4642b9b 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IInventoryConfig.d.ts @@ -2,4 +2,10 @@ import { IBaseConfig } from "./IBaseConfig"; export interface IInventoryConfig extends IBaseConfig { kind: "aki-inventory"; newItemsMarkedFound: boolean; + randomLootContainers: Record; +} +export interface RewardDetails { + rewardCount: number; + foundInRaid: boolean; + rewardTplPool: Record; } diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/ILocaleConfig.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/ILocaleConfig.d.ts index fe9abf7..0a8955c 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/ILocaleConfig.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/ILocaleConfig.d.ts @@ -1,5 +1,10 @@ import { IBaseConfig } from "./IBaseConfig"; export interface ILocaleConfig extends IBaseConfig { kind: "aki-locale"; - desiredLocale: string; + /** e.g. ru/en/cn/fr etc, or 'system', will take computer locale setting */ + gameLocale: string; + /** e.g. ru/en/cn/fr etc, or 'system', will take computer locale setting */ + serverLocale: string; + /** Languages server can be translated into */ + serverSupportedLocales: string[]; } diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IPmcConfig.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IPmcConfig.d.ts index 9db2ba1..48601b2 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IPmcConfig.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IPmcConfig.d.ts @@ -6,9 +6,11 @@ export interface IPmcConfig { looseWeaponInBackpackChancePercent: number; looseWeaponInBackpackLootMinMax: MinMax; isUsec: number; + usecType: string; + bearType: string; chanceSameSideIsHostilePercent: number; /** key: location, value: type for usec/bear */ - pmcType: Record; + pmcType: Record>>; maxBackpackLootTotalRub: number; maxPocketLootTotalRub: number; maxVestLootTotalRub: number; diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IRagfairConfig.d.ts index c1b8763..6786417 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IRagfairConfig.d.ts @@ -28,12 +28,8 @@ export interface Reputation { gain: number; loss: number; } -export declare class OfferAdjustment { - maxPriceDifferenceBelowHandbookPercent: number; - handbookPriceMultipier: number; - priceThreshholdRub: number; -} export interface Dynamic { + barter: Barter; offerAdjustment: OfferAdjustment; expiredOfferThreshold: number; offerItemCount: MinMax; @@ -49,6 +45,20 @@ export interface Dynamic { showAsSingleStack: string[]; blacklist: Blacklist; } +export declare class Barter { + enable: boolean; + chancePercent: number; + itemCountMin: number; + itemCountMax: number; + priceRangeVariancePercent: number; + minRoubleCostToBecomeBarter: number; + itemTypeBlacklist: string[]; +} +export declare class OfferAdjustment { + maxPriceDifferenceBelowHandbookPercent: number; + handbookPriceMultipier: number; + priceThreshholdRub: number; +} export interface Condition { conditionChance: number; min: number; diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/ISeasonalEventConfig.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/ISeasonalEventConfig.d.ts index bc60618..e410925 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/ISeasonalEventConfig.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/ISeasonalEventConfig.d.ts @@ -1,6 +1,9 @@ import { IBaseConfig } from "./IBaseConfig"; export interface ISeasonalEventConfig extends IBaseConfig { kind: "aki-seasonalevents"; + enableSeasonalEventDetection: boolean; + /** event / botType / equipSlot / itemid */ + eventGear: Record>>>; events: ISeasonalEvent[]; } export interface ISeasonalEvent { diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IWeatherConfig.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IWeatherConfig.d.ts index bbdc43e..41a1c83 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IWeatherConfig.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IWeatherConfig.d.ts @@ -1,3 +1,4 @@ +import { WindDirection } from "../../../models/enums/WindDirection"; import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface IWeatherConfig extends IBaseConfig { @@ -7,12 +8,16 @@ export interface IWeatherConfig extends IBaseConfig { } export interface Weather { clouds: MinMax; - windSpeed: MinMax; - windDirection: MinMax; + windSpeed: WeatherSettings; + windDirection: WeatherSettings; windGustiness: MinMax; - rain: MinMax; + rain: WeatherSettings; rainIntensity: MinMax; - fog: MinMax; + fog: WeatherSettings; temp: MinMax; pressure: MinMax; } +export interface WeatherSettings { + values: T[]; + weights: number[]; +} diff --git a/TypeScript/6ReferenceAnotherClass/types/routers/item_events/HideoutItemEventRouter.d.ts b/TypeScript/6ReferenceAnotherClass/types/routers/item_events/HideoutItemEventRouter.d.ts index e1e98af..44bd1cd 100644 --- a/TypeScript/6ReferenceAnotherClass/types/routers/item_events/HideoutItemEventRouter.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/routers/item_events/HideoutItemEventRouter.d.ts @@ -1,7 +1,7 @@ -import { IPmcData } from "../../models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "../../models/eft/itemEvent/IItemEventRouterResponse"; import { HideoutCallbacks } from "../../callbacks/HideoutCallbacks"; import { HandledRoute, ItemEventRouterDefinition } from "../../di/Router"; +import { IPmcData } from "../../models/eft/common/IPmcData"; +import { IItemEventRouterResponse } from "../../models/eft/itemEvent/IItemEventRouterResponse"; export declare class HideoutItemEventRouter extends ItemEventRouterDefinition { protected hideoutCallbacks: HideoutCallbacks; constructor(hideoutCallbacks: HideoutCallbacks); diff --git a/TypeScript/6ReferenceAnotherClass/types/routers/item_events/InventoryItemEventRouter.d.ts b/TypeScript/6ReferenceAnotherClass/types/routers/item_events/InventoryItemEventRouter.d.ts index 2619bb9..953d322 100644 --- a/TypeScript/6ReferenceAnotherClass/types/routers/item_events/InventoryItemEventRouter.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/routers/item_events/InventoryItemEventRouter.d.ts @@ -1,7 +1,7 @@ -import { IPmcData } from "../../models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "../../models/eft/itemEvent/IItemEventRouterResponse"; import { InventoryCallbacks } from "../../callbacks/InventoryCallbacks"; import { HandledRoute, ItemEventRouterDefinition } from "../../di/Router"; +import { IPmcData } from "../../models/eft/common/IPmcData"; +import { IItemEventRouterResponse } from "../../models/eft/itemEvent/IItemEventRouterResponse"; export declare class InventoryItemEventRouter extends ItemEventRouterDefinition { protected inventoryCallbacks: InventoryCallbacks; constructor(inventoryCallbacks: InventoryCallbacks); diff --git a/TypeScript/6ReferenceAnotherClass/types/servers/HttpServer.d.ts b/TypeScript/6ReferenceAnotherClass/types/servers/HttpServer.d.ts index bbca8af..80c1d48 100644 --- a/TypeScript/6ReferenceAnotherClass/types/servers/HttpServer.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/servers/HttpServer.d.ts @@ -4,6 +4,7 @@ import { ApplicationContext } from "../context/ApplicationContext"; import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; import { ILogger } from "../models/spt/utils/ILogger"; +import { LocalisationService } from "../services/LocalisationService"; import { ConfigServer } from "./ConfigServer"; import { DatabaseServer } from "./DatabaseServer"; import { IHttpListener } from "./http/IHttpListener"; @@ -12,11 +13,12 @@ export declare class HttpServer { protected logger: ILogger; protected databaseServer: DatabaseServer; protected httpServerHelper: HttpServerHelper; + protected localisationService: LocalisationService; protected httpListeners: IHttpListener[]; protected configServer: ConfigServer; protected applicationContext: ApplicationContext; protected webSocketServer: WebSocketServer; - constructor(logger: ILogger, databaseServer: DatabaseServer, httpServerHelper: HttpServerHelper, httpListeners: IHttpListener[], configServer: ConfigServer, applicationContext: ApplicationContext, webSocketServer: WebSocketServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, httpServerHelper: HttpServerHelper, localisationService: LocalisationService, httpListeners: IHttpListener[], configServer: ConfigServer, applicationContext: ApplicationContext, webSocketServer: WebSocketServer); protected httpConfig: IHttpConfig; getCookies(req: http.IncomingMessage): any; handleRequest(req: IncomingMessage, resp: ServerResponse): void; diff --git a/TypeScript/6ReferenceAnotherClass/types/servers/SaveServer.d.ts b/TypeScript/6ReferenceAnotherClass/types/servers/SaveServer.d.ts index cb28f49..4dca514 100644 --- a/TypeScript/6ReferenceAnotherClass/types/servers/SaveServer.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/servers/SaveServer.d.ts @@ -1,20 +1,22 @@ +import { SaveLoadRouter } from "../di/Router"; import { IAkiProfile, Info } from "../models/eft/profile/IAkiProfile"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { VFS } from "../utils/VFS"; -import { SaveLoadRouter } from "../di/Router"; -import { ILogger } from "../models/spt/utils/ILogger"; export declare class SaveServer { protected vfs: VFS; protected saveLoadRouters: SaveLoadRouter[]; protected jsonUtil: JsonUtil; protected hashUtil: HashUtil; + protected localisationService: LocalisationService; protected logger: ILogger; protected profileFilepath: string; protected profiles: {}; protected onSave: {}; protected saveMd5: {}; - constructor(vfs: VFS, saveLoadRouters: SaveLoadRouter[], jsonUtil: JsonUtil, hashUtil: HashUtil, logger: ILogger); + constructor(vfs: VFS, saveLoadRouters: SaveLoadRouter[], jsonUtil: JsonUtil, hashUtil: HashUtil, localisationService: LocalisationService, logger: ILogger); load(): void; save(): void; getProfile(sessionId: string): IAkiProfile; diff --git a/TypeScript/6ReferenceAnotherClass/types/servers/WebSocketServer.d.ts b/TypeScript/6ReferenceAnotherClass/types/servers/WebSocketServer.d.ts index f33d214..5d40e6e 100644 --- a/TypeScript/6ReferenceAnotherClass/types/servers/WebSocketServer.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/servers/WebSocketServer.d.ts @@ -1,18 +1,20 @@ /// -import { HttpServerHelper } from "../helpers/HttpServerHelper"; -import WebSocket from "ws"; import http, { IncomingMessage } from "http"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { RandomUtil } from "../utils/RandomUtil"; +import WebSocket from "ws"; +import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { INotification } from "../models/eft/notifier/INotifier"; -import { ConfigServer } from "./ConfigServer"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { LocalisationService } from "../services/LocalisationService"; +import { RandomUtil } from "../utils/RandomUtil"; +import { ConfigServer } from "./ConfigServer"; export declare class WebSocketServer { protected logger: ILogger; protected randomUtil: RandomUtil; protected configServer: ConfigServer; + protected localisationService: LocalisationService; protected httpServerHelper: HttpServerHelper; - constructor(logger: ILogger, randomUtil: RandomUtil, configServer: ConfigServer, httpServerHelper: HttpServerHelper); + constructor(logger: ILogger, randomUtil: RandomUtil, configServer: ConfigServer, localisationService: LocalisationService, httpServerHelper: HttpServerHelper); protected httpConfig: IHttpConfig; protected defaultNotification: INotification; protected webSockets: Record; diff --git a/TypeScript/6ReferenceAnotherClass/types/servers/http/AkiHttpListener.d.ts b/TypeScript/6ReferenceAnotherClass/types/servers/http/AkiHttpListener.d.ts index 6f78939..acf92aa 100644 --- a/TypeScript/6ReferenceAnotherClass/types/servers/http/AkiHttpListener.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/servers/http/AkiHttpListener.d.ts @@ -1,22 +1,24 @@ /// /// import { IncomingMessage, ServerResponse } from "http"; -import { IHttpListener } from "./IHttpListener"; import { Serializer } from "../../di/Serializer"; import { ILogger } from "../../models/spt/utils/ILogger"; import { HttpRouter } from "../../routers/HttpRouter"; +import { LocalisationService } from "../../services/LocalisationService"; import { HttpResponseUtil } from "../../utils/HttpResponseUtil"; import { JsonUtil } from "../../utils/JsonUtil"; import { HttpBufferHandler } from "./HttpBufferHandler"; +import { IHttpListener } from "./IHttpListener"; export declare class AkiHttpListener implements IHttpListener { protected httpRouter: HttpRouter; protected serializers: Serializer[]; protected logger: ILogger; protected jsonUtil: JsonUtil; protected httpResponse: HttpResponseUtil; + protected localisationService: LocalisationService; protected httpBufferHandler: HttpBufferHandler; constructor(httpRouter: HttpRouter, // TODO: delay required - serializers: Serializer[], logger: ILogger, jsonUtil: JsonUtil, httpResponse: HttpResponseUtil, httpBufferHandler: HttpBufferHandler); + serializers: Serializer[], logger: ILogger, jsonUtil: JsonUtil, httpResponse: HttpResponseUtil, localisationService: LocalisationService, httpBufferHandler: HttpBufferHandler); canHandle(_: string, req: IncomingMessage): boolean; handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): void; sendResponse(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: Buffer, output: string): void; diff --git a/TypeScript/6ReferenceAnotherClass/types/services/BotEquipmentFilterService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/BotEquipmentFilterService.d.ts index 632f961..ae72cc3 100644 --- a/TypeScript/6ReferenceAnotherClass/types/services/BotEquipmentFilterService.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/services/BotEquipmentFilterService.d.ts @@ -1,12 +1,12 @@ import { IBotType } from "../models/eft/common/tables/IBotType"; -import { EquipmentFilters, EquipmentFilterDetails, IBotConfig } from "../models/spt/config/IBotConfig"; +import { EquipmentFilters, EquipmentFilterDetails, IBotConfig, WeightingAdjustmentDetails } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; export declare class BotEquipmentFilterService { protected logger: ILogger; protected configServer: ConfigServer; protected botConfig: IBotConfig; - protected botEquipmentFilterlists: Record; + protected botEquipmentConfig: Record; constructor(logger: ILogger, configServer: ConfigServer); /** * Filter a bots data to exclude equipment and cartridges defines in the botConfig @@ -30,6 +30,20 @@ export declare class BotEquipmentFilterService { * @returns EquipmentFilterDetails object */ protected getBotEquipmentWhitelist(botRole: string, playerLevel: number): EquipmentFilterDetails; + /** + * Retreive clothing weighting adjustments from bot.json config + * @param botRole Bot type to get adjustments for + * @param playerLevel level of player + * @returns Weighting adjustments for bots clothing + */ + protected getBotClothingAdjustments(botRole: string, playerLevel: number): WeightingAdjustmentDetails; + /** + * Retreive item weighting adjustments from bot.json config + * @param botRole Bot type to get adjustments for + * @param playerLevel level of player + * @returns Weighting adjustments for bot items + */ + protected getBotWeightingAdjustments(botRole: string, playerLevel: number): WeightingAdjustmentDetails; /** * Filter bot equipment based on blacklist and whitelist from config/bot.json * Prioritises whitelist first, if one is found blacklist is ignored @@ -47,4 +61,10 @@ export declare class BotEquipmentFilterService { * @returns Filtered bot file */ protected filterCartridges(baseBotNode: IBotType, blacklist: EquipmentFilterDetails, whitelist: EquipmentFilterDetails): void; + /** + * Add/Edit weighting changes to bot items using values from config/bot.json/equipment + * @param weightingAdjustments Weighting change to apply to bot + * @param botItemPool Bot item dictionary to adjust + */ + protected adjustWeighting(weightingAdjustments: WeightingAdjustmentDetails, botItemPool: Record): void; } diff --git a/TypeScript/6ReferenceAnotherClass/types/services/BotGenerationCacheService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/BotGenerationCacheService.d.ts index ba53fec..0be0576 100644 --- a/TypeScript/6ReferenceAnotherClass/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/services/BotGenerationCacheService.d.ts @@ -8,11 +8,11 @@ export declare class BotGenerationCacheService { protected randomUtil: RandomUtil; protected jsonUtil: JsonUtil; protected botHelper: BotHelper; - protected storedBots: IBotBase[]; + protected storedBots: Map; constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, botHelper: BotHelper); /** * Store array of bots in cache, shuffle results before storage - * @param botsToStore + * @param botsToStore Bots we want to store in the cache */ storeBots(botsToStore: IBotBase[]): void; /** @@ -21,25 +21,7 @@ export declare class BotGenerationCacheService { * @param role role to retreive (assault/bossTagilla etc) * @returns IBotBase object */ - getBot(role: string): IBotBase[]; - /** - * Find a bot by its index from cache - * @param indexOfBotToReturn index to find bot by - * @returns bot profile - */ - protected getBotFromCache(indexOfBotToReturn: number): IBotBase; - /** - * Remove bot profile by index from cache - * @param indexOfBotToReturn Index of bot profile to remove - */ - protected removeBotFromCache(indexOfBotToReturn: number): void; - /** - * Get index of bot profile that matches criteria - * @param role Role of bot wanted - * @param getPmc Requested bot a pmc - * @returns index of found bot, -1 if not found - */ - protected getIndexOfBotToReturn(role: string, getPmc: boolean): number; + getBot(role: string): IBotBase; /** * Remove all cached bot profiles */ @@ -48,5 +30,5 @@ export declare class BotGenerationCacheService { * Does cache have bots * @returns true if empty */ - cacheIsEmpty(): boolean; + cacheHasBotOfRole(role: string): boolean; } diff --git a/TypeScript/6ReferenceAnotherClass/types/services/LocaleService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/LocaleService.d.ts index 33bea7b..8275b75 100644 --- a/TypeScript/6ReferenceAnotherClass/types/services/LocaleService.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/services/LocaleService.d.ts @@ -1,14 +1,42 @@ import { ILocaleConfig } from "../models/spt/config/ILocaleConfig"; +import { ILocaleGlobalBase } from "../models/spt/server/ILocaleBase"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +/** + * Handles getting locales from config or users machine + */ export declare class LocaleService { protected logger: ILogger; + protected databaseServer: DatabaseServer; protected configServer: ConfigServer; protected localeConfig: ILocaleConfig; - constructor(logger: ILogger, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, configServer: ConfigServer); /** - * Gets the locale key from the locale.json file + * Get the eft globals db file based on the configured locale in config/locale.json, if not found, fall back to 'en' + * @returns ILocaleGlobalBase + */ + getLocaleDb(): ILocaleGlobalBase; + /** + * Gets the game locale key from the locale.json file, + * if value is 'system' get system locale * @returns locale e.g en/ge/cz/cn */ - getDesiredLocale(): string; + getDesiredGameLocale(): string; + /** + * Gets the game locale key from the locale.json file, + * if value is 'system' get system locale + * @returns locale e.g en/ge/cz/cn + */ + getDesiredServerLocale(): string; + /** + * Get array of languages supported for localisation + * @returns array of locales e.g. en/fr/cn + */ + getServerSupportedLocales(): string[]; + /** + * Get the locale of the computer running the server + * @returns langage part of locale e.g. 'en' part of 'en-US' + */ + protected getPlatformLocale(): string; } diff --git a/TypeScript/6ReferenceAnotherClass/types/services/LocalisationService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/LocalisationService.d.ts new file mode 100644 index 0000000..519325d --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/services/LocalisationService.d.ts @@ -0,0 +1,21 @@ +import { I18n } from "i18n"; +import { ILocaleConfig } from "../models/spt/config/ILocaleConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { LocaleService } from "./LocaleService"; +/** + * Handles translating server text into different langauges + */ +export declare class LocalisationService { + protected logger: ILogger; + protected localeService: LocaleService; + protected localeConfig: ILocaleConfig; + protected i18n: I18n; + constructor(logger: ILogger, localeService: LocaleService); + /** + * Get a localised value using the passed in key + * @param key Key to loop up locale for + * @param args optional arguments + * @returns Localised string + */ + getText(key: string, args?: any): string; +} diff --git a/TypeScript/6ReferenceAnotherClass/types/services/PaymentService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/PaymentService.d.ts index a5e538f..c9ce95a 100644 --- a/TypeScript/6ReferenceAnotherClass/types/services/PaymentService.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/services/PaymentService.d.ts @@ -11,6 +11,7 @@ import { IProcessSellTradeRequestData } from "../models/eft/trade/IProcessSellTr import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +import { LocalisationService } from "./LocalisationService"; export declare class PaymentService { protected logger: ILogger; protected httpResponse: HttpResponseUtil; @@ -19,8 +20,9 @@ export declare class PaymentService { protected traderHelper: TraderHelper; protected itemHelper: ItemHelper; protected inventoryHelper: InventoryHelper; + protected localisationService: LocalisationService; protected paymentHelper: PaymentHelper; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, traderHelper: TraderHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper); + constructor(logger: ILogger, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, traderHelper: TraderHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, localisationService: LocalisationService, paymentHelper: PaymentHelper); /** * Take money and insert items into return to server request * @param {Object} pmcData @@ -50,7 +52,7 @@ export declare class PaymentService { * @param pmcData Player profile to find and remove currency from * @param currencyTpl Type of currency to pay * @param amountToPay money value to pay - * @param sessionID Sessino id + * @param sessionID Session id * @param output output object to send to client * @returns IItemEventRouterResponse */ diff --git a/TypeScript/6ReferenceAnotherClass/types/services/PlayerService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/PlayerService.d.ts index 519b7e5..2f364d5 100644 --- a/TypeScript/6ReferenceAnotherClass/types/services/PlayerService.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/services/PlayerService.d.ts @@ -2,10 +2,12 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { IPlayerIncrementSkillLevelRequestData } from "../models/eft/player/IPlayerIncrementSkillLevelRequestData"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "./LocalisationService"; export declare class PlayerService { protected logger: ILogger; + protected localisationService: LocalisationService; protected databaseServer: DatabaseServer; - constructor(logger: ILogger, databaseServer: DatabaseServer); + constructor(logger: ILogger, localisationService: LocalisationService, databaseServer: DatabaseServer); /** * increases the profile skill and updates any output * @param {Object} pmcData diff --git a/TypeScript/6ReferenceAnotherClass/types/services/PmcAiService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/PmcAiService.d.ts deleted file mode 100644 index 0690f1f..0000000 --- a/TypeScript/6ReferenceAnotherClass/types/services/PmcAiService.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { IBotConfig } from "../models/spt/config/IBotConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { ConfigServer } from "../servers/ConfigServer"; -/** Storing/retreving pmcRoles set at the start of a raid - its done at that point as we know what location the player is heading to */ -export declare class PmcAiService { - protected logger: ILogger; - protected configServer: ConfigServer; - protected botConfig: IBotConfig; - protected usecRole: string; - protected bearRole: string; - constructor(logger: ILogger, configServer: ConfigServer); - /** - * Convert from pmc side (usec/bear) to the side as defined in the bot config (usecType/bearType) - * @param pmcSide eft side (usec/bear) - * @returns pmc side as defined in config - */ - getPmcRole(pmcSide: "usec" | "bear" | string): string; - /** - * Set the roles for pmcs - * @param location map location to look up and use as pmc types - */ - setPmcRolesByLocation(location: string): void; - /** - * Clear the saved role from usec/bear PMCs - */ - clearPmcRoles(): void; -} diff --git a/TypeScript/6ReferenceAnotherClass/types/services/ProfileFixerService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/ProfileFixerService.d.ts index e772919..86a6af8 100644 --- a/TypeScript/6ReferenceAnotherClass/types/services/ProfileFixerService.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/services/ProfileFixerService.d.ts @@ -8,12 +8,14 @@ import { HideoutAreas } from "../models/enums/HideoutAreas"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { Watermark } from "../utils/Watermark"; +import { LocalisationService } from "./LocalisationService"; export declare class ProfileFixerService { protected logger: ILogger; protected watermark: Watermark; protected hideoutHelper: HideoutHelper; + protected localisationService: LocalisationService; protected databaseServer: DatabaseServer; - constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, databaseServer: DatabaseServer); + constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, localisationService: LocalisationService, databaseServer: DatabaseServer); /** * Find issues in the pmc profile data that may cause issues and fix them * @param pmcProfile profile to check and fix diff --git a/TypeScript/6ReferenceAnotherClass/types/services/RagfairOfferService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/RagfairOfferService.d.ts index a6f6b6d..86c1e52 100644 --- a/TypeScript/6ReferenceAnotherClass/types/services/RagfairOfferService.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/services/RagfairOfferService.d.ts @@ -11,6 +11,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { TimeUtil } from "../utils/TimeUtil"; +import { LocalisationService } from "./LocalisationService"; import { RagfairCategoriesService } from "./RagfairCategoriesService"; export declare class RagfairOfferService { protected logger: ILogger; @@ -22,12 +23,14 @@ export declare class RagfairOfferService { protected profileHelper: ProfileHelper; protected eventOutputHolder: EventOutputHolder; protected httpResponse: HttpResponseUtil; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected playerOffersLoaded: boolean; protected expiredOffers: Item[]; - protected offers: IRagfairOffer[]; + /** offerId, offer */ + protected offers: Record; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, databaseServer: DatabaseServer, saveServer: SaveServer, ragfairServerHelper: RagfairServerHelper, ragfairCategoriesService: RagfairCategoriesService, profileHelper: ProfileHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, databaseServer: DatabaseServer, saveServer: SaveServer, ragfairServerHelper: RagfairServerHelper, ragfairCategoriesService: RagfairCategoriesService, profileHelper: ProfileHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, localisationService: LocalisationService, configServer: ConfigServer); /** * Get all offers * @returns IRagfairOffer array diff --git a/TypeScript/6ReferenceAnotherClass/types/utils/App.d.ts b/TypeScript/6ReferenceAnotherClass/types/utils/App.d.ts index dcc2669..cc8a5af 100644 --- a/TypeScript/6ReferenceAnotherClass/types/utils/App.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/utils/App.d.ts @@ -1,14 +1,16 @@ -import { TimeUtil } from "./TimeUtil"; import { OnLoad } from "../di/OnLoad"; import { OnUpdate } from "../di/OnUpdate"; import { ILogger } from "../models/spt/utils/ILogger"; +import { LocalisationService } from "../services/LocalisationService"; +import { TimeUtil } from "./TimeUtil"; export declare class App { protected logger: ILogger; protected timeUtil: TimeUtil; + protected localisationService: LocalisationService; protected onLoadComponents: OnLoad[]; protected onUpdateComponents: OnUpdate[]; protected onUpdateLastRun: {}; - constructor(logger: ILogger, timeUtil: TimeUtil, onLoadComponents: OnLoad[], onUpdateComponents: OnUpdate[]); + constructor(logger: ILogger, timeUtil: TimeUtil, localisationService: LocalisationService, onLoadComponents: OnLoad[], onUpdateComponents: OnUpdate[]); load(): void; protected update(onUpdateComponents: OnUpdate[]): void; protected logUpdateException(err: any, updateable: OnUpdate): void; diff --git a/TypeScript/6ReferenceAnotherClass/types/utils/DatabaseImporter.d.ts b/TypeScript/6ReferenceAnotherClass/types/utils/DatabaseImporter.d.ts index 483e135..31670ae 100644 --- a/TypeScript/6ReferenceAnotherClass/types/utils/DatabaseImporter.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/utils/DatabaseImporter.d.ts @@ -3,15 +3,17 @@ import { IDatabaseTables } from "../models/spt/server/IDatabaseTables"; import { ILogger } from "../models/spt/utils/ILogger"; import { ImageRouter } from "../routers/ImageRouter"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { JsonUtil } from "./JsonUtil"; import { VFS } from "./VFS"; export declare class DatabaseImporter extends OnLoad { protected logger: ILogger; protected vfs: VFS; protected jsonUtil: JsonUtil; + protected localisationService: LocalisationService; protected databaseServer: DatabaseServer; protected imageRouter: ImageRouter; - constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, databaseServer: DatabaseServer, imageRouter: ImageRouter); + constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, localisationService: LocalisationService, databaseServer: DatabaseServer, imageRouter: ImageRouter); onLoad(): void; /** * Read all json files in database folder and map into a json object diff --git a/TypeScript/6ReferenceAnotherClass/types/utils/HttpResponseUtil.d.ts b/TypeScript/6ReferenceAnotherClass/types/utils/HttpResponseUtil.d.ts index 29502be..3a78618 100644 --- a/TypeScript/6ReferenceAnotherClass/types/utils/HttpResponseUtil.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/utils/HttpResponseUtil.d.ts @@ -1,10 +1,13 @@ -import { JsonUtil } from "./JsonUtil"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { INullResponseData } from "../models/eft/httpResponse/INullResponseData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; +import { BackendErrorCodes } from "../models/enums/BackendErrorCodes"; +import { LocalisationService } from "../services/LocalisationService"; +import { JsonUtil } from "./JsonUtil"; export declare class HttpResponseUtil { protected jsonUtil: JsonUtil; - constructor(jsonUtil: JsonUtil); + protected localisationService: LocalisationService; + constructor(jsonUtil: JsonUtil, localisationService: LocalisationService); protected clearString(s: string): any; noBody(data: any): any; getBody(data: T, err?: number, errmsg?: any): IGetBodyResponseData; @@ -12,5 +15,5 @@ export declare class HttpResponseUtil { emptyResponse(): IGetBodyResponseData; nullResponse(): INullResponseData; emptyArrayResponse(): IGetBodyResponseData; - appendErrorToOutput(output: IItemEventRouterResponse, message?: string, title?: string): IItemEventRouterResponse; + appendErrorToOutput(output: IItemEventRouterResponse, message?: string, errorCode?: BackendErrorCodes): IItemEventRouterResponse; } diff --git a/TypeScript/6ReferenceAnotherClass/types/utils/RandomUtil.d.ts b/TypeScript/6ReferenceAnotherClass/types/utils/RandomUtil.d.ts index 633e472..aa556e3 100644 --- a/TypeScript/6ReferenceAnotherClass/types/utils/RandomUtil.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/utils/RandomUtil.d.ts @@ -110,6 +110,12 @@ export declare class RandomUtil { getIntEx(max: number): number; getFloat(min: number, max: number): number; getBool(): boolean; + /** + * Check if number passes a check out of 100 + * @param chancePercent value check needs to be above + * @returns true if value passes check + */ + getChance100(chancePercent: number): boolean; getStringArrayValue(arr: string[]): string; getArrayValue(arr: T[]): T; getKey(node: any): string; diff --git a/TypeScript/6ReferenceAnotherClass/types/utils/Watermark.d.ts b/TypeScript/6ReferenceAnotherClass/types/utils/Watermark.d.ts index c6dc120..e02eba2 100644 --- a/TypeScript/6ReferenceAnotherClass/types/utils/Watermark.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/utils/Watermark.d.ts @@ -1,20 +1,15 @@ import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { LocalisationService } from "../services/LocalisationService"; export declare class WatermarkLocale { - protected locales: { - "en-US": { - description: string[]; - warning: string[]; - modding: string[]; - }; - "zh-CN": { - description: string[]; - warning: string[]; - modding: string[]; - }; + protected localisationService: LocalisationService; + constructor(localisationService: LocalisationService); + protected watermark: { + description: string[]; + warning: string[]; + modding: string[]; }; - getLocale(): string; getDescription(): string[]; getWarning(): string[]; getModding(): string[]; @@ -22,9 +17,10 @@ export declare class WatermarkLocale { export declare class Watermark { protected logger: ILogger; protected configServer: ConfigServer; + protected localisationService: LocalisationService; protected watermarkLocale?: WatermarkLocale; protected akiConfig: ICoreConfig; - constructor(logger: ILogger, configServer: ConfigServer, watermarkLocale?: WatermarkLocale); + constructor(logger: ILogger, configServer: ConfigServer, localisationService: LocalisationService, watermarkLocale?: WatermarkLocale); protected text: string[]; protected versionLabel: string; initialize(): void; diff --git a/TypeScript/7OnLoadHook/types/callbacks/BotCallbacks.d.ts b/TypeScript/7OnLoadHook/types/callbacks/BotCallbacks.d.ts index 2db60dc..827015e 100644 --- a/TypeScript/7OnLoadHook/types/callbacks/BotCallbacks.d.ts +++ b/TypeScript/7OnLoadHook/types/callbacks/BotCallbacks.d.ts @@ -8,8 +8,29 @@ export declare class BotCallbacks { protected botController: BotController; protected httpResponse: HttpResponseUtil; constructor(botController: BotController, httpResponse: HttpResponseUtil); + /** + * Handle singleplayer/settings/bot/limit + * @returns string + */ getBotLimit(url: string, info: IEmptyRequestData, sessionID: string): string; + /** + * Handle singleplayer/settings/bot/difficulty + * @returns string + */ getBotDifficulty(url: string, info: IEmptyRequestData, sessionID: string): string; + /** + * Handle client/game/bot/generate + * @returns IGetBodyResponseData + */ generateBots(url: string, info: IGenerateBotsRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle singleplayer/settings/bot/maxCap + * @returns string + */ getBotCap(): string; + /** + * Handle singleplayer/settings/bot/getBotBehaviours + * @returns string + */ + getBotBehaviours(): string; } diff --git a/TypeScript/7OnLoadHook/types/callbacks/CustomizationCallbacks.d.ts b/TypeScript/7OnLoadHook/types/callbacks/CustomizationCallbacks.d.ts index 3bab8c0..75d5701 100644 --- a/TypeScript/7OnLoadHook/types/callbacks/CustomizationCallbacks.d.ts +++ b/TypeScript/7OnLoadHook/types/callbacks/CustomizationCallbacks.d.ts @@ -3,6 +3,7 @@ import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { IPmcData } from "../models/eft/common/IPmcData"; import { ISuit } from "../models/eft/common/tables/ITrader"; import { IBuyClothingRequestData } from "../models/eft/customization/IBuyClothingRequestData"; +import { IGetSuitsResponse } from "../models/eft/customization/IGetSuitsResponse"; import { IWearClothingRequestData } from "../models/eft/customization/IWearClothingRequestData"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; @@ -13,10 +14,15 @@ export declare class CustomizationCallbacks { protected saveServer: SaveServer; protected httpResponse: HttpResponseUtil; constructor(customizationController: CustomizationController, saveServer: SaveServer, httpResponse: HttpResponseUtil); - getSuits(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<{ - _id: string; - suites: string[]; - }>; + /** + * Handles client/trading/customization/storage + * @returns + */ + getSuits(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handles client/trading/customization + * @returns ISuit[] + */ getTraderSuits(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; wearClothing(pmcData: IPmcData, body: IWearClothingRequestData, sessionID: string): IItemEventRouterResponse; buyClothing(pmcData: IPmcData, body: IBuyClothingRequestData, sessionID: string): IItemEventRouterResponse; diff --git a/TypeScript/7OnLoadHook/types/callbacks/DataCallbacks.d.ts b/TypeScript/7OnLoadHook/types/callbacks/DataCallbacks.d.ts index 04566ff..2efcf81 100644 --- a/TypeScript/7OnLoadHook/types/callbacks/DataCallbacks.d.ts +++ b/TypeScript/7OnLoadHook/types/callbacks/DataCallbacks.d.ts @@ -12,15 +12,42 @@ import { ILanguageBase } from "../models/spt/server/ILocaleBase"; import { ISettingsBase } from "../models/spt/server/ISettingsBase"; import { DatabaseServer } from "../servers/DatabaseServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +/** + * Handle client requests + */ export declare class DataCallbacks { protected httpResponse: HttpResponseUtil; protected databaseServer: DatabaseServer; constructor(httpResponse: HttpResponseUtil, databaseServer: DatabaseServer); + /** + * Handles client/settings + * @returns ISettingsBase + */ getSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handles client/globals + * @returns IGlobals + */ getGlobals(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handles client/items + * @returns string + */ getTemplateItems(url: string, info: IEmptyRequestData, sessionID: string): string; + /** + * Handles client/handbook/templates + * @returns IHandbookBase + */ getTemplateHandbook(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handles client/customization + * @returns Record>; + /** + * Handles client/account/customization + * @returns string[] + */ getTemplateCharacter(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getTemplateQuests(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getHideoutSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; @@ -28,6 +55,6 @@ export declare class DataCallbacks { gethideoutProduction(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getHideoutScavcase(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getLocalesLanguages(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - getLocalesMenu(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + getLocalesMenu(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getLocalesGlobal(url: string, info: IEmptyRequestData, sessionID: string): string; } diff --git a/TypeScript/7OnLoadHook/types/callbacks/DialogueCallbacks.d.ts b/TypeScript/7OnLoadHook/types/callbacks/DialogueCallbacks.d.ts index 634f90b..7b2eeae 100644 --- a/TypeScript/7OnLoadHook/types/callbacks/DialogueCallbacks.d.ts +++ b/TypeScript/7OnLoadHook/types/callbacks/DialogueCallbacks.d.ts @@ -26,15 +26,27 @@ export declare class DialogueCallbacks extends OnUpdate { protected httpResponse: HttpResponseUtil; protected dialogueController: DialogueController; constructor(hashUtil: HashUtil, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, dialogueController: DialogueController); + /** + * Handles client/friend/list + * @returns IGetFriendListDataResponse + */ getFriendList(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handles client/chatServer/list + * @returns + */ getChatServerList(url: string, info: IGetChatServerListRequestData, sessionID: string): IGetBodyResponseData; getMailDialogList(url: string, info: IGetMailDialogListRequestData, sessionID: string): IGetBodyResponseData; getMailDialogView(url: string, info: IGetMailDialogViewRequestData, sessionID: string): IGetBodyResponseData; - getMailDialogInfo(url: string, info: IGetMailDialogInfoRequestData, sessionID: string): IGetBodyResponseData; + getMailDialogInfo(url: string, info: IGetMailDialogInfoRequestData, sessionID: string): IGetBodyResponseData; removeDialog(url: string, info: IRemoveDialogRequestData, sessionID: string): IGetBodyResponseData; pinDialog(url: string, info: IPinDialogRequestData, sessionID: string): IGetBodyResponseData; unpinDialog(url: string, info: IPinDialogRequestData, sessionID: string): IGetBodyResponseData; setRead(url: string, info: ISetDialogReadRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handles client/mail/dialog/getAllAttachments + * @returns IGetAllAttachmentsResponse + */ getAllAttachments(url: string, info: IGetAllAttachmentsRequestData, sessionID: string): IGetBodyResponseData; listOutbox(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; listInbox(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; diff --git a/TypeScript/7OnLoadHook/types/callbacks/GameCallbacks.d.ts b/TypeScript/7OnLoadHook/types/callbacks/GameCallbacks.d.ts index 5e4c240..3a6b7e6 100644 --- a/TypeScript/7OnLoadHook/types/callbacks/GameCallbacks.d.ts +++ b/TypeScript/7OnLoadHook/types/callbacks/GameCallbacks.d.ts @@ -3,6 +3,9 @@ import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { ICheckVersionResponse } from "../models/eft/game/ICheckVersionResponse"; import { IGameConfigResponse } from "../models/eft/game/IGameConfigResponse"; import { IGameEmptyCrcRequestData } from "../models/eft/game/IGameEmptyCrcRequestData"; +import { IGameKeepAliveResponse } from "../models/eft/game/IGameKeepAliveResponse"; +import { IGameLogoutResponseData } from "../models/eft/game/IGameLogoutResponseData"; +import { IGameStartResponse } from "../models/eft/game/IGameStartResponse"; import { IReportNicknameRequestData } from "../models/eft/game/IReportNicknameRequestData"; import { IServerDetails } from "../models/eft/game/IServerDetails"; import { IVersionValidateRequestData } from "../models/eft/game/IVersionValidateRequestData"; @@ -15,13 +18,37 @@ declare class GameCallbacks { protected watermark: Watermark; protected gameController: GameController; constructor(httpResponse: HttpResponseUtil, watermark: Watermark, gameController: GameController); + /** + * Handle client/game/version/validate + * @returns INullResponseData + */ versionValidate(url: string, info: IVersionValidateRequestData, sessionID: string): INullResponseData; - gameStart(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - gameLogout(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/game/start + * @returns IGameStartResponse + */ + gameStart(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/game/logout + * @returns IGameLogoutResponseData + */ + gameLogout(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/game/config + * @returns IGameConfigResponse + */ getGameConfig(url: string, info: IGameEmptyCrcRequestData, sessionID: string): IGetBodyResponseData; getServer(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; validateGameVersion(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - gameKeepalive(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/game/keepalive + * @returns IGameKeepAliveResponse + */ + gameKeepalive(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle singleplayer/settings/version + * @returns string + */ getVersion(url: string, info: IEmptyRequestData, sessionID: string): string; reportNickname(url: string, info: IReportNicknameRequestData, sessionID: string): INullResponseData; } diff --git a/TypeScript/7OnLoadHook/types/callbacks/HealthCallbacks.d.ts b/TypeScript/7OnLoadHook/types/callbacks/HealthCallbacks.d.ts index 8672be7..7edf03e 100644 --- a/TypeScript/7OnLoadHook/types/callbacks/HealthCallbacks.d.ts +++ b/TypeScript/7OnLoadHook/types/callbacks/HealthCallbacks.d.ts @@ -21,7 +21,19 @@ export declare class HealthCallbacks { * @returns empty response, no data sent back to client */ syncHealth(url: string, info: ISyncHealthRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle Eat + * @returns IItemEventRouterResponse + */ offraidEat(pmcData: IPmcData, body: IOffraidEatRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle Heal + * @returns IItemEventRouterResponse + */ offraidHeal(pmcData: IPmcData, body: IOffraidHealRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle RestoreHealth + * @returns IItemEventRouterResponse + */ healthTreatment(pmcData: IPmcData, info: IHealthTreatmentRequestData, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/7OnLoadHook/types/callbacks/HideoutCallbacks.d.ts b/TypeScript/7OnLoadHook/types/callbacks/HideoutCallbacks.d.ts index 99ab4c9..e39e806 100644 --- a/TypeScript/7OnLoadHook/types/callbacks/HideoutCallbacks.d.ts +++ b/TypeScript/7OnLoadHook/types/callbacks/HideoutCallbacks.d.ts @@ -19,14 +19,77 @@ export declare class HideoutCallbacks extends OnUpdate { protected hideoutConfig: IHideoutConfig; constructor(hideoutController: HideoutController, // TODO: delay needed configServer: ConfigServer); + /** + * Handle HideoutUpgrade + * @param pmcData + * @param body + * @param sessionID + * @returns + */ upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutUpgradeComplete + * @param pmcData + * @param body + * @param sessionID + * @returns + */ upgradeComplete(pmcData: IPmcData, body: IHideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutPutItemsInAreaSlots + * @param pmcData + * @param body + * @param sessionID + * @returns + */ putItemsInAreaSlots(pmcData: IPmcData, body: IHideoutPutItemInRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutTakeItemsFromAreaSlots + * @param pmcData + * @param body + * @param sessionID + * @returns + */ takeItemsFromAreaSlots(pmcData: IPmcData, body: IHideoutTakeItemOutRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutToggleArea + * @param pmcData + * @param body + * @param sessionID + * @returns + */ toggleArea(pmcData: IPmcData, body: IHideoutToggleAreaRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutSingleProductionStart + * @param pmcData + * @param body + * @param sessionID + * @returns + */ singleProductionStart(pmcData: IPmcData, body: IHideoutSingleProductionStartRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutScavCaseProductionStart + * @param pmcData + * @param body + * @param sessionID + * @returns + */ scavCaseProductionStart(pmcData: IPmcData, body: IHideoutScavCaseStartRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutContinuousProductionStart + * @param pmcData + * @param body + * @param sessionID + * @returns + */ continuousProductionStart(pmcData: IPmcData, body: IHideoutContinousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutTakeProduction + * @param pmcData + * @param body + * @param sessionID + * @returns + */ takeProduction(pmcData: IPmcData, body: IHideoutTakeProductionRequestData, sessionID: string): IItemEventRouterResponse; onUpdate(timeSinceLastRun: number): boolean; getRoute(): string; diff --git a/TypeScript/7OnLoadHook/types/callbacks/InraidCallbacks.d.ts b/TypeScript/7OnLoadHook/types/callbacks/InraidCallbacks.d.ts index 05bcce4..918bfaf 100644 --- a/TypeScript/7OnLoadHook/types/callbacks/InraidCallbacks.d.ts +++ b/TypeScript/7OnLoadHook/types/callbacks/InraidCallbacks.d.ts @@ -1,23 +1,49 @@ import { InraidController } from "../controllers/InraidController"; -import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { INullResponseData } from "../models/eft/httpResponse/INullResponseData"; import { IRegisterPlayerRequestData } from "../models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; -import { IAirdropConfig } from "../models/spt/config/IAirdropConfig"; -import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; -import { ConfigServer } from "../servers/ConfigServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +/** + * Handle client requests + */ export declare class InraidCallbacks { protected inraidController: InraidController; protected httpResponse: HttpResponseUtil; - protected configServer: ConfigServer; - protected airdropConfig: IAirdropConfig; - protected inraidConfig: IInRaidConfig; - constructor(inraidController: InraidController, httpResponse: HttpResponseUtil, configServer: ConfigServer); + constructor(inraidController: InraidController, httpResponse: HttpResponseUtil); + /** + * Handle client/location/getLocalloot + * @param url + * @param info register player request + * @param sessionID Session id + * @returns Null http response + */ registerPlayer(url: string, info: IRegisterPlayerRequestData, sessionID: string): INullResponseData; + /** + * Handle raid/profile/save + * @param url + * @param info Save progress request + * @param sessionID Session id + * @returns Null http response + */ saveProgress(url: string, info: ISaveProgressRequestData, sessionID: string): INullResponseData; + /** + * Handle singleplayer/settings/raid/endstate + * @returns + */ getRaidEndState(): string; - getRaidMenuSettings(url: string, info: IEmptyRequestData, sessionID: string): string; - getWeaponDurability(url: string, info: any, sessionID: string): string; - getAirdropConfig(url: string, info: any, sessionID: string): string; + /** + * Handle singleplayer/settings/raid/menu + * @returns JSON as string + */ + getRaidMenuSettings(): string; + /** + * Handle singleplayer/settings/weapon/durability + * @returns + */ + getWeaponDurability(): string; + /** + * Handle singleplayer/airdrop/config + * @returns JSON as string + */ + getAirdropConfig(): string; } diff --git a/TypeScript/7OnLoadHook/types/callbacks/InsuranceCallbacks.d.ts b/TypeScript/7OnLoadHook/types/callbacks/InsuranceCallbacks.d.ts index 8835ba2..a171e1c 100644 --- a/TypeScript/7OnLoadHook/types/callbacks/InsuranceCallbacks.d.ts +++ b/TypeScript/7OnLoadHook/types/callbacks/InsuranceCallbacks.d.ts @@ -17,7 +17,15 @@ export declare class InsuranceCallbacks extends OnUpdate { protected configServer: ConfigServer; protected insuranceConfig: IInsuranceConfig; constructor(insuranceController: InsuranceController, insuranceService: InsuranceService, httpResponse: HttpResponseUtil, configServer: ConfigServer); + /** + * Handle client/insurance/items/list/cost + * @returns IGetInsuranceCostResponseData + */ getInsuranceCost(url: string, info: IGetInsuranceCostRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle Insure + * @returns IItemEventRouterResponse + */ insure(pmcData: IPmcData, body: IInsureRequestData, sessionID: string): IItemEventRouterResponse; onUpdate(secondsSinceLastRun: number): boolean; getRoute(): string; diff --git a/TypeScript/7OnLoadHook/types/callbacks/InventoryCallbacks.d.ts b/TypeScript/7OnLoadHook/types/callbacks/InventoryCallbacks.d.ts index 9ab1486..46bf6fd 100644 --- a/TypeScript/7OnLoadHook/types/callbacks/InventoryCallbacks.d.ts +++ b/TypeScript/7OnLoadHook/types/callbacks/InventoryCallbacks.d.ts @@ -16,6 +16,7 @@ import { IInventorySwapRequestData } from "../models/eft/inventory/IInventorySwa import { IInventoryTagRequestData } from "../models/eft/inventory/IInventoryTagRequestData"; import { IInventoryToggleRequestData } from "../models/eft/inventory/IInventoryToggleRequestData"; import { IInventoryTransferRequestData } from "../models/eft/inventory/IInventoryTransferRequestData"; +import { IOpenRandomLootContainerRequestData } from "../models/eft/inventory/IOpenRandomLootContainerRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; export declare class InventoryCallbacks { protected inventoryController: InventoryController; @@ -36,4 +37,5 @@ export declare class InventoryCallbacks { createMapMarker(pmcData: IPmcData, body: IInventoryCreateMarkerRequestData, sessionID: string): IItemEventRouterResponse; deleteMapMarker(pmcData: IPmcData, body: IInventoryDeleteMarkerRequestData, sessionID: string): IItemEventRouterResponse; editMapMarker(pmcData: IPmcData, body: IInventoryEditMarkerRequestData, sessionID: string): IItemEventRouterResponse; + openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/7OnLoadHook/types/callbacks/ItemEventCallbacks.d.ts b/TypeScript/7OnLoadHook/types/callbacks/ItemEventCallbacks.d.ts index f4f04f9..fbb0b5f 100644 --- a/TypeScript/7OnLoadHook/types/callbacks/ItemEventCallbacks.d.ts +++ b/TypeScript/7OnLoadHook/types/callbacks/ItemEventCallbacks.d.ts @@ -1,4 +1,5 @@ import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; +import { Warning } from "../models/eft/itemEvent/IItemEventRouterBase"; import { IItemEventRouterRequest } from "../models/eft/itemEvent/IItemEventRouterRequest"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { ItemEventRouter } from "../routers/ItemEventRouter"; @@ -8,4 +9,5 @@ export declare class ItemEventCallbacks { protected itemEventRouter: ItemEventRouter; constructor(httpResponse: HttpResponseUtil, itemEventRouter: ItemEventRouter); handleEvents(url: string, info: IItemEventRouterRequest, sessionID: string): IGetBodyResponseData; + protected getErrorCode(warnings: Warning[]): number; } diff --git a/TypeScript/7OnLoadHook/types/callbacks/MatchCallbacks.d.ts b/TypeScript/7OnLoadHook/types/callbacks/MatchCallbacks.d.ts index 2a92ef5..10fbc44 100644 --- a/TypeScript/7OnLoadHook/types/callbacks/MatchCallbacks.d.ts +++ b/TypeScript/7OnLoadHook/types/callbacks/MatchCallbacks.d.ts @@ -34,6 +34,10 @@ export declare class MatchCallbacks { serverAvailable(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData | IGetBodyResponseData; joinMatch(url: string, info: IJoinMatchRequestData, sessionID: string): IGetBodyResponseData; getMetrics(url: string, info: any, sessionID: string): IGetBodyResponseData; + /** + * Handle client/match/group/status + * @returns + */ getGroupStatus(url: string, info: IGetGroupStatusRequestData, sessionID: string): IGetBodyResponseData; createGroup(url: string, info: ICreateGroupRequestData, sessionID: string): IGetBodyResponseData; deleteGroup(url: string, info: any, sessionID: string): INullResponseData; diff --git a/TypeScript/7OnLoadHook/types/callbacks/NotifierCallbacks.d.ts b/TypeScript/7OnLoadHook/types/callbacks/NotifierCallbacks.d.ts index c42058f..fab325b 100644 --- a/TypeScript/7OnLoadHook/types/callbacks/NotifierCallbacks.d.ts +++ b/TypeScript/7OnLoadHook/types/callbacks/NotifierCallbacks.d.ts @@ -4,6 +4,7 @@ import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { INotifierChannel } from "../models/eft/notifier/INotifier"; import { ISelectProfileRequestData } from "../models/eft/notifier/ISelectProfileRequestData"; +import { ISelectProfileResponse } from "../models/eft/notifier/ISelectProfileResponse"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; export declare class NotifierCallbacks { protected httpServerHelper: HttpServerHelper; @@ -19,6 +20,10 @@ export declare class NotifierCallbacks { sendNotification(sessionID: string, req: any, resp: any, data: any): void; getNotifier(url: string, info: any, sessionID: string): IGetBodyResponseData; createNotifierChannel(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - selectProfile(url: string, info: ISelectProfileRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/game/profile/select + * @returns ISelectProfileResponse + */ + selectProfile(url: string, info: ISelectProfileRequestData, sessionID: string): IGetBodyResponseData; notify(url: string, info: any, sessionID: string): string; } diff --git a/TypeScript/7OnLoadHook/types/callbacks/QuestCallbacks.d.ts b/TypeScript/7OnLoadHook/types/callbacks/QuestCallbacks.d.ts index 559c29e..2a3eb20 100644 --- a/TypeScript/7OnLoadHook/types/callbacks/QuestCallbacks.d.ts +++ b/TypeScript/7OnLoadHook/types/callbacks/QuestCallbacks.d.ts @@ -21,6 +21,13 @@ export declare class QuestCallbacks { acceptQuest(pmcData: IPmcData, body: IAcceptQuestRequestData, sessionID: string): IItemEventRouterResponse; completeQuest(pmcData: IPmcData, body: ICompleteQuestRequestData, sessionID: string): IItemEventRouterResponse; handoverQuest(pmcData: IPmcData, body: IHandoverQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle client/quest/list + * @param url + * @param info + * @param sessionID + * @returns + */ listQuests(url: string, info: IListQuestsRequestData, sessionID: string): IGetBodyResponseData; activityPeriods(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; } diff --git a/TypeScript/7OnLoadHook/types/callbacks/RagfairCallbacks.d.ts b/TypeScript/7OnLoadHook/types/callbacks/RagfairCallbacks.d.ts index c609f2f..37f3807 100644 --- a/TypeScript/7OnLoadHook/types/callbacks/RagfairCallbacks.d.ts +++ b/TypeScript/7OnLoadHook/types/callbacks/RagfairCallbacks.d.ts @@ -35,7 +35,7 @@ export declare class RagfairCallbacks extends OnLoadOnUpdate { getRoute(): string; search(url: string, info: ISearchRequestData, sessionID: string): IGetBodyResponseData; getMarketPrice(url: string, info: IGetMarketPriceRequestData, sessionID: string): IGetBodyResponseData; - getItemPrices(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + getItemPrices(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData>; addOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; removeOffer(pmcData: IPmcData, info: IRemoveOfferRequestData, sessionID: string): IItemEventRouterResponse; extendOffer(pmcData: IPmcData, info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; diff --git a/TypeScript/7OnLoadHook/types/callbacks/TraderCallbacks.d.ts b/TypeScript/7OnLoadHook/types/callbacks/TraderCallbacks.d.ts index e4fd099..40a1455 100644 --- a/TypeScript/7OnLoadHook/types/callbacks/TraderCallbacks.d.ts +++ b/TypeScript/7OnLoadHook/types/callbacks/TraderCallbacks.d.ts @@ -12,6 +12,10 @@ export declare class TraderCallbacks extends OnLoadOnUpdate { onUpdate(): boolean; getRoute(): string; getTraderSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/trading/api/getUserAssortPrice/trader + * @returns + */ getProfilePurchases(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData>; getTrader(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getAssort(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; diff --git a/TypeScript/7OnLoadHook/types/callbacks/WeatherCallbacks.d.ts b/TypeScript/7OnLoadHook/types/callbacks/WeatherCallbacks.d.ts index ae784c8..f9d2002 100644 --- a/TypeScript/7OnLoadHook/types/callbacks/WeatherCallbacks.d.ts +++ b/TypeScript/7OnLoadHook/types/callbacks/WeatherCallbacks.d.ts @@ -1,10 +1,15 @@ import { WeatherController } from "../controllers/WeatherController"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; +import { IWeatherData } from "../models/eft/weather/IWeatherData"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; export declare class WeatherCallbacks { protected httpResponse: HttpResponseUtil; protected weatherController: WeatherController; constructor(httpResponse: HttpResponseUtil, weatherController: WeatherController); - getWeather(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/weather + * @returns IWeatherData + */ + getWeather(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; } diff --git a/TypeScript/7OnLoadHook/types/context/ContextVariableType.d.ts b/TypeScript/7OnLoadHook/types/context/ContextVariableType.d.ts index 5fc1704..a7dd9b5 100644 --- a/TypeScript/7OnLoadHook/types/context/ContextVariableType.d.ts +++ b/TypeScript/7OnLoadHook/types/context/ContextVariableType.d.ts @@ -1,4 +1,8 @@ export declare enum ContextVariableType { + /** Logged in users session id */ SESSION_ID = 0, - MATCH_INFO = 1 + /** Currently acive raid information */ + MATCH_INFO = 1, + /** Timestamp when client first connected */ + CLIENT_START_TIMESTAMP = 2 } diff --git a/TypeScript/7OnLoadHook/types/controllers/BotController.d.ts b/TypeScript/7OnLoadHook/types/controllers/BotController.d.ts index a5111d5..92317c3 100644 --- a/TypeScript/7OnLoadHook/types/controllers/BotController.d.ts +++ b/TypeScript/7OnLoadHook/types/controllers/BotController.d.ts @@ -1,6 +1,8 @@ import { ApplicationContext } from "../context/ApplicationContext"; import { BotGenerator } from "../generators/BotGenerator"; +import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { IGenerateBotsRequestData } from "../models/eft/bot/IGenerateBotsRequestData"; import { IBotBase } from "../models/eft/common/tables/IBotBase"; import { IBotCore } from "../models/eft/common/tables/IBotCore"; @@ -10,18 +12,23 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; -import { PmcAiService } from "../services/PmcAiService"; +import { LocalisationService } from "../services/LocalisationService"; +import { JsonUtil } from "../utils/JsonUtil"; export declare class BotController { protected logger: ILogger; protected databaseServer: DatabaseServer; protected botGenerator: BotGenerator; protected botHelper: BotHelper; - protected pmcAiService: PmcAiService; + protected botDifficultyHelper: BotDifficultyHelper; protected botGenerationCacheService: BotGenerationCacheService; + protected localisationService: LocalisationService; + protected weightedRandomHelper: WeightedRandomHelper; protected configServer: ConfigServer; protected applicationContext: ApplicationContext; + protected jsonUtil: JsonUtil; protected botConfig: IBotConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, pmcAiService: PmcAiService, botGenerationCacheService: BotGenerationCacheService, configServer: ConfigServer, applicationContext: ApplicationContext); + static readonly pmcTypeLabel = "PMC"; + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); /** * Return the number of bot loadout varieties to be generated * @param type bot Type we want the loadout gen count for @@ -37,7 +44,6 @@ export declare class BotController { * @returns Difficulty object */ getBotDifficulty(type: string, difficulty: string): Difficulty; - protected getPmcDifficultySettings(pmcType: "bear" | "usec", difficulty: string, usecType: string, bearType: string): Difficulty; /** * Generate bot profiles and store in cache * @param sessionId Session id @@ -51,4 +57,5 @@ export declare class BotController { * @returns cap number */ getBotCap(): number; + getPmcBotTypes(): Record>>; } diff --git a/TypeScript/7OnLoadHook/types/controllers/DialogueController.d.ts b/TypeScript/7OnLoadHook/types/controllers/DialogueController.d.ts index 1b72522..9c8b728 100644 --- a/TypeScript/7OnLoadHook/types/controllers/DialogueController.d.ts +++ b/TypeScript/7OnLoadHook/types/controllers/DialogueController.d.ts @@ -23,7 +23,7 @@ export declare class DialogueController { * Get the content of a dialogue * @param dialogueID Dialog id * @param sessionID Session Id - * @returns + * @returns DialogueInfo */ getDialogueInfo(dialogueID: string, sessionID: string): DialogueInfo; /** diff --git a/TypeScript/7OnLoadHook/types/controllers/GameController.d.ts b/TypeScript/7OnLoadHook/types/controllers/GameController.d.ts index 3bfbdb1..f4f5849 100644 --- a/TypeScript/7OnLoadHook/types/controllers/GameController.d.ts +++ b/TypeScript/7OnLoadHook/types/controllers/GameController.d.ts @@ -1,3 +1,4 @@ +import { ApplicationContext } from "../context/ApplicationContext"; import { GameEventHelper } from "../helpers/GameEventHelper"; import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; @@ -14,6 +15,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; +import { LocalisationService } from "../services/LocalisationService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { Watermark } from "../utils/Watermark"; export declare class GameController { @@ -24,14 +26,33 @@ export declare class GameController { protected localeService: LocaleService; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; + protected localisationService: LocalisationService; protected gameEventHelper: GameEventHelper; + protected applicationContext: ApplicationContext; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; protected coreConfig: ICoreConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, gameEventHelper: GameEventHelper, configServer: ConfigServer); - gameStart(_url: string, _info: IEmptyRequestData, sessionID: string): void; + constructor(logger: ILogger, databaseServer: DatabaseServer, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, gameEventHelper: GameEventHelper, applicationContext: ApplicationContext, configServer: ConfigServer); + gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; + /** + * Check if current date falls inside any of the seasons events pased in, if so, handle them + * @param seasonalEvents events to check for + */ protected checkForAndEnableSeasonalEvents(seasonalEvents: ISeasonalEvent[]): void; + /** + * Make adjusted to server code based on the name of the event passed in + * @param globalConfig globals.json + * @param eventName Name of the event to enable. e.g. Christmas + */ protected updateGlobalEvents(globalConfig: Config, eventName: string): void; + /** + * Read in data from seasonalEvents.json and add found equipment items to bots + * @param eventName Name of the event to read equipment in from config + */ + protected addEventGearToScavs(eventName: string): void; + /** + * Set Khorovod(dancing tree) chance to 100% on all maps that support it + */ protected enableDancingTree(): void; /** * Make non-trigger-spawned raiders spawn earlier + always @@ -40,5 +61,6 @@ export declare class GameController { protected logProfileDetails(fullProfile: IAkiProfile): void; getGameConfig(sessionID: string): IGameConfigResponse; getServer(): IServerDetails[]; + protected addPumpkinsToScavBackpacks(): void; getValidGameVersion(): ICheckVersionResponse; } diff --git a/TypeScript/7OnLoadHook/types/controllers/HideoutController.d.ts b/TypeScript/7OnLoadHook/types/controllers/HideoutController.d.ts index ada5bd9..5b6507b 100644 --- a/TypeScript/7OnLoadHook/types/controllers/HideoutController.d.ts +++ b/TypeScript/7OnLoadHook/types/controllers/HideoutController.d.ts @@ -23,12 +23,13 @@ import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; import { PlayerService } from "../services/PlayerService"; import { HashUtil } from "../utils/HashUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; -import { JsonUtil } from "../utils/JsonUtil"; export declare class HideoutController { protected logger: ILogger; protected hashUtil: HashUtil; @@ -45,11 +46,12 @@ export declare class HideoutController { protected profileHelper: ProfileHelper; protected hideoutHelper: HideoutHelper; protected scavCaseRewardGenerator: ScavCaseRewardGenerator; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected jsonUtil: JsonUtil; protected static nameBackendCountersCrafting: string; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, configServer: ConfigServer, jsonUtil: JsonUtil); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, localisationService: LocalisationService, configServer: ConfigServer, jsonUtil: JsonUtil); upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; upgradeComplete(pmcData: IPmcData, body: HideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; /** diff --git a/TypeScript/7OnLoadHook/types/controllers/InraidController.d.ts b/TypeScript/7OnLoadHook/types/controllers/InraidController.d.ts index e84eea1..39a6396 100644 --- a/TypeScript/7OnLoadHook/types/controllers/InraidController.d.ts +++ b/TypeScript/7OnLoadHook/types/controllers/InraidController.d.ts @@ -6,6 +6,7 @@ import { ProfileHelper } from "../helpers/ProfileHelper"; import { QuestHelper } from "../helpers/QuestHelper"; import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; +import { Item } from "../models/eft/common/tables/IItem"; import { IRegisterPlayerRequestData } from "../models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; import { IAirdropConfig } from "../models/spt/config/IAirdropConfig"; @@ -17,6 +18,9 @@ import { SaveServer } from "../servers/SaveServer"; import { InsuranceService } from "../services/InsuranceService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; +/** + * Logic for handling In Raid callbacks + */ export declare class InraidController { protected logger: ILogger; protected saveServer: SaveServer; @@ -35,14 +39,42 @@ export declare class InraidController { protected airdropConfig: IAirdropConfig; protected inraidConfig: IInRaidConfig; 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 + * Save locationid to active profiles inraid object + * @param sessionID Session id + * @param info Register player request + */ + addPlayer(sessionID: string, info: IRegisterPlayerRequestData): void; + /** + * Save profile state to disk + * Handles pmc/pscav + * @param offraidData post-raid request data + * @param sessionID Session id + */ + savePostRaidProgress(offraidData: ISaveProgressRequestData, sessionID: string): void; + /** + * Handle updating player profile post-pmc raid * @param sessionID session id - * @param offraidData post-raid data of raid + * @param offraidData post-raid data */ protected savePmcProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; + /** + * Make changes to pmc profile after they left raid dead, + * alter bodypart hp, handle insurance, delete inventory items, remove carried quest items + * @param postRaidSaveRequest post-raid save request + * @param pmcData pmc profile + * @param insuranceEnabled is insurance enabled + * @param preRaidGear gear player had before raid + * @param sessionID Session id + * @returns Updated profile object + */ + protected performPostRaidActionsWhenDead(postRaidSaveRequest: ISaveProgressRequestData, pmcData: IPmcData, insuranceEnabled: boolean, preRaidGear: Item[], sessionID: string): IPmcData; + /** + * Adjust player characters bodypart hp if they left raid early + * @param postRaidSaveRequest post raid data + * @param pmcData player profile + */ + protected updatePmcHealthPostRaid(postRaidSaveRequest: ISaveProgressRequestData, pmcData: IPmcData): void; /** * Reduce body part hp to % of max * @param pmcData profile to edit @@ -68,7 +100,31 @@ export declare class InraidController { * @param isPlayerScav Was the player a pScav */ protected markOrRemoveFoundInRaidItems(offraidData: ISaveProgressRequestData, pmcData: IPmcData, isPlayerScav: boolean): void; + /** + * Update profile after player completes scav raid + * @param scavData Scav profile + * @param sessionID Session id + * @param offraidData Post-raid save request + * @param pmcData Pmc profile + * @param isDead Is player dead + */ protected handlePostRaidPlayerScavProcess(scavData: IPmcData, sessionID: string, offraidData: ISaveProgressRequestData, pmcData: IPmcData, isDead: boolean): void; + /** + * Update profile with scav karma values based on in-raid actions + * @param pmcData Pmc profile + * @param offraidData Post-raid save request + * @param scavData Scav profile + * @param sessionID Session id + */ protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData, scavData: IPmcData, sessionID: string): void; + /** + * Get the inraid config from configs/inraid.json + * @returns InRaid Config + */ + getInraidConfig(): IInRaidConfig; + /** + * Get airdrop config from configs/airdrop.json + * @returns Airdrop config + */ getAirdropConfig(): IAirdropConfig; } diff --git a/TypeScript/7OnLoadHook/types/controllers/InsuranceController.d.ts b/TypeScript/7OnLoadHook/types/controllers/InsuranceController.d.ts index 14bf129..54f31b5 100644 --- a/TypeScript/7OnLoadHook/types/controllers/InsuranceController.d.ts +++ b/TypeScript/7OnLoadHook/types/controllers/InsuranceController.d.ts @@ -30,8 +30,7 @@ export declare class InsuranceController { protected insuranceService: InsuranceService; protected configServer: ConfigServer; protected insuranceConfig: IInsuranceConfig; - constructor(logger: ILogger, randomUtil: RandomUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, paymentService: PaymentService, // TODO: delay required - insuranceService: InsuranceService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, paymentService: PaymentService, insuranceService: InsuranceService, configServer: ConfigServer); processReturn(): void; insure(pmcData: IPmcData, body: IInsureRequestData, sessionID: string): IItemEventRouterResponse; /** diff --git a/TypeScript/7OnLoadHook/types/controllers/InventoryController.d.ts b/TypeScript/7OnLoadHook/types/controllers/InventoryController.d.ts index 6a1a21e..e1c08c0 100644 --- a/TypeScript/7OnLoadHook/types/controllers/InventoryController.d.ts +++ b/TypeScript/7OnLoadHook/types/controllers/InventoryController.d.ts @@ -1,8 +1,8 @@ -import { EventOutputHolder } from "../routers/EventOutputHolder"; import { InventoryHelper } from "../helpers/InventoryHelper"; import { PaymentHelper } from "../helpers/PaymentHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IAddItemRequestData } from "../models/eft/inventory/IAddItemRequestData"; import { IInventoryBindRequestData } from "../models/eft/inventory/IInventoryBindRequestData"; @@ -21,33 +21,46 @@ import { IInventorySwapRequestData } from "../models/eft/inventory/IInventorySwa import { IInventoryTagRequestData } from "../models/eft/inventory/IInventoryTagRequestData"; import { IInventoryToggleRequestData } from "../models/eft/inventory/IInventoryToggleRequestData"; import { IInventoryTransferRequestData } from "../models/eft/inventory/IInventoryTransferRequestData"; +import { IOpenRandomLootContainerRequestData } from "../models/eft/inventory/IOpenRandomLootContainerRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { ILogger } from "../models/spt/utils/ILogger"; +import { EventOutputHolder } from "../routers/EventOutputHolder"; import { DatabaseServer } from "../servers/DatabaseServer"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { HashUtil } from "../utils/HashUtil"; +import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { JsonUtil } from "../utils/JsonUtil"; +import { RandomUtil } from "../utils/RandomUtil"; export declare class InventoryController { protected logger: ILogger; protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; + protected randomUtil: RandomUtil; protected databaseServer: DatabaseServer; protected fenceService: FenceService; protected presetHelper: PresetHelper; protected inventoryHelper: InventoryHelper; protected ragfairOfferService: RagfairOfferService; protected profileHelper: ProfileHelper; + protected weightedRandomHelper: WeightedRandomHelper; protected paymentHelper: PaymentHelper; + protected localisationService: LocalisationService; protected eventOutputHolder: EventOutputHolder; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder); + protected httpResponseUtil: HttpResponseUtil; + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, weightedRandomHelper: WeightedRandomHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); /** * Move Item * change location of item with parentId and slotId * transfers items from one profile to another if fromOwner/toOwner is set in the body. * otherwise, move is contained within the same profile_f. - */ - moveItem(pmcData: IPmcData, body: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; + * @param pmcData Profile + * @param moveRequest Move request data + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ + moveItem(pmcData: IPmcData, moveRequest: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; /** * Remove Item from Profile * Deep tree item deletion, also removes items from insurance list @@ -122,4 +135,12 @@ export declare class InventoryController { createMapMarker(pmcData: IPmcData, body: IInventoryCreateMarkerRequestData, sessionID: string): IItemEventRouterResponse; deleteMapMarker(pmcData: IPmcData, body: IInventoryDeleteMarkerRequestData, sessionID: string): IItemEventRouterResponse; editMapMarker(pmcData: IPmcData, body: IInventoryEditMarkerRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle event fired when a container is unpacked (currently only the halloween pumpkin) + * @param pmcData Profile data + * @param body open loot container request data + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ + openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/7OnLoadHook/types/controllers/LocationController.d.ts b/TypeScript/7OnLoadHook/types/controllers/LocationController.d.ts index 9db3205..b6feba8 100644 --- a/TypeScript/7OnLoadHook/types/controllers/LocationController.d.ts +++ b/TypeScript/7OnLoadHook/types/controllers/LocationController.d.ts @@ -7,6 +7,7 @@ import { LootItem } from "../models/spt/services/LootItem"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -15,12 +16,13 @@ export declare class LocationController { protected hashUtil: HashUtil; protected logger: ILogger; protected locationGenerator: LocationGenerator; + protected localisationService: LocalisationService; protected lootGenerator: LootGenerator; protected databaseServer: DatabaseServer; protected timeUtil: TimeUtil; protected configServer: ConfigServer; protected airdropConfig: IAirdropConfig; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, logger: ILogger, locationGenerator: LocationGenerator, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer); + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer); get(location: string): ILocationBase; generate(name: string): ILocationBase; generateAll(): ILocationsGenerateAllResponse; diff --git a/TypeScript/7OnLoadHook/types/controllers/MatchController.d.ts b/TypeScript/7OnLoadHook/types/controllers/MatchController.d.ts index dac6a3f..2b0d150 100644 --- a/TypeScript/7OnLoadHook/types/controllers/MatchController.d.ts +++ b/TypeScript/7OnLoadHook/types/controllers/MatchController.d.ts @@ -19,7 +19,6 @@ import { SaveServer } from "../servers/SaveServer"; import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; import { BotLootCacheService } from "../services/BotLootCacheService"; import { MatchLocationService } from "../services/MatchLocationService"; -import { PmcAiService } from "../services/PmcAiService"; import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; export declare class MatchController { protected logger: ILogger; @@ -30,13 +29,12 @@ export declare class MatchController { protected botLootCacheService: BotLootCacheService; protected configServer: ConfigServer; protected profileSnapshotService: ProfileSnapshotService; - protected pmcAiService: PmcAiService; protected botGenerationCacheService: BotGenerationCacheService; 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, pmcAiService: PmcAiService, botGenerationCacheService: BotGenerationCacheService, applicationContext: ApplicationContext); + constructor(logger: ILogger, saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, botGenerationCacheService: BotGenerationCacheService, applicationContext: ApplicationContext); getEnabled(): boolean; getProfile(info: IGetProfileRequestData): IPmcData[]; createGroup(sessionID: string, info: ICreateGroupRequestData): any; diff --git a/TypeScript/7OnLoadHook/types/controllers/RagfairController.d.ts b/TypeScript/7OnLoadHook/types/controllers/RagfairController.d.ts index 5440458..95702f2 100644 --- a/TypeScript/7OnLoadHook/types/controllers/RagfairController.d.ts +++ b/TypeScript/7OnLoadHook/types/controllers/RagfairController.d.ts @@ -29,6 +29,7 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { RagfairServer } from "../servers/RagfairServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; import { PaymentService } from "../services/PaymentService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { RagfairPriceService } from "../services/RagfairPriceService"; @@ -62,9 +63,10 @@ export declare class RagfairController { protected ragfairOfferService: RagfairOfferService; protected ragfairRequiredItemsService: RagfairRequiredItemsService; protected ragfairOfferGenerator: RagfairOfferGenerator; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, eventOutputHolder: EventOutputHolder, ragfairServer: RagfairServer, ragfairPriceService: RagfairPriceService, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer, ragfairSellHelper: RagfairSellHelper, ragfairTaxHelper: RagfairTaxHelper, ragfairSortHelper: RagfairSortHelper, ragfairOfferHelper: RagfairOfferHelper, profileHelper: ProfileHelper, paymentService: PaymentService, handbookHelper: HandbookHelper, paymentHelper: PaymentHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, ragfairOfferGenerator: RagfairOfferGenerator, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, eventOutputHolder: EventOutputHolder, ragfairServer: RagfairServer, ragfairPriceService: RagfairPriceService, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer, ragfairSellHelper: RagfairSellHelper, ragfairTaxHelper: RagfairTaxHelper, ragfairSortHelper: RagfairSortHelper, ragfairOfferHelper: RagfairOfferHelper, profileHelper: ProfileHelper, paymentService: PaymentService, handbookHelper: HandbookHelper, paymentHelper: PaymentHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, ragfairOfferGenerator: RagfairOfferGenerator, localisationService: LocalisationService, configServer: ConfigServer); getOffers(sessionID: string, info: ISearchRequestData): IGetOffersResult; /** * Get offers for the client based on type of search being performed @@ -103,7 +105,12 @@ export declare class RagfairController { protected isLinkedSearch(info: ISearchRequestData): boolean; protected isRequiredSearch(info: ISearchRequestData): boolean; update(): void; - getItemPrice(info: IGetMarketPriceRequestData): IGetItemPriceResult; + /** + * Called when creating an offer on flea, fills values in top right corner + * @param getPriceRequest + * @returns min/avg/max values for an item based on flea offers available + */ + getItemMinAvgMaxFleaPriceValues(getPriceRequest: IGetMarketPriceRequestData): IGetItemPriceResult; addPlayerOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; createPlayerOffer(profile: IAkiProfile, requirements: Requirement[], items: Item[], sellInOnePiece: boolean, amountToSend: number): IRagfairOffer; getAllFleaPrices(): Record; diff --git a/TypeScript/7OnLoadHook/types/controllers/RepeatableQuestController.d.ts b/TypeScript/7OnLoadHook/types/controllers/RepeatableQuestController.d.ts index 7db5886..333583b 100644 --- a/TypeScript/7OnLoadHook/types/controllers/RepeatableQuestController.d.ts +++ b/TypeScript/7OnLoadHook/types/controllers/RepeatableQuestController.d.ts @@ -17,6 +17,7 @@ import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { ItemFilterService } from "../services/ItemFilterService"; +import { LocalisationService } from "../services/LocalisationService"; import { PaymentService } from "../services/PaymentService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { JsonUtil } from "../utils/JsonUtil"; @@ -64,12 +65,13 @@ export declare class RepeatableQuestController { protected profileFixerService: ProfileFixerService; protected ragfairServerHelper: RagfairServerHelper; protected eventOutputHolder: EventOutputHolder; + protected localisationService: LocalisationService; protected paymentService: PaymentService; protected objectId: ObjectId; protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * This is the method reached by the /client/repeatalbeQuests/activityPeriods endpoint * Returns an array of objects in the format of repeatable quests to the client. diff --git a/TypeScript/7OnLoadHook/types/controllers/WeatherController.d.ts b/TypeScript/7OnLoadHook/types/controllers/WeatherController.d.ts index ca7f5eb..631a90c 100644 --- a/TypeScript/7OnLoadHook/types/controllers/WeatherController.d.ts +++ b/TypeScript/7OnLoadHook/types/controllers/WeatherController.d.ts @@ -1,11 +1,18 @@ import { WeatherGenerator } from "../generators/WeatherGenerator"; import { IWeatherData } from "../models/eft/weather/IWeatherData"; import { IWeatherConfig } from "../models/spt/config/IWeatherConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; export declare class WeatherController { protected weatherGenerator: WeatherGenerator; + protected logger: ILogger; protected configServer: ConfigServer; protected weatherConfig: IWeatherConfig; - constructor(weatherGenerator: WeatherGenerator, configServer: ConfigServer); + constructor(weatherGenerator: WeatherGenerator, logger: ILogger, configServer: ConfigServer); generate(): IWeatherData; + /** + * Get the current in-raid time (MUST HAVE PLAYER LOGGED INTO CLIENT TO WORK) + * @returns Date object + */ + getCurrentInRaidTime(): Date; } diff --git a/TypeScript/7OnLoadHook/types/generators/BotGenerator.d.ts b/TypeScript/7OnLoadHook/types/generators/BotGenerator.d.ts index 2ac51db..a1ac9ed 100644 --- a/TypeScript/7OnLoadHook/types/generators/BotGenerator.d.ts +++ b/TypeScript/7OnLoadHook/types/generators/BotGenerator.d.ts @@ -1,7 +1,8 @@ +import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; import { GameEventHelper } from "../helpers/GameEventHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; -import { IGenerateBotsRequestData } from "../models/eft/bot/IGenerateBotsRequestData"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { Health as PmcHealth, IBotBase, Skills } from "../models/eft/common/tables/IBotBase"; import { Health, IBotType, Inventory } from "../models/eft/common/tables/IBotType"; import { IBotConfig } from "../models/spt/config/IBotConfig"; @@ -9,7 +10,6 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; -import { PmcAiService } from "../services/PmcAiService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; @@ -29,12 +29,13 @@ export declare class BotGenerator { protected databaseServer: DatabaseServer; protected botInventoryGenerator: BotInventoryGenerator; protected botEquipmentFilterService: BotEquipmentFilterService; + protected weightedRandomHelper: WeightedRandomHelper; protected botHelper: BotHelper; + protected botDifficultyHelper: BotDifficultyHelper; protected gameEventHelper: GameEventHelper; - protected pmcAiService: PmcAiService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botEquipmentFilterService: BotEquipmentFilterService, botHelper: BotHelper, gameEventHelper: GameEventHelper, pmcAiService: PmcAiService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botEquipmentFilterService: BotEquipmentFilterService, weightedRandomHelper: WeightedRandomHelper, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, gameEventHelper: GameEventHelper, configServer: ConfigServer); /** * Generate a player scav bot object * @param role e.g. assault / pmcbot @@ -44,12 +45,18 @@ export declare class BotGenerator { */ generatePlayerScav(sessionId: string, role: string, difficulty: string, botTemplate: IBotType): IBotBase; /** - * Generate an array of bot objects for populate a raid with + * Generate an array of bot objects based on a condition for a raid with * @param sessionId session id - * @param info request object + * @param condition request condition * @returns bot array */ - generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; + generateByCondition(sessionId: string, botCountToGenerate: number, difficulty: string, role: string, isPmc: boolean): IBotBase[]; + /** + * Get the PMCs wildSpawnType value + * @param role "usec" / "bear" + * @returns wildSpawnType value as string + */ + protected getPmcRoleByDescription(role: string): string; /** * Get a randomised PMC side based on bot config value 'isUsec' * @returns pmc side as string @@ -64,13 +71,13 @@ export declare class BotGenerator { * Create a IBotBase object with equipment/loot/exp etc * @param sessionId Session id * @param bot bots base file - * @param role botRole bot will use + * @param botRole Role bot will use (bear/usec for PMCs) * @param node Bot template from db/bots/x.json * @param isPmc Is bot to be a PMC * @param isPlayerScav is bot to be a p scav bot * @returns IBotBase object */ - protected generateBot(sessionId: string, bot: IBotBase, role: string, node: IBotType, isPmc: boolean, isPlayerScav?: boolean): IBotBase; + protected generateBot(sessionId: string, bot: IBotBase, botRole: string, node: IBotType, isPmc: boolean, isPlayerScav?: boolean): IBotBase; /** * Log the number of PMCs generated to the debug console * @param output Generated bot array, ready to send to client diff --git a/TypeScript/7OnLoadHook/types/generators/BotInventoryGenerator.d.ts b/TypeScript/7OnLoadHook/types/generators/BotInventoryGenerator.d.ts index c5ed545..e1efaf2 100644 --- a/TypeScript/7OnLoadHook/types/generators/BotInventoryGenerator.d.ts +++ b/TypeScript/7OnLoadHook/types/generators/BotInventoryGenerator.d.ts @@ -7,6 +7,7 @@ import { IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { BotLootGenerator } from "./BotLootGenerator"; @@ -20,14 +21,68 @@ export declare class BotInventoryGenerator { protected botLootGenerator: BotLootGenerator; protected botGeneratorHelper: BotGeneratorHelper; protected weightedRandomHelper: WeightedRandomHelper; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, configServer: ConfigServer); + /** + * Add equipment/weapons/loot to bot + * @param sessionId Session id + * @param templateInventory bot/x.json data from db + * @param equipmentChances Chances each item will be added to bot + * @param itemGenerationLimitsMinMax item gen limits for bot role + * @param botRole Role bot has (assault/pmcBot) + * @param isPmc Is bot being converted into a pmc + * @returns PmcInventory object with equipment/weapons/loot + */ generateInventory(sessionId: string, templateInventory: Inventory, equipmentChances: Chances, itemGenerationLimitsMinMax: Generation, botRole: string, isPmc: boolean): PmcInventory; + /** + * Create a pmcInventory object with all the base/generic items needed + * @returns PmcInventory object + */ + protected generateInventoryBase(): PmcInventory; + /** + * Add equipment to a bot + * @param templateInventory bot/x.json data from db + * @param equipmentChances Chances items will be added to bot + * @param botRole Role bot has (assault/pmcBot) + * @param botInventory Inventory to add equipment to + */ + protected generateAndAddEquipmentToBot(templateInventory: Inventory, equipmentChances: Chances, botRole: string, botInventory: PmcInventory): void; + protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory): void; + /** + * Work out what weapons bot should have equipped and add them to bot inventory + * @param templateInventory bot/x.json data from db + * @param equipmentChances Chances bot can have equipment equipped + * @param sessionId Session id + * @param botInventory Inventory to add weapons to + * @param botRole assault/pmcBot/bossTagilla etc + * @param isPmc Is the bot being generated as a pmc + * @param itemGenerationLimitsMinMax Limits for items the bot can have + */ + protected generateAndAddWeaponsToBot(templateInventory: Inventory, equipmentChances: Chances, sessionId: string, botInventory: PmcInventory, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation): void; + /** + * Calculate if the bot should have weapons in Primary/Secondary/Holster slots + * @param equipmentChances Chances bot has certain equipment + * @returns What slots bot should have weapons generated for + */ + protected getDesiredWeaponsForBot(equipmentChances: Chances): { + slot: EquipmentSlots; + shouldSpawn: boolean; + }[]; + /** + * Add weapon + spare mags/ammo to bots inventory + * @param sessionId Session id + * @param weaponSlot Weapon slot being generated + * @param templateInventory bot/x.json data from db + * @param botInventory Inventory to add weapon+mags/ammo to + * @param equipmentChances Chances bot can have equipment equipped + * @param botRole assault/pmcBot/bossTagilla etc + * @param isPmc Is the bot being generated as a pmc + * @param itemGenerationLimitsMinMax + */ protected addWeaponAndMagazinesToInventory(sessionId: string, weaponSlot: { slot: EquipmentSlots; shouldSpawn: boolean; }, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation): void; - protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory): void; - protected generateInventoryBase(): PmcInventory; } diff --git a/TypeScript/7OnLoadHook/types/generators/BotLootGenerator.d.ts b/TypeScript/7OnLoadHook/types/generators/BotLootGenerator.d.ts index c1f5310..3352a46 100644 --- a/TypeScript/7OnLoadHook/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/7OnLoadHook/types/generators/BotLootGenerator.d.ts @@ -10,6 +10,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotLootCacheService } from "../services/BotLootCacheService"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { BotWeaponGenerator } from "./BotWeaponGenerator"; @@ -23,9 +24,10 @@ export declare class BotLootGenerator { protected botWeaponGenerator: BotWeaponGenerator; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected botLootCacheService: BotLootCacheService; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, configServer: ConfigServer); generateLoot(sessionId: string, templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances): void; protected getRandomisedCount(min: number, max: number, nValue: number): number; /** @@ -113,7 +115,7 @@ export declare class BotLootGenerator { * If no limit found for a non pmc bot, fall back to defaults * @param isPmc is the bot we want limits for a pmc * @param botRole what role does the bot have - * @returns dictionary of tplIds and limit + * @returns Dictionary of tplIds and limit */ protected getItemSpawnLimitsForBotType(isPmc: boolean, botRole: string): Record; /** diff --git a/TypeScript/7OnLoadHook/types/generators/BotWeaponGenerator.d.ts b/TypeScript/7OnLoadHook/types/generators/BotWeaponGenerator.d.ts index 487901b..40284ea 100644 --- a/TypeScript/7OnLoadHook/types/generators/BotWeaponGenerator.d.ts +++ b/TypeScript/7OnLoadHook/types/generators/BotWeaponGenerator.d.ts @@ -12,6 +12,7 @@ import { IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; @@ -27,10 +28,11 @@ export declare class BotWeaponGenerator { protected randomUtil: RandomUtil; protected configServer: ConfigServer; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected localisationService: LocalisationService; protected inventoryMagGenComponents: IInventoryMagGen[]; protected readonly modMagazineSlotId = "mod_magazine"; protected botConfig: IBotConfig; - constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil, configServer: ConfigServer, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, inventoryMagGenComponents: IInventoryMagGen[]); + constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil, configServer: ConfigServer, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, inventoryMagGenComponents: IInventoryMagGen[]); /** * Pick a random weapon based on weightings and generate a functional weapon * @param equipmentSlot Primary/secondary/holster diff --git a/TypeScript/7OnLoadHook/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/7OnLoadHook/types/generators/RagfairOfferGenerator.d.ts index b64a7e7..23882d2 100644 --- a/TypeScript/7OnLoadHook/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/7OnLoadHook/types/generators/RagfairOfferGenerator.d.ts @@ -1,16 +1,19 @@ +import { HandbookHelper } from "../helpers/HandbookHelper"; import { ItemHelper } from "../helpers/ItemHelper"; +import { PaymentHelper } from "../helpers/PaymentHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; import { Item } from "../models/eft/common/tables/IItem"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { IBarterScheme } from "../models/eft/common/tables/ITrader"; -import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; +import { IRagfairOffer, OfferRequirement } from "../models/eft/ragfair/IRagfairOffer"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { RagfairCategoriesService } from "../services/RagfairCategoriesService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { RagfairPriceService } from "../services/RagfairPriceService"; @@ -27,18 +30,31 @@ export declare class RagfairOfferGenerator { protected timeUtil: TimeUtil; protected databaseServer: DatabaseServer; protected ragfairServerHelper: RagfairServerHelper; + protected handbookHelper: HandbookHelper; protected saveServer: SaveServer; protected presetHelper: PresetHelper; protected ragfairAssortGenerator: RagfairAssortGenerator; protected ragfairOfferService: RagfairOfferService; protected ragfairPriceService: RagfairPriceService; + protected localisationService: LocalisationService; + protected paymentHelper: PaymentHelper; protected ragfairCategoriesService: RagfairCategoriesService; protected fenceService: FenceService; protected itemHelper: ItemHelper; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, ragfairServerHelper: RagfairServerHelper, saveServer: SaveServer, presetHelper: PresetHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferService: RagfairOfferService, ragfairPriceService: RagfairPriceService, ragfairCategoriesService: RagfairCategoriesService, fenceService: FenceService, itemHelper: ItemHelper, configServer: ConfigServer); + protected allowedFleaPriceItemsForBarter: { + tpl: string; + price: number; + }[]; + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, ragfairServerHelper: RagfairServerHelper, handbookHelper: HandbookHelper, saveServer: SaveServer, presetHelper: PresetHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferService: RagfairOfferService, ragfairPriceService: RagfairPriceService, localisationService: LocalisationService, paymentHelper: PaymentHelper, ragfairCategoriesService: RagfairCategoriesService, fenceService: FenceService, itemHelper: ItemHelper, configServer: ConfigServer); createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; + /** + * Calculate the offer price that's listed on the flea listing + * @param offerRequirements barter requirements for offer + * @returns rouble cost of offer + */ + protected calculateOfferListingPrice(offerRequirements: OfferRequirement[]): number; /** * Get avatar url from trader table in db * @param isTrader Is user we're getting avatar for a trader @@ -87,20 +103,36 @@ export declare class RagfairOfferGenerator { * @returns Item with conditions added */ protected addMissingCondition(item: Item): Item; - protected getOfferRequirements(items: Item[]): { - count: number; - _tpl: string; + /** + * Create a barter-based barter scheme, if not possible, fall back to making barter scheme currency based + * @param offerItems Items for sale in offer + * @returns barter scheme + */ + protected createBarterRequirement(offerItems: Item[]): IBarterScheme[]; + /** + * Get an array of flea prices + item tpl, cached in generator class + * @returns array with tpl/price values + */ + protected getFleaPricesAsArray(): { + tpl: string; + price: number; }[]; + /** + * Create a random currency-based barter scheme for an array of items + * @param offerItems Items on offer + * @returns Barter scheme for offer + */ + protected createCurrencyRequirement(offerItems: Item[]): IBarterScheme[]; /** * Create a flea offer and store it in the Ragfair server offers array * @param userID owner of the offer * @param time time offer is put up * @param items items in the offer - * @param barterScheme - * @param loyalLevel + * @param barterScheme cost of item (currency or barter) + * @param loyalLevel Loyalty level needed to buy item * @param price price of offer * @param sellInOnePiece - * @returns + * @returns Ragfair offer */ createFleaOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; } diff --git a/TypeScript/7OnLoadHook/types/generators/WeatherGenerator.d.ts b/TypeScript/7OnLoadHook/types/generators/WeatherGenerator.d.ts index 8ddbe49..65d2c76 100644 --- a/TypeScript/7OnLoadHook/types/generators/WeatherGenerator.d.ts +++ b/TypeScript/7OnLoadHook/types/generators/WeatherGenerator.d.ts @@ -1,38 +1,54 @@ +import { ApplicationContext } from "../context/ApplicationContext"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; -import { IWeatherData } from "../models/eft/weather/IWeatherData"; +import { IWeather, IWeatherData } from "../models/eft/weather/IWeatherData"; +import { WindDirection } from "../models/enums/WindDirection"; import { IWeatherConfig } from "../models/spt/config/IWeatherConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class WeatherGenerator { protected weightedRandomHelper: WeightedRandomHelper; + protected logger: ILogger; protected randomUtil: RandomUtil; protected timeUtil: TimeUtil; + protected applicationContext: ApplicationContext; protected configServer: ConfigServer; protected weatherConfig: IWeatherConfig; - constructor(weightedRandomHelper: WeightedRandomHelper, randomUtil: RandomUtil, timeUtil: TimeUtil, configServer: ConfigServer); - calculateTime(data: IWeatherData): IWeatherData; + constructor(weightedRandomHelper: WeightedRandomHelper, logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, applicationContext: ApplicationContext, configServer: ConfigServer); + calculateGameTime(data: IWeatherData): IWeatherData; /** * Get server uptime seconds multiplied by a multiplier and add to current time as seconds * Format to BSGs requirements - * @param computedDate current date + * @param currentDate current date * @returns formatted time */ - protected getAcceleratedTime(computedDate: Date): string; + protected getBsgFormattedInRaidTime(currentDate: Date): string; + /** + * Get the current in-raid time + * @param currentDate (new Date()) + * @returns Date object of current in-raid time + */ + getInRaidTime(currentDate: Date): Date; /** * Get current time formatted to fit BSGs requirement - * @param computedDate date to format into bsg style + * @param date date to format into bsg style * @returns */ - protected getNormalTime(computedDate: Date): string; + protected getBSGFormattedTime(date: Date): string; /** - * Return randomised Weather data - * @param weatherData weather input data + * Return randomised Weather data with help of config/weather.json * @returns Randomised weather data */ - generateWeather(weatherData: IWeatherData): IWeatherData; - protected getWeightedFog(): string; + generateWeather(): IWeather; + /** + * Set IWeather date/time/timestamp values to now + * @param weather Object to update + */ + protected setCurrentDateTime(weather: IWeather): void; + protected getWeightedWindDirection(): WindDirection; + protected getWeightedWindSpeed(): number; + protected getWeightedFog(): number; protected getWeightedRain(): number; protected getRandomFloat(node: string): number; - protected getRandomInt(node: string): number; } diff --git a/TypeScript/7OnLoadHook/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts b/TypeScript/7OnLoadHook/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts index 4fcb1e2..1589707 100644 --- a/TypeScript/7OnLoadHook/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts +++ b/TypeScript/7OnLoadHook/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts @@ -1,13 +1,15 @@ import { BotWeaponGeneratorHelper } from "../../../helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "../../../helpers/ItemHelper"; import { ILogger } from "../../../models/spt/utils/ILogger"; +import { LocalisationService } from "../../../services/LocalisationService"; import { IInventoryMagGen } from "../IInventoryMagGen"; import { InventoryMagGen } from "../InventoryMagGen"; export declare class ExternalInventoryMagGen implements IInventoryMagGen { protected logger: ILogger; protected itemHelper: ItemHelper; + protected localisationService: LocalisationService; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; - constructor(logger: ILogger, itemHelper: ItemHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper); + constructor(logger: ILogger, itemHelper: ItemHelper, localisationService: LocalisationService, botWeaponGeneratorHelper: BotWeaponGeneratorHelper); getPriority(): number; canHandleInventoryMagGen(inventoryMagGen: InventoryMagGen): boolean; process(inventoryMagGen: InventoryMagGen): void; diff --git a/TypeScript/7OnLoadHook/types/helpers/BotDifficultyHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/BotDifficultyHelper.d.ts new file mode 100644 index 0000000..a58ebdb --- /dev/null +++ b/TypeScript/7OnLoadHook/types/helpers/BotDifficultyHelper.d.ts @@ -0,0 +1,46 @@ +import { Difficulty } from "../models/eft/common/tables/IBotType"; +import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; +import { JsonUtil } from "../utils/JsonUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +import { BotHelper } from "./BotHelper"; +export declare class BotDifficultyHelper { + protected logger: ILogger; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected randomUtil: RandomUtil; + protected localisationService: LocalisationService; + protected botHelper: BotHelper; + protected configServer: ConfigServer; + protected botConfig: IBotConfig; + constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, localisationService: LocalisationService, botHelper: BotHelper, configServer: ConfigServer); + getPmcDifficultySettings(pmcType: "bear" | "usec", difficulty: string, usecType: string, bearType: string): Difficulty; + /** + * Get difficulty settings for desired bot type, if not found use assault bot types + * @param type bot type to retreive difficulty of + * @param difficulty difficulty to get settings for (easy/normal etc) + * @returns Difficulty object + */ + getBotDifficultySettings(type: string, difficulty: string): Difficulty; + /** + * Get difficulty settings for a PMC + * @param type "usec" / "bear" + * @param difficulty what difficulty to retrieve + * @returns Difficulty object + */ + protected getDifficultySettings(type: string, difficulty: string): Difficulty; + /** + * Translate chosen value from pre-raid difficulty dropdown into bot difficulty value + * @param dropDownDifficulty Dropdown difficulty value to convert + * @returns bot difficulty + */ + convertBotDifficultyDropdownToBotDifficulty(dropDownDifficulty: string): string; + /** + * Choose a random difficulty from - easy/normal/hard/impossible + * @returns random difficulty + */ + chooseRandomDifficulty(): string; +} diff --git a/TypeScript/7OnLoadHook/types/helpers/BotGeneratorHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/BotGeneratorHelper.d.ts index 5e3e501..899669e 100644 --- a/TypeScript/7OnLoadHook/types/helpers/BotGeneratorHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/BotGeneratorHelper.d.ts @@ -8,6 +8,7 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; import { ItemFilterService } from "../services/ItemFilterService"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; @@ -43,9 +44,10 @@ export declare class BotGeneratorHelper { protected itemFilterService: ItemFilterService; protected profileHelper: ProfileHelper; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Check mods are compatible and add to array * @param equipment Equipment item to add mods to @@ -53,9 +55,11 @@ export declare class BotGeneratorHelper { * @param parentId parentid of item to add mod to * @param parentTemplate template objet of item to add mods to * @param modSpawnChances dictionary of mod items and their chance to spawn for this bot type + * @param botRole the bot role being generated for + * @param forceSpawn should this mod be forced to spawn * @returns Item + compatible mods as an array */ - generateModsForEquipment(equipment: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances): Item[]; + generateModsForEquipment(equipment: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances, botRole: string, forceSpawn?: boolean): Item[]; /** * @param sessionId session id * @param weapon Weapon to add mods to @@ -70,15 +74,15 @@ export declare class BotGeneratorHelper { generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponParentId: string, parentWeaponTemplate: ITemplateItem, modSpawnChances: ModsChances, ammoTpl: string, botRole: string): Item[]; /** * - * @param modSlot - * @param isRandomisableSlot - * @param modsParent - * @param botEquipBlacklist - * @param itemModPool + * @param modSlot Slot mod will fit into + * @param isRandomisableSlot Will generate a randomised mod pool if true + * @param modsParent Parent slot the item will be a part of + * @param botEquipBlacklist Blacklist to prevent mods from being picked + * @param itemModPool Pool of items to pick from * @param weapon array with only weapon tpl in it, ready for mods to be added * @param ammoTpl ammo tpl to use if slot requires a cartridge to be added (e.g. mod_magazine) - * @param parentTemplate - * @returns + * @param parentTemplate Parent item the mod will go into + * @returns ITemplateItem */ protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, modsParent: Slot, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem): [boolean, ITemplateItem]; /** @@ -114,8 +118,10 @@ export declare class BotGeneratorHelper { * Find all compatible mods for equipment item and add to modPool * @param itemDetails item to find mods for * @param modPool ModPool to add mods to + * @param equipmentBlacklist equipment not allowed to be used by the bot + * @param botEquipmentRole bot type to generate pool for (e.g. assault, pmcBot, pmc for usec/bear) */ - generateDynamicModPool(itemDetails: ITemplateItem, modPool: Mods): void; + generateDynamicModPool(itemDetails: ITemplateItem, modPool: Mods, equipmentBlacklist: EquipmentFilterDetails[], botEquipmentRole: string): void; /** * Take a list of tpls and filter out blacklisted values using itemFilterService + botEquipmentBlacklist * @param allowedMods base mods to filter @@ -153,7 +159,7 @@ export declare class BotGeneratorHelper { * @param modTemplate Used to add additional properites in the upd object * @returns Item object */ - protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem): Item; + protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem, botRole: string): Item; /** * randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot * never return true for an item that has 0% spawn chance @@ -170,10 +176,10 @@ export declare class BotGeneratorHelper { */ protected getAmmoContainers(): string[]; /** - * Get the slot details for an item (chamber/cartridge/slot) + * Get a Slot property for an item (chamber/cartridge/slot) * @param modSlot e.g patron_in_weapon * @param parentTemplate item template - * @returns + * @returns Slot item */ protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; /** @@ -185,7 +191,6 @@ export declare class BotGeneratorHelper { * @param modPool modPool which should include available cartrigdes * @param parentId The CylinderMagazine's UID * @param parentTemplate The CylinderMagazine's template - * @returns */ protected fillCamora(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem): void; /** @@ -197,11 +202,11 @@ export declare class BotGeneratorHelper { /** * Adds properties to an item * e.g. Repairable / HasHinge / Foldable / MaxDurability - * @param itemTemplate - * @param botRole Used by weapons to randomise the durability values + * @param itemTemplate Item extra properties are being generated for + * @param botRole Used by weapons to randomise the durability values. Null for non-equipped items * @returns Item Upd object with extra properties */ - generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: any): { + generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: string): { upd?: Upd; }; /** @@ -220,21 +225,27 @@ export declare class BotGeneratorHelper { protected generateArmorRepairableProperties(itemTemplate: ITemplateItem, botRole: string): Repairable; /** * Get a random mod from an items compatible mods Filter array - * @param modTpl - * @param parentSlot - * @param modSlot - * @param items + * @param modTpl ???? + * @param parentSlot item mod will go into, used to get combatible items + * @param modSlot Slot to get mod to fill + * @param items items to ensure picked mod is compatible with * @returns item tpl */ protected getModTplFromItemDb(modTpl: string, parentSlot: Slot, modSlot: string, items: Item[]): string; /** * Can an item be added to an item without issue - * @param items - * @param tplToCheck - * @param equipmentSlot - * @returns true if possible + * @param items items to check compatiblilities with + * @param tplToCheck tpl of the item to check for incompatibilities + * @param equipmentSlot Slot the item will be placed into + * @returns false if no incompatibilties */ isItemIncompatibleWithCurrentItems(items: Item[], tplToCheck: string, equipmentSlot: string): boolean; + /** + * Convert a bots role to the equipment role used in config/bot.json + * @param botRole Role to convert + * @returns Equipment role (e.g. pmc / assault / bossTagilla) + */ + getBotEquipmentRole(botRole: string): string; } /** TODO - move into own class */ export declare class ExhaustableArray { diff --git a/TypeScript/7OnLoadHook/types/helpers/BotHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/BotHelper.d.ts index 67a6384..a7f779e 100644 --- a/TypeScript/7OnLoadHook/types/helpers/BotHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/BotHelper.d.ts @@ -3,6 +3,7 @@ import { IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; export declare class BotHelper { @@ -10,46 +11,27 @@ export declare class BotHelper { protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, configServer: ConfigServer); - /** - * Get difficulty settings for desired bot type, if not found use assault bot types - * @param type bot type to retreive difficulty of - * @param difficulty difficulty to get settings for (easy/normal etc) - * @returns Difficulty object - */ - getBotDifficultySettings(type: string, difficulty: string): Difficulty; + constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, localisationService: LocalisationService, configServer: ConfigServer); /** * Get a template object for the specified botRole from bots.types db * @param role botRole to get template for * @returns IBotType object */ getBotTemplate(role: string): IBotType; - /** - * Get difficulty settings for a PMC - * @param type "usec" / "bear" - * @param difficulty what difficulty to retrieve - * @returns Difficulty object - */ - getPmcDifficultySettings(type: string, difficulty: string): Difficulty; - /** - * Translate chosen value from pre-raid difficulty dropdown into bot difficulty value - * @param dropDownDifficulty Dropdown difficulty value to convert - * @returns bot difficulty - */ - convertBotDifficultyDropdownToBotDifficulty(dropDownDifficulty: string): string; - /** - * Choose a random difficulty from - easy/normal/hard/impossible - * @returns random difficulty - */ - chooseRandomDifficulty(): string; /** * Randomise the chance the PMC will attack their own side * Look up value in bot.json/chanceSameSideIsHostilePercent * @param difficultySettings pmc difficulty settings */ randomisePmcHostility(difficultySettings: Difficulty): void; + /** + * Is the passed in bot role a PMC (usec/bear/pmc) + * @param botRole bot role to check + * @returns true if is pmc + */ isBotPmc(botRole: string): boolean; isBotBoss(botRole: string): boolean; isBotFollower(botRole: string): boolean; diff --git a/TypeScript/7OnLoadHook/types/helpers/GameEventHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/GameEventHelper.d.ts index fca87be..fa25eff 100644 --- a/TypeScript/7OnLoadHook/types/helpers/GameEventHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/GameEventHelper.d.ts @@ -15,4 +15,15 @@ export declare class GameEventHelper { * @returns Record with event name + start/end date */ getEventDetails(): ISeasonalEvent[]; + /** + * Is detection of seasonal events enabled (halloween / christmas) + * @returns true if seasonal events should be checked for + */ + isAutomaticEventDetectionEnabled(): boolean; + /** + * Get a dictionary of gear changes to apply to bots for a specific event e.g. Christmas/Halloween + * @param eventName Name of event to get gear changes for + * @returns bots with equipment changes + */ + getEventBotGear(eventName: string): Record>>; } diff --git a/TypeScript/7OnLoadHook/types/helpers/HideoutHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/HideoutHelper.d.ts index 5f7e3b7..9d51fed 100644 --- a/TypeScript/7OnLoadHook/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/HideoutHelper.d.ts @@ -11,6 +11,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { PlayerService } from "../services/PlayerService"; import { HashUtil } from "../utils/HashUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; @@ -29,13 +30,14 @@ export declare class HideoutHelper { protected profileHelper: ProfileHelper; protected inventoryHelper: InventoryHelper; protected playerService: PlayerService; + protected localisationService: LocalisationService; protected configServer: ConfigServer; static bitcoinFarm: string; static waterCollector: string; static bitcoin: string; static expeditionaryFuelTank: string; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, localisationService: LocalisationService, configServer: ConfigServer); registerProduction(pmcData: IPmcData, body: IHideoutSingleProductionStartRequestData | IHideoutContinousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; /** * This convinience function intialies new Production Object diff --git a/TypeScript/7OnLoadHook/types/helpers/InventoryHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/InventoryHelper.d.ts index b8e5c9d..6419f93 100644 --- a/TypeScript/7OnLoadHook/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/InventoryHelper.d.ts @@ -5,11 +5,12 @@ import { IInventoryMergeRequestData } from "../models/eft/inventory/IInventoryMe import { IInventoryMoveRequestData } from "../models/eft/inventory/IInventoryMoveRequestData"; import { IInventorySplitRequestData } from "../models/eft/inventory/IInventorySplitRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { IInventoryConfig } from "../models/spt/config/IInventoryConfig"; +import { IInventoryConfig, RewardDetails } from "../models/spt/config/IInventoryConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { JsonUtil } from "../utils/JsonUtil"; @@ -38,9 +39,10 @@ export declare class InventoryHelper { protected itemHelper: ItemHelper; protected containerHelper: ContainerHelper; protected profileHelper: ProfileHelper; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected inventoryConfig: IInventoryConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); addItem(pmcData: IPmcData, body: IAddItemRequestData, output: IItemEventRouterResponse, sessionID: string, callback: any, foundInRaid?: boolean, addUpd?: any): IItemEventRouterResponse; removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; removeItemByCount(pmcData: IPmcData, itemId: string, count: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; @@ -76,6 +78,12 @@ export declare class InventoryHelper { * Internal helper function to handle cartridges in inventory if any of them exist. */ protected handleCartridges(items: Item[], body: IInventoryMoveRequestData): void; + /** + * Get details for how a random loot container should be handled, max rewards, possible reward tpls + * @param itemTpl Container being opened + * @returns Reward details + */ + getRandomLootContainerRewardDetails(itemTpl: string): RewardDetails; } declare namespace InventoryHelper { interface InventoryItemHash { diff --git a/TypeScript/7OnLoadHook/types/helpers/ItemHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/ItemHelper.d.ts index 0effaf2..fc88a46 100644 --- a/TypeScript/7OnLoadHook/types/helpers/ItemHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/ItemHelper.d.ts @@ -5,6 +5,7 @@ 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 { LocaleService } from "../services/LocaleService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; @@ -18,7 +19,8 @@ declare class ItemHelper { protected objectId: ObjectId; protected mathUtil: MathUtil; protected databaseServer: DatabaseServer; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer); + protected localeService: LocaleService; + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, localeService: LocaleService); /** * Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash * @param {string} tpl the template id / tpl @@ -212,6 +214,12 @@ declare class ItemHelper { * @returns size of stack */ getItemStackSize(item: Item): number; + /** + * Get the name of an item from the locale file using the item tpl + * @param itemTpl Tpl of item to get name of + * @returns Name of item + */ + getItemName(itemTpl: string): string; } declare namespace ItemHelper { interface ItemSize { diff --git a/TypeScript/7OnLoadHook/types/helpers/QuestHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/QuestHelper.d.ts index a6b4892..edbd2e1 100644 --- a/TypeScript/7OnLoadHook/types/helpers/QuestHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/QuestHelper.d.ts @@ -50,6 +50,12 @@ export declare class QuestHelper { * @returns true if player level is greater than or equal to quest */ doesPlayerLevelFulfilCondition(playerLevel: number, condition: AvailableForConditions): boolean; + /** + * Get the quests found in both arrays (inner join) + * @param before Array of qeusts #1 + * @param after Array of quests #2 + * @returns Reduction of cartesian product between two quest arrays + */ getDeltaQuests(before: IQuest[], after: IQuest[]): IQuest[]; /** * Increase skill points of a skill on player profile @@ -66,38 +72,85 @@ export declare class QuestHelper { * quest list in question. */ dumpQuests(quests: any): void; - loyaltyRequirementCheck(loyaltyRequirementProperties: AvailableForProps, profile: IPmcData): boolean; - protected processReward(reward: Reward): any[]; + /** + * Check if trader has sufficient loyalty to fullfill quest requirement + * @param questProperties Quest props + * @param profile Player profile + * @returns true if loyalty is high enough to fulfil quest requirement + */ + traderStandingRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; + protected processReward(reward: Reward): Reward[]; + /** + * Gets a flat list of reward items for the given quest at a specific state (e.g. Fail/Success) + * @param quest quest to get rewards for + * @param state Quest status that holds the items (Started, Success, Fail) + * @returns array of items with the correct maxStack + */ getQuestRewardItems(quest: IQuest, state: QuestStatus): Reward[]; /** - * Add quest with new state value to pmc profile + * Update player profile with quest status (e.g. Fail/Success) * @param pmcData profile to add quest to * @param newState state the new quest should be in when added * @param acceptedQuest Details of quest being added */ addQuestToPMCData(pmcData: IPmcData, newState: QuestStatus, acceptedQuest: IAcceptQuestRequestData): void; - acceptedUnlocked(acceptedQuestId: string, sessionID: string): IQuest[]; - failedUnlocked(failedQuestId: string, sessionID: string): IQuest[]; - applyMoneyBoost(quest: IQuest, moneyBoost: number): IQuest; - changeItemStack(pmcData: IPmcData, id: string, value: number, sessionID: string, output: any): void; /** - * Get List of All Quests as an array + * TODO: what is going on here + * @param acceptedQuestId Quest to add to profile + * @param sessionID Session id + * @returns Array of quests in profile + quest passed in as param + */ + acceptedUnlocked(acceptedQuestId: string, sessionID: string): IQuest[]; + /** + * TODO: what is going on here + * @param failedQuestId + * @param sessionID Session id + * @returns + */ + failedUnlocked(failedQuestId: string, sessionID: string): IQuest[]; + /** + * Adjust quest money rewards by passed in multipler + * @param quest Quest to multiple money rewards + * @param multipler Value to adjust money rewards by + * @returns Updated quest + */ + applyMoneyBoost(quest: IQuest, multipler: number): IQuest; + /** + * Sets the item stack to new value, or delete the item if value <= 0 + * // TODO maybe merge this function and the one from customization + * @param pmcData Profile + * @param itemId id of item to adjust stack size of + * @param newStackSize Stack size to adjust to + * @param sessionID Session id + * @param output ItemEvent router response + */ + changeItemStack(pmcData: IPmcData, itemId: string, newStackSize: number, sessionID: string, output: IItemEventRouterResponse): void; + /** + * Get List of All Quests from db + * NOT CLONED * @returns Array of IQuest objects */ - questValues(): IQuest[]; + getQuestsFromDb(): IQuest[]; /** - * Reest AvailableForStart conditions for quests - * @param quests queststo clean + * Get quests, strip all requirement conditions except level + * @param quests quests to process * @returns quest array without conditions */ - protected cleanQuestList(quests: IQuest[]): IQuest[]; + protected getQuestsWithOnlyLevelRequirementStartCondition(quests: IQuest[]): IQuest[]; /** - * Reset AvailableForStart conditions on a quest + * Remove all quest conditions except for level requirement * @param quest quest to clean * @returns reset IQuest object */ - cleanQuestConditions(quest: IQuest): IQuest; - failQuest(pmcData: IPmcData, body: any, sessionID: string): any; + getQuestWithOnlyLevelRequirementStartCondition(quest: IQuest): IQuest; + /** + * Fail a quest in a player profile + * @param pmcData Profile + * @param failRequest fail quest request data + * @param sessionID Session id + * @returns Item event router response + */ + failQuest(pmcData: IPmcData, failRequest: any, sessionID: string): IItemEventRouterResponse; /** * Get quest by id from database * @param questId questid to look for @@ -105,7 +158,12 @@ export declare class QuestHelper { * @returns IQuest object */ getQuestFromDb(questId: string, pmcData: IPmcData): IQuest; - getQuestLocaleIdFromDb(messageId: string): string; + /** + * Get the locale Id from locale db for a quest message + * @param questMessageId Quest mesage id to look up + * @returns Locale Id from locale db + */ + getQuestLocaleIdFromDb(questMessageId: string): string; /** * Alter a quests state + Add a record to tis status timers object * @param pmcData Profile to update @@ -128,5 +186,10 @@ export declare class QuestHelper { * @returns bonus in percent */ protected getIntelCenterRewardBonus(pmcData: IPmcData): number; - getFindItemIdForQuestItem(itemTpl: string): string; + /** + * Find quest with 'findItem' requirement that needs the item tpl be handed in + * @param itemTpl item tpl to look for + * @returns 'FindItem' condition id + */ + getFindItemIdForQuestHandIn(itemTpl: string): string; } diff --git a/TypeScript/7OnLoadHook/types/helpers/RagfairServerHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/RagfairServerHelper.d.ts index a03cdda..ec388d8 100644 --- a/TypeScript/7OnLoadHook/types/helpers/RagfairServerHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/RagfairServerHelper.d.ts @@ -44,10 +44,20 @@ export declare class RagfairServerHelper { isPlayer(userID: string): boolean; returnItems(sessionID: string, items: any[]): void; calculateDynamicStackCount(tplId: string, isWeaponPreset: boolean): number; + /** + * Choose a currency at random with bias + * @returns currency tpl + */ getDynamicOfferCurrency(): string; getMemberType(userID: string): MemberCategory; getNickname(userID: string): string; getPresetItems(item: any): Item[]; getPresetItemsByTpl(item: Item): Item[]; + /** + * Generate new unique ids for the children while preserving hierarchy + * @param item base item + * @param preset + * @returns Item array with new IDs + */ reparentPresets(item: Item, preset: Item[]): Item[]; } diff --git a/TypeScript/7OnLoadHook/types/helpers/RagfairSortHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/RagfairSortHelper.d.ts index 28d1d38..4669ce6 100644 --- a/TypeScript/7OnLoadHook/types/helpers/RagfairSortHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/RagfairSortHelper.d.ts @@ -18,7 +18,7 @@ export declare class RagfairSortHelper { protected sortOffersByRating(a: IRagfairOffer, b: IRagfairOffer): number; protected sortOffersByName(a: IRagfairOffer, b: IRagfairOffer): number; /** - * Order two offers by price value + * Order two offers by rouble price value * @param a Offer a * @param b Offer b * @returns diff --git a/TypeScript/7OnLoadHook/types/loaders/PreAkiModLoader.d.ts b/TypeScript/7OnLoadHook/types/loaders/PreAkiModLoader.d.ts index 7a687a5..f486a28 100644 --- a/TypeScript/7OnLoadHook/types/loaders/PreAkiModLoader.d.ts +++ b/TypeScript/7OnLoadHook/types/loaders/PreAkiModLoader.d.ts @@ -1,29 +1,31 @@ import { DependencyContainer } from "tsyringe"; +import { IPostAkiLoadMod } from "../models/external/IPostAkiLoadMod"; +import { IPostDBLoadMod } from "../models/external/IPostDBLoadMod"; +import { IPreAkiLoadMod } from "../models/external/IPreAkiLoadMod"; import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { ModLoader } from "../models/spt/mod/IMod"; import { IModLoader } from "../models/spt/mod/IModLoader"; import { IPackageJsonData } from "../models/spt/mod/IPackageJsonData"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { LocalisationService } from "../services/LocalisationService"; import { ModCompilerService } from "../services/ModCompilerService"; import { JsonUtil } from "../utils/JsonUtil"; import { VFS } from "../utils/VFS"; import { BundleLoader } from "./BundleLoader"; -import { IPostAkiLoadMod } from "../models/external/IPostAkiLoadMod"; -import { IPreAkiLoadMod } from "../models/external/IPreAkiLoadMod"; -import { IPostDBLoadMod } from "../models/external/IPostDBLoadMod"; export declare class PreAkiModLoader implements IModLoader { protected logger: ILogger; protected vfs: VFS; protected jsonUtil: JsonUtil; protected modCompilerService: ModCompilerService; protected bundleLoader: BundleLoader; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected static container: DependencyContainer; protected readonly basepath = "user/mods/"; protected imported: Record; protected akiConfig: ICoreConfig; - constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, modCompilerService: ModCompilerService, bundleLoader: BundleLoader, configServer: ConfigServer); + constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, modCompilerService: ModCompilerService, bundleLoader: BundleLoader, localisationService: LocalisationService, configServer: ConfigServer); load(container: DependencyContainer): Promise; getBundles(local: boolean): string; getBundle(key: string, local: boolean): void; diff --git a/TypeScript/7OnLoadHook/types/models/eft/bot/IGenerateBotsRequestData.d.ts b/TypeScript/7OnLoadHook/types/models/eft/bot/IGenerateBotsRequestData.d.ts index c49cef7..f1f7013 100644 --- a/TypeScript/7OnLoadHook/types/models/eft/bot/IGenerateBotsRequestData.d.ts +++ b/TypeScript/7OnLoadHook/types/models/eft/bot/IGenerateBotsRequestData.d.ts @@ -2,6 +2,7 @@ export interface IGenerateBotsRequestData { conditions: Condition[]; } export interface Condition { + /** e.g. assault/pmcBot/bossKilla */ Role: string; Limit: number; Difficulty: string; diff --git a/TypeScript/7OnLoadHook/types/models/eft/common/IGlobals.d.ts b/TypeScript/7OnLoadHook/types/models/eft/common/IGlobals.d.ts index 81e2023..b53f106 100644 --- a/TypeScript/7OnLoadHook/types/models/eft/common/IGlobals.d.ts +++ b/TypeScript/7OnLoadHook/types/models/eft/common/IGlobals.d.ts @@ -591,6 +591,7 @@ export interface HealPrice { export interface ProfileHealthSettings { BodyPartsSettings: BodyPartsSettings; HealthFactorsSettings: HealthFactorsSettings; + DefaultStimulatorBuff: string; } export interface BodyPartsSettings { Head: BodyPartsSetting; diff --git a/TypeScript/7OnLoadHook/types/models/eft/common/tables/IBotBase.d.ts b/TypeScript/7OnLoadHook/types/models/eft/common/tables/IBotBase.d.ts index 1c28ae0..2b418c1 100644 --- a/TypeScript/7OnLoadHook/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/7OnLoadHook/types/models/eft/common/tables/IBotBase.d.ts @@ -107,6 +107,7 @@ export interface CurrentMax { Maximum: number; } export interface Inventory { + discardLimits: Record; items: Item[]; equipment: string; stash: string; diff --git a/TypeScript/7OnLoadHook/types/models/eft/common/tables/IBotType.d.ts b/TypeScript/7OnLoadHook/types/models/eft/common/tables/IBotType.d.ts index c1fe579..55b4bd9 100644 --- a/TypeScript/7OnLoadHook/types/models/eft/common/tables/IBotType.d.ts +++ b/TypeScript/7OnLoadHook/types/models/eft/common/tables/IBotType.d.ts @@ -13,8 +13,8 @@ export interface IBotType { skills: Skills; } export interface Appearance { - body: string[]; - feet: string[]; + body: Record; + feet: Record; hands: string[]; head: string[]; voice: string[]; diff --git a/TypeScript/7OnLoadHook/types/models/eft/common/tables/ITemplateItem.d.ts b/TypeScript/7OnLoadHook/types/models/eft/common/tables/ITemplateItem.d.ts index 8569e61..0fa7e18 100644 --- a/TypeScript/7OnLoadHook/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/TypeScript/7OnLoadHook/types/models/eft/common/tables/ITemplateItem.d.ts @@ -254,7 +254,7 @@ export interface Props { foodUseTime?: number; foodEffectType?: string; StimulatorBuffs?: string; - effects_health?: any; + effects_health?: IHealthEffect[] | Record>; effects_damage?: any; MaximumNumberOfUsage?: number; knifeHitDelay?: number; @@ -366,6 +366,10 @@ export interface Props { MinTimeToContactExplode?: number; ExplosionEffectType?: string; } +export interface IHealthEffect { + type: string; + value: number; +} export interface Prefab { path: string; rcid: string; diff --git a/TypeScript/7OnLoadHook/types/models/eft/customization/IGetSuitsResponse.d.ts b/TypeScript/7OnLoadHook/types/models/eft/customization/IGetSuitsResponse.d.ts new file mode 100644 index 0000000..fe6888c --- /dev/null +++ b/TypeScript/7OnLoadHook/types/models/eft/customization/IGetSuitsResponse.d.ts @@ -0,0 +1,4 @@ +export interface IGetSuitsResponse { + _id: string; + suits: string[]; +} diff --git a/TypeScript/7OnLoadHook/types/models/eft/game/IGameKeepAliveResponse.d.ts b/TypeScript/7OnLoadHook/types/models/eft/game/IGameKeepAliveResponse.d.ts new file mode 100644 index 0000000..170ce6a --- /dev/null +++ b/TypeScript/7OnLoadHook/types/models/eft/game/IGameKeepAliveResponse.d.ts @@ -0,0 +1,4 @@ +export interface IGameKeepAliveResponse { + msg: string; + utc_time: number; +} diff --git a/TypeScript/7OnLoadHook/types/models/eft/game/IGameLogoutResponseData.d.ts b/TypeScript/7OnLoadHook/types/models/eft/game/IGameLogoutResponseData.d.ts new file mode 100644 index 0000000..0f52050 --- /dev/null +++ b/TypeScript/7OnLoadHook/types/models/eft/game/IGameLogoutResponseData.d.ts @@ -0,0 +1,3 @@ +export interface IGameLogoutResponseData { + status: string; +} diff --git a/TypeScript/7OnLoadHook/types/models/eft/game/IGameStartResponse.d.ts b/TypeScript/7OnLoadHook/types/models/eft/game/IGameStartResponse.d.ts new file mode 100644 index 0000000..9f0ab6d --- /dev/null +++ b/TypeScript/7OnLoadHook/types/models/eft/game/IGameStartResponse.d.ts @@ -0,0 +1,3 @@ +export interface IGameStartResponse { + utc_time: number; +} diff --git a/TypeScript/7OnLoadHook/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts b/TypeScript/7OnLoadHook/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts new file mode 100644 index 0000000..3c45124 --- /dev/null +++ b/TypeScript/7OnLoadHook/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts @@ -0,0 +1,11 @@ +import { IInventoryBaseActionRequestData } from "./IInventoryBaseActionRequestData"; +export interface IOpenRandomLootContainerRequestData extends IInventoryBaseActionRequestData { + Action: "OpenRandomLootContainer"; + /** Container item opened */ + item: string; + to: To[]; +} +export interface To { + /** Player character (pmc/scav) id items will be sent to */ + id: string; +} diff --git a/TypeScript/7OnLoadHook/types/models/eft/itemEvent/IItemEventRouterBase.d.ts b/TypeScript/7OnLoadHook/types/models/eft/itemEvent/IItemEventRouterBase.d.ts index 4841cfd..60ab284 100644 --- a/TypeScript/7OnLoadHook/types/models/eft/itemEvent/IItemEventRouterBase.d.ts +++ b/TypeScript/7OnLoadHook/types/models/eft/itemEvent/IItemEventRouterBase.d.ts @@ -10,8 +10,9 @@ export interface IItemEventRouterBase { export declare type TProfileChanges = Record; export interface Warning { index: number; - err: string; errmsg: string; + code?: string; + data?: any; } export interface ProfileChange { _id: string; diff --git a/TypeScript/7OnLoadHook/types/models/eft/match/IStartOffineRaidRequestData.d.ts b/TypeScript/7OnLoadHook/types/models/eft/match/IStartOffineRaidRequestData.d.ts index af0625e..1983728 100644 --- a/TypeScript/7OnLoadHook/types/models/eft/match/IStartOffineRaidRequestData.d.ts +++ b/TypeScript/7OnLoadHook/types/models/eft/match/IStartOffineRaidRequestData.d.ts @@ -2,8 +2,10 @@ import { BotAmount } from "../../enums/BotAmount"; import { BotDifficulty } from "../../enums/BotDifficulty"; export interface IStartOfflineRaidRequestData { locationName: string; + /** Current time, not in-game time */ startTime: number; - dateTime: string; + /** CURR = am, past = pm */ + dateTime: "CURR" | "PAST"; gameSettings: GameSettings; } export interface GameSettings { diff --git a/TypeScript/7OnLoadHook/types/models/eft/notifier/ISelectProfileResponse.d.ts b/TypeScript/7OnLoadHook/types/models/eft/notifier/ISelectProfileResponse.d.ts new file mode 100644 index 0000000..ecb668a --- /dev/null +++ b/TypeScript/7OnLoadHook/types/models/eft/notifier/ISelectProfileResponse.d.ts @@ -0,0 +1,6 @@ +import { INotifierChannel } from "./INotifier"; +export interface ISelectProfileResponse { + status: string; + notifier: INotifierChannel; + notifierServer: string; +} diff --git a/TypeScript/7OnLoadHook/types/models/eft/ragfair/IRagfairOffer.d.ts b/TypeScript/7OnLoadHook/types/models/eft/ragfair/IRagfairOffer.d.ts index 3251a37..792ec7d 100644 --- a/TypeScript/7OnLoadHook/types/models/eft/ragfair/IRagfairOffer.d.ts +++ b/TypeScript/7OnLoadHook/types/models/eft/ragfair/IRagfairOffer.d.ts @@ -7,19 +7,19 @@ export interface IRagfairOffer { requirements: OfferRequirement[]; root: string; intId: number; + /** Handbook price */ itemsCost: number; + /** Rouble price */ requirementsCost: number; - sptRequirementsCostRouble: number; startTime: number; endTime: number; sellInOnePiece: boolean; - name?: string; - shortName?: string; loyaltyLevel: number; buyRestrictionMax?: number; buyRestrictionCurrent?: number; locked: boolean; unlimitedCount: boolean; + /** Rouble price */ summaryCost: number; user: IRagfairOfferUser; notAvailable: boolean; @@ -33,11 +33,11 @@ export interface OfferRequirement { } export interface IRagfairOfferUser { id: string; - nickname: string; - rating: number; + nickname?: string; + rating?: number; memberType: MemberCategory; - avatar: string; - isRatingGrowing: boolean; + avatar?: string; + isRatingGrowing?: boolean; } export interface SellResult { sellTime: number; diff --git a/TypeScript/7OnLoadHook/types/models/eft/weather/IWeatherData.d.ts b/TypeScript/7OnLoadHook/types/models/eft/weather/IWeatherData.d.ts index ecc96ce..1f5d5b5 100644 --- a/TypeScript/7OnLoadHook/types/models/eft/weather/IWeatherData.d.ts +++ b/TypeScript/7OnLoadHook/types/models/eft/weather/IWeatherData.d.ts @@ -1,17 +1,18 @@ +import { WindDirection } from "../../../models/enums/WindDirection"; export interface IWeatherData { acceleration: number; time: string; date: string; - weather: IWeather; + weather?: IWeather; } export interface IWeather { pressure: number; temp: number; - fog: string; + fog: number; rain_intensity: number; - rain: any; + rain: number; wind_gustiness: number; - wind_direction: any; + wind_direction: WindDirection; wind_speed: number; cloud: number; time: string; diff --git a/TypeScript/7OnLoadHook/types/models/enums/BackendErrorCodes.d.ts b/TypeScript/7OnLoadHook/types/models/enums/BackendErrorCodes.d.ts new file mode 100644 index 0000000..6614b75 --- /dev/null +++ b/TypeScript/7OnLoadHook/types/models/enums/BackendErrorCodes.d.ts @@ -0,0 +1,67 @@ +export declare enum BackendErrorCodes { + NONE = 0, + UNKNOWN_ERROR = 200, + NOT_AUTHORIZED = 201, + NEED_AUTHORIZATION_CODE = 209, + WRONG_AUTHORIZATION_CODE = 211, + NEED_CAPTCHA = 214, + NO_NEED_CAPTCHA = 215, + CAPTCHA_FAILED = 218, + CAPTCHA_BRUTE_FORCED = 219, + NO_ROOM_IN_STASH = 223, + NICKNAME_NOT_UNIQUE = 225, + NICKNAME_NOT_VALID = 226, + UNSUPPORTED_CLIENT_VERSION = 232, + REPORT_NOT_ALLOWED = 238, + NICKNAME_IS_ABUSIVE = 241, + NICKNAME_CHANGE_TIMEOUT = 242, + NOT_MODIFIED = 304, + HTTP_BAD_REQUEST = 400, + HTTP_NOT_AUTHORIZED = 401, + HTTP_FORBIDDEN = 403, + HTTP_NOT_FOUND = 404, + HTTP_METHOD_NOT_ALLOWED = 405, + UNKNOWN_TRADING_ERROR = 500, + HTTPNOTIMPLEMENTED = 501, + HTTPBADGATEWAY = 502, + HTTPSERVICEUNAVAILABLE = 503, + HTTPGATEWAYTIMEOUT = 504, + TRADEROUTOFMONEY = 505, + HTTPVARIANTALSONEGOTIATES = 506, + PRICECHANGED = 509, + TRADERDISABLED = 512, + ITEMHASBEENSOLD = 513, + NOTENOUGHSPACEFORMONEY = 518, + HTTPINVALIDSSLCERTIFICATE = 526, + UNKNOWNRAGFAIRERROR = 550, + UNKNOWNRAGFAIRERROR2 = 551, + UNKNOWNMATCHMAKERERROR = 600, + SESSIONPARAMETERSERROR = 601, + SESSIONLOST = 602, + SERVERNOTREGISTERED = 604, + UNKNOWNQUESTERROR = 700, + QUESTBADPARAM = 702, + QUESTNOTFOUND = 703, + QUESTISUNAVAILABLE = 704, + NOFREESPACEFORREWARDS = 705, + WRONGQUESTSTATUS = 706, + CANTCOMPLETEQUEST = 707, + UNKNOWNMAILERROR = 900, + TOOMANYFRIENDREQUESTS = 925, + UNKNOWNSCRIPTEXECUTIONERROR = 1000, + UNKNOWNREPAIRINGERROR = 1200, + UNKNOWNINSURANCEERROR = 1300, + UNKNOWNCURRENCYEXCHANGEERROR = 1400, + OFFERNOTFOUND = 1503, + NOTENOUGHSPACE = 1505, + OFFEROUTOFSTOCK = 1506, + OFFERSOLD = 1507, + RAGFAIRUNAVAILABLE = 1511, + BANNEDERRORCODE = 1513, + INSUFFICIENTNUMBERINSTOCK = 1516, + TOOMANYITEMSTOSELL = 1517, + EXAMINATIONFAILED = 22001, + ITEMALREADYEXAMINED = 22002, + UNKNOWNNGINXERROR = 9000, + PARSERESPONSEERROR = 9001 +} diff --git a/TypeScript/7OnLoadHook/types/models/enums/HideoutEventActions.d.ts b/TypeScript/7OnLoadHook/types/models/enums/HideoutEventActions.d.ts new file mode 100644 index 0000000..e441477 --- /dev/null +++ b/TypeScript/7OnLoadHook/types/models/enums/HideoutEventActions.d.ts @@ -0,0 +1,11 @@ +export declare enum HideoutEventActions { + HIDEOUT_UPGRADE = "HideoutUpgrade", + HIDEOUT_UPGRADE_COMPLETE = "HideoutUpgradeComplete", + HIDEOUT_PUT_ITEMS_IN_AREA_SLOTS = "HideoutPutItemsInAreaSlots", + HIDEOUT_TAKE_ITEMS_FROM_AREA_SLOTS = "HideoutTakeItemsFromAreaSlots", + HIDEOUT_TOGGLE_AREA = "HideoutToggleArea", + HIDEOUT_SINGLE_PRODUCTION_START = "HideoutSingleProductionStart", + HIDEOUT_SCAV_CASE_PRODUCTION_START = "HideoutScavCaseProductionStart", + HIDEOUT_CONTINUOUS_PRODUCTION_START = "HideoutContinuousProductionStart", + HIDEOUT_TAKE_PRODUCTION = "HideoutTakeProduction" +} diff --git a/TypeScript/7OnLoadHook/types/models/enums/ItemEventActions.d.ts b/TypeScript/7OnLoadHook/types/models/enums/ItemEventActions.d.ts new file mode 100644 index 0000000..0e65453 --- /dev/null +++ b/TypeScript/7OnLoadHook/types/models/enums/ItemEventActions.d.ts @@ -0,0 +1,19 @@ +export declare enum ItemEventActions { + MOVE = "Move", + REMOVE = "Remove", + SPLIT = "Split", + MERGE = "Merge", + TRANSFER = "Transfer", + SWAP = "Swap", + FOLD = "Fold", + TOGGLE = "Toggle", + TAG = "Tag", + BIND = "Bind", + EXAMINE = "Examine", + READ_ENCYCLOPEDIA = "ReadEncyclopedia", + APPLY_INVENTORY_CHANGES = "ApplyInventoryChanges", + CREATE_MAP_MARKER = "CreateMapMarker", + DELETE_MAP_MARKER = "DeleteMapMarker", + EDIT_MAP_MARKER = "EditMapMarker", + OPEN_RANDOM_LOOT_CONTAINER = "OpenRandomLootContainer" +} diff --git a/TypeScript/7OnLoadHook/types/models/enums/WeatherType.d.ts b/TypeScript/7OnLoadHook/types/models/enums/WeatherType.d.ts new file mode 100644 index 0000000..d31fefe --- /dev/null +++ b/TypeScript/7OnLoadHook/types/models/enums/WeatherType.d.ts @@ -0,0 +1,19 @@ +export declare enum WeatherType { + CLEAR_DAY = 1, + CLEAR_WIND = 2, + CLEAR_NIGHT = 3, + PARTLY_CLOUD_DAY = 4, + PARTLY_CLOUD_NIGHT = 5, + CLEAR_FOG_DAY = 6, + CLEAR_FOG_NIGHT = 7, + CLOUDFOG = 8, + FOG = 9, + MOSTLY_CLOUD = 10, + LIGHT_RAIN = 11, + RAIN = 12, + CLOUD_WIND = 13, + CLOUD_WIND_RAIN = 14, + FULL_CLOUD = 15, + THUNDER_CLOUD = 16, + NONE = 0 +} diff --git a/TypeScript/7OnLoadHook/types/models/enums/WildSpawnTypeNumber.d.ts b/TypeScript/7OnLoadHook/types/models/enums/WildSpawnTypeNumber.d.ts new file mode 100644 index 0000000..ff806fe --- /dev/null +++ b/TypeScript/7OnLoadHook/types/models/enums/WildSpawnTypeNumber.d.ts @@ -0,0 +1,33 @@ +export declare enum WildSpawnTypeNumber { + ASSAULT = 1, + MARKSMAN = 2, + BOSSTEST = 4, + BOSSBULLY = 8, + FOLLOWERTEST = 16, + FOLLOWERBULLY = 32, + BOSSKILLA = 64, + BOSSKOJANIY = 128, + FOLLOWERKOJANIY = 256, + PMCBOT = 512, + CURSEDASSAULT = 1024, + BOSSGLUHAR = 2048, + FOLLOWERGLUHARASSAULT = 4096, + FOLLOWERGLUHARSECURITY = 8192, + FOLLOWERGLUHARSCOUT = 16384, + FOLLOWERGLUHARSNIPE = 32768, + FOLLOWERSANITAR = 65536, + BOSSSANITAR = 131072, + TEST = 262144, + ASSAULTGROUP = 524288, + SECTANTWARRIOR = 1048576, + SECTANTPRIEST = 2097152, + BOSSTAGILLA = 4194304, + FOLLOWERTAGILLA = 8388608, + EXUSEC = 16777216, + GIFTER = 33554432, + BOSSKNIGHT = 67108864, + FOLLOWERBIGPIPE = 134217728, + FOLLOWERBIRDEYE = 268435456, + SPTUSEC = 536870912, + SPTBEAR = 1073741824 +} diff --git a/TypeScript/7OnLoadHook/types/models/enums/WindDirection.d.ts b/TypeScript/7OnLoadHook/types/models/enums/WindDirection.d.ts new file mode 100644 index 0000000..fb30b20 --- /dev/null +++ b/TypeScript/7OnLoadHook/types/models/enums/WindDirection.d.ts @@ -0,0 +1,10 @@ +export declare enum WindDirection { + EAST = 1, + NORTH = 2, + WEST = 3, + SOUTH = 4, + SE = 5, + SW = 6, + NW = 7, + NE = 8 +} diff --git a/TypeScript/7OnLoadHook/types/models/spt/config/IBotConfig.d.ts b/TypeScript/7OnLoadHook/types/models/spt/config/IBotConfig.d.ts index af8ceba..d6fa5e0 100644 --- a/TypeScript/7OnLoadHook/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/7OnLoadHook/types/models/spt/config/IBotConfig.d.ts @@ -27,6 +27,8 @@ export interface IBotConfig extends IBaseConfig { maxBotCap: Record; /** How many stacks of secret ammo should a bot have in its bot secure container */ secureContainerAmmoStackCount: number; + /** Batch generation size when type not available in cache */ + botGenerationBatchSizePerType: number; } export interface PresetBatch { assault: number; @@ -66,8 +68,12 @@ export interface EquipmentFilters { weaponModLimits: ModLimits; randomisedWeaponModSlots?: string[]; randomisedArmorSlots?: string[]; + faceShieldIsActiveChancePercent?: number; + lightLaserIsActiveChancePercent?: number; blacklist: EquipmentFilterDetails[]; whitelist: EquipmentFilterDetails[]; + clothing: WeightingAdjustmentDetails[]; + weightingAdjustments: WeightingAdjustmentDetails[]; } export interface ModLimits { /** How many scopes are allowed on a weapon - hard coded to work with OPTIC_SCOPE, ASSAULT_SCOPE, COLLIMATOR, COMPACT_COLLIMATOR */ @@ -80,3 +86,8 @@ export interface EquipmentFilterDetails { equipment: Record; cartridge: Record; } +export interface WeightingAdjustmentDetails { + levelRange: MinMax; + add: Record>; + edit: Record>; +} diff --git a/TypeScript/7OnLoadHook/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/7OnLoadHook/types/models/spt/config/IInventoryConfig.d.ts index ffffa41..4642b9b 100644 --- a/TypeScript/7OnLoadHook/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/7OnLoadHook/types/models/spt/config/IInventoryConfig.d.ts @@ -2,4 +2,10 @@ import { IBaseConfig } from "./IBaseConfig"; export interface IInventoryConfig extends IBaseConfig { kind: "aki-inventory"; newItemsMarkedFound: boolean; + randomLootContainers: Record; +} +export interface RewardDetails { + rewardCount: number; + foundInRaid: boolean; + rewardTplPool: Record; } diff --git a/TypeScript/7OnLoadHook/types/models/spt/config/ILocaleConfig.d.ts b/TypeScript/7OnLoadHook/types/models/spt/config/ILocaleConfig.d.ts index fe9abf7..0a8955c 100644 --- a/TypeScript/7OnLoadHook/types/models/spt/config/ILocaleConfig.d.ts +++ b/TypeScript/7OnLoadHook/types/models/spt/config/ILocaleConfig.d.ts @@ -1,5 +1,10 @@ import { IBaseConfig } from "./IBaseConfig"; export interface ILocaleConfig extends IBaseConfig { kind: "aki-locale"; - desiredLocale: string; + /** e.g. ru/en/cn/fr etc, or 'system', will take computer locale setting */ + gameLocale: string; + /** e.g. ru/en/cn/fr etc, or 'system', will take computer locale setting */ + serverLocale: string; + /** Languages server can be translated into */ + serverSupportedLocales: string[]; } diff --git a/TypeScript/7OnLoadHook/types/models/spt/config/IPmcConfig.d.ts b/TypeScript/7OnLoadHook/types/models/spt/config/IPmcConfig.d.ts index 9db2ba1..48601b2 100644 --- a/TypeScript/7OnLoadHook/types/models/spt/config/IPmcConfig.d.ts +++ b/TypeScript/7OnLoadHook/types/models/spt/config/IPmcConfig.d.ts @@ -6,9 +6,11 @@ export interface IPmcConfig { looseWeaponInBackpackChancePercent: number; looseWeaponInBackpackLootMinMax: MinMax; isUsec: number; + usecType: string; + bearType: string; chanceSameSideIsHostilePercent: number; /** key: location, value: type for usec/bear */ - pmcType: Record; + pmcType: Record>>; maxBackpackLootTotalRub: number; maxPocketLootTotalRub: number; maxVestLootTotalRub: number; diff --git a/TypeScript/7OnLoadHook/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/7OnLoadHook/types/models/spt/config/IRagfairConfig.d.ts index c1b8763..6786417 100644 --- a/TypeScript/7OnLoadHook/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/7OnLoadHook/types/models/spt/config/IRagfairConfig.d.ts @@ -28,12 +28,8 @@ export interface Reputation { gain: number; loss: number; } -export declare class OfferAdjustment { - maxPriceDifferenceBelowHandbookPercent: number; - handbookPriceMultipier: number; - priceThreshholdRub: number; -} export interface Dynamic { + barter: Barter; offerAdjustment: OfferAdjustment; expiredOfferThreshold: number; offerItemCount: MinMax; @@ -49,6 +45,20 @@ export interface Dynamic { showAsSingleStack: string[]; blacklist: Blacklist; } +export declare class Barter { + enable: boolean; + chancePercent: number; + itemCountMin: number; + itemCountMax: number; + priceRangeVariancePercent: number; + minRoubleCostToBecomeBarter: number; + itemTypeBlacklist: string[]; +} +export declare class OfferAdjustment { + maxPriceDifferenceBelowHandbookPercent: number; + handbookPriceMultipier: number; + priceThreshholdRub: number; +} export interface Condition { conditionChance: number; min: number; diff --git a/TypeScript/7OnLoadHook/types/models/spt/config/ISeasonalEventConfig.d.ts b/TypeScript/7OnLoadHook/types/models/spt/config/ISeasonalEventConfig.d.ts index bc60618..e410925 100644 --- a/TypeScript/7OnLoadHook/types/models/spt/config/ISeasonalEventConfig.d.ts +++ b/TypeScript/7OnLoadHook/types/models/spt/config/ISeasonalEventConfig.d.ts @@ -1,6 +1,9 @@ import { IBaseConfig } from "./IBaseConfig"; export interface ISeasonalEventConfig extends IBaseConfig { kind: "aki-seasonalevents"; + enableSeasonalEventDetection: boolean; + /** event / botType / equipSlot / itemid */ + eventGear: Record>>>; events: ISeasonalEvent[]; } export interface ISeasonalEvent { diff --git a/TypeScript/7OnLoadHook/types/models/spt/config/IWeatherConfig.d.ts b/TypeScript/7OnLoadHook/types/models/spt/config/IWeatherConfig.d.ts index bbdc43e..41a1c83 100644 --- a/TypeScript/7OnLoadHook/types/models/spt/config/IWeatherConfig.d.ts +++ b/TypeScript/7OnLoadHook/types/models/spt/config/IWeatherConfig.d.ts @@ -1,3 +1,4 @@ +import { WindDirection } from "../../../models/enums/WindDirection"; import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface IWeatherConfig extends IBaseConfig { @@ -7,12 +8,16 @@ export interface IWeatherConfig extends IBaseConfig { } export interface Weather { clouds: MinMax; - windSpeed: MinMax; - windDirection: MinMax; + windSpeed: WeatherSettings; + windDirection: WeatherSettings; windGustiness: MinMax; - rain: MinMax; + rain: WeatherSettings; rainIntensity: MinMax; - fog: MinMax; + fog: WeatherSettings; temp: MinMax; pressure: MinMax; } +export interface WeatherSettings { + values: T[]; + weights: number[]; +} diff --git a/TypeScript/7OnLoadHook/types/routers/item_events/HideoutItemEventRouter.d.ts b/TypeScript/7OnLoadHook/types/routers/item_events/HideoutItemEventRouter.d.ts index e1e98af..44bd1cd 100644 --- a/TypeScript/7OnLoadHook/types/routers/item_events/HideoutItemEventRouter.d.ts +++ b/TypeScript/7OnLoadHook/types/routers/item_events/HideoutItemEventRouter.d.ts @@ -1,7 +1,7 @@ -import { IPmcData } from "../../models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "../../models/eft/itemEvent/IItemEventRouterResponse"; import { HideoutCallbacks } from "../../callbacks/HideoutCallbacks"; import { HandledRoute, ItemEventRouterDefinition } from "../../di/Router"; +import { IPmcData } from "../../models/eft/common/IPmcData"; +import { IItemEventRouterResponse } from "../../models/eft/itemEvent/IItemEventRouterResponse"; export declare class HideoutItemEventRouter extends ItemEventRouterDefinition { protected hideoutCallbacks: HideoutCallbacks; constructor(hideoutCallbacks: HideoutCallbacks); diff --git a/TypeScript/7OnLoadHook/types/routers/item_events/InventoryItemEventRouter.d.ts b/TypeScript/7OnLoadHook/types/routers/item_events/InventoryItemEventRouter.d.ts index 2619bb9..953d322 100644 --- a/TypeScript/7OnLoadHook/types/routers/item_events/InventoryItemEventRouter.d.ts +++ b/TypeScript/7OnLoadHook/types/routers/item_events/InventoryItemEventRouter.d.ts @@ -1,7 +1,7 @@ -import { IPmcData } from "../../models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "../../models/eft/itemEvent/IItemEventRouterResponse"; import { InventoryCallbacks } from "../../callbacks/InventoryCallbacks"; import { HandledRoute, ItemEventRouterDefinition } from "../../di/Router"; +import { IPmcData } from "../../models/eft/common/IPmcData"; +import { IItemEventRouterResponse } from "../../models/eft/itemEvent/IItemEventRouterResponse"; export declare class InventoryItemEventRouter extends ItemEventRouterDefinition { protected inventoryCallbacks: InventoryCallbacks; constructor(inventoryCallbacks: InventoryCallbacks); diff --git a/TypeScript/7OnLoadHook/types/servers/HttpServer.d.ts b/TypeScript/7OnLoadHook/types/servers/HttpServer.d.ts index bbca8af..80c1d48 100644 --- a/TypeScript/7OnLoadHook/types/servers/HttpServer.d.ts +++ b/TypeScript/7OnLoadHook/types/servers/HttpServer.d.ts @@ -4,6 +4,7 @@ import { ApplicationContext } from "../context/ApplicationContext"; import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; import { ILogger } from "../models/spt/utils/ILogger"; +import { LocalisationService } from "../services/LocalisationService"; import { ConfigServer } from "./ConfigServer"; import { DatabaseServer } from "./DatabaseServer"; import { IHttpListener } from "./http/IHttpListener"; @@ -12,11 +13,12 @@ export declare class HttpServer { protected logger: ILogger; protected databaseServer: DatabaseServer; protected httpServerHelper: HttpServerHelper; + protected localisationService: LocalisationService; protected httpListeners: IHttpListener[]; protected configServer: ConfigServer; protected applicationContext: ApplicationContext; protected webSocketServer: WebSocketServer; - constructor(logger: ILogger, databaseServer: DatabaseServer, httpServerHelper: HttpServerHelper, httpListeners: IHttpListener[], configServer: ConfigServer, applicationContext: ApplicationContext, webSocketServer: WebSocketServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, httpServerHelper: HttpServerHelper, localisationService: LocalisationService, httpListeners: IHttpListener[], configServer: ConfigServer, applicationContext: ApplicationContext, webSocketServer: WebSocketServer); protected httpConfig: IHttpConfig; getCookies(req: http.IncomingMessage): any; handleRequest(req: IncomingMessage, resp: ServerResponse): void; diff --git a/TypeScript/7OnLoadHook/types/servers/SaveServer.d.ts b/TypeScript/7OnLoadHook/types/servers/SaveServer.d.ts index cb28f49..4dca514 100644 --- a/TypeScript/7OnLoadHook/types/servers/SaveServer.d.ts +++ b/TypeScript/7OnLoadHook/types/servers/SaveServer.d.ts @@ -1,20 +1,22 @@ +import { SaveLoadRouter } from "../di/Router"; import { IAkiProfile, Info } from "../models/eft/profile/IAkiProfile"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { VFS } from "../utils/VFS"; -import { SaveLoadRouter } from "../di/Router"; -import { ILogger } from "../models/spt/utils/ILogger"; export declare class SaveServer { protected vfs: VFS; protected saveLoadRouters: SaveLoadRouter[]; protected jsonUtil: JsonUtil; protected hashUtil: HashUtil; + protected localisationService: LocalisationService; protected logger: ILogger; protected profileFilepath: string; protected profiles: {}; protected onSave: {}; protected saveMd5: {}; - constructor(vfs: VFS, saveLoadRouters: SaveLoadRouter[], jsonUtil: JsonUtil, hashUtil: HashUtil, logger: ILogger); + constructor(vfs: VFS, saveLoadRouters: SaveLoadRouter[], jsonUtil: JsonUtil, hashUtil: HashUtil, localisationService: LocalisationService, logger: ILogger); load(): void; save(): void; getProfile(sessionId: string): IAkiProfile; diff --git a/TypeScript/7OnLoadHook/types/servers/WebSocketServer.d.ts b/TypeScript/7OnLoadHook/types/servers/WebSocketServer.d.ts index f33d214..5d40e6e 100644 --- a/TypeScript/7OnLoadHook/types/servers/WebSocketServer.d.ts +++ b/TypeScript/7OnLoadHook/types/servers/WebSocketServer.d.ts @@ -1,18 +1,20 @@ /// -import { HttpServerHelper } from "../helpers/HttpServerHelper"; -import WebSocket from "ws"; import http, { IncomingMessage } from "http"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { RandomUtil } from "../utils/RandomUtil"; +import WebSocket from "ws"; +import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { INotification } from "../models/eft/notifier/INotifier"; -import { ConfigServer } from "./ConfigServer"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { LocalisationService } from "../services/LocalisationService"; +import { RandomUtil } from "../utils/RandomUtil"; +import { ConfigServer } from "./ConfigServer"; export declare class WebSocketServer { protected logger: ILogger; protected randomUtil: RandomUtil; protected configServer: ConfigServer; + protected localisationService: LocalisationService; protected httpServerHelper: HttpServerHelper; - constructor(logger: ILogger, randomUtil: RandomUtil, configServer: ConfigServer, httpServerHelper: HttpServerHelper); + constructor(logger: ILogger, randomUtil: RandomUtil, configServer: ConfigServer, localisationService: LocalisationService, httpServerHelper: HttpServerHelper); protected httpConfig: IHttpConfig; protected defaultNotification: INotification; protected webSockets: Record; diff --git a/TypeScript/7OnLoadHook/types/servers/http/AkiHttpListener.d.ts b/TypeScript/7OnLoadHook/types/servers/http/AkiHttpListener.d.ts index 6f78939..acf92aa 100644 --- a/TypeScript/7OnLoadHook/types/servers/http/AkiHttpListener.d.ts +++ b/TypeScript/7OnLoadHook/types/servers/http/AkiHttpListener.d.ts @@ -1,22 +1,24 @@ /// /// import { IncomingMessage, ServerResponse } from "http"; -import { IHttpListener } from "./IHttpListener"; import { Serializer } from "../../di/Serializer"; import { ILogger } from "../../models/spt/utils/ILogger"; import { HttpRouter } from "../../routers/HttpRouter"; +import { LocalisationService } from "../../services/LocalisationService"; import { HttpResponseUtil } from "../../utils/HttpResponseUtil"; import { JsonUtil } from "../../utils/JsonUtil"; import { HttpBufferHandler } from "./HttpBufferHandler"; +import { IHttpListener } from "./IHttpListener"; export declare class AkiHttpListener implements IHttpListener { protected httpRouter: HttpRouter; protected serializers: Serializer[]; protected logger: ILogger; protected jsonUtil: JsonUtil; protected httpResponse: HttpResponseUtil; + protected localisationService: LocalisationService; protected httpBufferHandler: HttpBufferHandler; constructor(httpRouter: HttpRouter, // TODO: delay required - serializers: Serializer[], logger: ILogger, jsonUtil: JsonUtil, httpResponse: HttpResponseUtil, httpBufferHandler: HttpBufferHandler); + serializers: Serializer[], logger: ILogger, jsonUtil: JsonUtil, httpResponse: HttpResponseUtil, localisationService: LocalisationService, httpBufferHandler: HttpBufferHandler); canHandle(_: string, req: IncomingMessage): boolean; handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): void; sendResponse(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: Buffer, output: string): void; diff --git a/TypeScript/7OnLoadHook/types/services/BotEquipmentFilterService.d.ts b/TypeScript/7OnLoadHook/types/services/BotEquipmentFilterService.d.ts index 632f961..ae72cc3 100644 --- a/TypeScript/7OnLoadHook/types/services/BotEquipmentFilterService.d.ts +++ b/TypeScript/7OnLoadHook/types/services/BotEquipmentFilterService.d.ts @@ -1,12 +1,12 @@ import { IBotType } from "../models/eft/common/tables/IBotType"; -import { EquipmentFilters, EquipmentFilterDetails, IBotConfig } from "../models/spt/config/IBotConfig"; +import { EquipmentFilters, EquipmentFilterDetails, IBotConfig, WeightingAdjustmentDetails } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; export declare class BotEquipmentFilterService { protected logger: ILogger; protected configServer: ConfigServer; protected botConfig: IBotConfig; - protected botEquipmentFilterlists: Record; + protected botEquipmentConfig: Record; constructor(logger: ILogger, configServer: ConfigServer); /** * Filter a bots data to exclude equipment and cartridges defines in the botConfig @@ -30,6 +30,20 @@ export declare class BotEquipmentFilterService { * @returns EquipmentFilterDetails object */ protected getBotEquipmentWhitelist(botRole: string, playerLevel: number): EquipmentFilterDetails; + /** + * Retreive clothing weighting adjustments from bot.json config + * @param botRole Bot type to get adjustments for + * @param playerLevel level of player + * @returns Weighting adjustments for bots clothing + */ + protected getBotClothingAdjustments(botRole: string, playerLevel: number): WeightingAdjustmentDetails; + /** + * Retreive item weighting adjustments from bot.json config + * @param botRole Bot type to get adjustments for + * @param playerLevel level of player + * @returns Weighting adjustments for bot items + */ + protected getBotWeightingAdjustments(botRole: string, playerLevel: number): WeightingAdjustmentDetails; /** * Filter bot equipment based on blacklist and whitelist from config/bot.json * Prioritises whitelist first, if one is found blacklist is ignored @@ -47,4 +61,10 @@ export declare class BotEquipmentFilterService { * @returns Filtered bot file */ protected filterCartridges(baseBotNode: IBotType, blacklist: EquipmentFilterDetails, whitelist: EquipmentFilterDetails): void; + /** + * Add/Edit weighting changes to bot items using values from config/bot.json/equipment + * @param weightingAdjustments Weighting change to apply to bot + * @param botItemPool Bot item dictionary to adjust + */ + protected adjustWeighting(weightingAdjustments: WeightingAdjustmentDetails, botItemPool: Record): void; } diff --git a/TypeScript/7OnLoadHook/types/services/BotGenerationCacheService.d.ts b/TypeScript/7OnLoadHook/types/services/BotGenerationCacheService.d.ts index ba53fec..0be0576 100644 --- a/TypeScript/7OnLoadHook/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/7OnLoadHook/types/services/BotGenerationCacheService.d.ts @@ -8,11 +8,11 @@ export declare class BotGenerationCacheService { protected randomUtil: RandomUtil; protected jsonUtil: JsonUtil; protected botHelper: BotHelper; - protected storedBots: IBotBase[]; + protected storedBots: Map; constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, botHelper: BotHelper); /** * Store array of bots in cache, shuffle results before storage - * @param botsToStore + * @param botsToStore Bots we want to store in the cache */ storeBots(botsToStore: IBotBase[]): void; /** @@ -21,25 +21,7 @@ export declare class BotGenerationCacheService { * @param role role to retreive (assault/bossTagilla etc) * @returns IBotBase object */ - getBot(role: string): IBotBase[]; - /** - * Find a bot by its index from cache - * @param indexOfBotToReturn index to find bot by - * @returns bot profile - */ - protected getBotFromCache(indexOfBotToReturn: number): IBotBase; - /** - * Remove bot profile by index from cache - * @param indexOfBotToReturn Index of bot profile to remove - */ - protected removeBotFromCache(indexOfBotToReturn: number): void; - /** - * Get index of bot profile that matches criteria - * @param role Role of bot wanted - * @param getPmc Requested bot a pmc - * @returns index of found bot, -1 if not found - */ - protected getIndexOfBotToReturn(role: string, getPmc: boolean): number; + getBot(role: string): IBotBase; /** * Remove all cached bot profiles */ @@ -48,5 +30,5 @@ export declare class BotGenerationCacheService { * Does cache have bots * @returns true if empty */ - cacheIsEmpty(): boolean; + cacheHasBotOfRole(role: string): boolean; } diff --git a/TypeScript/7OnLoadHook/types/services/LocaleService.d.ts b/TypeScript/7OnLoadHook/types/services/LocaleService.d.ts index 33bea7b..8275b75 100644 --- a/TypeScript/7OnLoadHook/types/services/LocaleService.d.ts +++ b/TypeScript/7OnLoadHook/types/services/LocaleService.d.ts @@ -1,14 +1,42 @@ import { ILocaleConfig } from "../models/spt/config/ILocaleConfig"; +import { ILocaleGlobalBase } from "../models/spt/server/ILocaleBase"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +/** + * Handles getting locales from config or users machine + */ export declare class LocaleService { protected logger: ILogger; + protected databaseServer: DatabaseServer; protected configServer: ConfigServer; protected localeConfig: ILocaleConfig; - constructor(logger: ILogger, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, configServer: ConfigServer); /** - * Gets the locale key from the locale.json file + * Get the eft globals db file based on the configured locale in config/locale.json, if not found, fall back to 'en' + * @returns ILocaleGlobalBase + */ + getLocaleDb(): ILocaleGlobalBase; + /** + * Gets the game locale key from the locale.json file, + * if value is 'system' get system locale * @returns locale e.g en/ge/cz/cn */ - getDesiredLocale(): string; + getDesiredGameLocale(): string; + /** + * Gets the game locale key from the locale.json file, + * if value is 'system' get system locale + * @returns locale e.g en/ge/cz/cn + */ + getDesiredServerLocale(): string; + /** + * Get array of languages supported for localisation + * @returns array of locales e.g. en/fr/cn + */ + getServerSupportedLocales(): string[]; + /** + * Get the locale of the computer running the server + * @returns langage part of locale e.g. 'en' part of 'en-US' + */ + protected getPlatformLocale(): string; } diff --git a/TypeScript/7OnLoadHook/types/services/LocalisationService.d.ts b/TypeScript/7OnLoadHook/types/services/LocalisationService.d.ts new file mode 100644 index 0000000..519325d --- /dev/null +++ b/TypeScript/7OnLoadHook/types/services/LocalisationService.d.ts @@ -0,0 +1,21 @@ +import { I18n } from "i18n"; +import { ILocaleConfig } from "../models/spt/config/ILocaleConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { LocaleService } from "./LocaleService"; +/** + * Handles translating server text into different langauges + */ +export declare class LocalisationService { + protected logger: ILogger; + protected localeService: LocaleService; + protected localeConfig: ILocaleConfig; + protected i18n: I18n; + constructor(logger: ILogger, localeService: LocaleService); + /** + * Get a localised value using the passed in key + * @param key Key to loop up locale for + * @param args optional arguments + * @returns Localised string + */ + getText(key: string, args?: any): string; +} diff --git a/TypeScript/7OnLoadHook/types/services/PaymentService.d.ts b/TypeScript/7OnLoadHook/types/services/PaymentService.d.ts index a5e538f..c9ce95a 100644 --- a/TypeScript/7OnLoadHook/types/services/PaymentService.d.ts +++ b/TypeScript/7OnLoadHook/types/services/PaymentService.d.ts @@ -11,6 +11,7 @@ import { IProcessSellTradeRequestData } from "../models/eft/trade/IProcessSellTr import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +import { LocalisationService } from "./LocalisationService"; export declare class PaymentService { protected logger: ILogger; protected httpResponse: HttpResponseUtil; @@ -19,8 +20,9 @@ export declare class PaymentService { protected traderHelper: TraderHelper; protected itemHelper: ItemHelper; protected inventoryHelper: InventoryHelper; + protected localisationService: LocalisationService; protected paymentHelper: PaymentHelper; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, traderHelper: TraderHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper); + constructor(logger: ILogger, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, traderHelper: TraderHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, localisationService: LocalisationService, paymentHelper: PaymentHelper); /** * Take money and insert items into return to server request * @param {Object} pmcData @@ -50,7 +52,7 @@ export declare class PaymentService { * @param pmcData Player profile to find and remove currency from * @param currencyTpl Type of currency to pay * @param amountToPay money value to pay - * @param sessionID Sessino id + * @param sessionID Session id * @param output output object to send to client * @returns IItemEventRouterResponse */ diff --git a/TypeScript/7OnLoadHook/types/services/PlayerService.d.ts b/TypeScript/7OnLoadHook/types/services/PlayerService.d.ts index 519b7e5..2f364d5 100644 --- a/TypeScript/7OnLoadHook/types/services/PlayerService.d.ts +++ b/TypeScript/7OnLoadHook/types/services/PlayerService.d.ts @@ -2,10 +2,12 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { IPlayerIncrementSkillLevelRequestData } from "../models/eft/player/IPlayerIncrementSkillLevelRequestData"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "./LocalisationService"; export declare class PlayerService { protected logger: ILogger; + protected localisationService: LocalisationService; protected databaseServer: DatabaseServer; - constructor(logger: ILogger, databaseServer: DatabaseServer); + constructor(logger: ILogger, localisationService: LocalisationService, databaseServer: DatabaseServer); /** * increases the profile skill and updates any output * @param {Object} pmcData diff --git a/TypeScript/7OnLoadHook/types/services/PmcAiService.d.ts b/TypeScript/7OnLoadHook/types/services/PmcAiService.d.ts deleted file mode 100644 index 0690f1f..0000000 --- a/TypeScript/7OnLoadHook/types/services/PmcAiService.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { IBotConfig } from "../models/spt/config/IBotConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { ConfigServer } from "../servers/ConfigServer"; -/** Storing/retreving pmcRoles set at the start of a raid - its done at that point as we know what location the player is heading to */ -export declare class PmcAiService { - protected logger: ILogger; - protected configServer: ConfigServer; - protected botConfig: IBotConfig; - protected usecRole: string; - protected bearRole: string; - constructor(logger: ILogger, configServer: ConfigServer); - /** - * Convert from pmc side (usec/bear) to the side as defined in the bot config (usecType/bearType) - * @param pmcSide eft side (usec/bear) - * @returns pmc side as defined in config - */ - getPmcRole(pmcSide: "usec" | "bear" | string): string; - /** - * Set the roles for pmcs - * @param location map location to look up and use as pmc types - */ - setPmcRolesByLocation(location: string): void; - /** - * Clear the saved role from usec/bear PMCs - */ - clearPmcRoles(): void; -} diff --git a/TypeScript/7OnLoadHook/types/services/ProfileFixerService.d.ts b/TypeScript/7OnLoadHook/types/services/ProfileFixerService.d.ts index e772919..86a6af8 100644 --- a/TypeScript/7OnLoadHook/types/services/ProfileFixerService.d.ts +++ b/TypeScript/7OnLoadHook/types/services/ProfileFixerService.d.ts @@ -8,12 +8,14 @@ import { HideoutAreas } from "../models/enums/HideoutAreas"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { Watermark } from "../utils/Watermark"; +import { LocalisationService } from "./LocalisationService"; export declare class ProfileFixerService { protected logger: ILogger; protected watermark: Watermark; protected hideoutHelper: HideoutHelper; + protected localisationService: LocalisationService; protected databaseServer: DatabaseServer; - constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, databaseServer: DatabaseServer); + constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, localisationService: LocalisationService, databaseServer: DatabaseServer); /** * Find issues in the pmc profile data that may cause issues and fix them * @param pmcProfile profile to check and fix diff --git a/TypeScript/7OnLoadHook/types/services/RagfairOfferService.d.ts b/TypeScript/7OnLoadHook/types/services/RagfairOfferService.d.ts index a6f6b6d..86c1e52 100644 --- a/TypeScript/7OnLoadHook/types/services/RagfairOfferService.d.ts +++ b/TypeScript/7OnLoadHook/types/services/RagfairOfferService.d.ts @@ -11,6 +11,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { TimeUtil } from "../utils/TimeUtil"; +import { LocalisationService } from "./LocalisationService"; import { RagfairCategoriesService } from "./RagfairCategoriesService"; export declare class RagfairOfferService { protected logger: ILogger; @@ -22,12 +23,14 @@ export declare class RagfairOfferService { protected profileHelper: ProfileHelper; protected eventOutputHolder: EventOutputHolder; protected httpResponse: HttpResponseUtil; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected playerOffersLoaded: boolean; protected expiredOffers: Item[]; - protected offers: IRagfairOffer[]; + /** offerId, offer */ + protected offers: Record; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, databaseServer: DatabaseServer, saveServer: SaveServer, ragfairServerHelper: RagfairServerHelper, ragfairCategoriesService: RagfairCategoriesService, profileHelper: ProfileHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, databaseServer: DatabaseServer, saveServer: SaveServer, ragfairServerHelper: RagfairServerHelper, ragfairCategoriesService: RagfairCategoriesService, profileHelper: ProfileHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, localisationService: LocalisationService, configServer: ConfigServer); /** * Get all offers * @returns IRagfairOffer array diff --git a/TypeScript/7OnLoadHook/types/utils/App.d.ts b/TypeScript/7OnLoadHook/types/utils/App.d.ts index dcc2669..cc8a5af 100644 --- a/TypeScript/7OnLoadHook/types/utils/App.d.ts +++ b/TypeScript/7OnLoadHook/types/utils/App.d.ts @@ -1,14 +1,16 @@ -import { TimeUtil } from "./TimeUtil"; import { OnLoad } from "../di/OnLoad"; import { OnUpdate } from "../di/OnUpdate"; import { ILogger } from "../models/spt/utils/ILogger"; +import { LocalisationService } from "../services/LocalisationService"; +import { TimeUtil } from "./TimeUtil"; export declare class App { protected logger: ILogger; protected timeUtil: TimeUtil; + protected localisationService: LocalisationService; protected onLoadComponents: OnLoad[]; protected onUpdateComponents: OnUpdate[]; protected onUpdateLastRun: {}; - constructor(logger: ILogger, timeUtil: TimeUtil, onLoadComponents: OnLoad[], onUpdateComponents: OnUpdate[]); + constructor(logger: ILogger, timeUtil: TimeUtil, localisationService: LocalisationService, onLoadComponents: OnLoad[], onUpdateComponents: OnUpdate[]); load(): void; protected update(onUpdateComponents: OnUpdate[]): void; protected logUpdateException(err: any, updateable: OnUpdate): void; diff --git a/TypeScript/7OnLoadHook/types/utils/DatabaseImporter.d.ts b/TypeScript/7OnLoadHook/types/utils/DatabaseImporter.d.ts index 483e135..31670ae 100644 --- a/TypeScript/7OnLoadHook/types/utils/DatabaseImporter.d.ts +++ b/TypeScript/7OnLoadHook/types/utils/DatabaseImporter.d.ts @@ -3,15 +3,17 @@ import { IDatabaseTables } from "../models/spt/server/IDatabaseTables"; import { ILogger } from "../models/spt/utils/ILogger"; import { ImageRouter } from "../routers/ImageRouter"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { JsonUtil } from "./JsonUtil"; import { VFS } from "./VFS"; export declare class DatabaseImporter extends OnLoad { protected logger: ILogger; protected vfs: VFS; protected jsonUtil: JsonUtil; + protected localisationService: LocalisationService; protected databaseServer: DatabaseServer; protected imageRouter: ImageRouter; - constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, databaseServer: DatabaseServer, imageRouter: ImageRouter); + constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, localisationService: LocalisationService, databaseServer: DatabaseServer, imageRouter: ImageRouter); onLoad(): void; /** * Read all json files in database folder and map into a json object diff --git a/TypeScript/7OnLoadHook/types/utils/HttpResponseUtil.d.ts b/TypeScript/7OnLoadHook/types/utils/HttpResponseUtil.d.ts index 29502be..3a78618 100644 --- a/TypeScript/7OnLoadHook/types/utils/HttpResponseUtil.d.ts +++ b/TypeScript/7OnLoadHook/types/utils/HttpResponseUtil.d.ts @@ -1,10 +1,13 @@ -import { JsonUtil } from "./JsonUtil"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { INullResponseData } from "../models/eft/httpResponse/INullResponseData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; +import { BackendErrorCodes } from "../models/enums/BackendErrorCodes"; +import { LocalisationService } from "../services/LocalisationService"; +import { JsonUtil } from "./JsonUtil"; export declare class HttpResponseUtil { protected jsonUtil: JsonUtil; - constructor(jsonUtil: JsonUtil); + protected localisationService: LocalisationService; + constructor(jsonUtil: JsonUtil, localisationService: LocalisationService); protected clearString(s: string): any; noBody(data: any): any; getBody(data: T, err?: number, errmsg?: any): IGetBodyResponseData; @@ -12,5 +15,5 @@ export declare class HttpResponseUtil { emptyResponse(): IGetBodyResponseData; nullResponse(): INullResponseData; emptyArrayResponse(): IGetBodyResponseData; - appendErrorToOutput(output: IItemEventRouterResponse, message?: string, title?: string): IItemEventRouterResponse; + appendErrorToOutput(output: IItemEventRouterResponse, message?: string, errorCode?: BackendErrorCodes): IItemEventRouterResponse; } diff --git a/TypeScript/7OnLoadHook/types/utils/RandomUtil.d.ts b/TypeScript/7OnLoadHook/types/utils/RandomUtil.d.ts index 633e472..aa556e3 100644 --- a/TypeScript/7OnLoadHook/types/utils/RandomUtil.d.ts +++ b/TypeScript/7OnLoadHook/types/utils/RandomUtil.d.ts @@ -110,6 +110,12 @@ export declare class RandomUtil { getIntEx(max: number): number; getFloat(min: number, max: number): number; getBool(): boolean; + /** + * Check if number passes a check out of 100 + * @param chancePercent value check needs to be above + * @returns true if value passes check + */ + getChance100(chancePercent: number): boolean; getStringArrayValue(arr: string[]): string; getArrayValue(arr: T[]): T; getKey(node: any): string; diff --git a/TypeScript/7OnLoadHook/types/utils/Watermark.d.ts b/TypeScript/7OnLoadHook/types/utils/Watermark.d.ts index c6dc120..e02eba2 100644 --- a/TypeScript/7OnLoadHook/types/utils/Watermark.d.ts +++ b/TypeScript/7OnLoadHook/types/utils/Watermark.d.ts @@ -1,20 +1,15 @@ import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { LocalisationService } from "../services/LocalisationService"; export declare class WatermarkLocale { - protected locales: { - "en-US": { - description: string[]; - warning: string[]; - modding: string[]; - }; - "zh-CN": { - description: string[]; - warning: string[]; - modding: string[]; - }; + protected localisationService: LocalisationService; + constructor(localisationService: LocalisationService); + protected watermark: { + description: string[]; + warning: string[]; + modding: string[]; }; - getLocale(): string; getDescription(): string[]; getWarning(): string[]; getModding(): string[]; @@ -22,9 +17,10 @@ export declare class WatermarkLocale { export declare class Watermark { protected logger: ILogger; protected configServer: ConfigServer; + protected localisationService: LocalisationService; protected watermarkLocale?: WatermarkLocale; protected akiConfig: ICoreConfig; - constructor(logger: ILogger, configServer: ConfigServer, watermarkLocale?: WatermarkLocale); + constructor(logger: ILogger, configServer: ConfigServer, localisationService: LocalisationService, watermarkLocale?: WatermarkLocale); protected text: string[]; protected versionLabel: string; initialize(): void; diff --git a/TypeScript/8OnUpdateHook/types/callbacks/BotCallbacks.d.ts b/TypeScript/8OnUpdateHook/types/callbacks/BotCallbacks.d.ts index 2db60dc..827015e 100644 --- a/TypeScript/8OnUpdateHook/types/callbacks/BotCallbacks.d.ts +++ b/TypeScript/8OnUpdateHook/types/callbacks/BotCallbacks.d.ts @@ -8,8 +8,29 @@ export declare class BotCallbacks { protected botController: BotController; protected httpResponse: HttpResponseUtil; constructor(botController: BotController, httpResponse: HttpResponseUtil); + /** + * Handle singleplayer/settings/bot/limit + * @returns string + */ getBotLimit(url: string, info: IEmptyRequestData, sessionID: string): string; + /** + * Handle singleplayer/settings/bot/difficulty + * @returns string + */ getBotDifficulty(url: string, info: IEmptyRequestData, sessionID: string): string; + /** + * Handle client/game/bot/generate + * @returns IGetBodyResponseData + */ generateBots(url: string, info: IGenerateBotsRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle singleplayer/settings/bot/maxCap + * @returns string + */ getBotCap(): string; + /** + * Handle singleplayer/settings/bot/getBotBehaviours + * @returns string + */ + getBotBehaviours(): string; } diff --git a/TypeScript/8OnUpdateHook/types/callbacks/CustomizationCallbacks.d.ts b/TypeScript/8OnUpdateHook/types/callbacks/CustomizationCallbacks.d.ts index 3bab8c0..75d5701 100644 --- a/TypeScript/8OnUpdateHook/types/callbacks/CustomizationCallbacks.d.ts +++ b/TypeScript/8OnUpdateHook/types/callbacks/CustomizationCallbacks.d.ts @@ -3,6 +3,7 @@ import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { IPmcData } from "../models/eft/common/IPmcData"; import { ISuit } from "../models/eft/common/tables/ITrader"; import { IBuyClothingRequestData } from "../models/eft/customization/IBuyClothingRequestData"; +import { IGetSuitsResponse } from "../models/eft/customization/IGetSuitsResponse"; import { IWearClothingRequestData } from "../models/eft/customization/IWearClothingRequestData"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; @@ -13,10 +14,15 @@ export declare class CustomizationCallbacks { protected saveServer: SaveServer; protected httpResponse: HttpResponseUtil; constructor(customizationController: CustomizationController, saveServer: SaveServer, httpResponse: HttpResponseUtil); - getSuits(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<{ - _id: string; - suites: string[]; - }>; + /** + * Handles client/trading/customization/storage + * @returns + */ + getSuits(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handles client/trading/customization + * @returns ISuit[] + */ getTraderSuits(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; wearClothing(pmcData: IPmcData, body: IWearClothingRequestData, sessionID: string): IItemEventRouterResponse; buyClothing(pmcData: IPmcData, body: IBuyClothingRequestData, sessionID: string): IItemEventRouterResponse; diff --git a/TypeScript/8OnUpdateHook/types/callbacks/DataCallbacks.d.ts b/TypeScript/8OnUpdateHook/types/callbacks/DataCallbacks.d.ts index 04566ff..2efcf81 100644 --- a/TypeScript/8OnUpdateHook/types/callbacks/DataCallbacks.d.ts +++ b/TypeScript/8OnUpdateHook/types/callbacks/DataCallbacks.d.ts @@ -12,15 +12,42 @@ import { ILanguageBase } from "../models/spt/server/ILocaleBase"; import { ISettingsBase } from "../models/spt/server/ISettingsBase"; import { DatabaseServer } from "../servers/DatabaseServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +/** + * Handle client requests + */ export declare class DataCallbacks { protected httpResponse: HttpResponseUtil; protected databaseServer: DatabaseServer; constructor(httpResponse: HttpResponseUtil, databaseServer: DatabaseServer); + /** + * Handles client/settings + * @returns ISettingsBase + */ getSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handles client/globals + * @returns IGlobals + */ getGlobals(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handles client/items + * @returns string + */ getTemplateItems(url: string, info: IEmptyRequestData, sessionID: string): string; + /** + * Handles client/handbook/templates + * @returns IHandbookBase + */ getTemplateHandbook(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handles client/customization + * @returns Record>; + /** + * Handles client/account/customization + * @returns string[] + */ getTemplateCharacter(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getTemplateQuests(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getHideoutSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; @@ -28,6 +55,6 @@ export declare class DataCallbacks { gethideoutProduction(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getHideoutScavcase(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getLocalesLanguages(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - getLocalesMenu(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + getLocalesMenu(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getLocalesGlobal(url: string, info: IEmptyRequestData, sessionID: string): string; } diff --git a/TypeScript/8OnUpdateHook/types/callbacks/DialogueCallbacks.d.ts b/TypeScript/8OnUpdateHook/types/callbacks/DialogueCallbacks.d.ts index 634f90b..7b2eeae 100644 --- a/TypeScript/8OnUpdateHook/types/callbacks/DialogueCallbacks.d.ts +++ b/TypeScript/8OnUpdateHook/types/callbacks/DialogueCallbacks.d.ts @@ -26,15 +26,27 @@ export declare class DialogueCallbacks extends OnUpdate { protected httpResponse: HttpResponseUtil; protected dialogueController: DialogueController; constructor(hashUtil: HashUtil, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, dialogueController: DialogueController); + /** + * Handles client/friend/list + * @returns IGetFriendListDataResponse + */ getFriendList(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handles client/chatServer/list + * @returns + */ getChatServerList(url: string, info: IGetChatServerListRequestData, sessionID: string): IGetBodyResponseData; getMailDialogList(url: string, info: IGetMailDialogListRequestData, sessionID: string): IGetBodyResponseData; getMailDialogView(url: string, info: IGetMailDialogViewRequestData, sessionID: string): IGetBodyResponseData; - getMailDialogInfo(url: string, info: IGetMailDialogInfoRequestData, sessionID: string): IGetBodyResponseData; + getMailDialogInfo(url: string, info: IGetMailDialogInfoRequestData, sessionID: string): IGetBodyResponseData; removeDialog(url: string, info: IRemoveDialogRequestData, sessionID: string): IGetBodyResponseData; pinDialog(url: string, info: IPinDialogRequestData, sessionID: string): IGetBodyResponseData; unpinDialog(url: string, info: IPinDialogRequestData, sessionID: string): IGetBodyResponseData; setRead(url: string, info: ISetDialogReadRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handles client/mail/dialog/getAllAttachments + * @returns IGetAllAttachmentsResponse + */ getAllAttachments(url: string, info: IGetAllAttachmentsRequestData, sessionID: string): IGetBodyResponseData; listOutbox(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; listInbox(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; diff --git a/TypeScript/8OnUpdateHook/types/callbacks/GameCallbacks.d.ts b/TypeScript/8OnUpdateHook/types/callbacks/GameCallbacks.d.ts index 5e4c240..3a6b7e6 100644 --- a/TypeScript/8OnUpdateHook/types/callbacks/GameCallbacks.d.ts +++ b/TypeScript/8OnUpdateHook/types/callbacks/GameCallbacks.d.ts @@ -3,6 +3,9 @@ import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { ICheckVersionResponse } from "../models/eft/game/ICheckVersionResponse"; import { IGameConfigResponse } from "../models/eft/game/IGameConfigResponse"; import { IGameEmptyCrcRequestData } from "../models/eft/game/IGameEmptyCrcRequestData"; +import { IGameKeepAliveResponse } from "../models/eft/game/IGameKeepAliveResponse"; +import { IGameLogoutResponseData } from "../models/eft/game/IGameLogoutResponseData"; +import { IGameStartResponse } from "../models/eft/game/IGameStartResponse"; import { IReportNicknameRequestData } from "../models/eft/game/IReportNicknameRequestData"; import { IServerDetails } from "../models/eft/game/IServerDetails"; import { IVersionValidateRequestData } from "../models/eft/game/IVersionValidateRequestData"; @@ -15,13 +18,37 @@ declare class GameCallbacks { protected watermark: Watermark; protected gameController: GameController; constructor(httpResponse: HttpResponseUtil, watermark: Watermark, gameController: GameController); + /** + * Handle client/game/version/validate + * @returns INullResponseData + */ versionValidate(url: string, info: IVersionValidateRequestData, sessionID: string): INullResponseData; - gameStart(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - gameLogout(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/game/start + * @returns IGameStartResponse + */ + gameStart(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/game/logout + * @returns IGameLogoutResponseData + */ + gameLogout(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/game/config + * @returns IGameConfigResponse + */ getGameConfig(url: string, info: IGameEmptyCrcRequestData, sessionID: string): IGetBodyResponseData; getServer(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; validateGameVersion(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - gameKeepalive(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/game/keepalive + * @returns IGameKeepAliveResponse + */ + gameKeepalive(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle singleplayer/settings/version + * @returns string + */ getVersion(url: string, info: IEmptyRequestData, sessionID: string): string; reportNickname(url: string, info: IReportNicknameRequestData, sessionID: string): INullResponseData; } diff --git a/TypeScript/8OnUpdateHook/types/callbacks/HealthCallbacks.d.ts b/TypeScript/8OnUpdateHook/types/callbacks/HealthCallbacks.d.ts index 8672be7..7edf03e 100644 --- a/TypeScript/8OnUpdateHook/types/callbacks/HealthCallbacks.d.ts +++ b/TypeScript/8OnUpdateHook/types/callbacks/HealthCallbacks.d.ts @@ -21,7 +21,19 @@ export declare class HealthCallbacks { * @returns empty response, no data sent back to client */ syncHealth(url: string, info: ISyncHealthRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle Eat + * @returns IItemEventRouterResponse + */ offraidEat(pmcData: IPmcData, body: IOffraidEatRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle Heal + * @returns IItemEventRouterResponse + */ offraidHeal(pmcData: IPmcData, body: IOffraidHealRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle RestoreHealth + * @returns IItemEventRouterResponse + */ healthTreatment(pmcData: IPmcData, info: IHealthTreatmentRequestData, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/8OnUpdateHook/types/callbacks/HideoutCallbacks.d.ts b/TypeScript/8OnUpdateHook/types/callbacks/HideoutCallbacks.d.ts index 99ab4c9..e39e806 100644 --- a/TypeScript/8OnUpdateHook/types/callbacks/HideoutCallbacks.d.ts +++ b/TypeScript/8OnUpdateHook/types/callbacks/HideoutCallbacks.d.ts @@ -19,14 +19,77 @@ export declare class HideoutCallbacks extends OnUpdate { protected hideoutConfig: IHideoutConfig; constructor(hideoutController: HideoutController, // TODO: delay needed configServer: ConfigServer); + /** + * Handle HideoutUpgrade + * @param pmcData + * @param body + * @param sessionID + * @returns + */ upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutUpgradeComplete + * @param pmcData + * @param body + * @param sessionID + * @returns + */ upgradeComplete(pmcData: IPmcData, body: IHideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutPutItemsInAreaSlots + * @param pmcData + * @param body + * @param sessionID + * @returns + */ putItemsInAreaSlots(pmcData: IPmcData, body: IHideoutPutItemInRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutTakeItemsFromAreaSlots + * @param pmcData + * @param body + * @param sessionID + * @returns + */ takeItemsFromAreaSlots(pmcData: IPmcData, body: IHideoutTakeItemOutRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutToggleArea + * @param pmcData + * @param body + * @param sessionID + * @returns + */ toggleArea(pmcData: IPmcData, body: IHideoutToggleAreaRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutSingleProductionStart + * @param pmcData + * @param body + * @param sessionID + * @returns + */ singleProductionStart(pmcData: IPmcData, body: IHideoutSingleProductionStartRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutScavCaseProductionStart + * @param pmcData + * @param body + * @param sessionID + * @returns + */ scavCaseProductionStart(pmcData: IPmcData, body: IHideoutScavCaseStartRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutContinuousProductionStart + * @param pmcData + * @param body + * @param sessionID + * @returns + */ continuousProductionStart(pmcData: IPmcData, body: IHideoutContinousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutTakeProduction + * @param pmcData + * @param body + * @param sessionID + * @returns + */ takeProduction(pmcData: IPmcData, body: IHideoutTakeProductionRequestData, sessionID: string): IItemEventRouterResponse; onUpdate(timeSinceLastRun: number): boolean; getRoute(): string; diff --git a/TypeScript/8OnUpdateHook/types/callbacks/InraidCallbacks.d.ts b/TypeScript/8OnUpdateHook/types/callbacks/InraidCallbacks.d.ts index 05bcce4..918bfaf 100644 --- a/TypeScript/8OnUpdateHook/types/callbacks/InraidCallbacks.d.ts +++ b/TypeScript/8OnUpdateHook/types/callbacks/InraidCallbacks.d.ts @@ -1,23 +1,49 @@ import { InraidController } from "../controllers/InraidController"; -import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { INullResponseData } from "../models/eft/httpResponse/INullResponseData"; import { IRegisterPlayerRequestData } from "../models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; -import { IAirdropConfig } from "../models/spt/config/IAirdropConfig"; -import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; -import { ConfigServer } from "../servers/ConfigServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +/** + * Handle client requests + */ export declare class InraidCallbacks { protected inraidController: InraidController; protected httpResponse: HttpResponseUtil; - protected configServer: ConfigServer; - protected airdropConfig: IAirdropConfig; - protected inraidConfig: IInRaidConfig; - constructor(inraidController: InraidController, httpResponse: HttpResponseUtil, configServer: ConfigServer); + constructor(inraidController: InraidController, httpResponse: HttpResponseUtil); + /** + * Handle client/location/getLocalloot + * @param url + * @param info register player request + * @param sessionID Session id + * @returns Null http response + */ registerPlayer(url: string, info: IRegisterPlayerRequestData, sessionID: string): INullResponseData; + /** + * Handle raid/profile/save + * @param url + * @param info Save progress request + * @param sessionID Session id + * @returns Null http response + */ saveProgress(url: string, info: ISaveProgressRequestData, sessionID: string): INullResponseData; + /** + * Handle singleplayer/settings/raid/endstate + * @returns + */ getRaidEndState(): string; - getRaidMenuSettings(url: string, info: IEmptyRequestData, sessionID: string): string; - getWeaponDurability(url: string, info: any, sessionID: string): string; - getAirdropConfig(url: string, info: any, sessionID: string): string; + /** + * Handle singleplayer/settings/raid/menu + * @returns JSON as string + */ + getRaidMenuSettings(): string; + /** + * Handle singleplayer/settings/weapon/durability + * @returns + */ + getWeaponDurability(): string; + /** + * Handle singleplayer/airdrop/config + * @returns JSON as string + */ + getAirdropConfig(): string; } diff --git a/TypeScript/8OnUpdateHook/types/callbacks/InsuranceCallbacks.d.ts b/TypeScript/8OnUpdateHook/types/callbacks/InsuranceCallbacks.d.ts index 8835ba2..a171e1c 100644 --- a/TypeScript/8OnUpdateHook/types/callbacks/InsuranceCallbacks.d.ts +++ b/TypeScript/8OnUpdateHook/types/callbacks/InsuranceCallbacks.d.ts @@ -17,7 +17,15 @@ export declare class InsuranceCallbacks extends OnUpdate { protected configServer: ConfigServer; protected insuranceConfig: IInsuranceConfig; constructor(insuranceController: InsuranceController, insuranceService: InsuranceService, httpResponse: HttpResponseUtil, configServer: ConfigServer); + /** + * Handle client/insurance/items/list/cost + * @returns IGetInsuranceCostResponseData + */ getInsuranceCost(url: string, info: IGetInsuranceCostRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle Insure + * @returns IItemEventRouterResponse + */ insure(pmcData: IPmcData, body: IInsureRequestData, sessionID: string): IItemEventRouterResponse; onUpdate(secondsSinceLastRun: number): boolean; getRoute(): string; diff --git a/TypeScript/8OnUpdateHook/types/callbacks/InventoryCallbacks.d.ts b/TypeScript/8OnUpdateHook/types/callbacks/InventoryCallbacks.d.ts index 9ab1486..46bf6fd 100644 --- a/TypeScript/8OnUpdateHook/types/callbacks/InventoryCallbacks.d.ts +++ b/TypeScript/8OnUpdateHook/types/callbacks/InventoryCallbacks.d.ts @@ -16,6 +16,7 @@ import { IInventorySwapRequestData } from "../models/eft/inventory/IInventorySwa import { IInventoryTagRequestData } from "../models/eft/inventory/IInventoryTagRequestData"; import { IInventoryToggleRequestData } from "../models/eft/inventory/IInventoryToggleRequestData"; import { IInventoryTransferRequestData } from "../models/eft/inventory/IInventoryTransferRequestData"; +import { IOpenRandomLootContainerRequestData } from "../models/eft/inventory/IOpenRandomLootContainerRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; export declare class InventoryCallbacks { protected inventoryController: InventoryController; @@ -36,4 +37,5 @@ export declare class InventoryCallbacks { createMapMarker(pmcData: IPmcData, body: IInventoryCreateMarkerRequestData, sessionID: string): IItemEventRouterResponse; deleteMapMarker(pmcData: IPmcData, body: IInventoryDeleteMarkerRequestData, sessionID: string): IItemEventRouterResponse; editMapMarker(pmcData: IPmcData, body: IInventoryEditMarkerRequestData, sessionID: string): IItemEventRouterResponse; + openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/8OnUpdateHook/types/callbacks/ItemEventCallbacks.d.ts b/TypeScript/8OnUpdateHook/types/callbacks/ItemEventCallbacks.d.ts index f4f04f9..fbb0b5f 100644 --- a/TypeScript/8OnUpdateHook/types/callbacks/ItemEventCallbacks.d.ts +++ b/TypeScript/8OnUpdateHook/types/callbacks/ItemEventCallbacks.d.ts @@ -1,4 +1,5 @@ import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; +import { Warning } from "../models/eft/itemEvent/IItemEventRouterBase"; import { IItemEventRouterRequest } from "../models/eft/itemEvent/IItemEventRouterRequest"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { ItemEventRouter } from "../routers/ItemEventRouter"; @@ -8,4 +9,5 @@ export declare class ItemEventCallbacks { protected itemEventRouter: ItemEventRouter; constructor(httpResponse: HttpResponseUtil, itemEventRouter: ItemEventRouter); handleEvents(url: string, info: IItemEventRouterRequest, sessionID: string): IGetBodyResponseData; + protected getErrorCode(warnings: Warning[]): number; } diff --git a/TypeScript/8OnUpdateHook/types/callbacks/MatchCallbacks.d.ts b/TypeScript/8OnUpdateHook/types/callbacks/MatchCallbacks.d.ts index 2a92ef5..10fbc44 100644 --- a/TypeScript/8OnUpdateHook/types/callbacks/MatchCallbacks.d.ts +++ b/TypeScript/8OnUpdateHook/types/callbacks/MatchCallbacks.d.ts @@ -34,6 +34,10 @@ export declare class MatchCallbacks { serverAvailable(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData | IGetBodyResponseData; joinMatch(url: string, info: IJoinMatchRequestData, sessionID: string): IGetBodyResponseData; getMetrics(url: string, info: any, sessionID: string): IGetBodyResponseData; + /** + * Handle client/match/group/status + * @returns + */ getGroupStatus(url: string, info: IGetGroupStatusRequestData, sessionID: string): IGetBodyResponseData; createGroup(url: string, info: ICreateGroupRequestData, sessionID: string): IGetBodyResponseData; deleteGroup(url: string, info: any, sessionID: string): INullResponseData; diff --git a/TypeScript/8OnUpdateHook/types/callbacks/NotifierCallbacks.d.ts b/TypeScript/8OnUpdateHook/types/callbacks/NotifierCallbacks.d.ts index c42058f..fab325b 100644 --- a/TypeScript/8OnUpdateHook/types/callbacks/NotifierCallbacks.d.ts +++ b/TypeScript/8OnUpdateHook/types/callbacks/NotifierCallbacks.d.ts @@ -4,6 +4,7 @@ import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { INotifierChannel } from "../models/eft/notifier/INotifier"; import { ISelectProfileRequestData } from "../models/eft/notifier/ISelectProfileRequestData"; +import { ISelectProfileResponse } from "../models/eft/notifier/ISelectProfileResponse"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; export declare class NotifierCallbacks { protected httpServerHelper: HttpServerHelper; @@ -19,6 +20,10 @@ export declare class NotifierCallbacks { sendNotification(sessionID: string, req: any, resp: any, data: any): void; getNotifier(url: string, info: any, sessionID: string): IGetBodyResponseData; createNotifierChannel(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - selectProfile(url: string, info: ISelectProfileRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/game/profile/select + * @returns ISelectProfileResponse + */ + selectProfile(url: string, info: ISelectProfileRequestData, sessionID: string): IGetBodyResponseData; notify(url: string, info: any, sessionID: string): string; } diff --git a/TypeScript/8OnUpdateHook/types/callbacks/QuestCallbacks.d.ts b/TypeScript/8OnUpdateHook/types/callbacks/QuestCallbacks.d.ts index 559c29e..2a3eb20 100644 --- a/TypeScript/8OnUpdateHook/types/callbacks/QuestCallbacks.d.ts +++ b/TypeScript/8OnUpdateHook/types/callbacks/QuestCallbacks.d.ts @@ -21,6 +21,13 @@ export declare class QuestCallbacks { acceptQuest(pmcData: IPmcData, body: IAcceptQuestRequestData, sessionID: string): IItemEventRouterResponse; completeQuest(pmcData: IPmcData, body: ICompleteQuestRequestData, sessionID: string): IItemEventRouterResponse; handoverQuest(pmcData: IPmcData, body: IHandoverQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle client/quest/list + * @param url + * @param info + * @param sessionID + * @returns + */ listQuests(url: string, info: IListQuestsRequestData, sessionID: string): IGetBodyResponseData; activityPeriods(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; } diff --git a/TypeScript/8OnUpdateHook/types/callbacks/RagfairCallbacks.d.ts b/TypeScript/8OnUpdateHook/types/callbacks/RagfairCallbacks.d.ts index c609f2f..37f3807 100644 --- a/TypeScript/8OnUpdateHook/types/callbacks/RagfairCallbacks.d.ts +++ b/TypeScript/8OnUpdateHook/types/callbacks/RagfairCallbacks.d.ts @@ -35,7 +35,7 @@ export declare class RagfairCallbacks extends OnLoadOnUpdate { getRoute(): string; search(url: string, info: ISearchRequestData, sessionID: string): IGetBodyResponseData; getMarketPrice(url: string, info: IGetMarketPriceRequestData, sessionID: string): IGetBodyResponseData; - getItemPrices(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + getItemPrices(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData>; addOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; removeOffer(pmcData: IPmcData, info: IRemoveOfferRequestData, sessionID: string): IItemEventRouterResponse; extendOffer(pmcData: IPmcData, info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; diff --git a/TypeScript/8OnUpdateHook/types/callbacks/TraderCallbacks.d.ts b/TypeScript/8OnUpdateHook/types/callbacks/TraderCallbacks.d.ts index e4fd099..40a1455 100644 --- a/TypeScript/8OnUpdateHook/types/callbacks/TraderCallbacks.d.ts +++ b/TypeScript/8OnUpdateHook/types/callbacks/TraderCallbacks.d.ts @@ -12,6 +12,10 @@ export declare class TraderCallbacks extends OnLoadOnUpdate { onUpdate(): boolean; getRoute(): string; getTraderSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/trading/api/getUserAssortPrice/trader + * @returns + */ getProfilePurchases(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData>; getTrader(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getAssort(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; diff --git a/TypeScript/8OnUpdateHook/types/callbacks/WeatherCallbacks.d.ts b/TypeScript/8OnUpdateHook/types/callbacks/WeatherCallbacks.d.ts index ae784c8..f9d2002 100644 --- a/TypeScript/8OnUpdateHook/types/callbacks/WeatherCallbacks.d.ts +++ b/TypeScript/8OnUpdateHook/types/callbacks/WeatherCallbacks.d.ts @@ -1,10 +1,15 @@ import { WeatherController } from "../controllers/WeatherController"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; +import { IWeatherData } from "../models/eft/weather/IWeatherData"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; export declare class WeatherCallbacks { protected httpResponse: HttpResponseUtil; protected weatherController: WeatherController; constructor(httpResponse: HttpResponseUtil, weatherController: WeatherController); - getWeather(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/weather + * @returns IWeatherData + */ + getWeather(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; } diff --git a/TypeScript/8OnUpdateHook/types/context/ContextVariableType.d.ts b/TypeScript/8OnUpdateHook/types/context/ContextVariableType.d.ts index 5fc1704..a7dd9b5 100644 --- a/TypeScript/8OnUpdateHook/types/context/ContextVariableType.d.ts +++ b/TypeScript/8OnUpdateHook/types/context/ContextVariableType.d.ts @@ -1,4 +1,8 @@ export declare enum ContextVariableType { + /** Logged in users session id */ SESSION_ID = 0, - MATCH_INFO = 1 + /** Currently acive raid information */ + MATCH_INFO = 1, + /** Timestamp when client first connected */ + CLIENT_START_TIMESTAMP = 2 } diff --git a/TypeScript/8OnUpdateHook/types/controllers/BotController.d.ts b/TypeScript/8OnUpdateHook/types/controllers/BotController.d.ts index a5111d5..92317c3 100644 --- a/TypeScript/8OnUpdateHook/types/controllers/BotController.d.ts +++ b/TypeScript/8OnUpdateHook/types/controllers/BotController.d.ts @@ -1,6 +1,8 @@ import { ApplicationContext } from "../context/ApplicationContext"; import { BotGenerator } from "../generators/BotGenerator"; +import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { IGenerateBotsRequestData } from "../models/eft/bot/IGenerateBotsRequestData"; import { IBotBase } from "../models/eft/common/tables/IBotBase"; import { IBotCore } from "../models/eft/common/tables/IBotCore"; @@ -10,18 +12,23 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; -import { PmcAiService } from "../services/PmcAiService"; +import { LocalisationService } from "../services/LocalisationService"; +import { JsonUtil } from "../utils/JsonUtil"; export declare class BotController { protected logger: ILogger; protected databaseServer: DatabaseServer; protected botGenerator: BotGenerator; protected botHelper: BotHelper; - protected pmcAiService: PmcAiService; + protected botDifficultyHelper: BotDifficultyHelper; protected botGenerationCacheService: BotGenerationCacheService; + protected localisationService: LocalisationService; + protected weightedRandomHelper: WeightedRandomHelper; protected configServer: ConfigServer; protected applicationContext: ApplicationContext; + protected jsonUtil: JsonUtil; protected botConfig: IBotConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, pmcAiService: PmcAiService, botGenerationCacheService: BotGenerationCacheService, configServer: ConfigServer, applicationContext: ApplicationContext); + static readonly pmcTypeLabel = "PMC"; + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); /** * Return the number of bot loadout varieties to be generated * @param type bot Type we want the loadout gen count for @@ -37,7 +44,6 @@ export declare class BotController { * @returns Difficulty object */ getBotDifficulty(type: string, difficulty: string): Difficulty; - protected getPmcDifficultySettings(pmcType: "bear" | "usec", difficulty: string, usecType: string, bearType: string): Difficulty; /** * Generate bot profiles and store in cache * @param sessionId Session id @@ -51,4 +57,5 @@ export declare class BotController { * @returns cap number */ getBotCap(): number; + getPmcBotTypes(): Record>>; } diff --git a/TypeScript/8OnUpdateHook/types/controllers/DialogueController.d.ts b/TypeScript/8OnUpdateHook/types/controllers/DialogueController.d.ts index 1b72522..9c8b728 100644 --- a/TypeScript/8OnUpdateHook/types/controllers/DialogueController.d.ts +++ b/TypeScript/8OnUpdateHook/types/controllers/DialogueController.d.ts @@ -23,7 +23,7 @@ export declare class DialogueController { * Get the content of a dialogue * @param dialogueID Dialog id * @param sessionID Session Id - * @returns + * @returns DialogueInfo */ getDialogueInfo(dialogueID: string, sessionID: string): DialogueInfo; /** diff --git a/TypeScript/8OnUpdateHook/types/controllers/GameController.d.ts b/TypeScript/8OnUpdateHook/types/controllers/GameController.d.ts index 3bfbdb1..f4f5849 100644 --- a/TypeScript/8OnUpdateHook/types/controllers/GameController.d.ts +++ b/TypeScript/8OnUpdateHook/types/controllers/GameController.d.ts @@ -1,3 +1,4 @@ +import { ApplicationContext } from "../context/ApplicationContext"; import { GameEventHelper } from "../helpers/GameEventHelper"; import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; @@ -14,6 +15,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; +import { LocalisationService } from "../services/LocalisationService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { Watermark } from "../utils/Watermark"; export declare class GameController { @@ -24,14 +26,33 @@ export declare class GameController { protected localeService: LocaleService; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; + protected localisationService: LocalisationService; protected gameEventHelper: GameEventHelper; + protected applicationContext: ApplicationContext; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; protected coreConfig: ICoreConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, gameEventHelper: GameEventHelper, configServer: ConfigServer); - gameStart(_url: string, _info: IEmptyRequestData, sessionID: string): void; + constructor(logger: ILogger, databaseServer: DatabaseServer, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, gameEventHelper: GameEventHelper, applicationContext: ApplicationContext, configServer: ConfigServer); + gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; + /** + * Check if current date falls inside any of the seasons events pased in, if so, handle them + * @param seasonalEvents events to check for + */ protected checkForAndEnableSeasonalEvents(seasonalEvents: ISeasonalEvent[]): void; + /** + * Make adjusted to server code based on the name of the event passed in + * @param globalConfig globals.json + * @param eventName Name of the event to enable. e.g. Christmas + */ protected updateGlobalEvents(globalConfig: Config, eventName: string): void; + /** + * Read in data from seasonalEvents.json and add found equipment items to bots + * @param eventName Name of the event to read equipment in from config + */ + protected addEventGearToScavs(eventName: string): void; + /** + * Set Khorovod(dancing tree) chance to 100% on all maps that support it + */ protected enableDancingTree(): void; /** * Make non-trigger-spawned raiders spawn earlier + always @@ -40,5 +61,6 @@ export declare class GameController { protected logProfileDetails(fullProfile: IAkiProfile): void; getGameConfig(sessionID: string): IGameConfigResponse; getServer(): IServerDetails[]; + protected addPumpkinsToScavBackpacks(): void; getValidGameVersion(): ICheckVersionResponse; } diff --git a/TypeScript/8OnUpdateHook/types/controllers/HideoutController.d.ts b/TypeScript/8OnUpdateHook/types/controllers/HideoutController.d.ts index ada5bd9..5b6507b 100644 --- a/TypeScript/8OnUpdateHook/types/controllers/HideoutController.d.ts +++ b/TypeScript/8OnUpdateHook/types/controllers/HideoutController.d.ts @@ -23,12 +23,13 @@ import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; import { PlayerService } from "../services/PlayerService"; import { HashUtil } from "../utils/HashUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; -import { JsonUtil } from "../utils/JsonUtil"; export declare class HideoutController { protected logger: ILogger; protected hashUtil: HashUtil; @@ -45,11 +46,12 @@ export declare class HideoutController { protected profileHelper: ProfileHelper; protected hideoutHelper: HideoutHelper; protected scavCaseRewardGenerator: ScavCaseRewardGenerator; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected jsonUtil: JsonUtil; protected static nameBackendCountersCrafting: string; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, configServer: ConfigServer, jsonUtil: JsonUtil); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, localisationService: LocalisationService, configServer: ConfigServer, jsonUtil: JsonUtil); upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; upgradeComplete(pmcData: IPmcData, body: HideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; /** diff --git a/TypeScript/8OnUpdateHook/types/controllers/InraidController.d.ts b/TypeScript/8OnUpdateHook/types/controllers/InraidController.d.ts index e84eea1..39a6396 100644 --- a/TypeScript/8OnUpdateHook/types/controllers/InraidController.d.ts +++ b/TypeScript/8OnUpdateHook/types/controllers/InraidController.d.ts @@ -6,6 +6,7 @@ import { ProfileHelper } from "../helpers/ProfileHelper"; import { QuestHelper } from "../helpers/QuestHelper"; import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; +import { Item } from "../models/eft/common/tables/IItem"; import { IRegisterPlayerRequestData } from "../models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; import { IAirdropConfig } from "../models/spt/config/IAirdropConfig"; @@ -17,6 +18,9 @@ import { SaveServer } from "../servers/SaveServer"; import { InsuranceService } from "../services/InsuranceService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; +/** + * Logic for handling In Raid callbacks + */ export declare class InraidController { protected logger: ILogger; protected saveServer: SaveServer; @@ -35,14 +39,42 @@ export declare class InraidController { protected airdropConfig: IAirdropConfig; protected inraidConfig: IInRaidConfig; 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 + * Save locationid to active profiles inraid object + * @param sessionID Session id + * @param info Register player request + */ + addPlayer(sessionID: string, info: IRegisterPlayerRequestData): void; + /** + * Save profile state to disk + * Handles pmc/pscav + * @param offraidData post-raid request data + * @param sessionID Session id + */ + savePostRaidProgress(offraidData: ISaveProgressRequestData, sessionID: string): void; + /** + * Handle updating player profile post-pmc raid * @param sessionID session id - * @param offraidData post-raid data of raid + * @param offraidData post-raid data */ protected savePmcProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; + /** + * Make changes to pmc profile after they left raid dead, + * alter bodypart hp, handle insurance, delete inventory items, remove carried quest items + * @param postRaidSaveRequest post-raid save request + * @param pmcData pmc profile + * @param insuranceEnabled is insurance enabled + * @param preRaidGear gear player had before raid + * @param sessionID Session id + * @returns Updated profile object + */ + protected performPostRaidActionsWhenDead(postRaidSaveRequest: ISaveProgressRequestData, pmcData: IPmcData, insuranceEnabled: boolean, preRaidGear: Item[], sessionID: string): IPmcData; + /** + * Adjust player characters bodypart hp if they left raid early + * @param postRaidSaveRequest post raid data + * @param pmcData player profile + */ + protected updatePmcHealthPostRaid(postRaidSaveRequest: ISaveProgressRequestData, pmcData: IPmcData): void; /** * Reduce body part hp to % of max * @param pmcData profile to edit @@ -68,7 +100,31 @@ export declare class InraidController { * @param isPlayerScav Was the player a pScav */ protected markOrRemoveFoundInRaidItems(offraidData: ISaveProgressRequestData, pmcData: IPmcData, isPlayerScav: boolean): void; + /** + * Update profile after player completes scav raid + * @param scavData Scav profile + * @param sessionID Session id + * @param offraidData Post-raid save request + * @param pmcData Pmc profile + * @param isDead Is player dead + */ protected handlePostRaidPlayerScavProcess(scavData: IPmcData, sessionID: string, offraidData: ISaveProgressRequestData, pmcData: IPmcData, isDead: boolean): void; + /** + * Update profile with scav karma values based on in-raid actions + * @param pmcData Pmc profile + * @param offraidData Post-raid save request + * @param scavData Scav profile + * @param sessionID Session id + */ protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData, scavData: IPmcData, sessionID: string): void; + /** + * Get the inraid config from configs/inraid.json + * @returns InRaid Config + */ + getInraidConfig(): IInRaidConfig; + /** + * Get airdrop config from configs/airdrop.json + * @returns Airdrop config + */ getAirdropConfig(): IAirdropConfig; } diff --git a/TypeScript/8OnUpdateHook/types/controllers/InsuranceController.d.ts b/TypeScript/8OnUpdateHook/types/controllers/InsuranceController.d.ts index 14bf129..54f31b5 100644 --- a/TypeScript/8OnUpdateHook/types/controllers/InsuranceController.d.ts +++ b/TypeScript/8OnUpdateHook/types/controllers/InsuranceController.d.ts @@ -30,8 +30,7 @@ export declare class InsuranceController { protected insuranceService: InsuranceService; protected configServer: ConfigServer; protected insuranceConfig: IInsuranceConfig; - constructor(logger: ILogger, randomUtil: RandomUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, paymentService: PaymentService, // TODO: delay required - insuranceService: InsuranceService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, paymentService: PaymentService, insuranceService: InsuranceService, configServer: ConfigServer); processReturn(): void; insure(pmcData: IPmcData, body: IInsureRequestData, sessionID: string): IItemEventRouterResponse; /** diff --git a/TypeScript/8OnUpdateHook/types/controllers/InventoryController.d.ts b/TypeScript/8OnUpdateHook/types/controllers/InventoryController.d.ts index 6a1a21e..e1c08c0 100644 --- a/TypeScript/8OnUpdateHook/types/controllers/InventoryController.d.ts +++ b/TypeScript/8OnUpdateHook/types/controllers/InventoryController.d.ts @@ -1,8 +1,8 @@ -import { EventOutputHolder } from "../routers/EventOutputHolder"; import { InventoryHelper } from "../helpers/InventoryHelper"; import { PaymentHelper } from "../helpers/PaymentHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IAddItemRequestData } from "../models/eft/inventory/IAddItemRequestData"; import { IInventoryBindRequestData } from "../models/eft/inventory/IInventoryBindRequestData"; @@ -21,33 +21,46 @@ import { IInventorySwapRequestData } from "../models/eft/inventory/IInventorySwa import { IInventoryTagRequestData } from "../models/eft/inventory/IInventoryTagRequestData"; import { IInventoryToggleRequestData } from "../models/eft/inventory/IInventoryToggleRequestData"; import { IInventoryTransferRequestData } from "../models/eft/inventory/IInventoryTransferRequestData"; +import { IOpenRandomLootContainerRequestData } from "../models/eft/inventory/IOpenRandomLootContainerRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { ILogger } from "../models/spt/utils/ILogger"; +import { EventOutputHolder } from "../routers/EventOutputHolder"; import { DatabaseServer } from "../servers/DatabaseServer"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { HashUtil } from "../utils/HashUtil"; +import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { JsonUtil } from "../utils/JsonUtil"; +import { RandomUtil } from "../utils/RandomUtil"; export declare class InventoryController { protected logger: ILogger; protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; + protected randomUtil: RandomUtil; protected databaseServer: DatabaseServer; protected fenceService: FenceService; protected presetHelper: PresetHelper; protected inventoryHelper: InventoryHelper; protected ragfairOfferService: RagfairOfferService; protected profileHelper: ProfileHelper; + protected weightedRandomHelper: WeightedRandomHelper; protected paymentHelper: PaymentHelper; + protected localisationService: LocalisationService; protected eventOutputHolder: EventOutputHolder; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder); + protected httpResponseUtil: HttpResponseUtil; + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, weightedRandomHelper: WeightedRandomHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); /** * Move Item * change location of item with parentId and slotId * transfers items from one profile to another if fromOwner/toOwner is set in the body. * otherwise, move is contained within the same profile_f. - */ - moveItem(pmcData: IPmcData, body: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; + * @param pmcData Profile + * @param moveRequest Move request data + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ + moveItem(pmcData: IPmcData, moveRequest: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; /** * Remove Item from Profile * Deep tree item deletion, also removes items from insurance list @@ -122,4 +135,12 @@ export declare class InventoryController { createMapMarker(pmcData: IPmcData, body: IInventoryCreateMarkerRequestData, sessionID: string): IItemEventRouterResponse; deleteMapMarker(pmcData: IPmcData, body: IInventoryDeleteMarkerRequestData, sessionID: string): IItemEventRouterResponse; editMapMarker(pmcData: IPmcData, body: IInventoryEditMarkerRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle event fired when a container is unpacked (currently only the halloween pumpkin) + * @param pmcData Profile data + * @param body open loot container request data + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ + openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/8OnUpdateHook/types/controllers/LocationController.d.ts b/TypeScript/8OnUpdateHook/types/controllers/LocationController.d.ts index 9db3205..b6feba8 100644 --- a/TypeScript/8OnUpdateHook/types/controllers/LocationController.d.ts +++ b/TypeScript/8OnUpdateHook/types/controllers/LocationController.d.ts @@ -7,6 +7,7 @@ import { LootItem } from "../models/spt/services/LootItem"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -15,12 +16,13 @@ export declare class LocationController { protected hashUtil: HashUtil; protected logger: ILogger; protected locationGenerator: LocationGenerator; + protected localisationService: LocalisationService; protected lootGenerator: LootGenerator; protected databaseServer: DatabaseServer; protected timeUtil: TimeUtil; protected configServer: ConfigServer; protected airdropConfig: IAirdropConfig; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, logger: ILogger, locationGenerator: LocationGenerator, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer); + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer); get(location: string): ILocationBase; generate(name: string): ILocationBase; generateAll(): ILocationsGenerateAllResponse; diff --git a/TypeScript/8OnUpdateHook/types/controllers/MatchController.d.ts b/TypeScript/8OnUpdateHook/types/controllers/MatchController.d.ts index dac6a3f..2b0d150 100644 --- a/TypeScript/8OnUpdateHook/types/controllers/MatchController.d.ts +++ b/TypeScript/8OnUpdateHook/types/controllers/MatchController.d.ts @@ -19,7 +19,6 @@ import { SaveServer } from "../servers/SaveServer"; import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; import { BotLootCacheService } from "../services/BotLootCacheService"; import { MatchLocationService } from "../services/MatchLocationService"; -import { PmcAiService } from "../services/PmcAiService"; import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; export declare class MatchController { protected logger: ILogger; @@ -30,13 +29,12 @@ export declare class MatchController { protected botLootCacheService: BotLootCacheService; protected configServer: ConfigServer; protected profileSnapshotService: ProfileSnapshotService; - protected pmcAiService: PmcAiService; protected botGenerationCacheService: BotGenerationCacheService; 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, pmcAiService: PmcAiService, botGenerationCacheService: BotGenerationCacheService, applicationContext: ApplicationContext); + constructor(logger: ILogger, saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, botGenerationCacheService: BotGenerationCacheService, applicationContext: ApplicationContext); getEnabled(): boolean; getProfile(info: IGetProfileRequestData): IPmcData[]; createGroup(sessionID: string, info: ICreateGroupRequestData): any; diff --git a/TypeScript/8OnUpdateHook/types/controllers/RagfairController.d.ts b/TypeScript/8OnUpdateHook/types/controllers/RagfairController.d.ts index 5440458..95702f2 100644 --- a/TypeScript/8OnUpdateHook/types/controllers/RagfairController.d.ts +++ b/TypeScript/8OnUpdateHook/types/controllers/RagfairController.d.ts @@ -29,6 +29,7 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { RagfairServer } from "../servers/RagfairServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; import { PaymentService } from "../services/PaymentService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { RagfairPriceService } from "../services/RagfairPriceService"; @@ -62,9 +63,10 @@ export declare class RagfairController { protected ragfairOfferService: RagfairOfferService; protected ragfairRequiredItemsService: RagfairRequiredItemsService; protected ragfairOfferGenerator: RagfairOfferGenerator; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, eventOutputHolder: EventOutputHolder, ragfairServer: RagfairServer, ragfairPriceService: RagfairPriceService, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer, ragfairSellHelper: RagfairSellHelper, ragfairTaxHelper: RagfairTaxHelper, ragfairSortHelper: RagfairSortHelper, ragfairOfferHelper: RagfairOfferHelper, profileHelper: ProfileHelper, paymentService: PaymentService, handbookHelper: HandbookHelper, paymentHelper: PaymentHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, ragfairOfferGenerator: RagfairOfferGenerator, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, eventOutputHolder: EventOutputHolder, ragfairServer: RagfairServer, ragfairPriceService: RagfairPriceService, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer, ragfairSellHelper: RagfairSellHelper, ragfairTaxHelper: RagfairTaxHelper, ragfairSortHelper: RagfairSortHelper, ragfairOfferHelper: RagfairOfferHelper, profileHelper: ProfileHelper, paymentService: PaymentService, handbookHelper: HandbookHelper, paymentHelper: PaymentHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, ragfairOfferGenerator: RagfairOfferGenerator, localisationService: LocalisationService, configServer: ConfigServer); getOffers(sessionID: string, info: ISearchRequestData): IGetOffersResult; /** * Get offers for the client based on type of search being performed @@ -103,7 +105,12 @@ export declare class RagfairController { protected isLinkedSearch(info: ISearchRequestData): boolean; protected isRequiredSearch(info: ISearchRequestData): boolean; update(): void; - getItemPrice(info: IGetMarketPriceRequestData): IGetItemPriceResult; + /** + * Called when creating an offer on flea, fills values in top right corner + * @param getPriceRequest + * @returns min/avg/max values for an item based on flea offers available + */ + getItemMinAvgMaxFleaPriceValues(getPriceRequest: IGetMarketPriceRequestData): IGetItemPriceResult; addPlayerOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; createPlayerOffer(profile: IAkiProfile, requirements: Requirement[], items: Item[], sellInOnePiece: boolean, amountToSend: number): IRagfairOffer; getAllFleaPrices(): Record; diff --git a/TypeScript/8OnUpdateHook/types/controllers/RepeatableQuestController.d.ts b/TypeScript/8OnUpdateHook/types/controllers/RepeatableQuestController.d.ts index 7db5886..333583b 100644 --- a/TypeScript/8OnUpdateHook/types/controllers/RepeatableQuestController.d.ts +++ b/TypeScript/8OnUpdateHook/types/controllers/RepeatableQuestController.d.ts @@ -17,6 +17,7 @@ import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { ItemFilterService } from "../services/ItemFilterService"; +import { LocalisationService } from "../services/LocalisationService"; import { PaymentService } from "../services/PaymentService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { JsonUtil } from "../utils/JsonUtil"; @@ -64,12 +65,13 @@ export declare class RepeatableQuestController { protected profileFixerService: ProfileFixerService; protected ragfairServerHelper: RagfairServerHelper; protected eventOutputHolder: EventOutputHolder; + protected localisationService: LocalisationService; protected paymentService: PaymentService; protected objectId: ObjectId; protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * This is the method reached by the /client/repeatalbeQuests/activityPeriods endpoint * Returns an array of objects in the format of repeatable quests to the client. diff --git a/TypeScript/8OnUpdateHook/types/controllers/WeatherController.d.ts b/TypeScript/8OnUpdateHook/types/controllers/WeatherController.d.ts index ca7f5eb..631a90c 100644 --- a/TypeScript/8OnUpdateHook/types/controllers/WeatherController.d.ts +++ b/TypeScript/8OnUpdateHook/types/controllers/WeatherController.d.ts @@ -1,11 +1,18 @@ import { WeatherGenerator } from "../generators/WeatherGenerator"; import { IWeatherData } from "../models/eft/weather/IWeatherData"; import { IWeatherConfig } from "../models/spt/config/IWeatherConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; export declare class WeatherController { protected weatherGenerator: WeatherGenerator; + protected logger: ILogger; protected configServer: ConfigServer; protected weatherConfig: IWeatherConfig; - constructor(weatherGenerator: WeatherGenerator, configServer: ConfigServer); + constructor(weatherGenerator: WeatherGenerator, logger: ILogger, configServer: ConfigServer); generate(): IWeatherData; + /** + * Get the current in-raid time (MUST HAVE PLAYER LOGGED INTO CLIENT TO WORK) + * @returns Date object + */ + getCurrentInRaidTime(): Date; } diff --git a/TypeScript/8OnUpdateHook/types/generators/BotGenerator.d.ts b/TypeScript/8OnUpdateHook/types/generators/BotGenerator.d.ts index 2ac51db..a1ac9ed 100644 --- a/TypeScript/8OnUpdateHook/types/generators/BotGenerator.d.ts +++ b/TypeScript/8OnUpdateHook/types/generators/BotGenerator.d.ts @@ -1,7 +1,8 @@ +import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; import { GameEventHelper } from "../helpers/GameEventHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; -import { IGenerateBotsRequestData } from "../models/eft/bot/IGenerateBotsRequestData"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { Health as PmcHealth, IBotBase, Skills } from "../models/eft/common/tables/IBotBase"; import { Health, IBotType, Inventory } from "../models/eft/common/tables/IBotType"; import { IBotConfig } from "../models/spt/config/IBotConfig"; @@ -9,7 +10,6 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; -import { PmcAiService } from "../services/PmcAiService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; @@ -29,12 +29,13 @@ export declare class BotGenerator { protected databaseServer: DatabaseServer; protected botInventoryGenerator: BotInventoryGenerator; protected botEquipmentFilterService: BotEquipmentFilterService; + protected weightedRandomHelper: WeightedRandomHelper; protected botHelper: BotHelper; + protected botDifficultyHelper: BotDifficultyHelper; protected gameEventHelper: GameEventHelper; - protected pmcAiService: PmcAiService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botEquipmentFilterService: BotEquipmentFilterService, botHelper: BotHelper, gameEventHelper: GameEventHelper, pmcAiService: PmcAiService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botEquipmentFilterService: BotEquipmentFilterService, weightedRandomHelper: WeightedRandomHelper, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, gameEventHelper: GameEventHelper, configServer: ConfigServer); /** * Generate a player scav bot object * @param role e.g. assault / pmcbot @@ -44,12 +45,18 @@ export declare class BotGenerator { */ generatePlayerScav(sessionId: string, role: string, difficulty: string, botTemplate: IBotType): IBotBase; /** - * Generate an array of bot objects for populate a raid with + * Generate an array of bot objects based on a condition for a raid with * @param sessionId session id - * @param info request object + * @param condition request condition * @returns bot array */ - generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; + generateByCondition(sessionId: string, botCountToGenerate: number, difficulty: string, role: string, isPmc: boolean): IBotBase[]; + /** + * Get the PMCs wildSpawnType value + * @param role "usec" / "bear" + * @returns wildSpawnType value as string + */ + protected getPmcRoleByDescription(role: string): string; /** * Get a randomised PMC side based on bot config value 'isUsec' * @returns pmc side as string @@ -64,13 +71,13 @@ export declare class BotGenerator { * Create a IBotBase object with equipment/loot/exp etc * @param sessionId Session id * @param bot bots base file - * @param role botRole bot will use + * @param botRole Role bot will use (bear/usec for PMCs) * @param node Bot template from db/bots/x.json * @param isPmc Is bot to be a PMC * @param isPlayerScav is bot to be a p scav bot * @returns IBotBase object */ - protected generateBot(sessionId: string, bot: IBotBase, role: string, node: IBotType, isPmc: boolean, isPlayerScav?: boolean): IBotBase; + protected generateBot(sessionId: string, bot: IBotBase, botRole: string, node: IBotType, isPmc: boolean, isPlayerScav?: boolean): IBotBase; /** * Log the number of PMCs generated to the debug console * @param output Generated bot array, ready to send to client diff --git a/TypeScript/8OnUpdateHook/types/generators/BotInventoryGenerator.d.ts b/TypeScript/8OnUpdateHook/types/generators/BotInventoryGenerator.d.ts index c5ed545..e1efaf2 100644 --- a/TypeScript/8OnUpdateHook/types/generators/BotInventoryGenerator.d.ts +++ b/TypeScript/8OnUpdateHook/types/generators/BotInventoryGenerator.d.ts @@ -7,6 +7,7 @@ import { IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { BotLootGenerator } from "./BotLootGenerator"; @@ -20,14 +21,68 @@ export declare class BotInventoryGenerator { protected botLootGenerator: BotLootGenerator; protected botGeneratorHelper: BotGeneratorHelper; protected weightedRandomHelper: WeightedRandomHelper; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, configServer: ConfigServer); + /** + * Add equipment/weapons/loot to bot + * @param sessionId Session id + * @param templateInventory bot/x.json data from db + * @param equipmentChances Chances each item will be added to bot + * @param itemGenerationLimitsMinMax item gen limits for bot role + * @param botRole Role bot has (assault/pmcBot) + * @param isPmc Is bot being converted into a pmc + * @returns PmcInventory object with equipment/weapons/loot + */ generateInventory(sessionId: string, templateInventory: Inventory, equipmentChances: Chances, itemGenerationLimitsMinMax: Generation, botRole: string, isPmc: boolean): PmcInventory; + /** + * Create a pmcInventory object with all the base/generic items needed + * @returns PmcInventory object + */ + protected generateInventoryBase(): PmcInventory; + /** + * Add equipment to a bot + * @param templateInventory bot/x.json data from db + * @param equipmentChances Chances items will be added to bot + * @param botRole Role bot has (assault/pmcBot) + * @param botInventory Inventory to add equipment to + */ + protected generateAndAddEquipmentToBot(templateInventory: Inventory, equipmentChances: Chances, botRole: string, botInventory: PmcInventory): void; + protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory): void; + /** + * Work out what weapons bot should have equipped and add them to bot inventory + * @param templateInventory bot/x.json data from db + * @param equipmentChances Chances bot can have equipment equipped + * @param sessionId Session id + * @param botInventory Inventory to add weapons to + * @param botRole assault/pmcBot/bossTagilla etc + * @param isPmc Is the bot being generated as a pmc + * @param itemGenerationLimitsMinMax Limits for items the bot can have + */ + protected generateAndAddWeaponsToBot(templateInventory: Inventory, equipmentChances: Chances, sessionId: string, botInventory: PmcInventory, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation): void; + /** + * Calculate if the bot should have weapons in Primary/Secondary/Holster slots + * @param equipmentChances Chances bot has certain equipment + * @returns What slots bot should have weapons generated for + */ + protected getDesiredWeaponsForBot(equipmentChances: Chances): { + slot: EquipmentSlots; + shouldSpawn: boolean; + }[]; + /** + * Add weapon + spare mags/ammo to bots inventory + * @param sessionId Session id + * @param weaponSlot Weapon slot being generated + * @param templateInventory bot/x.json data from db + * @param botInventory Inventory to add weapon+mags/ammo to + * @param equipmentChances Chances bot can have equipment equipped + * @param botRole assault/pmcBot/bossTagilla etc + * @param isPmc Is the bot being generated as a pmc + * @param itemGenerationLimitsMinMax + */ protected addWeaponAndMagazinesToInventory(sessionId: string, weaponSlot: { slot: EquipmentSlots; shouldSpawn: boolean; }, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation): void; - protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory): void; - protected generateInventoryBase(): PmcInventory; } diff --git a/TypeScript/8OnUpdateHook/types/generators/BotLootGenerator.d.ts b/TypeScript/8OnUpdateHook/types/generators/BotLootGenerator.d.ts index c1f5310..3352a46 100644 --- a/TypeScript/8OnUpdateHook/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/8OnUpdateHook/types/generators/BotLootGenerator.d.ts @@ -10,6 +10,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotLootCacheService } from "../services/BotLootCacheService"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { BotWeaponGenerator } from "./BotWeaponGenerator"; @@ -23,9 +24,10 @@ export declare class BotLootGenerator { protected botWeaponGenerator: BotWeaponGenerator; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected botLootCacheService: BotLootCacheService; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, configServer: ConfigServer); generateLoot(sessionId: string, templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances): void; protected getRandomisedCount(min: number, max: number, nValue: number): number; /** @@ -113,7 +115,7 @@ export declare class BotLootGenerator { * If no limit found for a non pmc bot, fall back to defaults * @param isPmc is the bot we want limits for a pmc * @param botRole what role does the bot have - * @returns dictionary of tplIds and limit + * @returns Dictionary of tplIds and limit */ protected getItemSpawnLimitsForBotType(isPmc: boolean, botRole: string): Record; /** diff --git a/TypeScript/8OnUpdateHook/types/generators/BotWeaponGenerator.d.ts b/TypeScript/8OnUpdateHook/types/generators/BotWeaponGenerator.d.ts index 487901b..40284ea 100644 --- a/TypeScript/8OnUpdateHook/types/generators/BotWeaponGenerator.d.ts +++ b/TypeScript/8OnUpdateHook/types/generators/BotWeaponGenerator.d.ts @@ -12,6 +12,7 @@ import { IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; @@ -27,10 +28,11 @@ export declare class BotWeaponGenerator { protected randomUtil: RandomUtil; protected configServer: ConfigServer; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected localisationService: LocalisationService; protected inventoryMagGenComponents: IInventoryMagGen[]; protected readonly modMagazineSlotId = "mod_magazine"; protected botConfig: IBotConfig; - constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil, configServer: ConfigServer, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, inventoryMagGenComponents: IInventoryMagGen[]); + constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil, configServer: ConfigServer, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, inventoryMagGenComponents: IInventoryMagGen[]); /** * Pick a random weapon based on weightings and generate a functional weapon * @param equipmentSlot Primary/secondary/holster diff --git a/TypeScript/8OnUpdateHook/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/8OnUpdateHook/types/generators/RagfairOfferGenerator.d.ts index b64a7e7..23882d2 100644 --- a/TypeScript/8OnUpdateHook/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/8OnUpdateHook/types/generators/RagfairOfferGenerator.d.ts @@ -1,16 +1,19 @@ +import { HandbookHelper } from "../helpers/HandbookHelper"; import { ItemHelper } from "../helpers/ItemHelper"; +import { PaymentHelper } from "../helpers/PaymentHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; import { Item } from "../models/eft/common/tables/IItem"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { IBarterScheme } from "../models/eft/common/tables/ITrader"; -import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; +import { IRagfairOffer, OfferRequirement } from "../models/eft/ragfair/IRagfairOffer"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { RagfairCategoriesService } from "../services/RagfairCategoriesService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { RagfairPriceService } from "../services/RagfairPriceService"; @@ -27,18 +30,31 @@ export declare class RagfairOfferGenerator { protected timeUtil: TimeUtil; protected databaseServer: DatabaseServer; protected ragfairServerHelper: RagfairServerHelper; + protected handbookHelper: HandbookHelper; protected saveServer: SaveServer; protected presetHelper: PresetHelper; protected ragfairAssortGenerator: RagfairAssortGenerator; protected ragfairOfferService: RagfairOfferService; protected ragfairPriceService: RagfairPriceService; + protected localisationService: LocalisationService; + protected paymentHelper: PaymentHelper; protected ragfairCategoriesService: RagfairCategoriesService; protected fenceService: FenceService; protected itemHelper: ItemHelper; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, ragfairServerHelper: RagfairServerHelper, saveServer: SaveServer, presetHelper: PresetHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferService: RagfairOfferService, ragfairPriceService: RagfairPriceService, ragfairCategoriesService: RagfairCategoriesService, fenceService: FenceService, itemHelper: ItemHelper, configServer: ConfigServer); + protected allowedFleaPriceItemsForBarter: { + tpl: string; + price: number; + }[]; + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, ragfairServerHelper: RagfairServerHelper, handbookHelper: HandbookHelper, saveServer: SaveServer, presetHelper: PresetHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferService: RagfairOfferService, ragfairPriceService: RagfairPriceService, localisationService: LocalisationService, paymentHelper: PaymentHelper, ragfairCategoriesService: RagfairCategoriesService, fenceService: FenceService, itemHelper: ItemHelper, configServer: ConfigServer); createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; + /** + * Calculate the offer price that's listed on the flea listing + * @param offerRequirements barter requirements for offer + * @returns rouble cost of offer + */ + protected calculateOfferListingPrice(offerRequirements: OfferRequirement[]): number; /** * Get avatar url from trader table in db * @param isTrader Is user we're getting avatar for a trader @@ -87,20 +103,36 @@ export declare class RagfairOfferGenerator { * @returns Item with conditions added */ protected addMissingCondition(item: Item): Item; - protected getOfferRequirements(items: Item[]): { - count: number; - _tpl: string; + /** + * Create a barter-based barter scheme, if not possible, fall back to making barter scheme currency based + * @param offerItems Items for sale in offer + * @returns barter scheme + */ + protected createBarterRequirement(offerItems: Item[]): IBarterScheme[]; + /** + * Get an array of flea prices + item tpl, cached in generator class + * @returns array with tpl/price values + */ + protected getFleaPricesAsArray(): { + tpl: string; + price: number; }[]; + /** + * Create a random currency-based barter scheme for an array of items + * @param offerItems Items on offer + * @returns Barter scheme for offer + */ + protected createCurrencyRequirement(offerItems: Item[]): IBarterScheme[]; /** * Create a flea offer and store it in the Ragfair server offers array * @param userID owner of the offer * @param time time offer is put up * @param items items in the offer - * @param barterScheme - * @param loyalLevel + * @param barterScheme cost of item (currency or barter) + * @param loyalLevel Loyalty level needed to buy item * @param price price of offer * @param sellInOnePiece - * @returns + * @returns Ragfair offer */ createFleaOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; } diff --git a/TypeScript/8OnUpdateHook/types/generators/WeatherGenerator.d.ts b/TypeScript/8OnUpdateHook/types/generators/WeatherGenerator.d.ts index 8ddbe49..65d2c76 100644 --- a/TypeScript/8OnUpdateHook/types/generators/WeatherGenerator.d.ts +++ b/TypeScript/8OnUpdateHook/types/generators/WeatherGenerator.d.ts @@ -1,38 +1,54 @@ +import { ApplicationContext } from "../context/ApplicationContext"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; -import { IWeatherData } from "../models/eft/weather/IWeatherData"; +import { IWeather, IWeatherData } from "../models/eft/weather/IWeatherData"; +import { WindDirection } from "../models/enums/WindDirection"; import { IWeatherConfig } from "../models/spt/config/IWeatherConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class WeatherGenerator { protected weightedRandomHelper: WeightedRandomHelper; + protected logger: ILogger; protected randomUtil: RandomUtil; protected timeUtil: TimeUtil; + protected applicationContext: ApplicationContext; protected configServer: ConfigServer; protected weatherConfig: IWeatherConfig; - constructor(weightedRandomHelper: WeightedRandomHelper, randomUtil: RandomUtil, timeUtil: TimeUtil, configServer: ConfigServer); - calculateTime(data: IWeatherData): IWeatherData; + constructor(weightedRandomHelper: WeightedRandomHelper, logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, applicationContext: ApplicationContext, configServer: ConfigServer); + calculateGameTime(data: IWeatherData): IWeatherData; /** * Get server uptime seconds multiplied by a multiplier and add to current time as seconds * Format to BSGs requirements - * @param computedDate current date + * @param currentDate current date * @returns formatted time */ - protected getAcceleratedTime(computedDate: Date): string; + protected getBsgFormattedInRaidTime(currentDate: Date): string; + /** + * Get the current in-raid time + * @param currentDate (new Date()) + * @returns Date object of current in-raid time + */ + getInRaidTime(currentDate: Date): Date; /** * Get current time formatted to fit BSGs requirement - * @param computedDate date to format into bsg style + * @param date date to format into bsg style * @returns */ - protected getNormalTime(computedDate: Date): string; + protected getBSGFormattedTime(date: Date): string; /** - * Return randomised Weather data - * @param weatherData weather input data + * Return randomised Weather data with help of config/weather.json * @returns Randomised weather data */ - generateWeather(weatherData: IWeatherData): IWeatherData; - protected getWeightedFog(): string; + generateWeather(): IWeather; + /** + * Set IWeather date/time/timestamp values to now + * @param weather Object to update + */ + protected setCurrentDateTime(weather: IWeather): void; + protected getWeightedWindDirection(): WindDirection; + protected getWeightedWindSpeed(): number; + protected getWeightedFog(): number; protected getWeightedRain(): number; protected getRandomFloat(node: string): number; - protected getRandomInt(node: string): number; } diff --git a/TypeScript/8OnUpdateHook/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts b/TypeScript/8OnUpdateHook/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts index 4fcb1e2..1589707 100644 --- a/TypeScript/8OnUpdateHook/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts +++ b/TypeScript/8OnUpdateHook/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts @@ -1,13 +1,15 @@ import { BotWeaponGeneratorHelper } from "../../../helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "../../../helpers/ItemHelper"; import { ILogger } from "../../../models/spt/utils/ILogger"; +import { LocalisationService } from "../../../services/LocalisationService"; import { IInventoryMagGen } from "../IInventoryMagGen"; import { InventoryMagGen } from "../InventoryMagGen"; export declare class ExternalInventoryMagGen implements IInventoryMagGen { protected logger: ILogger; protected itemHelper: ItemHelper; + protected localisationService: LocalisationService; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; - constructor(logger: ILogger, itemHelper: ItemHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper); + constructor(logger: ILogger, itemHelper: ItemHelper, localisationService: LocalisationService, botWeaponGeneratorHelper: BotWeaponGeneratorHelper); getPriority(): number; canHandleInventoryMagGen(inventoryMagGen: InventoryMagGen): boolean; process(inventoryMagGen: InventoryMagGen): void; diff --git a/TypeScript/8OnUpdateHook/types/helpers/BotDifficultyHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/BotDifficultyHelper.d.ts new file mode 100644 index 0000000..a58ebdb --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/helpers/BotDifficultyHelper.d.ts @@ -0,0 +1,46 @@ +import { Difficulty } from "../models/eft/common/tables/IBotType"; +import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; +import { JsonUtil } from "../utils/JsonUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +import { BotHelper } from "./BotHelper"; +export declare class BotDifficultyHelper { + protected logger: ILogger; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected randomUtil: RandomUtil; + protected localisationService: LocalisationService; + protected botHelper: BotHelper; + protected configServer: ConfigServer; + protected botConfig: IBotConfig; + constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, localisationService: LocalisationService, botHelper: BotHelper, configServer: ConfigServer); + getPmcDifficultySettings(pmcType: "bear" | "usec", difficulty: string, usecType: string, bearType: string): Difficulty; + /** + * Get difficulty settings for desired bot type, if not found use assault bot types + * @param type bot type to retreive difficulty of + * @param difficulty difficulty to get settings for (easy/normal etc) + * @returns Difficulty object + */ + getBotDifficultySettings(type: string, difficulty: string): Difficulty; + /** + * Get difficulty settings for a PMC + * @param type "usec" / "bear" + * @param difficulty what difficulty to retrieve + * @returns Difficulty object + */ + protected getDifficultySettings(type: string, difficulty: string): Difficulty; + /** + * Translate chosen value from pre-raid difficulty dropdown into bot difficulty value + * @param dropDownDifficulty Dropdown difficulty value to convert + * @returns bot difficulty + */ + convertBotDifficultyDropdownToBotDifficulty(dropDownDifficulty: string): string; + /** + * Choose a random difficulty from - easy/normal/hard/impossible + * @returns random difficulty + */ + chooseRandomDifficulty(): string; +} diff --git a/TypeScript/8OnUpdateHook/types/helpers/BotGeneratorHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/BotGeneratorHelper.d.ts index 5e3e501..899669e 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/BotGeneratorHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/BotGeneratorHelper.d.ts @@ -8,6 +8,7 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; import { ItemFilterService } from "../services/ItemFilterService"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; @@ -43,9 +44,10 @@ export declare class BotGeneratorHelper { protected itemFilterService: ItemFilterService; protected profileHelper: ProfileHelper; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Check mods are compatible and add to array * @param equipment Equipment item to add mods to @@ -53,9 +55,11 @@ export declare class BotGeneratorHelper { * @param parentId parentid of item to add mod to * @param parentTemplate template objet of item to add mods to * @param modSpawnChances dictionary of mod items and their chance to spawn for this bot type + * @param botRole the bot role being generated for + * @param forceSpawn should this mod be forced to spawn * @returns Item + compatible mods as an array */ - generateModsForEquipment(equipment: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances): Item[]; + generateModsForEquipment(equipment: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances, botRole: string, forceSpawn?: boolean): Item[]; /** * @param sessionId session id * @param weapon Weapon to add mods to @@ -70,15 +74,15 @@ export declare class BotGeneratorHelper { generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponParentId: string, parentWeaponTemplate: ITemplateItem, modSpawnChances: ModsChances, ammoTpl: string, botRole: string): Item[]; /** * - * @param modSlot - * @param isRandomisableSlot - * @param modsParent - * @param botEquipBlacklist - * @param itemModPool + * @param modSlot Slot mod will fit into + * @param isRandomisableSlot Will generate a randomised mod pool if true + * @param modsParent Parent slot the item will be a part of + * @param botEquipBlacklist Blacklist to prevent mods from being picked + * @param itemModPool Pool of items to pick from * @param weapon array with only weapon tpl in it, ready for mods to be added * @param ammoTpl ammo tpl to use if slot requires a cartridge to be added (e.g. mod_magazine) - * @param parentTemplate - * @returns + * @param parentTemplate Parent item the mod will go into + * @returns ITemplateItem */ protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, modsParent: Slot, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem): [boolean, ITemplateItem]; /** @@ -114,8 +118,10 @@ export declare class BotGeneratorHelper { * Find all compatible mods for equipment item and add to modPool * @param itemDetails item to find mods for * @param modPool ModPool to add mods to + * @param equipmentBlacklist equipment not allowed to be used by the bot + * @param botEquipmentRole bot type to generate pool for (e.g. assault, pmcBot, pmc for usec/bear) */ - generateDynamicModPool(itemDetails: ITemplateItem, modPool: Mods): void; + generateDynamicModPool(itemDetails: ITemplateItem, modPool: Mods, equipmentBlacklist: EquipmentFilterDetails[], botEquipmentRole: string): void; /** * Take a list of tpls and filter out blacklisted values using itemFilterService + botEquipmentBlacklist * @param allowedMods base mods to filter @@ -153,7 +159,7 @@ export declare class BotGeneratorHelper { * @param modTemplate Used to add additional properites in the upd object * @returns Item object */ - protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem): Item; + protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem, botRole: string): Item; /** * randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot * never return true for an item that has 0% spawn chance @@ -170,10 +176,10 @@ export declare class BotGeneratorHelper { */ protected getAmmoContainers(): string[]; /** - * Get the slot details for an item (chamber/cartridge/slot) + * Get a Slot property for an item (chamber/cartridge/slot) * @param modSlot e.g patron_in_weapon * @param parentTemplate item template - * @returns + * @returns Slot item */ protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; /** @@ -185,7 +191,6 @@ export declare class BotGeneratorHelper { * @param modPool modPool which should include available cartrigdes * @param parentId The CylinderMagazine's UID * @param parentTemplate The CylinderMagazine's template - * @returns */ protected fillCamora(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem): void; /** @@ -197,11 +202,11 @@ export declare class BotGeneratorHelper { /** * Adds properties to an item * e.g. Repairable / HasHinge / Foldable / MaxDurability - * @param itemTemplate - * @param botRole Used by weapons to randomise the durability values + * @param itemTemplate Item extra properties are being generated for + * @param botRole Used by weapons to randomise the durability values. Null for non-equipped items * @returns Item Upd object with extra properties */ - generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: any): { + generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: string): { upd?: Upd; }; /** @@ -220,21 +225,27 @@ export declare class BotGeneratorHelper { protected generateArmorRepairableProperties(itemTemplate: ITemplateItem, botRole: string): Repairable; /** * Get a random mod from an items compatible mods Filter array - * @param modTpl - * @param parentSlot - * @param modSlot - * @param items + * @param modTpl ???? + * @param parentSlot item mod will go into, used to get combatible items + * @param modSlot Slot to get mod to fill + * @param items items to ensure picked mod is compatible with * @returns item tpl */ protected getModTplFromItemDb(modTpl: string, parentSlot: Slot, modSlot: string, items: Item[]): string; /** * Can an item be added to an item without issue - * @param items - * @param tplToCheck - * @param equipmentSlot - * @returns true if possible + * @param items items to check compatiblilities with + * @param tplToCheck tpl of the item to check for incompatibilities + * @param equipmentSlot Slot the item will be placed into + * @returns false if no incompatibilties */ isItemIncompatibleWithCurrentItems(items: Item[], tplToCheck: string, equipmentSlot: string): boolean; + /** + * Convert a bots role to the equipment role used in config/bot.json + * @param botRole Role to convert + * @returns Equipment role (e.g. pmc / assault / bossTagilla) + */ + getBotEquipmentRole(botRole: string): string; } /** TODO - move into own class */ export declare class ExhaustableArray { diff --git a/TypeScript/8OnUpdateHook/types/helpers/BotHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/BotHelper.d.ts index 67a6384..a7f779e 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/BotHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/BotHelper.d.ts @@ -3,6 +3,7 @@ import { IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; export declare class BotHelper { @@ -10,46 +11,27 @@ export declare class BotHelper { protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, configServer: ConfigServer); - /** - * Get difficulty settings for desired bot type, if not found use assault bot types - * @param type bot type to retreive difficulty of - * @param difficulty difficulty to get settings for (easy/normal etc) - * @returns Difficulty object - */ - getBotDifficultySettings(type: string, difficulty: string): Difficulty; + constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, localisationService: LocalisationService, configServer: ConfigServer); /** * Get a template object for the specified botRole from bots.types db * @param role botRole to get template for * @returns IBotType object */ getBotTemplate(role: string): IBotType; - /** - * Get difficulty settings for a PMC - * @param type "usec" / "bear" - * @param difficulty what difficulty to retrieve - * @returns Difficulty object - */ - getPmcDifficultySettings(type: string, difficulty: string): Difficulty; - /** - * Translate chosen value from pre-raid difficulty dropdown into bot difficulty value - * @param dropDownDifficulty Dropdown difficulty value to convert - * @returns bot difficulty - */ - convertBotDifficultyDropdownToBotDifficulty(dropDownDifficulty: string): string; - /** - * Choose a random difficulty from - easy/normal/hard/impossible - * @returns random difficulty - */ - chooseRandomDifficulty(): string; /** * Randomise the chance the PMC will attack their own side * Look up value in bot.json/chanceSameSideIsHostilePercent * @param difficultySettings pmc difficulty settings */ randomisePmcHostility(difficultySettings: Difficulty): void; + /** + * Is the passed in bot role a PMC (usec/bear/pmc) + * @param botRole bot role to check + * @returns true if is pmc + */ isBotPmc(botRole: string): boolean; isBotBoss(botRole: string): boolean; isBotFollower(botRole: string): boolean; diff --git a/TypeScript/8OnUpdateHook/types/helpers/GameEventHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/GameEventHelper.d.ts index fca87be..fa25eff 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/GameEventHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/GameEventHelper.d.ts @@ -15,4 +15,15 @@ export declare class GameEventHelper { * @returns Record with event name + start/end date */ getEventDetails(): ISeasonalEvent[]; + /** + * Is detection of seasonal events enabled (halloween / christmas) + * @returns true if seasonal events should be checked for + */ + isAutomaticEventDetectionEnabled(): boolean; + /** + * Get a dictionary of gear changes to apply to bots for a specific event e.g. Christmas/Halloween + * @param eventName Name of event to get gear changes for + * @returns bots with equipment changes + */ + getEventBotGear(eventName: string): Record>>; } diff --git a/TypeScript/8OnUpdateHook/types/helpers/HideoutHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/HideoutHelper.d.ts index 5f7e3b7..9d51fed 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/HideoutHelper.d.ts @@ -11,6 +11,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { PlayerService } from "../services/PlayerService"; import { HashUtil } from "../utils/HashUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; @@ -29,13 +30,14 @@ export declare class HideoutHelper { protected profileHelper: ProfileHelper; protected inventoryHelper: InventoryHelper; protected playerService: PlayerService; + protected localisationService: LocalisationService; protected configServer: ConfigServer; static bitcoinFarm: string; static waterCollector: string; static bitcoin: string; static expeditionaryFuelTank: string; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, localisationService: LocalisationService, configServer: ConfigServer); registerProduction(pmcData: IPmcData, body: IHideoutSingleProductionStartRequestData | IHideoutContinousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; /** * This convinience function intialies new Production Object diff --git a/TypeScript/8OnUpdateHook/types/helpers/InventoryHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/InventoryHelper.d.ts index b8e5c9d..6419f93 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/InventoryHelper.d.ts @@ -5,11 +5,12 @@ import { IInventoryMergeRequestData } from "../models/eft/inventory/IInventoryMe import { IInventoryMoveRequestData } from "../models/eft/inventory/IInventoryMoveRequestData"; import { IInventorySplitRequestData } from "../models/eft/inventory/IInventorySplitRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { IInventoryConfig } from "../models/spt/config/IInventoryConfig"; +import { IInventoryConfig, RewardDetails } from "../models/spt/config/IInventoryConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { JsonUtil } from "../utils/JsonUtil"; @@ -38,9 +39,10 @@ export declare class InventoryHelper { protected itemHelper: ItemHelper; protected containerHelper: ContainerHelper; protected profileHelper: ProfileHelper; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected inventoryConfig: IInventoryConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); addItem(pmcData: IPmcData, body: IAddItemRequestData, output: IItemEventRouterResponse, sessionID: string, callback: any, foundInRaid?: boolean, addUpd?: any): IItemEventRouterResponse; removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; removeItemByCount(pmcData: IPmcData, itemId: string, count: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; @@ -76,6 +78,12 @@ export declare class InventoryHelper { * Internal helper function to handle cartridges in inventory if any of them exist. */ protected handleCartridges(items: Item[], body: IInventoryMoveRequestData): void; + /** + * Get details for how a random loot container should be handled, max rewards, possible reward tpls + * @param itemTpl Container being opened + * @returns Reward details + */ + getRandomLootContainerRewardDetails(itemTpl: string): RewardDetails; } declare namespace InventoryHelper { interface InventoryItemHash { diff --git a/TypeScript/8OnUpdateHook/types/helpers/ItemHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/ItemHelper.d.ts index 0effaf2..fc88a46 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/ItemHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/ItemHelper.d.ts @@ -5,6 +5,7 @@ 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 { LocaleService } from "../services/LocaleService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; @@ -18,7 +19,8 @@ declare class ItemHelper { protected objectId: ObjectId; protected mathUtil: MathUtil; protected databaseServer: DatabaseServer; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer); + protected localeService: LocaleService; + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, localeService: LocaleService); /** * Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash * @param {string} tpl the template id / tpl @@ -212,6 +214,12 @@ declare class ItemHelper { * @returns size of stack */ getItemStackSize(item: Item): number; + /** + * Get the name of an item from the locale file using the item tpl + * @param itemTpl Tpl of item to get name of + * @returns Name of item + */ + getItemName(itemTpl: string): string; } declare namespace ItemHelper { interface ItemSize { diff --git a/TypeScript/8OnUpdateHook/types/helpers/QuestHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/QuestHelper.d.ts index a6b4892..edbd2e1 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/QuestHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/QuestHelper.d.ts @@ -50,6 +50,12 @@ export declare class QuestHelper { * @returns true if player level is greater than or equal to quest */ doesPlayerLevelFulfilCondition(playerLevel: number, condition: AvailableForConditions): boolean; + /** + * Get the quests found in both arrays (inner join) + * @param before Array of qeusts #1 + * @param after Array of quests #2 + * @returns Reduction of cartesian product between two quest arrays + */ getDeltaQuests(before: IQuest[], after: IQuest[]): IQuest[]; /** * Increase skill points of a skill on player profile @@ -66,38 +72,85 @@ export declare class QuestHelper { * quest list in question. */ dumpQuests(quests: any): void; - loyaltyRequirementCheck(loyaltyRequirementProperties: AvailableForProps, profile: IPmcData): boolean; - protected processReward(reward: Reward): any[]; + /** + * Check if trader has sufficient loyalty to fullfill quest requirement + * @param questProperties Quest props + * @param profile Player profile + * @returns true if loyalty is high enough to fulfil quest requirement + */ + traderStandingRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; + protected processReward(reward: Reward): Reward[]; + /** + * Gets a flat list of reward items for the given quest at a specific state (e.g. Fail/Success) + * @param quest quest to get rewards for + * @param state Quest status that holds the items (Started, Success, Fail) + * @returns array of items with the correct maxStack + */ getQuestRewardItems(quest: IQuest, state: QuestStatus): Reward[]; /** - * Add quest with new state value to pmc profile + * Update player profile with quest status (e.g. Fail/Success) * @param pmcData profile to add quest to * @param newState state the new quest should be in when added * @param acceptedQuest Details of quest being added */ addQuestToPMCData(pmcData: IPmcData, newState: QuestStatus, acceptedQuest: IAcceptQuestRequestData): void; - acceptedUnlocked(acceptedQuestId: string, sessionID: string): IQuest[]; - failedUnlocked(failedQuestId: string, sessionID: string): IQuest[]; - applyMoneyBoost(quest: IQuest, moneyBoost: number): IQuest; - changeItemStack(pmcData: IPmcData, id: string, value: number, sessionID: string, output: any): void; /** - * Get List of All Quests as an array + * TODO: what is going on here + * @param acceptedQuestId Quest to add to profile + * @param sessionID Session id + * @returns Array of quests in profile + quest passed in as param + */ + acceptedUnlocked(acceptedQuestId: string, sessionID: string): IQuest[]; + /** + * TODO: what is going on here + * @param failedQuestId + * @param sessionID Session id + * @returns + */ + failedUnlocked(failedQuestId: string, sessionID: string): IQuest[]; + /** + * Adjust quest money rewards by passed in multipler + * @param quest Quest to multiple money rewards + * @param multipler Value to adjust money rewards by + * @returns Updated quest + */ + applyMoneyBoost(quest: IQuest, multipler: number): IQuest; + /** + * Sets the item stack to new value, or delete the item if value <= 0 + * // TODO maybe merge this function and the one from customization + * @param pmcData Profile + * @param itemId id of item to adjust stack size of + * @param newStackSize Stack size to adjust to + * @param sessionID Session id + * @param output ItemEvent router response + */ + changeItemStack(pmcData: IPmcData, itemId: string, newStackSize: number, sessionID: string, output: IItemEventRouterResponse): void; + /** + * Get List of All Quests from db + * NOT CLONED * @returns Array of IQuest objects */ - questValues(): IQuest[]; + getQuestsFromDb(): IQuest[]; /** - * Reest AvailableForStart conditions for quests - * @param quests queststo clean + * Get quests, strip all requirement conditions except level + * @param quests quests to process * @returns quest array without conditions */ - protected cleanQuestList(quests: IQuest[]): IQuest[]; + protected getQuestsWithOnlyLevelRequirementStartCondition(quests: IQuest[]): IQuest[]; /** - * Reset AvailableForStart conditions on a quest + * Remove all quest conditions except for level requirement * @param quest quest to clean * @returns reset IQuest object */ - cleanQuestConditions(quest: IQuest): IQuest; - failQuest(pmcData: IPmcData, body: any, sessionID: string): any; + getQuestWithOnlyLevelRequirementStartCondition(quest: IQuest): IQuest; + /** + * Fail a quest in a player profile + * @param pmcData Profile + * @param failRequest fail quest request data + * @param sessionID Session id + * @returns Item event router response + */ + failQuest(pmcData: IPmcData, failRequest: any, sessionID: string): IItemEventRouterResponse; /** * Get quest by id from database * @param questId questid to look for @@ -105,7 +158,12 @@ export declare class QuestHelper { * @returns IQuest object */ getQuestFromDb(questId: string, pmcData: IPmcData): IQuest; - getQuestLocaleIdFromDb(messageId: string): string; + /** + * Get the locale Id from locale db for a quest message + * @param questMessageId Quest mesage id to look up + * @returns Locale Id from locale db + */ + getQuestLocaleIdFromDb(questMessageId: string): string; /** * Alter a quests state + Add a record to tis status timers object * @param pmcData Profile to update @@ -128,5 +186,10 @@ export declare class QuestHelper { * @returns bonus in percent */ protected getIntelCenterRewardBonus(pmcData: IPmcData): number; - getFindItemIdForQuestItem(itemTpl: string): string; + /** + * Find quest with 'findItem' requirement that needs the item tpl be handed in + * @param itemTpl item tpl to look for + * @returns 'FindItem' condition id + */ + getFindItemIdForQuestHandIn(itemTpl: string): string; } diff --git a/TypeScript/8OnUpdateHook/types/helpers/RagfairServerHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/RagfairServerHelper.d.ts index a03cdda..ec388d8 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/RagfairServerHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/RagfairServerHelper.d.ts @@ -44,10 +44,20 @@ export declare class RagfairServerHelper { isPlayer(userID: string): boolean; returnItems(sessionID: string, items: any[]): void; calculateDynamicStackCount(tplId: string, isWeaponPreset: boolean): number; + /** + * Choose a currency at random with bias + * @returns currency tpl + */ getDynamicOfferCurrency(): string; getMemberType(userID: string): MemberCategory; getNickname(userID: string): string; getPresetItems(item: any): Item[]; getPresetItemsByTpl(item: Item): Item[]; + /** + * Generate new unique ids for the children while preserving hierarchy + * @param item base item + * @param preset + * @returns Item array with new IDs + */ reparentPresets(item: Item, preset: Item[]): Item[]; } diff --git a/TypeScript/8OnUpdateHook/types/helpers/RagfairSortHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/RagfairSortHelper.d.ts index 28d1d38..4669ce6 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/RagfairSortHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/RagfairSortHelper.d.ts @@ -18,7 +18,7 @@ export declare class RagfairSortHelper { protected sortOffersByRating(a: IRagfairOffer, b: IRagfairOffer): number; protected sortOffersByName(a: IRagfairOffer, b: IRagfairOffer): number; /** - * Order two offers by price value + * Order two offers by rouble price value * @param a Offer a * @param b Offer b * @returns diff --git a/TypeScript/8OnUpdateHook/types/loaders/PreAkiModLoader.d.ts b/TypeScript/8OnUpdateHook/types/loaders/PreAkiModLoader.d.ts index 7a687a5..f486a28 100644 --- a/TypeScript/8OnUpdateHook/types/loaders/PreAkiModLoader.d.ts +++ b/TypeScript/8OnUpdateHook/types/loaders/PreAkiModLoader.d.ts @@ -1,29 +1,31 @@ import { DependencyContainer } from "tsyringe"; +import { IPostAkiLoadMod } from "../models/external/IPostAkiLoadMod"; +import { IPostDBLoadMod } from "../models/external/IPostDBLoadMod"; +import { IPreAkiLoadMod } from "../models/external/IPreAkiLoadMod"; import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { ModLoader } from "../models/spt/mod/IMod"; import { IModLoader } from "../models/spt/mod/IModLoader"; import { IPackageJsonData } from "../models/spt/mod/IPackageJsonData"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { LocalisationService } from "../services/LocalisationService"; import { ModCompilerService } from "../services/ModCompilerService"; import { JsonUtil } from "../utils/JsonUtil"; import { VFS } from "../utils/VFS"; import { BundleLoader } from "./BundleLoader"; -import { IPostAkiLoadMod } from "../models/external/IPostAkiLoadMod"; -import { IPreAkiLoadMod } from "../models/external/IPreAkiLoadMod"; -import { IPostDBLoadMod } from "../models/external/IPostDBLoadMod"; export declare class PreAkiModLoader implements IModLoader { protected logger: ILogger; protected vfs: VFS; protected jsonUtil: JsonUtil; protected modCompilerService: ModCompilerService; protected bundleLoader: BundleLoader; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected static container: DependencyContainer; protected readonly basepath = "user/mods/"; protected imported: Record; protected akiConfig: ICoreConfig; - constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, modCompilerService: ModCompilerService, bundleLoader: BundleLoader, configServer: ConfigServer); + constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, modCompilerService: ModCompilerService, bundleLoader: BundleLoader, localisationService: LocalisationService, configServer: ConfigServer); load(container: DependencyContainer): Promise; getBundles(local: boolean): string; getBundle(key: string, local: boolean): void; diff --git a/TypeScript/8OnUpdateHook/types/models/eft/bot/IGenerateBotsRequestData.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/bot/IGenerateBotsRequestData.d.ts index c49cef7..f1f7013 100644 --- a/TypeScript/8OnUpdateHook/types/models/eft/bot/IGenerateBotsRequestData.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/eft/bot/IGenerateBotsRequestData.d.ts @@ -2,6 +2,7 @@ export interface IGenerateBotsRequestData { conditions: Condition[]; } export interface Condition { + /** e.g. assault/pmcBot/bossKilla */ Role: string; Limit: number; Difficulty: string; diff --git a/TypeScript/8OnUpdateHook/types/models/eft/common/IGlobals.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/common/IGlobals.d.ts index 81e2023..b53f106 100644 --- a/TypeScript/8OnUpdateHook/types/models/eft/common/IGlobals.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/eft/common/IGlobals.d.ts @@ -591,6 +591,7 @@ export interface HealPrice { export interface ProfileHealthSettings { BodyPartsSettings: BodyPartsSettings; HealthFactorsSettings: HealthFactorsSettings; + DefaultStimulatorBuff: string; } export interface BodyPartsSettings { Head: BodyPartsSetting; diff --git a/TypeScript/8OnUpdateHook/types/models/eft/common/tables/IBotBase.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/common/tables/IBotBase.d.ts index 1c28ae0..2b418c1 100644 --- a/TypeScript/8OnUpdateHook/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/eft/common/tables/IBotBase.d.ts @@ -107,6 +107,7 @@ export interface CurrentMax { Maximum: number; } export interface Inventory { + discardLimits: Record; items: Item[]; equipment: string; stash: string; diff --git a/TypeScript/8OnUpdateHook/types/models/eft/common/tables/IBotType.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/common/tables/IBotType.d.ts index c1fe579..55b4bd9 100644 --- a/TypeScript/8OnUpdateHook/types/models/eft/common/tables/IBotType.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/eft/common/tables/IBotType.d.ts @@ -13,8 +13,8 @@ export interface IBotType { skills: Skills; } export interface Appearance { - body: string[]; - feet: string[]; + body: Record; + feet: Record; hands: string[]; head: string[]; voice: string[]; diff --git a/TypeScript/8OnUpdateHook/types/models/eft/common/tables/ITemplateItem.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/common/tables/ITemplateItem.d.ts index 8569e61..0fa7e18 100644 --- a/TypeScript/8OnUpdateHook/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/eft/common/tables/ITemplateItem.d.ts @@ -254,7 +254,7 @@ export interface Props { foodUseTime?: number; foodEffectType?: string; StimulatorBuffs?: string; - effects_health?: any; + effects_health?: IHealthEffect[] | Record>; effects_damage?: any; MaximumNumberOfUsage?: number; knifeHitDelay?: number; @@ -366,6 +366,10 @@ export interface Props { MinTimeToContactExplode?: number; ExplosionEffectType?: string; } +export interface IHealthEffect { + type: string; + value: number; +} export interface Prefab { path: string; rcid: string; diff --git a/TypeScript/8OnUpdateHook/types/models/eft/customization/IGetSuitsResponse.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/customization/IGetSuitsResponse.d.ts new file mode 100644 index 0000000..fe6888c --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/models/eft/customization/IGetSuitsResponse.d.ts @@ -0,0 +1,4 @@ +export interface IGetSuitsResponse { + _id: string; + suits: string[]; +} diff --git a/TypeScript/8OnUpdateHook/types/models/eft/game/IGameKeepAliveResponse.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/game/IGameKeepAliveResponse.d.ts new file mode 100644 index 0000000..170ce6a --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/models/eft/game/IGameKeepAliveResponse.d.ts @@ -0,0 +1,4 @@ +export interface IGameKeepAliveResponse { + msg: string; + utc_time: number; +} diff --git a/TypeScript/8OnUpdateHook/types/models/eft/game/IGameLogoutResponseData.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/game/IGameLogoutResponseData.d.ts new file mode 100644 index 0000000..0f52050 --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/models/eft/game/IGameLogoutResponseData.d.ts @@ -0,0 +1,3 @@ +export interface IGameLogoutResponseData { + status: string; +} diff --git a/TypeScript/8OnUpdateHook/types/models/eft/game/IGameStartResponse.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/game/IGameStartResponse.d.ts new file mode 100644 index 0000000..9f0ab6d --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/models/eft/game/IGameStartResponse.d.ts @@ -0,0 +1,3 @@ +export interface IGameStartResponse { + utc_time: number; +} diff --git a/TypeScript/8OnUpdateHook/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts new file mode 100644 index 0000000..3c45124 --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts @@ -0,0 +1,11 @@ +import { IInventoryBaseActionRequestData } from "./IInventoryBaseActionRequestData"; +export interface IOpenRandomLootContainerRequestData extends IInventoryBaseActionRequestData { + Action: "OpenRandomLootContainer"; + /** Container item opened */ + item: string; + to: To[]; +} +export interface To { + /** Player character (pmc/scav) id items will be sent to */ + id: string; +} diff --git a/TypeScript/8OnUpdateHook/types/models/eft/itemEvent/IItemEventRouterBase.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/itemEvent/IItemEventRouterBase.d.ts index 4841cfd..60ab284 100644 --- a/TypeScript/8OnUpdateHook/types/models/eft/itemEvent/IItemEventRouterBase.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/eft/itemEvent/IItemEventRouterBase.d.ts @@ -10,8 +10,9 @@ export interface IItemEventRouterBase { export declare type TProfileChanges = Record; export interface Warning { index: number; - err: string; errmsg: string; + code?: string; + data?: any; } export interface ProfileChange { _id: string; diff --git a/TypeScript/8OnUpdateHook/types/models/eft/match/IStartOffineRaidRequestData.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/match/IStartOffineRaidRequestData.d.ts index af0625e..1983728 100644 --- a/TypeScript/8OnUpdateHook/types/models/eft/match/IStartOffineRaidRequestData.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/eft/match/IStartOffineRaidRequestData.d.ts @@ -2,8 +2,10 @@ import { BotAmount } from "../../enums/BotAmount"; import { BotDifficulty } from "../../enums/BotDifficulty"; export interface IStartOfflineRaidRequestData { locationName: string; + /** Current time, not in-game time */ startTime: number; - dateTime: string; + /** CURR = am, past = pm */ + dateTime: "CURR" | "PAST"; gameSettings: GameSettings; } export interface GameSettings { diff --git a/TypeScript/8OnUpdateHook/types/models/eft/notifier/ISelectProfileResponse.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/notifier/ISelectProfileResponse.d.ts new file mode 100644 index 0000000..ecb668a --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/models/eft/notifier/ISelectProfileResponse.d.ts @@ -0,0 +1,6 @@ +import { INotifierChannel } from "./INotifier"; +export interface ISelectProfileResponse { + status: string; + notifier: INotifierChannel; + notifierServer: string; +} diff --git a/TypeScript/8OnUpdateHook/types/models/eft/ragfair/IRagfairOffer.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/ragfair/IRagfairOffer.d.ts index 3251a37..792ec7d 100644 --- a/TypeScript/8OnUpdateHook/types/models/eft/ragfair/IRagfairOffer.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/eft/ragfair/IRagfairOffer.d.ts @@ -7,19 +7,19 @@ export interface IRagfairOffer { requirements: OfferRequirement[]; root: string; intId: number; + /** Handbook price */ itemsCost: number; + /** Rouble price */ requirementsCost: number; - sptRequirementsCostRouble: number; startTime: number; endTime: number; sellInOnePiece: boolean; - name?: string; - shortName?: string; loyaltyLevel: number; buyRestrictionMax?: number; buyRestrictionCurrent?: number; locked: boolean; unlimitedCount: boolean; + /** Rouble price */ summaryCost: number; user: IRagfairOfferUser; notAvailable: boolean; @@ -33,11 +33,11 @@ export interface OfferRequirement { } export interface IRagfairOfferUser { id: string; - nickname: string; - rating: number; + nickname?: string; + rating?: number; memberType: MemberCategory; - avatar: string; - isRatingGrowing: boolean; + avatar?: string; + isRatingGrowing?: boolean; } export interface SellResult { sellTime: number; diff --git a/TypeScript/8OnUpdateHook/types/models/eft/weather/IWeatherData.d.ts b/TypeScript/8OnUpdateHook/types/models/eft/weather/IWeatherData.d.ts index ecc96ce..1f5d5b5 100644 --- a/TypeScript/8OnUpdateHook/types/models/eft/weather/IWeatherData.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/eft/weather/IWeatherData.d.ts @@ -1,17 +1,18 @@ +import { WindDirection } from "../../../models/enums/WindDirection"; export interface IWeatherData { acceleration: number; time: string; date: string; - weather: IWeather; + weather?: IWeather; } export interface IWeather { pressure: number; temp: number; - fog: string; + fog: number; rain_intensity: number; - rain: any; + rain: number; wind_gustiness: number; - wind_direction: any; + wind_direction: WindDirection; wind_speed: number; cloud: number; time: string; diff --git a/TypeScript/8OnUpdateHook/types/models/enums/BackendErrorCodes.d.ts b/TypeScript/8OnUpdateHook/types/models/enums/BackendErrorCodes.d.ts new file mode 100644 index 0000000..6614b75 --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/models/enums/BackendErrorCodes.d.ts @@ -0,0 +1,67 @@ +export declare enum BackendErrorCodes { + NONE = 0, + UNKNOWN_ERROR = 200, + NOT_AUTHORIZED = 201, + NEED_AUTHORIZATION_CODE = 209, + WRONG_AUTHORIZATION_CODE = 211, + NEED_CAPTCHA = 214, + NO_NEED_CAPTCHA = 215, + CAPTCHA_FAILED = 218, + CAPTCHA_BRUTE_FORCED = 219, + NO_ROOM_IN_STASH = 223, + NICKNAME_NOT_UNIQUE = 225, + NICKNAME_NOT_VALID = 226, + UNSUPPORTED_CLIENT_VERSION = 232, + REPORT_NOT_ALLOWED = 238, + NICKNAME_IS_ABUSIVE = 241, + NICKNAME_CHANGE_TIMEOUT = 242, + NOT_MODIFIED = 304, + HTTP_BAD_REQUEST = 400, + HTTP_NOT_AUTHORIZED = 401, + HTTP_FORBIDDEN = 403, + HTTP_NOT_FOUND = 404, + HTTP_METHOD_NOT_ALLOWED = 405, + UNKNOWN_TRADING_ERROR = 500, + HTTPNOTIMPLEMENTED = 501, + HTTPBADGATEWAY = 502, + HTTPSERVICEUNAVAILABLE = 503, + HTTPGATEWAYTIMEOUT = 504, + TRADEROUTOFMONEY = 505, + HTTPVARIANTALSONEGOTIATES = 506, + PRICECHANGED = 509, + TRADERDISABLED = 512, + ITEMHASBEENSOLD = 513, + NOTENOUGHSPACEFORMONEY = 518, + HTTPINVALIDSSLCERTIFICATE = 526, + UNKNOWNRAGFAIRERROR = 550, + UNKNOWNRAGFAIRERROR2 = 551, + UNKNOWNMATCHMAKERERROR = 600, + SESSIONPARAMETERSERROR = 601, + SESSIONLOST = 602, + SERVERNOTREGISTERED = 604, + UNKNOWNQUESTERROR = 700, + QUESTBADPARAM = 702, + QUESTNOTFOUND = 703, + QUESTISUNAVAILABLE = 704, + NOFREESPACEFORREWARDS = 705, + WRONGQUESTSTATUS = 706, + CANTCOMPLETEQUEST = 707, + UNKNOWNMAILERROR = 900, + TOOMANYFRIENDREQUESTS = 925, + UNKNOWNSCRIPTEXECUTIONERROR = 1000, + UNKNOWNREPAIRINGERROR = 1200, + UNKNOWNINSURANCEERROR = 1300, + UNKNOWNCURRENCYEXCHANGEERROR = 1400, + OFFERNOTFOUND = 1503, + NOTENOUGHSPACE = 1505, + OFFEROUTOFSTOCK = 1506, + OFFERSOLD = 1507, + RAGFAIRUNAVAILABLE = 1511, + BANNEDERRORCODE = 1513, + INSUFFICIENTNUMBERINSTOCK = 1516, + TOOMANYITEMSTOSELL = 1517, + EXAMINATIONFAILED = 22001, + ITEMALREADYEXAMINED = 22002, + UNKNOWNNGINXERROR = 9000, + PARSERESPONSEERROR = 9001 +} diff --git a/TypeScript/8OnUpdateHook/types/models/enums/HideoutEventActions.d.ts b/TypeScript/8OnUpdateHook/types/models/enums/HideoutEventActions.d.ts new file mode 100644 index 0000000..e441477 --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/models/enums/HideoutEventActions.d.ts @@ -0,0 +1,11 @@ +export declare enum HideoutEventActions { + HIDEOUT_UPGRADE = "HideoutUpgrade", + HIDEOUT_UPGRADE_COMPLETE = "HideoutUpgradeComplete", + HIDEOUT_PUT_ITEMS_IN_AREA_SLOTS = "HideoutPutItemsInAreaSlots", + HIDEOUT_TAKE_ITEMS_FROM_AREA_SLOTS = "HideoutTakeItemsFromAreaSlots", + HIDEOUT_TOGGLE_AREA = "HideoutToggleArea", + HIDEOUT_SINGLE_PRODUCTION_START = "HideoutSingleProductionStart", + HIDEOUT_SCAV_CASE_PRODUCTION_START = "HideoutScavCaseProductionStart", + HIDEOUT_CONTINUOUS_PRODUCTION_START = "HideoutContinuousProductionStart", + HIDEOUT_TAKE_PRODUCTION = "HideoutTakeProduction" +} diff --git a/TypeScript/8OnUpdateHook/types/models/enums/ItemEventActions.d.ts b/TypeScript/8OnUpdateHook/types/models/enums/ItemEventActions.d.ts new file mode 100644 index 0000000..0e65453 --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/models/enums/ItemEventActions.d.ts @@ -0,0 +1,19 @@ +export declare enum ItemEventActions { + MOVE = "Move", + REMOVE = "Remove", + SPLIT = "Split", + MERGE = "Merge", + TRANSFER = "Transfer", + SWAP = "Swap", + FOLD = "Fold", + TOGGLE = "Toggle", + TAG = "Tag", + BIND = "Bind", + EXAMINE = "Examine", + READ_ENCYCLOPEDIA = "ReadEncyclopedia", + APPLY_INVENTORY_CHANGES = "ApplyInventoryChanges", + CREATE_MAP_MARKER = "CreateMapMarker", + DELETE_MAP_MARKER = "DeleteMapMarker", + EDIT_MAP_MARKER = "EditMapMarker", + OPEN_RANDOM_LOOT_CONTAINER = "OpenRandomLootContainer" +} diff --git a/TypeScript/8OnUpdateHook/types/models/enums/WeatherType.d.ts b/TypeScript/8OnUpdateHook/types/models/enums/WeatherType.d.ts new file mode 100644 index 0000000..d31fefe --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/models/enums/WeatherType.d.ts @@ -0,0 +1,19 @@ +export declare enum WeatherType { + CLEAR_DAY = 1, + CLEAR_WIND = 2, + CLEAR_NIGHT = 3, + PARTLY_CLOUD_DAY = 4, + PARTLY_CLOUD_NIGHT = 5, + CLEAR_FOG_DAY = 6, + CLEAR_FOG_NIGHT = 7, + CLOUDFOG = 8, + FOG = 9, + MOSTLY_CLOUD = 10, + LIGHT_RAIN = 11, + RAIN = 12, + CLOUD_WIND = 13, + CLOUD_WIND_RAIN = 14, + FULL_CLOUD = 15, + THUNDER_CLOUD = 16, + NONE = 0 +} diff --git a/TypeScript/8OnUpdateHook/types/models/enums/WildSpawnTypeNumber.d.ts b/TypeScript/8OnUpdateHook/types/models/enums/WildSpawnTypeNumber.d.ts new file mode 100644 index 0000000..ff806fe --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/models/enums/WildSpawnTypeNumber.d.ts @@ -0,0 +1,33 @@ +export declare enum WildSpawnTypeNumber { + ASSAULT = 1, + MARKSMAN = 2, + BOSSTEST = 4, + BOSSBULLY = 8, + FOLLOWERTEST = 16, + FOLLOWERBULLY = 32, + BOSSKILLA = 64, + BOSSKOJANIY = 128, + FOLLOWERKOJANIY = 256, + PMCBOT = 512, + CURSEDASSAULT = 1024, + BOSSGLUHAR = 2048, + FOLLOWERGLUHARASSAULT = 4096, + FOLLOWERGLUHARSECURITY = 8192, + FOLLOWERGLUHARSCOUT = 16384, + FOLLOWERGLUHARSNIPE = 32768, + FOLLOWERSANITAR = 65536, + BOSSSANITAR = 131072, + TEST = 262144, + ASSAULTGROUP = 524288, + SECTANTWARRIOR = 1048576, + SECTANTPRIEST = 2097152, + BOSSTAGILLA = 4194304, + FOLLOWERTAGILLA = 8388608, + EXUSEC = 16777216, + GIFTER = 33554432, + BOSSKNIGHT = 67108864, + FOLLOWERBIGPIPE = 134217728, + FOLLOWERBIRDEYE = 268435456, + SPTUSEC = 536870912, + SPTBEAR = 1073741824 +} diff --git a/TypeScript/8OnUpdateHook/types/models/enums/WindDirection.d.ts b/TypeScript/8OnUpdateHook/types/models/enums/WindDirection.d.ts new file mode 100644 index 0000000..fb30b20 --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/models/enums/WindDirection.d.ts @@ -0,0 +1,10 @@ +export declare enum WindDirection { + EAST = 1, + NORTH = 2, + WEST = 3, + SOUTH = 4, + SE = 5, + SW = 6, + NW = 7, + NE = 8 +} diff --git a/TypeScript/8OnUpdateHook/types/models/spt/config/IBotConfig.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/config/IBotConfig.d.ts index af8ceba..d6fa5e0 100644 --- a/TypeScript/8OnUpdateHook/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/spt/config/IBotConfig.d.ts @@ -27,6 +27,8 @@ export interface IBotConfig extends IBaseConfig { maxBotCap: Record; /** How many stacks of secret ammo should a bot have in its bot secure container */ secureContainerAmmoStackCount: number; + /** Batch generation size when type not available in cache */ + botGenerationBatchSizePerType: number; } export interface PresetBatch { assault: number; @@ -66,8 +68,12 @@ export interface EquipmentFilters { weaponModLimits: ModLimits; randomisedWeaponModSlots?: string[]; randomisedArmorSlots?: string[]; + faceShieldIsActiveChancePercent?: number; + lightLaserIsActiveChancePercent?: number; blacklist: EquipmentFilterDetails[]; whitelist: EquipmentFilterDetails[]; + clothing: WeightingAdjustmentDetails[]; + weightingAdjustments: WeightingAdjustmentDetails[]; } export interface ModLimits { /** How many scopes are allowed on a weapon - hard coded to work with OPTIC_SCOPE, ASSAULT_SCOPE, COLLIMATOR, COMPACT_COLLIMATOR */ @@ -80,3 +86,8 @@ export interface EquipmentFilterDetails { equipment: Record; cartridge: Record; } +export interface WeightingAdjustmentDetails { + levelRange: MinMax; + add: Record>; + edit: Record>; +} diff --git a/TypeScript/8OnUpdateHook/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/config/IInventoryConfig.d.ts index ffffa41..4642b9b 100644 --- a/TypeScript/8OnUpdateHook/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/spt/config/IInventoryConfig.d.ts @@ -2,4 +2,10 @@ import { IBaseConfig } from "./IBaseConfig"; export interface IInventoryConfig extends IBaseConfig { kind: "aki-inventory"; newItemsMarkedFound: boolean; + randomLootContainers: Record; +} +export interface RewardDetails { + rewardCount: number; + foundInRaid: boolean; + rewardTplPool: Record; } diff --git a/TypeScript/8OnUpdateHook/types/models/spt/config/ILocaleConfig.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/config/ILocaleConfig.d.ts index fe9abf7..0a8955c 100644 --- a/TypeScript/8OnUpdateHook/types/models/spt/config/ILocaleConfig.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/spt/config/ILocaleConfig.d.ts @@ -1,5 +1,10 @@ import { IBaseConfig } from "./IBaseConfig"; export interface ILocaleConfig extends IBaseConfig { kind: "aki-locale"; - desiredLocale: string; + /** e.g. ru/en/cn/fr etc, or 'system', will take computer locale setting */ + gameLocale: string; + /** e.g. ru/en/cn/fr etc, or 'system', will take computer locale setting */ + serverLocale: string; + /** Languages server can be translated into */ + serverSupportedLocales: string[]; } diff --git a/TypeScript/8OnUpdateHook/types/models/spt/config/IPmcConfig.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/config/IPmcConfig.d.ts index 9db2ba1..48601b2 100644 --- a/TypeScript/8OnUpdateHook/types/models/spt/config/IPmcConfig.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/spt/config/IPmcConfig.d.ts @@ -6,9 +6,11 @@ export interface IPmcConfig { looseWeaponInBackpackChancePercent: number; looseWeaponInBackpackLootMinMax: MinMax; isUsec: number; + usecType: string; + bearType: string; chanceSameSideIsHostilePercent: number; /** key: location, value: type for usec/bear */ - pmcType: Record; + pmcType: Record>>; maxBackpackLootTotalRub: number; maxPocketLootTotalRub: number; maxVestLootTotalRub: number; diff --git a/TypeScript/8OnUpdateHook/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/config/IRagfairConfig.d.ts index c1b8763..6786417 100644 --- a/TypeScript/8OnUpdateHook/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/spt/config/IRagfairConfig.d.ts @@ -28,12 +28,8 @@ export interface Reputation { gain: number; loss: number; } -export declare class OfferAdjustment { - maxPriceDifferenceBelowHandbookPercent: number; - handbookPriceMultipier: number; - priceThreshholdRub: number; -} export interface Dynamic { + barter: Barter; offerAdjustment: OfferAdjustment; expiredOfferThreshold: number; offerItemCount: MinMax; @@ -49,6 +45,20 @@ export interface Dynamic { showAsSingleStack: string[]; blacklist: Blacklist; } +export declare class Barter { + enable: boolean; + chancePercent: number; + itemCountMin: number; + itemCountMax: number; + priceRangeVariancePercent: number; + minRoubleCostToBecomeBarter: number; + itemTypeBlacklist: string[]; +} +export declare class OfferAdjustment { + maxPriceDifferenceBelowHandbookPercent: number; + handbookPriceMultipier: number; + priceThreshholdRub: number; +} export interface Condition { conditionChance: number; min: number; diff --git a/TypeScript/8OnUpdateHook/types/models/spt/config/ISeasonalEventConfig.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/config/ISeasonalEventConfig.d.ts index bc60618..e410925 100644 --- a/TypeScript/8OnUpdateHook/types/models/spt/config/ISeasonalEventConfig.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/spt/config/ISeasonalEventConfig.d.ts @@ -1,6 +1,9 @@ import { IBaseConfig } from "./IBaseConfig"; export interface ISeasonalEventConfig extends IBaseConfig { kind: "aki-seasonalevents"; + enableSeasonalEventDetection: boolean; + /** event / botType / equipSlot / itemid */ + eventGear: Record>>>; events: ISeasonalEvent[]; } export interface ISeasonalEvent { diff --git a/TypeScript/8OnUpdateHook/types/models/spt/config/IWeatherConfig.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/config/IWeatherConfig.d.ts index bbdc43e..41a1c83 100644 --- a/TypeScript/8OnUpdateHook/types/models/spt/config/IWeatherConfig.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/spt/config/IWeatherConfig.d.ts @@ -1,3 +1,4 @@ +import { WindDirection } from "../../../models/enums/WindDirection"; import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface IWeatherConfig extends IBaseConfig { @@ -7,12 +8,16 @@ export interface IWeatherConfig extends IBaseConfig { } export interface Weather { clouds: MinMax; - windSpeed: MinMax; - windDirection: MinMax; + windSpeed: WeatherSettings; + windDirection: WeatherSettings; windGustiness: MinMax; - rain: MinMax; + rain: WeatherSettings; rainIntensity: MinMax; - fog: MinMax; + fog: WeatherSettings; temp: MinMax; pressure: MinMax; } +export interface WeatherSettings { + values: T[]; + weights: number[]; +} diff --git a/TypeScript/8OnUpdateHook/types/routers/item_events/HideoutItemEventRouter.d.ts b/TypeScript/8OnUpdateHook/types/routers/item_events/HideoutItemEventRouter.d.ts index e1e98af..44bd1cd 100644 --- a/TypeScript/8OnUpdateHook/types/routers/item_events/HideoutItemEventRouter.d.ts +++ b/TypeScript/8OnUpdateHook/types/routers/item_events/HideoutItemEventRouter.d.ts @@ -1,7 +1,7 @@ -import { IPmcData } from "../../models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "../../models/eft/itemEvent/IItemEventRouterResponse"; import { HideoutCallbacks } from "../../callbacks/HideoutCallbacks"; import { HandledRoute, ItemEventRouterDefinition } from "../../di/Router"; +import { IPmcData } from "../../models/eft/common/IPmcData"; +import { IItemEventRouterResponse } from "../../models/eft/itemEvent/IItemEventRouterResponse"; export declare class HideoutItemEventRouter extends ItemEventRouterDefinition { protected hideoutCallbacks: HideoutCallbacks; constructor(hideoutCallbacks: HideoutCallbacks); diff --git a/TypeScript/8OnUpdateHook/types/routers/item_events/InventoryItemEventRouter.d.ts b/TypeScript/8OnUpdateHook/types/routers/item_events/InventoryItemEventRouter.d.ts index 2619bb9..953d322 100644 --- a/TypeScript/8OnUpdateHook/types/routers/item_events/InventoryItemEventRouter.d.ts +++ b/TypeScript/8OnUpdateHook/types/routers/item_events/InventoryItemEventRouter.d.ts @@ -1,7 +1,7 @@ -import { IPmcData } from "../../models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "../../models/eft/itemEvent/IItemEventRouterResponse"; import { InventoryCallbacks } from "../../callbacks/InventoryCallbacks"; import { HandledRoute, ItemEventRouterDefinition } from "../../di/Router"; +import { IPmcData } from "../../models/eft/common/IPmcData"; +import { IItemEventRouterResponse } from "../../models/eft/itemEvent/IItemEventRouterResponse"; export declare class InventoryItemEventRouter extends ItemEventRouterDefinition { protected inventoryCallbacks: InventoryCallbacks; constructor(inventoryCallbacks: InventoryCallbacks); diff --git a/TypeScript/8OnUpdateHook/types/servers/HttpServer.d.ts b/TypeScript/8OnUpdateHook/types/servers/HttpServer.d.ts index bbca8af..80c1d48 100644 --- a/TypeScript/8OnUpdateHook/types/servers/HttpServer.d.ts +++ b/TypeScript/8OnUpdateHook/types/servers/HttpServer.d.ts @@ -4,6 +4,7 @@ import { ApplicationContext } from "../context/ApplicationContext"; import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; import { ILogger } from "../models/spt/utils/ILogger"; +import { LocalisationService } from "../services/LocalisationService"; import { ConfigServer } from "./ConfigServer"; import { DatabaseServer } from "./DatabaseServer"; import { IHttpListener } from "./http/IHttpListener"; @@ -12,11 +13,12 @@ export declare class HttpServer { protected logger: ILogger; protected databaseServer: DatabaseServer; protected httpServerHelper: HttpServerHelper; + protected localisationService: LocalisationService; protected httpListeners: IHttpListener[]; protected configServer: ConfigServer; protected applicationContext: ApplicationContext; protected webSocketServer: WebSocketServer; - constructor(logger: ILogger, databaseServer: DatabaseServer, httpServerHelper: HttpServerHelper, httpListeners: IHttpListener[], configServer: ConfigServer, applicationContext: ApplicationContext, webSocketServer: WebSocketServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, httpServerHelper: HttpServerHelper, localisationService: LocalisationService, httpListeners: IHttpListener[], configServer: ConfigServer, applicationContext: ApplicationContext, webSocketServer: WebSocketServer); protected httpConfig: IHttpConfig; getCookies(req: http.IncomingMessage): any; handleRequest(req: IncomingMessage, resp: ServerResponse): void; diff --git a/TypeScript/8OnUpdateHook/types/servers/SaveServer.d.ts b/TypeScript/8OnUpdateHook/types/servers/SaveServer.d.ts index cb28f49..4dca514 100644 --- a/TypeScript/8OnUpdateHook/types/servers/SaveServer.d.ts +++ b/TypeScript/8OnUpdateHook/types/servers/SaveServer.d.ts @@ -1,20 +1,22 @@ +import { SaveLoadRouter } from "../di/Router"; import { IAkiProfile, Info } from "../models/eft/profile/IAkiProfile"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { VFS } from "../utils/VFS"; -import { SaveLoadRouter } from "../di/Router"; -import { ILogger } from "../models/spt/utils/ILogger"; export declare class SaveServer { protected vfs: VFS; protected saveLoadRouters: SaveLoadRouter[]; protected jsonUtil: JsonUtil; protected hashUtil: HashUtil; + protected localisationService: LocalisationService; protected logger: ILogger; protected profileFilepath: string; protected profiles: {}; protected onSave: {}; protected saveMd5: {}; - constructor(vfs: VFS, saveLoadRouters: SaveLoadRouter[], jsonUtil: JsonUtil, hashUtil: HashUtil, logger: ILogger); + constructor(vfs: VFS, saveLoadRouters: SaveLoadRouter[], jsonUtil: JsonUtil, hashUtil: HashUtil, localisationService: LocalisationService, logger: ILogger); load(): void; save(): void; getProfile(sessionId: string): IAkiProfile; diff --git a/TypeScript/8OnUpdateHook/types/servers/WebSocketServer.d.ts b/TypeScript/8OnUpdateHook/types/servers/WebSocketServer.d.ts index f33d214..5d40e6e 100644 --- a/TypeScript/8OnUpdateHook/types/servers/WebSocketServer.d.ts +++ b/TypeScript/8OnUpdateHook/types/servers/WebSocketServer.d.ts @@ -1,18 +1,20 @@ /// -import { HttpServerHelper } from "../helpers/HttpServerHelper"; -import WebSocket from "ws"; import http, { IncomingMessage } from "http"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { RandomUtil } from "../utils/RandomUtil"; +import WebSocket from "ws"; +import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { INotification } from "../models/eft/notifier/INotifier"; -import { ConfigServer } from "./ConfigServer"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { LocalisationService } from "../services/LocalisationService"; +import { RandomUtil } from "../utils/RandomUtil"; +import { ConfigServer } from "./ConfigServer"; export declare class WebSocketServer { protected logger: ILogger; protected randomUtil: RandomUtil; protected configServer: ConfigServer; + protected localisationService: LocalisationService; protected httpServerHelper: HttpServerHelper; - constructor(logger: ILogger, randomUtil: RandomUtil, configServer: ConfigServer, httpServerHelper: HttpServerHelper); + constructor(logger: ILogger, randomUtil: RandomUtil, configServer: ConfigServer, localisationService: LocalisationService, httpServerHelper: HttpServerHelper); protected httpConfig: IHttpConfig; protected defaultNotification: INotification; protected webSockets: Record; diff --git a/TypeScript/8OnUpdateHook/types/servers/http/AkiHttpListener.d.ts b/TypeScript/8OnUpdateHook/types/servers/http/AkiHttpListener.d.ts index 6f78939..acf92aa 100644 --- a/TypeScript/8OnUpdateHook/types/servers/http/AkiHttpListener.d.ts +++ b/TypeScript/8OnUpdateHook/types/servers/http/AkiHttpListener.d.ts @@ -1,22 +1,24 @@ /// /// import { IncomingMessage, ServerResponse } from "http"; -import { IHttpListener } from "./IHttpListener"; import { Serializer } from "../../di/Serializer"; import { ILogger } from "../../models/spt/utils/ILogger"; import { HttpRouter } from "../../routers/HttpRouter"; +import { LocalisationService } from "../../services/LocalisationService"; import { HttpResponseUtil } from "../../utils/HttpResponseUtil"; import { JsonUtil } from "../../utils/JsonUtil"; import { HttpBufferHandler } from "./HttpBufferHandler"; +import { IHttpListener } from "./IHttpListener"; export declare class AkiHttpListener implements IHttpListener { protected httpRouter: HttpRouter; protected serializers: Serializer[]; protected logger: ILogger; protected jsonUtil: JsonUtil; protected httpResponse: HttpResponseUtil; + protected localisationService: LocalisationService; protected httpBufferHandler: HttpBufferHandler; constructor(httpRouter: HttpRouter, // TODO: delay required - serializers: Serializer[], logger: ILogger, jsonUtil: JsonUtil, httpResponse: HttpResponseUtil, httpBufferHandler: HttpBufferHandler); + serializers: Serializer[], logger: ILogger, jsonUtil: JsonUtil, httpResponse: HttpResponseUtil, localisationService: LocalisationService, httpBufferHandler: HttpBufferHandler); canHandle(_: string, req: IncomingMessage): boolean; handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): void; sendResponse(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: Buffer, output: string): void; diff --git a/TypeScript/8OnUpdateHook/types/services/BotEquipmentFilterService.d.ts b/TypeScript/8OnUpdateHook/types/services/BotEquipmentFilterService.d.ts index 632f961..ae72cc3 100644 --- a/TypeScript/8OnUpdateHook/types/services/BotEquipmentFilterService.d.ts +++ b/TypeScript/8OnUpdateHook/types/services/BotEquipmentFilterService.d.ts @@ -1,12 +1,12 @@ import { IBotType } from "../models/eft/common/tables/IBotType"; -import { EquipmentFilters, EquipmentFilterDetails, IBotConfig } from "../models/spt/config/IBotConfig"; +import { EquipmentFilters, EquipmentFilterDetails, IBotConfig, WeightingAdjustmentDetails } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; export declare class BotEquipmentFilterService { protected logger: ILogger; protected configServer: ConfigServer; protected botConfig: IBotConfig; - protected botEquipmentFilterlists: Record; + protected botEquipmentConfig: Record; constructor(logger: ILogger, configServer: ConfigServer); /** * Filter a bots data to exclude equipment and cartridges defines in the botConfig @@ -30,6 +30,20 @@ export declare class BotEquipmentFilterService { * @returns EquipmentFilterDetails object */ protected getBotEquipmentWhitelist(botRole: string, playerLevel: number): EquipmentFilterDetails; + /** + * Retreive clothing weighting adjustments from bot.json config + * @param botRole Bot type to get adjustments for + * @param playerLevel level of player + * @returns Weighting adjustments for bots clothing + */ + protected getBotClothingAdjustments(botRole: string, playerLevel: number): WeightingAdjustmentDetails; + /** + * Retreive item weighting adjustments from bot.json config + * @param botRole Bot type to get adjustments for + * @param playerLevel level of player + * @returns Weighting adjustments for bot items + */ + protected getBotWeightingAdjustments(botRole: string, playerLevel: number): WeightingAdjustmentDetails; /** * Filter bot equipment based on blacklist and whitelist from config/bot.json * Prioritises whitelist first, if one is found blacklist is ignored @@ -47,4 +61,10 @@ export declare class BotEquipmentFilterService { * @returns Filtered bot file */ protected filterCartridges(baseBotNode: IBotType, blacklist: EquipmentFilterDetails, whitelist: EquipmentFilterDetails): void; + /** + * Add/Edit weighting changes to bot items using values from config/bot.json/equipment + * @param weightingAdjustments Weighting change to apply to bot + * @param botItemPool Bot item dictionary to adjust + */ + protected adjustWeighting(weightingAdjustments: WeightingAdjustmentDetails, botItemPool: Record): void; } diff --git a/TypeScript/8OnUpdateHook/types/services/BotGenerationCacheService.d.ts b/TypeScript/8OnUpdateHook/types/services/BotGenerationCacheService.d.ts index ba53fec..0be0576 100644 --- a/TypeScript/8OnUpdateHook/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/8OnUpdateHook/types/services/BotGenerationCacheService.d.ts @@ -8,11 +8,11 @@ export declare class BotGenerationCacheService { protected randomUtil: RandomUtil; protected jsonUtil: JsonUtil; protected botHelper: BotHelper; - protected storedBots: IBotBase[]; + protected storedBots: Map; constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, botHelper: BotHelper); /** * Store array of bots in cache, shuffle results before storage - * @param botsToStore + * @param botsToStore Bots we want to store in the cache */ storeBots(botsToStore: IBotBase[]): void; /** @@ -21,25 +21,7 @@ export declare class BotGenerationCacheService { * @param role role to retreive (assault/bossTagilla etc) * @returns IBotBase object */ - getBot(role: string): IBotBase[]; - /** - * Find a bot by its index from cache - * @param indexOfBotToReturn index to find bot by - * @returns bot profile - */ - protected getBotFromCache(indexOfBotToReturn: number): IBotBase; - /** - * Remove bot profile by index from cache - * @param indexOfBotToReturn Index of bot profile to remove - */ - protected removeBotFromCache(indexOfBotToReturn: number): void; - /** - * Get index of bot profile that matches criteria - * @param role Role of bot wanted - * @param getPmc Requested bot a pmc - * @returns index of found bot, -1 if not found - */ - protected getIndexOfBotToReturn(role: string, getPmc: boolean): number; + getBot(role: string): IBotBase; /** * Remove all cached bot profiles */ @@ -48,5 +30,5 @@ export declare class BotGenerationCacheService { * Does cache have bots * @returns true if empty */ - cacheIsEmpty(): boolean; + cacheHasBotOfRole(role: string): boolean; } diff --git a/TypeScript/8OnUpdateHook/types/services/LocaleService.d.ts b/TypeScript/8OnUpdateHook/types/services/LocaleService.d.ts index 33bea7b..8275b75 100644 --- a/TypeScript/8OnUpdateHook/types/services/LocaleService.d.ts +++ b/TypeScript/8OnUpdateHook/types/services/LocaleService.d.ts @@ -1,14 +1,42 @@ import { ILocaleConfig } from "../models/spt/config/ILocaleConfig"; +import { ILocaleGlobalBase } from "../models/spt/server/ILocaleBase"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +/** + * Handles getting locales from config or users machine + */ export declare class LocaleService { protected logger: ILogger; + protected databaseServer: DatabaseServer; protected configServer: ConfigServer; protected localeConfig: ILocaleConfig; - constructor(logger: ILogger, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, configServer: ConfigServer); /** - * Gets the locale key from the locale.json file + * Get the eft globals db file based on the configured locale in config/locale.json, if not found, fall back to 'en' + * @returns ILocaleGlobalBase + */ + getLocaleDb(): ILocaleGlobalBase; + /** + * Gets the game locale key from the locale.json file, + * if value is 'system' get system locale * @returns locale e.g en/ge/cz/cn */ - getDesiredLocale(): string; + getDesiredGameLocale(): string; + /** + * Gets the game locale key from the locale.json file, + * if value is 'system' get system locale + * @returns locale e.g en/ge/cz/cn + */ + getDesiredServerLocale(): string; + /** + * Get array of languages supported for localisation + * @returns array of locales e.g. en/fr/cn + */ + getServerSupportedLocales(): string[]; + /** + * Get the locale of the computer running the server + * @returns langage part of locale e.g. 'en' part of 'en-US' + */ + protected getPlatformLocale(): string; } diff --git a/TypeScript/8OnUpdateHook/types/services/LocalisationService.d.ts b/TypeScript/8OnUpdateHook/types/services/LocalisationService.d.ts new file mode 100644 index 0000000..519325d --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/services/LocalisationService.d.ts @@ -0,0 +1,21 @@ +import { I18n } from "i18n"; +import { ILocaleConfig } from "../models/spt/config/ILocaleConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { LocaleService } from "./LocaleService"; +/** + * Handles translating server text into different langauges + */ +export declare class LocalisationService { + protected logger: ILogger; + protected localeService: LocaleService; + protected localeConfig: ILocaleConfig; + protected i18n: I18n; + constructor(logger: ILogger, localeService: LocaleService); + /** + * Get a localised value using the passed in key + * @param key Key to loop up locale for + * @param args optional arguments + * @returns Localised string + */ + getText(key: string, args?: any): string; +} diff --git a/TypeScript/8OnUpdateHook/types/services/PaymentService.d.ts b/TypeScript/8OnUpdateHook/types/services/PaymentService.d.ts index a5e538f..c9ce95a 100644 --- a/TypeScript/8OnUpdateHook/types/services/PaymentService.d.ts +++ b/TypeScript/8OnUpdateHook/types/services/PaymentService.d.ts @@ -11,6 +11,7 @@ import { IProcessSellTradeRequestData } from "../models/eft/trade/IProcessSellTr import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +import { LocalisationService } from "./LocalisationService"; export declare class PaymentService { protected logger: ILogger; protected httpResponse: HttpResponseUtil; @@ -19,8 +20,9 @@ export declare class PaymentService { protected traderHelper: TraderHelper; protected itemHelper: ItemHelper; protected inventoryHelper: InventoryHelper; + protected localisationService: LocalisationService; protected paymentHelper: PaymentHelper; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, traderHelper: TraderHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper); + constructor(logger: ILogger, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, traderHelper: TraderHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, localisationService: LocalisationService, paymentHelper: PaymentHelper); /** * Take money and insert items into return to server request * @param {Object} pmcData @@ -50,7 +52,7 @@ export declare class PaymentService { * @param pmcData Player profile to find and remove currency from * @param currencyTpl Type of currency to pay * @param amountToPay money value to pay - * @param sessionID Sessino id + * @param sessionID Session id * @param output output object to send to client * @returns IItemEventRouterResponse */ diff --git a/TypeScript/8OnUpdateHook/types/services/PlayerService.d.ts b/TypeScript/8OnUpdateHook/types/services/PlayerService.d.ts index 519b7e5..2f364d5 100644 --- a/TypeScript/8OnUpdateHook/types/services/PlayerService.d.ts +++ b/TypeScript/8OnUpdateHook/types/services/PlayerService.d.ts @@ -2,10 +2,12 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { IPlayerIncrementSkillLevelRequestData } from "../models/eft/player/IPlayerIncrementSkillLevelRequestData"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "./LocalisationService"; export declare class PlayerService { protected logger: ILogger; + protected localisationService: LocalisationService; protected databaseServer: DatabaseServer; - constructor(logger: ILogger, databaseServer: DatabaseServer); + constructor(logger: ILogger, localisationService: LocalisationService, databaseServer: DatabaseServer); /** * increases the profile skill and updates any output * @param {Object} pmcData diff --git a/TypeScript/8OnUpdateHook/types/services/PmcAiService.d.ts b/TypeScript/8OnUpdateHook/types/services/PmcAiService.d.ts deleted file mode 100644 index 0690f1f..0000000 --- a/TypeScript/8OnUpdateHook/types/services/PmcAiService.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { IBotConfig } from "../models/spt/config/IBotConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { ConfigServer } from "../servers/ConfigServer"; -/** Storing/retreving pmcRoles set at the start of a raid - its done at that point as we know what location the player is heading to */ -export declare class PmcAiService { - protected logger: ILogger; - protected configServer: ConfigServer; - protected botConfig: IBotConfig; - protected usecRole: string; - protected bearRole: string; - constructor(logger: ILogger, configServer: ConfigServer); - /** - * Convert from pmc side (usec/bear) to the side as defined in the bot config (usecType/bearType) - * @param pmcSide eft side (usec/bear) - * @returns pmc side as defined in config - */ - getPmcRole(pmcSide: "usec" | "bear" | string): string; - /** - * Set the roles for pmcs - * @param location map location to look up and use as pmc types - */ - setPmcRolesByLocation(location: string): void; - /** - * Clear the saved role from usec/bear PMCs - */ - clearPmcRoles(): void; -} diff --git a/TypeScript/8OnUpdateHook/types/services/ProfileFixerService.d.ts b/TypeScript/8OnUpdateHook/types/services/ProfileFixerService.d.ts index e772919..86a6af8 100644 --- a/TypeScript/8OnUpdateHook/types/services/ProfileFixerService.d.ts +++ b/TypeScript/8OnUpdateHook/types/services/ProfileFixerService.d.ts @@ -8,12 +8,14 @@ import { HideoutAreas } from "../models/enums/HideoutAreas"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { Watermark } from "../utils/Watermark"; +import { LocalisationService } from "./LocalisationService"; export declare class ProfileFixerService { protected logger: ILogger; protected watermark: Watermark; protected hideoutHelper: HideoutHelper; + protected localisationService: LocalisationService; protected databaseServer: DatabaseServer; - constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, databaseServer: DatabaseServer); + constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, localisationService: LocalisationService, databaseServer: DatabaseServer); /** * Find issues in the pmc profile data that may cause issues and fix them * @param pmcProfile profile to check and fix diff --git a/TypeScript/8OnUpdateHook/types/services/RagfairOfferService.d.ts b/TypeScript/8OnUpdateHook/types/services/RagfairOfferService.d.ts index a6f6b6d..86c1e52 100644 --- a/TypeScript/8OnUpdateHook/types/services/RagfairOfferService.d.ts +++ b/TypeScript/8OnUpdateHook/types/services/RagfairOfferService.d.ts @@ -11,6 +11,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { TimeUtil } from "../utils/TimeUtil"; +import { LocalisationService } from "./LocalisationService"; import { RagfairCategoriesService } from "./RagfairCategoriesService"; export declare class RagfairOfferService { protected logger: ILogger; @@ -22,12 +23,14 @@ export declare class RagfairOfferService { protected profileHelper: ProfileHelper; protected eventOutputHolder: EventOutputHolder; protected httpResponse: HttpResponseUtil; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected playerOffersLoaded: boolean; protected expiredOffers: Item[]; - protected offers: IRagfairOffer[]; + /** offerId, offer */ + protected offers: Record; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, databaseServer: DatabaseServer, saveServer: SaveServer, ragfairServerHelper: RagfairServerHelper, ragfairCategoriesService: RagfairCategoriesService, profileHelper: ProfileHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, databaseServer: DatabaseServer, saveServer: SaveServer, ragfairServerHelper: RagfairServerHelper, ragfairCategoriesService: RagfairCategoriesService, profileHelper: ProfileHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, localisationService: LocalisationService, configServer: ConfigServer); /** * Get all offers * @returns IRagfairOffer array diff --git a/TypeScript/8OnUpdateHook/types/utils/App.d.ts b/TypeScript/8OnUpdateHook/types/utils/App.d.ts index dcc2669..cc8a5af 100644 --- a/TypeScript/8OnUpdateHook/types/utils/App.d.ts +++ b/TypeScript/8OnUpdateHook/types/utils/App.d.ts @@ -1,14 +1,16 @@ -import { TimeUtil } from "./TimeUtil"; import { OnLoad } from "../di/OnLoad"; import { OnUpdate } from "../di/OnUpdate"; import { ILogger } from "../models/spt/utils/ILogger"; +import { LocalisationService } from "../services/LocalisationService"; +import { TimeUtil } from "./TimeUtil"; export declare class App { protected logger: ILogger; protected timeUtil: TimeUtil; + protected localisationService: LocalisationService; protected onLoadComponents: OnLoad[]; protected onUpdateComponents: OnUpdate[]; protected onUpdateLastRun: {}; - constructor(logger: ILogger, timeUtil: TimeUtil, onLoadComponents: OnLoad[], onUpdateComponents: OnUpdate[]); + constructor(logger: ILogger, timeUtil: TimeUtil, localisationService: LocalisationService, onLoadComponents: OnLoad[], onUpdateComponents: OnUpdate[]); load(): void; protected update(onUpdateComponents: OnUpdate[]): void; protected logUpdateException(err: any, updateable: OnUpdate): void; diff --git a/TypeScript/8OnUpdateHook/types/utils/DatabaseImporter.d.ts b/TypeScript/8OnUpdateHook/types/utils/DatabaseImporter.d.ts index 483e135..31670ae 100644 --- a/TypeScript/8OnUpdateHook/types/utils/DatabaseImporter.d.ts +++ b/TypeScript/8OnUpdateHook/types/utils/DatabaseImporter.d.ts @@ -3,15 +3,17 @@ import { IDatabaseTables } from "../models/spt/server/IDatabaseTables"; import { ILogger } from "../models/spt/utils/ILogger"; import { ImageRouter } from "../routers/ImageRouter"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { JsonUtil } from "./JsonUtil"; import { VFS } from "./VFS"; export declare class DatabaseImporter extends OnLoad { protected logger: ILogger; protected vfs: VFS; protected jsonUtil: JsonUtil; + protected localisationService: LocalisationService; protected databaseServer: DatabaseServer; protected imageRouter: ImageRouter; - constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, databaseServer: DatabaseServer, imageRouter: ImageRouter); + constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, localisationService: LocalisationService, databaseServer: DatabaseServer, imageRouter: ImageRouter); onLoad(): void; /** * Read all json files in database folder and map into a json object diff --git a/TypeScript/8OnUpdateHook/types/utils/HttpResponseUtil.d.ts b/TypeScript/8OnUpdateHook/types/utils/HttpResponseUtil.d.ts index 29502be..3a78618 100644 --- a/TypeScript/8OnUpdateHook/types/utils/HttpResponseUtil.d.ts +++ b/TypeScript/8OnUpdateHook/types/utils/HttpResponseUtil.d.ts @@ -1,10 +1,13 @@ -import { JsonUtil } from "./JsonUtil"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { INullResponseData } from "../models/eft/httpResponse/INullResponseData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; +import { BackendErrorCodes } from "../models/enums/BackendErrorCodes"; +import { LocalisationService } from "../services/LocalisationService"; +import { JsonUtil } from "./JsonUtil"; export declare class HttpResponseUtil { protected jsonUtil: JsonUtil; - constructor(jsonUtil: JsonUtil); + protected localisationService: LocalisationService; + constructor(jsonUtil: JsonUtil, localisationService: LocalisationService); protected clearString(s: string): any; noBody(data: any): any; getBody(data: T, err?: number, errmsg?: any): IGetBodyResponseData; @@ -12,5 +15,5 @@ export declare class HttpResponseUtil { emptyResponse(): IGetBodyResponseData; nullResponse(): INullResponseData; emptyArrayResponse(): IGetBodyResponseData; - appendErrorToOutput(output: IItemEventRouterResponse, message?: string, title?: string): IItemEventRouterResponse; + appendErrorToOutput(output: IItemEventRouterResponse, message?: string, errorCode?: BackendErrorCodes): IItemEventRouterResponse; } diff --git a/TypeScript/8OnUpdateHook/types/utils/RandomUtil.d.ts b/TypeScript/8OnUpdateHook/types/utils/RandomUtil.d.ts index 633e472..aa556e3 100644 --- a/TypeScript/8OnUpdateHook/types/utils/RandomUtil.d.ts +++ b/TypeScript/8OnUpdateHook/types/utils/RandomUtil.d.ts @@ -110,6 +110,12 @@ export declare class RandomUtil { getIntEx(max: number): number; getFloat(min: number, max: number): number; getBool(): boolean; + /** + * Check if number passes a check out of 100 + * @param chancePercent value check needs to be above + * @returns true if value passes check + */ + getChance100(chancePercent: number): boolean; getStringArrayValue(arr: string[]): string; getArrayValue(arr: T[]): T; getKey(node: any): string; diff --git a/TypeScript/8OnUpdateHook/types/utils/Watermark.d.ts b/TypeScript/8OnUpdateHook/types/utils/Watermark.d.ts index c6dc120..e02eba2 100644 --- a/TypeScript/8OnUpdateHook/types/utils/Watermark.d.ts +++ b/TypeScript/8OnUpdateHook/types/utils/Watermark.d.ts @@ -1,20 +1,15 @@ import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { LocalisationService } from "../services/LocalisationService"; export declare class WatermarkLocale { - protected locales: { - "en-US": { - description: string[]; - warning: string[]; - modding: string[]; - }; - "zh-CN": { - description: string[]; - warning: string[]; - modding: string[]; - }; + protected localisationService: LocalisationService; + constructor(localisationService: LocalisationService); + protected watermark: { + description: string[]; + warning: string[]; + modding: string[]; }; - getLocale(): string; getDescription(): string[]; getWarning(): string[]; getModding(): string[]; @@ -22,9 +17,10 @@ export declare class WatermarkLocale { export declare class Watermark { protected logger: ILogger; protected configServer: ConfigServer; + protected localisationService: LocalisationService; protected watermarkLocale?: WatermarkLocale; protected akiConfig: ICoreConfig; - constructor(logger: ILogger, configServer: ConfigServer, watermarkLocale?: WatermarkLocale); + constructor(logger: ILogger, configServer: ConfigServer, localisationService: LocalisationService, watermarkLocale?: WatermarkLocale); protected text: string[]; protected versionLabel: string; initialize(): void; diff --git a/TypeScript/9RouterHooks/types/callbacks/BotCallbacks.d.ts b/TypeScript/9RouterHooks/types/callbacks/BotCallbacks.d.ts index 2db60dc..827015e 100644 --- a/TypeScript/9RouterHooks/types/callbacks/BotCallbacks.d.ts +++ b/TypeScript/9RouterHooks/types/callbacks/BotCallbacks.d.ts @@ -8,8 +8,29 @@ export declare class BotCallbacks { protected botController: BotController; protected httpResponse: HttpResponseUtil; constructor(botController: BotController, httpResponse: HttpResponseUtil); + /** + * Handle singleplayer/settings/bot/limit + * @returns string + */ getBotLimit(url: string, info: IEmptyRequestData, sessionID: string): string; + /** + * Handle singleplayer/settings/bot/difficulty + * @returns string + */ getBotDifficulty(url: string, info: IEmptyRequestData, sessionID: string): string; + /** + * Handle client/game/bot/generate + * @returns IGetBodyResponseData + */ generateBots(url: string, info: IGenerateBotsRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle singleplayer/settings/bot/maxCap + * @returns string + */ getBotCap(): string; + /** + * Handle singleplayer/settings/bot/getBotBehaviours + * @returns string + */ + getBotBehaviours(): string; } diff --git a/TypeScript/9RouterHooks/types/callbacks/CustomizationCallbacks.d.ts b/TypeScript/9RouterHooks/types/callbacks/CustomizationCallbacks.d.ts index 3bab8c0..75d5701 100644 --- a/TypeScript/9RouterHooks/types/callbacks/CustomizationCallbacks.d.ts +++ b/TypeScript/9RouterHooks/types/callbacks/CustomizationCallbacks.d.ts @@ -3,6 +3,7 @@ import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { IPmcData } from "../models/eft/common/IPmcData"; import { ISuit } from "../models/eft/common/tables/ITrader"; import { IBuyClothingRequestData } from "../models/eft/customization/IBuyClothingRequestData"; +import { IGetSuitsResponse } from "../models/eft/customization/IGetSuitsResponse"; import { IWearClothingRequestData } from "../models/eft/customization/IWearClothingRequestData"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; @@ -13,10 +14,15 @@ export declare class CustomizationCallbacks { protected saveServer: SaveServer; protected httpResponse: HttpResponseUtil; constructor(customizationController: CustomizationController, saveServer: SaveServer, httpResponse: HttpResponseUtil); - getSuits(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<{ - _id: string; - suites: string[]; - }>; + /** + * Handles client/trading/customization/storage + * @returns + */ + getSuits(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handles client/trading/customization + * @returns ISuit[] + */ getTraderSuits(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; wearClothing(pmcData: IPmcData, body: IWearClothingRequestData, sessionID: string): IItemEventRouterResponse; buyClothing(pmcData: IPmcData, body: IBuyClothingRequestData, sessionID: string): IItemEventRouterResponse; diff --git a/TypeScript/9RouterHooks/types/callbacks/DataCallbacks.d.ts b/TypeScript/9RouterHooks/types/callbacks/DataCallbacks.d.ts index 04566ff..2efcf81 100644 --- a/TypeScript/9RouterHooks/types/callbacks/DataCallbacks.d.ts +++ b/TypeScript/9RouterHooks/types/callbacks/DataCallbacks.d.ts @@ -12,15 +12,42 @@ import { ILanguageBase } from "../models/spt/server/ILocaleBase"; import { ISettingsBase } from "../models/spt/server/ISettingsBase"; import { DatabaseServer } from "../servers/DatabaseServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +/** + * Handle client requests + */ export declare class DataCallbacks { protected httpResponse: HttpResponseUtil; protected databaseServer: DatabaseServer; constructor(httpResponse: HttpResponseUtil, databaseServer: DatabaseServer); + /** + * Handles client/settings + * @returns ISettingsBase + */ getSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handles client/globals + * @returns IGlobals + */ getGlobals(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handles client/items + * @returns string + */ getTemplateItems(url: string, info: IEmptyRequestData, sessionID: string): string; + /** + * Handles client/handbook/templates + * @returns IHandbookBase + */ getTemplateHandbook(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handles client/customization + * @returns Record>; + /** + * Handles client/account/customization + * @returns string[] + */ getTemplateCharacter(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getTemplateQuests(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getHideoutSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; @@ -28,6 +55,6 @@ export declare class DataCallbacks { gethideoutProduction(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getHideoutScavcase(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getLocalesLanguages(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - getLocalesMenu(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + getLocalesMenu(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getLocalesGlobal(url: string, info: IEmptyRequestData, sessionID: string): string; } diff --git a/TypeScript/9RouterHooks/types/callbacks/DialogueCallbacks.d.ts b/TypeScript/9RouterHooks/types/callbacks/DialogueCallbacks.d.ts index 634f90b..7b2eeae 100644 --- a/TypeScript/9RouterHooks/types/callbacks/DialogueCallbacks.d.ts +++ b/TypeScript/9RouterHooks/types/callbacks/DialogueCallbacks.d.ts @@ -26,15 +26,27 @@ export declare class DialogueCallbacks extends OnUpdate { protected httpResponse: HttpResponseUtil; protected dialogueController: DialogueController; constructor(hashUtil: HashUtil, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, dialogueController: DialogueController); + /** + * Handles client/friend/list + * @returns IGetFriendListDataResponse + */ getFriendList(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handles client/chatServer/list + * @returns + */ getChatServerList(url: string, info: IGetChatServerListRequestData, sessionID: string): IGetBodyResponseData; getMailDialogList(url: string, info: IGetMailDialogListRequestData, sessionID: string): IGetBodyResponseData; getMailDialogView(url: string, info: IGetMailDialogViewRequestData, sessionID: string): IGetBodyResponseData; - getMailDialogInfo(url: string, info: IGetMailDialogInfoRequestData, sessionID: string): IGetBodyResponseData; + getMailDialogInfo(url: string, info: IGetMailDialogInfoRequestData, sessionID: string): IGetBodyResponseData; removeDialog(url: string, info: IRemoveDialogRequestData, sessionID: string): IGetBodyResponseData; pinDialog(url: string, info: IPinDialogRequestData, sessionID: string): IGetBodyResponseData; unpinDialog(url: string, info: IPinDialogRequestData, sessionID: string): IGetBodyResponseData; setRead(url: string, info: ISetDialogReadRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handles client/mail/dialog/getAllAttachments + * @returns IGetAllAttachmentsResponse + */ getAllAttachments(url: string, info: IGetAllAttachmentsRequestData, sessionID: string): IGetBodyResponseData; listOutbox(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; listInbox(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; diff --git a/TypeScript/9RouterHooks/types/callbacks/GameCallbacks.d.ts b/TypeScript/9RouterHooks/types/callbacks/GameCallbacks.d.ts index 5e4c240..3a6b7e6 100644 --- a/TypeScript/9RouterHooks/types/callbacks/GameCallbacks.d.ts +++ b/TypeScript/9RouterHooks/types/callbacks/GameCallbacks.d.ts @@ -3,6 +3,9 @@ import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { ICheckVersionResponse } from "../models/eft/game/ICheckVersionResponse"; import { IGameConfigResponse } from "../models/eft/game/IGameConfigResponse"; import { IGameEmptyCrcRequestData } from "../models/eft/game/IGameEmptyCrcRequestData"; +import { IGameKeepAliveResponse } from "../models/eft/game/IGameKeepAliveResponse"; +import { IGameLogoutResponseData } from "../models/eft/game/IGameLogoutResponseData"; +import { IGameStartResponse } from "../models/eft/game/IGameStartResponse"; import { IReportNicknameRequestData } from "../models/eft/game/IReportNicknameRequestData"; import { IServerDetails } from "../models/eft/game/IServerDetails"; import { IVersionValidateRequestData } from "../models/eft/game/IVersionValidateRequestData"; @@ -15,13 +18,37 @@ declare class GameCallbacks { protected watermark: Watermark; protected gameController: GameController; constructor(httpResponse: HttpResponseUtil, watermark: Watermark, gameController: GameController); + /** + * Handle client/game/version/validate + * @returns INullResponseData + */ versionValidate(url: string, info: IVersionValidateRequestData, sessionID: string): INullResponseData; - gameStart(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - gameLogout(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/game/start + * @returns IGameStartResponse + */ + gameStart(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/game/logout + * @returns IGameLogoutResponseData + */ + gameLogout(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/game/config + * @returns IGameConfigResponse + */ getGameConfig(url: string, info: IGameEmptyCrcRequestData, sessionID: string): IGetBodyResponseData; getServer(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; validateGameVersion(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - gameKeepalive(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/game/keepalive + * @returns IGameKeepAliveResponse + */ + gameKeepalive(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle singleplayer/settings/version + * @returns string + */ getVersion(url: string, info: IEmptyRequestData, sessionID: string): string; reportNickname(url: string, info: IReportNicknameRequestData, sessionID: string): INullResponseData; } diff --git a/TypeScript/9RouterHooks/types/callbacks/HealthCallbacks.d.ts b/TypeScript/9RouterHooks/types/callbacks/HealthCallbacks.d.ts index 8672be7..7edf03e 100644 --- a/TypeScript/9RouterHooks/types/callbacks/HealthCallbacks.d.ts +++ b/TypeScript/9RouterHooks/types/callbacks/HealthCallbacks.d.ts @@ -21,7 +21,19 @@ export declare class HealthCallbacks { * @returns empty response, no data sent back to client */ syncHealth(url: string, info: ISyncHealthRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle Eat + * @returns IItemEventRouterResponse + */ offraidEat(pmcData: IPmcData, body: IOffraidEatRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle Heal + * @returns IItemEventRouterResponse + */ offraidHeal(pmcData: IPmcData, body: IOffraidHealRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle RestoreHealth + * @returns IItemEventRouterResponse + */ healthTreatment(pmcData: IPmcData, info: IHealthTreatmentRequestData, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/9RouterHooks/types/callbacks/HideoutCallbacks.d.ts b/TypeScript/9RouterHooks/types/callbacks/HideoutCallbacks.d.ts index 99ab4c9..e39e806 100644 --- a/TypeScript/9RouterHooks/types/callbacks/HideoutCallbacks.d.ts +++ b/TypeScript/9RouterHooks/types/callbacks/HideoutCallbacks.d.ts @@ -19,14 +19,77 @@ export declare class HideoutCallbacks extends OnUpdate { protected hideoutConfig: IHideoutConfig; constructor(hideoutController: HideoutController, // TODO: delay needed configServer: ConfigServer); + /** + * Handle HideoutUpgrade + * @param pmcData + * @param body + * @param sessionID + * @returns + */ upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutUpgradeComplete + * @param pmcData + * @param body + * @param sessionID + * @returns + */ upgradeComplete(pmcData: IPmcData, body: IHideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutPutItemsInAreaSlots + * @param pmcData + * @param body + * @param sessionID + * @returns + */ putItemsInAreaSlots(pmcData: IPmcData, body: IHideoutPutItemInRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutTakeItemsFromAreaSlots + * @param pmcData + * @param body + * @param sessionID + * @returns + */ takeItemsFromAreaSlots(pmcData: IPmcData, body: IHideoutTakeItemOutRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutToggleArea + * @param pmcData + * @param body + * @param sessionID + * @returns + */ toggleArea(pmcData: IPmcData, body: IHideoutToggleAreaRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutSingleProductionStart + * @param pmcData + * @param body + * @param sessionID + * @returns + */ singleProductionStart(pmcData: IPmcData, body: IHideoutSingleProductionStartRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutScavCaseProductionStart + * @param pmcData + * @param body + * @param sessionID + * @returns + */ scavCaseProductionStart(pmcData: IPmcData, body: IHideoutScavCaseStartRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutContinuousProductionStart + * @param pmcData + * @param body + * @param sessionID + * @returns + */ continuousProductionStart(pmcData: IPmcData, body: IHideoutContinousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle HideoutTakeProduction + * @param pmcData + * @param body + * @param sessionID + * @returns + */ takeProduction(pmcData: IPmcData, body: IHideoutTakeProductionRequestData, sessionID: string): IItemEventRouterResponse; onUpdate(timeSinceLastRun: number): boolean; getRoute(): string; diff --git a/TypeScript/9RouterHooks/types/callbacks/InraidCallbacks.d.ts b/TypeScript/9RouterHooks/types/callbacks/InraidCallbacks.d.ts index 05bcce4..918bfaf 100644 --- a/TypeScript/9RouterHooks/types/callbacks/InraidCallbacks.d.ts +++ b/TypeScript/9RouterHooks/types/callbacks/InraidCallbacks.d.ts @@ -1,23 +1,49 @@ import { InraidController } from "../controllers/InraidController"; -import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { INullResponseData } from "../models/eft/httpResponse/INullResponseData"; import { IRegisterPlayerRequestData } from "../models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; -import { IAirdropConfig } from "../models/spt/config/IAirdropConfig"; -import { IInRaidConfig } from "../models/spt/config/IInRaidConfig"; -import { ConfigServer } from "../servers/ConfigServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +/** + * Handle client requests + */ export declare class InraidCallbacks { protected inraidController: InraidController; protected httpResponse: HttpResponseUtil; - protected configServer: ConfigServer; - protected airdropConfig: IAirdropConfig; - protected inraidConfig: IInRaidConfig; - constructor(inraidController: InraidController, httpResponse: HttpResponseUtil, configServer: ConfigServer); + constructor(inraidController: InraidController, httpResponse: HttpResponseUtil); + /** + * Handle client/location/getLocalloot + * @param url + * @param info register player request + * @param sessionID Session id + * @returns Null http response + */ registerPlayer(url: string, info: IRegisterPlayerRequestData, sessionID: string): INullResponseData; + /** + * Handle raid/profile/save + * @param url + * @param info Save progress request + * @param sessionID Session id + * @returns Null http response + */ saveProgress(url: string, info: ISaveProgressRequestData, sessionID: string): INullResponseData; + /** + * Handle singleplayer/settings/raid/endstate + * @returns + */ getRaidEndState(): string; - getRaidMenuSettings(url: string, info: IEmptyRequestData, sessionID: string): string; - getWeaponDurability(url: string, info: any, sessionID: string): string; - getAirdropConfig(url: string, info: any, sessionID: string): string; + /** + * Handle singleplayer/settings/raid/menu + * @returns JSON as string + */ + getRaidMenuSettings(): string; + /** + * Handle singleplayer/settings/weapon/durability + * @returns + */ + getWeaponDurability(): string; + /** + * Handle singleplayer/airdrop/config + * @returns JSON as string + */ + getAirdropConfig(): string; } diff --git a/TypeScript/9RouterHooks/types/callbacks/InsuranceCallbacks.d.ts b/TypeScript/9RouterHooks/types/callbacks/InsuranceCallbacks.d.ts index 8835ba2..a171e1c 100644 --- a/TypeScript/9RouterHooks/types/callbacks/InsuranceCallbacks.d.ts +++ b/TypeScript/9RouterHooks/types/callbacks/InsuranceCallbacks.d.ts @@ -17,7 +17,15 @@ export declare class InsuranceCallbacks extends OnUpdate { protected configServer: ConfigServer; protected insuranceConfig: IInsuranceConfig; constructor(insuranceController: InsuranceController, insuranceService: InsuranceService, httpResponse: HttpResponseUtil, configServer: ConfigServer); + /** + * Handle client/insurance/items/list/cost + * @returns IGetInsuranceCostResponseData + */ getInsuranceCost(url: string, info: IGetInsuranceCostRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle Insure + * @returns IItemEventRouterResponse + */ insure(pmcData: IPmcData, body: IInsureRequestData, sessionID: string): IItemEventRouterResponse; onUpdate(secondsSinceLastRun: number): boolean; getRoute(): string; diff --git a/TypeScript/9RouterHooks/types/callbacks/InventoryCallbacks.d.ts b/TypeScript/9RouterHooks/types/callbacks/InventoryCallbacks.d.ts index 9ab1486..46bf6fd 100644 --- a/TypeScript/9RouterHooks/types/callbacks/InventoryCallbacks.d.ts +++ b/TypeScript/9RouterHooks/types/callbacks/InventoryCallbacks.d.ts @@ -16,6 +16,7 @@ import { IInventorySwapRequestData } from "../models/eft/inventory/IInventorySwa import { IInventoryTagRequestData } from "../models/eft/inventory/IInventoryTagRequestData"; import { IInventoryToggleRequestData } from "../models/eft/inventory/IInventoryToggleRequestData"; import { IInventoryTransferRequestData } from "../models/eft/inventory/IInventoryTransferRequestData"; +import { IOpenRandomLootContainerRequestData } from "../models/eft/inventory/IOpenRandomLootContainerRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; export declare class InventoryCallbacks { protected inventoryController: InventoryController; @@ -36,4 +37,5 @@ export declare class InventoryCallbacks { createMapMarker(pmcData: IPmcData, body: IInventoryCreateMarkerRequestData, sessionID: string): IItemEventRouterResponse; deleteMapMarker(pmcData: IPmcData, body: IInventoryDeleteMarkerRequestData, sessionID: string): IItemEventRouterResponse; editMapMarker(pmcData: IPmcData, body: IInventoryEditMarkerRequestData, sessionID: string): IItemEventRouterResponse; + openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/9RouterHooks/types/callbacks/ItemEventCallbacks.d.ts b/TypeScript/9RouterHooks/types/callbacks/ItemEventCallbacks.d.ts index f4f04f9..fbb0b5f 100644 --- a/TypeScript/9RouterHooks/types/callbacks/ItemEventCallbacks.d.ts +++ b/TypeScript/9RouterHooks/types/callbacks/ItemEventCallbacks.d.ts @@ -1,4 +1,5 @@ import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; +import { Warning } from "../models/eft/itemEvent/IItemEventRouterBase"; import { IItemEventRouterRequest } from "../models/eft/itemEvent/IItemEventRouterRequest"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { ItemEventRouter } from "../routers/ItemEventRouter"; @@ -8,4 +9,5 @@ export declare class ItemEventCallbacks { protected itemEventRouter: ItemEventRouter; constructor(httpResponse: HttpResponseUtil, itemEventRouter: ItemEventRouter); handleEvents(url: string, info: IItemEventRouterRequest, sessionID: string): IGetBodyResponseData; + protected getErrorCode(warnings: Warning[]): number; } diff --git a/TypeScript/9RouterHooks/types/callbacks/MatchCallbacks.d.ts b/TypeScript/9RouterHooks/types/callbacks/MatchCallbacks.d.ts index 2a92ef5..10fbc44 100644 --- a/TypeScript/9RouterHooks/types/callbacks/MatchCallbacks.d.ts +++ b/TypeScript/9RouterHooks/types/callbacks/MatchCallbacks.d.ts @@ -34,6 +34,10 @@ export declare class MatchCallbacks { serverAvailable(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData | IGetBodyResponseData; joinMatch(url: string, info: IJoinMatchRequestData, sessionID: string): IGetBodyResponseData; getMetrics(url: string, info: any, sessionID: string): IGetBodyResponseData; + /** + * Handle client/match/group/status + * @returns + */ getGroupStatus(url: string, info: IGetGroupStatusRequestData, sessionID: string): IGetBodyResponseData; createGroup(url: string, info: ICreateGroupRequestData, sessionID: string): IGetBodyResponseData; deleteGroup(url: string, info: any, sessionID: string): INullResponseData; diff --git a/TypeScript/9RouterHooks/types/callbacks/NotifierCallbacks.d.ts b/TypeScript/9RouterHooks/types/callbacks/NotifierCallbacks.d.ts index c42058f..fab325b 100644 --- a/TypeScript/9RouterHooks/types/callbacks/NotifierCallbacks.d.ts +++ b/TypeScript/9RouterHooks/types/callbacks/NotifierCallbacks.d.ts @@ -4,6 +4,7 @@ import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { INotifierChannel } from "../models/eft/notifier/INotifier"; import { ISelectProfileRequestData } from "../models/eft/notifier/ISelectProfileRequestData"; +import { ISelectProfileResponse } from "../models/eft/notifier/ISelectProfileResponse"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; export declare class NotifierCallbacks { protected httpServerHelper: HttpServerHelper; @@ -19,6 +20,10 @@ export declare class NotifierCallbacks { sendNotification(sessionID: string, req: any, resp: any, data: any): void; getNotifier(url: string, info: any, sessionID: string): IGetBodyResponseData; createNotifierChannel(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; - selectProfile(url: string, info: ISelectProfileRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/game/profile/select + * @returns ISelectProfileResponse + */ + selectProfile(url: string, info: ISelectProfileRequestData, sessionID: string): IGetBodyResponseData; notify(url: string, info: any, sessionID: string): string; } diff --git a/TypeScript/9RouterHooks/types/callbacks/QuestCallbacks.d.ts b/TypeScript/9RouterHooks/types/callbacks/QuestCallbacks.d.ts index 559c29e..2a3eb20 100644 --- a/TypeScript/9RouterHooks/types/callbacks/QuestCallbacks.d.ts +++ b/TypeScript/9RouterHooks/types/callbacks/QuestCallbacks.d.ts @@ -21,6 +21,13 @@ export declare class QuestCallbacks { acceptQuest(pmcData: IPmcData, body: IAcceptQuestRequestData, sessionID: string): IItemEventRouterResponse; completeQuest(pmcData: IPmcData, body: ICompleteQuestRequestData, sessionID: string): IItemEventRouterResponse; handoverQuest(pmcData: IPmcData, body: IHandoverQuestRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle client/quest/list + * @param url + * @param info + * @param sessionID + * @returns + */ listQuests(url: string, info: IListQuestsRequestData, sessionID: string): IGetBodyResponseData; activityPeriods(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; } diff --git a/TypeScript/9RouterHooks/types/callbacks/RagfairCallbacks.d.ts b/TypeScript/9RouterHooks/types/callbacks/RagfairCallbacks.d.ts index c609f2f..37f3807 100644 --- a/TypeScript/9RouterHooks/types/callbacks/RagfairCallbacks.d.ts +++ b/TypeScript/9RouterHooks/types/callbacks/RagfairCallbacks.d.ts @@ -35,7 +35,7 @@ export declare class RagfairCallbacks extends OnLoadOnUpdate { getRoute(): string; search(url: string, info: ISearchRequestData, sessionID: string): IGetBodyResponseData; getMarketPrice(url: string, info: IGetMarketPriceRequestData, sessionID: string): IGetBodyResponseData; - getItemPrices(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + getItemPrices(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData>; addOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; removeOffer(pmcData: IPmcData, info: IRemoveOfferRequestData, sessionID: string): IItemEventRouterResponse; extendOffer(pmcData: IPmcData, info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse; diff --git a/TypeScript/9RouterHooks/types/callbacks/TraderCallbacks.d.ts b/TypeScript/9RouterHooks/types/callbacks/TraderCallbacks.d.ts index e4fd099..40a1455 100644 --- a/TypeScript/9RouterHooks/types/callbacks/TraderCallbacks.d.ts +++ b/TypeScript/9RouterHooks/types/callbacks/TraderCallbacks.d.ts @@ -12,6 +12,10 @@ export declare class TraderCallbacks extends OnLoadOnUpdate { onUpdate(): boolean; getRoute(): string; getTraderSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/trading/api/getUserAssortPrice/trader + * @returns + */ getProfilePurchases(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData>; getTrader(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; getAssort(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; diff --git a/TypeScript/9RouterHooks/types/callbacks/WeatherCallbacks.d.ts b/TypeScript/9RouterHooks/types/callbacks/WeatherCallbacks.d.ts index ae784c8..f9d2002 100644 --- a/TypeScript/9RouterHooks/types/callbacks/WeatherCallbacks.d.ts +++ b/TypeScript/9RouterHooks/types/callbacks/WeatherCallbacks.d.ts @@ -1,10 +1,15 @@ import { WeatherController } from "../controllers/WeatherController"; import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; +import { IWeatherData } from "../models/eft/weather/IWeatherData"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; export declare class WeatherCallbacks { protected httpResponse: HttpResponseUtil; protected weatherController: WeatherController; constructor(httpResponse: HttpResponseUtil, weatherController: WeatherController); - getWeather(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; + /** + * Handle client/weather + * @returns IWeatherData + */ + getWeather(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData; } diff --git a/TypeScript/9RouterHooks/types/context/ContextVariableType.d.ts b/TypeScript/9RouterHooks/types/context/ContextVariableType.d.ts index 5fc1704..a7dd9b5 100644 --- a/TypeScript/9RouterHooks/types/context/ContextVariableType.d.ts +++ b/TypeScript/9RouterHooks/types/context/ContextVariableType.d.ts @@ -1,4 +1,8 @@ export declare enum ContextVariableType { + /** Logged in users session id */ SESSION_ID = 0, - MATCH_INFO = 1 + /** Currently acive raid information */ + MATCH_INFO = 1, + /** Timestamp when client first connected */ + CLIENT_START_TIMESTAMP = 2 } diff --git a/TypeScript/9RouterHooks/types/controllers/BotController.d.ts b/TypeScript/9RouterHooks/types/controllers/BotController.d.ts index a5111d5..92317c3 100644 --- a/TypeScript/9RouterHooks/types/controllers/BotController.d.ts +++ b/TypeScript/9RouterHooks/types/controllers/BotController.d.ts @@ -1,6 +1,8 @@ import { ApplicationContext } from "../context/ApplicationContext"; import { BotGenerator } from "../generators/BotGenerator"; +import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { IGenerateBotsRequestData } from "../models/eft/bot/IGenerateBotsRequestData"; import { IBotBase } from "../models/eft/common/tables/IBotBase"; import { IBotCore } from "../models/eft/common/tables/IBotCore"; @@ -10,18 +12,23 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; -import { PmcAiService } from "../services/PmcAiService"; +import { LocalisationService } from "../services/LocalisationService"; +import { JsonUtil } from "../utils/JsonUtil"; export declare class BotController { protected logger: ILogger; protected databaseServer: DatabaseServer; protected botGenerator: BotGenerator; protected botHelper: BotHelper; - protected pmcAiService: PmcAiService; + protected botDifficultyHelper: BotDifficultyHelper; protected botGenerationCacheService: BotGenerationCacheService; + protected localisationService: LocalisationService; + protected weightedRandomHelper: WeightedRandomHelper; protected configServer: ConfigServer; protected applicationContext: ApplicationContext; + protected jsonUtil: JsonUtil; protected botConfig: IBotConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, pmcAiService: PmcAiService, botGenerationCacheService: BotGenerationCacheService, configServer: ConfigServer, applicationContext: ApplicationContext); + static readonly pmcTypeLabel = "PMC"; + constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, localisationService: LocalisationService, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil); /** * Return the number of bot loadout varieties to be generated * @param type bot Type we want the loadout gen count for @@ -37,7 +44,6 @@ export declare class BotController { * @returns Difficulty object */ getBotDifficulty(type: string, difficulty: string): Difficulty; - protected getPmcDifficultySettings(pmcType: "bear" | "usec", difficulty: string, usecType: string, bearType: string): Difficulty; /** * Generate bot profiles and store in cache * @param sessionId Session id @@ -51,4 +57,5 @@ export declare class BotController { * @returns cap number */ getBotCap(): number; + getPmcBotTypes(): Record>>; } diff --git a/TypeScript/9RouterHooks/types/controllers/DialogueController.d.ts b/TypeScript/9RouterHooks/types/controllers/DialogueController.d.ts index 1b72522..9c8b728 100644 --- a/TypeScript/9RouterHooks/types/controllers/DialogueController.d.ts +++ b/TypeScript/9RouterHooks/types/controllers/DialogueController.d.ts @@ -23,7 +23,7 @@ export declare class DialogueController { * Get the content of a dialogue * @param dialogueID Dialog id * @param sessionID Session Id - * @returns + * @returns DialogueInfo */ getDialogueInfo(dialogueID: string, sessionID: string): DialogueInfo; /** diff --git a/TypeScript/9RouterHooks/types/controllers/GameController.d.ts b/TypeScript/9RouterHooks/types/controllers/GameController.d.ts index 3bfbdb1..f4f5849 100644 --- a/TypeScript/9RouterHooks/types/controllers/GameController.d.ts +++ b/TypeScript/9RouterHooks/types/controllers/GameController.d.ts @@ -1,3 +1,4 @@ +import { ApplicationContext } from "../context/ApplicationContext"; import { GameEventHelper } from "../helpers/GameEventHelper"; import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; @@ -14,6 +15,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { LocaleService } from "../services/LocaleService"; +import { LocalisationService } from "../services/LocalisationService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { Watermark } from "../utils/Watermark"; export declare class GameController { @@ -24,14 +26,33 @@ export declare class GameController { protected localeService: LocaleService; protected profileHelper: ProfileHelper; protected profileFixerService: ProfileFixerService; + protected localisationService: LocalisationService; protected gameEventHelper: GameEventHelper; + protected applicationContext: ApplicationContext; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; protected coreConfig: ICoreConfig; - constructor(logger: ILogger, databaseServer: DatabaseServer, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, gameEventHelper: GameEventHelper, configServer: ConfigServer); - gameStart(_url: string, _info: IEmptyRequestData, sessionID: string): void; + constructor(logger: ILogger, databaseServer: DatabaseServer, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, gameEventHelper: GameEventHelper, applicationContext: ApplicationContext, configServer: ConfigServer); + gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void; + /** + * Check if current date falls inside any of the seasons events pased in, if so, handle them + * @param seasonalEvents events to check for + */ protected checkForAndEnableSeasonalEvents(seasonalEvents: ISeasonalEvent[]): void; + /** + * Make adjusted to server code based on the name of the event passed in + * @param globalConfig globals.json + * @param eventName Name of the event to enable. e.g. Christmas + */ protected updateGlobalEvents(globalConfig: Config, eventName: string): void; + /** + * Read in data from seasonalEvents.json and add found equipment items to bots + * @param eventName Name of the event to read equipment in from config + */ + protected addEventGearToScavs(eventName: string): void; + /** + * Set Khorovod(dancing tree) chance to 100% on all maps that support it + */ protected enableDancingTree(): void; /** * Make non-trigger-spawned raiders spawn earlier + always @@ -40,5 +61,6 @@ export declare class GameController { protected logProfileDetails(fullProfile: IAkiProfile): void; getGameConfig(sessionID: string): IGameConfigResponse; getServer(): IServerDetails[]; + protected addPumpkinsToScavBackpacks(): void; getValidGameVersion(): ICheckVersionResponse; } diff --git a/TypeScript/9RouterHooks/types/controllers/HideoutController.d.ts b/TypeScript/9RouterHooks/types/controllers/HideoutController.d.ts index ada5bd9..5b6507b 100644 --- a/TypeScript/9RouterHooks/types/controllers/HideoutController.d.ts +++ b/TypeScript/9RouterHooks/types/controllers/HideoutController.d.ts @@ -23,12 +23,13 @@ import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; import { PlayerService } from "../services/PlayerService"; import { HashUtil } from "../utils/HashUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; -import { JsonUtil } from "../utils/JsonUtil"; export declare class HideoutController { protected logger: ILogger; protected hashUtil: HashUtil; @@ -45,11 +46,12 @@ export declare class HideoutController { protected profileHelper: ProfileHelper; protected hideoutHelper: HideoutHelper; protected scavCaseRewardGenerator: ScavCaseRewardGenerator; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected jsonUtil: JsonUtil; protected static nameBackendCountersCrafting: string; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, configServer: ConfigServer, jsonUtil: JsonUtil); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, localisationService: LocalisationService, configServer: ConfigServer, jsonUtil: JsonUtil); upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse; upgradeComplete(pmcData: IPmcData, body: HideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse; /** diff --git a/TypeScript/9RouterHooks/types/controllers/InraidController.d.ts b/TypeScript/9RouterHooks/types/controllers/InraidController.d.ts index e84eea1..39a6396 100644 --- a/TypeScript/9RouterHooks/types/controllers/InraidController.d.ts +++ b/TypeScript/9RouterHooks/types/controllers/InraidController.d.ts @@ -6,6 +6,7 @@ import { ProfileHelper } from "../helpers/ProfileHelper"; import { QuestHelper } from "../helpers/QuestHelper"; import { TraderHelper } from "../helpers/TraderHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; +import { Item } from "../models/eft/common/tables/IItem"; import { IRegisterPlayerRequestData } from "../models/eft/inRaid/IRegisterPlayerRequestData"; import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData"; import { IAirdropConfig } from "../models/spt/config/IAirdropConfig"; @@ -17,6 +18,9 @@ import { SaveServer } from "../servers/SaveServer"; import { InsuranceService } from "../services/InsuranceService"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; +/** + * Logic for handling In Raid callbacks + */ export declare class InraidController { protected logger: ILogger; protected saveServer: SaveServer; @@ -35,14 +39,42 @@ export declare class InraidController { protected airdropConfig: IAirdropConfig; protected inraidConfig: IInRaidConfig; 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 + * Save locationid to active profiles inraid object + * @param sessionID Session id + * @param info Register player request + */ + addPlayer(sessionID: string, info: IRegisterPlayerRequestData): void; + /** + * Save profile state to disk + * Handles pmc/pscav + * @param offraidData post-raid request data + * @param sessionID Session id + */ + savePostRaidProgress(offraidData: ISaveProgressRequestData, sessionID: string): void; + /** + * Handle updating player profile post-pmc raid * @param sessionID session id - * @param offraidData post-raid data of raid + * @param offraidData post-raid data */ protected savePmcProgress(sessionID: string, offraidData: ISaveProgressRequestData): void; + /** + * Make changes to pmc profile after they left raid dead, + * alter bodypart hp, handle insurance, delete inventory items, remove carried quest items + * @param postRaidSaveRequest post-raid save request + * @param pmcData pmc profile + * @param insuranceEnabled is insurance enabled + * @param preRaidGear gear player had before raid + * @param sessionID Session id + * @returns Updated profile object + */ + protected performPostRaidActionsWhenDead(postRaidSaveRequest: ISaveProgressRequestData, pmcData: IPmcData, insuranceEnabled: boolean, preRaidGear: Item[], sessionID: string): IPmcData; + /** + * Adjust player characters bodypart hp if they left raid early + * @param postRaidSaveRequest post raid data + * @param pmcData player profile + */ + protected updatePmcHealthPostRaid(postRaidSaveRequest: ISaveProgressRequestData, pmcData: IPmcData): void; /** * Reduce body part hp to % of max * @param pmcData profile to edit @@ -68,7 +100,31 @@ export declare class InraidController { * @param isPlayerScav Was the player a pScav */ protected markOrRemoveFoundInRaidItems(offraidData: ISaveProgressRequestData, pmcData: IPmcData, isPlayerScav: boolean): void; + /** + * Update profile after player completes scav raid + * @param scavData Scav profile + * @param sessionID Session id + * @param offraidData Post-raid save request + * @param pmcData Pmc profile + * @param isDead Is player dead + */ protected handlePostRaidPlayerScavProcess(scavData: IPmcData, sessionID: string, offraidData: ISaveProgressRequestData, pmcData: IPmcData, isDead: boolean): void; + /** + * Update profile with scav karma values based on in-raid actions + * @param pmcData Pmc profile + * @param offraidData Post-raid save request + * @param scavData Scav profile + * @param sessionID Session id + */ protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData, scavData: IPmcData, sessionID: string): void; + /** + * Get the inraid config from configs/inraid.json + * @returns InRaid Config + */ + getInraidConfig(): IInRaidConfig; + /** + * Get airdrop config from configs/airdrop.json + * @returns Airdrop config + */ getAirdropConfig(): IAirdropConfig; } diff --git a/TypeScript/9RouterHooks/types/controllers/InsuranceController.d.ts b/TypeScript/9RouterHooks/types/controllers/InsuranceController.d.ts index 14bf129..54f31b5 100644 --- a/TypeScript/9RouterHooks/types/controllers/InsuranceController.d.ts +++ b/TypeScript/9RouterHooks/types/controllers/InsuranceController.d.ts @@ -30,8 +30,7 @@ export declare class InsuranceController { protected insuranceService: InsuranceService; protected configServer: ConfigServer; protected insuranceConfig: IInsuranceConfig; - constructor(logger: ILogger, randomUtil: RandomUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, paymentService: PaymentService, // TODO: delay required - insuranceService: InsuranceService, configServer: ConfigServer); + constructor(logger: ILogger, randomUtil: RandomUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, paymentService: PaymentService, insuranceService: InsuranceService, configServer: ConfigServer); processReturn(): void; insure(pmcData: IPmcData, body: IInsureRequestData, sessionID: string): IItemEventRouterResponse; /** diff --git a/TypeScript/9RouterHooks/types/controllers/InventoryController.d.ts b/TypeScript/9RouterHooks/types/controllers/InventoryController.d.ts index 6a1a21e..e1c08c0 100644 --- a/TypeScript/9RouterHooks/types/controllers/InventoryController.d.ts +++ b/TypeScript/9RouterHooks/types/controllers/InventoryController.d.ts @@ -1,8 +1,8 @@ -import { EventOutputHolder } from "../routers/EventOutputHolder"; import { InventoryHelper } from "../helpers/InventoryHelper"; import { PaymentHelper } from "../helpers/PaymentHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { IPmcData } from "../models/eft/common/IPmcData"; import { IAddItemRequestData } from "../models/eft/inventory/IAddItemRequestData"; import { IInventoryBindRequestData } from "../models/eft/inventory/IInventoryBindRequestData"; @@ -21,33 +21,46 @@ import { IInventorySwapRequestData } from "../models/eft/inventory/IInventorySwa import { IInventoryTagRequestData } from "../models/eft/inventory/IInventoryTagRequestData"; import { IInventoryToggleRequestData } from "../models/eft/inventory/IInventoryToggleRequestData"; import { IInventoryTransferRequestData } from "../models/eft/inventory/IInventoryTransferRequestData"; +import { IOpenRandomLootContainerRequestData } from "../models/eft/inventory/IOpenRandomLootContainerRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; import { ILogger } from "../models/spt/utils/ILogger"; +import { EventOutputHolder } from "../routers/EventOutputHolder"; import { DatabaseServer } from "../servers/DatabaseServer"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { HashUtil } from "../utils/HashUtil"; +import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { JsonUtil } from "../utils/JsonUtil"; +import { RandomUtil } from "../utils/RandomUtil"; export declare class InventoryController { protected logger: ILogger; protected hashUtil: HashUtil; protected jsonUtil: JsonUtil; + protected randomUtil: RandomUtil; protected databaseServer: DatabaseServer; protected fenceService: FenceService; protected presetHelper: PresetHelper; protected inventoryHelper: InventoryHelper; protected ragfairOfferService: RagfairOfferService; protected profileHelper: ProfileHelper; + protected weightedRandomHelper: WeightedRandomHelper; protected paymentHelper: PaymentHelper; + protected localisationService: LocalisationService; protected eventOutputHolder: EventOutputHolder; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder); + protected httpResponseUtil: HttpResponseUtil; + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, weightedRandomHelper: WeightedRandomHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil); /** * Move Item * change location of item with parentId and slotId * transfers items from one profile to another if fromOwner/toOwner is set in the body. * otherwise, move is contained within the same profile_f. - */ - moveItem(pmcData: IPmcData, body: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; + * @param pmcData Profile + * @param moveRequest Move request data + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ + moveItem(pmcData: IPmcData, moveRequest: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse; /** * Remove Item from Profile * Deep tree item deletion, also removes items from insurance list @@ -122,4 +135,12 @@ export declare class InventoryController { createMapMarker(pmcData: IPmcData, body: IInventoryCreateMarkerRequestData, sessionID: string): IItemEventRouterResponse; deleteMapMarker(pmcData: IPmcData, body: IInventoryDeleteMarkerRequestData, sessionID: string): IItemEventRouterResponse; editMapMarker(pmcData: IPmcData, body: IInventoryEditMarkerRequestData, sessionID: string): IItemEventRouterResponse; + /** + * Handle event fired when a container is unpacked (currently only the halloween pumpkin) + * @param pmcData Profile data + * @param body open loot container request data + * @param sessionID Session id + * @returns IItemEventRouterResponse + */ + openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string): IItemEventRouterResponse; } diff --git a/TypeScript/9RouterHooks/types/controllers/LocationController.d.ts b/TypeScript/9RouterHooks/types/controllers/LocationController.d.ts index 9db3205..b6feba8 100644 --- a/TypeScript/9RouterHooks/types/controllers/LocationController.d.ts +++ b/TypeScript/9RouterHooks/types/controllers/LocationController.d.ts @@ -7,6 +7,7 @@ import { LootItem } from "../models/spt/services/LootItem"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -15,12 +16,13 @@ export declare class LocationController { protected hashUtil: HashUtil; protected logger: ILogger; protected locationGenerator: LocationGenerator; + protected localisationService: LocalisationService; protected lootGenerator: LootGenerator; protected databaseServer: DatabaseServer; protected timeUtil: TimeUtil; protected configServer: ConfigServer; protected airdropConfig: IAirdropConfig; - constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, logger: ILogger, locationGenerator: LocationGenerator, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer); + constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer); get(location: string): ILocationBase; generate(name: string): ILocationBase; generateAll(): ILocationsGenerateAllResponse; diff --git a/TypeScript/9RouterHooks/types/controllers/MatchController.d.ts b/TypeScript/9RouterHooks/types/controllers/MatchController.d.ts index dac6a3f..2b0d150 100644 --- a/TypeScript/9RouterHooks/types/controllers/MatchController.d.ts +++ b/TypeScript/9RouterHooks/types/controllers/MatchController.d.ts @@ -19,7 +19,6 @@ import { SaveServer } from "../servers/SaveServer"; import { BotGenerationCacheService } from "../services/BotGenerationCacheService"; import { BotLootCacheService } from "../services/BotLootCacheService"; import { MatchLocationService } from "../services/MatchLocationService"; -import { PmcAiService } from "../services/PmcAiService"; import { ProfileSnapshotService } from "../services/ProfileSnapshotService"; export declare class MatchController { protected logger: ILogger; @@ -30,13 +29,12 @@ export declare class MatchController { protected botLootCacheService: BotLootCacheService; protected configServer: ConfigServer; protected profileSnapshotService: ProfileSnapshotService; - protected pmcAiService: PmcAiService; protected botGenerationCacheService: BotGenerationCacheService; 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, pmcAiService: PmcAiService, botGenerationCacheService: BotGenerationCacheService, applicationContext: ApplicationContext); + constructor(logger: ILogger, saveServer: SaveServer, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, botGenerationCacheService: BotGenerationCacheService, applicationContext: ApplicationContext); getEnabled(): boolean; getProfile(info: IGetProfileRequestData): IPmcData[]; createGroup(sessionID: string, info: ICreateGroupRequestData): any; diff --git a/TypeScript/9RouterHooks/types/controllers/RagfairController.d.ts b/TypeScript/9RouterHooks/types/controllers/RagfairController.d.ts index 5440458..95702f2 100644 --- a/TypeScript/9RouterHooks/types/controllers/RagfairController.d.ts +++ b/TypeScript/9RouterHooks/types/controllers/RagfairController.d.ts @@ -29,6 +29,7 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { RagfairServer } from "../servers/RagfairServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocalisationService } from "../services/LocalisationService"; import { PaymentService } from "../services/PaymentService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { RagfairPriceService } from "../services/RagfairPriceService"; @@ -62,9 +63,10 @@ export declare class RagfairController { protected ragfairOfferService: RagfairOfferService; protected ragfairRequiredItemsService: RagfairRequiredItemsService; protected ragfairOfferGenerator: RagfairOfferGenerator; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, eventOutputHolder: EventOutputHolder, ragfairServer: RagfairServer, ragfairPriceService: RagfairPriceService, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer, ragfairSellHelper: RagfairSellHelper, ragfairTaxHelper: RagfairTaxHelper, ragfairSortHelper: RagfairSortHelper, ragfairOfferHelper: RagfairOfferHelper, profileHelper: ProfileHelper, paymentService: PaymentService, handbookHelper: HandbookHelper, paymentHelper: PaymentHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, ragfairOfferGenerator: RagfairOfferGenerator, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, eventOutputHolder: EventOutputHolder, ragfairServer: RagfairServer, ragfairPriceService: RagfairPriceService, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer, ragfairSellHelper: RagfairSellHelper, ragfairTaxHelper: RagfairTaxHelper, ragfairSortHelper: RagfairSortHelper, ragfairOfferHelper: RagfairOfferHelper, profileHelper: ProfileHelper, paymentService: PaymentService, handbookHelper: HandbookHelper, paymentHelper: PaymentHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, ragfairOfferGenerator: RagfairOfferGenerator, localisationService: LocalisationService, configServer: ConfigServer); getOffers(sessionID: string, info: ISearchRequestData): IGetOffersResult; /** * Get offers for the client based on type of search being performed @@ -103,7 +105,12 @@ export declare class RagfairController { protected isLinkedSearch(info: ISearchRequestData): boolean; protected isRequiredSearch(info: ISearchRequestData): boolean; update(): void; - getItemPrice(info: IGetMarketPriceRequestData): IGetItemPriceResult; + /** + * Called when creating an offer on flea, fills values in top right corner + * @param getPriceRequest + * @returns min/avg/max values for an item based on flea offers available + */ + getItemMinAvgMaxFleaPriceValues(getPriceRequest: IGetMarketPriceRequestData): IGetItemPriceResult; addPlayerOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse; createPlayerOffer(profile: IAkiProfile, requirements: Requirement[], items: Item[], sellInOnePiece: boolean, amountToSend: number): IRagfairOffer; getAllFleaPrices(): Record; diff --git a/TypeScript/9RouterHooks/types/controllers/RepeatableQuestController.d.ts b/TypeScript/9RouterHooks/types/controllers/RepeatableQuestController.d.ts index 7db5886..333583b 100644 --- a/TypeScript/9RouterHooks/types/controllers/RepeatableQuestController.d.ts +++ b/TypeScript/9RouterHooks/types/controllers/RepeatableQuestController.d.ts @@ -17,6 +17,7 @@ import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { ItemFilterService } from "../services/ItemFilterService"; +import { LocalisationService } from "../services/LocalisationService"; import { PaymentService } from "../services/PaymentService"; import { ProfileFixerService } from "../services/ProfileFixerService"; import { JsonUtil } from "../utils/JsonUtil"; @@ -64,12 +65,13 @@ export declare class RepeatableQuestController { protected profileFixerService: ProfileFixerService; protected ragfairServerHelper: RagfairServerHelper; protected eventOutputHolder: EventOutputHolder; + protected localisationService: LocalisationService; protected paymentService: PaymentService; protected objectId: ObjectId; protected itemFilterService: ItemFilterService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); + constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, configServer: ConfigServer); /** * This is the method reached by the /client/repeatalbeQuests/activityPeriods endpoint * Returns an array of objects in the format of repeatable quests to the client. diff --git a/TypeScript/9RouterHooks/types/controllers/WeatherController.d.ts b/TypeScript/9RouterHooks/types/controllers/WeatherController.d.ts index ca7f5eb..631a90c 100644 --- a/TypeScript/9RouterHooks/types/controllers/WeatherController.d.ts +++ b/TypeScript/9RouterHooks/types/controllers/WeatherController.d.ts @@ -1,11 +1,18 @@ import { WeatherGenerator } from "../generators/WeatherGenerator"; import { IWeatherData } from "../models/eft/weather/IWeatherData"; import { IWeatherConfig } from "../models/spt/config/IWeatherConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; export declare class WeatherController { protected weatherGenerator: WeatherGenerator; + protected logger: ILogger; protected configServer: ConfigServer; protected weatherConfig: IWeatherConfig; - constructor(weatherGenerator: WeatherGenerator, configServer: ConfigServer); + constructor(weatherGenerator: WeatherGenerator, logger: ILogger, configServer: ConfigServer); generate(): IWeatherData; + /** + * Get the current in-raid time (MUST HAVE PLAYER LOGGED INTO CLIENT TO WORK) + * @returns Date object + */ + getCurrentInRaidTime(): Date; } diff --git a/TypeScript/9RouterHooks/types/generators/BotGenerator.d.ts b/TypeScript/9RouterHooks/types/generators/BotGenerator.d.ts index 2ac51db..a1ac9ed 100644 --- a/TypeScript/9RouterHooks/types/generators/BotGenerator.d.ts +++ b/TypeScript/9RouterHooks/types/generators/BotGenerator.d.ts @@ -1,7 +1,8 @@ +import { BotDifficultyHelper } from "../helpers/BotDifficultyHelper"; import { BotHelper } from "../helpers/BotHelper"; import { GameEventHelper } from "../helpers/GameEventHelper"; import { ProfileHelper } from "../helpers/ProfileHelper"; -import { IGenerateBotsRequestData } from "../models/eft/bot/IGenerateBotsRequestData"; +import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; import { Health as PmcHealth, IBotBase, Skills } from "../models/eft/common/tables/IBotBase"; import { Health, IBotType, Inventory } from "../models/eft/common/tables/IBotType"; import { IBotConfig } from "../models/spt/config/IBotConfig"; @@ -9,7 +10,6 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; -import { PmcAiService } from "../services/PmcAiService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; @@ -29,12 +29,13 @@ export declare class BotGenerator { protected databaseServer: DatabaseServer; protected botInventoryGenerator: BotInventoryGenerator; protected botEquipmentFilterService: BotEquipmentFilterService; + protected weightedRandomHelper: WeightedRandomHelper; protected botHelper: BotHelper; + protected botDifficultyHelper: BotDifficultyHelper; protected gameEventHelper: GameEventHelper; - protected pmcAiService: PmcAiService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botEquipmentFilterService: BotEquipmentFilterService, botHelper: BotHelper, gameEventHelper: GameEventHelper, pmcAiService: PmcAiService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, databaseServer: DatabaseServer, botInventoryGenerator: BotInventoryGenerator, botEquipmentFilterService: BotEquipmentFilterService, weightedRandomHelper: WeightedRandomHelper, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, gameEventHelper: GameEventHelper, configServer: ConfigServer); /** * Generate a player scav bot object * @param role e.g. assault / pmcbot @@ -44,12 +45,18 @@ export declare class BotGenerator { */ generatePlayerScav(sessionId: string, role: string, difficulty: string, botTemplate: IBotType): IBotBase; /** - * Generate an array of bot objects for populate a raid with + * Generate an array of bot objects based on a condition for a raid with * @param sessionId session id - * @param info request object + * @param condition request condition * @returns bot array */ - generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[]; + generateByCondition(sessionId: string, botCountToGenerate: number, difficulty: string, role: string, isPmc: boolean): IBotBase[]; + /** + * Get the PMCs wildSpawnType value + * @param role "usec" / "bear" + * @returns wildSpawnType value as string + */ + protected getPmcRoleByDescription(role: string): string; /** * Get a randomised PMC side based on bot config value 'isUsec' * @returns pmc side as string @@ -64,13 +71,13 @@ export declare class BotGenerator { * Create a IBotBase object with equipment/loot/exp etc * @param sessionId Session id * @param bot bots base file - * @param role botRole bot will use + * @param botRole Role bot will use (bear/usec for PMCs) * @param node Bot template from db/bots/x.json * @param isPmc Is bot to be a PMC * @param isPlayerScav is bot to be a p scav bot * @returns IBotBase object */ - protected generateBot(sessionId: string, bot: IBotBase, role: string, node: IBotType, isPmc: boolean, isPlayerScav?: boolean): IBotBase; + protected generateBot(sessionId: string, bot: IBotBase, botRole: string, node: IBotType, isPmc: boolean, isPlayerScav?: boolean): IBotBase; /** * Log the number of PMCs generated to the debug console * @param output Generated bot array, ready to send to client diff --git a/TypeScript/9RouterHooks/types/generators/BotInventoryGenerator.d.ts b/TypeScript/9RouterHooks/types/generators/BotInventoryGenerator.d.ts index c5ed545..e1efaf2 100644 --- a/TypeScript/9RouterHooks/types/generators/BotInventoryGenerator.d.ts +++ b/TypeScript/9RouterHooks/types/generators/BotInventoryGenerator.d.ts @@ -7,6 +7,7 @@ import { IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { BotLootGenerator } from "./BotLootGenerator"; @@ -20,14 +21,68 @@ export declare class BotInventoryGenerator { protected botLootGenerator: BotLootGenerator; protected botGeneratorHelper: BotGeneratorHelper; protected weightedRandomHelper: WeightedRandomHelper; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, configServer: ConfigServer); + /** + * Add equipment/weapons/loot to bot + * @param sessionId Session id + * @param templateInventory bot/x.json data from db + * @param equipmentChances Chances each item will be added to bot + * @param itemGenerationLimitsMinMax item gen limits for bot role + * @param botRole Role bot has (assault/pmcBot) + * @param isPmc Is bot being converted into a pmc + * @returns PmcInventory object with equipment/weapons/loot + */ generateInventory(sessionId: string, templateInventory: Inventory, equipmentChances: Chances, itemGenerationLimitsMinMax: Generation, botRole: string, isPmc: boolean): PmcInventory; + /** + * Create a pmcInventory object with all the base/generic items needed + * @returns PmcInventory object + */ + protected generateInventoryBase(): PmcInventory; + /** + * Add equipment to a bot + * @param templateInventory bot/x.json data from db + * @param equipmentChances Chances items will be added to bot + * @param botRole Role bot has (assault/pmcBot) + * @param botInventory Inventory to add equipment to + */ + protected generateAndAddEquipmentToBot(templateInventory: Inventory, equipmentChances: Chances, botRole: string, botInventory: PmcInventory): void; + protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory): void; + /** + * Work out what weapons bot should have equipped and add them to bot inventory + * @param templateInventory bot/x.json data from db + * @param equipmentChances Chances bot can have equipment equipped + * @param sessionId Session id + * @param botInventory Inventory to add weapons to + * @param botRole assault/pmcBot/bossTagilla etc + * @param isPmc Is the bot being generated as a pmc + * @param itemGenerationLimitsMinMax Limits for items the bot can have + */ + protected generateAndAddWeaponsToBot(templateInventory: Inventory, equipmentChances: Chances, sessionId: string, botInventory: PmcInventory, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation): void; + /** + * Calculate if the bot should have weapons in Primary/Secondary/Holster slots + * @param equipmentChances Chances bot has certain equipment + * @returns What slots bot should have weapons generated for + */ + protected getDesiredWeaponsForBot(equipmentChances: Chances): { + slot: EquipmentSlots; + shouldSpawn: boolean; + }[]; + /** + * Add weapon + spare mags/ammo to bots inventory + * @param sessionId Session id + * @param weaponSlot Weapon slot being generated + * @param templateInventory bot/x.json data from db + * @param botInventory Inventory to add weapon+mags/ammo to + * @param equipmentChances Chances bot can have equipment equipped + * @param botRole assault/pmcBot/bossTagilla etc + * @param isPmc Is the bot being generated as a pmc + * @param itemGenerationLimitsMinMax + */ protected addWeaponAndMagazinesToInventory(sessionId: string, weaponSlot: { slot: EquipmentSlots; shouldSpawn: boolean; }, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation): void; - protected generateEquipment(equipmentSlot: string, equipmentPool: Record, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory): void; - protected generateInventoryBase(): PmcInventory; } diff --git a/TypeScript/9RouterHooks/types/generators/BotLootGenerator.d.ts b/TypeScript/9RouterHooks/types/generators/BotLootGenerator.d.ts index c1f5310..3352a46 100644 --- a/TypeScript/9RouterHooks/types/generators/BotLootGenerator.d.ts +++ b/TypeScript/9RouterHooks/types/generators/BotLootGenerator.d.ts @@ -10,6 +10,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotLootCacheService } from "../services/BotLootCacheService"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { RandomUtil } from "../utils/RandomUtil"; import { BotWeaponGenerator } from "./BotWeaponGenerator"; @@ -23,9 +24,10 @@ export declare class BotLootGenerator { protected botWeaponGenerator: BotWeaponGenerator; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; protected botLootCacheService: BotLootCacheService; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, configServer: ConfigServer); generateLoot(sessionId: string, templateInventory: Inventory, itemCounts: ItemMinMax, isPmc: boolean, botRole: string, botInventory: PmcInventory, equipmentChances: Chances): void; protected getRandomisedCount(min: number, max: number, nValue: number): number; /** @@ -113,7 +115,7 @@ export declare class BotLootGenerator { * If no limit found for a non pmc bot, fall back to defaults * @param isPmc is the bot we want limits for a pmc * @param botRole what role does the bot have - * @returns dictionary of tplIds and limit + * @returns Dictionary of tplIds and limit */ protected getItemSpawnLimitsForBotType(isPmc: boolean, botRole: string): Record; /** diff --git a/TypeScript/9RouterHooks/types/generators/BotWeaponGenerator.d.ts b/TypeScript/9RouterHooks/types/generators/BotWeaponGenerator.d.ts index 487901b..40284ea 100644 --- a/TypeScript/9RouterHooks/types/generators/BotWeaponGenerator.d.ts +++ b/TypeScript/9RouterHooks/types/generators/BotWeaponGenerator.d.ts @@ -12,6 +12,7 @@ import { IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; @@ -27,10 +28,11 @@ export declare class BotWeaponGenerator { protected randomUtil: RandomUtil; protected configServer: ConfigServer; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected localisationService: LocalisationService; protected inventoryMagGenComponents: IInventoryMagGen[]; protected readonly modMagazineSlotId = "mod_magazine"; protected botConfig: IBotConfig; - constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil, configServer: ConfigServer, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, inventoryMagGenComponents: IInventoryMagGen[]); + constructor(jsonUtil: JsonUtil, logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil, configServer: ConfigServer, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, inventoryMagGenComponents: IInventoryMagGen[]); /** * Pick a random weapon based on weightings and generate a functional weapon * @param equipmentSlot Primary/secondary/holster diff --git a/TypeScript/9RouterHooks/types/generators/RagfairOfferGenerator.d.ts b/TypeScript/9RouterHooks/types/generators/RagfairOfferGenerator.d.ts index b64a7e7..23882d2 100644 --- a/TypeScript/9RouterHooks/types/generators/RagfairOfferGenerator.d.ts +++ b/TypeScript/9RouterHooks/types/generators/RagfairOfferGenerator.d.ts @@ -1,16 +1,19 @@ +import { HandbookHelper } from "../helpers/HandbookHelper"; import { ItemHelper } from "../helpers/ItemHelper"; +import { PaymentHelper } from "../helpers/PaymentHelper"; import { PresetHelper } from "../helpers/PresetHelper"; import { RagfairServerHelper } from "../helpers/RagfairServerHelper"; import { Item } from "../models/eft/common/tables/IItem"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; import { IBarterScheme } from "../models/eft/common/tables/ITrader"; -import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; +import { IRagfairOffer, OfferRequirement } from "../models/eft/ragfair/IRagfairOffer"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { RagfairCategoriesService } from "../services/RagfairCategoriesService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { RagfairPriceService } from "../services/RagfairPriceService"; @@ -27,18 +30,31 @@ export declare class RagfairOfferGenerator { protected timeUtil: TimeUtil; protected databaseServer: DatabaseServer; protected ragfairServerHelper: RagfairServerHelper; + protected handbookHelper: HandbookHelper; protected saveServer: SaveServer; protected presetHelper: PresetHelper; protected ragfairAssortGenerator: RagfairAssortGenerator; protected ragfairOfferService: RagfairOfferService; protected ragfairPriceService: RagfairPriceService; + protected localisationService: LocalisationService; + protected paymentHelper: PaymentHelper; protected ragfairCategoriesService: RagfairCategoriesService; protected fenceService: FenceService; protected itemHelper: ItemHelper; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, ragfairServerHelper: RagfairServerHelper, saveServer: SaveServer, presetHelper: PresetHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferService: RagfairOfferService, ragfairPriceService: RagfairPriceService, ragfairCategoriesService: RagfairCategoriesService, fenceService: FenceService, itemHelper: ItemHelper, configServer: ConfigServer); + protected allowedFleaPriceItemsForBarter: { + tpl: string; + price: number; + }[]; + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, ragfairServerHelper: RagfairServerHelper, handbookHelper: HandbookHelper, saveServer: SaveServer, presetHelper: PresetHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferService: RagfairOfferService, ragfairPriceService: RagfairPriceService, localisationService: LocalisationService, paymentHelper: PaymentHelper, ragfairCategoriesService: RagfairCategoriesService, fenceService: FenceService, itemHelper: ItemHelper, configServer: ConfigServer); createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; + /** + * Calculate the offer price that's listed on the flea listing + * @param offerRequirements barter requirements for offer + * @returns rouble cost of offer + */ + protected calculateOfferListingPrice(offerRequirements: OfferRequirement[]): number; /** * Get avatar url from trader table in db * @param isTrader Is user we're getting avatar for a trader @@ -87,20 +103,36 @@ export declare class RagfairOfferGenerator { * @returns Item with conditions added */ protected addMissingCondition(item: Item): Item; - protected getOfferRequirements(items: Item[]): { - count: number; - _tpl: string; + /** + * Create a barter-based barter scheme, if not possible, fall back to making barter scheme currency based + * @param offerItems Items for sale in offer + * @returns barter scheme + */ + protected createBarterRequirement(offerItems: Item[]): IBarterScheme[]; + /** + * Get an array of flea prices + item tpl, cached in generator class + * @returns array with tpl/price values + */ + protected getFleaPricesAsArray(): { + tpl: string; + price: number; }[]; + /** + * Create a random currency-based barter scheme for an array of items + * @param offerItems Items on offer + * @returns Barter scheme for offer + */ + protected createCurrencyRequirement(offerItems: Item[]): IBarterScheme[]; /** * Create a flea offer and store it in the Ragfair server offers array * @param userID owner of the offer * @param time time offer is put up * @param items items in the offer - * @param barterScheme - * @param loyalLevel + * @param barterScheme cost of item (currency or barter) + * @param loyalLevel Loyalty level needed to buy item * @param price price of offer * @param sellInOnePiece - * @returns + * @returns Ragfair offer */ createFleaOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, price: number, sellInOnePiece?: boolean): IRagfairOffer; } diff --git a/TypeScript/9RouterHooks/types/generators/WeatherGenerator.d.ts b/TypeScript/9RouterHooks/types/generators/WeatherGenerator.d.ts index 8ddbe49..65d2c76 100644 --- a/TypeScript/9RouterHooks/types/generators/WeatherGenerator.d.ts +++ b/TypeScript/9RouterHooks/types/generators/WeatherGenerator.d.ts @@ -1,38 +1,54 @@ +import { ApplicationContext } from "../context/ApplicationContext"; import { WeightedRandomHelper } from "../helpers/WeightedRandomHelper"; -import { IWeatherData } from "../models/eft/weather/IWeatherData"; +import { IWeather, IWeatherData } from "../models/eft/weather/IWeatherData"; +import { WindDirection } from "../models/enums/WindDirection"; import { IWeatherConfig } from "../models/spt/config/IWeatherConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { RandomUtil } from "../utils/RandomUtil"; import { TimeUtil } from "../utils/TimeUtil"; export declare class WeatherGenerator { protected weightedRandomHelper: WeightedRandomHelper; + protected logger: ILogger; protected randomUtil: RandomUtil; protected timeUtil: TimeUtil; + protected applicationContext: ApplicationContext; protected configServer: ConfigServer; protected weatherConfig: IWeatherConfig; - constructor(weightedRandomHelper: WeightedRandomHelper, randomUtil: RandomUtil, timeUtil: TimeUtil, configServer: ConfigServer); - calculateTime(data: IWeatherData): IWeatherData; + constructor(weightedRandomHelper: WeightedRandomHelper, logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, applicationContext: ApplicationContext, configServer: ConfigServer); + calculateGameTime(data: IWeatherData): IWeatherData; /** * Get server uptime seconds multiplied by a multiplier and add to current time as seconds * Format to BSGs requirements - * @param computedDate current date + * @param currentDate current date * @returns formatted time */ - protected getAcceleratedTime(computedDate: Date): string; + protected getBsgFormattedInRaidTime(currentDate: Date): string; + /** + * Get the current in-raid time + * @param currentDate (new Date()) + * @returns Date object of current in-raid time + */ + getInRaidTime(currentDate: Date): Date; /** * Get current time formatted to fit BSGs requirement - * @param computedDate date to format into bsg style + * @param date date to format into bsg style * @returns */ - protected getNormalTime(computedDate: Date): string; + protected getBSGFormattedTime(date: Date): string; /** - * Return randomised Weather data - * @param weatherData weather input data + * Return randomised Weather data with help of config/weather.json * @returns Randomised weather data */ - generateWeather(weatherData: IWeatherData): IWeatherData; - protected getWeightedFog(): string; + generateWeather(): IWeather; + /** + * Set IWeather date/time/timestamp values to now + * @param weather Object to update + */ + protected setCurrentDateTime(weather: IWeather): void; + protected getWeightedWindDirection(): WindDirection; + protected getWeightedWindSpeed(): number; + protected getWeightedFog(): number; protected getWeightedRain(): number; protected getRandomFloat(node: string): number; - protected getRandomInt(node: string): number; } diff --git a/TypeScript/9RouterHooks/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts b/TypeScript/9RouterHooks/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts index 4fcb1e2..1589707 100644 --- a/TypeScript/9RouterHooks/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts +++ b/TypeScript/9RouterHooks/types/generators/weapongen/implementations/ExternalInventoryMagGen.d.ts @@ -1,13 +1,15 @@ import { BotWeaponGeneratorHelper } from "../../../helpers/BotWeaponGeneratorHelper"; import { ItemHelper } from "../../../helpers/ItemHelper"; import { ILogger } from "../../../models/spt/utils/ILogger"; +import { LocalisationService } from "../../../services/LocalisationService"; import { IInventoryMagGen } from "../IInventoryMagGen"; import { InventoryMagGen } from "../InventoryMagGen"; export declare class ExternalInventoryMagGen implements IInventoryMagGen { protected logger: ILogger; protected itemHelper: ItemHelper; + protected localisationService: LocalisationService; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; - constructor(logger: ILogger, itemHelper: ItemHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper); + constructor(logger: ILogger, itemHelper: ItemHelper, localisationService: LocalisationService, botWeaponGeneratorHelper: BotWeaponGeneratorHelper); getPriority(): number; canHandleInventoryMagGen(inventoryMagGen: InventoryMagGen): boolean; process(inventoryMagGen: InventoryMagGen): void; diff --git a/TypeScript/9RouterHooks/types/helpers/BotDifficultyHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/BotDifficultyHelper.d.ts new file mode 100644 index 0000000..a58ebdb --- /dev/null +++ b/TypeScript/9RouterHooks/types/helpers/BotDifficultyHelper.d.ts @@ -0,0 +1,46 @@ +import { Difficulty } from "../models/eft/common/tables/IBotType"; +import { IBotConfig } from "../models/spt/config/IBotConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; +import { JsonUtil } from "../utils/JsonUtil"; +import { RandomUtil } from "../utils/RandomUtil"; +import { BotHelper } from "./BotHelper"; +export declare class BotDifficultyHelper { + protected logger: ILogger; + protected jsonUtil: JsonUtil; + protected databaseServer: DatabaseServer; + protected randomUtil: RandomUtil; + protected localisationService: LocalisationService; + protected botHelper: BotHelper; + protected configServer: ConfigServer; + protected botConfig: IBotConfig; + constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, localisationService: LocalisationService, botHelper: BotHelper, configServer: ConfigServer); + getPmcDifficultySettings(pmcType: "bear" | "usec", difficulty: string, usecType: string, bearType: string): Difficulty; + /** + * Get difficulty settings for desired bot type, if not found use assault bot types + * @param type bot type to retreive difficulty of + * @param difficulty difficulty to get settings for (easy/normal etc) + * @returns Difficulty object + */ + getBotDifficultySettings(type: string, difficulty: string): Difficulty; + /** + * Get difficulty settings for a PMC + * @param type "usec" / "bear" + * @param difficulty what difficulty to retrieve + * @returns Difficulty object + */ + protected getDifficultySettings(type: string, difficulty: string): Difficulty; + /** + * Translate chosen value from pre-raid difficulty dropdown into bot difficulty value + * @param dropDownDifficulty Dropdown difficulty value to convert + * @returns bot difficulty + */ + convertBotDifficultyDropdownToBotDifficulty(dropDownDifficulty: string): string; + /** + * Choose a random difficulty from - easy/normal/hard/impossible + * @returns random difficulty + */ + chooseRandomDifficulty(): string; +} diff --git a/TypeScript/9RouterHooks/types/helpers/BotGeneratorHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/BotGeneratorHelper.d.ts index 5e3e501..899669e 100644 --- a/TypeScript/9RouterHooks/types/helpers/BotGeneratorHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/BotGeneratorHelper.d.ts @@ -8,6 +8,7 @@ import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { BotEquipmentFilterService } from "../services/BotEquipmentFilterService"; import { ItemFilterService } from "../services/ItemFilterService"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; @@ -43,9 +44,10 @@ export declare class BotGeneratorHelper { protected itemFilterService: ItemFilterService; protected profileHelper: ProfileHelper; protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, configServer: ConfigServer); /** * Check mods are compatible and add to array * @param equipment Equipment item to add mods to @@ -53,9 +55,11 @@ export declare class BotGeneratorHelper { * @param parentId parentid of item to add mod to * @param parentTemplate template objet of item to add mods to * @param modSpawnChances dictionary of mod items and their chance to spawn for this bot type + * @param botRole the bot role being generated for + * @param forceSpawn should this mod be forced to spawn * @returns Item + compatible mods as an array */ - generateModsForEquipment(equipment: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances): Item[]; + generateModsForEquipment(equipment: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances, botRole: string, forceSpawn?: boolean): Item[]; /** * @param sessionId session id * @param weapon Weapon to add mods to @@ -70,15 +74,15 @@ export declare class BotGeneratorHelper { generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponParentId: string, parentWeaponTemplate: ITemplateItem, modSpawnChances: ModsChances, ammoTpl: string, botRole: string): Item[]; /** * - * @param modSlot - * @param isRandomisableSlot - * @param modsParent - * @param botEquipBlacklist - * @param itemModPool + * @param modSlot Slot mod will fit into + * @param isRandomisableSlot Will generate a randomised mod pool if true + * @param modsParent Parent slot the item will be a part of + * @param botEquipBlacklist Blacklist to prevent mods from being picked + * @param itemModPool Pool of items to pick from * @param weapon array with only weapon tpl in it, ready for mods to be added * @param ammoTpl ammo tpl to use if slot requires a cartridge to be added (e.g. mod_magazine) - * @param parentTemplate - * @returns + * @param parentTemplate Parent item the mod will go into + * @returns ITemplateItem */ protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, modsParent: Slot, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem): [boolean, ITemplateItem]; /** @@ -114,8 +118,10 @@ export declare class BotGeneratorHelper { * Find all compatible mods for equipment item and add to modPool * @param itemDetails item to find mods for * @param modPool ModPool to add mods to + * @param equipmentBlacklist equipment not allowed to be used by the bot + * @param botEquipmentRole bot type to generate pool for (e.g. assault, pmcBot, pmc for usec/bear) */ - generateDynamicModPool(itemDetails: ITemplateItem, modPool: Mods): void; + generateDynamicModPool(itemDetails: ITemplateItem, modPool: Mods, equipmentBlacklist: EquipmentFilterDetails[], botEquipmentRole: string): void; /** * Take a list of tpls and filter out blacklisted values using itemFilterService + botEquipmentBlacklist * @param allowedMods base mods to filter @@ -153,7 +159,7 @@ export declare class BotGeneratorHelper { * @param modTemplate Used to add additional properites in the upd object * @returns Item object */ - protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem): Item; + protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem, botRole: string): Item; /** * randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot * never return true for an item that has 0% spawn chance @@ -170,10 +176,10 @@ export declare class BotGeneratorHelper { */ protected getAmmoContainers(): string[]; /** - * Get the slot details for an item (chamber/cartridge/slot) + * Get a Slot property for an item (chamber/cartridge/slot) * @param modSlot e.g patron_in_weapon * @param parentTemplate item template - * @returns + * @returns Slot item */ protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot; /** @@ -185,7 +191,6 @@ export declare class BotGeneratorHelper { * @param modPool modPool which should include available cartrigdes * @param parentId The CylinderMagazine's UID * @param parentTemplate The CylinderMagazine's template - * @returns */ protected fillCamora(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem): void; /** @@ -197,11 +202,11 @@ export declare class BotGeneratorHelper { /** * Adds properties to an item * e.g. Repairable / HasHinge / Foldable / MaxDurability - * @param itemTemplate - * @param botRole Used by weapons to randomise the durability values + * @param itemTemplate Item extra properties are being generated for + * @param botRole Used by weapons to randomise the durability values. Null for non-equipped items * @returns Item Upd object with extra properties */ - generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: any): { + generateExtraPropertiesForItem(itemTemplate: ITemplateItem, botRole?: string): { upd?: Upd; }; /** @@ -220,21 +225,27 @@ export declare class BotGeneratorHelper { protected generateArmorRepairableProperties(itemTemplate: ITemplateItem, botRole: string): Repairable; /** * Get a random mod from an items compatible mods Filter array - * @param modTpl - * @param parentSlot - * @param modSlot - * @param items + * @param modTpl ???? + * @param parentSlot item mod will go into, used to get combatible items + * @param modSlot Slot to get mod to fill + * @param items items to ensure picked mod is compatible with * @returns item tpl */ protected getModTplFromItemDb(modTpl: string, parentSlot: Slot, modSlot: string, items: Item[]): string; /** * Can an item be added to an item without issue - * @param items - * @param tplToCheck - * @param equipmentSlot - * @returns true if possible + * @param items items to check compatiblilities with + * @param tplToCheck tpl of the item to check for incompatibilities + * @param equipmentSlot Slot the item will be placed into + * @returns false if no incompatibilties */ isItemIncompatibleWithCurrentItems(items: Item[], tplToCheck: string, equipmentSlot: string): boolean; + /** + * Convert a bots role to the equipment role used in config/bot.json + * @param botRole Role to convert + * @returns Equipment role (e.g. pmc / assault / bossTagilla) + */ + getBotEquipmentRole(botRole: string): string; } /** TODO - move into own class */ export declare class ExhaustableArray { diff --git a/TypeScript/9RouterHooks/types/helpers/BotHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/BotHelper.d.ts index 67a6384..a7f779e 100644 --- a/TypeScript/9RouterHooks/types/helpers/BotHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/BotHelper.d.ts @@ -3,6 +3,7 @@ import { IBotConfig } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; export declare class BotHelper { @@ -10,46 +11,27 @@ export declare class BotHelper { protected jsonUtil: JsonUtil; protected databaseServer: DatabaseServer; protected randomUtil: RandomUtil; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected botConfig: IBotConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, configServer: ConfigServer); - /** - * Get difficulty settings for desired bot type, if not found use assault bot types - * @param type bot type to retreive difficulty of - * @param difficulty difficulty to get settings for (easy/normal etc) - * @returns Difficulty object - */ - getBotDifficultySettings(type: string, difficulty: string): Difficulty; + constructor(logger: ILogger, jsonUtil: JsonUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, localisationService: LocalisationService, configServer: ConfigServer); /** * Get a template object for the specified botRole from bots.types db * @param role botRole to get template for * @returns IBotType object */ getBotTemplate(role: string): IBotType; - /** - * Get difficulty settings for a PMC - * @param type "usec" / "bear" - * @param difficulty what difficulty to retrieve - * @returns Difficulty object - */ - getPmcDifficultySettings(type: string, difficulty: string): Difficulty; - /** - * Translate chosen value from pre-raid difficulty dropdown into bot difficulty value - * @param dropDownDifficulty Dropdown difficulty value to convert - * @returns bot difficulty - */ - convertBotDifficultyDropdownToBotDifficulty(dropDownDifficulty: string): string; - /** - * Choose a random difficulty from - easy/normal/hard/impossible - * @returns random difficulty - */ - chooseRandomDifficulty(): string; /** * Randomise the chance the PMC will attack their own side * Look up value in bot.json/chanceSameSideIsHostilePercent * @param difficultySettings pmc difficulty settings */ randomisePmcHostility(difficultySettings: Difficulty): void; + /** + * Is the passed in bot role a PMC (usec/bear/pmc) + * @param botRole bot role to check + * @returns true if is pmc + */ isBotPmc(botRole: string): boolean; isBotBoss(botRole: string): boolean; isBotFollower(botRole: string): boolean; diff --git a/TypeScript/9RouterHooks/types/helpers/GameEventHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/GameEventHelper.d.ts index fca87be..fa25eff 100644 --- a/TypeScript/9RouterHooks/types/helpers/GameEventHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/GameEventHelper.d.ts @@ -15,4 +15,15 @@ export declare class GameEventHelper { * @returns Record with event name + start/end date */ getEventDetails(): ISeasonalEvent[]; + /** + * Is detection of seasonal events enabled (halloween / christmas) + * @returns true if seasonal events should be checked for + */ + isAutomaticEventDetectionEnabled(): boolean; + /** + * Get a dictionary of gear changes to apply to bots for a specific event e.g. Christmas/Halloween + * @param eventName Name of event to get gear changes for + * @returns bots with equipment changes + */ + getEventBotGear(eventName: string): Record>>; } diff --git a/TypeScript/9RouterHooks/types/helpers/HideoutHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/HideoutHelper.d.ts index 5f7e3b7..9d51fed 100644 --- a/TypeScript/9RouterHooks/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/HideoutHelper.d.ts @@ -11,6 +11,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { EventOutputHolder } from "../routers/EventOutputHolder"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { PlayerService } from "../services/PlayerService"; import { HashUtil } from "../utils/HashUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; @@ -29,13 +30,14 @@ export declare class HideoutHelper { protected profileHelper: ProfileHelper; protected inventoryHelper: InventoryHelper; protected playerService: PlayerService; + protected localisationService: LocalisationService; protected configServer: ConfigServer; static bitcoinFarm: string; static waterCollector: string; static bitcoin: string; static expeditionaryFuelTank: string; protected hideoutConfig: IHideoutConfig; - constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, configServer: ConfigServer); + constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, localisationService: LocalisationService, configServer: ConfigServer); registerProduction(pmcData: IPmcData, body: IHideoutSingleProductionStartRequestData | IHideoutContinousProductionStartRequestData, sessionID: string): IItemEventRouterResponse; /** * This convinience function intialies new Production Object diff --git a/TypeScript/9RouterHooks/types/helpers/InventoryHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/InventoryHelper.d.ts index b8e5c9d..6419f93 100644 --- a/TypeScript/9RouterHooks/types/helpers/InventoryHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/InventoryHelper.d.ts @@ -5,11 +5,12 @@ import { IInventoryMergeRequestData } from "../models/eft/inventory/IInventoryMe import { IInventoryMoveRequestData } from "../models/eft/inventory/IInventoryMoveRequestData"; import { IInventorySplitRequestData } from "../models/eft/inventory/IInventorySplitRequestData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; -import { IInventoryConfig } from "../models/spt/config/IInventoryConfig"; +import { IInventoryConfig, RewardDetails } from "../models/spt/config/IInventoryConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { FenceService } from "../services/FenceService"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { JsonUtil } from "../utils/JsonUtil"; @@ -38,9 +39,10 @@ export declare class InventoryHelper { protected itemHelper: ItemHelper; protected containerHelper: ContainerHelper; protected profileHelper: ProfileHelper; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected inventoryConfig: IInventoryConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, httpResponse: HttpResponseUtil, fenceService: FenceService, databaseServer: DatabaseServer, paymentHelper: PaymentHelper, traderAssortHelper: TraderAssortHelper, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, containerHelper: ContainerHelper, profileHelper: ProfileHelper, localisationService: LocalisationService, configServer: ConfigServer); addItem(pmcData: IPmcData, body: IAddItemRequestData, output: IItemEventRouterResponse, sessionID: string, callback: any, foundInRaid?: boolean, addUpd?: any): IItemEventRouterResponse; removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; removeItemByCount(pmcData: IPmcData, itemId: string, count: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse; @@ -76,6 +78,12 @@ export declare class InventoryHelper { * Internal helper function to handle cartridges in inventory if any of them exist. */ protected handleCartridges(items: Item[], body: IInventoryMoveRequestData): void; + /** + * Get details for how a random loot container should be handled, max rewards, possible reward tpls + * @param itemTpl Container being opened + * @returns Reward details + */ + getRandomLootContainerRewardDetails(itemTpl: string): RewardDetails; } declare namespace InventoryHelper { interface InventoryItemHash { diff --git a/TypeScript/9RouterHooks/types/helpers/ItemHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/ItemHelper.d.ts index 0effaf2..fc88a46 100644 --- a/TypeScript/9RouterHooks/types/helpers/ItemHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/ItemHelper.d.ts @@ -5,6 +5,7 @@ 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 { LocaleService } from "../services/LocaleService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { MathUtil } from "../utils/MathUtil"; @@ -18,7 +19,8 @@ declare class ItemHelper { protected objectId: ObjectId; protected mathUtil: MathUtil; protected databaseServer: DatabaseServer; - constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer); + protected localeService: LocaleService; + constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, localeService: LocaleService); /** * Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash * @param {string} tpl the template id / tpl @@ -212,6 +214,12 @@ declare class ItemHelper { * @returns size of stack */ getItemStackSize(item: Item): number; + /** + * Get the name of an item from the locale file using the item tpl + * @param itemTpl Tpl of item to get name of + * @returns Name of item + */ + getItemName(itemTpl: string): string; } declare namespace ItemHelper { interface ItemSize { diff --git a/TypeScript/9RouterHooks/types/helpers/QuestHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/QuestHelper.d.ts index a6b4892..edbd2e1 100644 --- a/TypeScript/9RouterHooks/types/helpers/QuestHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/QuestHelper.d.ts @@ -50,6 +50,12 @@ export declare class QuestHelper { * @returns true if player level is greater than or equal to quest */ doesPlayerLevelFulfilCondition(playerLevel: number, condition: AvailableForConditions): boolean; + /** + * Get the quests found in both arrays (inner join) + * @param before Array of qeusts #1 + * @param after Array of quests #2 + * @returns Reduction of cartesian product between two quest arrays + */ getDeltaQuests(before: IQuest[], after: IQuest[]): IQuest[]; /** * Increase skill points of a skill on player profile @@ -66,38 +72,85 @@ export declare class QuestHelper { * quest list in question. */ dumpQuests(quests: any): void; - loyaltyRequirementCheck(loyaltyRequirementProperties: AvailableForProps, profile: IPmcData): boolean; - protected processReward(reward: Reward): any[]; + /** + * Check if trader has sufficient loyalty to fullfill quest requirement + * @param questProperties Quest props + * @param profile Player profile + * @returns true if loyalty is high enough to fulfil quest requirement + */ + traderStandingRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean; + protected processReward(reward: Reward): Reward[]; + /** + * Gets a flat list of reward items for the given quest at a specific state (e.g. Fail/Success) + * @param quest quest to get rewards for + * @param state Quest status that holds the items (Started, Success, Fail) + * @returns array of items with the correct maxStack + */ getQuestRewardItems(quest: IQuest, state: QuestStatus): Reward[]; /** - * Add quest with new state value to pmc profile + * Update player profile with quest status (e.g. Fail/Success) * @param pmcData profile to add quest to * @param newState state the new quest should be in when added * @param acceptedQuest Details of quest being added */ addQuestToPMCData(pmcData: IPmcData, newState: QuestStatus, acceptedQuest: IAcceptQuestRequestData): void; - acceptedUnlocked(acceptedQuestId: string, sessionID: string): IQuest[]; - failedUnlocked(failedQuestId: string, sessionID: string): IQuest[]; - applyMoneyBoost(quest: IQuest, moneyBoost: number): IQuest; - changeItemStack(pmcData: IPmcData, id: string, value: number, sessionID: string, output: any): void; /** - * Get List of All Quests as an array + * TODO: what is going on here + * @param acceptedQuestId Quest to add to profile + * @param sessionID Session id + * @returns Array of quests in profile + quest passed in as param + */ + acceptedUnlocked(acceptedQuestId: string, sessionID: string): IQuest[]; + /** + * TODO: what is going on here + * @param failedQuestId + * @param sessionID Session id + * @returns + */ + failedUnlocked(failedQuestId: string, sessionID: string): IQuest[]; + /** + * Adjust quest money rewards by passed in multipler + * @param quest Quest to multiple money rewards + * @param multipler Value to adjust money rewards by + * @returns Updated quest + */ + applyMoneyBoost(quest: IQuest, multipler: number): IQuest; + /** + * Sets the item stack to new value, or delete the item if value <= 0 + * // TODO maybe merge this function and the one from customization + * @param pmcData Profile + * @param itemId id of item to adjust stack size of + * @param newStackSize Stack size to adjust to + * @param sessionID Session id + * @param output ItemEvent router response + */ + changeItemStack(pmcData: IPmcData, itemId: string, newStackSize: number, sessionID: string, output: IItemEventRouterResponse): void; + /** + * Get List of All Quests from db + * NOT CLONED * @returns Array of IQuest objects */ - questValues(): IQuest[]; + getQuestsFromDb(): IQuest[]; /** - * Reest AvailableForStart conditions for quests - * @param quests queststo clean + * Get quests, strip all requirement conditions except level + * @param quests quests to process * @returns quest array without conditions */ - protected cleanQuestList(quests: IQuest[]): IQuest[]; + protected getQuestsWithOnlyLevelRequirementStartCondition(quests: IQuest[]): IQuest[]; /** - * Reset AvailableForStart conditions on a quest + * Remove all quest conditions except for level requirement * @param quest quest to clean * @returns reset IQuest object */ - cleanQuestConditions(quest: IQuest): IQuest; - failQuest(pmcData: IPmcData, body: any, sessionID: string): any; + getQuestWithOnlyLevelRequirementStartCondition(quest: IQuest): IQuest; + /** + * Fail a quest in a player profile + * @param pmcData Profile + * @param failRequest fail quest request data + * @param sessionID Session id + * @returns Item event router response + */ + failQuest(pmcData: IPmcData, failRequest: any, sessionID: string): IItemEventRouterResponse; /** * Get quest by id from database * @param questId questid to look for @@ -105,7 +158,12 @@ export declare class QuestHelper { * @returns IQuest object */ getQuestFromDb(questId: string, pmcData: IPmcData): IQuest; - getQuestLocaleIdFromDb(messageId: string): string; + /** + * Get the locale Id from locale db for a quest message + * @param questMessageId Quest mesage id to look up + * @returns Locale Id from locale db + */ + getQuestLocaleIdFromDb(questMessageId: string): string; /** * Alter a quests state + Add a record to tis status timers object * @param pmcData Profile to update @@ -128,5 +186,10 @@ export declare class QuestHelper { * @returns bonus in percent */ protected getIntelCenterRewardBonus(pmcData: IPmcData): number; - getFindItemIdForQuestItem(itemTpl: string): string; + /** + * Find quest with 'findItem' requirement that needs the item tpl be handed in + * @param itemTpl item tpl to look for + * @returns 'FindItem' condition id + */ + getFindItemIdForQuestHandIn(itemTpl: string): string; } diff --git a/TypeScript/9RouterHooks/types/helpers/RagfairServerHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/RagfairServerHelper.d.ts index a03cdda..ec388d8 100644 --- a/TypeScript/9RouterHooks/types/helpers/RagfairServerHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/RagfairServerHelper.d.ts @@ -44,10 +44,20 @@ export declare class RagfairServerHelper { isPlayer(userID: string): boolean; returnItems(sessionID: string, items: any[]): void; calculateDynamicStackCount(tplId: string, isWeaponPreset: boolean): number; + /** + * Choose a currency at random with bias + * @returns currency tpl + */ getDynamicOfferCurrency(): string; getMemberType(userID: string): MemberCategory; getNickname(userID: string): string; getPresetItems(item: any): Item[]; getPresetItemsByTpl(item: Item): Item[]; + /** + * Generate new unique ids for the children while preserving hierarchy + * @param item base item + * @param preset + * @returns Item array with new IDs + */ reparentPresets(item: Item, preset: Item[]): Item[]; } diff --git a/TypeScript/9RouterHooks/types/helpers/RagfairSortHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/RagfairSortHelper.d.ts index 28d1d38..4669ce6 100644 --- a/TypeScript/9RouterHooks/types/helpers/RagfairSortHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/RagfairSortHelper.d.ts @@ -18,7 +18,7 @@ export declare class RagfairSortHelper { protected sortOffersByRating(a: IRagfairOffer, b: IRagfairOffer): number; protected sortOffersByName(a: IRagfairOffer, b: IRagfairOffer): number; /** - * Order two offers by price value + * Order two offers by rouble price value * @param a Offer a * @param b Offer b * @returns diff --git a/TypeScript/9RouterHooks/types/loaders/PreAkiModLoader.d.ts b/TypeScript/9RouterHooks/types/loaders/PreAkiModLoader.d.ts index 7a687a5..f486a28 100644 --- a/TypeScript/9RouterHooks/types/loaders/PreAkiModLoader.d.ts +++ b/TypeScript/9RouterHooks/types/loaders/PreAkiModLoader.d.ts @@ -1,29 +1,31 @@ import { DependencyContainer } from "tsyringe"; +import { IPostAkiLoadMod } from "../models/external/IPostAkiLoadMod"; +import { IPostDBLoadMod } from "../models/external/IPostDBLoadMod"; +import { IPreAkiLoadMod } from "../models/external/IPreAkiLoadMod"; import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { ModLoader } from "../models/spt/mod/IMod"; import { IModLoader } from "../models/spt/mod/IModLoader"; import { IPackageJsonData } from "../models/spt/mod/IPackageJsonData"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { LocalisationService } from "../services/LocalisationService"; import { ModCompilerService } from "../services/ModCompilerService"; import { JsonUtil } from "../utils/JsonUtil"; import { VFS } from "../utils/VFS"; import { BundleLoader } from "./BundleLoader"; -import { IPostAkiLoadMod } from "../models/external/IPostAkiLoadMod"; -import { IPreAkiLoadMod } from "../models/external/IPreAkiLoadMod"; -import { IPostDBLoadMod } from "../models/external/IPostDBLoadMod"; export declare class PreAkiModLoader implements IModLoader { protected logger: ILogger; protected vfs: VFS; protected jsonUtil: JsonUtil; protected modCompilerService: ModCompilerService; protected bundleLoader: BundleLoader; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected static container: DependencyContainer; protected readonly basepath = "user/mods/"; protected imported: Record; protected akiConfig: ICoreConfig; - constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, modCompilerService: ModCompilerService, bundleLoader: BundleLoader, configServer: ConfigServer); + constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, modCompilerService: ModCompilerService, bundleLoader: BundleLoader, localisationService: LocalisationService, configServer: ConfigServer); load(container: DependencyContainer): Promise; getBundles(local: boolean): string; getBundle(key: string, local: boolean): void; diff --git a/TypeScript/9RouterHooks/types/models/eft/bot/IGenerateBotsRequestData.d.ts b/TypeScript/9RouterHooks/types/models/eft/bot/IGenerateBotsRequestData.d.ts index c49cef7..f1f7013 100644 --- a/TypeScript/9RouterHooks/types/models/eft/bot/IGenerateBotsRequestData.d.ts +++ b/TypeScript/9RouterHooks/types/models/eft/bot/IGenerateBotsRequestData.d.ts @@ -2,6 +2,7 @@ export interface IGenerateBotsRequestData { conditions: Condition[]; } export interface Condition { + /** e.g. assault/pmcBot/bossKilla */ Role: string; Limit: number; Difficulty: string; diff --git a/TypeScript/9RouterHooks/types/models/eft/common/IGlobals.d.ts b/TypeScript/9RouterHooks/types/models/eft/common/IGlobals.d.ts index 81e2023..b53f106 100644 --- a/TypeScript/9RouterHooks/types/models/eft/common/IGlobals.d.ts +++ b/TypeScript/9RouterHooks/types/models/eft/common/IGlobals.d.ts @@ -591,6 +591,7 @@ export interface HealPrice { export interface ProfileHealthSettings { BodyPartsSettings: BodyPartsSettings; HealthFactorsSettings: HealthFactorsSettings; + DefaultStimulatorBuff: string; } export interface BodyPartsSettings { Head: BodyPartsSetting; diff --git a/TypeScript/9RouterHooks/types/models/eft/common/tables/IBotBase.d.ts b/TypeScript/9RouterHooks/types/models/eft/common/tables/IBotBase.d.ts index 1c28ae0..2b418c1 100644 --- a/TypeScript/9RouterHooks/types/models/eft/common/tables/IBotBase.d.ts +++ b/TypeScript/9RouterHooks/types/models/eft/common/tables/IBotBase.d.ts @@ -107,6 +107,7 @@ export interface CurrentMax { Maximum: number; } export interface Inventory { + discardLimits: Record; items: Item[]; equipment: string; stash: string; diff --git a/TypeScript/9RouterHooks/types/models/eft/common/tables/IBotType.d.ts b/TypeScript/9RouterHooks/types/models/eft/common/tables/IBotType.d.ts index c1fe579..55b4bd9 100644 --- a/TypeScript/9RouterHooks/types/models/eft/common/tables/IBotType.d.ts +++ b/TypeScript/9RouterHooks/types/models/eft/common/tables/IBotType.d.ts @@ -13,8 +13,8 @@ export interface IBotType { skills: Skills; } export interface Appearance { - body: string[]; - feet: string[]; + body: Record; + feet: Record; hands: string[]; head: string[]; voice: string[]; diff --git a/TypeScript/9RouterHooks/types/models/eft/common/tables/ITemplateItem.d.ts b/TypeScript/9RouterHooks/types/models/eft/common/tables/ITemplateItem.d.ts index 8569e61..0fa7e18 100644 --- a/TypeScript/9RouterHooks/types/models/eft/common/tables/ITemplateItem.d.ts +++ b/TypeScript/9RouterHooks/types/models/eft/common/tables/ITemplateItem.d.ts @@ -254,7 +254,7 @@ export interface Props { foodUseTime?: number; foodEffectType?: string; StimulatorBuffs?: string; - effects_health?: any; + effects_health?: IHealthEffect[] | Record>; effects_damage?: any; MaximumNumberOfUsage?: number; knifeHitDelay?: number; @@ -366,6 +366,10 @@ export interface Props { MinTimeToContactExplode?: number; ExplosionEffectType?: string; } +export interface IHealthEffect { + type: string; + value: number; +} export interface Prefab { path: string; rcid: string; diff --git a/TypeScript/9RouterHooks/types/models/eft/customization/IGetSuitsResponse.d.ts b/TypeScript/9RouterHooks/types/models/eft/customization/IGetSuitsResponse.d.ts new file mode 100644 index 0000000..fe6888c --- /dev/null +++ b/TypeScript/9RouterHooks/types/models/eft/customization/IGetSuitsResponse.d.ts @@ -0,0 +1,4 @@ +export interface IGetSuitsResponse { + _id: string; + suits: string[]; +} diff --git a/TypeScript/9RouterHooks/types/models/eft/game/IGameKeepAliveResponse.d.ts b/TypeScript/9RouterHooks/types/models/eft/game/IGameKeepAliveResponse.d.ts new file mode 100644 index 0000000..170ce6a --- /dev/null +++ b/TypeScript/9RouterHooks/types/models/eft/game/IGameKeepAliveResponse.d.ts @@ -0,0 +1,4 @@ +export interface IGameKeepAliveResponse { + msg: string; + utc_time: number; +} diff --git a/TypeScript/9RouterHooks/types/models/eft/game/IGameLogoutResponseData.d.ts b/TypeScript/9RouterHooks/types/models/eft/game/IGameLogoutResponseData.d.ts new file mode 100644 index 0000000..0f52050 --- /dev/null +++ b/TypeScript/9RouterHooks/types/models/eft/game/IGameLogoutResponseData.d.ts @@ -0,0 +1,3 @@ +export interface IGameLogoutResponseData { + status: string; +} diff --git a/TypeScript/9RouterHooks/types/models/eft/game/IGameStartResponse.d.ts b/TypeScript/9RouterHooks/types/models/eft/game/IGameStartResponse.d.ts new file mode 100644 index 0000000..9f0ab6d --- /dev/null +++ b/TypeScript/9RouterHooks/types/models/eft/game/IGameStartResponse.d.ts @@ -0,0 +1,3 @@ +export interface IGameStartResponse { + utc_time: number; +} diff --git a/TypeScript/9RouterHooks/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts b/TypeScript/9RouterHooks/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts new file mode 100644 index 0000000..3c45124 --- /dev/null +++ b/TypeScript/9RouterHooks/types/models/eft/inventory/IOpenRandomLootContainerRequestData.d.ts @@ -0,0 +1,11 @@ +import { IInventoryBaseActionRequestData } from "./IInventoryBaseActionRequestData"; +export interface IOpenRandomLootContainerRequestData extends IInventoryBaseActionRequestData { + Action: "OpenRandomLootContainer"; + /** Container item opened */ + item: string; + to: To[]; +} +export interface To { + /** Player character (pmc/scav) id items will be sent to */ + id: string; +} diff --git a/TypeScript/9RouterHooks/types/models/eft/itemEvent/IItemEventRouterBase.d.ts b/TypeScript/9RouterHooks/types/models/eft/itemEvent/IItemEventRouterBase.d.ts index 4841cfd..60ab284 100644 --- a/TypeScript/9RouterHooks/types/models/eft/itemEvent/IItemEventRouterBase.d.ts +++ b/TypeScript/9RouterHooks/types/models/eft/itemEvent/IItemEventRouterBase.d.ts @@ -10,8 +10,9 @@ export interface IItemEventRouterBase { export declare type TProfileChanges = Record; export interface Warning { index: number; - err: string; errmsg: string; + code?: string; + data?: any; } export interface ProfileChange { _id: string; diff --git a/TypeScript/9RouterHooks/types/models/eft/match/IStartOffineRaidRequestData.d.ts b/TypeScript/9RouterHooks/types/models/eft/match/IStartOffineRaidRequestData.d.ts index af0625e..1983728 100644 --- a/TypeScript/9RouterHooks/types/models/eft/match/IStartOffineRaidRequestData.d.ts +++ b/TypeScript/9RouterHooks/types/models/eft/match/IStartOffineRaidRequestData.d.ts @@ -2,8 +2,10 @@ import { BotAmount } from "../../enums/BotAmount"; import { BotDifficulty } from "../../enums/BotDifficulty"; export interface IStartOfflineRaidRequestData { locationName: string; + /** Current time, not in-game time */ startTime: number; - dateTime: string; + /** CURR = am, past = pm */ + dateTime: "CURR" | "PAST"; gameSettings: GameSettings; } export interface GameSettings { diff --git a/TypeScript/9RouterHooks/types/models/eft/notifier/ISelectProfileResponse.d.ts b/TypeScript/9RouterHooks/types/models/eft/notifier/ISelectProfileResponse.d.ts new file mode 100644 index 0000000..ecb668a --- /dev/null +++ b/TypeScript/9RouterHooks/types/models/eft/notifier/ISelectProfileResponse.d.ts @@ -0,0 +1,6 @@ +import { INotifierChannel } from "./INotifier"; +export interface ISelectProfileResponse { + status: string; + notifier: INotifierChannel; + notifierServer: string; +} diff --git a/TypeScript/9RouterHooks/types/models/eft/ragfair/IRagfairOffer.d.ts b/TypeScript/9RouterHooks/types/models/eft/ragfair/IRagfairOffer.d.ts index 3251a37..792ec7d 100644 --- a/TypeScript/9RouterHooks/types/models/eft/ragfair/IRagfairOffer.d.ts +++ b/TypeScript/9RouterHooks/types/models/eft/ragfair/IRagfairOffer.d.ts @@ -7,19 +7,19 @@ export interface IRagfairOffer { requirements: OfferRequirement[]; root: string; intId: number; + /** Handbook price */ itemsCost: number; + /** Rouble price */ requirementsCost: number; - sptRequirementsCostRouble: number; startTime: number; endTime: number; sellInOnePiece: boolean; - name?: string; - shortName?: string; loyaltyLevel: number; buyRestrictionMax?: number; buyRestrictionCurrent?: number; locked: boolean; unlimitedCount: boolean; + /** Rouble price */ summaryCost: number; user: IRagfairOfferUser; notAvailable: boolean; @@ -33,11 +33,11 @@ export interface OfferRequirement { } export interface IRagfairOfferUser { id: string; - nickname: string; - rating: number; + nickname?: string; + rating?: number; memberType: MemberCategory; - avatar: string; - isRatingGrowing: boolean; + avatar?: string; + isRatingGrowing?: boolean; } export interface SellResult { sellTime: number; diff --git a/TypeScript/9RouterHooks/types/models/eft/weather/IWeatherData.d.ts b/TypeScript/9RouterHooks/types/models/eft/weather/IWeatherData.d.ts index ecc96ce..1f5d5b5 100644 --- a/TypeScript/9RouterHooks/types/models/eft/weather/IWeatherData.d.ts +++ b/TypeScript/9RouterHooks/types/models/eft/weather/IWeatherData.d.ts @@ -1,17 +1,18 @@ +import { WindDirection } from "../../../models/enums/WindDirection"; export interface IWeatherData { acceleration: number; time: string; date: string; - weather: IWeather; + weather?: IWeather; } export interface IWeather { pressure: number; temp: number; - fog: string; + fog: number; rain_intensity: number; - rain: any; + rain: number; wind_gustiness: number; - wind_direction: any; + wind_direction: WindDirection; wind_speed: number; cloud: number; time: string; diff --git a/TypeScript/9RouterHooks/types/models/enums/BackendErrorCodes.d.ts b/TypeScript/9RouterHooks/types/models/enums/BackendErrorCodes.d.ts new file mode 100644 index 0000000..6614b75 --- /dev/null +++ b/TypeScript/9RouterHooks/types/models/enums/BackendErrorCodes.d.ts @@ -0,0 +1,67 @@ +export declare enum BackendErrorCodes { + NONE = 0, + UNKNOWN_ERROR = 200, + NOT_AUTHORIZED = 201, + NEED_AUTHORIZATION_CODE = 209, + WRONG_AUTHORIZATION_CODE = 211, + NEED_CAPTCHA = 214, + NO_NEED_CAPTCHA = 215, + CAPTCHA_FAILED = 218, + CAPTCHA_BRUTE_FORCED = 219, + NO_ROOM_IN_STASH = 223, + NICKNAME_NOT_UNIQUE = 225, + NICKNAME_NOT_VALID = 226, + UNSUPPORTED_CLIENT_VERSION = 232, + REPORT_NOT_ALLOWED = 238, + NICKNAME_IS_ABUSIVE = 241, + NICKNAME_CHANGE_TIMEOUT = 242, + NOT_MODIFIED = 304, + HTTP_BAD_REQUEST = 400, + HTTP_NOT_AUTHORIZED = 401, + HTTP_FORBIDDEN = 403, + HTTP_NOT_FOUND = 404, + HTTP_METHOD_NOT_ALLOWED = 405, + UNKNOWN_TRADING_ERROR = 500, + HTTPNOTIMPLEMENTED = 501, + HTTPBADGATEWAY = 502, + HTTPSERVICEUNAVAILABLE = 503, + HTTPGATEWAYTIMEOUT = 504, + TRADEROUTOFMONEY = 505, + HTTPVARIANTALSONEGOTIATES = 506, + PRICECHANGED = 509, + TRADERDISABLED = 512, + ITEMHASBEENSOLD = 513, + NOTENOUGHSPACEFORMONEY = 518, + HTTPINVALIDSSLCERTIFICATE = 526, + UNKNOWNRAGFAIRERROR = 550, + UNKNOWNRAGFAIRERROR2 = 551, + UNKNOWNMATCHMAKERERROR = 600, + SESSIONPARAMETERSERROR = 601, + SESSIONLOST = 602, + SERVERNOTREGISTERED = 604, + UNKNOWNQUESTERROR = 700, + QUESTBADPARAM = 702, + QUESTNOTFOUND = 703, + QUESTISUNAVAILABLE = 704, + NOFREESPACEFORREWARDS = 705, + WRONGQUESTSTATUS = 706, + CANTCOMPLETEQUEST = 707, + UNKNOWNMAILERROR = 900, + TOOMANYFRIENDREQUESTS = 925, + UNKNOWNSCRIPTEXECUTIONERROR = 1000, + UNKNOWNREPAIRINGERROR = 1200, + UNKNOWNINSURANCEERROR = 1300, + UNKNOWNCURRENCYEXCHANGEERROR = 1400, + OFFERNOTFOUND = 1503, + NOTENOUGHSPACE = 1505, + OFFEROUTOFSTOCK = 1506, + OFFERSOLD = 1507, + RAGFAIRUNAVAILABLE = 1511, + BANNEDERRORCODE = 1513, + INSUFFICIENTNUMBERINSTOCK = 1516, + TOOMANYITEMSTOSELL = 1517, + EXAMINATIONFAILED = 22001, + ITEMALREADYEXAMINED = 22002, + UNKNOWNNGINXERROR = 9000, + PARSERESPONSEERROR = 9001 +} diff --git a/TypeScript/9RouterHooks/types/models/enums/HideoutEventActions.d.ts b/TypeScript/9RouterHooks/types/models/enums/HideoutEventActions.d.ts new file mode 100644 index 0000000..e441477 --- /dev/null +++ b/TypeScript/9RouterHooks/types/models/enums/HideoutEventActions.d.ts @@ -0,0 +1,11 @@ +export declare enum HideoutEventActions { + HIDEOUT_UPGRADE = "HideoutUpgrade", + HIDEOUT_UPGRADE_COMPLETE = "HideoutUpgradeComplete", + HIDEOUT_PUT_ITEMS_IN_AREA_SLOTS = "HideoutPutItemsInAreaSlots", + HIDEOUT_TAKE_ITEMS_FROM_AREA_SLOTS = "HideoutTakeItemsFromAreaSlots", + HIDEOUT_TOGGLE_AREA = "HideoutToggleArea", + HIDEOUT_SINGLE_PRODUCTION_START = "HideoutSingleProductionStart", + HIDEOUT_SCAV_CASE_PRODUCTION_START = "HideoutScavCaseProductionStart", + HIDEOUT_CONTINUOUS_PRODUCTION_START = "HideoutContinuousProductionStart", + HIDEOUT_TAKE_PRODUCTION = "HideoutTakeProduction" +} diff --git a/TypeScript/9RouterHooks/types/models/enums/ItemEventActions.d.ts b/TypeScript/9RouterHooks/types/models/enums/ItemEventActions.d.ts new file mode 100644 index 0000000..0e65453 --- /dev/null +++ b/TypeScript/9RouterHooks/types/models/enums/ItemEventActions.d.ts @@ -0,0 +1,19 @@ +export declare enum ItemEventActions { + MOVE = "Move", + REMOVE = "Remove", + SPLIT = "Split", + MERGE = "Merge", + TRANSFER = "Transfer", + SWAP = "Swap", + FOLD = "Fold", + TOGGLE = "Toggle", + TAG = "Tag", + BIND = "Bind", + EXAMINE = "Examine", + READ_ENCYCLOPEDIA = "ReadEncyclopedia", + APPLY_INVENTORY_CHANGES = "ApplyInventoryChanges", + CREATE_MAP_MARKER = "CreateMapMarker", + DELETE_MAP_MARKER = "DeleteMapMarker", + EDIT_MAP_MARKER = "EditMapMarker", + OPEN_RANDOM_LOOT_CONTAINER = "OpenRandomLootContainer" +} diff --git a/TypeScript/9RouterHooks/types/models/enums/WeatherType.d.ts b/TypeScript/9RouterHooks/types/models/enums/WeatherType.d.ts new file mode 100644 index 0000000..d31fefe --- /dev/null +++ b/TypeScript/9RouterHooks/types/models/enums/WeatherType.d.ts @@ -0,0 +1,19 @@ +export declare enum WeatherType { + CLEAR_DAY = 1, + CLEAR_WIND = 2, + CLEAR_NIGHT = 3, + PARTLY_CLOUD_DAY = 4, + PARTLY_CLOUD_NIGHT = 5, + CLEAR_FOG_DAY = 6, + CLEAR_FOG_NIGHT = 7, + CLOUDFOG = 8, + FOG = 9, + MOSTLY_CLOUD = 10, + LIGHT_RAIN = 11, + RAIN = 12, + CLOUD_WIND = 13, + CLOUD_WIND_RAIN = 14, + FULL_CLOUD = 15, + THUNDER_CLOUD = 16, + NONE = 0 +} diff --git a/TypeScript/9RouterHooks/types/models/enums/WildSpawnTypeNumber.d.ts b/TypeScript/9RouterHooks/types/models/enums/WildSpawnTypeNumber.d.ts new file mode 100644 index 0000000..ff806fe --- /dev/null +++ b/TypeScript/9RouterHooks/types/models/enums/WildSpawnTypeNumber.d.ts @@ -0,0 +1,33 @@ +export declare enum WildSpawnTypeNumber { + ASSAULT = 1, + MARKSMAN = 2, + BOSSTEST = 4, + BOSSBULLY = 8, + FOLLOWERTEST = 16, + FOLLOWERBULLY = 32, + BOSSKILLA = 64, + BOSSKOJANIY = 128, + FOLLOWERKOJANIY = 256, + PMCBOT = 512, + CURSEDASSAULT = 1024, + BOSSGLUHAR = 2048, + FOLLOWERGLUHARASSAULT = 4096, + FOLLOWERGLUHARSECURITY = 8192, + FOLLOWERGLUHARSCOUT = 16384, + FOLLOWERGLUHARSNIPE = 32768, + FOLLOWERSANITAR = 65536, + BOSSSANITAR = 131072, + TEST = 262144, + ASSAULTGROUP = 524288, + SECTANTWARRIOR = 1048576, + SECTANTPRIEST = 2097152, + BOSSTAGILLA = 4194304, + FOLLOWERTAGILLA = 8388608, + EXUSEC = 16777216, + GIFTER = 33554432, + BOSSKNIGHT = 67108864, + FOLLOWERBIGPIPE = 134217728, + FOLLOWERBIRDEYE = 268435456, + SPTUSEC = 536870912, + SPTBEAR = 1073741824 +} diff --git a/TypeScript/9RouterHooks/types/models/enums/WindDirection.d.ts b/TypeScript/9RouterHooks/types/models/enums/WindDirection.d.ts new file mode 100644 index 0000000..fb30b20 --- /dev/null +++ b/TypeScript/9RouterHooks/types/models/enums/WindDirection.d.ts @@ -0,0 +1,10 @@ +export declare enum WindDirection { + EAST = 1, + NORTH = 2, + WEST = 3, + SOUTH = 4, + SE = 5, + SW = 6, + NW = 7, + NE = 8 +} diff --git a/TypeScript/9RouterHooks/types/models/spt/config/IBotConfig.d.ts b/TypeScript/9RouterHooks/types/models/spt/config/IBotConfig.d.ts index af8ceba..d6fa5e0 100644 --- a/TypeScript/9RouterHooks/types/models/spt/config/IBotConfig.d.ts +++ b/TypeScript/9RouterHooks/types/models/spt/config/IBotConfig.d.ts @@ -27,6 +27,8 @@ export interface IBotConfig extends IBaseConfig { maxBotCap: Record; /** How many stacks of secret ammo should a bot have in its bot secure container */ secureContainerAmmoStackCount: number; + /** Batch generation size when type not available in cache */ + botGenerationBatchSizePerType: number; } export interface PresetBatch { assault: number; @@ -66,8 +68,12 @@ export interface EquipmentFilters { weaponModLimits: ModLimits; randomisedWeaponModSlots?: string[]; randomisedArmorSlots?: string[]; + faceShieldIsActiveChancePercent?: number; + lightLaserIsActiveChancePercent?: number; blacklist: EquipmentFilterDetails[]; whitelist: EquipmentFilterDetails[]; + clothing: WeightingAdjustmentDetails[]; + weightingAdjustments: WeightingAdjustmentDetails[]; } export interface ModLimits { /** How many scopes are allowed on a weapon - hard coded to work with OPTIC_SCOPE, ASSAULT_SCOPE, COLLIMATOR, COMPACT_COLLIMATOR */ @@ -80,3 +86,8 @@ export interface EquipmentFilterDetails { equipment: Record; cartridge: Record; } +export interface WeightingAdjustmentDetails { + levelRange: MinMax; + add: Record>; + edit: Record>; +} diff --git a/TypeScript/9RouterHooks/types/models/spt/config/IInventoryConfig.d.ts b/TypeScript/9RouterHooks/types/models/spt/config/IInventoryConfig.d.ts index ffffa41..4642b9b 100644 --- a/TypeScript/9RouterHooks/types/models/spt/config/IInventoryConfig.d.ts +++ b/TypeScript/9RouterHooks/types/models/spt/config/IInventoryConfig.d.ts @@ -2,4 +2,10 @@ import { IBaseConfig } from "./IBaseConfig"; export interface IInventoryConfig extends IBaseConfig { kind: "aki-inventory"; newItemsMarkedFound: boolean; + randomLootContainers: Record; +} +export interface RewardDetails { + rewardCount: number; + foundInRaid: boolean; + rewardTplPool: Record; } diff --git a/TypeScript/9RouterHooks/types/models/spt/config/ILocaleConfig.d.ts b/TypeScript/9RouterHooks/types/models/spt/config/ILocaleConfig.d.ts index fe9abf7..0a8955c 100644 --- a/TypeScript/9RouterHooks/types/models/spt/config/ILocaleConfig.d.ts +++ b/TypeScript/9RouterHooks/types/models/spt/config/ILocaleConfig.d.ts @@ -1,5 +1,10 @@ import { IBaseConfig } from "./IBaseConfig"; export interface ILocaleConfig extends IBaseConfig { kind: "aki-locale"; - desiredLocale: string; + /** e.g. ru/en/cn/fr etc, or 'system', will take computer locale setting */ + gameLocale: string; + /** e.g. ru/en/cn/fr etc, or 'system', will take computer locale setting */ + serverLocale: string; + /** Languages server can be translated into */ + serverSupportedLocales: string[]; } diff --git a/TypeScript/9RouterHooks/types/models/spt/config/IPmcConfig.d.ts b/TypeScript/9RouterHooks/types/models/spt/config/IPmcConfig.d.ts index 9db2ba1..48601b2 100644 --- a/TypeScript/9RouterHooks/types/models/spt/config/IPmcConfig.d.ts +++ b/TypeScript/9RouterHooks/types/models/spt/config/IPmcConfig.d.ts @@ -6,9 +6,11 @@ export interface IPmcConfig { looseWeaponInBackpackChancePercent: number; looseWeaponInBackpackLootMinMax: MinMax; isUsec: number; + usecType: string; + bearType: string; chanceSameSideIsHostilePercent: number; /** key: location, value: type for usec/bear */ - pmcType: Record; + pmcType: Record>>; maxBackpackLootTotalRub: number; maxPocketLootTotalRub: number; maxVestLootTotalRub: number; diff --git a/TypeScript/9RouterHooks/types/models/spt/config/IRagfairConfig.d.ts b/TypeScript/9RouterHooks/types/models/spt/config/IRagfairConfig.d.ts index c1b8763..6786417 100644 --- a/TypeScript/9RouterHooks/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/9RouterHooks/types/models/spt/config/IRagfairConfig.d.ts @@ -28,12 +28,8 @@ export interface Reputation { gain: number; loss: number; } -export declare class OfferAdjustment { - maxPriceDifferenceBelowHandbookPercent: number; - handbookPriceMultipier: number; - priceThreshholdRub: number; -} export interface Dynamic { + barter: Barter; offerAdjustment: OfferAdjustment; expiredOfferThreshold: number; offerItemCount: MinMax; @@ -49,6 +45,20 @@ export interface Dynamic { showAsSingleStack: string[]; blacklist: Blacklist; } +export declare class Barter { + enable: boolean; + chancePercent: number; + itemCountMin: number; + itemCountMax: number; + priceRangeVariancePercent: number; + minRoubleCostToBecomeBarter: number; + itemTypeBlacklist: string[]; +} +export declare class OfferAdjustment { + maxPriceDifferenceBelowHandbookPercent: number; + handbookPriceMultipier: number; + priceThreshholdRub: number; +} export interface Condition { conditionChance: number; min: number; diff --git a/TypeScript/9RouterHooks/types/models/spt/config/ISeasonalEventConfig.d.ts b/TypeScript/9RouterHooks/types/models/spt/config/ISeasonalEventConfig.d.ts index bc60618..e410925 100644 --- a/TypeScript/9RouterHooks/types/models/spt/config/ISeasonalEventConfig.d.ts +++ b/TypeScript/9RouterHooks/types/models/spt/config/ISeasonalEventConfig.d.ts @@ -1,6 +1,9 @@ import { IBaseConfig } from "./IBaseConfig"; export interface ISeasonalEventConfig extends IBaseConfig { kind: "aki-seasonalevents"; + enableSeasonalEventDetection: boolean; + /** event / botType / equipSlot / itemid */ + eventGear: Record>>>; events: ISeasonalEvent[]; } export interface ISeasonalEvent { diff --git a/TypeScript/9RouterHooks/types/models/spt/config/IWeatherConfig.d.ts b/TypeScript/9RouterHooks/types/models/spt/config/IWeatherConfig.d.ts index bbdc43e..41a1c83 100644 --- a/TypeScript/9RouterHooks/types/models/spt/config/IWeatherConfig.d.ts +++ b/TypeScript/9RouterHooks/types/models/spt/config/IWeatherConfig.d.ts @@ -1,3 +1,4 @@ +import { WindDirection } from "../../../models/enums/WindDirection"; import { MinMax } from "../../common/MinMax"; import { IBaseConfig } from "./IBaseConfig"; export interface IWeatherConfig extends IBaseConfig { @@ -7,12 +8,16 @@ export interface IWeatherConfig extends IBaseConfig { } export interface Weather { clouds: MinMax; - windSpeed: MinMax; - windDirection: MinMax; + windSpeed: WeatherSettings; + windDirection: WeatherSettings; windGustiness: MinMax; - rain: MinMax; + rain: WeatherSettings; rainIntensity: MinMax; - fog: MinMax; + fog: WeatherSettings; temp: MinMax; pressure: MinMax; } +export interface WeatherSettings { + values: T[]; + weights: number[]; +} diff --git a/TypeScript/9RouterHooks/types/routers/item_events/HideoutItemEventRouter.d.ts b/TypeScript/9RouterHooks/types/routers/item_events/HideoutItemEventRouter.d.ts index e1e98af..44bd1cd 100644 --- a/TypeScript/9RouterHooks/types/routers/item_events/HideoutItemEventRouter.d.ts +++ b/TypeScript/9RouterHooks/types/routers/item_events/HideoutItemEventRouter.d.ts @@ -1,7 +1,7 @@ -import { IPmcData } from "../../models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "../../models/eft/itemEvent/IItemEventRouterResponse"; import { HideoutCallbacks } from "../../callbacks/HideoutCallbacks"; import { HandledRoute, ItemEventRouterDefinition } from "../../di/Router"; +import { IPmcData } from "../../models/eft/common/IPmcData"; +import { IItemEventRouterResponse } from "../../models/eft/itemEvent/IItemEventRouterResponse"; export declare class HideoutItemEventRouter extends ItemEventRouterDefinition { protected hideoutCallbacks: HideoutCallbacks; constructor(hideoutCallbacks: HideoutCallbacks); diff --git a/TypeScript/9RouterHooks/types/routers/item_events/InventoryItemEventRouter.d.ts b/TypeScript/9RouterHooks/types/routers/item_events/InventoryItemEventRouter.d.ts index 2619bb9..953d322 100644 --- a/TypeScript/9RouterHooks/types/routers/item_events/InventoryItemEventRouter.d.ts +++ b/TypeScript/9RouterHooks/types/routers/item_events/InventoryItemEventRouter.d.ts @@ -1,7 +1,7 @@ -import { IPmcData } from "../../models/eft/common/IPmcData"; -import { IItemEventRouterResponse } from "../../models/eft/itemEvent/IItemEventRouterResponse"; import { InventoryCallbacks } from "../../callbacks/InventoryCallbacks"; import { HandledRoute, ItemEventRouterDefinition } from "../../di/Router"; +import { IPmcData } from "../../models/eft/common/IPmcData"; +import { IItemEventRouterResponse } from "../../models/eft/itemEvent/IItemEventRouterResponse"; export declare class InventoryItemEventRouter extends ItemEventRouterDefinition { protected inventoryCallbacks: InventoryCallbacks; constructor(inventoryCallbacks: InventoryCallbacks); diff --git a/TypeScript/9RouterHooks/types/servers/HttpServer.d.ts b/TypeScript/9RouterHooks/types/servers/HttpServer.d.ts index bbca8af..80c1d48 100644 --- a/TypeScript/9RouterHooks/types/servers/HttpServer.d.ts +++ b/TypeScript/9RouterHooks/types/servers/HttpServer.d.ts @@ -4,6 +4,7 @@ import { ApplicationContext } from "../context/ApplicationContext"; import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; import { ILogger } from "../models/spt/utils/ILogger"; +import { LocalisationService } from "../services/LocalisationService"; import { ConfigServer } from "./ConfigServer"; import { DatabaseServer } from "./DatabaseServer"; import { IHttpListener } from "./http/IHttpListener"; @@ -12,11 +13,12 @@ export declare class HttpServer { protected logger: ILogger; protected databaseServer: DatabaseServer; protected httpServerHelper: HttpServerHelper; + protected localisationService: LocalisationService; protected httpListeners: IHttpListener[]; protected configServer: ConfigServer; protected applicationContext: ApplicationContext; protected webSocketServer: WebSocketServer; - constructor(logger: ILogger, databaseServer: DatabaseServer, httpServerHelper: HttpServerHelper, httpListeners: IHttpListener[], configServer: ConfigServer, applicationContext: ApplicationContext, webSocketServer: WebSocketServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, httpServerHelper: HttpServerHelper, localisationService: LocalisationService, httpListeners: IHttpListener[], configServer: ConfigServer, applicationContext: ApplicationContext, webSocketServer: WebSocketServer); protected httpConfig: IHttpConfig; getCookies(req: http.IncomingMessage): any; handleRequest(req: IncomingMessage, resp: ServerResponse): void; diff --git a/TypeScript/9RouterHooks/types/servers/SaveServer.d.ts b/TypeScript/9RouterHooks/types/servers/SaveServer.d.ts index cb28f49..4dca514 100644 --- a/TypeScript/9RouterHooks/types/servers/SaveServer.d.ts +++ b/TypeScript/9RouterHooks/types/servers/SaveServer.d.ts @@ -1,20 +1,22 @@ +import { SaveLoadRouter } from "../di/Router"; import { IAkiProfile, Info } from "../models/eft/profile/IAkiProfile"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { LocalisationService } from "../services/LocalisationService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { VFS } from "../utils/VFS"; -import { SaveLoadRouter } from "../di/Router"; -import { ILogger } from "../models/spt/utils/ILogger"; export declare class SaveServer { protected vfs: VFS; protected saveLoadRouters: SaveLoadRouter[]; protected jsonUtil: JsonUtil; protected hashUtil: HashUtil; + protected localisationService: LocalisationService; protected logger: ILogger; protected profileFilepath: string; protected profiles: {}; protected onSave: {}; protected saveMd5: {}; - constructor(vfs: VFS, saveLoadRouters: SaveLoadRouter[], jsonUtil: JsonUtil, hashUtil: HashUtil, logger: ILogger); + constructor(vfs: VFS, saveLoadRouters: SaveLoadRouter[], jsonUtil: JsonUtil, hashUtil: HashUtil, localisationService: LocalisationService, logger: ILogger); load(): void; save(): void; getProfile(sessionId: string): IAkiProfile; diff --git a/TypeScript/9RouterHooks/types/servers/WebSocketServer.d.ts b/TypeScript/9RouterHooks/types/servers/WebSocketServer.d.ts index f33d214..5d40e6e 100644 --- a/TypeScript/9RouterHooks/types/servers/WebSocketServer.d.ts +++ b/TypeScript/9RouterHooks/types/servers/WebSocketServer.d.ts @@ -1,18 +1,20 @@ /// -import { HttpServerHelper } from "../helpers/HttpServerHelper"; -import WebSocket from "ws"; import http, { IncomingMessage } from "http"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { RandomUtil } from "../utils/RandomUtil"; +import WebSocket from "ws"; +import { HttpServerHelper } from "../helpers/HttpServerHelper"; import { INotification } from "../models/eft/notifier/INotifier"; -import { ConfigServer } from "./ConfigServer"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { LocalisationService } from "../services/LocalisationService"; +import { RandomUtil } from "../utils/RandomUtil"; +import { ConfigServer } from "./ConfigServer"; export declare class WebSocketServer { protected logger: ILogger; protected randomUtil: RandomUtil; protected configServer: ConfigServer; + protected localisationService: LocalisationService; protected httpServerHelper: HttpServerHelper; - constructor(logger: ILogger, randomUtil: RandomUtil, configServer: ConfigServer, httpServerHelper: HttpServerHelper); + constructor(logger: ILogger, randomUtil: RandomUtil, configServer: ConfigServer, localisationService: LocalisationService, httpServerHelper: HttpServerHelper); protected httpConfig: IHttpConfig; protected defaultNotification: INotification; protected webSockets: Record; diff --git a/TypeScript/9RouterHooks/types/servers/http/AkiHttpListener.d.ts b/TypeScript/9RouterHooks/types/servers/http/AkiHttpListener.d.ts index 6f78939..acf92aa 100644 --- a/TypeScript/9RouterHooks/types/servers/http/AkiHttpListener.d.ts +++ b/TypeScript/9RouterHooks/types/servers/http/AkiHttpListener.d.ts @@ -1,22 +1,24 @@ /// /// import { IncomingMessage, ServerResponse } from "http"; -import { IHttpListener } from "./IHttpListener"; import { Serializer } from "../../di/Serializer"; import { ILogger } from "../../models/spt/utils/ILogger"; import { HttpRouter } from "../../routers/HttpRouter"; +import { LocalisationService } from "../../services/LocalisationService"; import { HttpResponseUtil } from "../../utils/HttpResponseUtil"; import { JsonUtil } from "../../utils/JsonUtil"; import { HttpBufferHandler } from "./HttpBufferHandler"; +import { IHttpListener } from "./IHttpListener"; export declare class AkiHttpListener implements IHttpListener { protected httpRouter: HttpRouter; protected serializers: Serializer[]; protected logger: ILogger; protected jsonUtil: JsonUtil; protected httpResponse: HttpResponseUtil; + protected localisationService: LocalisationService; protected httpBufferHandler: HttpBufferHandler; constructor(httpRouter: HttpRouter, // TODO: delay required - serializers: Serializer[], logger: ILogger, jsonUtil: JsonUtil, httpResponse: HttpResponseUtil, httpBufferHandler: HttpBufferHandler); + serializers: Serializer[], logger: ILogger, jsonUtil: JsonUtil, httpResponse: HttpResponseUtil, localisationService: LocalisationService, httpBufferHandler: HttpBufferHandler); canHandle(_: string, req: IncomingMessage): boolean; handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): void; sendResponse(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: Buffer, output: string): void; diff --git a/TypeScript/9RouterHooks/types/services/BotEquipmentFilterService.d.ts b/TypeScript/9RouterHooks/types/services/BotEquipmentFilterService.d.ts index 632f961..ae72cc3 100644 --- a/TypeScript/9RouterHooks/types/services/BotEquipmentFilterService.d.ts +++ b/TypeScript/9RouterHooks/types/services/BotEquipmentFilterService.d.ts @@ -1,12 +1,12 @@ import { IBotType } from "../models/eft/common/tables/IBotType"; -import { EquipmentFilters, EquipmentFilterDetails, IBotConfig } from "../models/spt/config/IBotConfig"; +import { EquipmentFilters, EquipmentFilterDetails, IBotConfig, WeightingAdjustmentDetails } from "../models/spt/config/IBotConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; export declare class BotEquipmentFilterService { protected logger: ILogger; protected configServer: ConfigServer; protected botConfig: IBotConfig; - protected botEquipmentFilterlists: Record; + protected botEquipmentConfig: Record; constructor(logger: ILogger, configServer: ConfigServer); /** * Filter a bots data to exclude equipment and cartridges defines in the botConfig @@ -30,6 +30,20 @@ export declare class BotEquipmentFilterService { * @returns EquipmentFilterDetails object */ protected getBotEquipmentWhitelist(botRole: string, playerLevel: number): EquipmentFilterDetails; + /** + * Retreive clothing weighting adjustments from bot.json config + * @param botRole Bot type to get adjustments for + * @param playerLevel level of player + * @returns Weighting adjustments for bots clothing + */ + protected getBotClothingAdjustments(botRole: string, playerLevel: number): WeightingAdjustmentDetails; + /** + * Retreive item weighting adjustments from bot.json config + * @param botRole Bot type to get adjustments for + * @param playerLevel level of player + * @returns Weighting adjustments for bot items + */ + protected getBotWeightingAdjustments(botRole: string, playerLevel: number): WeightingAdjustmentDetails; /** * Filter bot equipment based on blacklist and whitelist from config/bot.json * Prioritises whitelist first, if one is found blacklist is ignored @@ -47,4 +61,10 @@ export declare class BotEquipmentFilterService { * @returns Filtered bot file */ protected filterCartridges(baseBotNode: IBotType, blacklist: EquipmentFilterDetails, whitelist: EquipmentFilterDetails): void; + /** + * Add/Edit weighting changes to bot items using values from config/bot.json/equipment + * @param weightingAdjustments Weighting change to apply to bot + * @param botItemPool Bot item dictionary to adjust + */ + protected adjustWeighting(weightingAdjustments: WeightingAdjustmentDetails, botItemPool: Record): void; } diff --git a/TypeScript/9RouterHooks/types/services/BotGenerationCacheService.d.ts b/TypeScript/9RouterHooks/types/services/BotGenerationCacheService.d.ts index ba53fec..0be0576 100644 --- a/TypeScript/9RouterHooks/types/services/BotGenerationCacheService.d.ts +++ b/TypeScript/9RouterHooks/types/services/BotGenerationCacheService.d.ts @@ -8,11 +8,11 @@ export declare class BotGenerationCacheService { protected randomUtil: RandomUtil; protected jsonUtil: JsonUtil; protected botHelper: BotHelper; - protected storedBots: IBotBase[]; + protected storedBots: Map; constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, botHelper: BotHelper); /** * Store array of bots in cache, shuffle results before storage - * @param botsToStore + * @param botsToStore Bots we want to store in the cache */ storeBots(botsToStore: IBotBase[]): void; /** @@ -21,25 +21,7 @@ export declare class BotGenerationCacheService { * @param role role to retreive (assault/bossTagilla etc) * @returns IBotBase object */ - getBot(role: string): IBotBase[]; - /** - * Find a bot by its index from cache - * @param indexOfBotToReturn index to find bot by - * @returns bot profile - */ - protected getBotFromCache(indexOfBotToReturn: number): IBotBase; - /** - * Remove bot profile by index from cache - * @param indexOfBotToReturn Index of bot profile to remove - */ - protected removeBotFromCache(indexOfBotToReturn: number): void; - /** - * Get index of bot profile that matches criteria - * @param role Role of bot wanted - * @param getPmc Requested bot a pmc - * @returns index of found bot, -1 if not found - */ - protected getIndexOfBotToReturn(role: string, getPmc: boolean): number; + getBot(role: string): IBotBase; /** * Remove all cached bot profiles */ @@ -48,5 +30,5 @@ export declare class BotGenerationCacheService { * Does cache have bots * @returns true if empty */ - cacheIsEmpty(): boolean; + cacheHasBotOfRole(role: string): boolean; } diff --git a/TypeScript/9RouterHooks/types/services/LocaleService.d.ts b/TypeScript/9RouterHooks/types/services/LocaleService.d.ts index 33bea7b..8275b75 100644 --- a/TypeScript/9RouterHooks/types/services/LocaleService.d.ts +++ b/TypeScript/9RouterHooks/types/services/LocaleService.d.ts @@ -1,14 +1,42 @@ import { ILocaleConfig } from "../models/spt/config/ILocaleConfig"; +import { ILocaleGlobalBase } from "../models/spt/server/ILocaleBase"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { DatabaseServer } from "../servers/DatabaseServer"; +/** + * Handles getting locales from config or users machine + */ export declare class LocaleService { protected logger: ILogger; + protected databaseServer: DatabaseServer; protected configServer: ConfigServer; protected localeConfig: ILocaleConfig; - constructor(logger: ILogger, configServer: ConfigServer); + constructor(logger: ILogger, databaseServer: DatabaseServer, configServer: ConfigServer); /** - * Gets the locale key from the locale.json file + * Get the eft globals db file based on the configured locale in config/locale.json, if not found, fall back to 'en' + * @returns ILocaleGlobalBase + */ + getLocaleDb(): ILocaleGlobalBase; + /** + * Gets the game locale key from the locale.json file, + * if value is 'system' get system locale * @returns locale e.g en/ge/cz/cn */ - getDesiredLocale(): string; + getDesiredGameLocale(): string; + /** + * Gets the game locale key from the locale.json file, + * if value is 'system' get system locale + * @returns locale e.g en/ge/cz/cn + */ + getDesiredServerLocale(): string; + /** + * Get array of languages supported for localisation + * @returns array of locales e.g. en/fr/cn + */ + getServerSupportedLocales(): string[]; + /** + * Get the locale of the computer running the server + * @returns langage part of locale e.g. 'en' part of 'en-US' + */ + protected getPlatformLocale(): string; } diff --git a/TypeScript/9RouterHooks/types/services/LocalisationService.d.ts b/TypeScript/9RouterHooks/types/services/LocalisationService.d.ts new file mode 100644 index 0000000..519325d --- /dev/null +++ b/TypeScript/9RouterHooks/types/services/LocalisationService.d.ts @@ -0,0 +1,21 @@ +import { I18n } from "i18n"; +import { ILocaleConfig } from "../models/spt/config/ILocaleConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { LocaleService } from "./LocaleService"; +/** + * Handles translating server text into different langauges + */ +export declare class LocalisationService { + protected logger: ILogger; + protected localeService: LocaleService; + protected localeConfig: ILocaleConfig; + protected i18n: I18n; + constructor(logger: ILogger, localeService: LocaleService); + /** + * Get a localised value using the passed in key + * @param key Key to loop up locale for + * @param args optional arguments + * @returns Localised string + */ + getText(key: string, args?: any): string; +} diff --git a/TypeScript/9RouterHooks/types/services/PaymentService.d.ts b/TypeScript/9RouterHooks/types/services/PaymentService.d.ts index a5e538f..c9ce95a 100644 --- a/TypeScript/9RouterHooks/types/services/PaymentService.d.ts +++ b/TypeScript/9RouterHooks/types/services/PaymentService.d.ts @@ -11,6 +11,7 @@ import { IProcessSellTradeRequestData } from "../models/eft/trade/IProcessSellTr import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; +import { LocalisationService } from "./LocalisationService"; export declare class PaymentService { protected logger: ILogger; protected httpResponse: HttpResponseUtil; @@ -19,8 +20,9 @@ export declare class PaymentService { protected traderHelper: TraderHelper; protected itemHelper: ItemHelper; protected inventoryHelper: InventoryHelper; + protected localisationService: LocalisationService; protected paymentHelper: PaymentHelper; - constructor(logger: ILogger, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, traderHelper: TraderHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, paymentHelper: PaymentHelper); + constructor(logger: ILogger, httpResponse: HttpResponseUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, traderHelper: TraderHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, localisationService: LocalisationService, paymentHelper: PaymentHelper); /** * Take money and insert items into return to server request * @param {Object} pmcData @@ -50,7 +52,7 @@ export declare class PaymentService { * @param pmcData Player profile to find and remove currency from * @param currencyTpl Type of currency to pay * @param amountToPay money value to pay - * @param sessionID Sessino id + * @param sessionID Session id * @param output output object to send to client * @returns IItemEventRouterResponse */ diff --git a/TypeScript/9RouterHooks/types/services/PlayerService.d.ts b/TypeScript/9RouterHooks/types/services/PlayerService.d.ts index 519b7e5..2f364d5 100644 --- a/TypeScript/9RouterHooks/types/services/PlayerService.d.ts +++ b/TypeScript/9RouterHooks/types/services/PlayerService.d.ts @@ -2,10 +2,12 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { IPlayerIncrementSkillLevelRequestData } from "../models/eft/player/IPlayerIncrementSkillLevelRequestData"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "./LocalisationService"; export declare class PlayerService { protected logger: ILogger; + protected localisationService: LocalisationService; protected databaseServer: DatabaseServer; - constructor(logger: ILogger, databaseServer: DatabaseServer); + constructor(logger: ILogger, localisationService: LocalisationService, databaseServer: DatabaseServer); /** * increases the profile skill and updates any output * @param {Object} pmcData diff --git a/TypeScript/9RouterHooks/types/services/PmcAiService.d.ts b/TypeScript/9RouterHooks/types/services/PmcAiService.d.ts deleted file mode 100644 index 0690f1f..0000000 --- a/TypeScript/9RouterHooks/types/services/PmcAiService.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { IBotConfig } from "../models/spt/config/IBotConfig"; -import { ILogger } from "../models/spt/utils/ILogger"; -import { ConfigServer } from "../servers/ConfigServer"; -/** Storing/retreving pmcRoles set at the start of a raid - its done at that point as we know what location the player is heading to */ -export declare class PmcAiService { - protected logger: ILogger; - protected configServer: ConfigServer; - protected botConfig: IBotConfig; - protected usecRole: string; - protected bearRole: string; - constructor(logger: ILogger, configServer: ConfigServer); - /** - * Convert from pmc side (usec/bear) to the side as defined in the bot config (usecType/bearType) - * @param pmcSide eft side (usec/bear) - * @returns pmc side as defined in config - */ - getPmcRole(pmcSide: "usec" | "bear" | string): string; - /** - * Set the roles for pmcs - * @param location map location to look up and use as pmc types - */ - setPmcRolesByLocation(location: string): void; - /** - * Clear the saved role from usec/bear PMCs - */ - clearPmcRoles(): void; -} diff --git a/TypeScript/9RouterHooks/types/services/ProfileFixerService.d.ts b/TypeScript/9RouterHooks/types/services/ProfileFixerService.d.ts index e772919..86a6af8 100644 --- a/TypeScript/9RouterHooks/types/services/ProfileFixerService.d.ts +++ b/TypeScript/9RouterHooks/types/services/ProfileFixerService.d.ts @@ -8,12 +8,14 @@ import { HideoutAreas } from "../models/enums/HideoutAreas"; import { ILogger } from "../models/spt/utils/ILogger"; import { DatabaseServer } from "../servers/DatabaseServer"; import { Watermark } from "../utils/Watermark"; +import { LocalisationService } from "./LocalisationService"; export declare class ProfileFixerService { protected logger: ILogger; protected watermark: Watermark; protected hideoutHelper: HideoutHelper; + protected localisationService: LocalisationService; protected databaseServer: DatabaseServer; - constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, databaseServer: DatabaseServer); + constructor(logger: ILogger, watermark: Watermark, hideoutHelper: HideoutHelper, localisationService: LocalisationService, databaseServer: DatabaseServer); /** * Find issues in the pmc profile data that may cause issues and fix them * @param pmcProfile profile to check and fix diff --git a/TypeScript/9RouterHooks/types/services/RagfairOfferService.d.ts b/TypeScript/9RouterHooks/types/services/RagfairOfferService.d.ts index a6f6b6d..86c1e52 100644 --- a/TypeScript/9RouterHooks/types/services/RagfairOfferService.d.ts +++ b/TypeScript/9RouterHooks/types/services/RagfairOfferService.d.ts @@ -11,6 +11,7 @@ import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; import { HttpResponseUtil } from "../utils/HttpResponseUtil"; import { TimeUtil } from "../utils/TimeUtil"; +import { LocalisationService } from "./LocalisationService"; import { RagfairCategoriesService } from "./RagfairCategoriesService"; export declare class RagfairOfferService { protected logger: ILogger; @@ -22,12 +23,14 @@ export declare class RagfairOfferService { protected profileHelper: ProfileHelper; protected eventOutputHolder: EventOutputHolder; protected httpResponse: HttpResponseUtil; + protected localisationService: LocalisationService; protected configServer: ConfigServer; protected playerOffersLoaded: boolean; protected expiredOffers: Item[]; - protected offers: IRagfairOffer[]; + /** offerId, offer */ + protected offers: Record; protected ragfairConfig: IRagfairConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, databaseServer: DatabaseServer, saveServer: SaveServer, ragfairServerHelper: RagfairServerHelper, ragfairCategoriesService: RagfairCategoriesService, profileHelper: ProfileHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, databaseServer: DatabaseServer, saveServer: SaveServer, ragfairServerHelper: RagfairServerHelper, ragfairCategoriesService: RagfairCategoriesService, profileHelper: ProfileHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, localisationService: LocalisationService, configServer: ConfigServer); /** * Get all offers * @returns IRagfairOffer array diff --git a/TypeScript/9RouterHooks/types/utils/App.d.ts b/TypeScript/9RouterHooks/types/utils/App.d.ts index dcc2669..cc8a5af 100644 --- a/TypeScript/9RouterHooks/types/utils/App.d.ts +++ b/TypeScript/9RouterHooks/types/utils/App.d.ts @@ -1,14 +1,16 @@ -import { TimeUtil } from "./TimeUtil"; import { OnLoad } from "../di/OnLoad"; import { OnUpdate } from "../di/OnUpdate"; import { ILogger } from "../models/spt/utils/ILogger"; +import { LocalisationService } from "../services/LocalisationService"; +import { TimeUtil } from "./TimeUtil"; export declare class App { protected logger: ILogger; protected timeUtil: TimeUtil; + protected localisationService: LocalisationService; protected onLoadComponents: OnLoad[]; protected onUpdateComponents: OnUpdate[]; protected onUpdateLastRun: {}; - constructor(logger: ILogger, timeUtil: TimeUtil, onLoadComponents: OnLoad[], onUpdateComponents: OnUpdate[]); + constructor(logger: ILogger, timeUtil: TimeUtil, localisationService: LocalisationService, onLoadComponents: OnLoad[], onUpdateComponents: OnUpdate[]); load(): void; protected update(onUpdateComponents: OnUpdate[]): void; protected logUpdateException(err: any, updateable: OnUpdate): void; diff --git a/TypeScript/9RouterHooks/types/utils/DatabaseImporter.d.ts b/TypeScript/9RouterHooks/types/utils/DatabaseImporter.d.ts index 483e135..31670ae 100644 --- a/TypeScript/9RouterHooks/types/utils/DatabaseImporter.d.ts +++ b/TypeScript/9RouterHooks/types/utils/DatabaseImporter.d.ts @@ -3,15 +3,17 @@ import { IDatabaseTables } from "../models/spt/server/IDatabaseTables"; import { ILogger } from "../models/spt/utils/ILogger"; import { ImageRouter } from "../routers/ImageRouter"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocalisationService } from "../services/LocalisationService"; import { JsonUtil } from "./JsonUtil"; import { VFS } from "./VFS"; export declare class DatabaseImporter extends OnLoad { protected logger: ILogger; protected vfs: VFS; protected jsonUtil: JsonUtil; + protected localisationService: LocalisationService; protected databaseServer: DatabaseServer; protected imageRouter: ImageRouter; - constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, databaseServer: DatabaseServer, imageRouter: ImageRouter); + constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, localisationService: LocalisationService, databaseServer: DatabaseServer, imageRouter: ImageRouter); onLoad(): void; /** * Read all json files in database folder and map into a json object diff --git a/TypeScript/9RouterHooks/types/utils/HttpResponseUtil.d.ts b/TypeScript/9RouterHooks/types/utils/HttpResponseUtil.d.ts index 29502be..3a78618 100644 --- a/TypeScript/9RouterHooks/types/utils/HttpResponseUtil.d.ts +++ b/TypeScript/9RouterHooks/types/utils/HttpResponseUtil.d.ts @@ -1,10 +1,13 @@ -import { JsonUtil } from "./JsonUtil"; import { IGetBodyResponseData } from "../models/eft/httpResponse/IGetBodyResponseData"; import { INullResponseData } from "../models/eft/httpResponse/INullResponseData"; import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse"; +import { BackendErrorCodes } from "../models/enums/BackendErrorCodes"; +import { LocalisationService } from "../services/LocalisationService"; +import { JsonUtil } from "./JsonUtil"; export declare class HttpResponseUtil { protected jsonUtil: JsonUtil; - constructor(jsonUtil: JsonUtil); + protected localisationService: LocalisationService; + constructor(jsonUtil: JsonUtil, localisationService: LocalisationService); protected clearString(s: string): any; noBody(data: any): any; getBody(data: T, err?: number, errmsg?: any): IGetBodyResponseData; @@ -12,5 +15,5 @@ export declare class HttpResponseUtil { emptyResponse(): IGetBodyResponseData; nullResponse(): INullResponseData; emptyArrayResponse(): IGetBodyResponseData; - appendErrorToOutput(output: IItemEventRouterResponse, message?: string, title?: string): IItemEventRouterResponse; + appendErrorToOutput(output: IItemEventRouterResponse, message?: string, errorCode?: BackendErrorCodes): IItemEventRouterResponse; } diff --git a/TypeScript/9RouterHooks/types/utils/RandomUtil.d.ts b/TypeScript/9RouterHooks/types/utils/RandomUtil.d.ts index 633e472..aa556e3 100644 --- a/TypeScript/9RouterHooks/types/utils/RandomUtil.d.ts +++ b/TypeScript/9RouterHooks/types/utils/RandomUtil.d.ts @@ -110,6 +110,12 @@ export declare class RandomUtil { getIntEx(max: number): number; getFloat(min: number, max: number): number; getBool(): boolean; + /** + * Check if number passes a check out of 100 + * @param chancePercent value check needs to be above + * @returns true if value passes check + */ + getChance100(chancePercent: number): boolean; getStringArrayValue(arr: string[]): string; getArrayValue(arr: T[]): T; getKey(node: any): string; diff --git a/TypeScript/9RouterHooks/types/utils/Watermark.d.ts b/TypeScript/9RouterHooks/types/utils/Watermark.d.ts index c6dc120..e02eba2 100644 --- a/TypeScript/9RouterHooks/types/utils/Watermark.d.ts +++ b/TypeScript/9RouterHooks/types/utils/Watermark.d.ts @@ -1,20 +1,15 @@ import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { LocalisationService } from "../services/LocalisationService"; export declare class WatermarkLocale { - protected locales: { - "en-US": { - description: string[]; - warning: string[]; - modding: string[]; - }; - "zh-CN": { - description: string[]; - warning: string[]; - modding: string[]; - }; + protected localisationService: LocalisationService; + constructor(localisationService: LocalisationService); + protected watermark: { + description: string[]; + warning: string[]; + modding: string[]; }; - getLocale(): string; getDescription(): string[]; getWarning(): string[]; getModding(): string[]; @@ -22,9 +17,10 @@ export declare class WatermarkLocale { export declare class Watermark { protected logger: ILogger; protected configServer: ConfigServer; + protected localisationService: LocalisationService; protected watermarkLocale?: WatermarkLocale; protected akiConfig: ICoreConfig; - constructor(logger: ILogger, configServer: ConfigServer, watermarkLocale?: WatermarkLocale); + constructor(logger: ILogger, configServer: ConfigServer, localisationService: LocalisationService, watermarkLocale?: WatermarkLocale); protected text: string[]; protected versionLabel: string; initialize(): void;