Co-authored-by: Dev <dev@dev.sp-tarkov.com>
Reviewed-on: #24
This commit is contained in:
chomp 2024-04-04 21:29:42 +00:00
parent abbd1e9649
commit 36f643f3a6
5614 changed files with 77106 additions and 38681 deletions

View File

@ -1,4 +1,4 @@
# Mod examples for v3.7.6
# Mod examples for v3.8.0
A collection of example mods that perform typical actions in SPT

View File

@ -4,7 +4,7 @@
"main": "src/mod.js",
"license": "MIT",
"author": "Chomp",
"akiVersion": "~3.7",
"akiVersion": "~3.8",
"loadBefore": [],
"loadAfter": [],
"incompatibilities": [],
@ -15,16 +15,16 @@
"buildinfo": "node ./build.mjs --verbose"
},
"devDependencies": {
"@types/node": "18.18.4",
"@typescript-eslint/eslint-plugin": "6.7.5",
"@typescript-eslint/parser": "6.7.5",
"@types/node": "20.11",
"@typescript-eslint/eslint-plugin": "7.2",
"@typescript-eslint/parser": "7.2",
"archiver": "^6.0",
"eslint": "8.51.0",
"fs-extra": "^11.1",
"eslint": "8.57",
"fs-extra": "11.2",
"ignore": "^5.2",
"os": "^0.1",
"tsyringe": "4.8.0",
"typescript": "5.2.2",
"winston": "3.11.0"
"typescript": "5.4",
"winston": "3.12"
}
}

View File

@ -2,5 +2,5 @@ export declare class ErrorHandler {
private logger;
private readLine;
constructor();
handleCriticalError(err: any): void;
handleCriticalError(err: Error): void;
}

View File

@ -1,5 +1,5 @@
export declare class Program {
private errorHandler;
constructor();
start(): void;
start(): Promise<void>;
}

View File

