2022-12-25 18:45:30 -05:00
|
|
|
import { ApplicationContext } from "../context/ApplicationContext";
|
2022-08-17 02:29:54 -04:00
|
|
|
import { PlayerScavGenerator } from "../generators/PlayerScavGenerator";
|
|
|
|
import { HealthHelper } from "../helpers/HealthHelper";
|
|
|
|
import { InRaidHelper } from "../helpers/InRaidHelper";
|
|
|
|
import { ItemHelper } from "../helpers/ItemHelper";
|
|
|
|
import { ProfileHelper } from "../helpers/ProfileHelper";
|
|
|
|
import { QuestHelper } from "../helpers/QuestHelper";
|
|
|
|
import { TraderHelper } from "../helpers/TraderHelper";
|
|
|
|
import { IPmcData } from "../models/eft/common/IPmcData";
|
2022-12-25 18:45:30 -05:00
|
|
|
import { Item } from "../models/eft/common/tables/IItem";
|
2022-08-17 02:29:54 -04:00
|
|
|
import { IRegisterPlayerRequestData } from "../models/eft/inRaid/IRegisterPlayerRequestData";
|
|
|
|
import { ISaveProgressRequestData } from "../models/eft/inRaid/ISaveProgressRequestData";
|
2022-12-25 18:45:30 -05:00
|
|
|
import { IAirdropConfig } from "../models/spt/config/IAirdropConfig";
|
2022-08-17 02:29:54 -04:00
|
|
|
import { IInRaidConfig } from "../models/spt/config/IInRaidConfig";
|
|
|
|
import { ILogger } from "../models/spt/utils/ILogger";
|
|
|
|
import { ConfigServer } from "../servers/ConfigServer";
|
|
|
|
import { DatabaseServer } from "../servers/DatabaseServer";
|
|
|
|
import { SaveServer } from "../servers/SaveServer";
|
|
|
|
import { InsuranceService } from "../services/InsuranceService";
|
|
|
|
import { JsonUtil } from "../utils/JsonUtil";
|
|
|
|
import { TimeUtil } from "../utils/TimeUtil";
|
2022-12-25 18:45:30 -05:00
|
|
|
/**
|
|
|
|
* Logic for handling In Raid callbacks
|
|
|
|
*/
|
2022-08-17 02:29:54 -04:00
|
|
|
export declare class InraidController {
|
|
|
|
protected logger: ILogger;
|
|
|
|
protected saveServer: SaveServer;
|
|
|
|
protected jsonUtil: JsonUtil;
|
|
|
|
protected timeUtil: TimeUtil;
|
|
|
|
protected databaseServer: DatabaseServer;
|
|
|
|
protected questHelper: QuestHelper;
|
|
|
|
protected itemHelper: ItemHelper;
|
|
|
|
protected profileHelper: ProfileHelper;
|
|
|
|
protected playerScavGenerator: PlayerScavGenerator;
|
|
|
|
protected healthHelper: HealthHelper;
|
|
|
|
protected traderHelper: TraderHelper;
|
|
|
|
protected insuranceService: InsuranceService;
|
|
|
|
protected inRaidHelper: InRaidHelper;
|
2022-12-25 18:45:30 -05:00
|
|
|
protected applicationContext: ApplicationContext;
|
2022-08-17 02:29:54 -04:00
|
|
|
protected configServer: ConfigServer;
|
2022-12-25 18:45:30 -05:00
|
|
|
protected airdropConfig: IAirdropConfig;
|
2022-08-17 02:29:54 -04:00
|
|
|
protected inraidConfig: IInRaidConfig;
|
2022-12-25 18:45:30 -05:00
|
|
|
constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer);
|
|
|
|
/**
|
|
|
|
* Save locationId to active profiles inraid object AND app context
|
|
|
|
* @param sessionID Session id
|
|
|
|
* @param info Register player request
|
|
|
|
*/
|
2022-08-17 02:29:54 -04:00
|
|
|
addPlayer(sessionID: string, info: IRegisterPlayerRequestData): void;
|
2022-09-01 05:19:17 -04:00
|
|
|
/**
|
2022-12-25 18:45:30 -05:00
|
|
|
* Save profile state to disk
|
|
|
|
* Handles pmc/pscav
|
|
|
|
* @param offraidData post-raid request data
|
|
|
|
* @param sessionID Session id
|
|
|
|
*/
|
|
|
|
savePostRaidProgress(offraidData: ISaveProgressRequestData, sessionID: string): void;
|
|
|
|
/**
|
|
|
|
* Handle updating player profile post-pmc raid
|
2022-09-01 05:19:17 -04:00
|
|
|
* @param sessionID session id
|
2022-12-25 18:45:30 -05:00
|
|
|
* @param offraidData post-raid data
|
2022-09-01 05:19:17 -04:00
|
|
|
*/
|
|
|
|
protected savePmcProgress(sessionID: string, offraidData: ISaveProgressRequestData): void;
|
2022-12-25 18:45:30 -05:00
|
|
|
/**
|
|
|
|
* Make changes to pmc profile after they left raid dead,
|
|
|
|
* alter bodypart hp, handle insurance, delete inventory items, remove carried quest items
|
|
|
|
* @param postRaidSaveRequest post-raid save request
|
|
|
|
* @param pmcData pmc profile
|
|
|
|
* @param insuranceEnabled is insurance enabled
|
|
|
|
* @param preRaidGear gear player had before raid
|
|
|
|
* @param sessionID Session id
|
|
|
|
* @returns Updated profile object
|
|
|
|
*/
|
|
|
|
protected performPostRaidActionsWhenDead(postRaidSaveRequest: ISaveProgressRequestData, pmcData: IPmcData, insuranceEnabled: boolean, preRaidGear: Item[], sessionID: string): IPmcData;
|
|
|
|
/**
|
|
|
|
* Adjust player characters bodypart hp if they left raid early
|
|
|
|
* @param postRaidSaveRequest post raid data
|
|
|
|
* @param pmcData player profile
|
|
|
|
*/
|
|
|
|
protected updatePmcHealthPostRaid(postRaidSaveRequest: ISaveProgressRequestData, pmcData: IPmcData): void;
|
2022-09-01 05:19:17 -04:00
|
|
|
/**
|
|
|
|
* Reduce body part hp to % of max
|
|
|
|
* @param pmcData profile to edit
|
|
|
|
* @param multipler multipler to apply to max health
|
|
|
|
*/
|
|
|
|
protected reducePmcHealthToPercent(pmcData: IPmcData, multipler: number): void;
|
|
|
|
/**
|
|
|
|
* Handle updating the profile post-pscav raid
|
|
|
|
* @param sessionID session id
|
|
|
|
* @param offraidData post-raid data of raid
|
|
|
|
*/
|
|
|
|
protected savePlayerScavProgress(sessionID: string, offraidData: ISaveProgressRequestData): void;
|
|
|
|
/**
|
|
|
|
* Is the player dead after a raid - dead is anything other than "survived" / "runner"
|
|
|
|
* @param statusOnExit exit value from offraidData object
|
|
|
|
* @returns true if dead
|
|
|
|
*/
|
|
|
|
protected isPlayerDead(statusOnExit: string): boolean;
|
2022-08-17 02:29:54 -04:00
|
|
|
/**
|
|
|
|
* Mark inventory items as FiR if player survived raid, otherwise remove FiR from them
|
|
|
|
* @param offraidData Save Progress Request
|
|
|
|
* @param pmcData player profile
|
|
|
|
* @param isPlayerScav Was the player a pScav
|
|
|
|
*/
|
|
|
|
protected markOrRemoveFoundInRaidItems(offraidData: ISaveProgressRequestData, pmcData: IPmcData, isPlayerScav: boolean): void;
|
2022-12-25 18:45:30 -05:00
|
|
|
/**
|
|
|
|
* Update profile after player completes scav raid
|
|
|
|
* @param scavData Scav profile
|
|
|
|
* @param sessionID Session id
|
|
|
|
* @param offraidData Post-raid save request
|
|
|
|
* @param pmcData Pmc profile
|
|
|
|
* @param isDead Is player dead
|
|
|
|
*/
|
2022-08-17 02:29:54 -04:00
|
|
|
protected handlePostRaidPlayerScavProcess(scavData: IPmcData, sessionID: string, offraidData: ISaveProgressRequestData, pmcData: IPmcData, isDead: boolean): void;
|
2022-12-25 18:45:30 -05:00
|
|
|
/**
|
|
|
|
* Update profile with scav karma values based on in-raid actions
|
|
|
|
* @param pmcData Pmc profile
|
|
|
|
* @param offraidData Post-raid save request
|
|
|
|
* @param scavData Scav profile
|
|
|
|
* @param sessionID Session id
|
|
|
|
*/
|
2022-08-17 02:29:54 -04:00
|
|
|
protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData, scavData: IPmcData, sessionID: string): void;
|
2022-12-25 18:45:30 -05:00
|
|
|
/**
|
|
|
|
* Get the inraid config from configs/inraid.json
|
|
|
|
* @returns InRaid Config
|
|
|
|
*/
|
|
|
|
getInraidConfig(): IInRaidConfig;
|
|
|
|
/**
|
|
|
|
* Get airdrop config from configs/airdrop.json
|
|
|
|
* @returns Airdrop config
|
|
|
|
*/
|
|
|
|
getAirdropConfig(): IAirdropConfig;
|
2022-08-17 02:29:54 -04:00
|
|
|
}
|