Update types

This commit is contained in:
Chomp 2022-12-19 14:01:18 +00:00
parent d33a9055ed
commit 784613eb48
6 changed files with 22 additions and 4 deletions

View File

@ -3,6 +3,15 @@ import { ContextVariableType } from "./ContextVariableType";
export declare class ApplicationContext { export declare class ApplicationContext {
private variables; private variables;
private static holderMaxSize; private static holderMaxSize;
/**
* Called like:
*
* const registerPlayerInfo = this.applicationContext.getLatestValue(ContextVariableType.REGISTER_PLAYER_REQUEST).getValue<IRegisterPlayerRequestData>();
*
* const matchInfo = this.applicationContext.getLatestValue(ContextVariableType.MATCH_INFO).getValue<IStartOfflineRaidRequestData>();
* @param type
* @returns
*/
getLatestValue(type: ContextVariableType): ContextVariable; getLatestValue(type: ContextVariableType): ContextVariable;
getValues(type: ContextVariableType): ContextVariable[]; getValues(type: ContextVariableType): ContextVariable[];
addValue(type: ContextVariableType, value: any): void; addValue(type: ContextVariableType, value: any): void;

View File

@ -4,5 +4,7 @@ export declare enum ContextVariableType {
/** Currently acive raid information */ /** Currently acive raid information */
MATCH_INFO = 1, MATCH_INFO = 1,
/** Timestamp when client first connected */ /** Timestamp when client first connected */
CLIENT_START_TIMESTAMP = 2 CLIENT_START_TIMESTAMP = 2,
/** When player is loading into map and loot is requested */
REGISTER_PLAYER_REQUEST = 3
} }

View File

@ -1,3 +1,4 @@
import { ApplicationContext } from "../context/ApplicationContext";
import { PlayerScavGenerator } from "../generators/PlayerScavGenerator"; import { PlayerScavGenerator } from "../generators/PlayerScavGenerator";
import { HealthHelper } from "../helpers/HealthHelper"; import { HealthHelper } from "../helpers/HealthHelper";
import { InRaidHelper } from "../helpers/InRaidHelper"; import { InRaidHelper } from "../helpers/InRaidHelper";
@ -35,12 +36,13 @@ export declare class InraidController {
protected traderHelper: TraderHelper; protected traderHelper: TraderHelper;
protected insuranceService: InsuranceService; protected insuranceService: InsuranceService;
protected inRaidHelper: InRaidHelper; protected inRaidHelper: InRaidHelper;
protected applicationContext: ApplicationContext;
protected configServer: ConfigServer; protected configServer: ConfigServer;
protected airdropConfig: IAirdropConfig; protected airdropConfig: IAirdropConfig;
protected inraidConfig: IInRaidConfig; protected inraidConfig: IInRaidConfig;
constructor(logger: ILogger, saveServer: SaveServer, jsonUtil: JsonUtil, timeUtil: TimeUtil, databaseServer: DatabaseServer, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, configServer: ConfigServer); 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 * Save locationId to active profiles inraid object AND app context
* @param sessionID Session id * @param sessionID Session id
* @param info Register player request * @param info Register player request
*/ */

View File

@ -5,8 +5,10 @@ export declare class PresetHelper {
protected jsonUtil: JsonUtil; protected jsonUtil: JsonUtil;
protected databaseServer: DatabaseServer; protected databaseServer: DatabaseServer;
protected lookup: Record<string, string[]>; protected lookup: Record<string, string[]>;
protected defaultPresets: Record<string, Preset>;
constructor(jsonUtil: JsonUtil, databaseServer: DatabaseServer); constructor(jsonUtil: JsonUtil, databaseServer: DatabaseServer);
hydratePresetStore(input: Record<string, string[]>): void; hydratePresetStore(input: Record<string, string[]>): void;
getDefaultPresets(): Record<string, Preset>;
isPreset(id: string): boolean; isPreset(id: string): boolean;
hasPreset(templateId: string): boolean; hasPreset(templateId: string): boolean;
getPreset(id: string): Preset; getPreset(id: string): Preset;

View File

@ -37,7 +37,7 @@ export declare class TradeHelper {
buyItem(pmcData: IPmcData, buyRequestData: IProcessBuyTradeRequestData, sessionID: string, foundInRaid: boolean, upd: Upd): IItemEventRouterResponse; buyItem(pmcData: IPmcData, buyRequestData: IProcessBuyTradeRequestData, sessionID: string, foundInRaid: boolean, upd: Upd): IItemEventRouterResponse;
/** /**
* Sell item to trader * Sell item to trader
* @param pmcData * @param pmcData Profile to update
* @param body * @param body
* @param sessionID * @param sessionID
* @returns * @returns

View File

@ -1,3 +1,4 @@
import { MinMax } from "../../../models/common/MinMax";
import { IBaseConfig } from "./IBaseConfig"; import { IBaseConfig } from "./IBaseConfig";
export interface ITraderConfig extends IBaseConfig { export interface ITraderConfig extends IBaseConfig {
kind: "aki-trader"; kind: "aki-trader";
@ -19,6 +20,8 @@ export interface FenceConfig {
assortSize: number; assortSize: number;
maxPresetsPercent: number; maxPresetsPercent: number;
presetPriceMult: number; presetPriceMult: number;
armorMaxDurabilityPercentMinMax: MinMax;
presetMaxDurabilityPercentMinMax: MinMax;
itemPriceMult: number; itemPriceMult: number;
regenerateAssortsOnRefresh: boolean; regenerateAssortsOnRefresh: boolean;
itemTypeLimits: Record<string, number>; itemTypeLimits: Record<string, number>;