@ -0,0 +1,21 @@
import { AchievementController } from "@spt-aki/controllers/AchievementController";
import { ProfileController } from "@spt-aki/controllers/ProfileController";
import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData";
import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData";
import { ICompletedAchievementsResponse } from "@spt-aki/models/eft/profile/ICompletedAchievementsResponse";
import { IGetAchievementsResponse } from "@spt-aki/models/eft/profile/IGetAchievementsResponse";
import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil";
export declare class AchievementCallbacks {
protected achievementController: AchievementController;
protected profileController: ProfileController;
protected httpResponse: HttpResponseUtil;
constructor(achievementController: AchievementController, profileController: ProfileController, httpResponse: HttpResponseUtil);
/**
* Handle client/achievement/list
*/
getAchievements(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<IGetAchievementsResponse>;
/**
* Handle client/achievement/statistic
*/
statistic(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<ICompletedAchievementsResponse>;
}

View File

@ -0,0 +1,34 @@
import { BuildController } from "@spt-aki/controllers/BuildController";
import { ISetMagazineRequest } from "@spt-aki/models/eft/builds/ISetMagazineRequest";
import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData";
import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData";
import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData";
import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData";
import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData";
import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile";
import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil";
export declare class BuildsCallbacks {
protected httpResponse: HttpResponseUtil;
protected buildController: BuildController;
constructor(httpResponse: HttpResponseUtil, buildController: BuildController);
/**
* Handle client/builds/list
*/
getBuilds(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<IUserBuilds>;
/**
* Handle client/builds/magazine/save
*/
createMagazineTemplate(url: string, request: ISetMagazineRequest, sessionID: string): INullResponseData;
/**
* Handle client/builds/weapon/save
*/
setWeapon(url: string, info: IPresetBuildActionRequestData, sessionID: string): INullResponseData;
/**
* Handle client/builds/equipment/save
*/
setEquipment(url: string, info: IPresetBuildActionRequestData, sessionID: string): INullResponseData;
/**
* Handle client/builds/delete
*/
deleteBuild(url: string, info: IRemoveBuildRequestData, sessionID: string): INullResponseData;
}

View File

@ -1,18 +1,13 @@
import { BundleLoader } from "@spt-aki/loaders/BundleLoader";
import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig";
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
import { ConfigServer } from "@spt-aki/servers/ConfigServer";
import { HttpFileUtil } from "@spt-aki/utils/HttpFileUtil";
import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil";
export declare class BundleCallbacks {
protected logger: ILogger;
protected httpResponse: HttpResponseUtil;
protected httpFileUtil: HttpFileUtil;
protected bundleLoader: BundleLoader;
protected configServer: ConfigServer;
protected httpConfig: IHttpConfig;
constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, bundleLoader: BundleLoader, configServer: ConfigServer);
sendBundle(sessionID: string, req: any, resp: any, body: any): void;
constructor(httpResponse: HttpResponseUtil, bundleLoader: BundleLoader, configServer: ConfigServer);
/**
* Handle singleplayer/bundles
*/

View File

@ -1,14 +1,28 @@
import { ClientLogController } from "@spt-aki/controllers/ClientLogController";
import { ModLoadOrder } from "@spt-aki/loaders/ModLoadOrder";
import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData";
import { IClientLogRequest } from "@spt-aki/models/spt/logging/IClientLogRequest";
import { ConfigServer } from "@spt-aki/servers/ConfigServer";
import { LocalisationService } from "@spt-aki/services/LocalisationService";
import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil";
/** Handle client logging related events */
export declare class ClientLogCallbacks {
protected httpResponse: HttpResponseUtil;
protected clientLogController: ClientLogController;
constructor(httpResponse: HttpResponseUtil, clientLogController: ClientLogController);
protected configServer: ConfigServer;
protected localisationService: LocalisationService;
protected modLoadOrder: ModLoadOrder;
constructor(httpResponse: HttpResponseUtil, clientLogController: ClientLogController, configServer: ConfigServer, localisationService: LocalisationService, modLoadOrder: ModLoadOrder);
/**
* Handle /singleplayer/log
*/
clientLog(url: string, info: IClientLogRequest, sessionID: string): INullResponseData;
/**
* Handle /singleplayer/release
*/
releaseNotes(): string;
/**
* Handle /singleplayer/enableBSGlogging
*/
bsgLogging(): string;
}

View File

@ -71,8 +71,8 @@ export declare class GameCallbacks implements OnLoad {
getVersion(url: string, info: IEmptyRequestData, sessionID: string): string;
reportNickname(url: string, info: IReportNicknameRequestData, sessionID: string): INullResponseData;
/**
* Handle singleplayer/settings/getRaidTime
* @returns string
*/
* Handle singleplayer/settings/getRaidTime
* @returns string
*/
getRaidTime(url: string, request: IGetRaidTimeRequest, sessionID: string): IGetRaidTimeResponse;
}

View File

@ -26,11 +26,11 @@ export declare class HideoutCallbacks implements OnUpdate {
/**
* Handle HideoutUpgrade event
*/
upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse;
upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse;
/**
* Handle HideoutUpgradeComplete event
*/
upgradeComplete(pmcData: IPmcData, body: IHideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse;
upgradeComplete(pmcData: IPmcData, body: IHideoutUpgradeCompleteRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse;
/**
* Handle HideoutPutItemsInAreaSlots
*/
@ -62,11 +62,11 @@ export declare class HideoutCallbacks implements OnUpdate {
/**
* Handle HideoutQuickTimeEvent
*/
handleQTEEvent(pmcData: IPmcData, request: IHandleQTEEventRequestData, sessionId: string): IItemEventRouterResponse;
handleQTEEvent(pmcData: IPmcData, request: IHandleQTEEventRequestData, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse;
/**
* Handle client/game/profile/items/moving - RecordShootingRangePoints
*/
recordShootingRangePoints(pmcData: IPmcData, request: IRecordShootingRangePoints, sessionId: string): IItemEventRouterResponse;
recordShootingRangePoints(pmcData: IPmcData, request: IRecordShootingRangePoints, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse;
/**
* Handle client/game/profile/items/moving - RecordShootingRangePoints
*/

View File

@ -1,5 +1,7 @@
import { InraidController } from "@spt-aki/controllers/InraidController";
import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData";
import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData";
import { IItemDeliveryRequestData } from "@spt-aki/models/eft/inRaid/IItemDeliveryRequestData";
import { IRegisterPlayerRequestData } from "@spt-aki/models/eft/inRaid/IRegisterPlayerRequestData";
import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData";
import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil";
@ -47,4 +49,19 @@ export declare class InraidCallbacks {
* @returns JSON as string
*/
getAirdropConfig(): string;
/**
* Handle singleplayer/btr/config
* @returns JSON as string
*/
getBTRConfig(): string;
/**
* Handle singleplayer/traderServices/getTraderServices
*/
getTraderServices(url: string, info: IEmptyRequestData, sessionId: string): string;
/**
* Handle singleplayer/traderServices/itemDelivery
*/
itemDelivery(url: string, request: IItemDeliveryRequestData, sessionId: string): INullResponseData;
getTraitorScavHostileChance(url: string, info: IEmptyRequestData, sessionId: string): string;
getSandboxMaxPatrolValue(url: string, info: IEmptyRequestData, sessionId: string): string;
}

View File

@ -1,4 +1,5 @@
import { InventoryController } from "@spt-aki/controllers/InventoryController";
import { QuestController } from "@spt-aki/controllers/QuestController";
import { IPmcData } from "@spt-aki/models/eft/common/IPmcData";
import { IInventoryBindRequestData } from "@spt-aki/models/eft/inventory/IInventoryBindRequestData";
import { IInventoryCreateMarkerRequestData } from "@spt-aki/models/eft/inventory/IInventoryCreateMarkerRequestData";
@ -18,34 +19,43 @@ import { IInventoryToggleRequestData } from "@spt-aki/models/eft/inventory/IInve
import { IInventoryTransferRequestData } from "@spt-aki/models/eft/inventory/IInventoryTransferRequestData";
import { IOpenRandomLootContainerRequestData } from "@spt-aki/models/eft/inventory/IOpenRandomLootContainerRequestData";
import { IRedeemProfileRequestData } from "@spt-aki/models/eft/inventory/IRedeemProfileRequestData";
import { ISetFavoriteItems } from "@spt-aki/models/eft/inventory/ISetFavoriteItems";
import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse";
import { IFailQuestRequestData } from "@spt-aki/models/eft/quests/IFailQuestRequestData";
export declare class InventoryCallbacks {
protected inventoryController: InventoryController;
constructor(inventoryController: InventoryController);
/** Handle Move event */
moveItem(pmcData: IPmcData, body: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse;
protected questController: QuestController;
constructor(inventoryController: InventoryController, questController: QuestController);
/** Handle client/game/profile/items/moving Move event */
moveItem(pmcData: IPmcData, body: IInventoryMoveRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse;
/** Handle Remove event */
removeItem(pmcData: IPmcData, body: IInventoryRemoveRequestData, sessionID: string): IItemEventRouterResponse;
removeItem(pmcData: IPmcData, body: IInventoryRemoveRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse;
/** Handle Split event */
splitItem(pmcData: IPmcData, body: IInventorySplitRequestData, sessionID: string): IItemEventRouterResponse;
mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string): IItemEventRouterResponse;
transferItem(pmcData: IPmcData, body: IInventoryTransferRequestData, sessionID: string): IItemEventRouterResponse;
splitItem(pmcData: IPmcData, body: IInventorySplitRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse;
mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse;
transferItem(pmcData: IPmcData, request: IInventoryTransferRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse;
/** Handle Swap */
swapItem(pmcData: IPmcData, body: IInventorySwapRequestData, sessionID: string): IItemEventRouterResponse;
foldItem(pmcData: IPmcData, body: IInventoryFoldRequestData, sessionID: string): IItemEventRouterResponse;
toggleItem(pmcData: IPmcData, body: IInventoryToggleRequestData, sessionID: string): IItemEventRouterResponse;
tagItem(pmcData: IPmcData, body: IInventoryTagRequestData, sessionID: string): IItemEventRouterResponse;
bindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse;
unbindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse;
examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string): IItemEventRouterResponse;
bindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse;
unbindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse;
examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse;
/** Handle ReadEncyclopedia */
readEncyclopedia(pmcData: IPmcData, body: IInventoryReadEncyclopediaRequestData, sessionID: string): IItemEventRouterResponse;
/** Handle ApplyInventoryChanges */
sortInventory(pmcData: IPmcData, body: IInventorySortRequestData, sessionID: string): IItemEventRouterResponse;
createMapMarker(pmcData: IPmcData, body: IInventoryCreateMarkerRequestData, sessionID: string): IItemEventRouterResponse;
deleteMapMarker(pmcData: IPmcData, body: IInventoryDeleteMarkerRequestData, sessionID: string): IItemEventRouterResponse;
editMapMarker(pmcData: IPmcData, body: IInventoryEditMarkerRequestData, sessionID: string): IItemEventRouterResponse;
sortInventory(pmcData: IPmcData, body: IInventorySortRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse;
createMapMarker(pmcData: IPmcData, body: IInventoryCreateMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse;
deleteMapMarker(pmcData: IPmcData, body: IInventoryDeleteMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse;
editMapMarker(pmcData: IPmcData, body: IInventoryEditMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse;
/** Handle OpenRandomLootContainer */
openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string): IItemEventRouterResponse;
redeemProfileReward(pmcData: IPmcData, body: IRedeemProfileRequestData, sessionId: string): IItemEventRouterResponse;
openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse;
redeemProfileReward(pmcData: IPmcData, body: IRedeemProfileRequestData, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse;
setFavoriteItem(pmcData: IPmcData, body: ISetFavoriteItems, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse;
/**
* TODO - MOVE INTO QUEST CODE
* Handle game/profile/items/moving - QuestFail
*/
failQuest(pmcData: IPmcData, request: IFailQuestRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse;
}

View File

@ -9,5 +9,11 @@ export declare class ItemEventCallbacks {
protected itemEventRouter: ItemEventRouter;
constructor(httpResponse: HttpResponseUtil, itemEventRouter: ItemEventRouter);
handleEvents(url: string, info: IItemEventRouterRequest, sessionID: string): IGetBodyResponseData<IItemEventRouterResponse>;
/**
* Return true if the passed in list of warnings contains critical issues
* @param warnings The list of warnings to check for critical errors
* @returns
*/
private isCriticalError;
protected getErrorCode(warnings: Warning[]): number;
}

View File

@ -1,16 +1,14 @@
import { MatchController } from "@spt-aki/controllers/MatchController";
import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData";
import { IPmcData } from "@spt-aki/models/eft/common/IPmcData";
import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData";
import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData";
import { IAcceptGroupInviteRequest } from "@spt-aki/models/eft/match/IAcceptGroupInviteRequest";
import { IAcceptGroupInviteResponse } from "@spt-aki/models/eft/match/IAcceptGroupInviteResponse";
import { ICancelGroupInviteRequest } from "@spt-aki/models/eft/match/ICancelGroupInviteRequest";
import { ICreateGroupRequestData } from "@spt-aki/models/eft/match/ICreateGroupRequestData";
import { IDeclineGroupInviteRequest } from "@spt-aki/models/eft/match/IDeclineGroupInviteRequest";
import { IEndOfflineRaidRequestData } from "@spt-aki/models/eft/match/IEndOfflineRaidRequestData";
import { IGetGroupStatusRequestData } from "@spt-aki/models/eft/match/IGetGroupStatusRequestData";
import { IGetGroupStatusResponse } from "@spt-aki/models/eft/match/IGetGroupStatusResponse";
import { IGetProfileRequestData } from "@spt-aki/models/eft/match/IGetProfileRequestData";
import { IGetRaidConfigurationRequestData } from "@spt-aki/models/eft/match/IGetRaidConfigurationRequestData";
import { IJoinMatchRequestData } from "@spt-aki/models/eft/match/IJoinMatchRequestData";
import { IJoinMatchResult } from "@spt-aki/models/eft/match/IJoinMatchResult";
@ -39,29 +37,27 @@ export declare class MatchCallbacks {
sendGroupInvite(url: string, info: ISendGroupInviteRequest, sessionID: string): IGetBodyResponseData<string>;
/** Handle client/match/group/invite/accept */
acceptGroupInvite(url: string, info: IAcceptGroupInviteRequest, sessionID: string): IGetBodyResponseData<IAcceptGroupInviteResponse[]>;
/** Handle client/match/group/invite/decline */
declineGroupInvite(url: string, info: IDeclineGroupInviteRequest, sessionID: string): IGetBodyResponseData<any>;
/** Handle client/match/group/invite/cancel */
cancelGroupInvite(url: string, info: ICancelGroupInviteRequest, sessionID: string): IGetBodyResponseData<boolean>;
/** Handle client/match/group/transfer */
transferGroup(url: string, info: ITransferGroupRequest, sessionID: string): IGetBodyResponseData<boolean>;
/** Handle client/match/group/invite/cancel-all */
cancelAllGroupInvite(url: string, info: any, sessionID: string): INullResponseData;
cancelAllGroupInvite(url: string, info: IEmptyRequestData, sessionID: string): INullResponseData;
/** @deprecated - not called on raid start/end or game start/exit */
putMetrics(url: string, info: IPutMetricsRequestData, sessionID: string): INullResponseData;
/** Handle raid/profile/list */
getProfile(url: string, info: IGetProfileRequestData, sessionID: string): IGetBodyResponseData<IPmcData[]>;
serverAvailable(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<boolean>;
/** Handle match/group/start_game */
joinMatch(url: string, info: IJoinMatchRequestData, sessionID: string): IGetBodyResponseData<IJoinMatchResult>;
/** Handle client/getMetricsConfig */
getMetrics(url: string, info: any, sessionID: string): IGetBodyResponseData<string>;
/**
* @deprecated - not called on raid start/end or game start/exit
* Called periodically while in a group
* Handle client/match/group/status
* @returns
*/
getGroupStatus(url: string, info: IGetGroupStatusRequestData, sessionID: string): IGetBodyResponseData<IGetGroupStatusResponse>;
/** Handle client/match/group/create */
createGroup(url: string, info: ICreateGroupRequestData, sessionID: string): IGetBodyResponseData<any>;
/** Handle client/match/group/delete */
deleteGroup(url: string, info: any, sessionID: string): INullResponseData;
leaveGroup(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<boolean>;
@ -71,4 +67,6 @@ export declare class MatchCallbacks {
endOfflineRaid(url: string, info: IEndOfflineRaidRequestData, sessionID: string): INullResponseData;
/** Handle client/raid/configuration */
getRaidConfiguration(url: string, info: IGetRaidConfigurationRequestData, sessionID: string): INullResponseData;
/** Handle client/raid/configuration-by-profile */
getConfigurationByProfile(url: string, info: IGetRaidConfigurationRequestData, sessionID: string): INullResponseData;
}

View File

@ -1,26 +0,0 @@
import { PresetBuildController } from "@spt-aki/controllers/PresetBuildController";
import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData";
import { IPmcData } from "@spt-aki/models/eft/common/IPmcData";
import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData";
import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse";
import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData";
import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData";
import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile";
import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil";
export declare class PresetBuildCallbacks {
protected httpResponse: HttpResponseUtil;
protected presetBuildController: PresetBuildController;
constructor(httpResponse: HttpResponseUtil, presetBuildController: PresetBuildController);
/** Handle client/handbook/builds/my/list */
getHandbookUserlist(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<IUserBuilds>;
/** Handle SaveWeaponBuild event */
saveWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse;
/** Handle removeBuild event*/
removeBuild(pmcData: IPmcData, body: IRemoveBuildRequestData, sessionID: string): IItemEventRouterResponse;
/** Handle RemoveWeaponBuild event*/
removeWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse;
/** Handle SaveEquipmentBuild event */
saveEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse;
/** Handle RemoveEquipmentBuild event*/
removeEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse;
}

View File

@ -1,4 +1,5 @@
import { ProfileController } from "@spt-aki/controllers/ProfileController";
import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper";
import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData";
import { IPmcData } from "@spt-aki/models/eft/common/IPmcData";
import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData";
@ -6,6 +7,8 @@ import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullRespons
import { IGetMiniProfileRequestData } from "@spt-aki/models/eft/launcher/IGetMiniProfileRequestData";
import { GetProfileStatusResponseData } from "@spt-aki/models/eft/profile/GetProfileStatusResponseData";
import { ICreateProfileResponse } from "@spt-aki/models/eft/profile/ICreateProfileResponse";
import { IGetOtherProfileRequest } from "@spt-aki/models/eft/profile/IGetOtherProfileRequest";
import { IGetOtherProfileResponse } from "@spt-aki/models/eft/profile/IGetOtherProfileResponse";
import { IGetProfileSettingsRequest } from "@spt-aki/models/eft/profile/IGetProfileSettingsRequest";
import { IProfileChangeNicknameRequestData } from "@spt-aki/models/eft/profile/IProfileChangeNicknameRequestData";
import { IProfileChangeVoiceRequestData } from "@spt-aki/models/eft/profile/IProfileChangeVoiceRequestData";
@ -20,7 +23,8 @@ export declare class ProfileCallbacks {
protected httpResponse: HttpResponseUtil;
protected timeUtil: TimeUtil;
protected profileController: ProfileController;
constructor(httpResponse: HttpResponseUtil, timeUtil: TimeUtil, profileController: ProfileController);
protected profileHelper: ProfileHelper;
constructor(httpResponse: HttpResponseUtil, timeUtil: TimeUtil, profileController: ProfileController, profileHelper: ProfileHelper);
/**
* Handle client/game/profile/create
*/
@ -62,6 +66,11 @@ export declare class ProfileCallbacks {
* Called when creating a character when choosing a character face/voice
*/
getProfileStatus(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<GetProfileStatusResponseData>;
/**
* Handle client/profile/view
* Called when viewing another players profile
*/
getOtherProfile(url: string, request: IGetOtherProfileRequest, sessionID: string): IGetBodyResponseData<IGetOtherProfileResponse>;
/**
* Handle client/profile/settings
*/

View File

@ -47,7 +47,7 @@ export declare class RagfairCallbacks implements OnLoad, OnUpdate {
getMarketPrice(url: string, info: IGetMarketPriceRequestData, sessionID: string): IGetBodyResponseData<IGetItemPriceResult>;
/** Handle RagFairAddOffer event */
addOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse;
/** \Handle RagFairRemoveOffer event */
/** Handle RagFairRemoveOffer event */
removeOffer(pmcData: IPmcData, info: IRemoveOfferRequestData, sessionID: string): IItemEventRouterResponse;
/** Handle RagFairRenewOffer event */
extendOffer(pmcData: IPmcData, info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse;

View File

@ -8,7 +8,8 @@ import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil";
export declare class TraderCallbacks implements OnLoad, OnUpdate {
protected httpResponse: HttpResponseUtil;
protected traderController: TraderController;
constructor(httpResponse: HttpResponseUtil, traderController: TraderController);
constructor(httpResponse: HttpResponseUtil, // TODO: delay required
traderController: TraderController);
onLoad(): Promise<void>;
onUpdate(): Promise<boolean>;
getRoute(): string;

View File

@ -5,14 +5,13 @@ export declare class ApplicationContext {
private static holderMaxSize;
/**
* Called like:
*
* ```
* const registerPlayerInfo = this.applicationContext.getLatestValue(ContextVariableType.REGISTER_PLAYER_REQUEST).getValue<IRegisterPlayerRequestData>();
*
* const activePlayerSessionId = this.applicationContext.getLatestValue(ContextVariableType.SESSION_ID).getValue<string>();
*
* const matchInfo = this.applicationContext.getLatestValue(ContextVariableType.RAID_CONFIGURATION).getValue<IGetRaidConfigurationRequestData>();
* @param type
* @returns
* ```
*/
getLatestValue(type: ContextVariableType): ContextVariable;
getValues(type: ContextVariableType): ContextVariable[];

View File

@ -0,0 +1,23 @@
import { ICompletedAchievementsResponse } from "@spt-aki/models/eft/profile/ICompletedAchievementsResponse";
import { IGetAchievementsResponse } from "@spt-aki/models/eft/profile/IGetAchievementsResponse";
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
import { DatabaseServer } from "@spt-aki/servers/DatabaseServer";
/**
* Logic for handling In Raid callbacks
*/
export declare class AchievementController {
protected logger: ILogger;
protected databaseServer: DatabaseServer;
constructor(logger: ILogger, databaseServer: DatabaseServer);
/**
* Get base achievements
* @param sessionID Session id
*/
getAchievements(sessionID: string): IGetAchievementsResponse;
/**
* Shows % of 'other' players who've completed each achievement
* @param sessionId Session id
* @returns ICompletedAchievementsResponse
*/
getAchievementStatistics(sessionId: string): ICompletedAchievementsResponse;
}

View File

@ -4,6 +4,7 @@ import { BotDifficultyHelper } from "@spt-aki/helpers/BotDifficultyHelper";
import { BotHelper } from "@spt-aki/helpers/BotHelper";
import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper";
import { IGenerateBotsRequestData } from "@spt-aki/models/eft/bot/IGenerateBotsRequestData";
import { IPmcData } from "@spt-aki/models/eft/common/IPmcData";
import { IBotBase } from "@spt-aki/models/eft/common/tables/IBotBase";
import { IBotCore } from "@spt-aki/models/eft/common/tables/IBotCore";
import { Difficulty } from "@spt-aki/models/eft/common/tables/IBotType";
@ -15,7 +16,9 @@ import { DatabaseServer } from "@spt-aki/servers/DatabaseServer";
import { BotGenerationCacheService } from "@spt-aki/services/BotGenerationCacheService";
import { LocalisationService } from "@spt-aki/services/LocalisationService";
import { MatchBotDetailsCacheService } from "@spt-aki/services/MatchBotDetailsCacheService";
import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService";
import { JsonUtil } from "@spt-aki/utils/JsonUtil";
import { RandomUtil } from "@spt-aki/utils/RandomUtil";
export declare class BotController {
protected logger: ILogger;
protected databaseServer: DatabaseServer;
@ -25,22 +28,24 @@ export declare class BotController {
protected botGenerationCacheService: BotGenerationCacheService;
protected matchBotDetailsCacheService: MatchBotDetailsCacheService;
protected localisationService: LocalisationService;
protected seasonalEventService: SeasonalEventService;
protected profileHelper: ProfileHelper;
protected configServer: ConfigServer;
protected applicationContext: ApplicationContext;
protected randomUtil: RandomUtil;
protected jsonUtil: JsonUtil;
protected botConfig: IBotConfig;
protected pmcConfig: IPmcConfig;
constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, jsonUtil: JsonUtil);
constructor(logger: ILogger, databaseServer: DatabaseServer, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, botGenerationCacheService: BotGenerationCacheService, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, seasonalEventService: SeasonalEventService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, randomUtil: RandomUtil, jsonUtil: JsonUtil);
/**
* Return the number of bot loadout varieties to be generated
* @param type bot Type we want the loadout gen count for
* Return the number of bot load-out varieties to be generated
* @param type bot Type we want the load-out gen count for
* @returns number of bots to generate
*/
getBotPresetGenerationLimit(type: string): number;
/**
* Handle singleplayer/settings/bot/difficulty
* Get the core.json difficulty settings from database\bots
* Get the core.json difficulty settings from database/bots
* @returns IBotCore
*/
getBotCoreDifficulty(): IBotCore;
@ -48,10 +53,10 @@ export declare class BotController {
* Get bot difficulty settings
* adjust PMC settings to ensure they engage the correct bot types
* @param type what bot the server is requesting settings for
* @param difficulty difficulty level server requested settings for
* @param diffLevel difficulty level server requested settings for
* @returns Difficulty object
*/
getBotDifficulty(type: string, difficulty: string): Difficulty;
getBotDifficulty(type: string, diffLevel: string): Difficulty;
/**
* Generate bot profiles and store in cache
* @param sessionId Session id
@ -60,7 +65,22 @@ export declare class BotController {
*/
generate(sessionId: string, info: IGenerateBotsRequestData): IBotBase[];
/**
* Get the difficulty passed in, if its not "asoline", get selected difficulty from config
* On first bot generation bots are generated and stored inside a cache, ready to be used later
* @param request Bot generation request object
* @param pmcProfile Player profile
* @param sessionId Session id
* @returns
*/
protected generateBotsFirstTime(request: IGenerateBotsRequestData, pmcProfile: IPmcData, sessionId: string): IBotBase[];
/**
* Pull a single bot out of cache and return, if cache is empty add bots to it and then return
* @param sessionId Session id
* @param request Bot generation request object
* @returns Single IBotBase object
*/
protected returnSingleBotFromCache(sessionId: string, request: IGenerateBotsRequestData): IBotBase[];
/**
* Get the difficulty passed in, if its not "asonline", get selected difficulty from config
* @param requestedDifficulty
* @returns
*/

View File

@ -0,0 +1,36 @@
import { ItemHelper } from "@spt-aki/helpers/ItemHelper";
import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper";
import { ISetMagazineRequest } from "@spt-aki/models/eft/builds/ISetMagazineRequest";
import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData";
import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData";
import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile";
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder";
import { DatabaseServer } from "@spt-aki/servers/DatabaseServer";
import { SaveServer } from "@spt-aki/servers/SaveServer";
import { HashUtil } from "@spt-aki/utils/HashUtil";
import { JsonUtil } from "@spt-aki/utils/JsonUtil";
export declare class BuildController {
protected logger: ILogger;
protected hashUtil: HashUtil;
protected eventOutputHolder: EventOutputHolder;
protected jsonUtil: JsonUtil;
protected databaseServer: DatabaseServer;
protected profileHelper: ProfileHelper;
protected itemHelper: ItemHelper;
protected saveServer: SaveServer;
constructor(logger: ILogger, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, jsonUtil: JsonUtil, databaseServer: DatabaseServer, profileHelper: ProfileHelper, itemHelper: ItemHelper, saveServer: SaveServer);
/** Handle client/handbook/builds/my/list */
getUserBuilds(sessionID: string): IUserBuilds;
/** Handle client/builds/weapon/save */
saveWeaponBuild(sessionId: string, body: IPresetBuildActionRequestData): void;
/** Handle client/builds/equipment/save event */
saveEquipmentBuild(sessionID: string, request: IPresetBuildActionRequestData): void;
/** Handle client/builds/delete*/
removeBuild(sessionID: string, request: IRemoveBuildRequestData): void;
protected removePlayerBuild(id: string, sessionID: string): void;
/**
* Handle client/builds/magazine/save
*/
createMagazineTemplate(sessionId: string, request: ISetMagazineRequest): void;
}

View File

@ -110,7 +110,7 @@ export declare class DialogueController {
* Get all uncollected items attached to mail in a particular dialog
* @param dialogueId Dialog to get mail attachments from
* @param sessionId Session id
* @returns
* @returns IGetAllAttachmentsResponse
*/
getAllAttachments(dialogueId: string, sessionId: string): IGetAllAttachmentsResponse;
/** client/mail/msg/send */

View File

@ -13,7 +13,9 @@ import { IGetRaidTimeRequest } from "@spt-aki/models/eft/game/IGetRaidTimeReques
import { IGetRaidTimeResponse } from "@spt-aki/models/eft/game/IGetRaidTimeResponse";
import { IServerDetails } from "@spt-aki/models/eft/game/IServerDetails";
import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile";
import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig";
import { ICoreConfig } from "@spt-aki/models/spt/config/ICoreConfig";
import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig";
import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig";
import { ILocationConfig } from "@spt-aki/models/spt/config/ILocationConfig";
import { ILootConfig } from "@spt-aki/models/spt/config/ILootConfig";
@ -59,21 +61,23 @@ export declare class GameController {
protected coreConfig: ICoreConfig;
protected locationConfig: ILocationConfig;
protected ragfairConfig: IRagfairConfig;
protected hideoutConfig: IHideoutConfig;
protected pmcConfig: IPmcConfig;
protected lootConfig: ILootConfig;
protected botConfig: IBotConfig;
constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, preAkiModLoader: PreAkiModLoader, httpServerHelper: HttpServerHelper, randomUtil: RandomUtil, hideoutHelper: HideoutHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, seasonalEventService: SeasonalEventService, itemBaseClassService: ItemBaseClassService, giftService: GiftService, raidTimeAdjustmentService: RaidTimeAdjustmentService, applicationContext: ApplicationContext, configServer: ConfigServer);
load(): void;
/**
* Handle client/game/start
*/
gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void;
protected adjustLocationBotValues(): void;
/**
* Out of date/incorrectly made trader mods forget this data
*/
protected checkTraderRepairValuesExist(): void;
protected addCustomLooseLootPositions(): void;
protected adjustLooseLootSpawnProbabilities(): void;
protected setHideoutAreasAndCraftsTo40Secs(): void;
/** Apply custom limits on bot types as defined in configs/location.json/botTypeLimits */
protected adjustMapBotLimits(): void;
/**
@ -112,8 +116,7 @@ export declare class GameController {
protected flagAllItemsInDbAsSellableOnFlea(): void;
/**
* When player logs in, iterate over all active effects and reduce timer
* TODO - add body part HP regen
* @param pmcProfile
* @param pmcProfile Profile to adjust values for
*/
protected updateProfileHealthValues(pmcProfile: IPmcData): void;
/**
@ -130,7 +133,8 @@ export declare class GameController {
*/
protected sendPraporGiftsToNewProfiles(pmcProfile: IPmcData): void;
/**
* Find and split waves with large numbers of bots into smaller waves - BSG appears to reduce the size of these waves to one bot when they're waiting to spawn for too long
* Find and split waves with large numbers of bots into smaller waves - BSG appears to reduce the size of these
* waves to one bot when they're waiting to spawn for too long
*/
protected splitBotWavesIntoSingleWaves(): void;
/**
@ -139,7 +143,7 @@ export declare class GameController {
*/
protected saveActiveModsToProfile(fullProfile: IAkiProfile): void;
/**
* Check for any missing assorts inside each traders assort.json data, checking against traders qeustassort.json
* Check for any missing assorts inside each traders assort.json data, checking against traders questassort.json
*/
protected validateQuestAssortUnlocksExist(): void;
/**

View File

@ -1,11 +1,12 @@
import { ScavCaseRewardGenerator } from "@spt-aki/generators/ScavCaseRewardGenerator";
import { HideoutHelper } from "@spt-aki/helpers/HideoutHelper";
import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper";
import { ItemHelper } from "@spt-aki/helpers/ItemHelper";
import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper";
import { PresetHelper } from "@spt-aki/helpers/PresetHelper";
import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper";
import { IPmcData } from "@spt-aki/models/eft/common/IPmcData";
import { HideoutArea, Product } from "@spt-aki/models/eft/common/tables/IBotBase";
import { HideoutArea, ITaskConditionCounter, Product } from "@spt-aki/models/eft/common/tables/IBotBase";
import { HideoutUpgradeCompleteRequestData } from "@spt-aki/models/eft/hideout/HideoutUpgradeCompleteRequestData";
import { IHandleQTEEventRequestData } from "@spt-aki/models/eft/hideout/IHandleQTEEventRequestData";
import { IHideoutArea, Stage } from "@spt-aki/models/eft/hideout/IHideoutArea";
@ -45,6 +46,7 @@ export declare class HideoutController {
protected databaseServer: DatabaseServer;
protected randomUtil: RandomUtil;
protected inventoryHelper: InventoryHelper;
protected itemHelper: ItemHelper;
protected saveServer: SaveServer;
protected playerService: PlayerService;
protected presetHelper: PresetHelper;
@ -58,27 +60,28 @@ export declare class HideoutController {
protected configServer: ConfigServer;
protected jsonUtil: JsonUtil;
protected fenceService: FenceService;
protected static nameBackendCountersCrafting: string;
/** Key used in TaskConditionCounters array */
protected static nameTaskConditionCountersCrafting: 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, localisationService: LocalisationService, configServer: ConfigServer, jsonUtil: JsonUtil, fenceService: FenceService);
constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, itemHelper: ItemHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, localisationService: LocalisationService, configServer: ConfigServer, jsonUtil: JsonUtil, fenceService: FenceService);
/**
* Handle HideoutUpgrade event
* Start a hideout area upgrade
* @param pmcData Player profile
* @param request upgrade start request
* @param sessionID Session id
* @returns IItemEventRouterResponse
* @param output Client response
*/
startUpgrade(pmcData: IPmcData, request: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse;
startUpgrade(pmcData: IPmcData, request: IHideoutUpgradeRequestData, sessionID: string, output: IItemEventRouterResponse): void;
/**
* Handle HideoutUpgradeComplete event
* Complete a hideout area upgrade
* @param pmcData Player profile
* @param request Completed upgrade request
* @param sessionID Session id
* @returns IItemEventRouterResponse
* @param output Client response
*/
upgradeComplete(pmcData: IPmcData, request: HideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse;
upgradeComplete(pmcData: IPmcData, request: HideoutUpgradeCompleteRequestData, sessionID: string, output: IItemEventRouterResponse): void;
/**
* Upgrade wall status to visible in profile if medstation/water collector are both level 1
* @param pmcData Player profile
@ -202,26 +205,23 @@ export declare class HideoutController {
* @param pmcData Player profile
* @param request Remove production from area request
* @param output Output object to update
* @returns IItemEventRouterResponse
*/
protected handleRecipe(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse;
protected handleRecipe(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void;
/**
* Get the "CounterHoursCrafting" TaskConditionCounter from a profile
* @param pmcData Profile to get counter from
* @param recipe Recipe being crafted
* @returns ITaskConditionCounter
*/
protected getHoursCraftingTaskConditionCounter(pmcData: IPmcData, recipe: IHideoutProduction): ITaskConditionCounter;
/**
* Handles generating case rewards and sending to player inventory
* @param sessionID Session id
* @param pmcData Player profile
* @param request Get rewards from scavcase craft request
* @param output Output object to update
* @returns IItemEventRouterResponse
*/
protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse;
/**
* Start area production for item by adding production to profiles' Hideout.Production array
* @param pmcData Player profile
* @param request Start production request
* @param sessionID Session id
* @returns IItemEventRouterResponse
*/
registerProduction(pmcData: IPmcData, request: IHideoutSingleProductionStartRequestData | IHideoutContinuousProductionStartRequestData, sessionID: string): IItemEventRouterResponse;
protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void;
/**
* Get quick time event list for hideout
* // TODO - implement this
@ -236,7 +236,7 @@ export declare class HideoutController {
* @param pmcData Profile to adjust
* @param request QTE result object
*/
handleQTEEventOutcome(sessionId: string, pmcData: IPmcData, request: IHandleQTEEventRequestData): IItemEventRouterResponse;
handleQTEEventOutcome(sessionId: string, pmcData: IPmcData, request: IHandleQTEEventRequestData, output: IItemEventRouterResponse): void;
/**
* Record a high score from the shooting range into a player profiles overallcounters
* @param sessionId Session id
@ -244,7 +244,7 @@ export declare class HideoutController {
* @param request shooting range score request
* @returns IItemEventRouterResponse
*/
recordShootingRangePoints(sessionId: string, pmcData: IPmcData, request: IRecordShootingRangePoints): IItemEventRouterResponse;
recordShootingRangePoints(sessionId: string, pmcData: IPmcData, request: IRecordShootingRangePoints): void;
/**
* Handle client/game/profile/items/moving - HideoutImproveArea
* @param sessionId Session id

View File

@ -7,19 +7,29 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper";
import { QuestHelper } from "@spt-aki/helpers/QuestHelper";
import { TraderHelper } from "@spt-aki/helpers/TraderHelper";
import { IPmcData } from "@spt-aki/models/eft/common/IPmcData";
import { Item } from "@spt-aki/models/eft/common/tables/IItem";
import { IRegisterPlayerRequestData } from "@spt-aki/models/eft/inRaid/IRegisterPlayerRequestData";
import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData";
import { PlayerRaidEndState } from "@spt-aki/models/enums/PlayerRaidEndState";
import { IAirdropConfig } from "@spt-aki/models/spt/config/IAirdropConfig";
import { IBTRConfig } from "@spt-aki/models/spt/config/IBTRConfig";
import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig";
import { IInRaidConfig } from "@spt-aki/models/spt/config/IInRaidConfig";
import { ILocationConfig } from "@spt-aki/models/spt/config/ILocationConfig";
import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig";
import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig";
import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel";
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
import { ConfigServer } from "@spt-aki/servers/ConfigServer";
import { DatabaseServer } from "@spt-aki/servers/DatabaseServer";
import { SaveServer } from "@spt-aki/servers/SaveServer";
import { InsuranceService } from "@spt-aki/services/InsuranceService";
import { MailSendService } from "@spt-aki/services/MailSendService";
import { MatchBotDetailsCacheService } from "@spt-aki/services/MatchBotDetailsCacheService";
import { PmcChatResponseService } from "@spt-aki/services/PmcChatResponseService";
import { TraderServicesService } from "@spt-aki/services/TraderServicesService";
import { JsonUtil } from "@spt-aki/utils/JsonUtil";
import { RandomUtil } from "@spt-aki/utils/RandomUtil";
import { TimeUtil } from "@spt-aki/utils/TimeUtil";
/**
* Logic for handling In Raid callbacks
@ -38,13 +48,21 @@ export declare class InraidController {
protected playerScavGenerator: PlayerScavGenerator;
protected healthHelper: HealthHelper;
protected traderHelper: TraderHelper;
protected traderServicesService: TraderServicesService;
protected insuranceService: InsuranceService;
protected inRaidHelper: InRaidHelper;
protected applicationContext: ApplicationContext;
protected configServer: ConfigServer;
protected mailSendService: MailSendService;
protected randomUtil: RandomUtil;
protected airdropConfig: IAirdropConfig;
protected inraidConfig: IInRaidConfig;
constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer);
protected btrConfig: IBTRConfig;
protected inRaidConfig: IInRaidConfig;
protected traderConfig: ITraderConfig;
protected locationConfig: ILocationConfig;
protected ragfairConfig: IRagfairConfig;
protected hideoutConfig: IHideoutConfig;
constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, traderServicesService: TraderServicesService, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer, mailSendService: MailSendService, randomUtil: RandomUtil);
/**
* Save locationId to active profiles inraid object AND app context
* @param sessionID Session id
@ -66,8 +84,8 @@ export declare class InraidController {
*/
protected savePmcProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void;
/**
* Make changes to pmc profile after they've died in raid,
* Alter bodypart hp, handle insurance, delete inventory items, remove carried quest items
* Make changes to PMC profile after they've died in raid,
* Alter body part hp, handle insurance, delete inventory items, remove carried quest items
* @param postRaidSaveRequest Post-raid save request
* @param pmcData Pmc profile
* @param sessionID Session id
@ -75,7 +93,7 @@ export declare class InraidController {
*/
protected performPostRaidActionsWhenDead(postRaidSaveRequest: ISaveProgressRequestData, pmcData: IPmcData, sessionID: string): IPmcData;
/**
* Adjust player characters bodypart hp post-raid
* Adjust player characters body part hp post-raid
* @param postRaidSaveRequest post raid data
* @param pmcData player profile
*/
@ -83,15 +101,29 @@ export declare class InraidController {
/**
* Reduce body part hp to % of max
* @param pmcData profile to edit
* @param multipler multipler to apply to max health
* @param multiplier multiplier to apply to max health
*/
protected reducePmcHealthToPercent(pmcData: IPmcData, multipler: number): void;
protected reducePmcHealthToPercent(pmcData: IPmcData, multiplier: number): void;
/**
* Handle updating the profile post-pscav raid
* @param sessionID Session id
* @param postRaidRequest Post-raid data of raid
*/
protected savePlayerScavProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void;
/**
* merge two dictionaries together
* Prioritise pair that has true as a value
* @param primary main dictionary
* @param secondary Secondary dictionary
*/
protected mergePmcAndScavEncyclopedias(primary: IPmcData, secondary: IPmcData): void;
/**
* Post-scav-raid any charisma increase must be propigated into PMC profile
* @param postRaidServerScavProfile Scav profile after adjustments made from raid
* @param postRaidServerPmcProfile Pmc profile after raid
* @param preRaidScavCharismaProgress charisma progress value pre-raid
*/
protected updatePmcCharismaSkillPostScavRaid(postRaidServerScavProfile: IPmcData, postRaidServerPmcProfile: IPmcData, preRaidScavCharismaProgress: number): void;
/**
* Does provided profile contain any condition counters
* @param profile Profile to check for condition counters
@ -128,8 +160,9 @@ export declare class InraidController {
* 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
*/
protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData): void;
protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData, scavData: IPmcData): void;
/**
* Get the inraid config from configs/inraid.json
* @returns InRaid Config
@ -140,4 +173,20 @@ export declare class InraidController {
* @returns Airdrop config
*/
getAirdropConfig(): IAirdropConfig;
/**
* Get BTR config from configs/btr.json
* @returns Airdrop config
*/
getBTRConfig(): IBTRConfig;
/**
* Handle singleplayer/traderServices/getTraderServices
* @returns Trader services data
*/
getTraderServices(sessionId: string, traderId: string): ITraderServiceModel[];
/**
* Handle singleplayer/traderServices/itemDelivery
*/
itemDelivery(sessionId: string, traderId: string, items: Item[]): void;
getTraitorScavHostileChance(url: string, sessionID: string): number;
getSandboxMaxPatrolValue(url: string, sessionID: string): number;
}

View File

@ -8,7 +8,7 @@ import { IGetInsuranceCostRequestData } from "@spt-aki/models/eft/insurance/IGet
import { IGetInsuranceCostResponseData } from "@spt-aki/models/eft/insurance/IGetInsuranceCostResponseData";
import { IInsureRequestData } from "@spt-aki/models/eft/insurance/IInsureRequestData";
import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse";
import { ISystemData, Insurance } from "@spt-aki/models/eft/profile/IAkiProfile";
import { Insurance } from "@spt-aki/models/eft/profile/IAkiProfile";
import { IInsuranceConfig } from "@spt-aki/models/spt/config/IInsuranceConfig";
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder";
@ -18,11 +18,15 @@ import { SaveServer } from "@spt-aki/servers/SaveServer";
import { InsuranceService } from "@spt-aki/services/InsuranceService";
import { MailSendService } from "@spt-aki/services/MailSendService";
import { PaymentService } from "@spt-aki/services/PaymentService";
import { HashUtil } from "@spt-aki/utils/HashUtil";
import { MathUtil } from "@spt-aki/utils/MathUtil";
import { RandomUtil } from "@spt-aki/utils/RandomUtil";
import { TimeUtil } from "@spt-aki/utils/TimeUtil";
export declare class InsuranceController {
protected logger: ILogger;
protected randomUtil: RandomUtil;
protected mathUtil: MathUtil;
protected hashUtil: HashUtil;
protected eventOutputHolder: EventOutputHolder;
protected timeUtil: TimeUtil;
protected saveServer: SaveServer;
@ -37,7 +41,7 @@ export declare class InsuranceController {
protected configServer: ConfigServer;
protected insuranceConfig: IInsuranceConfig;
protected roubleTpl: string;
constructor(logger: ILogger, randomUtil: RandomUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, traderHelper: TraderHelper, paymentService: PaymentService, insuranceService: InsuranceService, mailSendService: MailSendService, configServer: ConfigServer);
constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, traderHelper: TraderHelper, paymentService: PaymentService, insuranceService: InsuranceService, mailSendService: MailSendService, configServer: ConfigServer);
/**
* Process insurance items of all profiles prior to being given back to the player through the mail service.
*
@ -66,6 +70,12 @@ export declare class InsuranceController {
* @returns void
*/
protected processInsuredItems(insuranceDetails: Insurance[], sessionID: string): void;
/**
* Count all items in all insurance packages.
* @param insurance
* @returns
*/
protected countAllInsuranceItems(insurance: Insurance[]): number;
/**
* Remove an insurance package from a profile using the package's system data information.
*
@ -73,31 +83,35 @@ export declare class InsuranceController {
* @param index The array index of the insurance package to remove.
* @returns void
*/
protected removeInsurancePackageFromProfile(sessionID: string, packageInfo: ISystemData): void;
protected removeInsurancePackageFromProfile(sessionID: string, insPackage: Insurance): void;
/**
* Finds the items that should be deleted based on the given Insurance object.
*
* @param insured The insurance object containing the items to evaluate for deletion.
* @param rootItemParentID - The ID that should be assigned to all "hideout"/root items.
* @param insured - The insurance object containing the items to evaluate for deletion.
* @returns A Set containing the IDs of items that should be deleted.
*/
protected findItemsToDelete(insured: Insurance): Set<string>;
/**
* Populate a Map object of items for quick lookup by their ID.
*
* @param insured The insurance object containing the items to populate the map with.
* @returns A Map where the keys are the item IDs and the values are the corresponding Item objects.
*/
protected populateItemsMap(insured: Insurance): Map<string, Item>;
protected findItemsToDelete(rootItemParentID: string, insured: Insurance): Set<string>;
/**
* Initialize a Map object that holds main-parents to all of their attachments. Note that "main-parent" in this
* context refers to the parent item that an attachment is attached to. For example, a suppressor attached to a gun,
* not the backpack that the gun is located in (the gun's parent).
*
* @param rootItemParentID - The ID that should be assigned to all "hideout"/root items.
* @param insured - The insurance object containing the items to evaluate.
* @param itemsMap - A Map object for quick item look-up by item ID.
* @returns A Map object containing parent item IDs to arrays of their attachment items.
*/
protected populateParentAttachmentsMap(insured: Insurance, itemsMap: Map<string, Item>): Map<string, Item[]>;
protected populateParentAttachmentsMap(rootItemParentID: string, insured: Insurance, itemsMap: Map<string, Item>): Map<string, Item[]>;
/**
* Remove attachments that can not be moddable in-raid from the parentAttachmentsMap. If no moddable attachments
* remain, the parent is removed from the map as well.
*
* @param parentAttachmentsMap - A Map object containing parent item IDs to arrays of their attachment items.
* @param itemsMap - A Map object for quick item look-up by item ID.
* @returns A Map object containing parent item IDs to arrays of their attachment items which are not moddable in-raid.
*/
protected removeNonModdableAttachments(parentAttachmentsMap: Map<string, Item[]>, itemsMap: Map<string, Item>): Map<string, Item[]>;
/**
* Process "regular" insurance items. Any insured item that is not an attached, attachment is considered a "regular"
* item. This method iterates over them, preforming item deletion rolls to see if they should be deleted. If so,
@ -105,15 +119,13 @@ export declare class InsuranceController {
*
* @param insured The insurance object containing the items to evaluate.
* @param toDelete A Set to keep track of items marked for deletion.
* @param parentAttachmentsMap A Map object containing parent item IDs to arrays of their attachment items.
* @returns void
*/
protected processRegularItems(insured: Insurance, toDelete: Set<string>): void;
protected processRegularItems(insured: Insurance, toDelete: Set<string>, parentAttachmentsMap: Map<string, Item[]>): void;
/**
* Process parent items and their attachments, updating the toDelete Set accordingly.
*
* This method iterates over a map of parent items to their attachments and performs evaluations on each.
* It marks items for deletion based on certain conditions and updates the toDelete Set accordingly.
*
* @param mainParentToAttachmentsMap A Map object containing parent item IDs to arrays of their attachment items.
* @param itemsMap A Map object for quick item look-up by item ID.
* @param traderId The trader ID from the Insurance object.
@ -169,40 +181,23 @@ export declare class InsuranceController {
* @returns void
*/
protected removeItemsFromInsurance(insured: Insurance, toDelete: Set<string>): void;
/**
* Adopts orphaned items by resetting them as base-level items. Helpful in situations where a parent has been
* deleted from insurance, but any insured items within the parent should remain. This method will remove the
* reference from the children to the parent and set item properties to main-level values.
*
* @param insured Insurance object containing items.
*/
protected adoptOrphanedItems(insured: Insurance): void;
/**
* Fetches the parentId property of an item with a slotId "hideout". Not sure if this is actually dynamic, but this
* method should be a reliable way to fetch it, if it ever does change.
*
* @param items Array of items to search through.
* @returns The parentId of an item with slotId 'hideout'. Empty string if not found.
*/
protected fetchHideoutItemParent(items: Item[]): string;
/**
* Handle sending the insurance message to the user that potentially contains the valid insurance items.
*
* @param sessionID The session ID that should receive the insurance message.
* @param insurance The context of insurance to use.
* @param noItems Whether or not there are any items to return to the player.
* @returns void
*/
protected sendMail(sessionID: string, insurance: Insurance, noItems: boolean): void;
protected sendMail(sessionID: string, insurance: Insurance): void;
/**
* Determines whether a insured item should be removed from the player's inventory based on a random roll and
* trader-specific return chance.
*
* @param traderId The ID of the trader who insured the item.
* @param insuredItem Optional. The item to roll for. Only used for logging.
* @returns true if the insured item should be removed from inventory, false otherwise.
* @returns true if the insured item should be removed from inventory, false otherwise, or null on error.
*/
protected rollForDelete(traderId: string, insuredItem?: Item): boolean;
protected rollForDelete(traderId: string, insuredItem?: Item): boolean | null;
/**
* Handle Insure event
* Add insurance to an item

View File

@ -1,4 +1,5 @@
import { LootGenerator } from "@spt-aki/generators/LootGenerator";
import { HideoutHelper } from "@spt-aki/helpers/HideoutHelper";
import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper";
import { ItemHelper } from "@spt-aki/helpers/ItemHelper";
import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper";
@ -24,7 +25,9 @@ import { IInventoryToggleRequestData } from "@spt-aki/models/eft/inventory/IInve
import { IInventoryTransferRequestData } from "@spt-aki/models/eft/inventory/IInventoryTransferRequestData";
import { IOpenRandomLootContainerRequestData } from "@spt-aki/models/eft/inventory/IOpenRandomLootContainerRequestData";
import { IRedeemProfileRequestData } from "@spt-aki/models/eft/inventory/IRedeemProfileRequestData";
import { ISetFavoriteItems } from "@spt-aki/models/eft/inventory/ISetFavoriteItems";
import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse";
import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile";
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder";
import { DatabaseServer } from "@spt-aki/servers/DatabaseServer";
@ -47,6 +50,7 @@ export declare class InventoryController {
protected presetHelper: PresetHelper;
protected inventoryHelper: InventoryHelper;
protected questHelper: QuestHelper;
protected hideoutHelper: HideoutHelper;
protected ragfairOfferService: RagfairOfferService;
protected profileHelper: ProfileHelper;
protected paymentHelper: PaymentHelper;
@ -55,7 +59,7 @@ export declare class InventoryController {
protected lootGenerator: LootGenerator;
protected eventOutputHolder: EventOutputHolder;
protected httpResponseUtil: HttpResponseUtil;
constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, questHelper: QuestHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, playerService: PlayerService, lootGenerator: LootGenerator, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil);
constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, randomUtil: RandomUtil, databaseServer: DatabaseServer, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, questHelper: QuestHelper, hideoutHelper: HideoutHelper, ragfairOfferService: RagfairOfferService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, playerService: PlayerService, lootGenerator: LootGenerator, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil);
/**
* Move Item
* change location of item with parentId and slotId
@ -64,55 +68,52 @@ export declare class InventoryController {
* @param pmcData Profile
* @param moveRequest Move request data
* @param sessionID Session id
* @returns IItemEventRouterResponse
* @param output Client response
*/
moveItem(pmcData: IPmcData, moveRequest: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse;
moveItem(pmcData: IPmcData, moveRequest: IInventoryMoveRequestData, sessionID: string, output: IItemEventRouterResponse): void;
/**
* Get a event router response with inventory trader message
* @param output Item event router response
* @returns Item event router response
*/
protected getTraderExploitErrorResponse(output: IItemEventRouterResponse): IItemEventRouterResponse;
/**
* Remove Item from Profile
* Deep tree item deletion, also removes items from insurance list
*/
removeItem(pmcData: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse;
protected appendTraderExploitErrorResponse(output: IItemEventRouterResponse): void;
/**
* Handle Remove event
* Implements functionality "Discard" from Main menu (Stash etc.)
* Removes item from PMC Profile
*/
discardItem(pmcData: IPmcData, body: IInventoryRemoveRequestData, sessionID: string): IItemEventRouterResponse;
discardItem(pmcData: IPmcData, request: IInventoryRemoveRequestData, sessionID: string, output: IItemEventRouterResponse): void;
/**
* Split Item
* spliting 1 stack into 2
* @param pmcData Player profile (unused, getOwnerInventoryItems() gets profile)
* @param request Split request
* @param sessionID Session/player id
* @param output Client response
* @returns IItemEventRouterResponse
*/
splitItem(pmcData: IPmcData, request: IInventorySplitRequestData, sessionID: string): IItemEventRouterResponse;
splitItem(pmcData: IPmcData, request: IInventorySplitRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse;
/**
* Fully merge 2 inventory stacks together into one stack (merging where both stacks remain is called 'transfer')
* Deletes item from `body.item` and adding number of stacks into `body.with`
* @param pmcData Player profile (unused, getOwnerInventoryItems() gets profile)
* @param body Merge request
* @param sessionID Player id
* @param output Client response
* @returns IItemEventRouterResponse
*/
mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string): IItemEventRouterResponse;
mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse;
/**
* TODO: Adds no data to output to send to client, is this by design?
* TODO: should make use of getOwnerInventoryItems(), stack being transferred may not always be on pmc
* Transfer items from one stack into another while keeping original stack
* Used to take items from scav inventory into stash or to insert ammo into mags (shotgun ones) and reloading weapon by clicking "Reload"
* @param pmcData Player profile
* @param body Transfer request
* @param sessionID Session id
* @param output Client response
* @returns IItemEventRouterResponse
*/
transferItem(pmcData: IPmcData, body: IInventoryTransferRequestData, sessionID: string): IItemEventRouterResponse;
transferItem(pmcData: IPmcData, body: IInventoryTransferRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse;
/**
* Swap Item
* its used for "reload" if you have weapon in hands and magazine is somewhere else in rig or backpack in equipment
@ -122,7 +123,7 @@ export declare class InventoryController {
/**
* Handles folding of Weapons
*/
foldItem(pmcData: IPmcData, body: IInventoryFoldRequestData, sessionID: string): IItemEventRouterResponse;
foldItem(pmcData: IPmcData, request: IInventoryFoldRequestData, sessionID: string): IItemEventRouterResponse;
/**
* Toggles "Toggleable" items like night vision goggles and face shields.
* @param pmcData player profile
@ -147,31 +148,32 @@ export declare class InventoryController {
* @param sessionID Session id
* @returns IItemEventRouterResponse
*/
bindItem(pmcData: IPmcData, bindRequest: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse;
bindItem(pmcData: IPmcData, bindRequest: IInventoryBindRequestData, sessionID: string): void;
/**
* Unbind an inventory item from quick access menu at bottom of player screen
* Handle unbind event
* @param pmcData Player profile
* @param bindRequest Request object
* @param sessionID Session id
* @returns IItemEventRouterResponse
* @param output Client response
*/
unbindItem(pmcData: IPmcData, request: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse;
unbindItem(pmcData: IPmcData, request: IInventoryBindRequestData, sessionID: string, output: IItemEventRouterResponse): void;
/**
* Handles examining an item
* @param pmcData player profile
* @param body request object
* @param sessionID session id
* @param output Client response
* @returns response
*/
examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string): IItemEventRouterResponse;
protected flagItemsAsInspectedAndRewardXp(itemTpls: string[], pmcProfile: IPmcData): void;
examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse;
protected flagItemsAsInspectedAndRewardXp(itemTpls: string[], fullProfile: IAkiProfile): void;
/**
* Get the tplid of an item from the examine request object
* @param body response request
* @returns tplid
* @param request Response request
* @returns tplId
*/
protected getExaminedItemTpl(body: IInventoryExamineRequestData): string;
protected getExaminedItemTpl(request: IInventoryExamineRequestData): string;
readEncyclopedia(pmcData: IPmcData, body: IInventoryReadEncyclopediaRequestData, sessionID: string): IItemEventRouterResponse;
/**
* Handle ApplyInventoryChanges
@ -179,33 +181,33 @@ export declare class InventoryController {
* @param pmcData Player profile
* @param request sort request
* @param sessionID Session id
* @returns IItemEventRouterResponse
*/
sortInventory(pmcData: IPmcData, request: IInventorySortRequestData, sessionID: string): IItemEventRouterResponse;
sortInventory(pmcData: IPmcData, request: IInventorySortRequestData, sessionID: string): void;
/**
* Add note to a map
* @param pmcData Player profile
* @param request Add marker request
* @param sessionID Session id
* @param output Client response
* @returns IItemEventRouterResponse
*/
createMapMarker(pmcData: IPmcData, request: IInventoryCreateMarkerRequestData, sessionID: string): IItemEventRouterResponse;
createMapMarker(pmcData: IPmcData, request: IInventoryCreateMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): void;
/**
* Delete a map marker
* @param pmcData Player profile
* @param request Delete marker request
* @param sessionID Session id
* @returns IItemEventRouterResponse
* @param output Client response
*/
deleteMapMarker(pmcData: IPmcData, request: IInventoryDeleteMarkerRequestData, sessionID: string): IItemEventRouterResponse;
deleteMapMarker(pmcData: IPmcData, request: IInventoryDeleteMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): void;
/**
* Edit an existing map marker
* @param pmcData Player profile
* @param request Edit marker request
* @param sessionID Session id
* @returns IItemEventRouterResponse
* @param output Client response
*/
editMapMarker(pmcData: IPmcData, request: IInventoryEditMarkerRequestData, sessionID: string): IItemEventRouterResponse;
editMapMarker(pmcData: IPmcData, request: IInventoryEditMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): void;
/**
* Strip out characters from note string that are not: letter/numbers/unicode/spaces
* @param mapNoteText Marker text to sanitise
@ -216,10 +218,11 @@ export declare class InventoryController {
* Handle OpenRandomLootContainer event
* 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 body Open loot container request data
* @param sessionID Session id
* @returns IItemEventRouterResponse
* @param output Client response
*/
openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string): IItemEventRouterResponse;
redeemProfileReward(pmcData: IPmcData, request: IRedeemProfileRequestData, sessionId: string): IItemEventRouterResponse;
openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string, output: IItemEventRouterResponse): void;
redeemProfileReward(pmcData: IPmcData, request: IRedeemProfileRequestData, sessionId: string): void;
setFavoriteItem(pmcData: IPmcData, request: ISetFavoriteItems, sessionId: string): void;
}

View File

@ -14,9 +14,13 @@ import { DatabaseServer } from "@spt-aki/servers/DatabaseServer";
import { SaveServer } from "@spt-aki/servers/SaveServer";
import { LocalisationService } from "@spt-aki/services/LocalisationService";
import { HashUtil } from "@spt-aki/utils/HashUtil";
import { RandomUtil } from "@spt-aki/utils/RandomUtil";
import { TimeUtil } from "@spt-aki/utils/TimeUtil";
export declare class LauncherController {
protected logger: ILogger;
protected hashUtil: HashUtil;
protected timeUtil: TimeUtil;
protected randomUtil: RandomUtil;
protected saveServer: SaveServer;
protected httpServerHelper: HttpServerHelper;
protected profileHelper: ProfileHelper;
@ -25,7 +29,7 @@ export declare class LauncherController {
protected preAkiModLoader: PreAkiModLoader;
protected configServer: ConfigServer;
protected coreConfig: ICoreConfig;
constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, preAkiModLoader: PreAkiModLoader, configServer: ConfigServer);
constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, preAkiModLoader: PreAkiModLoader, configServer: ConfigServer);
connect(): IConnectResponse;
/**
* Get descriptive text for each of the profile edtions a player can choose, keyed by profile.json profile type e.g. "Edge Of Darkness"
@ -36,6 +40,8 @@ export declare class LauncherController {
login(info: ILoginRequestData): string;
register(info: IRegisterData): string;
protected createAccount(info: IRegisterData): string;
protected generateProfileId(): string;
protected formatID(timeStamp: number, counter: number): string;
changeUsername(info: IChangeRequestData): string;
changePassword(info: IChangeRequestData): string;
wipe(info: IRegisterData): string;

View File

@ -13,6 +13,7 @@ import { LootRequest } from "@spt-aki/models/spt/services/LootRequest";
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
import { ConfigServer } from "@spt-aki/servers/ConfigServer";
import { DatabaseServer } from "@spt-aki/servers/DatabaseServer";
import { ItemFilterService } from "@spt-aki/services/ItemFilterService";
import { LocalisationService } from "@spt-aki/services/LocalisationService";
import { RaidTimeAdjustmentService } from "@spt-aki/services/RaidTimeAdjustmentService";
import { HashUtil } from "@spt-aki/utils/HashUtil";
@ -28,6 +29,7 @@ export declare class LocationController {
protected locationGenerator: LocationGenerator;
protected localisationService: LocalisationService;
protected raidTimeAdjustmentService: RaidTimeAdjustmentService;
protected itemFilterService: ItemFilterService;
protected lootGenerator: LootGenerator;
protected databaseServer: DatabaseServer;
protected timeUtil: TimeUtil;
@ -35,7 +37,7 @@ export declare class LocationController {
protected applicationContext: ApplicationContext;
protected airdropConfig: IAirdropConfig;
protected locationConfig: ILocationConfig;
constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, weightedRandomHelper: WeightedRandomHelper, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, raidTimeAdjustmentService: RaidTimeAdjustmentService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer, applicationContext: ApplicationContext);
constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, weightedRandomHelper: WeightedRandomHelper, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, raidTimeAdjustmentService: RaidTimeAdjustmentService, itemFilterService: ItemFilterService, lootGenerator: LootGenerator, databaseServer: DatabaseServer, timeUtil: TimeUtil, configServer: ConfigServer, applicationContext: ApplicationContext);
/**
* Handle client/location/getLocalloot
* Get a location (map) with generated loot data
@ -59,7 +61,7 @@ export declare class LocationController {
generateAll(sessionId: string): ILocationsGenerateAllResponse;
/**
* Handle client/location/getAirdropLoot
* Get loot for an airdop container
* Get loot for an airdrop container
* Generates it randomly based on config/airdrop.json values
* @returns Array of LootItem objects
*/

View File

@ -3,11 +3,9 @@ import { LootGenerator } from "@spt-aki/generators/LootGenerator";
import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper";
import { TraderHelper } from "@spt-aki/helpers/TraderHelper";
import { IPmcData } from "@spt-aki/models/eft/common/IPmcData";
import { ICreateGroupRequestData } from "@spt-aki/models/eft/match/ICreateGroupRequestData";
import { IEndOfflineRaidRequestData } from "@spt-aki/models/eft/match/IEndOfflineRaidRequestData";
import { IGetGroupStatusRequestData } from "@spt-aki/models/eft/match/IGetGroupStatusRequestData";
import { IGetGroupStatusResponse } from "@spt-aki/models/eft/match/IGetGroupStatusResponse";
import { IGetProfileRequestData } from "@spt-aki/models/eft/match/IGetProfileRequestData";
import { IGetRaidConfigurationRequestData } from "@spt-aki/models/eft/match/IGetRaidConfigurationRequestData";
import { IJoinMatchRequestData } from "@spt-aki/models/eft/match/IJoinMatchRequestData";
import { IJoinMatchResult } from "@spt-aki/models/eft/match/IJoinMatchResult";
@ -43,15 +41,11 @@ export declare class MatchController {
protected lootGenerator: LootGenerator;
protected applicationContext: ApplicationContext;
protected matchConfig: IMatchConfig;
protected inraidConfig: IInRaidConfig;
protected inRaidConfig: IInRaidConfig;
protected traderConfig: ITraderConfig;
protected pmcConfig: IPmcConfig;
constructor(logger: ILogger, saveServer: SaveServer, timeUtil: TimeUtil, randomUtil: RandomUtil, hashUtil: HashUtil, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, botGenerationCacheService: BotGenerationCacheService, mailSendService: MailSendService, lootGenerator: LootGenerator, applicationContext: ApplicationContext);
getEnabled(): boolean;
/** Handle raid/profile/list */
getProfile(info: IGetProfileRequestData): IPmcData[];
/** Handle client/match/group/create */
createGroup(sessionID: string, info: ICreateGroupRequestData): any;
/** Handle client/match/group/delete */
deleteGroup(info: any): void;
/** Handle match/group/start_game */

View File

@ -1,36 +0,0 @@
import { ItemHelper } from "@spt-aki/helpers/ItemHelper";
import { IPmcData } from "@spt-aki/models/eft/common/IPmcData";
import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse";
import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData";
import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData";
import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile";
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder";
import { DatabaseServer } from "@spt-aki/servers/DatabaseServer";
import { SaveServer } from "@spt-aki/servers/SaveServer";
import { HashUtil } from "@spt-aki/utils/HashUtil";
import { JsonUtil } from "@spt-aki/utils/JsonUtil";
export declare class PresetBuildController {
protected logger: ILogger;
protected hashUtil: HashUtil;
protected eventOutputHolder: EventOutputHolder;
protected jsonUtil: JsonUtil;
protected databaseServer: DatabaseServer;
protected itemHelper: ItemHelper;
protected saveServer: SaveServer;
constructor(logger: ILogger, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, saveServer: SaveServer);
/** Handle client/handbook/builds/my/list */
getUserBuilds(sessionID: string): IUserBuilds;
/** Handle SaveWeaponBuild event */
saveWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionId: string): IItemEventRouterResponse;
/** Handle SaveEquipmentBuild event */
saveEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse;
protected saveBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string, buildType: string): IItemEventRouterResponse;
/** Handle RemoveWeaponBuild event*/
removeBuild(pmcData: IPmcData, body: IRemoveBuildRequestData, sessionID: string): IItemEventRouterResponse;
/** Handle RemoveWeaponBuild event*/
removeWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse;
/** Handle RemoveEquipmentBuild event*/
removeEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse;
protected removePlayerBuild(pmcData: IPmcData, id: string, sessionID: string): IItemEventRouterResponse;
}

View File

@ -1,8 +1,10 @@
import { PresetHelper } from "@spt-aki/helpers/PresetHelper";
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
import { DatabaseServer } from "@spt-aki/servers/DatabaseServer";
export declare class PresetController {
protected logger: ILogger;
protected presetHelper: PresetHelper;
protected databaseServer: DatabaseServer;
constructor(presetHelper: PresetHelper, databaseServer: DatabaseServer);
constructor(logger: ILogger, presetHelper: PresetHelper, databaseServer: DatabaseServer);
initialize(): void;
}

View File

@ -7,7 +7,10 @@ import { TraderHelper } from "@spt-aki/helpers/TraderHelper";
import { IPmcData } from "@spt-aki/models/eft/common/IPmcData";
import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse";
import { IMiniProfile } from "@spt-aki/models/eft/launcher/IMiniProfile";
import { GetProfileStatusResponseData } from "@spt-aki/models/eft/profile/GetProfileStatusResponseData";
import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile";
import { IGetOtherProfileRequest } from "@spt-aki/models/eft/profile/IGetOtherProfileRequest";
import { IGetOtherProfileResponse } from "@spt-aki/models/eft/profile/IGetOtherProfileResponse";
import { IProfileChangeNicknameRequestData } from "@spt-aki/models/eft/profile/IProfileChangeNicknameRequestData";
import { IProfileChangeVoiceRequestData } from "@spt-aki/models/eft/profile/IProfileChangeVoiceRequestData";
import { IProfileCreateRequestData } from "@spt-aki/models/eft/profile/IProfileCreateRequestData";
@ -21,6 +24,7 @@ import { SaveServer } from "@spt-aki/servers/SaveServer";
import { LocalisationService } from "@spt-aki/services/LocalisationService";
import { MailSendService } from "@spt-aki/services/MailSendService";
import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService";
import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService";
import { HashUtil } from "@spt-aki/utils/HashUtil";
import { TimeUtil } from "@spt-aki/utils/TimeUtil";
export declare class ProfileController {
@ -32,6 +36,7 @@ export declare class ProfileController {
protected itemHelper: ItemHelper;
protected profileFixerService: ProfileFixerService;
protected localisationService: LocalisationService;
protected seasonalEventService: SeasonalEventService;
protected mailSendService: MailSendService;
protected playerScavGenerator: PlayerScavGenerator;
protected eventOutputHolder: EventOutputHolder;
@ -39,7 +44,7 @@ export declare class ProfileController {
protected dialogueHelper: DialogueHelper;
protected questHelper: QuestHelper;
protected profileHelper: ProfileHelper;
constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, mailSendService: MailSendService, playerScavGenerator: PlayerScavGenerator, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, questHelper: QuestHelper, profileHelper: ProfileHelper);
constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, seasonalEventService: SeasonalEventService, mailSendService: MailSendService, playerScavGenerator: PlayerScavGenerator, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, questHelper: QuestHelper, profileHelper: ProfileHelper);
/**
* Handle /launcher/profiles
*/
@ -59,6 +64,11 @@ export declare class ProfileController {
* @returns Profiles _id value
*/
createProfile(info: IProfileCreateRequestData, sessionID: string): string;
/**
* make profiles pmcData.Inventory.equipment unique
* @param pmcData Profile to update
*/
protected updateInventoryEquipmentId(pmcData: IPmcData): void;
/**
* Delete a profile
* @param sessionID Id of profile to delete
@ -101,4 +111,9 @@ export declare class ProfileController {
* Handle client/game/profile/search
*/
getFriends(info: ISearchFriendRequestData, sessionID: string): ISearchFriendResponse[];
/**
* Handle client/profile/status
*/
getProfileStatus(sessionId: string): GetProfileStatusResponseData;
getOtherProfile(sessionId: string, request: IGetOtherProfileRequest): IGetOtherProfileResponse;
}

View File

@ -7,11 +7,12 @@ import { TraderHelper } from "@spt-aki/helpers/TraderHelper";
import { IPmcData } from "@spt-aki/models/eft/common/IPmcData";
import { IQuestStatus } from "@spt-aki/models/eft/common/tables/IBotBase";
import { Item } from "@spt-aki/models/eft/common/tables/IItem";
import { AvailableForConditions, IQuest, Reward } from "@spt-aki/models/eft/common/tables/IQuest";
import { IQuest, IQuestCondition } from "@spt-aki/models/eft/common/tables/IQuest";
import { IRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests";
import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse";
import { IAcceptQuestRequestData } from "@spt-aki/models/eft/quests/IAcceptQuestRequestData";
import { ICompleteQuestRequestData } from "@spt-aki/models/eft/quests/ICompleteQuestRequestData";
import { IFailQuestRequestData } from "@spt-aki/models/eft/quests/IFailQuestRequestData";
import { IHandoverQuestRequestData } from "@spt-aki/models/eft/quests/IHandoverQuestRequestData";
import { IQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig";
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
@ -68,12 +69,6 @@ export declare class QuestController {
* @returns true = show to player
*/
protected showEventQuestToPlayer(questId: string): boolean;
/**
* Is the quest for the opposite side the player is on
* @param playerSide Player side (usec/bear)
* @param questId QuestId to check
*/
protected questIsForOtherSide(playerSide: string, questId: string): boolean;
/**
* Handle QuestAccept event
* Handle the client accepting a quest and starting it
@ -113,6 +108,12 @@ export declare class QuestController {
* @returns ItemEvent client response
*/
completeQuest(pmcData: IPmcData, body: ICompleteQuestRequestData, sessionID: string): IItemEventRouterResponse;
/**
* Return a list of quests that would fail when supplied quest is completed
* @param completedQuestId quest completed id
* @returns array of IQuest objects
*/
protected getQuestsFailedByCompletingQuest(completedQuestId: string, pmcProfile: IPmcData): IQuest[];
/**
* Remove a quest entirely from a profile
* @param sessionId Player id
@ -133,7 +134,7 @@ export declare class QuestController {
* @param completedQuestId Completed quest id
* @param questRewards Rewards given to player
*/
protected sendSuccessDialogMessageOnQuestComplete(sessionID: string, pmcData: IPmcData, completedQuestId: string, questRewards: Reward[]): void;
protected sendSuccessDialogMessageOnQuestComplete(sessionID: string, pmcData: IPmcData, completedQuestId: string, questRewards: Item[]): void;
/**
* Look for newly available quests after completing a quest with a requirement to wait x minutes (time-locked) before being available and add data to profile
* @param pmcData Player profile to update
@ -141,12 +142,6 @@ export declare class QuestController {
* @param completedQuestId Quest just completed
*/
protected addTimeLockedQuestsToProfile(pmcData: IPmcData, quests: IQuest[], completedQuestId: string): void;
/**
* Returns a list of quests that should be failed when a quest is completed
* @param completedQuestId quest completed id
* @returns array of quests
*/
protected getQuestsFailedByCompletingQuest(completedQuestId: string): IQuest[];
/**
* Fail the provided quests
* Update quest in profile, otherwise add fresh quest object with failed status
@ -179,7 +174,7 @@ export declare class QuestController {
* @param output Response to send to user
* @returns IItemEventRouterResponse
*/
protected showQuestItemHandoverMatchError(handoverQuestRequest: IHandoverQuestRequestData, itemHandedOver: Item, handoverRequirements: AvailableForConditions, output: IItemEventRouterResponse): IItemEventRouterResponse;
protected showQuestItemHandoverMatchError(handoverQuestRequest: IHandoverQuestRequestData, itemHandedOver: Item, handoverRequirements: IQuestCondition, output: IItemEventRouterResponse): IItemEventRouterResponse;
/**
* Increment a backend counter stored value by an amount,
* Create counter if it does not exist
@ -188,5 +183,13 @@ export declare class QuestController {
* @param questId quest id counter is associated with
* @param counterValue value to increment the backend counter with
*/
protected updateProfileBackendCounterValue(pmcData: IPmcData, conditionId: string, questId: string, counterValue: number): void;
protected updateProfileTaskConditionCounterValue(pmcData: IPmcData, conditionId: string, questId: string, counterValue: number): void;
/**
* Handle /client/game/profile/items/moving - QuestFail
* @param pmcData Pmc profile
* @param request Fail qeust request
* @param sessionID Session id
* @returns IItemEventRouterResponse
*/
failQuest(pmcData: IPmcData, request: IFailQuestRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse;
}

View File

@ -21,6 +21,7 @@ import { IGetMarketPriceRequestData } from "@spt-aki/models/eft/ragfair/IGetMark
import { IGetOffersResult } from "@spt-aki/models/eft/ragfair/IGetOffersResult";
import { IGetRagfairOfferByIdRequest } from "@spt-aki/models/eft/ragfair/IGetRagfairOfferByIdRequest";
import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer";
import { IRemoveOfferRequestData } from "@spt-aki/models/eft/ragfair/IRemoveOfferRequestData";
import { ISearchRequestData } from "@spt-aki/models/eft/ragfair/ISearchRequestData";
import { IProcessBuyTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBuyTradeRequestData";
import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig";
@ -69,9 +70,17 @@ export declare class RagfairController {
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, ragfairTaxService: RagfairTaxService, 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);
/**
* Handles client/ragfair/find
* Returns flea offers that match required search parameters
* @param sessionID Player id
* @param searchRequest Search request data
* @returns IGetOffersResult
*/
getOffers(sessionID: string, searchRequest: ISearchRequestData): IGetOffersResult;
/**
* Handle client/ragfair/offer/findbyid
* Handle client/ragfair/offer/findbyid
* Occurs when searching for `#x` on flea
* @param sessionId Player id
* @param request Request data
* @returns IRagfairOffer
@ -80,7 +89,7 @@ export declare class RagfairController {
/**
* Get offers for the client based on type of search being performed
* @param searchRequest Client search request data
* @param itemsToAdd comes from ragfairHelper.filterCategories()
* @param itemsToAdd Comes from ragfairHelper.filterCategories()
* @param traderAssorts Trader assorts
* @param pmcProfile Player profile
* @returns array of offers
@ -89,18 +98,10 @@ export declare class RagfairController {
/**
* Get categories for the type of search being performed, linked/required/all
* @param searchRequest Client search request data
* @param offers ragfair offers to get categories for
* @returns record with tpls + counts
* @param offers Ragfair offers to get categories for
* @returns record with templates + counts
*/
protected getSpecificCategories(pmcProfile: IPmcData, searchRequest: ISearchRequestData, offers: IRagfairOffer[]): Record<string, number>;
/**
* Add Required offers to offers result
* @param searchRequest Client search request data
* @param assorts
* @param pmcProfile Player profile
* @param result Result object being sent back to client
*/
protected addRequiredOffersToResult(searchRequest: ISearchRequestData, assorts: Record<string, ITraderAssort>, pmcProfile: IPmcData, result: IGetOffersResult): void;
/**
* Add index to all offers passed in (0-indexed)
* @param offers Offers to add index value to
@ -108,16 +109,26 @@ export declare class RagfairController {
protected addIndexValueToOffers(offers: IRagfairOffer[]): void;
/**
* Update a trader flea offer with buy restrictions stored in the traders assort
* @param offer flea offer to update
* @param profile full profile of player
* @param offer Flea offer to update
* @param fullProfile Players full profile
*/
protected setTraderOfferPurchaseLimits(offer: IRagfairOffer, profile: IAkiProfile): void;
protected setTraderOfferPurchaseLimits(offer: IRagfairOffer, fullProfile: IAkiProfile): void;
/**
* Adjust ragfair offer stack count to match same value as traders assort stack count
* @param offer Flea offer to adjust
* @param offer Flea offer to adjust stack size of
*/
protected setTraderOfferStackSize(offer: IRagfairOffer): void;
/**
* Is the flea search being performed a 'linked' search type
* @param info Search request
* @returns True if it is a 'linked' search type
*/
protected isLinkedSearch(info: ISearchRequestData): boolean;
/**
* Is the flea search being performed a 'required' search type
* @param info Search request
* @returns True if it is a 'required' search type
*/
protected isRequiredSearch(info: ISearchRequestData): boolean;
/**
* Check all profiles and sell player offers / send player money for listing if it sold
@ -163,25 +174,33 @@ export declare class RagfairController {
*/
protected calculateRequirementsPriceInRub(requirements: Requirement[]): number;
/**
* Using item ids from flea offer request, find corrispnding items from player inventory and return as array
* Using item ids from flea offer request, find corresponding items from player inventory and return as array
* @param pmcData Player profile
* @param itemIdsFromFleaOfferRequest Ids from request
* @param errorMessage if item is not found, add error message to this parameter
* @returns Array of items from player inventory
*/
protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[], errorMessage: string): Item[];
createPlayerOffer(profile: IAkiProfile, requirements: Requirement[], items: Item[], sellInOnePiece: boolean, amountToSend: number): IRagfairOffer;
protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[]): {
items: Item[] | null;
errorMessage: string | null;
};
createPlayerOffer(sessionId: string, requirements: Requirement[], items: Item[], sellInOnePiece: boolean): IRagfairOffer;
getAllFleaPrices(): Record<string, number>;
getStaticPrices(): Record<string, number>;
/**
* User requested removal of the offer, actually reduces the time to 71 seconds,
* allowing for the possibility of extending the auction before it's end time
* @param offerId offer to 'remove'
* @param sessionID Players id
* @param removeRequest Remove offer request
* @param sessionId Players id
* @returns IItemEventRouterResponse
*/
removeOffer(offerId: string, sessionID: string): IItemEventRouterResponse;
extendOffer(info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse;
removeOffer(removeRequest: IRemoveOfferRequestData, sessionId: string): IItemEventRouterResponse;
/**
* Extend a ragfair offers listing time
* @param extendRequest Extend offer request
* @param sessionId Players id
* @returns IItemEventRouterResponse
*/
extendOffer(extendRequest: IExtendOfferRequestData, sessionId: string): IItemEventRouterResponse;
/**
* Create a basic trader request object with price and currency type
* @param currency What currency: RUB, EURO, USD

View File

@ -1,3 +1,4 @@
import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper";
import { QuestHelper } from "@spt-aki/helpers/QuestHelper";
import { RepairHelper } from "@spt-aki/helpers/RepairHelper";
import { TraderHelper } from "@spt-aki/helpers/TraderHelper";
@ -20,8 +21,9 @@ export declare class RepairController {
protected paymentService: PaymentService;
protected repairHelper: RepairHelper;
protected repairService: RepairService;
protected profileHelper: ProfileHelper;
protected repairConfig: IRepairConfig;
constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, repairService: RepairService);
constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, repairService: RepairService, profileHelper: ProfileHelper);
/**
* Handle TraderRepair event
* Repair with trader

View File

@ -1,13 +1,13 @@
import { RepeatableQuestGenerator } from "@spt-aki/generators/RepeatableQuestGenerator";
import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper";
import { QuestHelper } from "@spt-aki/helpers/QuestHelper";
import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper";
import { RepeatableQuestHelper } from "@spt-aki/helpers/RepeatableQuestHelper";
import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData";
import { IPmcData } from "@spt-aki/models/eft/common/IPmcData";
import { IPmcDataRepeatableQuest, IRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests";
import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse";
import { IRepeatableQuestChangeRequest } from "@spt-aki/models/eft/quests/IRepeatableQuestChangeRequest";
import { ELocationName } from "@spt-aki/models/enums/ELocationName";
import { IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig";
import { IQuestTypePool } from "@spt-aki/models/spt/repeatable/IQuestTypePool";
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
@ -30,7 +30,6 @@ export declare class RepeatableQuestController {
protected jsonUtil: JsonUtil;
protected profileHelper: ProfileHelper;
protected profileFixerService: ProfileFixerService;
protected ragfairServerHelper: RagfairServerHelper;
protected eventOutputHolder: EventOutputHolder;
protected paymentService: PaymentService;
protected objectId: ObjectId;
@ -39,7 +38,7 @@ export declare class RepeatableQuestController {
protected questHelper: QuestHelper;
protected configServer: ConfigServer;
protected questConfig: IQuestConfig;
constructor(logger: ILogger, databaseServer: DatabaseServer, timeUtil: TimeUtil, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, repeatableQuestGenerator: RepeatableQuestGenerator, repeatableQuestHelper: RepeatableQuestHelper, questHelper: QuestHelper, configServer: ConfigServer);
constructor(logger: ILogger, databaseServer: DatabaseServer, timeUtil: TimeUtil, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, repeatableQuestGenerator: RepeatableQuestGenerator, repeatableQuestHelper: RepeatableQuestHelper, questHelper: QuestHelper, configServer: ConfigServer);
/**
* Handle client/repeatalbeQuests/activityPeriods
* Returns an array of objects in the format of repeatable quests to the client.
@ -62,9 +61,9 @@ export declare class RepeatableQuestController {
* The new quests generated are again persisted in profile.RepeatableQuests
*
* @param {string} _info Request from client
* @param {string} sessionID Player's session id
* @param {string} sessionID Player's session id
*
* @returns {array} array of "repeatableQuestObjects" as descibed above
* @returns {array} Array of "repeatableQuestObjects" as descibed above
*/
getClientRepeatableQuests(_info: IEmptyRequestData, sessionID: string): IPmcDataRepeatableQuest[];
/**
@ -95,6 +94,20 @@ export declare class RepeatableQuestController {
*/
protected generateQuestPool(repeatableConfig: IRepeatableQuestConfig, pmcLevel: number): IQuestTypePool;
protected createBaseQuestPool(repeatableConfig: IRepeatableQuestConfig): IQuestTypePool;
/**
* Return the locations this PMC is allowed to get daily quests for based on their level
* @param locations The original list of locations
* @param pmcLevel The level of the player PMC
* @returns A filtered list of locations that allow the player PMC level to access it
*/
protected getAllowedLocations(locations: Record<ELocationName, string[]>, pmcLevel: number): Partial<Record<ELocationName, string[]>>;
/**
* Return true if the given pmcLevel is allowed on the given location
* @param location The location name to check
* @param pmcLevel The level of the pmc
* @returns True if the given pmc level is allowed to access the given location
*/
protected isPmcLevelAllowedOnLocation(location: string, pmcLevel: number): boolean;
debugLogRepeatableQuestIds(pmcData: IPmcData): void;
/**
* Handle RepeatableQuestChange event

View File

@ -3,11 +3,12 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper";
import { TradeHelper } from "@spt-aki/helpers/TradeHelper";
import { TraderHelper } from "@spt-aki/helpers/TraderHelper";
import { IPmcData } from "@spt-aki/models/eft/common/IPmcData";
import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem";
import { Item } from "@spt-aki/models/eft/common/tables/IItem";
import { ITraderBase } from "@spt-aki/models/eft/common/tables/ITrader";
import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse";
import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer";
import { IProcessBaseTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBaseTradeRequestData";
import { IProcessRagfairTradeRequestData } from "@spt-aki/models/eft/trade/IProcessRagfairTradeRequestData";
import { IOfferRequest, IProcessRagfairTradeRequestData } from "@spt-aki/models/eft/trade/IProcessRagfairTradeRequestData";
import { ISellScavItemsToFenceRequestData } from "@spt-aki/models/eft/trade/ISellScavItemsToFenceRequestData";
import { Traders } from "@spt-aki/models/enums/Traders";
import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig";
@ -15,15 +16,24 @@ import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig";
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder";
import { ConfigServer } from "@spt-aki/servers/ConfigServer";
import { DatabaseServer } from "@spt-aki/servers/DatabaseServer";
import { RagfairServer } from "@spt-aki/servers/RagfairServer";
import { LocalisationService } from "@spt-aki/services/LocalisationService";
import { MailSendService } from "@spt-aki/services/MailSendService";
import { RagfairPriceService } from "@spt-aki/services/RagfairPriceService";
import { HashUtil } from "@spt-aki/utils/HashUtil";
import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil";
import { JsonUtil } from "@spt-aki/utils/JsonUtil";
import { RandomUtil } from "@spt-aki/utils/RandomUtil";
import { TimeUtil } from "@spt-aki/utils/TimeUtil";
export declare class TradeController {
protected logger: ILogger;
protected databaseServer: DatabaseServer;
protected eventOutputHolder: EventOutputHolder;
protected tradeHelper: TradeHelper;
protected timeUtil: TimeUtil;
protected randomUtil: RandomUtil;
protected hashUtil: HashUtil;
protected itemHelper: ItemHelper;
protected profileHelper: ProfileHelper;
protected traderHelper: TraderHelper;
@ -32,26 +42,51 @@ export declare class TradeController {
protected httpResponse: HttpResponseUtil;
protected localisationService: LocalisationService;
protected ragfairPriceService: RagfairPriceService;
protected mailSendService: MailSendService;
protected configServer: ConfigServer;
protected roubleTpl: string;
protected ragfairConfig: IRagfairConfig;
protected traderConfig: ITraderConfig;
constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, jsonUtil: JsonUtil, ragfairServer: RagfairServer, httpResponse: HttpResponseUtil, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService, configServer: ConfigServer);
constructor(logger: ILogger, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, timeUtil: TimeUtil, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, jsonUtil: JsonUtil, ragfairServer: RagfairServer, httpResponse: HttpResponseUtil, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService, mailSendService: MailSendService, configServer: ConfigServer);
/** Handle TradingConfirm event */
confirmTrading(pmcData: IPmcData, request: IProcessBaseTradeRequestData, sessionID: string): IItemEventRouterResponse;
/** Handle RagFairBuyOffer event */
confirmRagfairTrading(pmcData: IPmcData, body: IProcessRagfairTradeRequestData, sessionID: string): IItemEventRouterResponse;
confirmRagfairTrading(pmcData: IPmcData, request: IProcessRagfairTradeRequestData, sessionID: string): IItemEventRouterResponse;
/**
* Buy an item off the flea sold by a trader
* @param sessionId Session id
* @param pmcData Player profile
* @param fleaOffer Offer being purchased
* @param requestOffer request data from client
* @param output Output to send back to client
*/
protected buyTraderItemFromRagfair(sessionId: string, pmcData: IPmcData, fleaOffer: IRagfairOffer, requestOffer: IOfferRequest, output: IItemEventRouterResponse): void;
/**
* Buy an item off the flea sold by a PMC
* @param sessionId Session id
* @param pmcData Player profile
* @param fleaOffer Offer being purchased
* @param requestOffer Request data from client
* @param output Output to send back to client
*/
protected buyPmcItemFromRagfair(sessionId: string, pmcData: IPmcData, fleaOffer: IRagfairOffer, requestOffer: IOfferRequest, output: IItemEventRouterResponse): void;
/**
* Does Player have necessary trader loyalty to purchase flea offer
* @param sellerIsTrader is seller trader
* @param fleaOffer FLea offer being bought
* @param pmcData Player profile
* @returns True if player can buy offer
*/
protected playerLacksTraderLoyaltyLevelToBuyOffer(fleaOffer: IRagfairOffer, pmcData: IPmcData): boolean;
/** Handle SellAllFromSavage event */
sellScavItemsToFence(pmcData: IPmcData, request: ISellScavItemsToFenceRequestData, sessionId: string): IItemEventRouterResponse;
/**
* Sell all sellable items to a trader from inventory
* WILL DELETE ITEMS FROM INVENTORY + CHILDREN OF ITEMS SOLD
* Send the specified rouble total to player as mail
* @param sessionId Session id
* @param profileWithItemsToSell Profile with items to be sold to trader
* @param profileThatGetsMoney Profile that gets the money after selling items
* @param trader Trader to sell items to
* @returns IItemEventRouterResponse
* @param output IItemEventRouterResponse
*/
protected sellInventoryToTrader(sessionId: string, profileWithItemsToSell: IPmcData, profileThatGetsMoney: IPmcData, trader: Traders): IItemEventRouterResponse;
protected mailMoneyToPlayer(sessionId: string, roublesToSend: number, trader: Traders): void;
/**
* Looks up an items children and gets total handbook price for them
* @param parentItemId parent item that has children we want to sum price of
@ -61,5 +96,4 @@ export declare class TradeController {
* @returns Rouble price
*/
protected getPriceOfItemAndChildren(parentItemId: string, items: Item[], handbookPrices: Record<string, number>, traderDetails: ITraderBase): number;
protected confirmTradingInternal(pmcData: IPmcData, body: IProcessBaseTradeRequestData, sessionID: string, foundInRaid?: boolean, upd?: Upd): IItemEventRouterResponse;
}

View File

@ -3,14 +3,18 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper";
import { TraderAssortHelper } from "@spt-aki/helpers/TraderAssortHelper";
import { TraderHelper } from "@spt-aki/helpers/TraderHelper";
import { ITraderAssort, ITraderBase } from "@spt-aki/models/eft/common/tables/ITrader";
import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig";
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
import { ConfigServer } from "@spt-aki/servers/ConfigServer";
import { DatabaseServer } from "@spt-aki/servers/DatabaseServer";
import { FenceService } from "@spt-aki/services/FenceService";
import { TraderAssortService } from "@spt-aki/services/TraderAssortService";
import { TraderPurchasePersisterService } from "@spt-aki/services/TraderPurchasePersisterService";
import { JsonUtil } from "@spt-aki/utils/JsonUtil";
import { TimeUtil } from "@spt-aki/utils/TimeUtil";
export declare class TraderController {
protected logger: ILogger;
protected timeUtil: TimeUtil;
protected databaseServer: DatabaseServer;
protected traderAssortHelper: TraderAssortHelper;
protected profileHelper: ProfileHelper;
@ -20,10 +24,12 @@ export declare class TraderController {
protected fenceService: FenceService;
protected fenceBaseAssortGenerator: FenceBaseAssortGenerator;
protected jsonUtil: JsonUtil;
constructor(logger: ILogger, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, traderAssortService: TraderAssortService, traderPurchasePersisterService: TraderPurchasePersisterService, fenceService: FenceService, fenceBaseAssortGenerator: FenceBaseAssortGenerator, jsonUtil: JsonUtil);
protected configServer: ConfigServer;
protected traderConfig: ITraderConfig;
constructor(logger: ILogger, timeUtil: TimeUtil, databaseServer: DatabaseServer, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, traderAssortService: TraderAssortService, traderPurchasePersisterService: TraderPurchasePersisterService, fenceService: FenceService, fenceBaseAssortGenerator: FenceBaseAssortGenerator, jsonUtil: JsonUtil, configServer: ConfigServer);
/**
* Runs when onLoad event is fired
* Iterate over traders, ensure an unmolested copy of their assorts is stored in traderAssortService
* Iterate over traders, ensure a pristine copy of their assorts is stored in traderAssortService
* Store timestamp of next assort refresh in nextResupply property of traders .base object
*/
load(): void;

View File

@ -21,7 +21,7 @@ export declare class DynamicRouter extends Router {
getHandledRoutes(): HandledRoute[];
}
export declare class ItemEventRouterDefinition extends Router {
handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string): IItemEventRouterResponse;
handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string, output: IItemEventRouterResponse): void;
}
export declare class SaveLoadRouter extends Router {
handleLoad(profile: IAkiProfile): IAkiProfile;

View File

@ -2,12 +2,17 @@ import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper";
import { BotHelper } from "@spt-aki/helpers/BotHelper";
import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper";
import { ItemHelper } from "@spt-aki/helpers/ItemHelper";
import { PresetHelper } from "@spt-aki/helpers/PresetHelper";
import { ProbabilityHelper } from "@spt-aki/helpers/ProbabilityHelper";
import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper";
import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper";
import { IPreset } from "@spt-aki/models/eft/common/IGlobals";
import { Mods, ModsChances } from "@spt-aki/models/eft/common/tables/IBotType";
import { Item } from "@spt-aki/models/eft/common/tables/IItem";
import { ITemplateItem, Slot } from "@spt-aki/models/eft/common/tables/ITemplateItem";
import { EquipmentFilterDetails, IBotConfig } from "@spt-aki/models/spt/config/IBotConfig";
import { ModSpawn } from "@spt-aki/models/enums/ModSpawn";
import { IChooseRandomCompatibleModResult } from "@spt-aki/models/spt/bots/IChooseRandomCompatibleModResult";
import { EquipmentFilterDetails, EquipmentFilters, IBotConfig } from "@spt-aki/models/spt/config/IBotConfig";
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
import { ConfigServer } from "@spt-aki/servers/ConfigServer";
import { DatabaseServer } from "@spt-aki/servers/DatabaseServer";
@ -19,6 +24,8 @@ import { LocalisationService } from "@spt-aki/services/LocalisationService";
import { HashUtil } from "@spt-aki/utils/HashUtil";
import { JsonUtil } from "@spt-aki/utils/JsonUtil";
import { RandomUtil } from "@spt-aki/utils/RandomUtil";
import { IGenerateEquipmentProperties } from "./BotInventoryGenerator";
import { IFilterPlateModsForSlotByLevelResult } from "./IFilterPlateModsForSlotByLevelResult";
export declare class BotEquipmentModGenerator {
protected logger: ILogger;
protected jsonUtil: JsonUtil;
@ -34,39 +41,48 @@ export declare class BotEquipmentModGenerator {
protected botHelper: BotHelper;
protected botGeneratorHelper: BotGeneratorHelper;
protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper;
protected weightedRandomHelper: WeightedRandomHelper;
protected presetHelper: PresetHelper;
protected localisationService: LocalisationService;
protected botEquipmentModPoolService: BotEquipmentModPoolService;
protected configServer: ConfigServer;
protected botConfig: IBotConfig;
constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, itemHelper: ItemHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponModLimitService: BotWeaponModLimitService, botHelper: BotHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, localisationService: LocalisationService, botEquipmentModPoolService: BotEquipmentModPoolService, configServer: ConfigServer);
constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseServer: DatabaseServer, itemHelper: ItemHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponModLimitService: BotWeaponModLimitService, botHelper: BotHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, presetHelper: PresetHelper, localisationService: LocalisationService, botEquipmentModPoolService: BotEquipmentModPoolService, configServer: ConfigServer);
/**
* Check mods are compatible and add to array
* @param equipment Equipment item to add mods to
* @param modPool Mod list to choose frm
* @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, botRole: string, forceSpawn?: boolean): Item[];
generateModsForEquipment(equipment: Item[], parentId: string, parentTemplate: ITemplateItem, settings: IGenerateEquipmentProperties, shouldForceSpawn?: boolean): Item[];
/**
* Filter a bots plate pool based on its current level
* @param settings Bot equipment generation settings
* @param modSlot Armor slot being filtered
* @param existingPlateTplPool Plates tpls to choose from
* @param armorItem
* @returns Array of plate tpls to choose from
*/
protected filterPlateModsForSlotByLevel(settings: IGenerateEquipmentProperties, modSlot: string, existingPlateTplPool: string[], armorItem: ITemplateItem): IFilterPlateModsForSlotByLevelResult;
/**
* Add mods to a weapon using the provided mod pool
* @param sessionId session id
* @param weapon Weapon to add mods to
* @param modPool Pool of compatible mods to attach to weapon
* @param weaponParentId parentId of weapon
* @param weaponId parentId of weapon
* @param parentTemplate Weapon which mods will be generated on
* @param modSpawnChances Mod spawn chances
* @param ammoTpl Ammo tpl to use when generating magazines/cartridges
* @param botRole Role of bot weapon is generated for
* @param botLevel lvel of the bot weapon is being generated for
* @param modLimits limits placed on certian mod types per gun
* @param botLevel Level of the bot weapon is being generated for
* @param modLimits limits placed on certain mod types per gun
* @param botEquipmentRole role of bot when accessing bot.json equipment config settings
* @returns Weapon + mods array
*/
generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponParentId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances, ammoTpl: string, botRole: string, botLevel: number, modLimits: BotModLimits, botEquipmentRole: string): Item[];
generateModsForWeapon(sessionId: string, weapon: Item[], modPool: Mods, weaponId: string, parentTemplate: ITemplateItem, modSpawnChances: ModsChances, ammoTpl: string, botRole: string, botLevel: number, modLimits: BotModLimits, botEquipmentRole: string): Item[];
/**
* Is this modslot a front or rear sight
* @param modSlot Slot to check
@ -93,16 +109,16 @@ export declare class BotEquipmentModGenerator {
* @param parentTemplate item template
* @returns Slot item
*/
protected getModItemSlot(modSlot: string, parentTemplate: ITemplateItem): Slot;
protected getModItemSlotFromDb(modSlot: string, parentTemplate: ITemplateItem): Slot;
/**
* 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
* @param itemSlot slot the item sits in
* @param modSlot slot the mod sits in
* @param modSpawnChances Chances for various mod spawns
* @returns boolean true if it should spawn
* @param botEquipConfig Various config settings for generating this type of bot
* @returns ModSpawn.SPAWN when mod should be spawned, ModSpawn.DEFAULT_MOD when default mod should spawn, ModSpawn.SKIP when mod is skipped
*/
protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances): boolean;
protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances, botEquipConfig: EquipmentFilters): ModSpawn;
/**
* @param modSlot Slot mod will fit into
* @param isRandomisableSlot Will generate a randomised mod pool if true
@ -112,9 +128,32 @@ export declare class BotEquipmentModGenerator {
* @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 Parent item the mod will go into
* @returns ITemplateItem
* @returns itemHelper.getItem() result
*/
protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, botWeaponSightWhitelist: Record<string, string[]>, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record<string, string[]>, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem): [boolean, ITemplateItem];
protected chooseModToPutIntoSlot(modSlot: string, isRandomisableSlot: boolean, botWeaponSightWhitelist: Record<string, string[]>, botEquipBlacklist: EquipmentFilterDetails, itemModPool: Record<string, string[]>, weapon: Item[], ammoTpl: string, parentTemplate: ITemplateItem, modSpawnResult: ModSpawn): [boolean, ITemplateItem];
protected pickWeaponModTplForSlotFromPool(modPool: string[], parentSlot: Slot, modSpawnResult: ModSpawn, weapon: Item[], modSlotname: string): IChooseRandomCompatibleModResult;
/**
* Filter mod pool down based on various criteria:
* Is slot flagged as randomisable
* Is slot required
* Is slot flagged as default mod only
* @param itemModPool Existing pool of mods to choose
* @param modSpawnResult outcome of random roll to select if mod should be added
* @param parentTemplate Mods parent
* @param weaponTemplate Mods root parent (weapon/equipment)
* @param modSlot name of mod slot to choose for
* @param botEquipBlacklist
* @param isRandomisableSlot is flagged as a randomisable slot
* @returns
*/
protected getModPoolForSlot(itemModPool: Record<string, string[]>, modSpawnResult: ModSpawn, parentTemplate: ITemplateItem, weaponTemplate: ITemplateItem, modSlot: string, botEquipBlacklist: EquipmentFilterDetails, isRandomisableSlot: boolean): string[];
/**
* Get default preset for weapon, get specific weapon presets for edge cases (mp5/silenced dvl)
* @param weaponTemplate
* @param parentItemTpl
* @returns
*/
protected getMatchingPreset(weaponTemplate: ITemplateItem, parentItemTpl: string): IPreset;
/**
* Temp fix to prevent certain combinations of weapons with mods that are known to be incompatible
* @param weapon Weapon
@ -128,7 +167,7 @@ export declare class BotEquipmentModGenerator {
* @param modTpl _tpl
* @param parentId parentId
* @param modSlot slotId
* @param modTemplate Used to add additional properites in the upd object
* @param modTemplate Used to add additional properties in the upd object
* @returns Item object
*/
protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem, botRole: string): Item;
@ -141,21 +180,22 @@ export declare class BotEquipmentModGenerator {
/**
* Get a random mod from an items compatible mods Filter array
* @param modTpl ???? default value to return if nothing found
* @param parentSlot item mod will go into, used to get combatible items
* @param parentSlot item mod will go into, used to get compatible 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;
protected getRandomModTplFromItemDb(modTpl: string, parentSlot: Slot, modSlot: string, items: Item[]): string;
/**
* Log errors if mod is not compatible with slot
* @param modToAdd template of mod to check
* @param itemSlot slot the item will be placed in
* @param slotAddedToTemplate slot the item will be placed in
* @param modSlot slot the mod will fill
* @param parentTemplate template of the mods parent item
* @param parentTemplate template of the mods being added
* @param botRole
* @returns true if valid
*/
protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], itemSlot: Slot, modSlot: string, parentTemplate: ITemplateItem): boolean;
protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], slotAddedToTemplate: Slot, modSlot: string, parentTemplate: ITemplateItem, botRole: string): boolean;
/**
* Find mod tpls of a provided type and add to modPool
* @param desiredSlotName slot to look up and add we are adding tpls for (e.g mod_scope)
@ -191,9 +231,9 @@ export declare class BotEquipmentModGenerator {
*/
protected fillCamora(items: Item[], modPool: Mods, parentId: string, parentTemplate: ITemplateItem): void;
/**
* Take a record of camoras and merge the compatable shells into one array
* Take a record of camoras and merge the compatible shells into one array
* @param camorasWithShells camoras we want to merge into one array
* @returns string array of shells fro luitple camora sources
* @returns string array of shells for multiple camora sources
*/
protected mergeCamoraPoolsTogether(camorasWithShells: Record<string, string[]>): string[];
/**

View File

@ -4,7 +4,7 @@ import { BotDifficultyHelper } from "@spt-aki/helpers/BotDifficultyHelper";
import { BotHelper } from "@spt-aki/helpers/BotHelper";
import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper";
import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper";
import { Health as PmcHealth, IBaseJsonSkills, IBaseSkill, IBotBase, Info, Skills as botSkills } from "@spt-aki/models/eft/common/tables/IBotBase";
import { IBaseJsonSkills, IBaseSkill, IBotBase, Info, Health as PmcHealth, Skills as botSkills } from "@spt-aki/models/eft/common/tables/IBotBase";
import { Appearance, Health, IBotType } from "@spt-aki/models/eft/common/tables/IBotType";
import { BotGenerationDetails } from "@spt-aki/models/spt/bots/BotGenerationDetails";
import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig";
@ -48,12 +48,12 @@ export declare class BotGenerator {
*/
generatePlayerScav(sessionId: string, role: string, difficulty: string, botTemplate: IBotType): IBotBase;
/**
* Create x number of bots of the type/side/difficulty defined in botGenerationDetails
* Create 1 bots of the type/side/difficulty defined in botGenerationDetails
* @param sessionId Session id
* @param botGenerationDetails details on how to generate bots
* @returns array of bots
* @returns constructed bot
*/
prepareAndGenerateBots(sessionId: string, botGenerationDetails: BotGenerationDetails): IBotBase[];
prepareAndGenerateBot(sessionId: string, botGenerationDetails: BotGenerationDetails): IBotBase;
/**
* Get a clone of the database\bots\base.json file
* @returns IBotBase object
@ -78,11 +78,11 @@ export declare class BotGenerator {
/**
* Create a bot nickname
* @param botJsonTemplate x.json from database
* @param isPlayerScav Will bot be player scav
* @param botGenerationDetails
* @param botRole role of bot e.g. assault
* @returns Nickname for bot
*/
protected generateBotNickname(botJsonTemplate: IBotType, isPlayerScav: boolean, botRole: string, sessionId: string): string;
protected generateBotNickname(botJsonTemplate: IBotType, botGenerationDetails: BotGenerationDetails, botRole: string, sessionId: string): string;
/**
* Log the number of PMCs generated to the debug console
* @param output Generated bot array, ready to send to client
@ -113,8 +113,8 @@ export declare class BotGenerator {
* @param bot bot to update
* @returns updated IBotBase object
*/
protected generateId(bot: IBotBase): IBotBase;
protected generateInventoryID(profile: IBotBase): IBotBase;
protected generateId(bot: IBotBase): void;
protected generateInventoryID(profile: IBotBase): void;
/**
* Randomise a bots game version and account category
* Chooses from all the game versions (standard, eod etc)
@ -127,5 +127,5 @@ export declare class BotGenerator {
* @param bot bot to add dogtag to
* @returns Bot with dogtag added
*/
protected generateDogtag(bot: IBotBase): IBotBase;
protected addDogtagToBot(bot: IBotBase): void;
}

View File

@ -8,7 +8,7 @@ import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper";
import { Inventory as PmcInventory } from "@spt-aki/models/eft/common/tables/IBotBase";
import { Chances, Generation, IBotType, Inventory, Mods } from "@spt-aki/models/eft/common/tables/IBotType";
import { EquipmentSlots } from "@spt-aki/models/enums/EquipmentSlots";
import { EquipmentFilterDetails, IBotConfig, RandomisationDetails } from "@spt-aki/models/spt/config/IBotConfig";
import { EquipmentFilterDetails, EquipmentFilters, IBotConfig, RandomisationDetails } from "@spt-aki/models/spt/config/IBotConfig";
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
import { ConfigServer } from "@spt-aki/servers/ConfigServer";
import { DatabaseServer } from "@spt-aki/servers/DatabaseServer";
@ -51,26 +51,31 @@ export declare class BotInventoryGenerator {
/**
* Add equipment to a bot
* @param templateInventory bot/x.json data from db
* @param equipmentChances Chances items will be added to bot
* @param wornItemChances Chances items will be added to bot
* @param botRole Role bot has (assault/pmcBot)
* @param botInventory Inventory to add equipment to
* @param botLevel Level of bot
*/
protected generateAndAddEquipmentToBot(templateInventory: Inventory, equipmentChances: Chances, botRole: string, botInventory: PmcInventory, botLevel: number): void;
protected generateAndAddEquipmentToBot(templateInventory: Inventory, wornItemChances: Chances, botRole: string, botInventory: PmcInventory, botLevel: number): void;
/**
* Remove non-armored rigs from parameter data
* @param templateInventory
*/
protected filterRigsToThoseWithProtection(templateInventory: Inventory): void;
/**
* Remove armored rigs from parameter data
* @param templateInventory
*/
protected filterRigsToThoseWithoutProtection(templateInventory: Inventory): void;
/**
* Add a piece of equipment with mods to inventory from the provided pools
* @param equipmentSlot Slot to select an item for
* @param equipmentPool Possible items to choose from
* @param modPool Possible mods to apply to item chosen
* @param spawnChances Chances items will be chosen to be added
* @param botRole Role of bot e.g. assault
* @param inventory Inventory to add item into
* @param randomisationDetails settings from bot.json to adjust how item is generated
* @param settings Values to adjust how item is chosen and added to bot
* @returns true when item added
*/
protected generateEquipment(equipmentSlot: string, equipmentPool: Record<string, number>, modPool: Mods, spawnChances: Chances, botRole: string, inventory: PmcInventory, randomisationDetails: RandomisationDetails): void;
protected generateEquipment(settings: IGenerateEquipmentProperties): boolean;
/**
* Get all possible mods for item and filter down based on equipment blacklist from bot.json config
* @param itemTpl Item mod pool is being retreived and filtered
* @param itemTpl Item mod pool is being retrieved and filtered
* @param equipmentBlacklist blacklist to filter mod pool with
* @returns Filtered pool of mods
*/
@ -112,3 +117,20 @@ export declare class BotInventoryGenerator {
shouldSpawn: boolean;
}, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationWeights: Generation, botLevel: number): void;
}
export interface IGenerateEquipmentProperties {
/** Root Slot being generated */
rootEquipmentSlot: string;
/** Equipment pool for root slot being generated */
rootEquipmentPool: Record<string, number>;
modPool: Mods;
/** Dictionary of mod items and their chance to spawn for this bot type */
spawnChances: Chances;
/** Role being generated for */
botRole: string;
/** Level of bot being generated */
botLevel: number;
inventory: PmcInventory;
botEquipmentConfig: EquipmentFilters;
/** Settings from bot.json to adjust how item is generated */
randomisationDetails: RandomisationDetails;
}

View File

@ -20,10 +20,17 @@ export declare class BotLevelGenerator {
*/
generateBotLevel(levelDetails: MinMax, botGenerationDetails: BotGenerationDetails, bot: IBotBase): IRandomisedBotLevelResult;
/**
* Get the highest level a bot can be relative to the players level, but no futher than the max size from globals.exp_table
* Get the highest level a bot can be relative to the players level, but no further than the max size from globals.exp_table
* @param playerLevel Players current level
* @param relativeDeltaMax max delta above player level to go
* @returns highest level possible for bot
*/
protected getHighestRelativeBotLevel(playerLevel: number, relativeDeltaMax: number, levelDetails: MinMax, expTable: IExpTable[]): number;
/**
* Get the lowest level a bot can be relative to the players level, but no lower than 1
* @param playerLevel Players current level
* @param relativeDeltaMin Min delta below player level to go
* @returns lowest level possible for bot
*/
protected getLowestRelativeBotLevel(playerLevel: number, relativeDeltaMin: number, levelDetails: MinMax, expTable: IExpTable[]): number;
}

View File

@ -1,7 +1,8 @@
import { BotWeaponGenerator } from "@spt-aki/generators/BotWeaponGenerator";
import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper";
import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper";
import { BotHelper } from "@spt-aki/helpers/BotHelper";
import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper";
import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper";
import { ItemHelper } from "@spt-aki/helpers/ItemHelper";
import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper";
import { Inventory as PmcInventory } from "@spt-aki/models/eft/common/tables/IBotBase";
@ -9,6 +10,7 @@ import { IBotType, Inventory, ModsChances } from "@spt-aki/models/eft/common/tab
import { Item } from "@spt-aki/models/eft/common/tables/IItem";
import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem";
import { EquipmentSlots } from "@spt-aki/models/enums/EquipmentSlots";
import { IItemSpawnLimitSettings } from "@spt-aki/models/spt/bots/IItemSpawnLimitSettings";
import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig";
import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig";
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
@ -17,24 +19,28 @@ import { DatabaseServer } from "@spt-aki/servers/DatabaseServer";
import { BotLootCacheService } from "@spt-aki/services/BotLootCacheService";
import { LocalisationService } from "@spt-aki/services/LocalisationService";
import { HashUtil } from "@spt-aki/utils/HashUtil";
import { JsonUtil } from "@spt-aki/utils/JsonUtil";
import { RandomUtil } from "@spt-aki/utils/RandomUtil";
export declare class BotLootGenerator {
protected logger: ILogger;
protected hashUtil: HashUtil;
protected randomUtil: RandomUtil;
protected itemHelper: ItemHelper;
protected jsonUtil: JsonUtil;
protected inventoryHelper: InventoryHelper;
protected databaseServer: DatabaseServer;
protected handbookHelper: HandbookHelper;
protected botGeneratorHelper: BotGeneratorHelper;
protected botWeaponGenerator: BotWeaponGenerator;
protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper;
protected weightedRandomHelper: WeightedRandomHelper;
protected botHelper: BotHelper;
protected botLootCacheService: BotLootCacheService;
protected localisationService: LocalisationService;
protected configServer: ConfigServer;
protected botConfig: IBotConfig;
protected pmcConfig: IPmcConfig;
constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, configServer: ConfigServer);
constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, itemHelper: ItemHelper, jsonUtil: JsonUtil, inventoryHelper: InventoryHelper, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, weightedRandomHelper: WeightedRandomHelper, botHelper: BotHelper, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, configServer: ConfigServer);
protected getItemSpawnLimitsForBot(botRole: string): IItemSpawnLimitSettings;
/**
* Add loot to bots containers
* @param sessionId Session id
@ -66,17 +72,26 @@ export declare class BotLootGenerator {
*/
protected getRandomisedCount(min: number, max: number, nValue: number): number;
/**
* Take random items from a pool and add to an inventory until totalItemCount or totalValueLimit is reached
* @param pool Pool of items to pick from
* Take random items from a pool and add to an inventory until totalItemCount or totalValueLimit or space limit is reached
* @param pool Pool of items to pick from with weight
* @param equipmentSlots What equipment slot will the loot items be added to
* @param totalItemCount Max count of items to add
* @param inventoryToAddItemsTo Bot inventory loot will be added to
* @param botRole Role of the bot loot is being generated for (assault/pmcbot)
* @param useLimits Should item limit counts be used as defined in config/bot.json
* @param itemSpawnLimits Item spawn limits the bot must adhere to
* @param totalValueLimitRub Total value of loot allowed in roubles
* @param isPmc Is bot being generated for a pmc
*/
protected addLootFromPool(pool: ITemplateItem[], equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, useLimits?: boolean, totalValueLimitRub?: number, isPmc?: boolean): void;
protected addLootFromPool(pool: Record<string, number>, equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, itemSpawnLimits?: IItemSpawnLimitSettings, totalValueLimitRub?: number, isPmc?: boolean): void;
protected createWalletLoot(walletId: string): Item[][];
/**
* Some items need child items to function, add them to the itemToAddChildrenTo array
* @param itemToAddTemplate Db template of item to check
* @param itemToAddChildrenTo Item to add children to
* @param isPmc Is the item being generated for a pmc (affects money/ammo stack sizes)
* @param botRole role bot has that owns item
*/
protected addRequiredChildItemsToParent(itemToAddTemplate: ITemplateItem, itemToAddChildrenTo: Item[], isPmc: boolean, botRole: string): void;
/**
* Add generated weapons to inventory as loot
* @param botInventory inventory to add preset to
@ -87,44 +102,28 @@ export declare class BotLootGenerator {
* @param isPmc are we generating for a pmc
*/
protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): void;
/**
* Get a random item from the pool parameter using the biasedRandomNumber system
* @param pool Pool of items to pick an item from
* @param isPmc Is the bot being created a pmc
* @returns ITemplateItem object
*/
protected getRandomItemFromPoolByRole(pool: ITemplateItem[], botRole: string): ITemplateItem;
/**
* Get the loot nvalue from botconfig
* @param botRole Role of bot e.g. assault/bosstagilla/sptBear
* @returns nvalue as number
*/
protected getBotLootNValueByRole(botRole: string): number;
/**
* Hydrate item limit array to contain items that have a limit for a specific bot type
* All values are set to 0
* @param isPmc Is the bot a pmc
* @param botRole Role the bot has
* @param limitCount
*/
protected initItemLimitArray(isPmc: boolean, botRole: string, limitCount: Record<string, number>): void;
protected initItemLimitArray(botRole: string, limitCount: Record<string, number>): void;
/**
* Check if an item has reached its bot-specific spawn limit
* @param itemTemplate Item we check to see if its reached spawn limit
* @param botRole Bot type
* @param isPmc Is bot we're working with a pmc
* @param limitCount Spawn limits for items on bot
* @param itemSpawnLimits The limits this bot is allowed to have
* @param itemSpawnLimits
* @returns true if item has reached spawn limit
*/
protected itemHasReachedSpawnLimit(itemTemplate: ITemplateItem, botRole: string, isPmc: boolean, limitCount: Record<string, number>, itemSpawnLimits: Record<string, number>): boolean;
protected itemHasReachedSpawnLimit(itemTemplate: ITemplateItem, botRole: string, itemSpawnLimits: IItemSpawnLimitSettings): boolean;
/**
* Randomise the stack size of a money object, uses different values for pmc or scavs
* @param isPmc Is money on a PMC bot
* @param botRole Role bot has that has money stack
* @param itemTemplate item details from db
* @param moneyItem Money item to randomise
*/
protected randomiseMoneyStackSize(isPmc: boolean, itemTemplate: ITemplateItem, moneyItem: Item): void;
protected randomiseMoneyStackSize(botRole: string, itemTemplate: ITemplateItem, moneyItem: Item): void;
/**
* Randomise the size of an ammo stack
* @param isPmc Is ammo on a PMC bot
@ -135,11 +134,10 @@ export declare class BotLootGenerator {
/**
* Get spawn limits for a specific bot type from bot.json config
* 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
*/
protected getItemSpawnLimitsForBotType(isPmc: boolean, botRole: string): Record<string, number>;
protected getItemSpawnLimitsForBotType(botRole: string): Record<string, number>;
/**
* Get the parentId or tplId of item inside spawnLimits object if it exists
* @param itemTemplate item we want to look for in spawn limits

View File

@ -1,5 +1,7 @@
import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper";
import { ItemHelper } from "@spt-aki/helpers/ItemHelper";
import { PresetHelper } from "@spt-aki/helpers/PresetHelper";
import { Item } from "@spt-aki/models/eft/common/tables/IItem";
import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem";
import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig";
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
@ -7,20 +9,33 @@ import { ConfigServer } from "@spt-aki/servers/ConfigServer";
import { DatabaseServer } from "@spt-aki/servers/DatabaseServer";
import { ItemFilterService } from "@spt-aki/services/ItemFilterService";
import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService";
import { HashUtil } from "@spt-aki/utils/HashUtil";
import { JsonUtil } from "@spt-aki/utils/JsonUtil";
export declare class FenceBaseAssortGenerator {
protected logger: ILogger;
protected hashUtil: HashUtil;
protected jsonUtil: JsonUtil;
protected databaseServer: DatabaseServer;
protected handbookHelper: HandbookHelper;
protected itemHelper: ItemHelper;
protected presetHelper: PresetHelper;
protected itemFilterService: ItemFilterService;
protected seasonalEventService: SeasonalEventService;
protected configServer: ConfigServer;
protected traderConfig: ITraderConfig;
constructor(logger: ILogger, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer);
constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer);
/**
* Create base fence assorts dynamically and store in db
* Create base fence assorts dynamically and store in memory
*/
generateFenceBaseAssorts(): void;
protected getItemPrice(itemTpl: string, items: Item[]): number;
protected getAmmoBoxPrice(items: Item[]): number;
/**
* Add soft inserts + armor plates to an armor
* @param armor Armor item array to add mods into
* @param itemDbDetails Armor items db template
*/
protected addChildrenToArmorModSlots(armor: Item[], itemDbDetails: ITemplateItem): void;
/**
* Check if item is valid for being added to fence assorts
* @param item Item to check

View File

@ -0,0 +1,11 @@
export interface IFilterPlateModsForSlotByLevelResult {
result: Result;
plateModTpls: string[];
}
export declare enum Result {
UNKNOWN_FAILURE = -1,
SUCCESS = 1,
NO_DEFAULT_FILTER = 2,
NOT_PLATE_HOLDING_SLOT = 3,
LACKS_PLATE_WEIGHTS = 4
}

View File

@ -1,7 +1,6 @@
import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper";
import { ItemHelper } from "@spt-aki/helpers/ItemHelper";
import { PresetHelper } from "@spt-aki/helpers/PresetHelper";
import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper";
import { IContainerMinMax, IStaticContainer } from "@spt-aki/models/eft/common/ILocation";
import { ILocationBase } from "@spt-aki/models/eft/common/ILocationBase";
import { ILooseLoot, Spawnpoint, SpawnpointTemplate, SpawnpointsForced } from "@spt-aki/models/eft/common/ILooseLoot";
@ -34,7 +33,6 @@ export declare class LocationGenerator {
protected jsonUtil: JsonUtil;
protected objectId: ObjectId;
protected randomUtil: RandomUtil;
protected ragfairServerHelper: RagfairServerHelper;
protected itemHelper: ItemHelper;
protected mathUtil: MathUtil;
protected seasonalEventService: SeasonalEventService;
@ -43,7 +41,7 @@ export declare class LocationGenerator {
protected localisationService: LocalisationService;
protected configServer: ConfigServer;
protected locationConfig: ILocationConfig;
constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, ragfairServerHelper: RagfairServerHelper, itemHelper: ItemHelper, mathUtil: MathUtil, seasonalEventService: SeasonalEventService, containerHelper: ContainerHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer);
constructor(logger: ILogger, databaseServer: DatabaseServer, jsonUtil: JsonUtil, objectId: ObjectId, randomUtil: RandomUtil, itemHelper: ItemHelper, mathUtil: MathUtil, seasonalEventService: SeasonalEventService, containerHelper: ContainerHelper, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer);
/**
* Create an array of container objects with randomised loot
* @param locationBase Map base to generate containers for
@ -147,5 +145,5 @@ export declare class LocationGenerator {
* @returns Item object
*/
protected getItemInArray(items: Item[], chosenTpl: string): Item;
protected createStaticLootItem(tpl: string, staticAmmoDist: Record<string, IStaticAmmoDetails[]>, parentId?: string): IContainerItem;
protected createStaticLootItem(chosenTpl: string, staticAmmoDist: Record<string, IStaticAmmoDetails[]>, parentId?: string): IContainerItem;
}

View File

@ -3,8 +3,8 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper";
import { PresetHelper } from "@spt-aki/helpers/PresetHelper";
import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper";
import { IPreset } from "@spt-aki/models/eft/common/IGlobals";
import { Item } from "@spt-aki/models/eft/common/tables/IItem";
import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem";
import { AddItem } from "@spt-aki/models/eft/inventory/IAddItemRequestData";
import { ISealedAirdropContainerSettings, RewardDetails } from "@spt-aki/models/spt/config/IInventoryConfig";
import { LootItem } from "@spt-aki/models/spt/services/LootItem";
import { LootRequest } from "@spt-aki/models/spt/services/LootRequest";
@ -14,6 +14,7 @@ import { ItemFilterService } from "@spt-aki/services/ItemFilterService";
import { LocalisationService } from "@spt-aki/services/LocalisationService";
import { RagfairLinkedItemService } from "@spt-aki/services/RagfairLinkedItemService";
import { HashUtil } from "@spt-aki/utils/HashUtil";
import { JsonUtil } from "@spt-aki/utils/JsonUtil";
import { RandomUtil } from "@spt-aki/utils/RandomUtil";
type ItemLimit = {
current: number;
@ -24,6 +25,7 @@ export declare class LootGenerator {
protected hashUtil: HashUtil;
protected databaseServer: DatabaseServer;
protected randomUtil: RandomUtil;
protected jsonUtil: JsonUtil;
protected itemHelper: ItemHelper;
protected presetHelper: PresetHelper;
protected inventoryHelper: InventoryHelper;
@ -31,13 +33,20 @@ export declare class LootGenerator {
protected localisationService: LocalisationService;
protected ragfairLinkedItemService: RagfairLinkedItemService;
protected itemFilterService: ItemFilterService;
constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, ragfairLinkedItemService: RagfairLinkedItemService, itemFilterService: ItemFilterService);
constructor(logger: ILogger, hashUtil: HashUtil, databaseServer: DatabaseServer, randomUtil: RandomUtil, jsonUtil: JsonUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, ragfairLinkedItemService: RagfairLinkedItemService, itemFilterService: ItemFilterService);
/**
* Generate a list of items based on configuration options parameter
* @param options parameters to adjust how loot is generated
* @returns An array of loot items
*/
createRandomLoot(options: LootRequest): LootItem[];
/**
* Filter armor items by their main plates protection level
* @param armor Armor preset
* @param options Loot request options
* @returns True item passes checks
*/
protected armorIsDesiredProtectionLevel(armor: IPreset, options: LootRequest): boolean;
/**
* Construct item limit record to hold max and current item count for each item type
* @param limits limits as defined in config
@ -71,43 +80,36 @@ export declare class LootGenerator {
* @param result array to add found preset to
* @returns true if preset was valid and added to pool
*/
protected findAndAddRandomPresetToLoot(globalDefaultPresets: [string, IPreset][], itemTypeCounts: Record<string, {
protected findAndAddRandomPresetToLoot(globalDefaultPresets: IPreset[], itemTypeCounts: Record<string, {
current: number;
max: number;
}>, itemBlacklist: string[], result: LootItem[]): boolean;
/**
* Sealed weapon containers have a weapon + associated mods inside them + assortment of other things (food/meds)
* @param containerSettings sealed weapon container settings
* @returns Array of items to add to player inventory
* @returns Array of item with children arrays
*/
getSealedWeaponCaseLoot(containerSettings: ISealedAirdropContainerSettings): AddItem[];
getSealedWeaponCaseLoot(containerSettings: ISealedAirdropContainerSettings): Item[][];
/**
* Get non-weapon mod rewards for a sealed container
* @param containerSettings Sealed weapon container settings
* @param weaponDetailsDb Details for the weapon to reward player
* @returns AddItem array
* @returns Array of item with children arrays
*/
protected getSealedContainerNonWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, weaponDetailsDb: ITemplateItem): AddItem[];
protected getSealedContainerNonWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, weaponDetailsDb: ITemplateItem): Item[][];
/**
* Iterate over the container weaponModRewardLimits settings and create an array of weapon mods to reward player
* @param containerSettings Sealed weapon container settings
* @param linkedItemsToWeapon All items that can be attached/inserted into weapon
* @param chosenWeaponPreset The weapon preset given to player as reward
* @returns AddItem array
* @returns Array of item with children arrays
*/
protected getSealedContainerWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, linkedItemsToWeapon: ITemplateItem[], chosenWeaponPreset: IPreset): AddItem[];
protected getSealedContainerWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, linkedItemsToWeapon: ITemplateItem[], chosenWeaponPreset: IPreset): Item[][];
/**
* Handle event-related loot containers - currently just the halloween jack-o-lanterns that give food rewards
* @param rewardContainerDetails
* @returns AddItem array
* @returns Array of item with children arrays
*/
getRandomLootContainerLoot(rewardContainerDetails: RewardDetails): AddItem[];
/**
* A bug in inventoryHelper.addItem() means you cannot add the same item to the array twice with a count of 1, it causes duplication
* Default adds 1, or increments count
* @param itemTplToAdd items tpl we want to add to array
* @param resultsArray Array to add item tpl to
*/
protected addOrIncrementItemToArray(itemTplToAdd: string, resultsArray: AddItem[]): void;
getRandomLootContainerLoot(rewardContainerDetails: RewardDetails): Item[][];
}
export {};

View File

@ -4,6 +4,7 @@ import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig";
import { ConfigServer } from "@spt-aki/servers/ConfigServer";
import { DatabaseServer } from "@spt-aki/servers/DatabaseServer";
import { ItemFilterService } from "@spt-aki/services/ItemFilterService";
import { RagfairPriceService } from "@spt-aki/services/RagfairPriceService";
import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService";
/**
* Handle the generation of dynamic PMC loot in pockets and backpacks
@ -14,22 +15,23 @@ export declare class PMCLootGenerator {
protected databaseServer: DatabaseServer;
protected configServer: ConfigServer;
protected itemFilterService: ItemFilterService;
protected ragfairPriceService: RagfairPriceService;
protected seasonalEventService: SeasonalEventService;
protected pocketLootPool: string[];
protected vestLootPool: string[];
protected backpackLootPool: string[];
protected pocketLootPool: Record<string, number>;
protected vestLootPool: Record<string, number>;
protected backpackLootPool: Record<string, number>;
protected pmcConfig: IPmcConfig;
constructor(itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService);
constructor(itemHelper: ItemHelper, databaseServer: DatabaseServer, configServer: ConfigServer, itemFilterService: ItemFilterService, ragfairPriceService: RagfairPriceService, seasonalEventService: SeasonalEventService);
/**
* Create an array of loot items a PMC can have in their pockets
* @returns string array of tpls
*/
generatePMCPocketLootPool(): string[];
generatePMCPocketLootPool(botRole: string): Record<string, number>;
/**
* Create an array of loot items a PMC can have in their vests
* @returns string array of tpls
*/
generatePMCVestLootPool(): string[];
generatePMCVestLootPool(botRole: string): Record<string, number>;
/**
* Check if item has a width/height that lets it fit into a 2x2 slot
* 1x1 / 1x2 / 2x1 / 2x2
@ -41,5 +43,12 @@ export declare class PMCLootGenerator {
* Create an array of loot items a PMC can have in their backpack
* @returns string array of tpls
*/
generatePMCBackpackLootPool(): string[];
generatePMCBackpackLootPool(botRole: string): Record<string, number>;
/**
* Find the greated common divisor of all weights and use it on the passed in dictionary
* @param weightedDict
*/
protected reduceWeightValues(weightedDict: Record<string, number>): void;
protected commonDivisor(numbers: number[]): number;
protected gcd(a: number, b: number): number;
}

View File

@ -1,11 +1,10 @@
import { BotGenerator } from "@spt-aki/generators/BotGenerator";
import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper";
import { BotHelper } from "@spt-aki/helpers/BotHelper";
import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper";
import { ItemHelper } from "@spt-aki/helpers/ItemHelper";
import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper";
import { IPmcData } from "@spt-aki/models/eft/common/IPmcData";
import { Skills, Stats } from "@spt-aki/models/eft/common/tables/IBotBase";
import { IBotBase, Skills, Stats } from "@spt-aki/models/eft/common/tables/IBotBase";
import { IBotType } from "@spt-aki/models/eft/common/tables/IBotType";
import { IPlayerScavConfig, KarmaLevel } from "@spt-aki/models/spt/config/IPlayerScavConfig";
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
@ -24,7 +23,6 @@ export declare class PlayerScavGenerator {
protected databaseServer: DatabaseServer;
protected hashUtil: HashUtil;
protected itemHelper: ItemHelper;
protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper;
protected botGeneratorHelper: BotGeneratorHelper;
protected saveServer: SaveServer;
protected profileHelper: ProfileHelper;
@ -36,13 +34,20 @@ export declare class PlayerScavGenerator {
protected botGenerator: BotGenerator;
protected configServer: ConfigServer;
protected playerScavConfig: IPlayerScavConfig;
constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, hashUtil: HashUtil, itemHelper: ItemHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botGeneratorHelper: BotGeneratorHelper, saveServer: SaveServer, profileHelper: ProfileHelper, botHelper: BotHelper, jsonUtil: JsonUtil, fenceService: FenceService, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, botGenerator: BotGenerator, configServer: ConfigServer);
constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, hashUtil: HashUtil, itemHelper: ItemHelper, botGeneratorHelper: BotGeneratorHelper, saveServer: SaveServer, profileHelper: ProfileHelper, botHelper: BotHelper, jsonUtil: JsonUtil, fenceService: FenceService, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, botGenerator: BotGenerator, configServer: ConfigServer);
/**
* Update a player profile to include a new player scav profile
* @param sessionID session id to specify what profile is updated
* @returns profile object
*/
generate(sessionID: string): IPmcData;
/**
* Add items picked from `playerscav.lootItemsToAddChancePercent`
* @param possibleItemsToAdd dict of tpl + % chance to be added
* @param scavData
* @param containersToAddTo Possible slotIds to add loot to
*/
protected addAdditionalLootToPlayerScavContainers(possibleItemsToAdd: Record<string, number>, scavData: IBotBase, containersToAddTo: string[]): void;
/**
* Get the scav karama level for a profile
* Is also the fence trader rep level

View File

@ -1,4 +1,5 @@
import { ItemHelper } from "@spt-aki/helpers/ItemHelper";
import { PresetHelper } from "@spt-aki/helpers/PresetHelper";
import { IPreset } from "@spt-aki/models/eft/common/IGlobals";
import { Item } from "@spt-aki/models/eft/common/tables/IItem";
import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig";
@ -11,42 +12,41 @@ export declare class RagfairAssortGenerator {
protected jsonUtil: JsonUtil;
protected hashUtil: HashUtil;
protected itemHelper: ItemHelper;
protected presetHelper: PresetHelper;
protected databaseServer: DatabaseServer;
protected seasonalEventService: SeasonalEventService;
protected configServer: ConfigServer;
protected generatedAssortItems: Item[];
protected generatedAssortItems: Item[][];
protected ragfairConfig: IRagfairConfig;
constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, seasonalEventService: SeasonalEventService, configServer: ConfigServer);
protected ragfairItemInvalidBaseTypes: string[];
constructor(jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, databaseServer: DatabaseServer, seasonalEventService: SeasonalEventService, configServer: ConfigServer);
/**
* Get an array of unique items that can be sold on the flea
* @returns array of unique items
* Get an array of arrays that can be sold on the flea
* Each sub array contains item + children (if any)
* @returns array of arrays
*/
getAssortItems(): Item[];
getAssortItems(): Item[][];
/**
* Check internal generatedAssortItems array has objects
* @returns true if array has objects
*/
protected assortsAreGenerated(): boolean;
/**
* Generate an array of items the flea can sell
* @returns array of unique items
* Generate an array of arrays (item + children) the flea can sell
* @returns array of arrays (item + children)
*/
protected generateRagfairAssortItems(): Item[];
protected generateRagfairAssortItems(): Item[][];
/**
* Get presets from globals.json
* @returns Preset object array
* Get presets from globals to add to flea
* ragfairConfig.dynamic.showDefaultPresetsOnly decides if its all presets or just defaults
* @returns IPreset array
*/
protected getPresets(): IPreset[];
/**
* Get default presets from globals.json
* @returns Preset object array
*/
protected getDefaultPresets(): IPreset[];
protected getPresetsToAdd(): IPreset[];
/**
* Create a base assort item and return it with populated values + 999999 stack count + unlimited count = true
* @param tplId tplid to add to item
* @param id id to add to item
* @returns hydrated Item object
* @returns Hydrated Item object
*/
protected createRagfairAssortItem(tplId: string, id?: string): Item;
protected createRagfairAssortRootItem(tplId: string, id?: string): Item;
}

View File

@ -8,7 +8,7 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem";
import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem";
import { IBarterScheme } from "@spt-aki/models/eft/common/tables/ITrader";
import { IRagfairOffer, OfferRequirement } from "@spt-aki/models/eft/ragfair/IRagfairOffer";
import { Dynamic, IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig";
import { Dynamic, IArmorPlateBlacklistSettings, IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig";
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
import { ConfigServer } from "@spt-aki/servers/ConfigServer";
import { DatabaseServer } from "@spt-aki/servers/DatabaseServer";
@ -119,22 +119,28 @@ export declare class RagfairOfferGenerator {
* Create multiple offers for items by using a unique list of items we've generated previously
* @param expiredOffers optional, expired offers to regenerate
*/
generateDynamicOffers(expiredOffers?: Item[]): Promise<void>;
generateDynamicOffers(expiredOffers?: Item[][]): Promise<void>;
/**
* @param assortItemIndex Index of assort item
* @param assortItemsToProcess Item array containing index
* @param expiredOffers Currently expired offers on flea
* @param assortItemWithChildren Item with its children to process into offers
* @param isExpiredOffer is an expired offer
* @param config Ragfair dynamic config
*/
protected createOffersForItems(assortItemIndex: string, assortItemsToProcess: Item[], expiredOffers: Item[], config: Dynamic): Promise<void>;
protected createOffersFromAssort(assortItemWithChildren: Item[], isExpiredOffer: boolean, config: Dynamic): Promise<void>;
/**
* iterate over an items chidren and look for plates above desired level and remove them
* @param presetWithChildren preset to check for plates
* @param plateSettings Settings
* @returns True if plate removed
*/
protected removeBannedPlatesFromPreset(presetWithChildren: Item[], plateSettings: IArmorPlateBlacklistSettings): boolean;
/**
* Create one flea offer for a specific item
* @param items Item to create offer for
* @param itemWithChildren Item to create offer for
* @param isPreset Is item a weapon preset
* @param itemDetails raw db item details
* @returns Item array
*/
protected createSingleOfferForItem(items: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise<void>;
protected createSingleOfferForItem(itemWithChildren: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise<void>;
/**
* Generate trader offers on flea using the traders assort data
* @param traderID Trader to generate offers for
@ -144,11 +150,10 @@ export declare class RagfairOfferGenerator {
* Get array of an item with its mods + condition properties (e.g durability)
* Apply randomisation adjustments to condition if item base is found in ragfair.json/dynamic/condition
* @param userID id of owner of item
* @param itemWithMods Item and mods, get condition of first item (only first array item is used)
* @param itemWithMods Item and mods, get condition of first item (only first array item is modified)
* @param itemDetails db details of first item
* @returns
*/
protected randomiseItemUpdProperties(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): Item[];
protected randomiseOfferItemUpdProperties(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): void;
/**
* Get the relevant condition id if item tpl matches in ragfair.json/condition
* @param tpl Item to look for matching condition object
@ -158,24 +163,32 @@ export declare class RagfairOfferGenerator {
/**
* Alter an items condition based on its item base type
* @param conditionSettingsId also the parentId of item being altered
* @param item Item to adjust condition details of
* @param itemWithMods Item to adjust condition details of
* @param itemDetails db item details of first item in array
*/
protected randomiseItemCondition(conditionSettingsId: string, item: Item, itemDetails: ITemplateItem): void;
protected randomiseItemCondition(conditionSettingsId: string, itemWithMods: Item[], itemDetails: ITemplateItem): void;
/**
* Adjust an items durability/maxDurability value
* @param item item (weapon/armor) to adjust
* @param multiplier Value to multiple durability by
* @param item item (weapon/armor) to Adjust
* @param itemDbDetails Weapon details from db
* @param maxMultiplier Value to multiply max durability by
* @param currentMultiplier Value to multiply current durability by
*/
protected randomiseDurabilityValues(item: Item, multiplier: number): void;
protected randomiseWeaponDurability(item: Item, itemDbDetails: ITemplateItem, maxMultiplier: number, currentMultiplier: number): void;
/**
* Randomise the durabiltiy values for an armors plates and soft inserts
* @param armorWithMods Armor item with its child mods
* @param currentMultiplier Chosen multipler to use for current durability value
* @param maxMultiplier Chosen multipler to use for max durability value
*/
protected randomiseArmorDurabilityValues(armorWithMods: Item[], currentMultiplier: number, maxMultiplier: number): void;
/**
* Add missing conditions to an item if needed
* Durabiltiy for repairable items
* HpResource for medical items
* @param item item to add conditions to
* @returns Item with conditions added
*/
protected addMissingConditions(item: Item): Item;
protected addMissingConditions(item: Item): void;
/**
* Create a barter-based barter scheme, if not possible, fall back to making barter scheme currency based
* @param offerItems Items for sale in offer
@ -192,10 +205,10 @@ export declare class RagfairOfferGenerator {
}[];
/**
* Create a random currency-based barter scheme for an array of items
* @param offerItems Items on offer
* @param offerWithChildren Items on offer
* @param isPackOffer Is the barter scheme being created for a pack offer
* @param multipler What to multiply the resulting price by
* @returns Barter scheme for offer
*/
protected createCurrencyBarterScheme(offerItems: Item[], isPackOffer: boolean, multipler?: number): IBarterScheme[];
protected createCurrencyBarterScheme(offerWithChildren: Item[], isPackOffer: boolean, multipler?: number): IBarterScheme[];
}

View File

@ -1,53 +1,34 @@
import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper";
import { RepeatableQuestRewardGenerator } from "@spt-aki/generators/RepeatableQuestRewardGenerator";
import { ItemHelper } from "@spt-aki/helpers/ItemHelper";
import { PresetHelper } from "@spt-aki/helpers/PresetHelper";
import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper";
import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper";
import { RepeatableQuestHelper } from "@spt-aki/helpers/RepeatableQuestHelper";
import { Exit } from "@spt-aki/models/eft/common/ILocationBase";
import { TraderInfo } from "@spt-aki/models/eft/common/tables/IBotBase";
import { Item } from "@spt-aki/models/eft/common/tables/IItem";
import { ICompletion, ICompletionAvailableFor, IElimination, IEliminationCondition, IExploration, IExplorationCondition, IPickup, IRepeatableQuest, IReward, IRewards } from "@spt-aki/models/eft/common/tables/IRepeatableQuests";
import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem";
import { IBaseQuestConfig, IBossInfo, IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig";
import { IQuestCondition, IQuestConditionCounterCondition } from "@spt-aki/models/eft/common/tables/IQuest";
import { IRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests";
import { IBossInfo, IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig";
import { IQuestTypePool } from "@spt-aki/models/spt/repeatable/IQuestTypePool";
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder";
import { ConfigServer } from "@spt-aki/servers/ConfigServer";
import { DatabaseServer } from "@spt-aki/servers/DatabaseServer";
import { ItemFilterService } from "@spt-aki/services/ItemFilterService";
import { LocalisationService } from "@spt-aki/services/LocalisationService";
import { PaymentService } from "@spt-aki/services/PaymentService";
import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService";
import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil";
import { JsonUtil } from "@spt-aki/utils/JsonUtil";
import { MathUtil } from "@spt-aki/utils/MathUtil";
import { ObjectId } from "@spt-aki/utils/ObjectId";
import { ProbabilityObjectArray, RandomUtil } from "@spt-aki/utils/RandomUtil";
import { TimeUtil } from "@spt-aki/utils/TimeUtil";
export declare class RepeatableQuestGenerator {
protected timeUtil: TimeUtil;
protected logger: ILogger;
protected randomUtil: RandomUtil;
protected httpResponse: HttpResponseUtil;
protected mathUtil: MathUtil;
protected jsonUtil: JsonUtil;
protected databaseServer: DatabaseServer;
protected itemHelper: ItemHelper;
protected presetHelper: PresetHelper;
protected profileHelper: ProfileHelper;
protected profileFixerService: ProfileFixerService;
protected handbookHelper: HandbookHelper;
protected ragfairServerHelper: RagfairServerHelper;
protected eventOutputHolder: EventOutputHolder;
protected localisationService: LocalisationService;
protected paymentService: PaymentService;
protected objectId: ObjectId;
protected itemFilterService: ItemFilterService;
protected repeatableQuestHelper: RepeatableQuestHelper;
protected repeatableQuestRewardGenerator: RepeatableQuestRewardGenerator;
protected configServer: ConfigServer;
protected questConfig: IQuestConfig;
constructor(timeUtil: TimeUtil, logger: ILogger, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, handbookHelper: HandbookHelper, ragfairServerHelper: RagfairServerHelper, eventOutputHolder: EventOutputHolder, localisationService: LocalisationService, paymentService: PaymentService, objectId: ObjectId, itemFilterService: ItemFilterService, repeatableQuestHelper: RepeatableQuestHelper, configServer: ConfigServer);
constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, localisationService: LocalisationService, objectId: ObjectId, repeatableQuestHelper: RepeatableQuestHelper, repeatableQuestRewardGenerator: RepeatableQuestRewardGenerator, configServer: ConfigServer);
/**
* This method is called by /GetClientRepeatableQuests/ and creates one element of quest type format (see assets/database/templates/repeatableQuests.json).
* It randomly draws a quest type (currently Elimination, Completion or Exploration) as well as a trader who is providing the quest
@ -66,7 +47,7 @@ export declare class RepeatableQuestGenerator {
* @param repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest
* @returns Object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json)
*/
protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IElimination;
protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest;
/**
* Get a number of kills neded to complete elimination quest
* @param targetKey Target type desired e.g. anyPmc/bossBully/Savage
@ -82,7 +63,7 @@ export declare class RepeatableQuestGenerator {
* @param {string} location the location on which to fulfill the elimination quest
* @returns {IEliminationCondition} object of "Elimination"-location-subcondition
*/
protected generateEliminationLocation(location: string[]): IEliminationCondition;
protected generateEliminationLocation(location: string[]): IQuestConditionCounterCondition;
/**
* Create kill condition for an elimination quest
* @param target Bot type target of elimination quest e.g. "AnyPmc", "Savage"
@ -92,7 +73,7 @@ export declare class RepeatableQuestGenerator {
* @param allowedWeaponCategory What category of weapon must be used - undefined = any
* @returns IEliminationCondition object
*/
protected generateEliminationCondition(target: string, targetedBodyParts: string[], distance: number, allowedWeapon: string, allowedWeaponCategory: string): IEliminationCondition;
protected generateEliminationCondition(target: string, targetedBodyParts: string[], distance: number, allowedWeapon: string, allowedWeaponCategory: string): IQuestConditionCounterCondition;
/**
* Generates a valid Completion quest
*
@ -101,7 +82,7 @@ export declare class RepeatableQuestGenerator {
* @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest
* @returns {object} object of quest type format for "Completion" (see assets/database/templates/repeatableQuests.json)
*/
protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): ICompletion;
protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest;
/**
* A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json)
* This is a helper method for GenerateCompletionQuest to create a completion condition (of which a completion quest theoretically can have many)
@ -110,7 +91,7 @@ export declare class RepeatableQuestGenerator {
* @param {integer} value amount of items of this specific type to request
* @returns {object} object of "Completion"-condition
*/
protected generateCompletionAvailableForFinish(itemTpl: string, value: number): ICompletionAvailableFor;
protected generateCompletionAvailableForFinish(itemTpl: string, value: number): IQuestCondition;
/**
* Generates a valid Exploration quest
*
@ -120,8 +101,15 @@ export declare class RepeatableQuestGenerator {
* @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest
* @returns {object} object of quest type format for "Exploration" (see assets/database/templates/repeatableQuests.json)
*/
protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IExploration;
protected generatePickupQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IPickup;
protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest;
/**
* Filter a maps exits to just those for the desired side
* @param locationKey Map id (e.g. factory4_day)
* @param playerSide Scav/Pmc
* @returns Array of Exit objects
*/
protected getLocationExitsForSide(locationKey: string, playerSide: string): Exit[];
protected generatePickupQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest;
/**
* Convert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567)
* @param locationKey e.g factory4_day
@ -135,70 +123,7 @@ export declare class RepeatableQuestGenerator {
* @param {string} exit The exit name to generate the condition for
* @returns {object} Exit condition
*/
protected generateExplorationExitCondition(exit: Exit): IExplorationCondition;
/**
* Generate the reward for a mission. A reward can consist of
* - Experience
* - Money
* - Items
* - Trader Reputation
*
* The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to
* experience / money / items / trader reputation can be defined in QuestConfig.js
*
* There's also a random variation of the reward the spread of which can be also defined in the config.
*
* Additonaly, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used
*
* @param {integer} pmcLevel player's level
* @param {number} difficulty a reward scaling factor goint from 0.2 to 1
* @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader)
* @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest
* @returns {object} object of "Reward"-type that can be given for a repeatable mission
*/
protected generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig, questConfig: IBaseQuestConfig): IRewards;
/**
* Should reward item have stack size increased (25% chance)
* @param item Item to possibly increase stack size of
* @param maxRoublePriceToStack Maximum rouble price an item can be to still be chosen for stacking
* @returns True if it should
*/
protected canIncreaseRewardItemStackSize(item: ITemplateItem, maxRoublePriceToStack: number): boolean;
/**
* Get a randomised number a reward items stack size should be based on its handbook price
* @param item Reward item to get stack size for
* @returns Stack size value
*/
protected getRandomisedRewardItemStackSizeByPrice(item: ITemplateItem): number;
/**
* Select a number of items that have a colelctive value of the passed in parameter
* @param repeatableConfig Config
* @param roublesBudget Total value of items to return
* @returns Array of reward items that fit budget
*/
protected chooseRewardItemsWithinBudget(repeatableConfig: IRepeatableQuestConfig, roublesBudget: number, traderId: string): ITemplateItem[];
/**
* Helper to create a reward item structured as required by the client
*
* @param {string} tpl ItemId of the rewarded item
* @param {integer} value Amount of items to give
* @param {integer} index All rewards will be appended to a list, for unknown reasons the client wants the index
* @returns {object} Object of "Reward"-item-type
*/
protected generateRewardItem(tpl: string, value: number, index: number, preset?: Item[]): IReward;
/**
* Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable)
* @param repeatableQuestConfig Config file
* @returns List of rewardable items [[_tpl, itemTemplate],...]
*/
protected getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig, traderId: string): [string, ITemplateItem][];
/**
* Checks if an id is a valid item. Valid meaning that it's an item that may be a reward
* or content of bot loot. Items that are tested as valid may be in a player backpack or stash.
* @param {string} tpl template id of item to check
* @returns True if item is valid reward
*/
protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig, itemBaseWhitelist: string[]): boolean;
protected generateExplorationExitCondition(exit: Exit): IQuestConditionCounterCondition;
/**
* Generates the base object of quest type format given as templates in assets/database/templates/repeatableQuests.json
* The templates include Elimination, Completion and Extraction quest types

View File

@ -0,0 +1,106 @@
import { HandbookHelper } from "@spt-aki/helpers/HandbookHelper";
import { ItemHelper } from "@spt-aki/helpers/ItemHelper";
import { PresetHelper } from "@spt-aki/helpers/PresetHelper";
import { Item } from "@spt-aki/models/eft/common/tables/IItem";
import { IQuestReward, IQuestRewards } from "@spt-aki/models/eft/common/tables/IQuest";
import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem";
import { IBaseQuestConfig, IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig";
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
import { ConfigServer } from "@spt-aki/servers/ConfigServer";
import { DatabaseServer } from "@spt-aki/servers/DatabaseServer";
import { ItemFilterService } from "@spt-aki/services/ItemFilterService";
import { LocalisationService } from "@spt-aki/services/LocalisationService";
import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService";
import { JsonUtil } from "@spt-aki/utils/JsonUtil";
import { MathUtil } from "@spt-aki/utils/MathUtil";
import { ObjectId } from "@spt-aki/utils/ObjectId";
import { RandomUtil } from "@spt-aki/utils/RandomUtil";
export declare class RepeatableQuestRewardGenerator {
protected logger: ILogger;
protected randomUtil: RandomUtil;
protected mathUtil: MathUtil;
protected jsonUtil: JsonUtil;
protected databaseServer: DatabaseServer;
protected itemHelper: ItemHelper;
protected presetHelper: PresetHelper;
protected handbookHelper: HandbookHelper;
protected localisationService: LocalisationService;
protected objectId: ObjectId;
protected itemFilterService: ItemFilterService;
protected seasonalEventService: SeasonalEventService;
protected configServer: ConfigServer;
protected questConfig: IQuestConfig;
constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper, presetHelper: PresetHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, objectId: ObjectId, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer);
/**
* Generate the reward for a mission. A reward can consist of
* - Experience
* - Money
* - Items
* - Trader Reputation
*
* The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to
* experience / money / items / trader reputation can be defined in QuestConfig.js
*
* There's also a random variation of the reward the spread of which can be also defined in the config.
*
* Additionally, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used
*
* @param {integer} pmcLevel player's level
* @param {number} difficulty a reward scaling factor from 0.2 to 1
* @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader)
* @param {object} repeatableConfig The configuration for the repeatable kind (daily, weekly) as configured in QuestConfig for the requested quest
* @returns {object} object of "Reward"-type that can be given for a repeatable mission
*/
generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig, questConfig: IBaseQuestConfig): IQuestRewards;
/**
* @param rewardItems List of reward items to filter
* @param roublesBudget The budget remaining for rewards
* @param minPrice The minimum priced item to include
* @returns True if any items remain in `rewardItems`, false otherwise
*/
protected filterRewardPoolWithinBudget(rewardItems: ITemplateItem[], roublesBudget: number, minPrice: number): boolean;
/**
* Get a randomised number a reward items stack size should be based on its handbook price
* @param item Reward item to get stack size for
* @returns Stack size value
*/
protected getRandomisedRewardItemStackSizeByPrice(item: ITemplateItem): number;
/**
* Should reward item have stack size increased (25% chance)
* @param item Item to possibly increase stack size of
* @param maxRoublePriceToStack Maximum rouble price an item can be to still be chosen for stacking
* @returns True if it should
*/
protected canIncreaseRewardItemStackSize(item: ITemplateItem, maxRoublePriceToStack: number): boolean;
protected calculateAmmoStackSizeThatFitsBudget(itemSelected: ITemplateItem, roublesBudget: number, rewardNumItems: number): number;
/**
* Select a number of items that have a colelctive value of the passed in parameter
* @param repeatableConfig Config
* @param roublesBudget Total value of items to return
* @returns Array of reward items that fit budget
*/
protected chooseRewardItemsWithinBudget(repeatableConfig: IRepeatableQuestConfig, roublesBudget: number, traderId: string): ITemplateItem[];
/**
* Helper to create a reward item structured as required by the client
*
* @param {string} tpl ItemId of the rewarded item
* @param {integer} value Amount of items to give
* @param {integer} index All rewards will be appended to a list, for unknown reasons the client wants the index
* @returns {object} Object of "Reward"-item-type
*/
protected generateRewardItem(tpl: string, value: number, index: number, preset?: Item[]): IQuestReward;
/**
* Picks rewardable items from items.json. This means they need to fit into the inventory and they shouldn't be keys (debatable)
* @param repeatableQuestConfig Config file
* @returns List of rewardable items [[_tpl, itemTemplate],...]
*/
getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig, traderId: string): [string, ITemplateItem][];
/**
* Checks if an id is a valid item. Valid meaning that it's an item that may be a reward
* or content of bot loot. Items that are tested as valid may be in a player backpack or stash.
* @param {string} tpl template id of item to check
* @returns True if item is valid reward
*/
protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig, itemBaseWhitelist: string[]): boolean;
protected addMoneyReward(traderId: string, rewards: IQuestRewards, rewardRoubles: number, rewardIndex: number): void;
}

View File

@ -1,6 +1,6 @@
import { ItemHelper } from "@spt-aki/helpers/ItemHelper";
import { Product } from "@spt-aki/models/eft/common/tables/IBotBase";
import { Upd } from "@spt-aki/models/eft/common/tables/IItem";
import { PresetHelper } from "@spt-aki/helpers/PresetHelper";
import { Item } from "@spt-aki/models/eft/common/tables/IItem";
import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem";
import { IHideoutScavCase } from "@spt-aki/models/eft/hideout/IHideoutScavCase";
import { IScavCaseConfig } from "@spt-aki/models/spt/config/IScavCaseConfig";
@ -10,7 +10,9 @@ import { ConfigServer } from "@spt-aki/servers/ConfigServer";
import { DatabaseServer } from "@spt-aki/servers/DatabaseServer";
import { ItemFilterService } from "@spt-aki/services/ItemFilterService";
import { RagfairPriceService } from "@spt-aki/services/RagfairPriceService";
import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService";
import { HashUtil } from "@spt-aki/utils/HashUtil";
import { JsonUtil } from "@spt-aki/utils/JsonUtil";
import { RandomUtil } from "@spt-aki/utils/RandomUtil";
/**
* Handle the creation of randomised scav case rewards
@ -18,22 +20,25 @@ import { RandomUtil } from "@spt-aki/utils/RandomUtil";
export declare class ScavCaseRewardGenerator {
protected logger: ILogger;
protected randomUtil: RandomUtil;
protected jsonUtil: JsonUtil;
protected hashUtil: HashUtil;
protected itemHelper: ItemHelper;
protected presetHelper: PresetHelper;
protected databaseServer: DatabaseServer;
protected ragfairPriceService: RagfairPriceService;
protected seasonalEventService: SeasonalEventService;
protected itemFilterService: ItemFilterService;
protected configServer: ConfigServer;
protected scavCaseConfig: IScavCaseConfig;
protected dbItemsCache: ITemplateItem[];
protected dbAmmoItemsCache: ITemplateItem[];
constructor(logger: ILogger, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, itemFilterService: ItemFilterService, configServer: ConfigServer);
constructor(logger: ILogger, randomUtil: RandomUtil, jsonUtil: JsonUtil, hashUtil: HashUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, databaseServer: DatabaseServer, ragfairPriceService: RagfairPriceService, seasonalEventService: SeasonalEventService, itemFilterService: ItemFilterService, configServer: ConfigServer);
/**
* Create an array of rewards that will be given to the player upon completing their scav case build
* @param recipeId recipe of the scav case craft
* @returns Product array
*/
generate(recipeId: string): Product[];
generate(recipeId: string): Item[][];
/**
* Get all db items that are not blacklisted in scavcase config or global blacklist
* Store in class field
@ -72,17 +77,7 @@ export declare class ScavCaseRewardGenerator {
* @param rewardItems items to convert
* @returns Product array
*/
protected randomiseContainerItemRewards(rewardItems: ITemplateItem[], rarity: string): Product[];
/**
* Add a randomised stack count to ammo or money items
* @param item money or ammo item
* @param resultItem money or ammo item with a randomise stack size
*/
protected addStackCountToAmmoAndMoney(item: ITemplateItem, resultItem: {
_id: string;
_tpl: string;
upd: Upd;
}, rarity: string): void;
protected randomiseContainerItemRewards(rewardItems: ITemplateItem[], rarity: string): Item[][];
/**
* @param dbItems all items from the items.json
* @param itemFilters controls how the dbItems will be filtered and returned (handbook price)

View File

@ -15,6 +15,7 @@ export declare class WeatherGenerator {
protected applicationContext: ApplicationContext;
protected configServer: ConfigServer;
protected weatherConfig: IWeatherConfig;
private serverStartTimestampMS;
constructor(weightedRandomHelper: WeightedRandomHelper, logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, applicationContext: ApplicationContext, configServer: ConfigServer);
/**
* Get current + raid datetime and format into correct BSG format and return
@ -28,13 +29,13 @@ export declare class WeatherGenerator {
* @param currentDate current date
* @returns formatted time
*/
protected getBsgFormattedInRaidTime(currentDate: Date): string;
protected getBsgFormattedInRaidTime(): string;
/**
* Get the current in-raid time
* @param currentDate (new Date())
* @returns Date object of current in-raid time
*/
getInRaidTime(currentDate: Date): Date;
getInRaidTime(): Date;
/**
* Get current time formatted to fit BSGs requirement
* @param date date to format into bsg style

View File

@ -1,5 +1,6 @@
import { IInventoryMagGen } from "@spt-aki/generators/weapongen/IInventoryMagGen";
import { InventoryMagGen } from "@spt-aki/generators/weapongen/InventoryMagGen";
import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper";
import { BotWeaponGeneratorHelper } from "@spt-aki/helpers/BotWeaponGeneratorHelper";
import { ItemHelper } from "@spt-aki/helpers/ItemHelper";
import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem";
@ -11,13 +12,14 @@ export declare class ExternalInventoryMagGen implements IInventoryMagGen {
protected itemHelper: ItemHelper;
protected localisationService: LocalisationService;
protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper;
protected botGeneratorHelper: BotGeneratorHelper;
protected randomUtil: RandomUtil;
constructor(logger: ILogger, itemHelper: ItemHelper, localisationService: LocalisationService, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, randomUtil: RandomUtil);
constructor(logger: ILogger, itemHelper: ItemHelper, localisationService: LocalisationService, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil);
getPriority(): number;
canHandleInventoryMagGen(inventoryMagGen: InventoryMagGen): boolean;
process(inventoryMagGen: InventoryMagGen): void;
/**
* Get a random compatible external magazine for a weapon, excluses internal magazines from possible pool
* Get a random compatible external magazine for a weapon, exclude internal magazines from possible pool
* @param weaponTpl Weapon to get mag for
* @returns tpl of magazine
*/

View File

@ -14,7 +14,7 @@ export declare class AssortHelper {
protected questHelper: QuestHelper;
constructor(logger: ILogger, itemHelper: ItemHelper, databaseServer: DatabaseServer, localisationService: LocalisationService, questHelper: QuestHelper);
/**
* Remove assorts from a trader that have not been unlocked yet (via player completing corrisponding quest)
* Remove assorts from a trader that have not been unlocked yet (via player completing corresponding quest)
* @param pmcProfile Player profile
* @param traderId Traders id the assort belongs to
* @param traderAssorts All assort items from same trader

View File

@ -1,15 +1,19 @@
import { ApplicationContext } from "@spt-aki/context/ApplicationContext";
import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper";
import { DurabilityLimitsHelper } from "@spt-aki/helpers/DurabilityLimitsHelper";
import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper";
import { ItemHelper } from "@spt-aki/helpers/ItemHelper";
import { Inventory } from "@spt-aki/models/eft/common/tables/IBotBase";
import { Item, Repairable, Upd } from "@spt-aki/models/eft/common/tables/IItem";
import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem";
import { Grid, ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem";
import { ItemAddedResult } from "@spt-aki/models/enums/ItemAddedResult";
import { IChooseRandomCompatibleModResult } from "@spt-aki/models/spt/bots/IChooseRandomCompatibleModResult";
import { EquipmentFilters, IBotConfig, IRandomisedResourceValues } from "@spt-aki/models/spt/config/IBotConfig";
import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig";
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
import { ConfigServer } from "@spt-aki/servers/ConfigServer";
import { DatabaseServer } from "@spt-aki/servers/DatabaseServer";
import { LocalisationService } from "@spt-aki/services/LocalisationService";
import { JsonUtil } from "@spt-aki/utils/JsonUtil";
import { RandomUtil } from "@spt-aki/utils/RandomUtil";
export declare class BotGeneratorHelper {
protected logger: ILogger;
@ -17,12 +21,14 @@ export declare class BotGeneratorHelper {
protected databaseServer: DatabaseServer;
protected durabilityLimitsHelper: DurabilityLimitsHelper;
protected itemHelper: ItemHelper;
protected inventoryHelper: InventoryHelper;
protected containerHelper: ContainerHelper;
protected applicationContext: ApplicationContext;
protected localisationService: LocalisationService;
protected configServer: ConfigServer;
protected botConfig: IBotConfig;
protected pmcConfig: IPmcConfig;
constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, applicationContext: ApplicationContext, localisationService: LocalisationService, configServer: ConfigServer);
constructor(logger: ILogger, randomUtil: RandomUtil, databaseServer: DatabaseServer, durabilityLimitsHelper: DurabilityLimitsHelper, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, containerHelper: ContainerHelper, applicationContext: ApplicationContext, localisationService: LocalisationService, configServer: ConfigServer);
/**
* Adds properties to an item
* e.g. Repairable / HasHinge / Foldable / MaxDurability
@ -30,7 +36,7 @@ export declare class BotGeneratorHelper {
* @param botRole Used by weapons to randomize 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;
};
/**
@ -62,32 +68,36 @@ export declare class BotGeneratorHelper {
* @returns Repairable object
*/
protected generateArmorRepairableProperties(itemTemplate: ITemplateItem, botRole: string): Repairable;
isWeaponModIncompatibleWithCurrentMods(itemsEquipped: Item[], tplToCheck: string, modSlot: string): IChooseRandomCompatibleModResult;
/**
* Can item be added to another item without conflict
* @param items Items to check compatibilities with
* @param itemsEquipped Items to check compatibilities with
* @param tplToCheck Tpl of the item to check for incompatibilities
* @param equipmentSlot Slot the item will be placed into
* @returns false if no incompatibilities, also has incompatibility reason
*/
isItemIncompatibleWithCurrentItems(items: Item[], tplToCheck: string, equipmentSlot: string): {
incompatible: boolean;
reason: string;
};
isItemIncompatibleWithCurrentItems(itemsEquipped: Item[], tplToCheck: string, equipmentSlot: string): IChooseRandomCompatibleModResult;
/**
* 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<T> {
private itemPool;
private randomUtil;
private jsonUtil;
private pool;
constructor(itemPool: T[], randomUtil: RandomUtil, jsonUtil: JsonUtil);
getRandomValue(): T;
getFirstValue(): T;
hasValues(): boolean;
/**
* Adds an item with all its children into specified equipmentSlots, wherever it fits.
* @param equipmentSlots Slot to add item+children into
* @param rootItemId Root item id to use as mod items parentid
* @param rootItemTplId Root itms tpl id
* @param itemWithChildren Item to add
* @param inventory Inventory to add item+children into
* @returns ItemAddedResult result object
*/
addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], rootItemId: string, rootItemTplId: string, itemWithChildren: Item[], inventory: Inventory): ItemAddedResult;
/**
* Is the provided item allowed inside a container
* @param slotGrid Items sub-grid we want to place item inside
* @param itemTpl Item tpl being placed
* @returns True if allowed
*/
protected itemAllowedInContainer(slotGrid: Grid, itemTpl: string): boolean;
}

View File

@ -1,13 +1,11 @@
import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper";
import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper";
import { BotGeneratorHelper } from "@spt-aki/helpers/BotGeneratorHelper";
import { ItemHelper } from "@spt-aki/helpers/ItemHelper";
import { WeightedRandomHelper } from "@spt-aki/helpers/WeightedRandomHelper";
import { Inventory } from "@spt-aki/models/eft/common/tables/IBotBase";
import { GenerationData } from "@spt-aki/models/eft/common/tables/IBotType";
import { Item } from "@spt-aki/models/eft/common/tables/IItem";
import { Grid, ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem";
import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem";
import { EquipmentSlots } from "@spt-aki/models/enums/EquipmentSlots";
import { ItemAddedResult } from "@spt-aki/models/enums/ItemAddedResult";
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
import { DatabaseServer } from "@spt-aki/servers/DatabaseServer";
import { LocalisationService } from "@spt-aki/services/LocalisationService";
@ -19,11 +17,10 @@ export declare class BotWeaponGeneratorHelper {
protected itemHelper: ItemHelper;
protected randomUtil: RandomUtil;
protected hashUtil: HashUtil;
protected inventoryHelper: InventoryHelper;
protected weightedRandomHelper: WeightedRandomHelper;
protected botGeneratorHelper: BotGeneratorHelper;
protected localisationService: LocalisationService;
protected containerHelper: ContainerHelper;
constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, containerHelper: ContainerHelper);
constructor(logger: ILogger, databaseServer: DatabaseServer, itemHelper: ItemHelper, randomUtil: RandomUtil, hashUtil: HashUtil, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, localisationService: LocalisationService);
/**
* Get a randomized number of bullets for a specific magazine
* @param magCounts Weights of magazines
@ -65,22 +62,4 @@ export declare class BotWeaponGeneratorHelper {
* @returns tpl of magazine
*/
getWeaponsDefaultMagazineTpl(weaponTemplate: ITemplateItem): string;
/**
* TODO - move into BotGeneratorHelper, this is not the class for it
* Adds an item with all its children into specified equipmentSlots, wherever it fits.
* @param equipmentSlots Slot to add item+children into
* @param parentId
* @param parentTpl
* @param itemWithChildren Item to add
* @param inventory Inventory to add item+children into
* @returns a `boolean` indicating item was added
*/
addItemWithChildrenToEquipmentSlot(equipmentSlots: string[], parentId: string, parentTpl: string, itemWithChildren: Item[], inventory: Inventory): ItemAddedResult;
/**
* Is the provided item allowed inside a container
* @param slotGrid Items sub-grid we want to place item inside
* @param itemTpl Item tpl being placed
* @returns True if allowed
*/
protected itemAllowedInContainer(slotGrid: Grid, itemTpl: string): boolean;
}

View File

@ -28,13 +28,12 @@ export declare class ContainerHelper {
protected locateSlot(container2D: number[][], containerX: number, containerY: number, x: number, y: number, itemW: number, itemH: number): boolean;
/**
* Find a free slot for an item to be placed at
* @param container2D Container to palce item in
* @param container2D Container to place item in
* @param x Container x size
* @param y Container y size
* @param itemW Items width
* @param itemH Items height
* @param rotate is item rotated
* @returns Location to place item
*/
fillContainerMapWithItem(container2D: number[][], x: number, y: number, itemW: number, itemH: number, rotate: boolean): number[][];
fillContainerMapWithItem(container2D: number[][], x: number, y: number, itemW: number, itemH: number, rotate: boolean): void;
}

View File

@ -3,6 +3,7 @@ import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper";
import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest";
import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile";
import { ICoreConfig } from "@spt-aki/models/spt/config/ICoreConfig";
import { IWeatherConfig } from "@spt-aki/models/spt/config/IWeatherConfig";
import { ConfigServer } from "@spt-aki/servers/ConfigServer";
import { GiftService } from "@spt-aki/services/GiftService";
import { MailSendService } from "@spt-aki/services/MailSendService";
@ -14,6 +15,7 @@ export declare class SptDialogueChatBot implements IDialogueChatBot {
protected giftService: GiftService;
protected configServer: ConfigServer;
protected coreConfig: ICoreConfig;
protected weatherConfig: IWeatherConfig;
constructor(profileHelper: ProfileHelper, randomUtil: RandomUtil, mailSendService: MailSendService, giftService: GiftService, configServer: ConfigServer);
getChatBot(): IUserDialogInfo;
/**

View File

@ -2,8 +2,7 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper";
import { NotificationSendHelper } from "@spt-aki/helpers/NotificationSendHelper";
import { NotifierHelper } from "@spt-aki/helpers/NotifierHelper";
import { Item } from "@spt-aki/models/eft/common/tables/IItem";
import { Dialogue, MessageContent, MessagePreview } from "@spt-aki/models/eft/profile/IAkiProfile";
import { MessageType } from "@spt-aki/models/enums/MessageType";
import { Dialogue, MessagePreview } from "@spt-aki/models/eft/profile/IAkiProfile";
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
import { DatabaseServer } from "@spt-aki/servers/DatabaseServer";
import { SaveServer } from "@spt-aki/servers/SaveServer";
@ -19,14 +18,6 @@ export declare class DialogueHelper {
protected localisationService: LocalisationService;
protected itemHelper: ItemHelper;
constructor(logger: ILogger, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, notifierHelper: NotifierHelper, notificationSendHelper: NotificationSendHelper, localisationService: LocalisationService, itemHelper: ItemHelper);
/**
* @deprecated Use MailSendService.sendMessage() or helpers
*/
createMessageContext(templateId: string, messageType: MessageType, maxStoreTime?: any): MessageContent;
/**
* @deprecated Use MailSendService.sendMessage() or helpers
*/
addDialogueMessage(dialogueID: string, messageContent: MessageContent, sessionID: string, rewards?: Item[], messageType?: MessageType): void;
/**
* Get the preview contents of the last message in a dialogue.
* @param dialogue

View File

@ -1,4 +1,7 @@
import { Category } from "@spt-aki/models/eft/common/tables/IHandbookBase";
import { Item } from "@spt-aki/models/eft/common/tables/IItem";
import { IItemConfig } from "@spt-aki/models/spt/config/IItemConfig";
import { ConfigServer } from "@spt-aki/servers/ConfigServer";
import { DatabaseServer } from "@spt-aki/servers/DatabaseServer";
import { JsonUtil } from "@spt-aki/utils/JsonUtil";
declare class LookupItem<T, I> {
@ -14,9 +17,11 @@ export declare class LookupCollection {
export declare class HandbookHelper {
protected databaseServer: DatabaseServer;
protected jsonUtil: JsonUtil;
protected configServer: ConfigServer;
protected itemConfig: IItemConfig;
protected lookupCacheGenerated: boolean;
protected handbookPriceCache: LookupCollection;
constructor(databaseServer: DatabaseServer, jsonUtil: JsonUtil);
constructor(databaseServer: DatabaseServer, jsonUtil: JsonUtil, configServer: ConfigServer);
/**
* Create an in-memory cache of all items with associated handbook price in handbookPriceCache class
*/
@ -28,6 +33,7 @@ export declare class HandbookHelper {
* @returns price in roubles
*/
getTemplatePrice(tpl: string): number;
getTemplatePriceForItems(items: Item[]): number;
/**
* Get all items in template with the given parent category
* @param parentId

View File

@ -1,15 +1,16 @@
import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper";
import { ItemHelper } from "@spt-aki/helpers/ItemHelper";
import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper";
import { IPmcData } from "@spt-aki/models/eft/common/IPmcData";
import { HideoutArea, IHideoutImprovement, Production, Productive } from "@spt-aki/models/eft/common/tables/IBotBase";
import { Upd } from "@spt-aki/models/eft/common/tables/IItem";
import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem";
import { StageBonus } from "@spt-aki/models/eft/hideout/IHideoutArea";
import { IHideoutContinuousProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutContinuousProductionStartRequestData";
import { IHideoutProduction } from "@spt-aki/models/eft/hideout/IHideoutProduction";
import { IHideoutSingleProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutSingleProductionStartRequestData";
import { IHideoutTakeProductionRequestData } from "@spt-aki/models/eft/hideout/IHideoutTakeProductionRequestData";
import { IAddItemRequestData } from "@spt-aki/models/eft/inventory/IAddItemRequestData";
import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse";
import { SkillTypes } from "@spt-aki/models/enums/SkillTypes";
import { IHideoutConfig } from "@spt-aki/models/spt/config/IHideoutConfig";
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder";
@ -19,6 +20,7 @@ import { LocalisationService } from "@spt-aki/services/LocalisationService";
import { PlayerService } from "@spt-aki/services/PlayerService";
import { HashUtil } from "@spt-aki/utils/HashUtil";
import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil";
import { JsonUtil } from "@spt-aki/utils/JsonUtil";
import { TimeUtil } from "@spt-aki/utils/TimeUtil";
export declare class HideoutHelper {
protected logger: ILogger;
@ -31,14 +33,17 @@ export declare class HideoutHelper {
protected inventoryHelper: InventoryHelper;
protected playerService: PlayerService;
protected localisationService: LocalisationService;
protected itemHelper: ItemHelper;
protected configServer: ConfigServer;
protected jsonUtil: JsonUtil;
static bitcoinFarm: string;
static bitcoinProductionId: string;
static waterCollector: string;
static bitcoin: string;
static bitcoinTpl: string;
static expeditionaryFuelTank: string;
static maxSkillPoint: number;
protected hideoutConfig: IHideoutConfig;
constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, localisationService: LocalisationService, configServer: ConfigServer);
constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, inventoryHelper: InventoryHelper, playerService: PlayerService, localisationService: LocalisationService, itemHelper: ItemHelper, configServer: ConfigServer, jsonUtil: JsonUtil);
/**
* Add production to profiles' Hideout.Production array
* @param pmcData Profile to add production to
@ -80,6 +85,16 @@ export declare class HideoutHelper {
waterCollectorHasFilter: boolean;
};
protected doesWaterCollectorHaveFilter(waterCollector: HideoutArea): boolean;
/**
* Iterate over productions and update their progress timers
* @param pmcData Profile to check for productions and update
* @param hideoutProperties Hideout properties
*/
protected updateProductionTimers(pmcData: IPmcData, hideoutProperties: {
btcFarmCGs: number;
isGeneratorOn: boolean;
waterCollectorHasFilter: boolean;
}): void;
/**
* Update progress timer for water collector
* @param pmcData profile to update
@ -91,16 +106,6 @@ export declare class HideoutHelper {
isGeneratorOn: boolean;
waterCollectorHasFilter: boolean;
}): void;
/**
* Iterate over productions and update their progress timers
* @param pmcData Profile to check for productions and update
* @param hideoutProperties Hideout properties
*/
protected updateProductionTimers(pmcData: IPmcData, hideoutProperties: {
btcFarmCGs: number;
isGeneratorOn: boolean;
waterCollectorHasFilter: boolean;
}): void;
/**
* Update a productions progress value based on the amount of time that has passed
* @param pmcData Player profile
@ -138,17 +143,34 @@ export declare class HideoutHelper {
isGeneratorOn: boolean;
waterCollectorHasFilter: boolean;
}): void;
protected updateFuel(generatorArea: HideoutArea, pmcData: IPmcData): void;
protected updateWaterCollector(sessionId: string, pmcData: IPmcData, area: HideoutArea, isGeneratorOn: boolean): void;
/**
* Decrease fuel from generator slots based on amount of time since last time this occured
* @param generatorArea Hideout area
* @param pmcData Player profile
* @param isGeneratorOn Is the generator turned on since last update
*/
protected updateFuel(generatorArea: HideoutArea, pmcData: IPmcData, isGeneratorOn: boolean): void;
protected updateWaterCollector(sessionId: string, pmcData: IPmcData, area: HideoutArea, hideoutProperties: {
btcFarmCGs: number;
isGeneratorOn: boolean;
waterCollectorHasFilter: boolean;
}): void;
/**
* Get craft time and make adjustments to account for dev profile + crafting skill level
* @param pmcData Player profile making craft
* @param recipeId Recipe being crafted
* @param applyHideoutManagementBonus should the hideout mgmt bonus be appled to the calculation
* @returns Items craft time with bonuses subtracted
*/
protected getAdjustedCraftTimeWithSkills(pmcData: IPmcData, recipeId: string, applyHideoutManagementBonus?: boolean): number;
/**
* Adjust water filter objects resourceValue or delete when they reach 0 resource
* @param waterFilterArea water filter area to update
* @param production production object
* @param isGeneratorOn is generator enabled
* @param pmcData Player profile
* @returns Updated HideoutArea object
*/
protected updateWaterFilters(waterFilterArea: HideoutArea, production: Production, isGeneratorOn: boolean, pmcData: IPmcData): HideoutArea;
protected updateWaterFilters(waterFilterArea: HideoutArea, production: Production, isGeneratorOn: boolean, pmcData: IPmcData): void;
/**
* Get an adjusted water filter drain rate based on time elapsed since last run,
* handle edge case when craft time has gone on longer than total production time
@ -156,9 +178,9 @@ export declare class HideoutHelper {
* @param totalProductionTime Total time collecting water
* @param productionProgress how far water collector has progressed
* @param baseFilterDrainRate Base drain rate
* @returns
* @returns drain rate (adjusted)
*/
protected adjustWaterFilterDrainRate(secondsSinceServerTick: number, totalProductionTime: number, productionProgress: number, baseFilterDrainRate: number): number;
protected getTimeAdjustedWaterFilterDrainRate(secondsSinceServerTick: number, totalProductionTime: number, productionProgress: number, baseFilterDrainRate: number): number;
/**
* Get the water filter drain rate based on hideout bonues player has
* @param pmcData Player profile
@ -178,8 +200,8 @@ export declare class HideoutHelper {
* @param resourceUnitsConsumed
* @returns Upd
*/
protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number): Upd;
protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData): void;
protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number, isFoundInRaid: boolean): Upd;
protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData, isGeneratorOn: boolean): void;
protected updateBitcoinFarm(pmcData: IPmcData, btcFarmCGs: number, isGeneratorOn: boolean): Production;
/**
* Add bitcoin object to btc production products array and set progress time
@ -196,15 +218,15 @@ export declare class HideoutHelper {
*/
protected getTimeElapsedSinceLastServerTick(pmcData: IPmcData, isGeneratorOn: boolean, recipe?: IHideoutProduction): number;
/**
* Get a count of how many BTC can be gathered by the profile
* Get a count of how many possible BTC can be gathered by the profile
* @param pmcData Profile to look up
* @returns coin slot count
* @returns Coin slot count
*/
protected getBTCSlots(pmcData: IPmcData): number;
/**
* Get a count of bitcoins player miner can hold
* Get a count of how many additional bitcoins player hideout can hold with elite skill
*/
protected getBitcoinMinerContainerSlotSize(): number;
protected getEliteSkillAdditionalBitcoinSlotCount(): number;
/**
* HideoutManagement skill gives a consumption bonus the higher the level
* 0.5% per level per 1-51, (25.5% at max)
@ -213,12 +235,21 @@ export declare class HideoutHelper {
*/
protected getHideoutManagementConsumptionBonus(pmcData: IPmcData): number;
/**
* Adjust craft time based on crafting skill level found in player profile
* Get a multipler based on players skill level and value per level
* @param pmcData Player profile
* @param skill Player skill from profile
* @param valuePerLevel Value from globals.config.SkillsSettings - `PerLevel`
* @returns Multipler from 0 to 1
*/
protected getSkillBonusMultipliedBySkillLevel(pmcData: IPmcData, skill: SkillTypes, valuePerLevel: number): number;
/**
* @param pmcData Player profile
* @param productionTime Time to complete hideout craft in seconds
* @returns Adjusted craft time in seconds
* @param skill Skill bonus to get reduction from
* @param amountPerLevel Skill bonus amount to apply
* @returns Seconds to reduce craft time by
*/
protected getCraftingSkillProductionTimeReduction(pmcData: IPmcData, productionTime: number): number;
getSkillProductionTimeReduction(pmcData: IPmcData, productionTime: number, skill: SkillTypes, amountPerLevel: number): number;
isProduction(productive: Productive): productive is Production;
/**
* Gather crafted BTC from hideout area and add to inventory
@ -226,15 +257,9 @@ export declare class HideoutHelper {
* @param pmcData Player profile
* @param request Take production request
* @param sessionId Session id
* @returns IItemEventRouterResponse
* @param output Output object to update
*/
getBTC(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionId: string): IItemEventRouterResponse;
/**
* Create a single bitcoin request object
* @param pmcData Player profile
* @returns IAddItemRequestData
*/
protected createBitcoinRequest(pmcData: IPmcData): IAddItemRequestData;
getBTC(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionId: string, output: IItemEventRouterResponse): void;
/**
* Upgrade hideout wall from starting level to interactable level if necessary stations have been upgraded
* @param pmcProfile Profile to upgrade wall in
@ -251,4 +276,17 @@ export declare class HideoutHelper {
* @param pmcProfile Profile to adjust
*/
setHideoutImprovementsToCompleted(pmcProfile: IPmcData): void;
/**
* Add/remove bonus combat skill based on number of dogtags in place of fame hideout area
* @param pmcData Player profile
*/
applyPlaceOfFameDogtagBonus(pmcData: IPmcData): void;
/**
* Calculate the raw dogtag combat skill bonus for place of fame based on number of dogtags
* Reverse engineered from client code
* @param pmcData Player profile
* @param activeDogtags Active dogtags in place of fame dogtag slots
* @returns combat bonus
*/
protected getDogtagCombatSkillBonusPercent(pmcData: IPmcData, activeDogtags: Item[]): number;
}

View File

@ -3,7 +3,7 @@ import { ItemHelper } from "@spt-aki/helpers/ItemHelper";
import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper";
import { QuestHelper } from "@spt-aki/helpers/QuestHelper";
import { IPmcData, IPostRaidPmcData } from "@spt-aki/models/eft/common/IPmcData";
import { IQuestStatus, TraderInfo, Victim } from "@spt-aki/models/eft/common/tables/IBotBase";
import { IQuestStatus, TraderInfo } from "@spt-aki/models/eft/common/tables/IBotBase";
import { Item } from "@spt-aki/models/eft/common/tables/IItem";
import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData";
import { IInRaidConfig } from "@spt-aki/models/spt/config/IInRaidConfig";
@ -15,6 +15,7 @@ import { SaveServer } from "@spt-aki/servers/SaveServer";
import { LocalisationService } from "@spt-aki/services/LocalisationService";
import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService";
import { JsonUtil } from "@spt-aki/utils/JsonUtil";
import { RandomUtil } from "@spt-aki/utils/RandomUtil";
import { TimeUtil } from "@spt-aki/utils/TimeUtil";
import { ProfileHelper } from "./ProfileHelper";
export declare class InRaidHelper {
@ -31,9 +32,10 @@ export declare class InRaidHelper {
protected localisationService: LocalisationService;
protected profileFixerService: ProfileFixerService;
protected configServer: ConfigServer;
protected randomUtil: RandomUtil;
protected lostOnDeathConfig: ILostOnDeathConfig;
protected inRaidConfig: IInRaidConfig;
constructor(logger: ILogger, timeUtil: TimeUtil, saveServer: SaveServer, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, profileFixerService: ProfileFixerService, configServer: ConfigServer);
constructor(logger: ILogger, timeUtil: TimeUtil, saveServer: SaveServer, jsonUtil: JsonUtil, itemHelper: ItemHelper, databaseServer: DatabaseServer, inventoryHelper: InventoryHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, profileFixerService: ProfileFixerService, configServer: ConfigServer, randomUtil: RandomUtil);
/**
* Lookup quest item loss from lostOnDeath config
* @returns True if items should be removed from inventory
@ -45,19 +47,6 @@ export declare class InRaidHelper {
* @param items Items array to check
*/
addUpdToMoneyFromRaid(items: Item[]): void;
/**
* Add karma changes up and return the new value
* @param existingFenceStanding Current fence standing level
* @param victims Array of kills player performed
* @returns adjusted karma level after kills are taken into account
*/
calculateFenceStandingChangeFromKills(existingFenceStanding: number, victims: Victim[]): number;
/**
* Get the standing gain/loss for killing an npc
* @param victim Who was killed by player
* @returns a numerical standing gain or loss
*/
protected getFenceStandingChangeForKillAsScav(victim: Victim): number;
/**
* Reset a profile to a baseline, used post-raid
* Reset points earned during session property
@ -74,7 +63,7 @@ export declare class InRaidHelper {
*/
protected resetSkillPointsEarnedDuringRaid(profile: IPmcData): void;
/** Check counters are correct in profile */
protected validateBackendCounters(saveProgressRequest: ISaveProgressRequestData, profileData: IPmcData): void;
protected validateTaskConditionCounters(saveProgressRequest: ISaveProgressRequestData, profileData: IPmcData): void;
/**
* Update various serverPMC profile values; quests/limb hp/trader standing with values post-raic
* @param pmcData Server PMC profile
@ -109,6 +98,12 @@ export declare class InRaidHelper {
* @param tradersClientProfile Client
*/
protected applyTraderStandingAdjustments(tradersServerProfile: Record<string, TraderInfo>, tradersClientProfile: Record<string, TraderInfo>): void;
/**
* Transfer client achievements into profile
* @param profile Player pmc profile
* @param clientAchievements Achievements from client
*/
protected updateProfileAchievements(profile: IPmcData, clientAchievements: Record<string, number>): void;
/**
* Set the SPT inraid location Profile property to 'none'
* @param sessionID Session id
@ -129,16 +124,15 @@ export declare class InRaidHelper {
* @param sessionID Session id
* @param serverProfile Profile to update
* @param postRaidProfile Profile returned by client after a raid
* @returns Updated profile
*/
setInventory(sessionID: string, serverProfile: IPmcData, postRaidProfile: IPmcData): IPmcData;
setInventory(sessionID: string, serverProfile: IPmcData, postRaidProfile: IPmcData): void;
/**
* Clear pmc inventory of all items except those that are exempt
* Clear PMC inventory of all items except those that are exempt
* Used post-raid to remove items after death
* @param pmcData Player profile
* @param sessionID Session id
* @param sessionId Session id
*/
deleteInventory(pmcData: IPmcData, sessionID: string): void;
deleteInventory(pmcData: IPmcData, sessionId: string): void;
/**
* Get an array of items from a profile that will be lost on death
* @param pmcProfile Profile to get items from

View File

@ -2,17 +2,21 @@ import { ContainerHelper } from "@spt-aki/helpers/ContainerHelper";
import { DialogueHelper } from "@spt-aki/helpers/DialogueHelper";
import { ItemHelper } from "@spt-aki/helpers/ItemHelper";
import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper";
import { PresetHelper } from "@spt-aki/helpers/PresetHelper";
import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper";
import { TraderAssortHelper } from "@spt-aki/helpers/TraderAssortHelper";
import { IPmcData } from "@spt-aki/models/eft/common/IPmcData";
import { Inventory } from "@spt-aki/models/eft/common/tables/IBotBase";
import { Item } from "@spt-aki/models/eft/common/tables/IItem";
import { AddItem, IAddItemRequestData } from "@spt-aki/models/eft/inventory/IAddItemRequestData";
import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem";
import { IAddItemDirectRequest } from "@spt-aki/models/eft/inventory/IAddItemDirectRequest";
import { AddItem } from "@spt-aki/models/eft/inventory/IAddItemRequestData";
import { IAddItemTempObject } from "@spt-aki/models/eft/inventory/IAddItemTempObject";
import { IAddItemsDirectRequest } from "@spt-aki/models/eft/inventory/IAddItemsDirectRequest";
import { IInventoryMergeRequestData } from "@spt-aki/models/eft/inventory/IInventoryMergeRequestData";
import { IInventoryMoveRequestData } from "@spt-aki/models/eft/inventory/IInventoryMoveRequestData";
import { IInventoryRemoveRequestData } from "@spt-aki/models/eft/inventory/IInventoryRemoveRequestData";
import { IInventorySplitRequestData } from "@spt-aki/models/eft/inventory/IInventorySplitRequestData";
import { IInventoryTransferRequestData } from "@spt-aki/models/eft/inventory/IInventoryTransferRequestData";
import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse";
import { IInventoryConfig, RewardDetails } from "@spt-aki/models/spt/config/IInventoryConfig";
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
@ -23,7 +27,7 @@ import { LocalisationService } from "@spt-aki/services/LocalisationService";
import { HashUtil } from "@spt-aki/utils/HashUtil";
import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil";
import { JsonUtil } from "@spt-aki/utils/JsonUtil";
export interface OwnerInventoryItems {
export interface IOwnerInventoryItems {
/** Inventory items from source */
from: Item[];
/** Inventory items at destination */
@ -44,53 +48,84 @@ export declare class InventoryHelper {
protected itemHelper: ItemHelper;
protected containerHelper: ContainerHelper;
protected profileHelper: ProfileHelper;
protected presetHelper: PresetHelper;
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, localisationService: LocalisationService, 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, presetHelper: PresetHelper, localisationService: LocalisationService, configServer: ConfigServer);
/**
* BUG: Passing the same item multiple times with a count of 1 will cause multiples of that item to be added (e.g. x3 separate objects of tar cola with count of 1 = 9 tarcolas being added to inventory)
* @param pmcData Profile to add items to
* @param request request data to add items
* @param output response to send back to client
* @param sessionID Session id
* @param callback Code to execute later (function)
* @param foundInRaid Will results added to inventory be set as found in raid
* @param addUpd Additional upd properties for items being added to inventory
* @param useSortingTable Allow items to go into sorting table when stash has no space
* @returns IItemEventRouterResponse
*/
addItem(pmcData: IPmcData, request: IAddItemRequestData, output: IItemEventRouterResponse, sessionID: string, callback: () => void, foundInRaid?: boolean, addUpd?: any, useSortingTable?: boolean): IItemEventRouterResponse;
/**
* Take the given item, find a free slot in passed in inventory and place it there
* If no space in inventory, place in sorting table
* @param itemToAdd Item to add to inventory
* @param stashFS2D Two dimentional stash map
* @param sortingTableFS2D Two dimentional sorting table stash map
* @param itemLib
* Add multiple items to player stash (assuming they all fit)
* @param sessionId Session id
* @param request IAddItemsDirectRequest request
* @param pmcData Player profile
* @param useSortingTable Should sorting table be used for overflow items when no inventory space for item
* @param output Client output object
* @returns Client error output if placing item failed
* @param output Client response object
*/
protected placeItemInInventory(itemToAdd: IAddItemTempObject, stashFS2D: number[][], sortingTableFS2D: number[][], itemLib: Item[], playerInventory: Inventory, useSortingTable: boolean, output: IItemEventRouterResponse): IItemEventRouterResponse;
addItemsToStash(sessionId: string, request: IAddItemsDirectRequest, pmcData: IPmcData, output: IItemEventRouterResponse): void;
/**
* Add ammo to ammo boxes
* @param itemToAdd Item to check is ammo box
* @param parentId Ammo box parent id
* @param output IItemEventRouterResponse object
* @param sessionID Session id
* @param pmcData Profile to add ammobox to
* @param output object to send to client
* @param foundInRaid should ammo be FiR
* Add whatever is passed in `request.itemWithModsToAdd` into player inventory (if it fits)
* @param sessionId Session id
* @param request addItemDirect request
* @param pmcData Player profile
* @param output Client response object
*/
protected hydrateAmmoBoxWithAmmo(pmcData: IPmcData, itemToAdd: IAddItemTempObject, parentId: string, sessionID: string, output: IItemEventRouterResponse, foundInRaid: boolean): void;
addItemToStash(sessionId: string, request: IAddItemDirectRequest, pmcData: IPmcData, output: IItemEventRouterResponse): void;
/**
* Set FiR status for an item + its children
* @param itemWithChildren An item
* @param foundInRaid Item was found in raid
*/
protected setFindInRaidStatusForItem(itemWithChildren: Item[], foundInRaid: boolean): void;
/**
* Remove properties from a Upd object used by a trader/ragfair that are unnecessary to a player
* @param upd Object to update
*/
protected removeTraderRagfairRelatedUpdProperties(upd: Upd): void;
/**
* Can all probided items be added into player inventory
* @param sessionId Player id
* @param itemsWithChildren array of items with children to try and fit
* @returns True all items fit
*/
canPlaceItemsInInventory(sessionId: string, itemsWithChildren: Item[][]): boolean;
/**
* Do the provided items all fit into the grid
* @param containerFS2D Container grid to fit items into
* @param itemsWithChildren items to try and fit into grid
* @returns True all fit
*/
canPlaceItemsInContainer(containerFS2D: number[][], itemsWithChildren: Item[][]): boolean;
/**
* Does an item fit into a container grid
* @param containerFS2D Container grid
* @param itemWithChildren item to check fits
* @returns True it fits
*/
canPlaceItemInContainer(containerFS2D: number[][], itemWithChildren: Item[]): boolean;
/**
* Find a free location inside a container to fit the item
* @param containerFS2D Container grid to add item to
* @param itemWithChildren Item to add to grid
* @param containerId Id of the container we're fitting item into
* @param desiredSlotId slot id value to use, default is "hideout"
*/
placeItemInContainer(containerFS2D: number[][], itemWithChildren: Item[], containerId: string, desiredSlotId?: string): void;
/**
* Find a location to place an item into inventory and place it
* @param stashFS2D 2-dimensional representation of the container slots
* @param sortingTableFS2D 2-dimensional representation of the sorting table slots
* @param itemWithChildren Item to place
* @param playerInventory
* @param useSortingTable Should sorting table to be used if main stash has no space
* @param output output to send back to client
*/
protected placeItemInInventory(stashFS2D: number[][], sortingTableFS2D: number[][], itemWithChildren: Item[], playerInventory: Inventory, useSortingTable: boolean, output: IItemEventRouterResponse): void;
/**
* Split an items stack size based on its StackMaxSize value
* @param assortItems Items to add to inventory
* @param requestItem Details of purchased item to add to inventory
* @param result Array split stacks are added to
* @param result Array split stacks are appended to
*/
protected splitStackIntoSmallerStacks(assortItems: Item[], requestItem: AddItem, result: IAddItemTempObject[]): void;
protected splitStackIntoSmallerChildStacks(assortItems: Item[], requestItem: AddItem, result: IAddItemTempObject[]): void;
/**
* Handle Remove event
* Remove item from player inventory + insured items array
@ -98,16 +133,51 @@ export declare class InventoryHelper {
* @param profile Profile to remove item from (pmc or scav)
* @param itemId Items id to remove
* @param sessionID Session id
* @param output Existing IItemEventRouterResponse object to append data to, creates new one by default if not supplied
* @param output OPTIONAL - IItemEventRouterResponse
*/
removeItem(profile: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): void;
/**
* Delete desired item from a player profiles mail
* @param sessionId Session id
* @param removeRequest Remove request
* @param output OPTIONAL - IItemEventRouterResponse
*/
removeItemAndChildrenFromMailRewards(sessionId: string, removeRequest: IInventoryRemoveRequestData, output?: IItemEventRouterResponse): void;
/**
* Find item by id in player inventory and remove x of its count
* @param pmcData player profile
* @param itemId Item id to decrement StackObjectsCount of
* @param countToRemove Number of item to remove
* @param sessionID Session id
* @param output IItemEventRouterResponse
* @returns IItemEventRouterResponse
*/
removeItem(profile: IPmcData, itemId: string, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse;
removeItemAndChildrenFromMailRewards(sessionId: string, removeRequest: IInventoryRemoveRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse;
removeItemByCount(pmcData: IPmcData, itemId: string, count: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse;
getItemSize(itemTpl: string, itemID: string, inventoryItem: Item[]): number[];
removeItemByCount(pmcData: IPmcData, itemId: string, countToRemove: number, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse;
/**
* Get the height and width of an item - can have children that alter size
* @param itemTpl Item to get size of
* @param itemID Items id to get size of
* @param inventoryItems
* @returns [width, height]
*/
getItemSize(itemTpl: string, itemID: string, inventoryItems: Item[]): number[];
protected getSizeByInventoryItemHash(itemTpl: string, itemID: string, inventoryItemHash: InventoryHelper.InventoryItemHash): number[];
/**
* Get a blank two-dimentional representation of a container
* @param containerH Horizontal size of container
* @param containerY Vertical size of container
* @returns Two-dimensional representation of container
*/
protected getBlankContainerMap(containerH: number, containerY: number): number[][];
/**
* @param containerH Horizontal size of container
* @param containerV Vertical size of container
* @param itemList
* @param containerId Id of the container
* @returns Two-dimensional representation of container
*/
getContainerMap(containerH: number, containerV: number, itemList: Item[], containerId: string): number[][];
protected getInventoryItemHash(inventoryItem: Item[]): InventoryHelper.InventoryItemHash;
getContainerMap(containerW: number, containerH: number, itemList: Item[], containerId: string): number[][];
/**
* Return the inventory that needs to be modified (scav/pmc etc)
* Changes made to result apply to character inventory
@ -116,19 +186,31 @@ export declare class InventoryHelper {
* @param sessionId Session id / playerid
* @returns OwnerInventoryItems with inventory of player/scav to adjust
*/
getOwnerInventoryItems(request: IInventoryMoveRequestData | IInventorySplitRequestData | IInventoryMergeRequestData, sessionId: string): OwnerInventoryItems;
getOwnerInventoryItems(request: IInventoryMoveRequestData | IInventorySplitRequestData | IInventoryMergeRequestData | IInventoryTransferRequestData, sessionId: string): IOwnerInventoryItems;
/**
* Made a 2d array table with 0 - free slot and 1 - used slot
* @param {Object} pmcData
* @param {string} sessionID
* @returns Array
* Get a two dimensional array to represent stash slots
* 0 value = free, 1 = taken
* @param pmcData Player profile
* @param sessionID session id
* @returns 2-dimensional array
*/
protected getStashSlotMap(pmcData: IPmcData, sessionID: string): number[][];
/**
* Get a blank two-dimensional array representation of a container
* @param containerTpl Container to get data for
* @returns blank two-dimensional array
*/
getContainerSlotMap(containerTpl: string): number[][];
/**
* Get a two-dimensional array representation of the players sorting table
* @param pmcData Player profile
* @returns two-dimensional array
*/
protected getSortingTableSlotMap(pmcData: IPmcData): number[][];
/**
* Get Player Stash Proper Size
* @param sessionID Playerid
* @returns Array of 2 values, x and y stash size
* Get Players Stash Size
* @param sessionID Players id
* @returns Array of 2 values, horizontal and vertical stash size
*/
protected getPlayerStashSize(sessionID: string): Record<number, number>;
/**
@ -172,6 +254,15 @@ export declare class InventoryHelper {
*/
getRandomLootContainerRewardDetails(itemTpl: string): RewardDetails;
getInventoryConfig(): IInventoryConfig;
/**
* Recursively checks if the given item is
* inside the stash, that is it has the stash as
* ancestor with slotId=hideout
* @param pmcData Player profile
* @param itemToCheck Item to look for
* @returns True if item exists inside stash
*/
isItemInStash(pmcData: IPmcData, itemToCheck: Item): boolean;
}
declare namespace InventoryHelper {
interface InventoryItemHash {

View File

@ -32,8 +32,8 @@ export declare class ItemHelper {
constructor(logger: ILogger, hashUtil: HashUtil, jsonUtil: JsonUtil, randomUtil: RandomUtil, objectId: ObjectId, mathUtil: MathUtil, databaseServer: DatabaseServer, handbookHelper: HandbookHelper, itemBaseClassService: ItemBaseClassService, itemFilterService: ItemFilterService, localisationService: LocalisationService, 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
* @returns boolean; true for items that may be in player possession and not quest items
* @param {string} tpl the template id / tpl
* @returns boolean; true for items that may be in player possession and not quest items
*/
isValidItem(tpl: string, invalidBaseTypes?: string[]): boolean;
/**
@ -51,6 +51,44 @@ export declare class ItemHelper {
* @returns true if any supplied base classes match
*/
isOfBaseclasses(tpl: string, baseClassTpls: string[]): boolean;
/**
* Does the provided item have the chance to require soft armor inserts
* Only applies to helmets/vest/armors.
* Not all head gear needs them
* @param itemTpl item to check
* @returns Does item have the possibility ot need soft inserts
*/
armorItemCanHoldMods(itemTpl: string): boolean;
/**
* Does the provided item tpl need soft/removable inserts to function
* @param itemTpl Armor item
* @returns True if item needs some kind of insert
*/
armorItemHasRemovableOrSoftInsertSlots(itemTpl: string): boolean;
/**
* Does the pased in tpl have ability to hold removable plate items
* @param itemTpl item tpl to check for plate support
* @returns True when armor can hold plates
*/
armorItemHasRemovablePlateSlots(itemTpl: string): boolean;
/**
* Does the provided item tpl require soft inserts to become a valid armor item
* @param itemTpl Item tpl to check
* @returns True if it needs armor inserts
*/
itemRequiresSoftInserts(itemTpl: string): boolean;
/**
* Get all soft insert slot ids
* @returns An array of soft insert ids (e.g. soft_armor_back, helmet_top)
*/
getSoftInsertSlotIds(): string[];
/**
* Returns the items total price based on the handbook or as a fallback from the prices.json if the item is not
* found in the handbook. If the price can't be found at all return 0
* @param tpls item tpls to look up the price of
* @returns Total price in roubles
*/
getItemAndChildrenPrice(tpls: string[]): number;
/**
* Returns the item price based on the handbook or as a fallback from the prices.json if the item is not
* found in the handbook. If the price can't be found at all return 0
@ -83,43 +121,6 @@ export declare class ItemHelper {
* @returns Fixed item
*/
fixItemStackCount(item: Item): Item;
/**
* AmmoBoxes contain StackSlots which need to be filled for the AmmoBox to have content.
* Here's what a filled AmmoBox looks like:
* {
* "_id": "b1bbe982daa00ac841d4ae4d",
* "_tpl": "57372c89245977685d4159b1",
* "parentId": "5fe49a0e2694b0755a504876",
* "slotId": "hideout",
* "location": {
* "x": 3,
* "y": 4,
* "r": 0
* },
* "upd": {
* "StackObjectsCount": 1
* }
* },
* {
* "_id": "b997b4117199033afd274a06",
* "_tpl": "56dff061d2720bb5668b4567",
* "parentId": "b1bbe982daa00ac841d4ae4d",
* "slotId": "cartridges",
* "location": 0,
* "upd": {
* "StackObjectsCount": 30
* }
* }
* Given the AmmoBox Item (first object) this function generates the StackSlot (second object) and returns it.
* StackSlots are only used for AmmoBoxes which only have one element in StackSlots. However, it seems to be generic
* to possibly also have more than one StackSlot. As good as possible, without seeing items having more than one
* StackSlot, this function takes account of this and creates and returns an array of StackSlotItems
*
* @param {object} item The item template of the AmmoBox as given in items.json
* @param {string} parentId The id of the AmmoBox instance these StackSlotItems should be children of
* @returns {array} The array of StackSlotItems
*/
generateItemsFromStackSlot(item: ITemplateItem, parentId: string): Item[];
/**
* Get cloned copy of all item data from items.json
* @returns array of ITemplateItem objects
@ -131,7 +132,14 @@ export declare class ItemHelper {
* @returns bool - is valid + template item object as array
*/
getItem(tpl: string): [boolean, ITemplateItem];
itemHasSlots(itemTpl: string): boolean;
isItemInDb(tpl: string): boolean;
/**
* Calcualte the average quality of an item and its children
* @param items An offers item to process
* @returns % quality modifer between 0 and 1
*/
getItemQualityModifierForOfferItems(items: Item[]): number;
/**
* get normalized value (0-1) based on item condition
* @param item
@ -149,17 +157,18 @@ export declare class ItemHelper {
/**
* Recursive function that looks at every item from parameter and gets their childrens Ids + includes parent item in results
* @param items Array of items (item + possible children)
* @param itemId Parent items id
* @param baseItemId Parent items id
* @returns an array of strings
*/
findAndReturnChildrenByItems(items: Item[], itemId: string): string[];
findAndReturnChildrenByItems(items: Item[], baseItemId: string): string[];
/**
* A variant of findAndReturnChildren where the output is list of item objects instead of their ids.
* @param items
* @param baseItemId
* @param items Array of items (item + possible children)
* @param baseItemId Parent items id
* @param modsOnly Include only mod items, exclude items stored inside root item
* @returns An array of Item objects
*/
findAndReturnChildrenAsItems(items: Item[], baseItemId: string): Item[];
findAndReturnChildrenAsItems(items: Item[], baseItemId: string, modsOnly?: boolean): Item[];
/**
* Find children of the item in a given assort (weapons parts for example, need recursive loop function)
* @param itemIdToFind Template id of item to check for
@ -192,28 +201,42 @@ export declare class ItemHelper {
*/
isItemTplStackable(tpl: string): boolean;
/**
* split item stack if it exceeds its items StackMaxSize property
* Split item stack if it exceeds its items StackMaxSize property into child items of passed in parent
* @param itemToSplit Item to split into smaller stacks
* @returns Array of split items
* @returns Array of root item + children
*/
splitStack(itemToSplit: Item): Item[];
/**
* Turn items like money into separate stacks that adhere to max stack size
* @param itemToSplit Item to split into smaller stacks
* @returns
*/
splitStackIntoSeparateItems(itemToSplit: Item): Item[][];
/**
* Find Barter items from array of items
* @param {string} by tpl or id
* @param {Item[]} items Array of items to iterate over
* @param {string} barterItemId
* @param {Item[]} itemsToSearch Array of items to iterate over
* @param {string} desiredBarterItemIds
* @returns Array of Item objects
*/
findBarterItems(by: "tpl" | "id", items: Item[], barterItemId: string): Item[];
findBarterItems(by: "tpl" | "id", itemsToSearch: Item[], desiredBarterItemIds: string | string[]): Item[];
/**
* Regenerate all guids with new ids, exceptions are for items that cannot be altered (e.g. stash/sorting table)
* Regenerate all GUIDs with new IDs, for the exception of special item types (e.g. quest, sorting table, etc.) This
* function will not mutate the original items array, but will return a new array with new GUIDs.
*
* @param originalItems Items to adjust the IDs of
* @param pmcData Player profile
* @param items Items to adjust ID values of
* @param insuredItems insured items to not replace ids for
* @param fastPanel
* @param insuredItems Insured items that should not have their IDs replaced
* @param fastPanel Quick slot panel
* @returns Item[]
*/
replaceIDs(pmcData: IPmcData, items: Item[], insuredItems?: InsuredItem[], fastPanel?: any): Item[];
replaceIDs(originalItems: Item[], pmcData?: IPmcData | null, insuredItems?: InsuredItem[] | null, fastPanel?: any): Item[];
/**
* Mark the passed in array of items as found in raid.
* Modifies passed in items
* @param items The list of items to mark as FiR
*/
setFoundInRaid(items: Item[]): void;
/**
* WARNING, SLOW. Recursively loop down through an items hierarchy to see if any of the ids match the supplied list, return true if any do
* @param {string} tpl Items tpl to check parents of
@ -251,12 +274,6 @@ export declare class ItemHelper {
* to traverse, where the keys are the item IDs and the values are the corresponding Item objects. This alleviates
* some of the performance concerns, as it allows for quick lookups of items by ID.
*
* To generate the map:
* ```
* const itemsMap = new Map<string, Item>();
* items.forEach(item => itemsMap.set(item._id, item));
* ```
*
* @param itemId - The unique identifier of the item for which to find the main parent.
* @param itemsMap - A Map containing item IDs mapped to their corresponding Item objects for quick lookup.
* @returns The Item object representing the top-most parent of the given item, or `null` if no such parent exists.
@ -269,6 +286,22 @@ export declare class ItemHelper {
* @returns true if the item is attached attachment, otherwise false.
*/
isAttachmentAttached(item: Item): boolean;
/**
* Retrieves the equipment parent item for a given item.
*
* This method traverses up the hierarchy of items starting from a given `itemId`, until it finds the equipment
* parent item. In other words, if you pass it an item id of a suppressor, it will traverse up the muzzle brake,
* barrel, upper receiver, gun, nested backpack, and finally return the backpack Item that is equipped.
*
* It's important to note that traversal is expensive, so this method requires that you pass it a Map of the items
* to traverse, where the keys are the item IDs and the values are the corresponding Item objects. This alleviates
* some of the performance concerns, as it allows for quick lookups of items by ID.
*
* @param itemId - The unique identifier of the item for which to find the equipment parent.
* @param itemsMap - A Map containing item IDs mapped to their corresponding Item objects for quick lookup.
* @returns The Item object representing the equipment parent of the given item, or `null` if no such parent exists.
*/
getEquipmentParent(itemId: string, itemsMap: Map<string, Item>): Item | null;
/**
* Get the inventory size of an item
* @param items Item with children
@ -281,13 +314,19 @@ export declare class ItemHelper {
* @param item Db item template to look up Cartridge filter values from
* @returns Caliber of cartridge
*/
getRandomCompatibleCaliberTemplateId(item: ITemplateItem): string;
getRandomCompatibleCaliberTemplateId(item: ITemplateItem): string | null;
/**
* Add cartridges to the ammo box with correct max stack sizes
* @param ammoBox Box to add cartridges to
* @param ammoBoxDetails Item template from items db
*/
addCartridgesToAmmoBox(ammoBox: Item[], ammoBoxDetails: ITemplateItem): void;
/**
* Add a single stack of cartridges to the ammo box
* @param ammoBox Box to add cartridges to
* @param ammoBoxDetails Item template from items db
*/
addSingleStackCartridgesToAmmoBox(ammoBox: Item[], ammoBoxDetails: ITemplateItem): void;
/**
* Check if item is stored inside of a container
* @param item Item to check is inside of container
@ -303,16 +342,17 @@ export declare class ItemHelper {
* @param staticAmmoDist Cartridge distribution
* @param caliber Caliber of cartridge to add to magazine
* @param minSizePercent % the magazine must be filled to
* @param weapon Weapon the magazine will be used for (if passed in uses Chamber as whitelist)
*/
fillMagazineWithRandomCartridge(magazine: Item[], magTemplate: ITemplateItem, staticAmmoDist: Record<string, IStaticAmmoDetails[]>, caliber?: string, minSizePercent?: number): void;
fillMagazineWithRandomCartridge(magazine: Item[], magTemplate: ITemplateItem, staticAmmoDist: Record<string, IStaticAmmoDetails[]>, caliber?: string, minSizePercent?: number, weapon?: ITemplateItem): void;
/**
* Add child items to a magazine of a specific cartridge
* @param magazine Magazine to add child items to
* @param magazineWithChildCartridges Magazine to add child items to
* @param magTemplate Db template of magazine
* @param cartridgeTpl Cartridge to add to magazine
* @param minSizePercent % the magazine must be filled to
*/
fillMagazineWithCartridge(magazine: Item[], magTemplate: ITemplateItem, cartridgeTpl: string, minSizePercent?: number): void;
fillMagazineWithCartridge(magazineWithChildCartridges: Item[], magTemplate: ITemplateItem, cartridgeTpl: string, minSizePercent?: number): void;
/**
* Choose a random bullet type from the list of possible a magazine has
* @param magTemplate Magazine template from Db
@ -323,18 +363,20 @@ export declare class ItemHelper {
* Chose a randomly weighted cartridge that fits
* @param caliber Desired caliber
* @param staticAmmoDist Cartridges and thier weights
* @param cartridgeWhitelist OPTIONAL whitelist for cartridges
* @returns Tpl of cartridge
*/
protected drawAmmoTpl(caliber: string, staticAmmoDist: Record<string, IStaticAmmoDetails[]>): string;
protected drawAmmoTpl(caliber: string, staticAmmoDist: Record<string, IStaticAmmoDetails[]>, cartridgeWhitelist?: string[]): string;
/**
* Create a basic cartrige object
* @param parentId container cartridges will be placed in
* @param ammoTpl Cartridge to insert
* @param stackCount Count of cartridges inside parent
* @param location Location inside parent (e.g. 0, 1)
* @param foundInRaid OPTIONAL - Are cartridges found in raid (SpawnedInSession)
* @returns Item
*/
createCartridges(parentId: string, ammoTpl: string, stackCount: number, location: number): Item;
createCartridges(parentId: string, ammoTpl: string, stackCount: number, location: number, foundInRaid?: boolean): Item;
/**
* Get the size of a stack, return 1 if no stack object count property found
* @param item Item to get stack size of
@ -348,6 +390,71 @@ export declare class ItemHelper {
*/
getItemName(itemTpl: string): string;
getItemTplsOfBaseType(desiredBaseType: string): string[];
/**
* Add child slot items to an item, chooses random child item if multiple choices exist
* @param itemToAdd array with single object (root item)
* @param itemToAddTemplate Db tempalte for root item
* @param modSpawnChanceDict Optional dictionary of mod name + % chance mod will be included in item (e.g. front_plate: 100)
* @param requiredOnly Only add required mods
* @returns Item with children
*/
addChildSlotItems(itemToAdd: Item[], itemToAddTemplate: ITemplateItem, modSpawnChanceDict?: Record<string, number>, requiredOnly?: boolean): Item[];
/**
* Get a compatible tpl from the array provided where it is not found in the provided incompatible mod tpls parameter
* @param possibleTpls Tpls to randomply choose from
* @param incompatibleModTpls Incompatible tpls to not allow
* @returns Chosen tpl or null
*/
getCompatibleTplFromArray(possibleTpls: string[], incompatibleModTpls: Set<string>): string;
/**
* Is the provided item._props.Slots._name property a plate slot
* @param slotName Name of slot (_name) of Items Slot array
* @returns True if its a slot that holds a removable palte
*/
isRemovablePlateSlot(slotName: string): boolean;
/**
* Get a list of slot names that hold removable plates
* @returns Array of slot ids (e.g. front_plate)
*/
getRemovablePlateSlotIds(): string[];
/**
* Generate new unique ids for child items while preserving hierarchy
* @param rootItem Base/primary item
* @param itemWithChildren Primary item + children of primary item
* @returns Item array with updated IDs
*/
reparentItemAndChildren(rootItem: Item, itemWithChildren: Item[]): Item[];
/**
* Update a root items _id property value to be unique
* @param itemWithChildren Item to update root items _id property
* @param newId Optional: new id to use
* @returns New root id
*/
remapRootItemId(itemWithChildren: Item[], newId?: string): string;
/**
* Adopts orphaned items by resetting them as root "hideout" items. Helpful in situations where a parent has been
* deleted from a group of items and there are children still referencing the missing parent. This method will
* remove the reference from the children to the parent and set item properties to root values.
*
* @param rootId The ID of the "root" of the container.
* @param items Array of Items that should be adjusted.
* @returns Array of Items that have been adopted.
*/
adoptOrphanedItems(rootId: string, items: Item[]): Item[];
/**
* Populate a Map object of items for quick lookup using their ID.
*
* @param items An array of Items that should be added to a Map.
* @returns A Map where the keys are the item IDs and the values are the corresponding Item objects.
*/
generateItemsMap(items: Item[]): Map<string, Item>;
/**
* Add a blank upd object to passed in item if it does not exist already
* @param item item to add upd to
* @param warningMessageWhenMissing text to write to log when upd object was not found
* @returns True when upd object was added
*/
addUpdObjectToItem(item: Item, warningMessageWhenMissing?: string): boolean;
}
declare namespace ItemHelper {
interface ItemSize {

View File

@ -1,23 +1,47 @@
import { IPreset } from "@spt-aki/models/eft/common/IGlobals";
import { DatabaseServer } from "@spt-aki/servers/DatabaseServer";
import { JsonUtil } from "@spt-aki/utils/JsonUtil";
import { ItemHelper } from "./ItemHelper";
export declare class PresetHelper {
protected jsonUtil: JsonUtil;
protected databaseServer: DatabaseServer;
protected itemHelper: ItemHelper;
protected lookup: Record<string, string[]>;
protected defaultPresets: Record<string, IPreset>;
constructor(jsonUtil: JsonUtil, databaseServer: DatabaseServer);
protected defaultEquipmentPresets: Record<string, IPreset>;
protected defaultWeaponPresets: Record<string, IPreset>;
constructor(jsonUtil: JsonUtil, databaseServer: DatabaseServer, itemHelper: ItemHelper);
hydratePresetStore(input: Record<string, string[]>): void;
/**
* Get default weapon and equipment presets
* @returns Dictionary
*/
getDefaultPresets(): Record<string, IPreset>;
/**
* Get default weapon presets
* @returns Dictionary
*/
getDefaultWeaponPresets(): Record<string, IPreset>;
/**
* Get default equipment presets
* @returns Dictionary
*/
getDefaultEquipmentPresets(): Record<string, IPreset>;
isPreset(id: string): boolean;
hasPreset(templateId: string): boolean;
getPreset(id: string): IPreset;
getAllPresets(): IPreset[];
getPresets(templateId: string): IPreset[];
/**
* Get the default preset for passed in weapon id
* @param templateId Weapon id to get preset for
* Get the default preset for passed in item id
* @param templateId Item id to get preset for
* @returns Null if no default preset, otherwise IPreset
*/
getDefaultPreset(templateId: string): IPreset;
getBaseItemTpl(presetId: string): string;
/**
* Return the price of the preset for the given item tpl, or for the tpl itself if no preset exists
* @param tpl The item template to get the price of
* @returns The price of the given item preset, or base item if no preset exists
*/
getDefaultPresetOrItemPrice(tpl: string): number;
}

View File

@ -4,17 +4,21 @@ import { Common, CounterKeyValue, Stats } from "@spt-aki/models/eft/common/table
import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile";
import { IValidateNicknameRequestData } from "@spt-aki/models/eft/profile/IValidateNicknameRequestData";
import { SkillTypes } from "@spt-aki/models/enums/SkillTypes";
import { IInventoryConfig } from "@spt-aki/models/spt/config/IInventoryConfig";
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
import { ConfigServer } from "@spt-aki/servers/ConfigServer";
import { DatabaseServer } from "@spt-aki/servers/DatabaseServer";
import { SaveServer } from "@spt-aki/servers/SaveServer";
import { LocalisationService } from "@spt-aki/services/LocalisationService";
import { ProfileSnapshotService } from "@spt-aki/services/ProfileSnapshotService";
import { HashUtil } from "@spt-aki/utils/HashUtil";
import { JsonUtil } from "@spt-aki/utils/JsonUtil";
import { TimeUtil } from "@spt-aki/utils/TimeUtil";
import { Watermark } from "@spt-aki/utils/Watermark";
export declare class ProfileHelper {
protected logger: ILogger;
protected jsonUtil: JsonUtil;
protected hashUtil: HashUtil;
protected watermark: Watermark;
protected timeUtil: TimeUtil;
protected saveServer: SaveServer;
@ -22,18 +26,25 @@ export declare class ProfileHelper {
protected itemHelper: ItemHelper;
protected profileSnapshotService: ProfileSnapshotService;
protected localisationService: LocalisationService;
constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, localisationService: LocalisationService);
protected configServer: ConfigServer;
protected inventoryConfig: IInventoryConfig;
constructor(logger: ILogger, jsonUtil: JsonUtil, hashUtil: HashUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, localisationService: LocalisationService, configServer: ConfigServer);
/**
* Remove/reset a completed quest condtion from players profile quest data
* @param sessionID Session id
* @param questConditionId Quest with condition to remove
*/
removeCompletedQuestConditionFromProfile(pmcData: IPmcData, questConditionId: Record<string, string>): void;
removeQuestConditionFromProfile(pmcData: IPmcData, questConditionId: Record<string, string>): void;
/**
* Get all profiles from server
* @returns Dictionary of profiles
*/
getProfiles(): Record<string, IAkiProfile>;
/**
* Get the pmc and scav profiles as an array by profile id
* @param sessionID
* @returns Array of IPmcData objects
*/
getCompleteProfile(sessionID: string): IPmcData[];
/**
* Fix xp doubling on post-raid xp reward screen by sending a 'dummy' profile to the post-raid screen
@ -45,37 +56,70 @@ export declare class ProfileHelper {
* @param output pmc and scav profiles array
* @param pmcProfile post-raid pmc profile
* @param scavProfile post-raid scav profile
* @returns updated profile array
* @returns Updated profile array
*/
protected postRaidXpWorkaroundFix(sessionId: string, output: IPmcData[], pmcProfile: IPmcData, scavProfile: IPmcData): IPmcData[];
/**
* Check if a nickname is used by another profile loaded by the server
* @param nicknameRequest
* @param nicknameRequest nickname request object
* @param sessionID Session id
* @returns True if already used
*/
isNicknameTaken(nicknameRequest: IValidateNicknameRequestData, sessionID: string): boolean;
protected profileHasInfoProperty(profile: IAkiProfile): boolean;
protected nicknameMatches(profileName: string, nicknameRequest: string): boolean;
protected sessionIdMatchesProfileId(profileId: string, sessionId: string): boolean;
protected stringsMatch(stringA: string, stringB: string): boolean;
/**
* Add experience to a PMC inside the players profile
* @param sessionID Session id
* @param experienceToAdd Experience to add to PMC character
*/
addExperienceToPmc(sessionID: string, experienceToAdd: number): void;
/**
* Iterate all profiles and find matching pmc profile by provided id
* @param pmcId Profile id to find
* @returns IPmcData
*/
getProfileByPmcId(pmcId: string): IPmcData;
/**
* Get the experiecne for the given level
* @param level level to get xp for
* @returns Number of xp points for level
*/
getExperience(level: number): number;
/**
* Get the max level a player can be
* @returns Max level
*/
getMaxLevel(): number;
getDefaultAkiDataObject(): any;
/**
* Get full representation of a players profile json
* @param sessionID Profile id to get
* @returns IAkiProfile object
*/
getFullProfile(sessionID: string): IAkiProfile;
/**
* Get a PMC profile by its session id
* @param sessionID Profile id to return
* @returns IPmcData object
*/
getPmcProfile(sessionID: string): IPmcData;
/**
* Get a full profiles scav-specific sub-profile
* @param sessionID Profiles id
* @returns IPmcData object
*/
getScavProfile(sessionID: string): IPmcData;
/**
* Get baseline counter values for a fresh profile
* @returns Stats
* @returns Default profile Stats object
*/
getDefaultCounters(): Stats;
/**
* is this profile flagged for data removal
* @param sessionID Profile id
* @returns True if profile is to be wiped of data/progress
*/
protected isWiped(sessionID: string): boolean;
protected getServerVersion(): string;
/**
@ -120,5 +164,23 @@ export declare class ProfileHelper {
* @returns
*/
addSkillPointsToPlayer(pmcProfile: IPmcData, skill: SkillTypes, pointsToAdd: number, useSkillProgressRateMultipler?: boolean): void;
/**
* Get a speciic common skill from supplied profile
* @param pmcData Player profile
* @param skill Skill to look up and return value from
* @returns Common skill object from desired profile
*/
getSkillFromProfile(pmcData: IPmcData, skill: SkillTypes): Common;
/**
* Is the provided session id for a developer account
* @param sessionID Profile id ot check
* @returns True if account is developer
*/
isDeveloperAccount(sessionID: string): boolean;
/**
* Add stash row bonus to profile or increments rows given count if it already exists
* @param sessionId Profile id to give rows to
* @param rowsToAdd How many rows to give profile
*/
addStashRowsBonusToProfile(sessionId: string, rowsToAdd: number): void;
}

View File

@ -1,8 +1,8 @@
import { AvailableForConditions } from "@spt-aki/models/eft/common/tables/IQuest";
import { IQuestCondition } from "@spt-aki/models/eft/common/tables/IQuest";
export declare class QuestConditionHelper {
getQuestConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[];
getLevelConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[];
getLoyaltyConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[];
getStandingConditions(q: AvailableForConditions[], furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[];
protected filterConditions(q: AvailableForConditions[], questType: string, furtherFilter?: (a: AvailableForConditions) => AvailableForConditions[]): AvailableForConditions[];
getQuestConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[];
getLevelConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[];
getLoyaltyConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[];
getStandingConditions(q: IQuestCondition[], furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[];
protected filterConditions(q: IQuestCondition[], questType: string, furtherFilter?: (a: IQuestCondition) => IQuestCondition[]): IQuestCondition[];
}

View File

@ -1,6 +1,7 @@
import { DialogueHelper } from "@spt-aki/helpers/DialogueHelper";
import { ItemHelper } from "@spt-aki/helpers/ItemHelper";
import { PaymentHelper } from "@spt-aki/helpers/PaymentHelper";
import { PresetHelper } from "@spt-aki/helpers/PresetHelper";
import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper";
import { QuestConditionHelper } from "@spt-aki/helpers/QuestConditionHelper";
import { RagfairServerHelper } from "@spt-aki/helpers/RagfairServerHelper";
@ -8,7 +9,7 @@ import { TraderHelper } from "@spt-aki/helpers/TraderHelper";
import { IPmcData } from "@spt-aki/models/eft/common/IPmcData";
import { Common, IQuestStatus } from "@spt-aki/models/eft/common/tables/IBotBase";
import { Item } from "@spt-aki/models/eft/common/tables/IItem";
import { AvailableForConditions, AvailableForProps, IQuest, Reward } from "@spt-aki/models/eft/common/tables/IQuest";
import { IQuest, IQuestCondition, IQuestReward } from "@spt-aki/models/eft/common/tables/IQuest";
import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse";
import { IAcceptQuestRequestData } from "@spt-aki/models/eft/quests/IAcceptQuestRequestData";
import { IFailQuestRequestData } from "@spt-aki/models/eft/quests/IFailQuestRequestData";
@ -40,10 +41,11 @@ export declare class QuestHelper {
protected paymentHelper: PaymentHelper;
protected localisationService: LocalisationService;
protected traderHelper: TraderHelper;
protected presetHelper: PresetHelper;
protected mailSendService: MailSendService;
protected configServer: ConfigServer;
protected questConfig: IQuestConfig;
constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, questConditionHelper: QuestConditionHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, mailSendService: MailSendService, configServer: ConfigServer);
constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, questConditionHelper: QuestConditionHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, presetHelper: PresetHelper, mailSendService: MailSendService, configServer: ConfigServer);
/**
* Get status of a quest in player profile by its id
* @param pmcData Profile to search
@ -57,7 +59,7 @@ export declare class QuestHelper {
* @param condition Quest condition
* @returns true if player level is greater than or equal to quest
*/
doesPlayerLevelFulfilCondition(playerLevel: number, condition: AvailableForConditions): boolean;
doesPlayerLevelFulfilCondition(playerLevel: number, condition: IQuestCondition): boolean;
/**
* Get the quests found in both arrays (inner join)
* @param before Array of quests #1
@ -84,28 +86,34 @@ export declare class QuestHelper {
* @param profile Player profile
* @returns true if loyalty is high enough to fulfill quest requirement
*/
traderLoyaltyLevelRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean;
traderLoyaltyLevelRequirementCheck(questProperties: IQuestCondition, profile: IPmcData): boolean;
/**
* Check if trader has sufficient standing to fulfill quest requirement
* @param questProperties Quest props
* @param profile Player profile
* @returns true if standing is high enough to fulfill quest requirement
*/
traderStandingRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean;
traderStandingRequirementCheck(questProperties: IQuestCondition, profile: IPmcData): boolean;
protected compareAvailableForValues(current: number, required: number, compareMethod: string): boolean;
/**
* take reward item from quest and set FiR status + fix stack sizes + fix mod Ids
* @param reward Reward item to fix
* Take reward item from quest and set FiR status + fix stack sizes + fix mod Ids
* @param questReward Reward item to fix
* @returns Fixed rewards
*/
protected processReward(reward: Reward): Reward[];
protected processReward(questReward: IQuestReward): Item[];
/**
* Add missing mod items to a quest armor reward
* @param originalRewardRootItem Original armor reward item from IQuestReward.items object
* @param questReward Armor reward from quest
*/
protected generateArmorRewardChildSlots(originalRewardRootItem: Item, questReward: IQuestReward): void;
/**
* 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 status Quest status that holds the items (Started, Success, Fail)
* @returns array of items with the correct maxStack
*/
getQuestRewardItems(quest: IQuest, status: QuestStatus): Reward[];
getQuestRewardItems(quest: IQuest, status: QuestStatus): Item[];
/**
* Look up quest in db by accepted quest id and construct a profile-ready object ready to store in profile
* @param pmcData Player profile
@ -120,6 +128,12 @@ export declare class QuestHelper {
* @returns Quests accessible to player incuding newly unlocked quests now quest (startedQuestId) was started
*/
getNewlyAccessibleQuestsWhenStartingQuest(startedQuestId: string, sessionID: string): IQuest[];
/**
* Is the quest for the opposite side the player is on
* @param playerSide Player side (usec/bear)
* @param questId QuestId to check
*/
questIsForOtherSide(playerSide: string, questId: string): boolean;
/**
* Get quests that can be shown to player after failing a quest
* @param failedQuestId Id of the quest failed by player
@ -170,9 +184,8 @@ export declare class QuestHelper {
* @param failRequest Fail quest request data
* @param sessionID Session id
* @param output Client output
* @returns Item event router response
*/
failQuest(pmcData: IPmcData, failRequest: IFailQuestRequestData, sessionID: string, output?: IItemEventRouterResponse): IItemEventRouterResponse;
failQuest(pmcData: IPmcData, failRequest: IFailQuestRequestData, sessionID: string, output?: IItemEventRouterResponse): void;
/**
* Get List of All Quests from db
* NOT CLONED
@ -222,7 +235,7 @@ export declare class QuestHelper {
* @param questResponse Response to send back to client
* @returns Array of reward objects
*/
applyQuestReward(profileData: IPmcData, questId: string, state: QuestStatus, sessionId: string, questResponse: IItemEventRouterResponse): Reward[];
applyQuestReward(profileData: IPmcData, questId: string, state: QuestStatus, sessionId: string, questResponse: IItemEventRouterResponse): Item[];
/**
* WIP - Find hideout craft id and add to unlockedProductionRecipe array in player profile
* also update client response recipeUnlocked array with craft id
@ -232,7 +245,7 @@ export declare class QuestHelper {
* @param sessionID Session id
* @param response Response to send back to client
*/
protected findAndAddHideoutProductionIdToProfile(pmcData: IPmcData, craftUnlockReward: Reward, questDetails: IQuest, sessionID: string, response: IItemEventRouterResponse): void;
protected findAndAddHideoutProductionIdToProfile(pmcData: IPmcData, craftUnlockReward: IQuestReward, questDetails: IQuest, sessionID: string, response: IItemEventRouterResponse): void;
/**
* Get players money reward bonus from profile
* @param pmcData player profile
@ -253,4 +266,10 @@ export declare class QuestHelper {
*/
addAllQuestsToProfile(pmcProfile: IPmcData, statuses: QuestStatus[]): void;
findAndRemoveQuestFromArrayIfExists(questId: string, quests: IQuestStatus[]): void;
/**
* Return a list of quests that would fail when supplied quest is completed
* @param completedQuestId quest completed id
* @returns array of IQuest objects
*/
getQuestsFailedByCompletingQuest(completedQuestId: string): IQuest[];
}

View File

@ -24,6 +24,7 @@ import { LocaleService } from "@spt-aki/services/LocaleService";
import { LocalisationService } from "@spt-aki/services/LocalisationService";
import { MailSendService } from "@spt-aki/services/MailSendService";
import { RagfairOfferService } from "@spt-aki/services/RagfairOfferService";
import { RagfairRequiredItemsService } from "@spt-aki/services/RagfairRequiredItemsService";
import { HashUtil } from "@spt-aki/utils/HashUtil";
import { TimeUtil } from "@spt-aki/utils/TimeUtil";
export declare class RagfairOfferHelper {
@ -42,6 +43,7 @@ export declare class RagfairOfferHelper {
protected ragfairSortHelper: RagfairSortHelper;
protected ragfairHelper: RagfairHelper;
protected ragfairOfferService: RagfairOfferService;
protected ragfairRequiredItemsService: RagfairRequiredItemsService;
protected localeService: LocaleService;
protected localisationService: LocalisationService;
protected mailSendService: MailSendService;
@ -49,25 +51,32 @@ export declare class RagfairOfferHelper {
protected static goodSoldTemplate: string;
protected ragfairConfig: IRagfairConfig;
protected questConfig: IQuestConfig;
constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, localisationService: LocalisationService, mailSendService: MailSendService, configServer: ConfigServer);
constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, traderHelper: TraderHelper, saveServer: SaveServer, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, localeService: LocaleService, localisationService: LocalisationService, mailSendService: MailSendService, configServer: ConfigServer);
/**
* Passthrough to ragfairOfferService.getOffers(), get flea offers a player should see
* @param searchRequest Data from client
* @param itemsToAdd ragfairHelper.filterCategories()
* @param traderAssorts Trader assorts
* @param pmcProfile Player profile
* @param pmcData Player profile
* @returns Offers the player should see
*/
getValidOffers(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record<string, ITraderAssort>, pmcProfile: IPmcData): IRagfairOffer[];
getValidOffers(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record<string, ITraderAssort>, pmcData: IPmcData): IRagfairOffer[];
/**
* Get matching offers that require the desired item and filter out offers from non traders if player is below ragfair unlock level
* @param searchRequest Search request from client
* @param pmcDataPlayer profile
* @returns Matching IRagfairOffer objects
*/
getOffersThatRequireItem(searchRequest: ISearchRequestData, pmcData: IPmcData): IRagfairOffer[];
/**
* Get offers from flea/traders specifically when building weapon preset
* @param searchRequest Search request data
* @param itemsToAdd string array of item tpls to search for
* @param traderAssorts All trader assorts player can access/buy
* @param pmcProfile Player profile
* @param pmcData Player profile
* @returns IRagfairOffer array
*/
getOffersForBuild(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record<string, ITraderAssort>, pmcProfile: IPmcData): IRagfairOffer[];
getOffersForBuild(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record<string, ITraderAssort>, pmcData: IPmcData): IRagfairOffer[];
/**
* Check if offer is from trader standing the player does not have
* @param offer Offer to check
@ -140,6 +149,21 @@ export declare class RagfairOfferHelper {
* @returns Localised message text
*/
protected getLocalisedOfferSoldMessage(itemTpl: string, boughtAmount: number): string;
/**
* Check an offer passes the various search criteria the player requested
* @param searchRequest
* @param offer
* @param pmcData
* @returns True
*/
protected passesSearchFilterCriteria(searchRequest: ISearchRequestData, offer: IRagfairOffer, pmcData: IPmcData): boolean;
/**
* Check that the passed in offer item is functional
* @param offerRootItem The root item of the offer
* @param offer The flea offer
* @returns True if the given item is functional
*/
isItemFunctional(offerRootItem: Item, offer: IRagfairOffer): boolean;
/**
* Should a ragfair offer be visible to the player
* @param searchRequest Search request
@ -150,6 +174,7 @@ export declare class RagfairOfferHelper {
* @returns True = should be shown to player
*/
isDisplayableOffer(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record<string, ITraderAssort>, offer: IRagfairOffer, pmcProfile: IPmcData): boolean;
isDisplayableOfferThatNeedsItem(searchRequest: ISearchRequestData, offer: IRagfairOffer): boolean;
/**
* Does the passed in item have a condition property
* @param item Item to check

View File

@ -53,6 +53,12 @@ export declare class RagfairServerHelper {
* @returns True if its blacklsited
*/
protected isItemOnCustomFleaBlacklist(itemTemplateId: string): boolean;
/**
* Is supplied parent id on the ragfair custom item category blacklist
* @param parentId Parent Id to check is blacklisted
* @returns true if blacklisted
*/
protected isItemCategoryOnCustomFleaBlacklist(itemParentId: string): boolean;
/**
* is supplied id a trader
* @param traderId
@ -96,11 +102,4 @@ export declare class RagfairServerHelper {
* @returns
*/
getPresetItemsByTpl(item: Item): Item[];
/**
* Generate new unique ids for child items while preserving hierarchy
* @param rootItem Base/primary item of preset
* @param preset Primary item + children of primary item
* @returns Item array with new IDs
*/
reparentPresets(rootItem: Item, preset: Item[]): Item[];
}

View File

@ -1,63 +1,68 @@
import { InventoryHelper } from "@spt-aki/helpers/InventoryHelper";
import { ItemHelper } from "@spt-aki/helpers/ItemHelper";
import { TraderAssortHelper } from "@spt-aki/helpers/TraderAssortHelper";
import { TraderHelper } from "@spt-aki/helpers/TraderHelper";
import { IPmcData } from "@spt-aki/models/eft/common/IPmcData";
import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem";
import { Item } from "@spt-aki/models/eft/common/tables/IItem";
import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse";
import { IProcessBuyTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBuyTradeRequestData";
import { IProcessSellTradeRequestData } from "@spt-aki/models/eft/trade/IProcessSellTradeRequestData";
import { IInventoryConfig } from "@spt-aki/models/spt/config/IInventoryConfig";
import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig";
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder";
import { ConfigServer } from "@spt-aki/servers/ConfigServer";
import { RagfairServer } from "@spt-aki/servers/RagfairServer";
import { FenceService } from "@spt-aki/services/FenceService";
import { LocalisationService } from "@spt-aki/services/LocalisationService";
import { PaymentService } from "@spt-aki/services/PaymentService";
import { TraderPurchasePersisterService } from "@spt-aki/services/TraderPurchasePersisterService";
import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil";
import { JsonUtil } from "@spt-aki/utils/JsonUtil";
export declare class TradeHelper {
protected logger: ILogger;
protected jsonUtil: JsonUtil;
protected eventOutputHolder: EventOutputHolder;
protected traderHelper: TraderHelper;
protected itemHelper: ItemHelper;
protected paymentService: PaymentService;
protected fenceService: FenceService;
protected localisationService: LocalisationService;
protected httpResponse: HttpResponseUtil;
protected inventoryHelper: InventoryHelper;
protected ragfairServer: RagfairServer;
protected traderAssortHelper: TraderAssortHelper;
protected traderPurchasePersisterService: TraderPurchasePersisterService;
protected configServer: ConfigServer;
protected traderConfig: ITraderConfig;
constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, itemHelper: ItemHelper, paymentService: PaymentService, fenceService: FenceService, httpResponse: HttpResponseUtil, inventoryHelper: InventoryHelper, ragfairServer: RagfairServer, configServer: ConfigServer);
protected inventoryConfig: IInventoryConfig;
constructor(logger: ILogger, jsonUtil: JsonUtil, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, itemHelper: ItemHelper, paymentService: PaymentService, fenceService: FenceService, localisationService: LocalisationService, httpResponse: HttpResponseUtil, inventoryHelper: InventoryHelper, ragfairServer: RagfairServer, traderAssortHelper: TraderAssortHelper, traderPurchasePersisterService: TraderPurchasePersisterService, configServer: ConfigServer);
/**
* Buy item from flea or trader
* @param pmcData Player profile
* @param buyRequestData data from client
* @param sessionID Session id
* @param foundInRaid Should item be found in raid
* @param upd optional item details used when buying from flea
* @returns
* @param output IItemEventRouterResponse
* @returns IItemEventRouterResponse
*/
buyItem(pmcData: IPmcData, buyRequestData: IProcessBuyTradeRequestData, sessionID: string, foundInRaid: boolean, upd: Upd): IItemEventRouterResponse;
buyItem(pmcData: IPmcData, buyRequestData: IProcessBuyTradeRequestData, sessionID: string, foundInRaid: boolean, output: IItemEventRouterResponse): void;
/**
* Sell item to trader
* @param profileWithItemsToSell Profile to remove items from
* @param profileToReceiveMoney Profile to accept the money for selling item
* @param sellRequest Request data
* @param sessionID Session id
* @returns IItemEventRouterResponse
* @param output IItemEventRouterResponse
*/
sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string): IItemEventRouterResponse;
/**
* Increment the assorts buy count by number of items purchased
* Show error on screen if player attempts to buy more than what the buy max allows
* @param assortBeingPurchased assort being bought
* @param itemsPurchasedCount number of items being bought
*/
protected incrementAssortBuyCount(assortBeingPurchased: Item, itemsPurchasedCount: number): void;
sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string, output: IItemEventRouterResponse): void;
/**
* Traders allow a limited number of purchases per refresh cycle (default 60 mins)
* @param sessionId Session id
* @param traderId Trader assort is purchased from
* @param assortBeingPurchased the item from trader being bought
* @param assortId Id of assort being purchased
* @param count How many are being bought
* @param count How many of the item are being bought
*/
protected checkPurchaseIsWithinTraderItemLimit(assortBeingPurchased: Item, assortId: string, count: number): void;
protected checkPurchaseIsWithinTraderItemLimit(sessionId: string, traderId: string, assortBeingPurchased: Item, assortId: string, count: number): void;
}

View File

@ -48,6 +48,11 @@ export declare class TraderAssortHelper {
* @returns a traders' assorts
*/
getAssort(sessionId: string, traderId: string, flea?: boolean): ITraderAssort;
/**
* Reset every traders root item `BuyRestrictionCurrent` property to 0
* @param assortItems Items to adjust
*/
protected resetBuyRestrictionCurrentValue(assortItems: Item[]): void;
/**
* Create a dict of all assort id = quest id mappings used to work out what items should be shown to player based on the quests they've started/completed/failed
*/

View File

@ -59,7 +59,7 @@ export declare class TraderHelper {
/**
* Reset a profiles trader data back to its initial state as seen by a level 1 player
* Does NOT take into account different profile levels
* @param sessionID session id
* @param sessionID session id of player
* @param traderID trader id to reset
*/
resetTrader(sessionID: string, traderID: string): void;
@ -74,13 +74,13 @@ export declare class TraderHelper {
* Alter a traders unlocked status
* @param traderId Trader to alter
* @param status New status to use
* @param sessionId Session id
* @param sessionId Session id of player
*/
setTraderUnlockedState(traderId: string, status: boolean, sessionId: string): void;
/**
* Add standing to a trader and level them up if exp goes over level threshold
* @param sessionId Session id
* @param traderId Traders id
* @param sessionId Session id of player
* @param traderId Traders id to add standing to
* @param standingToAdd Standing value to add to trader
*/
addStandingToTrader(sessionId: string, traderId: string, standingToAdd: number): void;
@ -117,11 +117,11 @@ export declare class TraderHelper {
*/
addTraderPurchasesToPlayerProfile(sessionID: string, newPurchaseDetails: {
items: {
item_id: string;
itemId: string;
count: number;
}[];
tid: string;
}): void;
traderId: string;
}, itemPurchased: Item): void;
/**
* Get the highest rouble price for an item from traders
* UNUSED

View File

@ -0,0 +1,2 @@
import "reflect-metadata";
import "source-map-support/register";

View File

@ -1,33 +1,33 @@
import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper";
import { BundleHashCacheService } from "@spt-aki/services/cache/BundleHashCacheService";
import { JsonUtil } from "@spt-aki/utils/JsonUtil";
import { VFS } from "@spt-aki/utils/VFS";
declare class BundleInfo {
modPath: string;
key: string;
path: string;
filepath: string;
dependencyKeys: string[];
constructor(modpath: string, bundle: any, bundlePath: string, bundleFilepath: string);
export declare class BundleInfo {
modpath: string;
filename: string;
crc: number;
dependencies: string[];
constructor(modpath: string, bundle: BundleManifestEntry, bundleHash: number);
}
export declare class BundleLoader {
protected httpServerHelper: HttpServerHelper;
protected vfs: VFS;
protected jsonUtil: JsonUtil;
protected bundleHashCacheService: BundleHashCacheService;
protected bundles: Record<string, BundleInfo>;
constructor(httpServerHelper: HttpServerHelper, vfs: VFS, jsonUtil: JsonUtil);
constructor(httpServerHelper: HttpServerHelper, vfs: VFS, jsonUtil: JsonUtil, bundleHashCacheService: BundleHashCacheService);
/**
* Handle singleplayer/bundles
*/
getBundles(local: boolean): BundleInfo[];
getBundle(key: string, local: boolean): BundleInfo;
getBundles(): BundleInfo[];
getBundle(key: string): BundleInfo;
addBundles(modpath: string): void;
addBundle(key: string, b: BundleInfo): void;
}
export interface BundleManifest {
manifest: Array<BundleManifestEntry>;
manifest: BundleManifestEntry[];
}
export interface BundleManifestEntry {
key: string;
path: string;
dependencyKeys: string[];
}
export {};

View File

@ -1,21 +1,17 @@
import { DependencyContainer } from "tsyringe";
import { BundleLoader } from "@spt-aki/loaders/BundleLoader";
import { ModTypeCheck } from "@spt-aki/loaders/ModTypeCheck";
import { PreAkiModLoader } from "@spt-aki/loaders/PreAkiModLoader";
import { IModLoader } from "@spt-aki/models/spt/mod/IModLoader";
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
import { LocalisationService } from "@spt-aki/services/LocalisationService";
import { VFS } from "@spt-aki/utils/VFS";
export declare class PostAkiModLoader implements IModLoader {
protected logger: ILogger;
protected bundleLoader: BundleLoader;
protected vfs: VFS;
protected preAkiModLoader: PreAkiModLoader;
protected localisationService: LocalisationService;
protected modTypeCheck: ModTypeCheck;
constructor(logger: ILogger, bundleLoader: BundleLoader, vfs: VFS, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck);
protected container: DependencyContainer;
constructor(logger: ILogger, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck);
getModPath(mod: string): string;
load(): Promise<void>;
protected executeMods(container: DependencyContainer): Promise<void>;
protected addBundles(): void;
protected executeModsAsync(): Promise<void>;
}

View File

@ -1,17 +1,21 @@
import { DependencyContainer } from "tsyringe";
import { OnLoad } from "@spt-aki/di/OnLoad";
import { BundleLoader } from "@spt-aki/loaders/BundleLoader";
import { ModTypeCheck } from "@spt-aki/loaders/ModTypeCheck";
import { PreAkiModLoader } from "@spt-aki/loaders/PreAkiModLoader";
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
import { LocalisationService } from "@spt-aki/services/LocalisationService";
export declare class PostDBModLoader implements OnLoad {
protected logger: ILogger;
protected bundleLoader: BundleLoader;
protected preAkiModLoader: PreAkiModLoader;
protected localisationService: LocalisationService;
protected modTypeCheck: ModTypeCheck;
constructor(logger: ILogger, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck);
protected container: DependencyContainer;
constructor(logger: ILogger, bundleLoader: BundleLoader, preAkiModLoader: PreAkiModLoader, localisationService: LocalisationService, modTypeCheck: ModTypeCheck);
onLoad(): Promise<void>;
getRoute(): string;
getModPath(mod: string): string;
protected executeMods(container: DependencyContainer): Promise<void>;
protected executeModsAsync(): Promise<void>;
protected addBundles(): void;
}

View File

@ -1,5 +1,4 @@
import { DependencyContainer } from "tsyringe";
import { BundleLoader } from "@spt-aki/loaders/BundleLoader";
import { ModLoadOrder } from "@spt-aki/loaders/ModLoadOrder";
import { ModTypeCheck } from "@spt-aki/loaders/ModTypeCheck";
import { ModDetails } from "@spt-aki/models/eft/profile/IAkiProfile";
@ -17,12 +16,11 @@ export declare class PreAkiModLoader implements IModLoader {
protected vfs: VFS;
protected jsonUtil: JsonUtil;
protected modCompilerService: ModCompilerService;
protected bundleLoader: BundleLoader;
protected localisationService: LocalisationService;
protected configServer: ConfigServer;
protected modLoadOrder: ModLoadOrder;
protected modTypeCheck: ModTypeCheck;
protected static container: DependencyContainer;
protected container: DependencyContainer;
protected readonly basepath = "user/mods/";
protected readonly modOrderPath = "user/mods/order.json";
protected order: Record<string, number>;
@ -30,7 +28,7 @@ export declare class PreAkiModLoader implements IModLoader {
protected akiConfig: ICoreConfig;
protected serverDependencies: Record<string, string>;
protected skippedMods: Set<string>;
constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, modCompilerService: ModCompilerService, bundleLoader: BundleLoader, localisationService: LocalisationService, configServer: ConfigServer, modLoadOrder: ModLoadOrder, modTypeCheck: ModTypeCheck);
constructor(logger: ILogger, vfs: VFS, jsonUtil: JsonUtil, modCompilerService: ModCompilerService, localisationService: LocalisationService, configServer: ConfigServer, modLoadOrder: ModLoadOrder, modTypeCheck: ModTypeCheck);
load(container: DependencyContainer): Promise<void>;
/**
* Returns a list of mods with preserved load order
@ -68,10 +66,9 @@ export declare class PreAkiModLoader implements IModLoader {
protected isModCombatibleWithAki(mod: IPackageJsonData): boolean;
/**
* Execute each mod found in this.imported
* @param container Dependence container to give to mod when it runs
* @returns void promise
*/
protected executeModsAsync(container: DependencyContainer): Promise<void>;
protected executeModsAsync(): Promise<void>;
/**
* Read loadorder.json (create if doesnt exist) and return sorted list of mods
* @returns string array of sorted mod names

View File

@ -0,0 +1,9 @@
import { IMagazineTemplateAmmoItem } from "../profile/IAkiProfile";
export interface ISetMagazineRequest {
Id: string;
Name: string;
Caliber: string;
Items: IMagazineTemplateAmmoItem[];
TopCount: number;
BottomCount: number;
}

View File

@ -5,6 +5,7 @@ export interface IGlobals {
config: IConfig;
bot_presets: IBotPreset[];
AudioSettings: IAudioSettings;
EnvironmentSettings: IEnvironmentSettings;
BotWeaponScatterings: IBotWeaponScattering[];
ItemPresets: Record<string, IPreset>;
}
@ -39,6 +40,7 @@ export interface IConfig {
BaseLoadTime: number;
BaseUnloadTime: number;
BaseCheckTime: number;
BluntDamageReduceFromSoftArmorMod: number;
Customization: ICustomization;
UncheckOnShot: boolean;
BotsEnabled: boolean;
@ -70,6 +72,10 @@ export interface IConfig {
SkillPointsBeforeFatigue: number;
SkillFatigueReset: number;
DiscardLimitsEnabled: boolean;
EventSettings: IEventSettings;
FavoriteItemsSettings: IFavoriteItemsSettings;
VaultingSettings: IVaultingSettings;
BTRSettings: IBTRSettings;
EventType: string[];
WalkSpeed: Ixyz;
SprintSpeed: Ixyz;
@ -102,6 +108,27 @@ export interface IWeaponFastDrawSettings {
WeaponPistolFastSwitchMaxSpeedMult: number;
WeaponPistolFastSwitchMinSpeedMult: number;
}
export interface IEventSettings {
EventActive: boolean;
EventTime: number;
EventWeather: IEventWeather;
ExitTimeMultiplier: number;
StaminaMultiplier: number;
SummonFailedWeather: IEventWeather;
SummonSuccessWeather: IEventWeather;
WeatherChangeTime: number;
}
export interface IEventWeather {
Cloudness: number;
Hour: number;
Minute: number;
Rain: number;
RainRandomness: number;
ScaterringFogDensity: number;
TopWindDirection: Ixyz;
Wind: number;
WindDirection: number;
}
export interface IGraphicSettings {
ExperimentalFogInCity: boolean;
}
@ -656,6 +683,7 @@ export interface IBodyPartsSetting {
Minimum: number;
Maximum: number;
Default: number;
EnvironmentDamageMultiplier: number;
OverDamageReceivedMultiplier: number;
}
export interface IHealthFactorsSettings {
@ -826,6 +854,83 @@ export interface IRestrictionsInRaid {
TemplateId: string;
Value: number;
}
export interface IFavoriteItemsSettings {
WeaponStandMaxItemsCount: number;
PlaceOfFameMaxItemsCount: number;
}
export interface IVaultingSettings {
IsActive: boolean;
VaultingInputTime: number;
GridSettings: IVaultingGridSettings;
MovesSettings: IVaultingMovesSettings;
}
export interface IVaultingGridSettings {
GridSizeX: number;
GridSizeY: number;
GridSizeZ: number;
SteppingLengthX: number;
SteppingLengthY: number;
SteppingLengthZ: number;
GridOffsetX: number;
GridOffsetY: number;
GridOffsetZ: number;
OffsetFactor: number;
}
export interface IVaultingMovesSettings {
VaultSettings: IVaultingSubMoveSettings;
ClimbSettings: IVaultingSubMoveSettings;
}
export interface IVaultingSubMoveSettings {
IsActive: boolean;
MaxWithoutHandHeight: number;
SpeedRange: Ixyz;
MoveRestrictions: IMoveRestrictions;
AutoMoveRestrictions: IMoveRestrictions;
}
export interface IMoveRestrictions {
IsActive: boolean;
MinDistantToInteract: number;
MinHeight: number;
MaxHeight: number;
MinLength: number;
MaxLength: number;
}
export interface IBTRSettings {
LocationsWithBTR: string[];
BasePriceTaxi: number;
AddPriceTaxi: number;
CleanUpPrice: number;
DeliveryPrice: number;
ModDeliveryCost: number;
BearPriceMod: number;
UsecPriceMod: number;
ScavPriceMod: number;
CoefficientDiscountCharisma: number;
DeliveryMinPrice: number;
TaxiMinPrice: number;
BotCoverMinPrice: number;
MapsConfigs: Record<string, IBtrMapConfig>;
DiameterWheel: number;
HeightWheel: number;
HeightWheelMaxPosLimit: number;
HeightWheelMinPosLimit: number;
SnapToSurfaceWheelsSpeed: number;
CheckSurfaceForWheelsTimer: number;
HeightWheelOffset: number;
}
export interface IBtrMapConfig {
mapID: string;
pathsConfigurations: IBtrMapConfig[];
}
export interface IBtrMapConfig {
id: string;
enterPoint: string;
exitPoint: string;
pathPoints: string[];
once: boolean;
circle: boolean;
circleCount: number;
}
export interface ISquadSettings {
CountOfRequestsToOnePlayer: number;
SecondsForExpiredRequest: number;
@ -1240,6 +1345,11 @@ export interface IFenceLevel {
BotHelpChance: number;
BotSpreadoutChance: number;
BotStopChance: number;
PriceModTaxi: number;
PriceModDelivery: number;
PriceModCleanUp: number;
DeliveryGridSize: Ixyz;
CanInteractWithBtr: boolean;
}
export interface IInertia {
InertiaLimits: Ixyz;
@ -1335,6 +1445,14 @@ export interface IAudioGroupPreset {
OcclusionIntensity: number;
OverallVolume: number;
}
export interface IEnvironmentSettings {
SnowStepsVolumeMultiplier: number;
SurfaceMultipliers: ISurfaceMultiplier[];
}
export interface ISurfaceMultiplier {
SurfaceType: string;
VolumeMult: number;
}
export interface IBotWeaponScattering {
Name: string;
PriorityScatter1meter: number;

View File

@ -1,9 +1,10 @@
import { ILocationBase } from "@spt-aki/models/eft/common/ILocationBase";
import { Exit, ILocationBase } from "@spt-aki/models/eft/common/ILocationBase";
import { ILooseLoot } from "@spt-aki/models/eft/common/ILooseLoot";
export interface ILocation {
base: ILocationBase;
looseLoot: ILooseLoot;
statics: IStaticContainer;
allExtracts: Exit[];
}
export interface IStaticContainer {
containersGroups: Record<string, IContainerMinMax>;

View File

@ -132,6 +132,8 @@ export interface BossLocationSpawn {
TriggerId: string;
TriggerName: string;
Delay?: number;
ForceSpawn?: boolean;
IgnoreMaxBots?: boolean;
Supports?: BossSupport[];
sptId?: string;
}
@ -171,6 +173,7 @@ export interface SpawnPointParam {
BotZoneName: string;
Categories: string[];
ColliderParams: ColliderParams;
CorePointId: number;
DelayToCanSpawnSec: number;
Id: string;
Infiltration: string;
@ -187,9 +190,11 @@ export interface Props {
Radius: number;
}
export interface Exit {
/** % Chance out of 100 exit will appear in raid */
Chance: number;
Count: number;
EntryPoints: string;
EventAvailable: boolean;
ExfiltrationTime: number;
ExfiltrationType: string;
RequiredSlot?: string;
@ -200,6 +205,7 @@ export interface Exit {
PassageRequirement: string;
PlayersCount: number;
RequirementTip: string;
Side?: string;
}
export interface MaxItemCountInLocation {
TemplateId: string;

View File

@ -2,6 +2,10 @@ import { IBotBase, IEftStats } from "@spt-aki/models/eft/common/tables/IBotBase"
export interface IPmcData extends IBotBase {
}
export interface IPostRaidPmcData extends IBotBase {
/** Only found in profile we get from client post raid */
EftStats: IEftStats;
Stats: IPostRaidStats;
}
export interface IPostRaidStats {
Eft: IEftStats;
/** Only found in profile we get from client post raid */
Arena: IEftStats;
}

View File

@ -0,0 +1,18 @@
import { IQuestConditionTypes, IQuestRewards } from "./IQuest";
export interface IAchievement {
id: string;
imageUrl: string;
assetPath: string;
rewards: IQuestRewards;
conditions: IQuestConditionTypes;
instantComplete: boolean;
showNotificationsInGame: boolean;
showProgress: boolean;
prefab: string;
rarity: string;
hidden: boolean;
showConditions: boolean;
progressBarEnabled: boolean;
side: string;
index: number;
}

View File

@ -1,6 +1,8 @@
import { Item, Upd } from "@spt-aki/models/eft/common/tables/IItem";
import { IPmcDataRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests";
import { IRagfairOffer } from "@spt-aki/models/eft/ragfair/IRagfairOffer";
import { BonusSkillType } from "@spt-aki/models/enums/BonusSkillType";
import { BonusType } from "@spt-aki/models/enums/BonusType";
import { HideoutAreas } from "@spt-aki/models/enums/HideoutAreas";
import { MemberCategory } from "@spt-aki/models/enums/MemberCategory";
import { QuestStatus } from "@spt-aki/models/enums/QuestStatus";
@ -17,14 +19,15 @@ export interface IBotBase {
Skills: Skills;
Stats: Stats;
Encyclopedia: Record<string, boolean>;
ConditionCounters: ConditionCounters;
BackendCounters: Record<string, BackendCounter>;
TaskConditionCounters: Record<string, ITaskConditionCounter>;
InsuredItems: InsuredItem[];
Hideout: Hideout;
Quests: IQuestStatus[];
TradersInfo: Record<string, TraderInfo>;
UnlockedInfo: IUnlockedInfo;
RagfairInfo: RagfairInfo;
/** Achievement id and timestamp */
Achievements: Record<string, number>;
RepeatableQuests: IPmcDataRepeatableQuest[];
Bonuses: Bonus[];
Notes: Notes;
@ -35,6 +38,13 @@ export interface IBotBase {
/** SPT specific property used during bot generation in raid */
sptIsPmc?: boolean;
}
export interface ITaskConditionCounter {
id: string;
type: string;
value: number;
/** Quest id */
sourceId: string;
}
export interface IUnlockedInfo {
unlockedProductionRecipe: string[];
}
@ -44,6 +54,7 @@ export interface Info {
LowerNickname: string;
Side: string;
SquadInviteRestriction: boolean;
HasCoopExtension: boolean;
Voice: string;
Level: number;
Experience: number;
@ -127,6 +138,7 @@ export interface Inventory {
/** Key is hideout area enum numeric as string e.g. "24", value is area _id */
hideoutAreaStashes: Record<string, string>;
fastPanel: Record<string, string>;
favoriteItems: string[];
}
export interface IBaseJsonSkills {
Common: Record<string, Common>;
@ -170,6 +182,7 @@ export interface IEftStats {
LastPlayerState?: LastPlayerState;
TotalInGameTime: number;
SurvivorClass?: string;
sptLastRaidFenceRepChange?: number;
}
export interface IDroppedItem {
QuestId: string;
@ -202,14 +215,6 @@ export interface CounterKeyValue {
Key: string[];
Value: number;
}
export interface ConditionCounters {
Counters: Counter[];
}
export interface Counter {
id: string;
value: number;
qid: string;
}
export interface Aggressor {
AccountId: string;
ProfileId: string;
@ -311,6 +316,8 @@ export interface Productive {
sptIsComplete?: boolean;
/** Is the craft a Continuous, e.g bitcoins/water collector */
sptIsContinuous?: boolean;
/** Stores a list of tools used in this craft and whether they're FiR, to give back once the craft is done */
sptRequiredTools?: Item[];
}
export interface Production extends Productive {
RecipeId: string;
@ -330,6 +337,7 @@ export interface HideoutArea {
level: number;
active: boolean;
passiveBonusesEnabled: boolean;
/** Must be integer */
completeTime: number;
constructing: boolean;
slots: HideoutSlot[];
@ -351,6 +359,8 @@ export interface LastCompleted {
export interface Notes {
Notes: Note[];
}
export interface CarExtractCounts {
}
export declare enum SurvivorClass {
UNKNOWN = 0,
NEUTRALIZER = 1,
@ -382,7 +392,7 @@ export interface RagfairInfo {
}
export interface Bonus {
id?: string;
type: string;
type: BonusType;
templateId?: string;
passive?: boolean;
production?: boolean;
@ -390,7 +400,7 @@ export interface Bonus {
value?: number;
icon?: string;
filter?: string[];
skillType?: string;
skillType?: BonusSkillType;
}
export interface Note {
Time: number;

View File

@ -15,13 +15,14 @@ export interface IBotType {
export interface Appearance {
body: Record<string, number>;
feet: Record<string, number>;
hands: string[];
head: string[];
voice: string[];
hands: Record<string, number>;
head: Record<string, number>;
voice: Record<string, number>;
}
export interface Chances {
equipment: EquipmentChances;
mods: ModsChances;
weaponMods: ModsChances;
equipmentMods: ModsChances;
}
export interface EquipmentChances {
ArmBand: number;
@ -119,7 +120,7 @@ export interface GenerationData {
/** key: number of items, value: weighting */
weights: Record<string, number>;
/** Array of item tpls */
whitelist: string[];
whitelist: Record<string, number>;
}
export interface Health {
BodyParts: BodyPart[];
@ -159,10 +160,10 @@ export interface Equipment {
TacticalVest: Record<string, number>;
}
export interface Items {
Backpack: string[];
Pockets: string[];
SecuredContainer: string[];
SpecialLoot: string[];
TacticalVest: string[];
Backpack: Record<string, number>;
Pockets: Record<string, number>;
SecuredContainer: Record<string, number>;
SpecialLoot: Record<string, number>;
TacticalVest: Record<string, number>;
}
export type Mods = Record<string, Record<string, string[]>>;

View File

@ -33,6 +33,7 @@ export interface Upd {
Foldable?: Foldable;
SideEffect?: SideEffect;
RepairKit?: RepairKit;
CultistAmulet?: ICultistAmulet;
}
export interface Buff {
rarity: string;
@ -119,3 +120,6 @@ export interface SideEffect {
export interface RepairKit {
Resource: number;
}
export interface ICultistAmulet {
NumberOfUsages: number;
}

View File

@ -11,10 +11,10 @@ export interface IProfileTemplates {
}
export interface IProfileSides {
descriptionLocaleKey: string;
usec: TemplateSide;
bear: TemplateSide;
usec: ITemplateSide;
bear: ITemplateSide;
}
export interface TemplateSide {
export interface ITemplateSide {
character: IPmcData;
suits: string[];
dialogues: Record<string, Dialogue>;
@ -22,7 +22,7 @@ export interface TemplateSide {
trader: ProfileTraderTemplate;
}
export interface ProfileTraderTemplate {
initialLoyaltyLevel: number;
initialLoyaltyLevel: Record<string, number>;
setQuestsAvailableForStart?: boolean;
setQuestsAvailableForFinish?: boolean;
initialStanding: number;

View File

@ -7,7 +7,7 @@ export interface IQuest {
QuestName?: string;
_id: string;
canShowNotificationsInGame: boolean;
conditions: Conditions;
conditions: IQuestConditionTypes;
description: string;
failMessageText: string;
name: string;
@ -24,8 +24,11 @@ export interface IQuest {
secretQuest: boolean;
startedMessageText: string;
successMessageText: string;
acceptPlayerMessage: string;
declinePlayerMessage: string;
completePlayerMessage: string;
templateId: string;
rewards: Rewards;
rewards: IQuestRewards;
/** Becomes 'AppearStatus' inside client */
status: string | number;
KeyQuest: boolean;
@ -35,28 +38,24 @@ export interface IQuest {
/** Status of quest to player */
sptStatus?: QuestStatus;
}
export interface Conditions {
Started: AvailableForConditions[];
AvailableForFinish: AvailableForConditions[];
AvailableForStart: AvailableForConditions[];
Success: AvailableForConditions[];
Fail: AvailableForConditions[];
export interface IQuestConditionTypes {
Started: IQuestCondition[];
AvailableForFinish: IQuestCondition[];
AvailableForStart: IQuestCondition[];
Success: IQuestCondition[];
Fail: IQuestCondition[];
}
export interface AvailableForConditions {
_parent: string;
_props: AvailableForProps;
dynamicLocale?: boolean;
}
export interface AvailableForProps {
export interface IQuestCondition {
id: string;
index: number;
parentId: string;
isEncoded: boolean;
dynamicLocale: boolean;
value?: string | number;
index?: number;
compareMethod?: string;
dynamicLocale: boolean;
visibilityConditions?: VisibilityCondition[];
target?: string | string[];
globalQuestCounterId?: string;
parentId?: string;
target: string[] | string;
value?: string | number;
type?: boolean;
status?: QuestStatus[];
availableAfter?: number;
dispersion?: number;
@ -66,55 +65,81 @@ export interface AvailableForProps {
dogtagLevel?: number;
maxDurability?: number;
minDurability?: number;
counter?: AvailableForCounter;
counter?: IQuestConditionCounter;
plantTime?: number;
zoneId?: string;
type?: boolean;
countInRaid?: boolean;
globalQuestCounterId?: any;
completeInSeconds?: number;
isEncoded?: boolean;
conditionType?: string;
}
export interface AvailableForCounter {
export interface IQuestConditionCounter {
id: string;
conditions: CounterCondition[];
conditions: IQuestConditionCounterCondition[];
}
export interface CounterCondition {
_parent: string;
_props: CounterProps;
}
export interface CounterProps {
export interface IQuestConditionCounterCondition {
id: string;
target: string[] | string;
dynamicLocale: boolean;
target?: string[] | string;
completeInSeconds?: number;
energy?: IValueCompare;
exitName?: string;
hydration?: IValueCompare;
time?: IValueCompare;
compareMethod?: string;
value?: string;
value?: number;
weapon?: string[];
distance?: ICounterConditionDistance;
equipmentInclusive?: string[][];
weaponModsInclusive?: string[][];
weaponModsExclusive?: string[][];
enemyEquipmentInclusive?: string[][];
enemyEquipmentExclusive?: string[][];
weaponCaliber?: string[];
savageRole?: string[];
status?: string[];
bodyPart?: string[];
daytime?: DaytimeCounter;
daytime?: IDaytimeCounter;
conditionType?: string;
enemyHealthEffects?: IEnemyHealthEffect[];
resetOnSessionEnd?: boolean;
}
export interface DaytimeCounter {
export interface IEnemyHealthEffect {
bodyParts: string[];
effects: string[];
}
export interface IValueCompare {
compareMethod: string;
value: number;
}
export interface ICounterConditionDistance {
value: number;
compareMethod: string;
}
export interface IDaytimeCounter {
from: number;
to: number;
}
export interface VisibilityCondition {
id: string;
value: number;
dynamicLocale: boolean;
target: string;
value?: number;
dynamicLocale?: boolean;
oneSessionOnly: boolean;
conditionType: string;
}
export interface Rewards {
AvailableForStart: Reward[];
AvailableForFinish: Reward[];
Started: Reward[];
Success: Reward[];
Fail: Reward[];
FailRestartable: Reward[];
Expired: Reward[];
export interface IQuestRewards {
AvailableForStart?: IQuestReward[];
AvailableForFinish?: IQuestReward[];
Started?: IQuestReward[];
Success?: IQuestReward[];
Fail?: IQuestReward[];
FailRestartable?: IQuestReward[];
Expired?: IQuestReward[];
}
export interface Reward extends Item {
export interface IQuestReward {
value?: string | number;
id: string;
id?: string;
type: QuestRewardType;
index: number;
target?: string;

View File

@ -1,21 +1,19 @@
import { Item } from "@spt-aki/models/eft/common/tables/IItem";
export interface IReward {
index: number;
type: string;
value: number;
target?: string;
items?: Item[];
import { IQuest, IQuestConditionTypes, IQuestRewards } from "./IQuest";
export interface IRepeatableQuest extends IQuest {
changeCost: IChangeCost[];
changeStandingCost: number;
sptRepatableGroupName: string;
}
export interface IRepeatableQuestDatabase {
templates: ITemplates;
templates: IRepeatableTemplates;
rewards: IRewardOptions;
data: IOptions;
samples: ISampleQuests[];
}
export interface ITemplates {
Elimination: IRepeatableQuest;
Completion: IRepeatableQuest;
Exploration: IRepeatableQuest;
export interface IRepeatableTemplates {
Elimination: IQuest;
Completion: IQuest;
Exploration: IQuest;
}
export interface IPmcDataRepeatableQuest {
id?: string;
@ -23,9 +21,8 @@ export interface IPmcDataRepeatableQuest {
activeQuests: IRepeatableQuest[];
inactiveQuests: IRepeatableQuest[];
endTime: number;
changeRequirement: TChangeRequirementRecord;
changeRequirement: Record<string, IChangeRequirement>;
}
export type TChangeRequirementRecord = Record<string, IChangeRequirement>;
export interface IChangeRequirement {
changeCost: IChangeCost[];
changeStandingCost: number;
@ -34,183 +31,6 @@ export interface IChangeCost {
templateId: string;
count: number;
}
export interface IRepeatableQuest {
_id: string;
traderId: string;
location: string;
image: string;
type: string;
isKey: boolean;
restartable: boolean;
instantComplete: boolean;
secretQuest: boolean;
canShowNotificationsInGame: boolean;
rewards: IRewards;
conditions: IConditions;
side: string;
questStatus: any;
name: string;
note: string;
description: string;
successMessageText: string;
failMessageText: string;
startedMessageText: string;
changeQuestMessageText: string;
acceptPlayerMessage: string;
declinePlayerMessage: string;
completePlayerMessage: string;
templateId: string;
changeCost: IChangeCost[];
changeStandingCost: number;
sptRepatableGroupName?: string;
}
export interface IRewards {
Started: IReward[];
Success: IReward[];
Fail: IReward[];
}
export interface IConditions {
AvailableForStart: any[];
AvailableForFinish: IAvailableFor[];
Fail: any[];
}
export interface IAvailableFor {
_props: IAvailableForProps;
_parent: string;
dynamicLocale: boolean;
}
export interface IAvailableForProps {
id: string;
parentId: string;
dynamicLocale: boolean;
index: number;
visibilityConditions: IVisibilityCondition[];
value: number;
}
export interface IVisibilityCondition {
id: string;
oneSessionOnly: boolean;
value: number;
index: number;
dynamicLocale: boolean;
}
export interface IAvailableForPropsCounter extends IAvailableForProps {
type: string;
oneSessionOnly: boolean;
doNotResetIfCounterCompleted: boolean;
counter?: ICounter;
}
export interface ICounter {
id: string;
conditions: ICondition[];
}
export interface ICondition {
_props: IConditionProps;
_parent: string;
}
export interface IConditionProps {
id: string;
dynamicLocale: boolean;
}
export interface IElimination extends IRepeatableQuest {
conditions: IEliminationConditions;
}
export interface IEliminationConditions extends IConditions {
AvailableForFinish: IEliminationAvailableFor[];
}
export interface IEliminationAvailableFor extends IAvailableFor {
_props: IEliminationAvailableForProps;
}
export interface IEliminationAvailableForProps extends IAvailableForPropsCounter {
counter: IEliminationCounter;
}
export interface IEliminationCounter extends ICounter {
conditions: IEliminationCondition[];
}
export interface IEliminationCondition extends ICondition {
_props: ILocationConditionProps | IKillConditionProps;
}
export interface IExploration extends IRepeatableQuest {
conditions: IExplorationConditions;
}
export interface IExplorationConditions extends IConditions {
AvailableForFinish: IExplorationAvailableFor[];
}
export interface IExplorationAvailableFor extends IAvailableFor {
_props: IExplorationAvailableForProps;
}
export interface IExplorationAvailableForProps extends IAvailableForPropsCounter {
counter: IExplorationCounter;
}
export interface IExplorationCounter extends ICounter {
conditions: IExplorationCondition[];
}
export interface IExplorationCondition extends ICondition {
_props: ILocationConditionProps | IExitStatusConditionProps | IExitNameConditionProps;
}
export interface IPickup extends IRepeatableQuest {
conditions: IPickupConditions;
}
export interface IPickupConditions extends IConditions {
AvailableForFinish: IPickupAvailableFor[];
}
export interface IPickupAvailableFor extends IAvailableFor {
_props: IPickupAvailableForProps;
}
export interface IPickupAvailableForProps extends IAvailableForPropsCounter {
target: string[];
counter?: IPickupCounter;
}
export interface IPickupCounter extends ICounter {
conditions: IPickupCondition[];
}
export interface IPickupCondition extends ICondition {
_props: IEquipmentConditionProps | ILocationConditionProps | IExitStatusConditionProps;
}
export interface ICompletion extends IRepeatableQuest {
conditions: ICompletionConditions;
}
export interface ICompletionConditions extends IConditions {
AvailableForFinish: ICompletionAvailableFor[];
}
export interface ICompletionAvailableFor extends IAvailableFor {
_props: ICompletionAvailableForProps;
}
export interface ICompletionAvailableForProps extends IAvailableForProps {
target: string[];
minDurability: number;
maxDurability: number;
dogtagLevel: number;
onlyFoundInRaid: boolean;
}
export interface ILocationConditionProps extends IConditionProps {
target: string[];
weapon?: string[];
weaponCategories?: string[];
}
export interface IEquipmentConditionProps extends IConditionProps {
equipmentInclusive: [string[]];
IncludeNotEquippedItems: boolean;
}
export interface IKillConditionProps extends IConditionProps {
target: string;
value: number;
savageRole?: string[];
bodyPart?: string[];
distance?: IDistanceCheck;
weapon?: string[];
weaponCategories?: string[];
}
export interface IDistanceCheck {
compareMethod: string;
value: number;
}
export interface IExitStatusConditionProps extends IConditionProps {
status: string[];
}
export interface IExitNameConditionProps extends IConditionProps {
exitName: string;
}
export interface IRewardOptions {
itemsBlacklist: string[];
}
@ -240,8 +60,8 @@ export interface ISampleQuests {
instantComplete: boolean;
secretQuest: boolean;
canShowNotificationsInGame: boolean;
rewards: IRewards;
conditions: IConditions;
rewards: IQuestRewards;
conditions: IQuestConditionTypes;
name: string;
note: string;
description: string;

View File

@ -82,6 +82,7 @@ export interface Props {
EffectiveDistance?: number;
Ergonomics?: number;
Velocity?: number;
WithAnimatorAiming?: boolean;
RaidModdable?: boolean;
ToolModdable?: boolean;
UniqueAnimationModID?: number;
@ -155,6 +156,8 @@ export interface Props {
BlocksArmorVest?: boolean;
speedPenaltyPercent?: number;
GridLayoutName?: string;
ContainerSpawnChanceModifier?: number;
SpawnExcludedFilter?: string[];
SpawnFilter?: any[];
containType?: any[];
sizeWidth?: number;
@ -170,6 +173,9 @@ export interface Props {
MaxDurability?: number;
armorZone?: string[];
armorClass?: string | number;
armorColliders?: string[];
armorPlateColliders?: string[];
bluntDamageReduceFromSoftArmor?: boolean;
mousePenalty?: number;
weaponErgonomicPenalty?: number;
BluntThroughput?: number;
@ -179,14 +185,17 @@ export interface Props {
weapUseType?: string;
ammoCaliber?: string;
OperatingResource?: number;
PostRecoilHorizontalRangeHandRotation?: Ixyz;
PostRecoilVerticalRangeHandRotation?: Ixyz;
ProgressRecoilAngleOnStable?: Ixyz;
RepairComplexity?: number;
durabSpawnMin?: number;
durabSpawnMax?: number;
isFastReload?: boolean;
RecoilForceUp?: number;
RecoilForceBack?: number;
Convergence?: number;
RecoilAngle?: number;
RecoilCamera?: number;
weapFireType?: string[];
RecolDispersion?: number;
SingleFireRate?: number;
@ -194,6 +203,7 @@ export interface Props {
bFirerate?: number;
bEffDist?: number;
bHearDist?: number;
blockLeftStance?: boolean;
isChamberLoad?: boolean;
chamberAmmoCount?: number;
isBoltCatch?: boolean;
@ -202,8 +212,9 @@ export interface Props {
AdjustCollimatorsToTrajectory?: boolean;
shotgunDispersion?: number;
Chambers?: Slot[];
CameraRecoil?: number;
CameraSnap?: number;
CameraToWeaponAngleSpeedRange?: Ixyz;
CameraToWeaponAngleStep?: number;
ReloadMode?: string;
AimPlane?: number;
TacticalReloadStiffnes?: Ixyz;
@ -211,6 +222,7 @@ export interface Props {
RecoilCenter?: Ixyz;
RotationCenter?: Ixyz;
RotationCenterNoStock?: Ixyz;
ShotsGroupSettings?: IShotsGroupSettings[];
FoldedSlot?: string;
CompactHandling?: boolean;
MinRepairDegradation?: number;
@ -242,6 +254,11 @@ export interface Props {
AllowOverheat?: boolean;
DoubleActionAccuracyPenalty?: number;
RecoilPosZMult?: number;
RecoilReturnPathDampingHandRotation?: number;
RecoilReturnPathOffsetHandRotation?: number;
RecoilReturnSpeedHandRotation?: number;
RecoilStableAngleIncreaseStep?: number;
RecoilStableIndexShot?: number;
MinRepairKitDegradation?: number;
MaxRepairKitDegradation?: number;
BlocksEarpiece?: boolean;
@ -386,6 +403,15 @@ export interface Props {
LinkedWeapon?: string;
UseAmmoWithoutShell?: boolean;
RandomLootSettings?: IRandomLootSettings;
RecoilCategoryMultiplierHandRotation?: number;
RecoilDampingHandRotation?: number;
LeanWeaponAgainstBody?: boolean;
RemoveShellAfterFire?: boolean;
RepairStrategyTypes?: string[];
IsEncoded?: boolean;
LayoutName?: string;
Lower75Prefab?: Prefab;
MaxUsages?: number;
}
export interface IHealthEffect {
type: string;
@ -430,6 +456,10 @@ export interface SlotProps {
}
export interface SlotFilter {
Shift?: number;
locked?: boolean;
Plate?: string;
armorColliders?: string[];
armorPlateColliders?: string[];
Filter: string[];
AnimationIndex?: number;
}
@ -490,3 +520,10 @@ export interface IColor {
b: number;
a: number;
}
export interface IShotsGroupSettings {
EndShotIndex: number;
ShotRecoilPositionStrength: Ixyz;
ShotRecoilRadianRange: Ixyz;
ShotRecoilRotationStrength: Ixyz;
StartShotIndex: number;
}

View File

@ -1,10 +1,12 @@
import { Item } from "@spt-aki/models/eft/common/tables/IItem";
import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel";
export interface ITrader {
assort: ITraderAssort;
assort?: ITraderAssort;
base: ITraderBase;
dialogue?: Record<string, string[]>;
questassort: Record<string, Record<string, string>>;
questassort?: Record<string, Record<string, string>>;
suits?: ISuit[];
services?: ITraderServiceModel[];
}
export interface ITraderBase {
refreshTraderRagfairOffers: boolean;

View File

@ -1,3 +1,5 @@
import { BonusSkillType } from "@spt-aki/models/enums/BonusSkillType";
import { BonusType } from "@spt-aki/models/enums/BonusType";
export interface IHideoutArea {
_id: string;
type: number;
@ -66,8 +68,8 @@ export interface StageBonus {
passive: boolean;
production: boolean;
visible: boolean;
skillType?: string;
type: string;
skillType?: BonusSkillType;
type: BonusType;
filter?: string[];
icon?: string;
/** CHANGES PER DUMP */

View File

@ -3,6 +3,7 @@ export interface IHideoutProduction {
areaType: number;
requirements: Requirement[];
productionTime: number;
/** Tpl of item being crafted */
endProduct: string;
isEncoded: boolean;
locked: boolean;

Some files were not shown because too many files have changed in this diff Show More