diff --git a/TypeScript/10ScopesAndTypes/types/controllers/GameController.d.ts b/TypeScript/10ScopesAndTypes/types/controllers/GameController.d.ts index 7f632d6..5f516de 100644 --- a/TypeScript/10ScopesAndTypes/types/controllers/GameController.d.ts +++ b/TypeScript/10ScopesAndTypes/types/controllers/GameController.d.ts @@ -6,19 +6,23 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { IPmcDataRepeatableQuest, IRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; import { IGameConfigResponse } from "../models/eft/game/IGameConfigResponse"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; +import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { LocaleService } from "../services/LocaleService"; import { Watermark } from "../utils/Watermark"; export declare class GameController { protected logger: ILogger; protected watermark: Watermark; protected httpServerHelper: HttpServerHelper; + protected localeService: LocaleService; protected profileHelper: ProfileHelper; protected gameHelper: GameHelper; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; - constructor(logger: ILogger, watermark: Watermark, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper, gameHelper: GameHelper, configServer: ConfigServer); + protected coreConfig: ICoreConfig; + constructor(logger: ILogger, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, gameHelper: GameHelper, configServer: ConfigServer); gameStart(_url: string, _info: IEmptyRequestData, sessionID: string): void; protected addMissingBonusesProperty(pmcProfile: IPmcData): void; protected addMissingRepeatableQuestsProperty(pmcProfile: IPmcData): void; diff --git a/TypeScript/10ScopesAndTypes/types/controllers/QuestController.d.ts b/TypeScript/10ScopesAndTypes/types/controllers/QuestController.d.ts index c00cd6d..2cbccfb 100644 --- a/TypeScript/10ScopesAndTypes/types/controllers/QuestController.d.ts +++ b/TypeScript/10ScopesAndTypes/types/controllers/QuestController.d.ts @@ -14,6 +14,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ItemEventRouter } from "../routers/ItemEventRouter"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocaleService } from "../services/LocaleService"; import { PlayerService } from "../services/PlayerService"; import { TimeUtil } from "../utils/TimeUtil"; export declare class QuestController { @@ -27,9 +28,10 @@ export declare class QuestController { protected questHelper: QuestHelper; protected questConditionHelper: QuestConditionHelper; protected playerService: PlayerService; + protected localeService: LocaleService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, itemHelper: ItemHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, questConditionHelper: QuestConditionHelper, playerService: PlayerService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, itemHelper: ItemHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, questConditionHelper: QuestConditionHelper, playerService: PlayerService, localeService: LocaleService, configServer: ConfigServer); /** * Get all quests visible to player * Exclude quests with incomplete preconditions (level/loyalty) diff --git a/TypeScript/10ScopesAndTypes/types/helpers/ItemHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/ItemHelper.d.ts index 70c88d6..4fff11e 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/ItemHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/ItemHelper.d.ts @@ -84,6 +84,11 @@ declare class ItemHelper { */ generateItemsFromStackSlot(item: ITemplateItem, parentId: string): Item[]; getItem(tpl: string): [boolean, ITemplateItem]; + /** + * get normalized value (0-1) based on item condition + * @param item + * @returns number between 0 and 1 + */ getItemQualityModifier(item: Item): number; findAndReturnChildrenByItems(items: Item[], itemID: string): string[]; /** diff --git a/TypeScript/10ScopesAndTypes/types/helpers/QuestHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/QuestHelper.d.ts index 04ede16..d6e382b 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/QuestHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/QuestHelper.d.ts @@ -8,6 +8,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ItemEventRouter } from "../routers/ItemEventRouter"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocaleService } from "../services/LocaleService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -25,6 +26,7 @@ export declare class QuestHelper { protected itemHelper: ItemHelper; protected itemEventRouter: ItemEventRouter; protected databaseServer: DatabaseServer; + protected localeService: LocaleService; protected ragfairServerHelper: RagfairServerHelper; protected dialogueHelper: DialogueHelper; protected profileHelper: ProfileHelper; @@ -32,7 +34,7 @@ export declare class QuestHelper { protected traderHelper: TraderHelper; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, traderHelper: TraderHelper, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, traderHelper: TraderHelper, configServer: ConfigServer); static get STATUS(): Record; questStatus(pmcData: IPmcData, questID: string): string; /** @@ -74,7 +76,7 @@ export declare class QuestHelper { cleanQuestConditions(quest: IQuest): IQuest; failQuest(pmcData: IPmcData, body: any, sessionID: string): any; getQuestFromDb(questId: string, pmcData: IPmcData): IQuest; - getQuestLocaleIdFromDb(messageId: string, localisation?: string): string; + getQuestLocaleIdFromDb(messageId: string): string; applyQuestReward(pmcData: IPmcData, body: ICompleteQuestRequestData, state: string, sessionID: string): Reward[]; /** * Get the intel center bonus a player has diff --git a/TypeScript/10ScopesAndTypes/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/RagfairOfferHelper.d.ts index 129bc1c..5a77e13 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/RagfairOfferHelper.d.ts @@ -10,6 +10,7 @@ import { ItemEventRouter } from "../routers/ItemEventRouter"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocaleService } from "../services/LocaleService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { HashUtil } from "../utils/HashUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -37,11 +38,12 @@ export declare class RagfairOfferHelper { protected ragfairSortHelper: RagfairSortHelper; protected ragfairHelper: RagfairHelper; protected ragfairOfferService: RagfairOfferService; + protected localeService: LocaleService; protected configServer: ConfigServer; protected static TPL_GOODS_SOLD: string; protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, saveServer: SaveServer, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, saveServer: SaveServer, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, configServer: ConfigServer); getValidOffers(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; getOffersForBuild(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; processOffers(sessionID: string): boolean; diff --git a/TypeScript/10ScopesAndTypes/types/helpers/RagfairServerHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/RagfairServerHelper.d.ts index 2cb3ea5..a52306b 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/RagfairServerHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/RagfairServerHelper.d.ts @@ -1,11 +1,12 @@ -import { MemberCategory } from "../models/enums/MemberCategory"; import { Item } from "../models/eft/common/tables/IItem"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { MemberCategory } from "../models/enums/MemberCategory"; import { IQuestConfig } from "../models/spt/config/IQuestConfig"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocaleService } from "../services/LocaleService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; @@ -19,13 +20,14 @@ export declare class RagfairServerHelper { protected databaseServer: DatabaseServer; protected profileHelper: ProfileHelper; protected itemHelper: ItemHelper; + protected localeService: LocaleService; protected dialogueHelper: DialogueHelper; protected jsonUtil: JsonUtil; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; protected static TPL_GOODS_RETURNED: string; - constructor(randomUtil: RandomUtil, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, profileHelper: ProfileHelper, itemHelper: ItemHelper, dialogueHelper: DialogueHelper, jsonUtil: JsonUtil, configServer: ConfigServer); + constructor(randomUtil: RandomUtil, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, profileHelper: ProfileHelper, itemHelper: ItemHelper, localeService: LocaleService, dialogueHelper: DialogueHelper, jsonUtil: JsonUtil, configServer: ConfigServer); /** * Is item valid / on blacklist / quest item * @param itemDetails diff --git a/TypeScript/10ScopesAndTypes/types/helpers/RagfairSortHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/RagfairSortHelper.d.ts index e983569..d20e10c 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/RagfairSortHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/RagfairSortHelper.d.ts @@ -1,8 +1,10 @@ import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocaleService } from "../services/LocaleService"; export declare class RagfairSortHelper { protected databaseServer: DatabaseServer; - constructor(databaseServer: DatabaseServer); + protected localeService: LocaleService; + constructor(databaseServer: DatabaseServer, localeService: LocaleService); sortOffers(offers: IRagfairOffer[], type: number, direction?: number): IRagfairOffer[]; protected sortOffersByID(a: IRagfairOffer, b: IRagfairOffer): number; protected sortOffersByRating(a: IRagfairOffer, b: IRagfairOffer): number; diff --git a/TypeScript/10ScopesAndTypes/types/helpers/TraderHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/TraderHelper.d.ts index ab4a371..717351f 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/TraderHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/TraderHelper.d.ts @@ -1,4 +1,6 @@ +import { FenceLevel } from "../models/eft/common/IGlobals"; import { IPmcData } from "../models/eft/common/IPmcData"; +import { Item } from "../models/eft/common/tables/IItem"; import { IBarterScheme, ITraderAssort, ITraderBase, LoyaltyLevel } from "../models/eft/common/tables/ITrader"; import { ITraderConfig } from "../models/spt/config/ITraderConfig"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -34,7 +36,48 @@ export declare class TraderHelper { */ resetTrader(sessionID: string, traderID: string): void; changeTraderDisplay(traderID: string, status: boolean, sessionID: string): void; + /** + * Get a list of items and their prices from player inventory that can be sold to a trader + * @param traderID trader id being traded with + * @param sessionID session id + * @returns IBarterScheme[][] + */ getPurchasesData(traderID: string, sessionID: string): Record; + /** + * Should item be skipped when selling to trader according to its sell categories and other checks + * @param pmcData + * @param item + * @param sellCategory + * @returns true if should NOT be sold to trader + */ + protected isItemUnSellableToTrader(pmcData: IPmcData, item: Item, sellCategory: string[]): boolean; + /** + * Can this weapon be sold to a trader with its current durabiltiy level + * @param traderID + * @param item + * @returns boolean + */ + protected isWeaponAndBelowTraderBuyDurability(traderID: string, item: Item): boolean; + /** + * Get the price of an item and all of its attached children + * Take into account bonuses/adjsutments e.g. discounts + * @param pmcData profile data + * @param item item to calculate price of + * @param buyPriceCoefficient + * @param fenceInfo fence data + * @param traderBase trader details + * @param currencyTpl Currency to get price as + * @returns price of item + children + */ + protected getAdjustedItemPrice(pmcData: IPmcData, item: Item, buyPriceCoefficient: number, fenceInfo: FenceLevel, traderBase: ITraderBase, currencyTpl: string): number; + /** + * Get the raw price of item+child items from handbook without any modification + * @param pmcData profile data + * @param item item to calculate price of + * @returns price as number + */ + protected getRawItemPrice(pmcData: IPmcData, item: Item): number; + protected getTraderDiscount(trader: ITraderBase, buyPriceCoefficient: number, fenceInfo: FenceLevel, traderID: string): number; /** * Calculate traders level based on exp amount and increment level if over threshold * @param traderID trader to process diff --git a/TypeScript/10ScopesAndTypes/types/loaders/AfterDbModLoader.d.ts b/TypeScript/10ScopesAndTypes/types/loaders/AfterDbModLoader.d.ts new file mode 100644 index 0000000..a9fc286 --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/loaders/AfterDbModLoader.d.ts @@ -0,0 +1,11 @@ +import { DependencyContainer } from "tsyringe"; +import { OnLoad } from "../di/OnLoad"; +import { InitialModLoader } from "./InitialModLoader"; +export declare class AfterDbModLoader implements OnLoad { + protected initialModLoader: InitialModLoader; + constructor(initialModLoader: InitialModLoader); + onLoad(): void; + getRoute(): string; + getModPath(mod: string): string; + protected executeMods(container: DependencyContainer): void; +} diff --git a/TypeScript/10ScopesAndTypes/types/models/enums/ConfigTypes.d.ts b/TypeScript/10ScopesAndTypes/types/models/enums/ConfigTypes.d.ts index 6bd31e8..1c49e62 100644 --- a/TypeScript/10ScopesAndTypes/types/models/enums/ConfigTypes.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/enums/ConfigTypes.d.ts @@ -8,6 +8,7 @@ export declare enum ConfigTypes { IN_RAID = "aki-inraid", INSURANCE = "aki-insurance", INVENTORY = "aki-inventory", + LOCALE = "aki-locale", LOCATION = "aki-location", MATCH = "aki-match", QUEST = "aki-quest", diff --git a/TypeScript/10ScopesAndTypes/types/models/external/IAfterDBLoadMod.d.ts b/TypeScript/10ScopesAndTypes/types/models/external/IAfterDBLoadMod.d.ts new file mode 100644 index 0000000..7f08b9e --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/models/external/IAfterDBLoadMod.d.ts @@ -0,0 +1,4 @@ +import { DependencyContainer } from "./tsyringe"; +export interface IAfterDBLoadMod { + loadAfterDbInit(container: DependencyContainer): void; +} diff --git a/TypeScript/10ScopesAndTypes/types/models/external/mod.d.ts b/TypeScript/10ScopesAndTypes/types/models/external/mod.d.ts index ecef460..47939e9 100644 --- a/TypeScript/10ScopesAndTypes/types/models/external/mod.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/external/mod.d.ts @@ -1,5 +1,5 @@ import { DependencyContainer } from "./tsyringe"; export interface IMod { - load: (container: DependencyContainer) => void; - delayedLoad: (container: DependencyContainer) => void; + load(container: DependencyContainer): void; + delayedLoad(container: DependencyContainer): void; } diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/config/ILocaleConfig.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/config/ILocaleConfig.d.ts new file mode 100644 index 0000000..fe9abf7 --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/models/spt/config/ILocaleConfig.d.ts @@ -0,0 +1,5 @@ +import { IBaseConfig } from "./IBaseConfig"; +export interface ILocaleConfig extends IBaseConfig { + kind: "aki-locale"; + desiredLocale: string; +} diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/logging/LogBackgroundColor.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/logging/LogBackgroundColor.d.ts new file mode 100644 index 0000000..87e08a9 --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/models/spt/logging/LogBackgroundColor.d.ts @@ -0,0 +1,11 @@ +export declare enum LogBackgroundColor { + default = "", + black = "blackBG", + red = "redBG", + green = "greenBG", + yellow = "yellowBG", + blue = "blueBG", + magenta = "magentaBG", + cyan = "cyanBG", + white = "whiteBG" +} diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/logging/LogTextColor.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/logging/LogTextColor.d.ts new file mode 100644 index 0000000..7147ae3 --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/models/spt/logging/LogTextColor.d.ts @@ -0,0 +1,11 @@ +export declare enum LogTextColor { + black = "black", + red = "red", + green = "green", + yellow = "yellow", + blue = "blue", + magenta = "magenta", + cyan = "cyan", + white = "white", + gray = "" +} diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/logging/SptLogger.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/logging/SptLogger.d.ts new file mode 100644 index 0000000..ea1b3d8 --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/models/spt/logging/SptLogger.d.ts @@ -0,0 +1,7 @@ +export interface SptLogger { + error: (msg: string | Record) => void; + warn: (msg: string | Record) => void; + succ?: (msg: string | Record) => void; + info: (msg: string | Record) => void; + debug: (msg: string | Record) => void; +} diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/utils/ILogger.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/utils/ILogger.d.ts index c983701..2af3fac 100644 --- a/TypeScript/10ScopesAndTypes/types/models/spt/utils/ILogger.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/spt/utils/ILogger.d.ts @@ -1,7 +1,10 @@ import { Daum } from "../../eft/itemEvent/IItemEventRouterRequest"; +import { LogBackgroundColor } from "../logging/LogBackgroundColor"; +import { LogTextColor } from "../logging/LogTextColor"; export interface ILogger { writeToLogFile(data: string | Daum): void; - log(data: string | Record | Error, color: string): void; + log(data: string | Record | Error, color: string, backgroundColor?: string): void; + logWithColor(data: string | Record, textColor: LogTextColor, backgroundColor?: LogBackgroundColor): void; error(data: string): void; warning(data: string): void; success(data: string): void; diff --git a/TypeScript/10ScopesAndTypes/types/services/FenceService.d.ts b/TypeScript/10ScopesAndTypes/types/services/FenceService.d.ts index 12723fb..79058c6 100644 --- a/TypeScript/10ScopesAndTypes/types/services/FenceService.d.ts +++ b/TypeScript/10ScopesAndTypes/types/services/FenceService.d.ts @@ -29,8 +29,8 @@ export declare class FenceService { hasExpiredCache(refreshAssort: boolean): boolean; generateFenceAssortCache(pmcData: IPmcData): void; /** - * - * @param pmcData Get the fence level the passed in profile has + * Get the fence level the passed in profile has + * @param pmcData Player profile * @returns FenceLevel */ getFenceInfo(pmcData: IPmcData): FenceLevel; diff --git a/TypeScript/10ScopesAndTypes/types/services/LocaleService.d.ts b/TypeScript/10ScopesAndTypes/types/services/LocaleService.d.ts new file mode 100644 index 0000000..33bea7b --- /dev/null +++ b/TypeScript/10ScopesAndTypes/types/services/LocaleService.d.ts @@ -0,0 +1,14 @@ +import { ILocaleConfig } from "../models/spt/config/ILocaleConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +export declare class LocaleService { + protected logger: ILogger; + protected configServer: ConfigServer; + protected localeConfig: ILocaleConfig; + constructor(logger: ILogger, configServer: ConfigServer); + /** + * Gets the locale key from the locale.json file + * @returns locale e.g en/ge/cz/cn + */ + getDesiredLocale(): string; +} diff --git a/TypeScript/10ScopesAndTypes/types/utils/DatabaseImporter.d.ts b/TypeScript/10ScopesAndTypes/types/utils/DatabaseImporter.d.ts index 24c1cd6..b3156ea 100644 --- a/TypeScript/10ScopesAndTypes/types/utils/DatabaseImporter.d.ts +++ b/TypeScript/10ScopesAndTypes/types/utils/DatabaseImporter.d.ts @@ -5,7 +5,7 @@ import { ImageRouter } from "../routers/ImageRouter"; import { DatabaseServer } from "../servers/DatabaseServer"; import { CustomHandbookItemService } from "../services/CustomHandbookItemService"; import { CustomItemService } from "../services/CustomItemService"; -import { CustomPresetService } from "../services/customPresetService"; +import { CustomPresetService } from "../services/CustomPresetService"; import { CustomTraderAssortService } from "../services/CustomTraderAssortService"; import { JsonUtil } from "./JsonUtil"; import { VFS } from "./VFS"; diff --git a/TypeScript/10ScopesAndTypes/types/utils/Logger.d.ts b/TypeScript/10ScopesAndTypes/types/utils/Logger.d.ts index f5b774b..3d9013f 100644 --- a/TypeScript/10ScopesAndTypes/types/utils/Logger.d.ts +++ b/TypeScript/10ScopesAndTypes/types/utils/Logger.d.ts @@ -1,17 +1,13 @@ /// -import { Daum } from "../models/eft/itemEvent/IItemEventRouterRequest"; -import { ILogger } from "../models/spt/utils/ILogger"; -import winston from "winston"; -import { IAsyncQueue } from "../models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "../models/spt/utils/IUuidGenerator"; import fs from "fs"; -interface SptLogger { - error: (msg: string | Record) => void; - warn: (msg: string | Record) => void; - succ?: (msg: string | Record) => void; - info: (msg: string | Record) => void; - debug: (msg: string | Record) => void; -} +import winston from "winston"; +import { Daum } from "../models/eft/itemEvent/IItemEventRouterRequest"; +import { LogBackgroundColor } from "../models/spt/logging/LogBackgroundColor"; +import { LogTextColor } from "../models/spt/logging/LogTextColor"; +import { SptLogger } from "../models/spt/logging/SptLogger"; +import { IAsyncQueue } from "../models/spt/utils/IAsyncQueue"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { IUUidGenerator } from "../models/spt/utils/IUuidGenerator"; export declare class WinstonLogger implements ILogger { protected asyncQueue: IAsyncQueue; protected uuidGenerator: IUUidGenerator; @@ -36,16 +32,27 @@ export declare class WinstonLogger implements ILogger { custom: string; debug: string; }; + bgColors: { + default: string; + blackBG: string; + redBG: string; + greenBG: string; + yellowBG: string; + blueBG: string; + magentaBG: string; + cyanBG: string; + whiteBG: string; + }; }; protected logger: winston.Logger & SptLogger; - writeFilePromisify: (path: fs.PathLike, data: string, options?: any) => Promise; + protected writeFilePromisify: (path: fs.PathLike, data: string, options?: any) => Promise; constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); writeToLogFile(data: string | Daum): Promise; - log(data: string | Error | Record, color: string): Promise; + log(data: string | Error | Record, color: string, backgroundColor?: string): Promise; error(data: string | Record): Promise; warning(data: string | Record): Promise; success(data: string | Record): Promise; info(data: string | Record): Promise; + logWithColor(data: string | Record, textColor: LogTextColor, backgroundColor?: LogBackgroundColor): Promise; debug(data: string | Record, onlyShowInConsole?: boolean): Promise; } -export {}; diff --git a/TypeScript/11BundleLoadingSample/types/controllers/GameController.d.ts b/TypeScript/11BundleLoadingSample/types/controllers/GameController.d.ts index 7f632d6..5f516de 100644 --- a/TypeScript/11BundleLoadingSample/types/controllers/GameController.d.ts +++ b/TypeScript/11BundleLoadingSample/types/controllers/GameController.d.ts @@ -6,19 +6,23 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { IPmcDataRepeatableQuest, IRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; import { IGameConfigResponse } from "../models/eft/game/IGameConfigResponse"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; +import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { LocaleService } from "../services/LocaleService"; import { Watermark } from "../utils/Watermark"; export declare class GameController { protected logger: ILogger; protected watermark: Watermark; protected httpServerHelper: HttpServerHelper; + protected localeService: LocaleService; protected profileHelper: ProfileHelper; protected gameHelper: GameHelper; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; - constructor(logger: ILogger, watermark: Watermark, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper, gameHelper: GameHelper, configServer: ConfigServer); + protected coreConfig: ICoreConfig; + constructor(logger: ILogger, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, gameHelper: GameHelper, configServer: ConfigServer); gameStart(_url: string, _info: IEmptyRequestData, sessionID: string): void; protected addMissingBonusesProperty(pmcProfile: IPmcData): void; protected addMissingRepeatableQuestsProperty(pmcProfile: IPmcData): void; diff --git a/TypeScript/11BundleLoadingSample/types/controllers/QuestController.d.ts b/TypeScript/11BundleLoadingSample/types/controllers/QuestController.d.ts index c00cd6d..2cbccfb 100644 --- a/TypeScript/11BundleLoadingSample/types/controllers/QuestController.d.ts +++ b/TypeScript/11BundleLoadingSample/types/controllers/QuestController.d.ts @@ -14,6 +14,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ItemEventRouter } from "../routers/ItemEventRouter"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocaleService } from "../services/LocaleService"; import { PlayerService } from "../services/PlayerService"; import { TimeUtil } from "../utils/TimeUtil"; export declare class QuestController { @@ -27,9 +28,10 @@ export declare class QuestController { protected questHelper: QuestHelper; protected questConditionHelper: QuestConditionHelper; protected playerService: PlayerService; + protected localeService: LocaleService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, itemHelper: ItemHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, questConditionHelper: QuestConditionHelper, playerService: PlayerService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, itemHelper: ItemHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, questConditionHelper: QuestConditionHelper, playerService: PlayerService, localeService: LocaleService, configServer: ConfigServer); /** * Get all quests visible to player * Exclude quests with incomplete preconditions (level/loyalty) diff --git a/TypeScript/11BundleLoadingSample/types/helpers/ItemHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/ItemHelper.d.ts index 70c88d6..4fff11e 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/ItemHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/ItemHelper.d.ts @@ -84,6 +84,11 @@ declare class ItemHelper { */ generateItemsFromStackSlot(item: ITemplateItem, parentId: string): Item[]; getItem(tpl: string): [boolean, ITemplateItem]; + /** + * get normalized value (0-1) based on item condition + * @param item + * @returns number between 0 and 1 + */ getItemQualityModifier(item: Item): number; findAndReturnChildrenByItems(items: Item[], itemID: string): string[]; /** diff --git a/TypeScript/11BundleLoadingSample/types/helpers/QuestHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/QuestHelper.d.ts index 04ede16..d6e382b 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/QuestHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/QuestHelper.d.ts @@ -8,6 +8,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ItemEventRouter } from "../routers/ItemEventRouter"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocaleService } from "../services/LocaleService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -25,6 +26,7 @@ export declare class QuestHelper { protected itemHelper: ItemHelper; protected itemEventRouter: ItemEventRouter; protected databaseServer: DatabaseServer; + protected localeService: LocaleService; protected ragfairServerHelper: RagfairServerHelper; protected dialogueHelper: DialogueHelper; protected profileHelper: ProfileHelper; @@ -32,7 +34,7 @@ export declare class QuestHelper { protected traderHelper: TraderHelper; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, traderHelper: TraderHelper, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, traderHelper: TraderHelper, configServer: ConfigServer); static get STATUS(): Record; questStatus(pmcData: IPmcData, questID: string): string; /** @@ -74,7 +76,7 @@ export declare class QuestHelper { cleanQuestConditions(quest: IQuest): IQuest; failQuest(pmcData: IPmcData, body: any, sessionID: string): any; getQuestFromDb(questId: string, pmcData: IPmcData): IQuest; - getQuestLocaleIdFromDb(messageId: string, localisation?: string): string; + getQuestLocaleIdFromDb(messageId: string): string; applyQuestReward(pmcData: IPmcData, body: ICompleteQuestRequestData, state: string, sessionID: string): Reward[]; /** * Get the intel center bonus a player has diff --git a/TypeScript/11BundleLoadingSample/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/RagfairOfferHelper.d.ts index 129bc1c..5a77e13 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/RagfairOfferHelper.d.ts @@ -10,6 +10,7 @@ import { ItemEventRouter } from "../routers/ItemEventRouter"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocaleService } from "../services/LocaleService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { HashUtil } from "../utils/HashUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -37,11 +38,12 @@ export declare class RagfairOfferHelper { protected ragfairSortHelper: RagfairSortHelper; protected ragfairHelper: RagfairHelper; protected ragfairOfferService: RagfairOfferService; + protected localeService: LocaleService; protected configServer: ConfigServer; protected static TPL_GOODS_SOLD: string; protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, saveServer: SaveServer, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, saveServer: SaveServer, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, configServer: ConfigServer); getValidOffers(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; getOffersForBuild(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; processOffers(sessionID: string): boolean; diff --git a/TypeScript/11BundleLoadingSample/types/helpers/RagfairServerHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/RagfairServerHelper.d.ts index 2cb3ea5..a52306b 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/RagfairServerHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/RagfairServerHelper.d.ts @@ -1,11 +1,12 @@ -import { MemberCategory } from "../models/enums/MemberCategory"; import { Item } from "../models/eft/common/tables/IItem"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { MemberCategory } from "../models/enums/MemberCategory"; import { IQuestConfig } from "../models/spt/config/IQuestConfig"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocaleService } from "../services/LocaleService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; @@ -19,13 +20,14 @@ export declare class RagfairServerHelper { protected databaseServer: DatabaseServer; protected profileHelper: ProfileHelper; protected itemHelper: ItemHelper; + protected localeService: LocaleService; protected dialogueHelper: DialogueHelper; protected jsonUtil: JsonUtil; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; protected static TPL_GOODS_RETURNED: string; - constructor(randomUtil: RandomUtil, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, profileHelper: ProfileHelper, itemHelper: ItemHelper, dialogueHelper: DialogueHelper, jsonUtil: JsonUtil, configServer: ConfigServer); + constructor(randomUtil: RandomUtil, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, profileHelper: ProfileHelper, itemHelper: ItemHelper, localeService: LocaleService, dialogueHelper: DialogueHelper, jsonUtil: JsonUtil, configServer: ConfigServer); /** * Is item valid / on blacklist / quest item * @param itemDetails diff --git a/TypeScript/11BundleLoadingSample/types/helpers/RagfairSortHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/RagfairSortHelper.d.ts index e983569..d20e10c 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/RagfairSortHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/RagfairSortHelper.d.ts @@ -1,8 +1,10 @@ import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocaleService } from "../services/LocaleService"; export declare class RagfairSortHelper { protected databaseServer: DatabaseServer; - constructor(databaseServer: DatabaseServer); + protected localeService: LocaleService; + constructor(databaseServer: DatabaseServer, localeService: LocaleService); sortOffers(offers: IRagfairOffer[], type: number, direction?: number): IRagfairOffer[]; protected sortOffersByID(a: IRagfairOffer, b: IRagfairOffer): number; protected sortOffersByRating(a: IRagfairOffer, b: IRagfairOffer): number; diff --git a/TypeScript/11BundleLoadingSample/types/helpers/TraderHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/TraderHelper.d.ts index ab4a371..717351f 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/TraderHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/TraderHelper.d.ts @@ -1,4 +1,6 @@ +import { FenceLevel } from "../models/eft/common/IGlobals"; import { IPmcData } from "../models/eft/common/IPmcData"; +import { Item } from "../models/eft/common/tables/IItem"; import { IBarterScheme, ITraderAssort, ITraderBase, LoyaltyLevel } from "../models/eft/common/tables/ITrader"; import { ITraderConfig } from "../models/spt/config/ITraderConfig"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -34,7 +36,48 @@ export declare class TraderHelper { */ resetTrader(sessionID: string, traderID: string): void; changeTraderDisplay(traderID: string, status: boolean, sessionID: string): void; + /** + * Get a list of items and their prices from player inventory that can be sold to a trader + * @param traderID trader id being traded with + * @param sessionID session id + * @returns IBarterScheme[][] + */ getPurchasesData(traderID: string, sessionID: string): Record; + /** + * Should item be skipped when selling to trader according to its sell categories and other checks + * @param pmcData + * @param item + * @param sellCategory + * @returns true if should NOT be sold to trader + */ + protected isItemUnSellableToTrader(pmcData: IPmcData, item: Item, sellCategory: string[]): boolean; + /** + * Can this weapon be sold to a trader with its current durabiltiy level + * @param traderID + * @param item + * @returns boolean + */ + protected isWeaponAndBelowTraderBuyDurability(traderID: string, item: Item): boolean; + /** + * Get the price of an item and all of its attached children + * Take into account bonuses/adjsutments e.g. discounts + * @param pmcData profile data + * @param item item to calculate price of + * @param buyPriceCoefficient + * @param fenceInfo fence data + * @param traderBase trader details + * @param currencyTpl Currency to get price as + * @returns price of item + children + */ + protected getAdjustedItemPrice(pmcData: IPmcData, item: Item, buyPriceCoefficient: number, fenceInfo: FenceLevel, traderBase: ITraderBase, currencyTpl: string): number; + /** + * Get the raw price of item+child items from handbook without any modification + * @param pmcData profile data + * @param item item to calculate price of + * @returns price as number + */ + protected getRawItemPrice(pmcData: IPmcData, item: Item): number; + protected getTraderDiscount(trader: ITraderBase, buyPriceCoefficient: number, fenceInfo: FenceLevel, traderID: string): number; /** * Calculate traders level based on exp amount and increment level if over threshold * @param traderID trader to process diff --git a/TypeScript/11BundleLoadingSample/types/loaders/AfterDbModLoader.d.ts b/TypeScript/11BundleLoadingSample/types/loaders/AfterDbModLoader.d.ts new file mode 100644 index 0000000..a9fc286 --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/loaders/AfterDbModLoader.d.ts @@ -0,0 +1,11 @@ +import { DependencyContainer } from "tsyringe"; +import { OnLoad } from "../di/OnLoad"; +import { InitialModLoader } from "./InitialModLoader"; +export declare class AfterDbModLoader implements OnLoad { + protected initialModLoader: InitialModLoader; + constructor(initialModLoader: InitialModLoader); + onLoad(): void; + getRoute(): string; + getModPath(mod: string): string; + protected executeMods(container: DependencyContainer): void; +} diff --git a/TypeScript/11BundleLoadingSample/types/models/enums/ConfigTypes.d.ts b/TypeScript/11BundleLoadingSample/types/models/enums/ConfigTypes.d.ts index 6bd31e8..1c49e62 100644 --- a/TypeScript/11BundleLoadingSample/types/models/enums/ConfigTypes.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/enums/ConfigTypes.d.ts @@ -8,6 +8,7 @@ export declare enum ConfigTypes { IN_RAID = "aki-inraid", INSURANCE = "aki-insurance", INVENTORY = "aki-inventory", + LOCALE = "aki-locale", LOCATION = "aki-location", MATCH = "aki-match", QUEST = "aki-quest", diff --git a/TypeScript/11BundleLoadingSample/types/models/external/IAfterDBLoadMod.d.ts b/TypeScript/11BundleLoadingSample/types/models/external/IAfterDBLoadMod.d.ts new file mode 100644 index 0000000..7f08b9e --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/models/external/IAfterDBLoadMod.d.ts @@ -0,0 +1,4 @@ +import { DependencyContainer } from "./tsyringe"; +export interface IAfterDBLoadMod { + loadAfterDbInit(container: DependencyContainer): void; +} diff --git a/TypeScript/11BundleLoadingSample/types/models/external/mod.d.ts b/TypeScript/11BundleLoadingSample/types/models/external/mod.d.ts index ecef460..47939e9 100644 --- a/TypeScript/11BundleLoadingSample/types/models/external/mod.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/external/mod.d.ts @@ -1,5 +1,5 @@ import { DependencyContainer } from "./tsyringe"; export interface IMod { - load: (container: DependencyContainer) => void; - delayedLoad: (container: DependencyContainer) => void; + load(container: DependencyContainer): void; + delayedLoad(container: DependencyContainer): void; } diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/config/ILocaleConfig.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/config/ILocaleConfig.d.ts new file mode 100644 index 0000000..fe9abf7 --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/models/spt/config/ILocaleConfig.d.ts @@ -0,0 +1,5 @@ +import { IBaseConfig } from "./IBaseConfig"; +export interface ILocaleConfig extends IBaseConfig { + kind: "aki-locale"; + desiredLocale: string; +} diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/logging/LogBackgroundColor.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/logging/LogBackgroundColor.d.ts new file mode 100644 index 0000000..87e08a9 --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/models/spt/logging/LogBackgroundColor.d.ts @@ -0,0 +1,11 @@ +export declare enum LogBackgroundColor { + default = "", + black = "blackBG", + red = "redBG", + green = "greenBG", + yellow = "yellowBG", + blue = "blueBG", + magenta = "magentaBG", + cyan = "cyanBG", + white = "whiteBG" +} diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/logging/LogTextColor.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/logging/LogTextColor.d.ts new file mode 100644 index 0000000..7147ae3 --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/models/spt/logging/LogTextColor.d.ts @@ -0,0 +1,11 @@ +export declare enum LogTextColor { + black = "black", + red = "red", + green = "green", + yellow = "yellow", + blue = "blue", + magenta = "magenta", + cyan = "cyan", + white = "white", + gray = "" +} diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/logging/SptLogger.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/logging/SptLogger.d.ts new file mode 100644 index 0000000..ea1b3d8 --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/models/spt/logging/SptLogger.d.ts @@ -0,0 +1,7 @@ +export interface SptLogger { + error: (msg: string | Record) => void; + warn: (msg: string | Record) => void; + succ?: (msg: string | Record) => void; + info: (msg: string | Record) => void; + debug: (msg: string | Record) => void; +} diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/utils/ILogger.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/utils/ILogger.d.ts index c983701..2af3fac 100644 --- a/TypeScript/11BundleLoadingSample/types/models/spt/utils/ILogger.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/spt/utils/ILogger.d.ts @@ -1,7 +1,10 @@ import { Daum } from "../../eft/itemEvent/IItemEventRouterRequest"; +import { LogBackgroundColor } from "../logging/LogBackgroundColor"; +import { LogTextColor } from "../logging/LogTextColor"; export interface ILogger { writeToLogFile(data: string | Daum): void; - log(data: string | Record | Error, color: string): void; + log(data: string | Record | Error, color: string, backgroundColor?: string): void; + logWithColor(data: string | Record, textColor: LogTextColor, backgroundColor?: LogBackgroundColor): void; error(data: string): void; warning(data: string): void; success(data: string): void; diff --git a/TypeScript/11BundleLoadingSample/types/services/FenceService.d.ts b/TypeScript/11BundleLoadingSample/types/services/FenceService.d.ts index 12723fb..79058c6 100644 --- a/TypeScript/11BundleLoadingSample/types/services/FenceService.d.ts +++ b/TypeScript/11BundleLoadingSample/types/services/FenceService.d.ts @@ -29,8 +29,8 @@ export declare class FenceService { hasExpiredCache(refreshAssort: boolean): boolean; generateFenceAssortCache(pmcData: IPmcData): void; /** - * - * @param pmcData Get the fence level the passed in profile has + * Get the fence level the passed in profile has + * @param pmcData Player profile * @returns FenceLevel */ getFenceInfo(pmcData: IPmcData): FenceLevel; diff --git a/TypeScript/11BundleLoadingSample/types/services/LocaleService.d.ts b/TypeScript/11BundleLoadingSample/types/services/LocaleService.d.ts new file mode 100644 index 0000000..33bea7b --- /dev/null +++ b/TypeScript/11BundleLoadingSample/types/services/LocaleService.d.ts @@ -0,0 +1,14 @@ +import { ILocaleConfig } from "../models/spt/config/ILocaleConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +export declare class LocaleService { + protected logger: ILogger; + protected configServer: ConfigServer; + protected localeConfig: ILocaleConfig; + constructor(logger: ILogger, configServer: ConfigServer); + /** + * Gets the locale key from the locale.json file + * @returns locale e.g en/ge/cz/cn + */ + getDesiredLocale(): string; +} diff --git a/TypeScript/11BundleLoadingSample/types/utils/DatabaseImporter.d.ts b/TypeScript/11BundleLoadingSample/types/utils/DatabaseImporter.d.ts index 24c1cd6..b3156ea 100644 --- a/TypeScript/11BundleLoadingSample/types/utils/DatabaseImporter.d.ts +++ b/TypeScript/11BundleLoadingSample/types/utils/DatabaseImporter.d.ts @@ -5,7 +5,7 @@ import { ImageRouter } from "../routers/ImageRouter"; import { DatabaseServer } from "../servers/DatabaseServer"; import { CustomHandbookItemService } from "../services/CustomHandbookItemService"; import { CustomItemService } from "../services/CustomItemService"; -import { CustomPresetService } from "../services/customPresetService"; +import { CustomPresetService } from "../services/CustomPresetService"; import { CustomTraderAssortService } from "../services/CustomTraderAssortService"; import { JsonUtil } from "./JsonUtil"; import { VFS } from "./VFS"; diff --git a/TypeScript/11BundleLoadingSample/types/utils/Logger.d.ts b/TypeScript/11BundleLoadingSample/types/utils/Logger.d.ts index f5b774b..3d9013f 100644 --- a/TypeScript/11BundleLoadingSample/types/utils/Logger.d.ts +++ b/TypeScript/11BundleLoadingSample/types/utils/Logger.d.ts @@ -1,17 +1,13 @@ /// -import { Daum } from "../models/eft/itemEvent/IItemEventRouterRequest"; -import { ILogger } from "../models/spt/utils/ILogger"; -import winston from "winston"; -import { IAsyncQueue } from "../models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "../models/spt/utils/IUuidGenerator"; import fs from "fs"; -interface SptLogger { - error: (msg: string | Record) => void; - warn: (msg: string | Record) => void; - succ?: (msg: string | Record) => void; - info: (msg: string | Record) => void; - debug: (msg: string | Record) => void; -} +import winston from "winston"; +import { Daum } from "../models/eft/itemEvent/IItemEventRouterRequest"; +import { LogBackgroundColor } from "../models/spt/logging/LogBackgroundColor"; +import { LogTextColor } from "../models/spt/logging/LogTextColor"; +import { SptLogger } from "../models/spt/logging/SptLogger"; +import { IAsyncQueue } from "../models/spt/utils/IAsyncQueue"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { IUUidGenerator } from "../models/spt/utils/IUuidGenerator"; export declare class WinstonLogger implements ILogger { protected asyncQueue: IAsyncQueue; protected uuidGenerator: IUUidGenerator; @@ -36,16 +32,27 @@ export declare class WinstonLogger implements ILogger { custom: string; debug: string; }; + bgColors: { + default: string; + blackBG: string; + redBG: string; + greenBG: string; + yellowBG: string; + blueBG: string; + magentaBG: string; + cyanBG: string; + whiteBG: string; + }; }; protected logger: winston.Logger & SptLogger; - writeFilePromisify: (path: fs.PathLike, data: string, options?: any) => Promise; + protected writeFilePromisify: (path: fs.PathLike, data: string, options?: any) => Promise; constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); writeToLogFile(data: string | Daum): Promise; - log(data: string | Error | Record, color: string): Promise; + log(data: string | Error | Record, color: string, backgroundColor?: string): Promise; error(data: string | Record): Promise; warning(data: string | Record): Promise; success(data: string | Record): Promise; info(data: string | Record): Promise; + logWithColor(data: string | Record, textColor: LogTextColor, backgroundColor?: LogBackgroundColor): Promise; debug(data: string | Record, onlyShowInConsole?: boolean): Promise; } -export {}; diff --git a/TypeScript/12ClassExtensionOverride/types/controllers/GameController.d.ts b/TypeScript/12ClassExtensionOverride/types/controllers/GameController.d.ts index 7f632d6..5f516de 100644 --- a/TypeScript/12ClassExtensionOverride/types/controllers/GameController.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/controllers/GameController.d.ts @@ -6,19 +6,23 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { IPmcDataRepeatableQuest, IRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; import { IGameConfigResponse } from "../models/eft/game/IGameConfigResponse"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; +import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { LocaleService } from "../services/LocaleService"; import { Watermark } from "../utils/Watermark"; export declare class GameController { protected logger: ILogger; protected watermark: Watermark; protected httpServerHelper: HttpServerHelper; + protected localeService: LocaleService; protected profileHelper: ProfileHelper; protected gameHelper: GameHelper; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; - constructor(logger: ILogger, watermark: Watermark, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper, gameHelper: GameHelper, configServer: ConfigServer); + protected coreConfig: ICoreConfig; + constructor(logger: ILogger, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, gameHelper: GameHelper, configServer: ConfigServer); gameStart(_url: string, _info: IEmptyRequestData, sessionID: string): void; protected addMissingBonusesProperty(pmcProfile: IPmcData): void; protected addMissingRepeatableQuestsProperty(pmcProfile: IPmcData): void; diff --git a/TypeScript/12ClassExtensionOverride/types/controllers/QuestController.d.ts b/TypeScript/12ClassExtensionOverride/types/controllers/QuestController.d.ts index c00cd6d..2cbccfb 100644 --- a/TypeScript/12ClassExtensionOverride/types/controllers/QuestController.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/controllers/QuestController.d.ts @@ -14,6 +14,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ItemEventRouter } from "../routers/ItemEventRouter"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocaleService } from "../services/LocaleService"; import { PlayerService } from "../services/PlayerService"; import { TimeUtil } from "../utils/TimeUtil"; export declare class QuestController { @@ -27,9 +28,10 @@ export declare class QuestController { protected questHelper: QuestHelper; protected questConditionHelper: QuestConditionHelper; protected playerService: PlayerService; + protected localeService: LocaleService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, itemHelper: ItemHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, questConditionHelper: QuestConditionHelper, playerService: PlayerService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, itemHelper: ItemHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, questConditionHelper: QuestConditionHelper, playerService: PlayerService, localeService: LocaleService, configServer: ConfigServer); /** * Get all quests visible to player * Exclude quests with incomplete preconditions (level/loyalty) diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/ItemHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/ItemHelper.d.ts index 70c88d6..4fff11e 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/ItemHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/ItemHelper.d.ts @@ -84,6 +84,11 @@ declare class ItemHelper { */ generateItemsFromStackSlot(item: ITemplateItem, parentId: string): Item[]; getItem(tpl: string): [boolean, ITemplateItem]; + /** + * get normalized value (0-1) based on item condition + * @param item + * @returns number between 0 and 1 + */ getItemQualityModifier(item: Item): number; findAndReturnChildrenByItems(items: Item[], itemID: string): string[]; /** diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/QuestHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/QuestHelper.d.ts index 04ede16..d6e382b 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/QuestHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/QuestHelper.d.ts @@ -8,6 +8,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ItemEventRouter } from "../routers/ItemEventRouter"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocaleService } from "../services/LocaleService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -25,6 +26,7 @@ export declare class QuestHelper { protected itemHelper: ItemHelper; protected itemEventRouter: ItemEventRouter; protected databaseServer: DatabaseServer; + protected localeService: LocaleService; protected ragfairServerHelper: RagfairServerHelper; protected dialogueHelper: DialogueHelper; protected profileHelper: ProfileHelper; @@ -32,7 +34,7 @@ export declare class QuestHelper { protected traderHelper: TraderHelper; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, traderHelper: TraderHelper, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, traderHelper: TraderHelper, configServer: ConfigServer); static get STATUS(): Record; questStatus(pmcData: IPmcData, questID: string): string; /** @@ -74,7 +76,7 @@ export declare class QuestHelper { cleanQuestConditions(quest: IQuest): IQuest; failQuest(pmcData: IPmcData, body: any, sessionID: string): any; getQuestFromDb(questId: string, pmcData: IPmcData): IQuest; - getQuestLocaleIdFromDb(messageId: string, localisation?: string): string; + getQuestLocaleIdFromDb(messageId: string): string; applyQuestReward(pmcData: IPmcData, body: ICompleteQuestRequestData, state: string, sessionID: string): Reward[]; /** * Get the intel center bonus a player has diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/RagfairOfferHelper.d.ts index 129bc1c..5a77e13 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/RagfairOfferHelper.d.ts @@ -10,6 +10,7 @@ import { ItemEventRouter } from "../routers/ItemEventRouter"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocaleService } from "../services/LocaleService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { HashUtil } from "../utils/HashUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -37,11 +38,12 @@ export declare class RagfairOfferHelper { protected ragfairSortHelper: RagfairSortHelper; protected ragfairHelper: RagfairHelper; protected ragfairOfferService: RagfairOfferService; + protected localeService: LocaleService; protected configServer: ConfigServer; protected static TPL_GOODS_SOLD: string; protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, saveServer: SaveServer, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, saveServer: SaveServer, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, configServer: ConfigServer); getValidOffers(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; getOffersForBuild(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; processOffers(sessionID: string): boolean; diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/RagfairServerHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/RagfairServerHelper.d.ts index 2cb3ea5..a52306b 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/RagfairServerHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/RagfairServerHelper.d.ts @@ -1,11 +1,12 @@ -import { MemberCategory } from "../models/enums/MemberCategory"; import { Item } from "../models/eft/common/tables/IItem"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { MemberCategory } from "../models/enums/MemberCategory"; import { IQuestConfig } from "../models/spt/config/IQuestConfig"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocaleService } from "../services/LocaleService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; @@ -19,13 +20,14 @@ export declare class RagfairServerHelper { protected databaseServer: DatabaseServer; protected profileHelper: ProfileHelper; protected itemHelper: ItemHelper; + protected localeService: LocaleService; protected dialogueHelper: DialogueHelper; protected jsonUtil: JsonUtil; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; protected static TPL_GOODS_RETURNED: string; - constructor(randomUtil: RandomUtil, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, profileHelper: ProfileHelper, itemHelper: ItemHelper, dialogueHelper: DialogueHelper, jsonUtil: JsonUtil, configServer: ConfigServer); + constructor(randomUtil: RandomUtil, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, profileHelper: ProfileHelper, itemHelper: ItemHelper, localeService: LocaleService, dialogueHelper: DialogueHelper, jsonUtil: JsonUtil, configServer: ConfigServer); /** * Is item valid / on blacklist / quest item * @param itemDetails diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/RagfairSortHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/RagfairSortHelper.d.ts index e983569..d20e10c 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/RagfairSortHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/RagfairSortHelper.d.ts @@ -1,8 +1,10 @@ import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocaleService } from "../services/LocaleService"; export declare class RagfairSortHelper { protected databaseServer: DatabaseServer; - constructor(databaseServer: DatabaseServer); + protected localeService: LocaleService; + constructor(databaseServer: DatabaseServer, localeService: LocaleService); sortOffers(offers: IRagfairOffer[], type: number, direction?: number): IRagfairOffer[]; protected sortOffersByID(a: IRagfairOffer, b: IRagfairOffer): number; protected sortOffersByRating(a: IRagfairOffer, b: IRagfairOffer): number; diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/TraderHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/TraderHelper.d.ts index ab4a371..717351f 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/TraderHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/TraderHelper.d.ts @@ -1,4 +1,6 @@ +import { FenceLevel } from "../models/eft/common/IGlobals"; import { IPmcData } from "../models/eft/common/IPmcData"; +import { Item } from "../models/eft/common/tables/IItem"; import { IBarterScheme, ITraderAssort, ITraderBase, LoyaltyLevel } from "../models/eft/common/tables/ITrader"; import { ITraderConfig } from "../models/spt/config/ITraderConfig"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -34,7 +36,48 @@ export declare class TraderHelper { */ resetTrader(sessionID: string, traderID: string): void; changeTraderDisplay(traderID: string, status: boolean, sessionID: string): void; + /** + * Get a list of items and their prices from player inventory that can be sold to a trader + * @param traderID trader id being traded with + * @param sessionID session id + * @returns IBarterScheme[][] + */ getPurchasesData(traderID: string, sessionID: string): Record; + /** + * Should item be skipped when selling to trader according to its sell categories and other checks + * @param pmcData + * @param item + * @param sellCategory + * @returns true if should NOT be sold to trader + */ + protected isItemUnSellableToTrader(pmcData: IPmcData, item: Item, sellCategory: string[]): boolean; + /** + * Can this weapon be sold to a trader with its current durabiltiy level + * @param traderID + * @param item + * @returns boolean + */ + protected isWeaponAndBelowTraderBuyDurability(traderID: string, item: Item): boolean; + /** + * Get the price of an item and all of its attached children + * Take into account bonuses/adjsutments e.g. discounts + * @param pmcData profile data + * @param item item to calculate price of + * @param buyPriceCoefficient + * @param fenceInfo fence data + * @param traderBase trader details + * @param currencyTpl Currency to get price as + * @returns price of item + children + */ + protected getAdjustedItemPrice(pmcData: IPmcData, item: Item, buyPriceCoefficient: number, fenceInfo: FenceLevel, traderBase: ITraderBase, currencyTpl: string): number; + /** + * Get the raw price of item+child items from handbook without any modification + * @param pmcData profile data + * @param item item to calculate price of + * @returns price as number + */ + protected getRawItemPrice(pmcData: IPmcData, item: Item): number; + protected getTraderDiscount(trader: ITraderBase, buyPriceCoefficient: number, fenceInfo: FenceLevel, traderID: string): number; /** * Calculate traders level based on exp amount and increment level if over threshold * @param traderID trader to process diff --git a/TypeScript/12ClassExtensionOverride/types/loaders/AfterDbModLoader.d.ts b/TypeScript/12ClassExtensionOverride/types/loaders/AfterDbModLoader.d.ts new file mode 100644 index 0000000..a9fc286 --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/loaders/AfterDbModLoader.d.ts @@ -0,0 +1,11 @@ +import { DependencyContainer } from "tsyringe"; +import { OnLoad } from "../di/OnLoad"; +import { InitialModLoader } from "./InitialModLoader"; +export declare class AfterDbModLoader implements OnLoad { + protected initialModLoader: InitialModLoader; + constructor(initialModLoader: InitialModLoader); + onLoad(): void; + getRoute(): string; + getModPath(mod: string): string; + protected executeMods(container: DependencyContainer): void; +} diff --git a/TypeScript/12ClassExtensionOverride/types/models/enums/ConfigTypes.d.ts b/TypeScript/12ClassExtensionOverride/types/models/enums/ConfigTypes.d.ts index 6bd31e8..1c49e62 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/enums/ConfigTypes.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/enums/ConfigTypes.d.ts @@ -8,6 +8,7 @@ export declare enum ConfigTypes { IN_RAID = "aki-inraid", INSURANCE = "aki-insurance", INVENTORY = "aki-inventory", + LOCALE = "aki-locale", LOCATION = "aki-location", MATCH = "aki-match", QUEST = "aki-quest", diff --git a/TypeScript/12ClassExtensionOverride/types/models/external/IAfterDBLoadMod.d.ts b/TypeScript/12ClassExtensionOverride/types/models/external/IAfterDBLoadMod.d.ts new file mode 100644 index 0000000..7f08b9e --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/models/external/IAfterDBLoadMod.d.ts @@ -0,0 +1,4 @@ +import { DependencyContainer } from "./tsyringe"; +export interface IAfterDBLoadMod { + loadAfterDbInit(container: DependencyContainer): void; +} diff --git a/TypeScript/12ClassExtensionOverride/types/models/external/mod.d.ts b/TypeScript/12ClassExtensionOverride/types/models/external/mod.d.ts index ecef460..47939e9 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/external/mod.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/external/mod.d.ts @@ -1,5 +1,5 @@ import { DependencyContainer } from "./tsyringe"; export interface IMod { - load: (container: DependencyContainer) => void; - delayedLoad: (container: DependencyContainer) => void; + load(container: DependencyContainer): void; + delayedLoad(container: DependencyContainer): void; } diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/config/ILocaleConfig.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/config/ILocaleConfig.d.ts new file mode 100644 index 0000000..fe9abf7 --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/config/ILocaleConfig.d.ts @@ -0,0 +1,5 @@ +import { IBaseConfig } from "./IBaseConfig"; +export interface ILocaleConfig extends IBaseConfig { + kind: "aki-locale"; + desiredLocale: string; +} diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/logging/LogBackgroundColor.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/logging/LogBackgroundColor.d.ts new file mode 100644 index 0000000..87e08a9 --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/logging/LogBackgroundColor.d.ts @@ -0,0 +1,11 @@ +export declare enum LogBackgroundColor { + default = "", + black = "blackBG", + red = "redBG", + green = "greenBG", + yellow = "yellowBG", + blue = "blueBG", + magenta = "magentaBG", + cyan = "cyanBG", + white = "whiteBG" +} diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/logging/LogTextColor.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/logging/LogTextColor.d.ts new file mode 100644 index 0000000..7147ae3 --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/logging/LogTextColor.d.ts @@ -0,0 +1,11 @@ +export declare enum LogTextColor { + black = "black", + red = "red", + green = "green", + yellow = "yellow", + blue = "blue", + magenta = "magenta", + cyan = "cyan", + white = "white", + gray = "" +} diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/logging/SptLogger.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/logging/SptLogger.d.ts new file mode 100644 index 0000000..ea1b3d8 --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/logging/SptLogger.d.ts @@ -0,0 +1,7 @@ +export interface SptLogger { + error: (msg: string | Record) => void; + warn: (msg: string | Record) => void; + succ?: (msg: string | Record) => void; + info: (msg: string | Record) => void; + debug: (msg: string | Record) => void; +} diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/utils/ILogger.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/utils/ILogger.d.ts index c983701..2af3fac 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/spt/utils/ILogger.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/utils/ILogger.d.ts @@ -1,7 +1,10 @@ import { Daum } from "../../eft/itemEvent/IItemEventRouterRequest"; +import { LogBackgroundColor } from "../logging/LogBackgroundColor"; +import { LogTextColor } from "../logging/LogTextColor"; export interface ILogger { writeToLogFile(data: string | Daum): void; - log(data: string | Record | Error, color: string): void; + log(data: string | Record | Error, color: string, backgroundColor?: string): void; + logWithColor(data: string | Record, textColor: LogTextColor, backgroundColor?: LogBackgroundColor): void; error(data: string): void; warning(data: string): void; success(data: string): void; diff --git a/TypeScript/12ClassExtensionOverride/types/services/FenceService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/FenceService.d.ts index 12723fb..79058c6 100644 --- a/TypeScript/12ClassExtensionOverride/types/services/FenceService.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/services/FenceService.d.ts @@ -29,8 +29,8 @@ export declare class FenceService { hasExpiredCache(refreshAssort: boolean): boolean; generateFenceAssortCache(pmcData: IPmcData): void; /** - * - * @param pmcData Get the fence level the passed in profile has + * Get the fence level the passed in profile has + * @param pmcData Player profile * @returns FenceLevel */ getFenceInfo(pmcData: IPmcData): FenceLevel; diff --git a/TypeScript/12ClassExtensionOverride/types/services/LocaleService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/LocaleService.d.ts new file mode 100644 index 0000000..33bea7b --- /dev/null +++ b/TypeScript/12ClassExtensionOverride/types/services/LocaleService.d.ts @@ -0,0 +1,14 @@ +import { ILocaleConfig } from "../models/spt/config/ILocaleConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +export declare class LocaleService { + protected logger: ILogger; + protected configServer: ConfigServer; + protected localeConfig: ILocaleConfig; + constructor(logger: ILogger, configServer: ConfigServer); + /** + * Gets the locale key from the locale.json file + * @returns locale e.g en/ge/cz/cn + */ + getDesiredLocale(): string; +} diff --git a/TypeScript/12ClassExtensionOverride/types/utils/DatabaseImporter.d.ts b/TypeScript/12ClassExtensionOverride/types/utils/DatabaseImporter.d.ts index 24c1cd6..b3156ea 100644 --- a/TypeScript/12ClassExtensionOverride/types/utils/DatabaseImporter.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/utils/DatabaseImporter.d.ts @@ -5,7 +5,7 @@ import { ImageRouter } from "../routers/ImageRouter"; import { DatabaseServer } from "../servers/DatabaseServer"; import { CustomHandbookItemService } from "../services/CustomHandbookItemService"; import { CustomItemService } from "../services/CustomItemService"; -import { CustomPresetService } from "../services/customPresetService"; +import { CustomPresetService } from "../services/CustomPresetService"; import { CustomTraderAssortService } from "../services/CustomTraderAssortService"; import { JsonUtil } from "./JsonUtil"; import { VFS } from "./VFS"; diff --git a/TypeScript/12ClassExtensionOverride/types/utils/Logger.d.ts b/TypeScript/12ClassExtensionOverride/types/utils/Logger.d.ts index f5b774b..3d9013f 100644 --- a/TypeScript/12ClassExtensionOverride/types/utils/Logger.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/utils/Logger.d.ts @@ -1,17 +1,13 @@ /// -import { Daum } from "../models/eft/itemEvent/IItemEventRouterRequest"; -import { ILogger } from "../models/spt/utils/ILogger"; -import winston from "winston"; -import { IAsyncQueue } from "../models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "../models/spt/utils/IUuidGenerator"; import fs from "fs"; -interface SptLogger { - error: (msg: string | Record) => void; - warn: (msg: string | Record) => void; - succ?: (msg: string | Record) => void; - info: (msg: string | Record) => void; - debug: (msg: string | Record) => void; -} +import winston from "winston"; +import { Daum } from "../models/eft/itemEvent/IItemEventRouterRequest"; +import { LogBackgroundColor } from "../models/spt/logging/LogBackgroundColor"; +import { LogTextColor } from "../models/spt/logging/LogTextColor"; +import { SptLogger } from "../models/spt/logging/SptLogger"; +import { IAsyncQueue } from "../models/spt/utils/IAsyncQueue"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { IUUidGenerator } from "../models/spt/utils/IUuidGenerator"; export declare class WinstonLogger implements ILogger { protected asyncQueue: IAsyncQueue; protected uuidGenerator: IUUidGenerator; @@ -36,16 +32,27 @@ export declare class WinstonLogger implements ILogger { custom: string; debug: string; }; + bgColors: { + default: string; + blackBG: string; + redBG: string; + greenBG: string; + yellowBG: string; + blueBG: string; + magentaBG: string; + cyanBG: string; + whiteBG: string; + }; }; protected logger: winston.Logger & SptLogger; - writeFilePromisify: (path: fs.PathLike, data: string, options?: any) => Promise; + protected writeFilePromisify: (path: fs.PathLike, data: string, options?: any) => Promise; constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); writeToLogFile(data: string | Daum): Promise; - log(data: string | Error | Record, color: string): Promise; + log(data: string | Error | Record, color: string, backgroundColor?: string): Promise; error(data: string | Record): Promise; warning(data: string | Record): Promise; success(data: string | Record): Promise; info(data: string | Record): Promise; + logWithColor(data: string | Record, textColor: LogTextColor, backgroundColor?: LogBackgroundColor): Promise; debug(data: string | Record, onlyShowInConsole?: boolean): Promise; } -export {}; diff --git a/TypeScript/13AddTrader/types/controllers/GameController.d.ts b/TypeScript/13AddTrader/types/controllers/GameController.d.ts index 7f632d6..5f516de 100644 --- a/TypeScript/13AddTrader/types/controllers/GameController.d.ts +++ b/TypeScript/13AddTrader/types/controllers/GameController.d.ts @@ -6,19 +6,23 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { IPmcDataRepeatableQuest, IRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; import { IGameConfigResponse } from "../models/eft/game/IGameConfigResponse"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; +import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { LocaleService } from "../services/LocaleService"; import { Watermark } from "../utils/Watermark"; export declare class GameController { protected logger: ILogger; protected watermark: Watermark; protected httpServerHelper: HttpServerHelper; + protected localeService: LocaleService; protected profileHelper: ProfileHelper; protected gameHelper: GameHelper; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; - constructor(logger: ILogger, watermark: Watermark, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper, gameHelper: GameHelper, configServer: ConfigServer); + protected coreConfig: ICoreConfig; + constructor(logger: ILogger, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, gameHelper: GameHelper, configServer: ConfigServer); gameStart(_url: string, _info: IEmptyRequestData, sessionID: string): void; protected addMissingBonusesProperty(pmcProfile: IPmcData): void; protected addMissingRepeatableQuestsProperty(pmcProfile: IPmcData): void; diff --git a/TypeScript/13AddTrader/types/controllers/QuestController.d.ts b/TypeScript/13AddTrader/types/controllers/QuestController.d.ts index c00cd6d..2cbccfb 100644 --- a/TypeScript/13AddTrader/types/controllers/QuestController.d.ts +++ b/TypeScript/13AddTrader/types/controllers/QuestController.d.ts @@ -14,6 +14,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ItemEventRouter } from "../routers/ItemEventRouter"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocaleService } from "../services/LocaleService"; import { PlayerService } from "../services/PlayerService"; import { TimeUtil } from "../utils/TimeUtil"; export declare class QuestController { @@ -27,9 +28,10 @@ export declare class QuestController { protected questHelper: QuestHelper; protected questConditionHelper: QuestConditionHelper; protected playerService: PlayerService; + protected localeService: LocaleService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, itemHelper: ItemHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, questConditionHelper: QuestConditionHelper, playerService: PlayerService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, itemHelper: ItemHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, questConditionHelper: QuestConditionHelper, playerService: PlayerService, localeService: LocaleService, configServer: ConfigServer); /** * Get all quests visible to player * Exclude quests with incomplete preconditions (level/loyalty) diff --git a/TypeScript/13AddTrader/types/helpers/ItemHelper.d.ts b/TypeScript/13AddTrader/types/helpers/ItemHelper.d.ts index 70c88d6..4fff11e 100644 --- a/TypeScript/13AddTrader/types/helpers/ItemHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/ItemHelper.d.ts @@ -84,6 +84,11 @@ declare class ItemHelper { */ generateItemsFromStackSlot(item: ITemplateItem, parentId: string): Item[]; getItem(tpl: string): [boolean, ITemplateItem]; + /** + * get normalized value (0-1) based on item condition + * @param item + * @returns number between 0 and 1 + */ getItemQualityModifier(item: Item): number; findAndReturnChildrenByItems(items: Item[], itemID: string): string[]; /** diff --git a/TypeScript/13AddTrader/types/helpers/QuestHelper.d.ts b/TypeScript/13AddTrader/types/helpers/QuestHelper.d.ts index 04ede16..d6e382b 100644 --- a/TypeScript/13AddTrader/types/helpers/QuestHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/QuestHelper.d.ts @@ -8,6 +8,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ItemEventRouter } from "../routers/ItemEventRouter"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocaleService } from "../services/LocaleService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -25,6 +26,7 @@ export declare class QuestHelper { protected itemHelper: ItemHelper; protected itemEventRouter: ItemEventRouter; protected databaseServer: DatabaseServer; + protected localeService: LocaleService; protected ragfairServerHelper: RagfairServerHelper; protected dialogueHelper: DialogueHelper; protected profileHelper: ProfileHelper; @@ -32,7 +34,7 @@ export declare class QuestHelper { protected traderHelper: TraderHelper; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, traderHelper: TraderHelper, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, traderHelper: TraderHelper, configServer: ConfigServer); static get STATUS(): Record; questStatus(pmcData: IPmcData, questID: string): string; /** @@ -74,7 +76,7 @@ export declare class QuestHelper { cleanQuestConditions(quest: IQuest): IQuest; failQuest(pmcData: IPmcData, body: any, sessionID: string): any; getQuestFromDb(questId: string, pmcData: IPmcData): IQuest; - getQuestLocaleIdFromDb(messageId: string, localisation?: string): string; + getQuestLocaleIdFromDb(messageId: string): string; applyQuestReward(pmcData: IPmcData, body: ICompleteQuestRequestData, state: string, sessionID: string): Reward[]; /** * Get the intel center bonus a player has diff --git a/TypeScript/13AddTrader/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/13AddTrader/types/helpers/RagfairOfferHelper.d.ts index 129bc1c..5a77e13 100644 --- a/TypeScript/13AddTrader/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/RagfairOfferHelper.d.ts @@ -10,6 +10,7 @@ import { ItemEventRouter } from "../routers/ItemEventRouter"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocaleService } from "../services/LocaleService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { HashUtil } from "../utils/HashUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -37,11 +38,12 @@ export declare class RagfairOfferHelper { protected ragfairSortHelper: RagfairSortHelper; protected ragfairHelper: RagfairHelper; protected ragfairOfferService: RagfairOfferService; + protected localeService: LocaleService; protected configServer: ConfigServer; protected static TPL_GOODS_SOLD: string; protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, saveServer: SaveServer, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, saveServer: SaveServer, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, configServer: ConfigServer); getValidOffers(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; getOffersForBuild(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; processOffers(sessionID: string): boolean; diff --git a/TypeScript/13AddTrader/types/helpers/RagfairServerHelper.d.ts b/TypeScript/13AddTrader/types/helpers/RagfairServerHelper.d.ts index 2cb3ea5..a52306b 100644 --- a/TypeScript/13AddTrader/types/helpers/RagfairServerHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/RagfairServerHelper.d.ts @@ -1,11 +1,12 @@ -import { MemberCategory } from "../models/enums/MemberCategory"; import { Item } from "../models/eft/common/tables/IItem"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { MemberCategory } from "../models/enums/MemberCategory"; import { IQuestConfig } from "../models/spt/config/IQuestConfig"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocaleService } from "../services/LocaleService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; @@ -19,13 +20,14 @@ export declare class RagfairServerHelper { protected databaseServer: DatabaseServer; protected profileHelper: ProfileHelper; protected itemHelper: ItemHelper; + protected localeService: LocaleService; protected dialogueHelper: DialogueHelper; protected jsonUtil: JsonUtil; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; protected static TPL_GOODS_RETURNED: string; - constructor(randomUtil: RandomUtil, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, profileHelper: ProfileHelper, itemHelper: ItemHelper, dialogueHelper: DialogueHelper, jsonUtil: JsonUtil, configServer: ConfigServer); + constructor(randomUtil: RandomUtil, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, profileHelper: ProfileHelper, itemHelper: ItemHelper, localeService: LocaleService, dialogueHelper: DialogueHelper, jsonUtil: JsonUtil, configServer: ConfigServer); /** * Is item valid / on blacklist / quest item * @param itemDetails diff --git a/TypeScript/13AddTrader/types/helpers/RagfairSortHelper.d.ts b/TypeScript/13AddTrader/types/helpers/RagfairSortHelper.d.ts index e983569..d20e10c 100644 --- a/TypeScript/13AddTrader/types/helpers/RagfairSortHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/RagfairSortHelper.d.ts @@ -1,8 +1,10 @@ import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocaleService } from "../services/LocaleService"; export declare class RagfairSortHelper { protected databaseServer: DatabaseServer; - constructor(databaseServer: DatabaseServer); + protected localeService: LocaleService; + constructor(databaseServer: DatabaseServer, localeService: LocaleService); sortOffers(offers: IRagfairOffer[], type: number, direction?: number): IRagfairOffer[]; protected sortOffersByID(a: IRagfairOffer, b: IRagfairOffer): number; protected sortOffersByRating(a: IRagfairOffer, b: IRagfairOffer): number; diff --git a/TypeScript/13AddTrader/types/helpers/TraderHelper.d.ts b/TypeScript/13AddTrader/types/helpers/TraderHelper.d.ts index ab4a371..717351f 100644 --- a/TypeScript/13AddTrader/types/helpers/TraderHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/TraderHelper.d.ts @@ -1,4 +1,6 @@ +import { FenceLevel } from "../models/eft/common/IGlobals"; import { IPmcData } from "../models/eft/common/IPmcData"; +import { Item } from "../models/eft/common/tables/IItem"; import { IBarterScheme, ITraderAssort, ITraderBase, LoyaltyLevel } from "../models/eft/common/tables/ITrader"; import { ITraderConfig } from "../models/spt/config/ITraderConfig"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -34,7 +36,48 @@ export declare class TraderHelper { */ resetTrader(sessionID: string, traderID: string): void; changeTraderDisplay(traderID: string, status: boolean, sessionID: string): void; + /** + * Get a list of items and their prices from player inventory that can be sold to a trader + * @param traderID trader id being traded with + * @param sessionID session id + * @returns IBarterScheme[][] + */ getPurchasesData(traderID: string, sessionID: string): Record; + /** + * Should item be skipped when selling to trader according to its sell categories and other checks + * @param pmcData + * @param item + * @param sellCategory + * @returns true if should NOT be sold to trader + */ + protected isItemUnSellableToTrader(pmcData: IPmcData, item: Item, sellCategory: string[]): boolean; + /** + * Can this weapon be sold to a trader with its current durabiltiy level + * @param traderID + * @param item + * @returns boolean + */ + protected isWeaponAndBelowTraderBuyDurability(traderID: string, item: Item): boolean; + /** + * Get the price of an item and all of its attached children + * Take into account bonuses/adjsutments e.g. discounts + * @param pmcData profile data + * @param item item to calculate price of + * @param buyPriceCoefficient + * @param fenceInfo fence data + * @param traderBase trader details + * @param currencyTpl Currency to get price as + * @returns price of item + children + */ + protected getAdjustedItemPrice(pmcData: IPmcData, item: Item, buyPriceCoefficient: number, fenceInfo: FenceLevel, traderBase: ITraderBase, currencyTpl: string): number; + /** + * Get the raw price of item+child items from handbook without any modification + * @param pmcData profile data + * @param item item to calculate price of + * @returns price as number + */ + protected getRawItemPrice(pmcData: IPmcData, item: Item): number; + protected getTraderDiscount(trader: ITraderBase, buyPriceCoefficient: number, fenceInfo: FenceLevel, traderID: string): number; /** * Calculate traders level based on exp amount and increment level if over threshold * @param traderID trader to process diff --git a/TypeScript/13AddTrader/types/loaders/AfterDbModLoader.d.ts b/TypeScript/13AddTrader/types/loaders/AfterDbModLoader.d.ts new file mode 100644 index 0000000..a9fc286 --- /dev/null +++ b/TypeScript/13AddTrader/types/loaders/AfterDbModLoader.d.ts @@ -0,0 +1,11 @@ +import { DependencyContainer } from "tsyringe"; +import { OnLoad } from "../di/OnLoad"; +import { InitialModLoader } from "./InitialModLoader"; +export declare class AfterDbModLoader implements OnLoad { + protected initialModLoader: InitialModLoader; + constructor(initialModLoader: InitialModLoader); + onLoad(): void; + getRoute(): string; + getModPath(mod: string): string; + protected executeMods(container: DependencyContainer): void; +} diff --git a/TypeScript/13AddTrader/types/models/enums/ConfigTypes.d.ts b/TypeScript/13AddTrader/types/models/enums/ConfigTypes.d.ts index 6bd31e8..1c49e62 100644 --- a/TypeScript/13AddTrader/types/models/enums/ConfigTypes.d.ts +++ b/TypeScript/13AddTrader/types/models/enums/ConfigTypes.d.ts @@ -8,6 +8,7 @@ export declare enum ConfigTypes { IN_RAID = "aki-inraid", INSURANCE = "aki-insurance", INVENTORY = "aki-inventory", + LOCALE = "aki-locale", LOCATION = "aki-location", MATCH = "aki-match", QUEST = "aki-quest", diff --git a/TypeScript/13AddTrader/types/models/external/IAfterDBLoadMod.d.ts b/TypeScript/13AddTrader/types/models/external/IAfterDBLoadMod.d.ts new file mode 100644 index 0000000..7f08b9e --- /dev/null +++ b/TypeScript/13AddTrader/types/models/external/IAfterDBLoadMod.d.ts @@ -0,0 +1,4 @@ +import { DependencyContainer } from "./tsyringe"; +export interface IAfterDBLoadMod { + loadAfterDbInit(container: DependencyContainer): void; +} diff --git a/TypeScript/13AddTrader/types/models/external/mod.d.ts b/TypeScript/13AddTrader/types/models/external/mod.d.ts index ecef460..47939e9 100644 --- a/TypeScript/13AddTrader/types/models/external/mod.d.ts +++ b/TypeScript/13AddTrader/types/models/external/mod.d.ts @@ -1,5 +1,5 @@ import { DependencyContainer } from "./tsyringe"; export interface IMod { - load: (container: DependencyContainer) => void; - delayedLoad: (container: DependencyContainer) => void; + load(container: DependencyContainer): void; + delayedLoad(container: DependencyContainer): void; } diff --git a/TypeScript/13AddTrader/types/models/spt/config/ILocaleConfig.d.ts b/TypeScript/13AddTrader/types/models/spt/config/ILocaleConfig.d.ts new file mode 100644 index 0000000..fe9abf7 --- /dev/null +++ b/TypeScript/13AddTrader/types/models/spt/config/ILocaleConfig.d.ts @@ -0,0 +1,5 @@ +import { IBaseConfig } from "./IBaseConfig"; +export interface ILocaleConfig extends IBaseConfig { + kind: "aki-locale"; + desiredLocale: string; +} diff --git a/TypeScript/13AddTrader/types/models/spt/logging/LogBackgroundColor.d.ts b/TypeScript/13AddTrader/types/models/spt/logging/LogBackgroundColor.d.ts new file mode 100644 index 0000000..87e08a9 --- /dev/null +++ b/TypeScript/13AddTrader/types/models/spt/logging/LogBackgroundColor.d.ts @@ -0,0 +1,11 @@ +export declare enum LogBackgroundColor { + default = "", + black = "blackBG", + red = "redBG", + green = "greenBG", + yellow = "yellowBG", + blue = "blueBG", + magenta = "magentaBG", + cyan = "cyanBG", + white = "whiteBG" +} diff --git a/TypeScript/13AddTrader/types/models/spt/logging/LogTextColor.d.ts b/TypeScript/13AddTrader/types/models/spt/logging/LogTextColor.d.ts new file mode 100644 index 0000000..7147ae3 --- /dev/null +++ b/TypeScript/13AddTrader/types/models/spt/logging/LogTextColor.d.ts @@ -0,0 +1,11 @@ +export declare enum LogTextColor { + black = "black", + red = "red", + green = "green", + yellow = "yellow", + blue = "blue", + magenta = "magenta", + cyan = "cyan", + white = "white", + gray = "" +} diff --git a/TypeScript/13AddTrader/types/models/spt/logging/SptLogger.d.ts b/TypeScript/13AddTrader/types/models/spt/logging/SptLogger.d.ts new file mode 100644 index 0000000..ea1b3d8 --- /dev/null +++ b/TypeScript/13AddTrader/types/models/spt/logging/SptLogger.d.ts @@ -0,0 +1,7 @@ +export interface SptLogger { + error: (msg: string | Record) => void; + warn: (msg: string | Record) => void; + succ?: (msg: string | Record) => void; + info: (msg: string | Record) => void; + debug: (msg: string | Record) => void; +} diff --git a/TypeScript/13AddTrader/types/models/spt/utils/ILogger.d.ts b/TypeScript/13AddTrader/types/models/spt/utils/ILogger.d.ts index c983701..2af3fac 100644 --- a/TypeScript/13AddTrader/types/models/spt/utils/ILogger.d.ts +++ b/TypeScript/13AddTrader/types/models/spt/utils/ILogger.d.ts @@ -1,7 +1,10 @@ import { Daum } from "../../eft/itemEvent/IItemEventRouterRequest"; +import { LogBackgroundColor } from "../logging/LogBackgroundColor"; +import { LogTextColor } from "../logging/LogTextColor"; export interface ILogger { writeToLogFile(data: string | Daum): void; - log(data: string | Record | Error, color: string): void; + log(data: string | Record | Error, color: string, backgroundColor?: string): void; + logWithColor(data: string | Record, textColor: LogTextColor, backgroundColor?: LogBackgroundColor): void; error(data: string): void; warning(data: string): void; success(data: string): void; diff --git a/TypeScript/13AddTrader/types/services/FenceService.d.ts b/TypeScript/13AddTrader/types/services/FenceService.d.ts index 12723fb..79058c6 100644 --- a/TypeScript/13AddTrader/types/services/FenceService.d.ts +++ b/TypeScript/13AddTrader/types/services/FenceService.d.ts @@ -29,8 +29,8 @@ export declare class FenceService { hasExpiredCache(refreshAssort: boolean): boolean; generateFenceAssortCache(pmcData: IPmcData): void; /** - * - * @param pmcData Get the fence level the passed in profile has + * Get the fence level the passed in profile has + * @param pmcData Player profile * @returns FenceLevel */ getFenceInfo(pmcData: IPmcData): FenceLevel; diff --git a/TypeScript/13AddTrader/types/services/LocaleService.d.ts b/TypeScript/13AddTrader/types/services/LocaleService.d.ts new file mode 100644 index 0000000..33bea7b --- /dev/null +++ b/TypeScript/13AddTrader/types/services/LocaleService.d.ts @@ -0,0 +1,14 @@ +import { ILocaleConfig } from "../models/spt/config/ILocaleConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +export declare class LocaleService { + protected logger: ILogger; + protected configServer: ConfigServer; + protected localeConfig: ILocaleConfig; + constructor(logger: ILogger, configServer: ConfigServer); + /** + * Gets the locale key from the locale.json file + * @returns locale e.g en/ge/cz/cn + */ + getDesiredLocale(): string; +} diff --git a/TypeScript/13AddTrader/types/utils/DatabaseImporter.d.ts b/TypeScript/13AddTrader/types/utils/DatabaseImporter.d.ts index 24c1cd6..b3156ea 100644 --- a/TypeScript/13AddTrader/types/utils/DatabaseImporter.d.ts +++ b/TypeScript/13AddTrader/types/utils/DatabaseImporter.d.ts @@ -5,7 +5,7 @@ import { ImageRouter } from "../routers/ImageRouter"; import { DatabaseServer } from "../servers/DatabaseServer"; import { CustomHandbookItemService } from "../services/CustomHandbookItemService"; import { CustomItemService } from "../services/CustomItemService"; -import { CustomPresetService } from "../services/customPresetService"; +import { CustomPresetService } from "../services/CustomPresetService"; import { CustomTraderAssortService } from "../services/CustomTraderAssortService"; import { JsonUtil } from "./JsonUtil"; import { VFS } from "./VFS"; diff --git a/TypeScript/13AddTrader/types/utils/Logger.d.ts b/TypeScript/13AddTrader/types/utils/Logger.d.ts index f5b774b..3d9013f 100644 --- a/TypeScript/13AddTrader/types/utils/Logger.d.ts +++ b/TypeScript/13AddTrader/types/utils/Logger.d.ts @@ -1,17 +1,13 @@ /// -import { Daum } from "../models/eft/itemEvent/IItemEventRouterRequest"; -import { ILogger } from "../models/spt/utils/ILogger"; -import winston from "winston"; -import { IAsyncQueue } from "../models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "../models/spt/utils/IUuidGenerator"; import fs from "fs"; -interface SptLogger { - error: (msg: string | Record) => void; - warn: (msg: string | Record) => void; - succ?: (msg: string | Record) => void; - info: (msg: string | Record) => void; - debug: (msg: string | Record) => void; -} +import winston from "winston"; +import { Daum } from "../models/eft/itemEvent/IItemEventRouterRequest"; +import { LogBackgroundColor } from "../models/spt/logging/LogBackgroundColor"; +import { LogTextColor } from "../models/spt/logging/LogTextColor"; +import { SptLogger } from "../models/spt/logging/SptLogger"; +import { IAsyncQueue } from "../models/spt/utils/IAsyncQueue"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { IUUidGenerator } from "../models/spt/utils/IUuidGenerator"; export declare class WinstonLogger implements ILogger { protected asyncQueue: IAsyncQueue; protected uuidGenerator: IUUidGenerator; @@ -36,16 +32,27 @@ export declare class WinstonLogger implements ILogger { custom: string; debug: string; }; + bgColors: { + default: string; + blackBG: string; + redBG: string; + greenBG: string; + yellowBG: string; + blueBG: string; + magentaBG: string; + cyanBG: string; + whiteBG: string; + }; }; protected logger: winston.Logger & SptLogger; - writeFilePromisify: (path: fs.PathLike, data: string, options?: any) => Promise; + protected writeFilePromisify: (path: fs.PathLike, data: string, options?: any) => Promise; constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); writeToLogFile(data: string | Daum): Promise; - log(data: string | Error | Record, color: string): Promise; + log(data: string | Error | Record, color: string, backgroundColor?: string): Promise; error(data: string | Record): Promise; warning(data: string | Record): Promise; success(data: string | Record): Promise; info(data: string | Record): Promise; + logWithColor(data: string | Record, textColor: LogTextColor, backgroundColor?: LogBackgroundColor): Promise; debug(data: string | Record, onlyShowInConsole?: boolean): Promise; } -export {}; diff --git a/TypeScript/1LogToConsole/src/mod.ts b/TypeScript/1LogToConsole/src/mod.ts index 22037be..47f3c2b 100644 --- a/TypeScript/1LogToConsole/src/mod.ts +++ b/TypeScript/1LogToConsole/src/mod.ts @@ -13,6 +13,7 @@ class Mod implements IMod logger.info("I am logging info!"); logger.warning("I am logging a warning!"); logger.error("I am logging an error!"); + logger.logWithColor("I am logging with color!", red, yellow); } // Code added here will be run AFTER the server has started diff --git a/TypeScript/1LogToConsole/types/controllers/GameController.d.ts b/TypeScript/1LogToConsole/types/controllers/GameController.d.ts index 7f632d6..5f516de 100644 --- a/TypeScript/1LogToConsole/types/controllers/GameController.d.ts +++ b/TypeScript/1LogToConsole/types/controllers/GameController.d.ts @@ -6,19 +6,23 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { IPmcDataRepeatableQuest, IRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; import { IGameConfigResponse } from "../models/eft/game/IGameConfigResponse"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; +import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { LocaleService } from "../services/LocaleService"; import { Watermark } from "../utils/Watermark"; export declare class GameController { protected logger: ILogger; protected watermark: Watermark; protected httpServerHelper: HttpServerHelper; + protected localeService: LocaleService; protected profileHelper: ProfileHelper; protected gameHelper: GameHelper; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; - constructor(logger: ILogger, watermark: Watermark, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper, gameHelper: GameHelper, configServer: ConfigServer); + protected coreConfig: ICoreConfig; + constructor(logger: ILogger, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, gameHelper: GameHelper, configServer: ConfigServer); gameStart(_url: string, _info: IEmptyRequestData, sessionID: string): void; protected addMissingBonusesProperty(pmcProfile: IPmcData): void; protected addMissingRepeatableQuestsProperty(pmcProfile: IPmcData): void; diff --git a/TypeScript/1LogToConsole/types/controllers/QuestController.d.ts b/TypeScript/1LogToConsole/types/controllers/QuestController.d.ts index c00cd6d..2cbccfb 100644 --- a/TypeScript/1LogToConsole/types/controllers/QuestController.d.ts +++ b/TypeScript/1LogToConsole/types/controllers/QuestController.d.ts @@ -14,6 +14,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ItemEventRouter } from "../routers/ItemEventRouter"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocaleService } from "../services/LocaleService"; import { PlayerService } from "../services/PlayerService"; import { TimeUtil } from "../utils/TimeUtil"; export declare class QuestController { @@ -27,9 +28,10 @@ export declare class QuestController { protected questHelper: QuestHelper; protected questConditionHelper: QuestConditionHelper; protected playerService: PlayerService; + protected localeService: LocaleService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, itemHelper: ItemHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, questConditionHelper: QuestConditionHelper, playerService: PlayerService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, itemHelper: ItemHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, questConditionHelper: QuestConditionHelper, playerService: PlayerService, localeService: LocaleService, configServer: ConfigServer); /** * Get all quests visible to player * Exclude quests with incomplete preconditions (level/loyalty) diff --git a/TypeScript/1LogToConsole/types/helpers/ItemHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/ItemHelper.d.ts index 70c88d6..4fff11e 100644 --- a/TypeScript/1LogToConsole/types/helpers/ItemHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/ItemHelper.d.ts @@ -84,6 +84,11 @@ declare class ItemHelper { */ generateItemsFromStackSlot(item: ITemplateItem, parentId: string): Item[]; getItem(tpl: string): [boolean, ITemplateItem]; + /** + * get normalized value (0-1) based on item condition + * @param item + * @returns number between 0 and 1 + */ getItemQualityModifier(item: Item): number; findAndReturnChildrenByItems(items: Item[], itemID: string): string[]; /** diff --git a/TypeScript/1LogToConsole/types/helpers/QuestHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/QuestHelper.d.ts index 04ede16..d6e382b 100644 --- a/TypeScript/1LogToConsole/types/helpers/QuestHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/QuestHelper.d.ts @@ -8,6 +8,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ItemEventRouter } from "../routers/ItemEventRouter"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocaleService } from "../services/LocaleService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -25,6 +26,7 @@ export declare class QuestHelper { protected itemHelper: ItemHelper; protected itemEventRouter: ItemEventRouter; protected databaseServer: DatabaseServer; + protected localeService: LocaleService; protected ragfairServerHelper: RagfairServerHelper; protected dialogueHelper: DialogueHelper; protected profileHelper: ProfileHelper; @@ -32,7 +34,7 @@ export declare class QuestHelper { protected traderHelper: TraderHelper; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, traderHelper: TraderHelper, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, traderHelper: TraderHelper, configServer: ConfigServer); static get STATUS(): Record; questStatus(pmcData: IPmcData, questID: string): string; /** @@ -74,7 +76,7 @@ export declare class QuestHelper { cleanQuestConditions(quest: IQuest): IQuest; failQuest(pmcData: IPmcData, body: any, sessionID: string): any; getQuestFromDb(questId: string, pmcData: IPmcData): IQuest; - getQuestLocaleIdFromDb(messageId: string, localisation?: string): string; + getQuestLocaleIdFromDb(messageId: string): string; applyQuestReward(pmcData: IPmcData, body: ICompleteQuestRequestData, state: string, sessionID: string): Reward[]; /** * Get the intel center bonus a player has diff --git a/TypeScript/1LogToConsole/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/RagfairOfferHelper.d.ts index 129bc1c..5a77e13 100644 --- a/TypeScript/1LogToConsole/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/RagfairOfferHelper.d.ts @@ -10,6 +10,7 @@ import { ItemEventRouter } from "../routers/ItemEventRouter"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocaleService } from "../services/LocaleService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { HashUtil } from "../utils/HashUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -37,11 +38,12 @@ export declare class RagfairOfferHelper { protected ragfairSortHelper: RagfairSortHelper; protected ragfairHelper: RagfairHelper; protected ragfairOfferService: RagfairOfferService; + protected localeService: LocaleService; protected configServer: ConfigServer; protected static TPL_GOODS_SOLD: string; protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, saveServer: SaveServer, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, saveServer: SaveServer, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, configServer: ConfigServer); getValidOffers(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; getOffersForBuild(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; processOffers(sessionID: string): boolean; diff --git a/TypeScript/1LogToConsole/types/helpers/RagfairServerHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/RagfairServerHelper.d.ts index 2cb3ea5..a52306b 100644 --- a/TypeScript/1LogToConsole/types/helpers/RagfairServerHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/RagfairServerHelper.d.ts @@ -1,11 +1,12 @@ -import { MemberCategory } from "../models/enums/MemberCategory"; import { Item } from "../models/eft/common/tables/IItem"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { MemberCategory } from "../models/enums/MemberCategory"; import { IQuestConfig } from "../models/spt/config/IQuestConfig"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocaleService } from "../services/LocaleService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; @@ -19,13 +20,14 @@ export declare class RagfairServerHelper { protected databaseServer: DatabaseServer; protected profileHelper: ProfileHelper; protected itemHelper: ItemHelper; + protected localeService: LocaleService; protected dialogueHelper: DialogueHelper; protected jsonUtil: JsonUtil; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; protected static TPL_GOODS_RETURNED: string; - constructor(randomUtil: RandomUtil, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, profileHelper: ProfileHelper, itemHelper: ItemHelper, dialogueHelper: DialogueHelper, jsonUtil: JsonUtil, configServer: ConfigServer); + constructor(randomUtil: RandomUtil, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, profileHelper: ProfileHelper, itemHelper: ItemHelper, localeService: LocaleService, dialogueHelper: DialogueHelper, jsonUtil: JsonUtil, configServer: ConfigServer); /** * Is item valid / on blacklist / quest item * @param itemDetails diff --git a/TypeScript/1LogToConsole/types/helpers/RagfairSortHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/RagfairSortHelper.d.ts index e983569..d20e10c 100644 --- a/TypeScript/1LogToConsole/types/helpers/RagfairSortHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/RagfairSortHelper.d.ts @@ -1,8 +1,10 @@ import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocaleService } from "../services/LocaleService"; export declare class RagfairSortHelper { protected databaseServer: DatabaseServer; - constructor(databaseServer: DatabaseServer); + protected localeService: LocaleService; + constructor(databaseServer: DatabaseServer, localeService: LocaleService); sortOffers(offers: IRagfairOffer[], type: number, direction?: number): IRagfairOffer[]; protected sortOffersByID(a: IRagfairOffer, b: IRagfairOffer): number; protected sortOffersByRating(a: IRagfairOffer, b: IRagfairOffer): number; diff --git a/TypeScript/1LogToConsole/types/helpers/TraderHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/TraderHelper.d.ts index ab4a371..717351f 100644 --- a/TypeScript/1LogToConsole/types/helpers/TraderHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/TraderHelper.d.ts @@ -1,4 +1,6 @@ +import { FenceLevel } from "../models/eft/common/IGlobals"; import { IPmcData } from "../models/eft/common/IPmcData"; +import { Item } from "../models/eft/common/tables/IItem"; import { IBarterScheme, ITraderAssort, ITraderBase, LoyaltyLevel } from "../models/eft/common/tables/ITrader"; import { ITraderConfig } from "../models/spt/config/ITraderConfig"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -34,7 +36,48 @@ export declare class TraderHelper { */ resetTrader(sessionID: string, traderID: string): void; changeTraderDisplay(traderID: string, status: boolean, sessionID: string): void; + /** + * Get a list of items and their prices from player inventory that can be sold to a trader + * @param traderID trader id being traded with + * @param sessionID session id + * @returns IBarterScheme[][] + */ getPurchasesData(traderID: string, sessionID: string): Record; + /** + * Should item be skipped when selling to trader according to its sell categories and other checks + * @param pmcData + * @param item + * @param sellCategory + * @returns true if should NOT be sold to trader + */ + protected isItemUnSellableToTrader(pmcData: IPmcData, item: Item, sellCategory: string[]): boolean; + /** + * Can this weapon be sold to a trader with its current durabiltiy level + * @param traderID + * @param item + * @returns boolean + */ + protected isWeaponAndBelowTraderBuyDurability(traderID: string, item: Item): boolean; + /** + * Get the price of an item and all of its attached children + * Take into account bonuses/adjsutments e.g. discounts + * @param pmcData profile data + * @param item item to calculate price of + * @param buyPriceCoefficient + * @param fenceInfo fence data + * @param traderBase trader details + * @param currencyTpl Currency to get price as + * @returns price of item + children + */ + protected getAdjustedItemPrice(pmcData: IPmcData, item: Item, buyPriceCoefficient: number, fenceInfo: FenceLevel, traderBase: ITraderBase, currencyTpl: string): number; + /** + * Get the raw price of item+child items from handbook without any modification + * @param pmcData profile data + * @param item item to calculate price of + * @returns price as number + */ + protected getRawItemPrice(pmcData: IPmcData, item: Item): number; + protected getTraderDiscount(trader: ITraderBase, buyPriceCoefficient: number, fenceInfo: FenceLevel, traderID: string): number; /** * Calculate traders level based on exp amount and increment level if over threshold * @param traderID trader to process diff --git a/TypeScript/1LogToConsole/types/loaders/AfterDbModLoader.d.ts b/TypeScript/1LogToConsole/types/loaders/AfterDbModLoader.d.ts new file mode 100644 index 0000000..a9fc286 --- /dev/null +++ b/TypeScript/1LogToConsole/types/loaders/AfterDbModLoader.d.ts @@ -0,0 +1,11 @@ +import { DependencyContainer } from "tsyringe"; +import { OnLoad } from "../di/OnLoad"; +import { InitialModLoader } from "./InitialModLoader"; +export declare class AfterDbModLoader implements OnLoad { + protected initialModLoader: InitialModLoader; + constructor(initialModLoader: InitialModLoader); + onLoad(): void; + getRoute(): string; + getModPath(mod: string): string; + protected executeMods(container: DependencyContainer): void; +} diff --git a/TypeScript/1LogToConsole/types/models/enums/ConfigTypes.d.ts b/TypeScript/1LogToConsole/types/models/enums/ConfigTypes.d.ts index 6bd31e8..1c49e62 100644 --- a/TypeScript/1LogToConsole/types/models/enums/ConfigTypes.d.ts +++ b/TypeScript/1LogToConsole/types/models/enums/ConfigTypes.d.ts @@ -8,6 +8,7 @@ export declare enum ConfigTypes { IN_RAID = "aki-inraid", INSURANCE = "aki-insurance", INVENTORY = "aki-inventory", + LOCALE = "aki-locale", LOCATION = "aki-location", MATCH = "aki-match", QUEST = "aki-quest", diff --git a/TypeScript/1LogToConsole/types/models/external/IAfterDBLoadMod.d.ts b/TypeScript/1LogToConsole/types/models/external/IAfterDBLoadMod.d.ts new file mode 100644 index 0000000..7f08b9e --- /dev/null +++ b/TypeScript/1LogToConsole/types/models/external/IAfterDBLoadMod.d.ts @@ -0,0 +1,4 @@ +import { DependencyContainer } from "./tsyringe"; +export interface IAfterDBLoadMod { + loadAfterDbInit(container: DependencyContainer): void; +} diff --git a/TypeScript/1LogToConsole/types/models/external/mod.d.ts b/TypeScript/1LogToConsole/types/models/external/mod.d.ts index ecef460..47939e9 100644 --- a/TypeScript/1LogToConsole/types/models/external/mod.d.ts +++ b/TypeScript/1LogToConsole/types/models/external/mod.d.ts @@ -1,5 +1,5 @@ import { DependencyContainer } from "./tsyringe"; export interface IMod { - load: (container: DependencyContainer) => void; - delayedLoad: (container: DependencyContainer) => void; + load(container: DependencyContainer): void; + delayedLoad(container: DependencyContainer): void; } diff --git a/TypeScript/1LogToConsole/types/models/spt/config/ILocaleConfig.d.ts b/TypeScript/1LogToConsole/types/models/spt/config/ILocaleConfig.d.ts new file mode 100644 index 0000000..fe9abf7 --- /dev/null +++ b/TypeScript/1LogToConsole/types/models/spt/config/ILocaleConfig.d.ts @@ -0,0 +1,5 @@ +import { IBaseConfig } from "./IBaseConfig"; +export interface ILocaleConfig extends IBaseConfig { + kind: "aki-locale"; + desiredLocale: string; +} diff --git a/TypeScript/1LogToConsole/types/models/spt/logging/LogBackgroundColor.d.ts b/TypeScript/1LogToConsole/types/models/spt/logging/LogBackgroundColor.d.ts new file mode 100644 index 0000000..87e08a9 --- /dev/null +++ b/TypeScript/1LogToConsole/types/models/spt/logging/LogBackgroundColor.d.ts @@ -0,0 +1,11 @@ +export declare enum LogBackgroundColor { + default = "", + black = "blackBG", + red = "redBG", + green = "greenBG", + yellow = "yellowBG", + blue = "blueBG", + magenta = "magentaBG", + cyan = "cyanBG", + white = "whiteBG" +} diff --git a/TypeScript/1LogToConsole/types/models/spt/logging/LogTextColor.d.ts b/TypeScript/1LogToConsole/types/models/spt/logging/LogTextColor.d.ts new file mode 100644 index 0000000..7147ae3 --- /dev/null +++ b/TypeScript/1LogToConsole/types/models/spt/logging/LogTextColor.d.ts @@ -0,0 +1,11 @@ +export declare enum LogTextColor { + black = "black", + red = "red", + green = "green", + yellow = "yellow", + blue = "blue", + magenta = "magenta", + cyan = "cyan", + white = "white", + gray = "" +} diff --git a/TypeScript/1LogToConsole/types/models/spt/logging/SptLogger.d.ts b/TypeScript/1LogToConsole/types/models/spt/logging/SptLogger.d.ts new file mode 100644 index 0000000..ea1b3d8 --- /dev/null +++ b/TypeScript/1LogToConsole/types/models/spt/logging/SptLogger.d.ts @@ -0,0 +1,7 @@ +export interface SptLogger { + error: (msg: string | Record) => void; + warn: (msg: string | Record) => void; + succ?: (msg: string | Record) => void; + info: (msg: string | Record) => void; + debug: (msg: string | Record) => void; +} diff --git a/TypeScript/1LogToConsole/types/models/spt/utils/ILogger.d.ts b/TypeScript/1LogToConsole/types/models/spt/utils/ILogger.d.ts index c983701..2af3fac 100644 --- a/TypeScript/1LogToConsole/types/models/spt/utils/ILogger.d.ts +++ b/TypeScript/1LogToConsole/types/models/spt/utils/ILogger.d.ts @@ -1,7 +1,10 @@ import { Daum } from "../../eft/itemEvent/IItemEventRouterRequest"; +import { LogBackgroundColor } from "../logging/LogBackgroundColor"; +import { LogTextColor } from "../logging/LogTextColor"; export interface ILogger { writeToLogFile(data: string | Daum): void; - log(data: string | Record | Error, color: string): void; + log(data: string | Record | Error, color: string, backgroundColor?: string): void; + logWithColor(data: string | Record, textColor: LogTextColor, backgroundColor?: LogBackgroundColor): void; error(data: string): void; warning(data: string): void; success(data: string): void; diff --git a/TypeScript/1LogToConsole/types/services/FenceService.d.ts b/TypeScript/1LogToConsole/types/services/FenceService.d.ts index 12723fb..79058c6 100644 --- a/TypeScript/1LogToConsole/types/services/FenceService.d.ts +++ b/TypeScript/1LogToConsole/types/services/FenceService.d.ts @@ -29,8 +29,8 @@ export declare class FenceService { hasExpiredCache(refreshAssort: boolean): boolean; generateFenceAssortCache(pmcData: IPmcData): void; /** - * - * @param pmcData Get the fence level the passed in profile has + * Get the fence level the passed in profile has + * @param pmcData Player profile * @returns FenceLevel */ getFenceInfo(pmcData: IPmcData): FenceLevel; diff --git a/TypeScript/1LogToConsole/types/services/LocaleService.d.ts b/TypeScript/1LogToConsole/types/services/LocaleService.d.ts new file mode 100644 index 0000000..33bea7b --- /dev/null +++ b/TypeScript/1LogToConsole/types/services/LocaleService.d.ts @@ -0,0 +1,14 @@ +import { ILocaleConfig } from "../models/spt/config/ILocaleConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +export declare class LocaleService { + protected logger: ILogger; + protected configServer: ConfigServer; + protected localeConfig: ILocaleConfig; + constructor(logger: ILogger, configServer: ConfigServer); + /** + * Gets the locale key from the locale.json file + * @returns locale e.g en/ge/cz/cn + */ + getDesiredLocale(): string; +} diff --git a/TypeScript/1LogToConsole/types/utils/DatabaseImporter.d.ts b/TypeScript/1LogToConsole/types/utils/DatabaseImporter.d.ts index 24c1cd6..b3156ea 100644 --- a/TypeScript/1LogToConsole/types/utils/DatabaseImporter.d.ts +++ b/TypeScript/1LogToConsole/types/utils/DatabaseImporter.d.ts @@ -5,7 +5,7 @@ import { ImageRouter } from "../routers/ImageRouter"; import { DatabaseServer } from "../servers/DatabaseServer"; import { CustomHandbookItemService } from "../services/CustomHandbookItemService"; import { CustomItemService } from "../services/CustomItemService"; -import { CustomPresetService } from "../services/customPresetService"; +import { CustomPresetService } from "../services/CustomPresetService"; import { CustomTraderAssortService } from "../services/CustomTraderAssortService"; import { JsonUtil } from "./JsonUtil"; import { VFS } from "./VFS"; diff --git a/TypeScript/1LogToConsole/types/utils/Logger.d.ts b/TypeScript/1LogToConsole/types/utils/Logger.d.ts index f5b774b..3d9013f 100644 --- a/TypeScript/1LogToConsole/types/utils/Logger.d.ts +++ b/TypeScript/1LogToConsole/types/utils/Logger.d.ts @@ -1,17 +1,13 @@ /// -import { Daum } from "../models/eft/itemEvent/IItemEventRouterRequest"; -import { ILogger } from "../models/spt/utils/ILogger"; -import winston from "winston"; -import { IAsyncQueue } from "../models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "../models/spt/utils/IUuidGenerator"; import fs from "fs"; -interface SptLogger { - error: (msg: string | Record) => void; - warn: (msg: string | Record) => void; - succ?: (msg: string | Record) => void; - info: (msg: string | Record) => void; - debug: (msg: string | Record) => void; -} +import winston from "winston"; +import { Daum } from "../models/eft/itemEvent/IItemEventRouterRequest"; +import { LogBackgroundColor } from "../models/spt/logging/LogBackgroundColor"; +import { LogTextColor } from "../models/spt/logging/LogTextColor"; +import { SptLogger } from "../models/spt/logging/SptLogger"; +import { IAsyncQueue } from "../models/spt/utils/IAsyncQueue"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { IUUidGenerator } from "../models/spt/utils/IUuidGenerator"; export declare class WinstonLogger implements ILogger { protected asyncQueue: IAsyncQueue; protected uuidGenerator: IUUidGenerator; @@ -36,16 +32,27 @@ export declare class WinstonLogger implements ILogger { custom: string; debug: string; }; + bgColors: { + default: string; + blackBG: string; + redBG: string; + greenBG: string; + yellowBG: string; + blueBG: string; + magentaBG: string; + cyanBG: string; + whiteBG: string; + }; }; protected logger: winston.Logger & SptLogger; - writeFilePromisify: (path: fs.PathLike, data: string, options?: any) => Promise; + protected writeFilePromisify: (path: fs.PathLike, data: string, options?: any) => Promise; constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); writeToLogFile(data: string | Daum): Promise; - log(data: string | Error | Record, color: string): Promise; + log(data: string | Error | Record, color: string, backgroundColor?: string): Promise; error(data: string | Record): Promise; warning(data: string | Record): Promise; success(data: string | Record): Promise; info(data: string | Record): Promise; + logWithColor(data: string | Record, textColor: LogTextColor, backgroundColor?: LogBackgroundColor): Promise; debug(data: string | Record, onlyShowInConsole?: boolean): Promise; } -export {}; diff --git a/TypeScript/2EditDatabase/types/controllers/GameController.d.ts b/TypeScript/2EditDatabase/types/controllers/GameController.d.ts index 7f632d6..5f516de 100644 --- a/TypeScript/2EditDatabase/types/controllers/GameController.d.ts +++ b/TypeScript/2EditDatabase/types/controllers/GameController.d.ts @@ -6,19 +6,23 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { IPmcDataRepeatableQuest, IRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; import { IGameConfigResponse } from "../models/eft/game/IGameConfigResponse"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; +import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { LocaleService } from "../services/LocaleService"; import { Watermark } from "../utils/Watermark"; export declare class GameController { protected logger: ILogger; protected watermark: Watermark; protected httpServerHelper: HttpServerHelper; + protected localeService: LocaleService; protected profileHelper: ProfileHelper; protected gameHelper: GameHelper; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; - constructor(logger: ILogger, watermark: Watermark, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper, gameHelper: GameHelper, configServer: ConfigServer); + protected coreConfig: ICoreConfig; + constructor(logger: ILogger, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, gameHelper: GameHelper, configServer: ConfigServer); gameStart(_url: string, _info: IEmptyRequestData, sessionID: string): void; protected addMissingBonusesProperty(pmcProfile: IPmcData): void; protected addMissingRepeatableQuestsProperty(pmcProfile: IPmcData): void; diff --git a/TypeScript/2EditDatabase/types/controllers/QuestController.d.ts b/TypeScript/2EditDatabase/types/controllers/QuestController.d.ts index c00cd6d..2cbccfb 100644 --- a/TypeScript/2EditDatabase/types/controllers/QuestController.d.ts +++ b/TypeScript/2EditDatabase/types/controllers/QuestController.d.ts @@ -14,6 +14,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ItemEventRouter } from "../routers/ItemEventRouter"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocaleService } from "../services/LocaleService"; import { PlayerService } from "../services/PlayerService"; import { TimeUtil } from "../utils/TimeUtil"; export declare class QuestController { @@ -27,9 +28,10 @@ export declare class QuestController { protected questHelper: QuestHelper; protected questConditionHelper: QuestConditionHelper; protected playerService: PlayerService; + protected localeService: LocaleService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, itemHelper: ItemHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, questConditionHelper: QuestConditionHelper, playerService: PlayerService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, itemHelper: ItemHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, questConditionHelper: QuestConditionHelper, playerService: PlayerService, localeService: LocaleService, configServer: ConfigServer); /** * Get all quests visible to player * Exclude quests with incomplete preconditions (level/loyalty) diff --git a/TypeScript/2EditDatabase/types/helpers/ItemHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/ItemHelper.d.ts index 70c88d6..4fff11e 100644 --- a/TypeScript/2EditDatabase/types/helpers/ItemHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/ItemHelper.d.ts @@ -84,6 +84,11 @@ declare class ItemHelper { */ generateItemsFromStackSlot(item: ITemplateItem, parentId: string): Item[]; getItem(tpl: string): [boolean, ITemplateItem]; + /** + * get normalized value (0-1) based on item condition + * @param item + * @returns number between 0 and 1 + */ getItemQualityModifier(item: Item): number; findAndReturnChildrenByItems(items: Item[], itemID: string): string[]; /** diff --git a/TypeScript/2EditDatabase/types/helpers/QuestHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/QuestHelper.d.ts index 04ede16..d6e382b 100644 --- a/TypeScript/2EditDatabase/types/helpers/QuestHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/QuestHelper.d.ts @@ -8,6 +8,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ItemEventRouter } from "../routers/ItemEventRouter"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocaleService } from "../services/LocaleService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -25,6 +26,7 @@ export declare class QuestHelper { protected itemHelper: ItemHelper; protected itemEventRouter: ItemEventRouter; protected databaseServer: DatabaseServer; + protected localeService: LocaleService; protected ragfairServerHelper: RagfairServerHelper; protected dialogueHelper: DialogueHelper; protected profileHelper: ProfileHelper; @@ -32,7 +34,7 @@ export declare class QuestHelper { protected traderHelper: TraderHelper; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, traderHelper: TraderHelper, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, traderHelper: TraderHelper, configServer: ConfigServer); static get STATUS(): Record; questStatus(pmcData: IPmcData, questID: string): string; /** @@ -74,7 +76,7 @@ export declare class QuestHelper { cleanQuestConditions(quest: IQuest): IQuest; failQuest(pmcData: IPmcData, body: any, sessionID: string): any; getQuestFromDb(questId: string, pmcData: IPmcData): IQuest; - getQuestLocaleIdFromDb(messageId: string, localisation?: string): string; + getQuestLocaleIdFromDb(messageId: string): string; applyQuestReward(pmcData: IPmcData, body: ICompleteQuestRequestData, state: string, sessionID: string): Reward[]; /** * Get the intel center bonus a player has diff --git a/TypeScript/2EditDatabase/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/RagfairOfferHelper.d.ts index 129bc1c..5a77e13 100644 --- a/TypeScript/2EditDatabase/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/RagfairOfferHelper.d.ts @@ -10,6 +10,7 @@ import { ItemEventRouter } from "../routers/ItemEventRouter"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocaleService } from "../services/LocaleService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { HashUtil } from "../utils/HashUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -37,11 +38,12 @@ export declare class RagfairOfferHelper { protected ragfairSortHelper: RagfairSortHelper; protected ragfairHelper: RagfairHelper; protected ragfairOfferService: RagfairOfferService; + protected localeService: LocaleService; protected configServer: ConfigServer; protected static TPL_GOODS_SOLD: string; protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, saveServer: SaveServer, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, saveServer: SaveServer, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, configServer: ConfigServer); getValidOffers(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; getOffersForBuild(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; processOffers(sessionID: string): boolean; diff --git a/TypeScript/2EditDatabase/types/helpers/RagfairServerHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/RagfairServerHelper.d.ts index 2cb3ea5..a52306b 100644 --- a/TypeScript/2EditDatabase/types/helpers/RagfairServerHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/RagfairServerHelper.d.ts @@ -1,11 +1,12 @@ -import { MemberCategory } from "../models/enums/MemberCategory"; import { Item } from "../models/eft/common/tables/IItem"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { MemberCategory } from "../models/enums/MemberCategory"; import { IQuestConfig } from "../models/spt/config/IQuestConfig"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocaleService } from "../services/LocaleService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; @@ -19,13 +20,14 @@ export declare class RagfairServerHelper { protected databaseServer: DatabaseServer; protected profileHelper: ProfileHelper; protected itemHelper: ItemHelper; + protected localeService: LocaleService; protected dialogueHelper: DialogueHelper; protected jsonUtil: JsonUtil; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; protected static TPL_GOODS_RETURNED: string; - constructor(randomUtil: RandomUtil, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, profileHelper: ProfileHelper, itemHelper: ItemHelper, dialogueHelper: DialogueHelper, jsonUtil: JsonUtil, configServer: ConfigServer); + constructor(randomUtil: RandomUtil, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, profileHelper: ProfileHelper, itemHelper: ItemHelper, localeService: LocaleService, dialogueHelper: DialogueHelper, jsonUtil: JsonUtil, configServer: ConfigServer); /** * Is item valid / on blacklist / quest item * @param itemDetails diff --git a/TypeScript/2EditDatabase/types/helpers/RagfairSortHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/RagfairSortHelper.d.ts index e983569..d20e10c 100644 --- a/TypeScript/2EditDatabase/types/helpers/RagfairSortHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/RagfairSortHelper.d.ts @@ -1,8 +1,10 @@ import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocaleService } from "../services/LocaleService"; export declare class RagfairSortHelper { protected databaseServer: DatabaseServer; - constructor(databaseServer: DatabaseServer); + protected localeService: LocaleService; + constructor(databaseServer: DatabaseServer, localeService: LocaleService); sortOffers(offers: IRagfairOffer[], type: number, direction?: number): IRagfairOffer[]; protected sortOffersByID(a: IRagfairOffer, b: IRagfairOffer): number; protected sortOffersByRating(a: IRagfairOffer, b: IRagfairOffer): number; diff --git a/TypeScript/2EditDatabase/types/helpers/TraderHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/TraderHelper.d.ts index ab4a371..717351f 100644 --- a/TypeScript/2EditDatabase/types/helpers/TraderHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/TraderHelper.d.ts @@ -1,4 +1,6 @@ +import { FenceLevel } from "../models/eft/common/IGlobals"; import { IPmcData } from "../models/eft/common/IPmcData"; +import { Item } from "../models/eft/common/tables/IItem"; import { IBarterScheme, ITraderAssort, ITraderBase, LoyaltyLevel } from "../models/eft/common/tables/ITrader"; import { ITraderConfig } from "../models/spt/config/ITraderConfig"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -34,7 +36,48 @@ export declare class TraderHelper { */ resetTrader(sessionID: string, traderID: string): void; changeTraderDisplay(traderID: string, status: boolean, sessionID: string): void; + /** + * Get a list of items and their prices from player inventory that can be sold to a trader + * @param traderID trader id being traded with + * @param sessionID session id + * @returns IBarterScheme[][] + */ getPurchasesData(traderID: string, sessionID: string): Record; + /** + * Should item be skipped when selling to trader according to its sell categories and other checks + * @param pmcData + * @param item + * @param sellCategory + * @returns true if should NOT be sold to trader + */ + protected isItemUnSellableToTrader(pmcData: IPmcData, item: Item, sellCategory: string[]): boolean; + /** + * Can this weapon be sold to a trader with its current durabiltiy level + * @param traderID + * @param item + * @returns boolean + */ + protected isWeaponAndBelowTraderBuyDurability(traderID: string, item: Item): boolean; + /** + * Get the price of an item and all of its attached children + * Take into account bonuses/adjsutments e.g. discounts + * @param pmcData profile data + * @param item item to calculate price of + * @param buyPriceCoefficient + * @param fenceInfo fence data + * @param traderBase trader details + * @param currencyTpl Currency to get price as + * @returns price of item + children + */ + protected getAdjustedItemPrice(pmcData: IPmcData, item: Item, buyPriceCoefficient: number, fenceInfo: FenceLevel, traderBase: ITraderBase, currencyTpl: string): number; + /** + * Get the raw price of item+child items from handbook without any modification + * @param pmcData profile data + * @param item item to calculate price of + * @returns price as number + */ + protected getRawItemPrice(pmcData: IPmcData, item: Item): number; + protected getTraderDiscount(trader: ITraderBase, buyPriceCoefficient: number, fenceInfo: FenceLevel, traderID: string): number; /** * Calculate traders level based on exp amount and increment level if over threshold * @param traderID trader to process diff --git a/TypeScript/2EditDatabase/types/loaders/AfterDbModLoader.d.ts b/TypeScript/2EditDatabase/types/loaders/AfterDbModLoader.d.ts new file mode 100644 index 0000000..a9fc286 --- /dev/null +++ b/TypeScript/2EditDatabase/types/loaders/AfterDbModLoader.d.ts @@ -0,0 +1,11 @@ +import { DependencyContainer } from "tsyringe"; +import { OnLoad } from "../di/OnLoad"; +import { InitialModLoader } from "./InitialModLoader"; +export declare class AfterDbModLoader implements OnLoad { + protected initialModLoader: InitialModLoader; + constructor(initialModLoader: InitialModLoader); + onLoad(): void; + getRoute(): string; + getModPath(mod: string): string; + protected executeMods(container: DependencyContainer): void; +} diff --git a/TypeScript/2EditDatabase/types/models/enums/ConfigTypes.d.ts b/TypeScript/2EditDatabase/types/models/enums/ConfigTypes.d.ts index 6bd31e8..1c49e62 100644 --- a/TypeScript/2EditDatabase/types/models/enums/ConfigTypes.d.ts +++ b/TypeScript/2EditDatabase/types/models/enums/ConfigTypes.d.ts @@ -8,6 +8,7 @@ export declare enum ConfigTypes { IN_RAID = "aki-inraid", INSURANCE = "aki-insurance", INVENTORY = "aki-inventory", + LOCALE = "aki-locale", LOCATION = "aki-location", MATCH = "aki-match", QUEST = "aki-quest", diff --git a/TypeScript/2EditDatabase/types/models/external/IAfterDBLoadMod.d.ts b/TypeScript/2EditDatabase/types/models/external/IAfterDBLoadMod.d.ts new file mode 100644 index 0000000..7f08b9e --- /dev/null +++ b/TypeScript/2EditDatabase/types/models/external/IAfterDBLoadMod.d.ts @@ -0,0 +1,4 @@ +import { DependencyContainer } from "./tsyringe"; +export interface IAfterDBLoadMod { + loadAfterDbInit(container: DependencyContainer): void; +} diff --git a/TypeScript/2EditDatabase/types/models/external/mod.d.ts b/TypeScript/2EditDatabase/types/models/external/mod.d.ts index ecef460..47939e9 100644 --- a/TypeScript/2EditDatabase/types/models/external/mod.d.ts +++ b/TypeScript/2EditDatabase/types/models/external/mod.d.ts @@ -1,5 +1,5 @@ import { DependencyContainer } from "./tsyringe"; export interface IMod { - load: (container: DependencyContainer) => void; - delayedLoad: (container: DependencyContainer) => void; + load(container: DependencyContainer): void; + delayedLoad(container: DependencyContainer): void; } diff --git a/TypeScript/2EditDatabase/types/models/spt/config/ILocaleConfig.d.ts b/TypeScript/2EditDatabase/types/models/spt/config/ILocaleConfig.d.ts new file mode 100644 index 0000000..fe9abf7 --- /dev/null +++ b/TypeScript/2EditDatabase/types/models/spt/config/ILocaleConfig.d.ts @@ -0,0 +1,5 @@ +import { IBaseConfig } from "./IBaseConfig"; +export interface ILocaleConfig extends IBaseConfig { + kind: "aki-locale"; + desiredLocale: string; +} diff --git a/TypeScript/2EditDatabase/types/models/spt/logging/LogBackgroundColor.d.ts b/TypeScript/2EditDatabase/types/models/spt/logging/LogBackgroundColor.d.ts new file mode 100644 index 0000000..87e08a9 --- /dev/null +++ b/TypeScript/2EditDatabase/types/models/spt/logging/LogBackgroundColor.d.ts @@ -0,0 +1,11 @@ +export declare enum LogBackgroundColor { + default = "", + black = "blackBG", + red = "redBG", + green = "greenBG", + yellow = "yellowBG", + blue = "blueBG", + magenta = "magentaBG", + cyan = "cyanBG", + white = "whiteBG" +} diff --git a/TypeScript/2EditDatabase/types/models/spt/logging/LogTextColor.d.ts b/TypeScript/2EditDatabase/types/models/spt/logging/LogTextColor.d.ts new file mode 100644 index 0000000..7147ae3 --- /dev/null +++ b/TypeScript/2EditDatabase/types/models/spt/logging/LogTextColor.d.ts @@ -0,0 +1,11 @@ +export declare enum LogTextColor { + black = "black", + red = "red", + green = "green", + yellow = "yellow", + blue = "blue", + magenta = "magenta", + cyan = "cyan", + white = "white", + gray = "" +} diff --git a/TypeScript/2EditDatabase/types/models/spt/logging/SptLogger.d.ts b/TypeScript/2EditDatabase/types/models/spt/logging/SptLogger.d.ts new file mode 100644 index 0000000..ea1b3d8 --- /dev/null +++ b/TypeScript/2EditDatabase/types/models/spt/logging/SptLogger.d.ts @@ -0,0 +1,7 @@ +export interface SptLogger { + error: (msg: string | Record) => void; + warn: (msg: string | Record) => void; + succ?: (msg: string | Record) => void; + info: (msg: string | Record) => void; + debug: (msg: string | Record) => void; +} diff --git a/TypeScript/2EditDatabase/types/models/spt/utils/ILogger.d.ts b/TypeScript/2EditDatabase/types/models/spt/utils/ILogger.d.ts index c983701..2af3fac 100644 --- a/TypeScript/2EditDatabase/types/models/spt/utils/ILogger.d.ts +++ b/TypeScript/2EditDatabase/types/models/spt/utils/ILogger.d.ts @@ -1,7 +1,10 @@ import { Daum } from "../../eft/itemEvent/IItemEventRouterRequest"; +import { LogBackgroundColor } from "../logging/LogBackgroundColor"; +import { LogTextColor } from "../logging/LogTextColor"; export interface ILogger { writeToLogFile(data: string | Daum): void; - log(data: string | Record | Error, color: string): void; + log(data: string | Record | Error, color: string, backgroundColor?: string): void; + logWithColor(data: string | Record, textColor: LogTextColor, backgroundColor?: LogBackgroundColor): void; error(data: string): void; warning(data: string): void; success(data: string): void; diff --git a/TypeScript/2EditDatabase/types/services/FenceService.d.ts b/TypeScript/2EditDatabase/types/services/FenceService.d.ts index 12723fb..79058c6 100644 --- a/TypeScript/2EditDatabase/types/services/FenceService.d.ts +++ b/TypeScript/2EditDatabase/types/services/FenceService.d.ts @@ -29,8 +29,8 @@ export declare class FenceService { hasExpiredCache(refreshAssort: boolean): boolean; generateFenceAssortCache(pmcData: IPmcData): void; /** - * - * @param pmcData Get the fence level the passed in profile has + * Get the fence level the passed in profile has + * @param pmcData Player profile * @returns FenceLevel */ getFenceInfo(pmcData: IPmcData): FenceLevel; diff --git a/TypeScript/2EditDatabase/types/services/LocaleService.d.ts b/TypeScript/2EditDatabase/types/services/LocaleService.d.ts new file mode 100644 index 0000000..33bea7b --- /dev/null +++ b/TypeScript/2EditDatabase/types/services/LocaleService.d.ts @@ -0,0 +1,14 @@ +import { ILocaleConfig } from "../models/spt/config/ILocaleConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +export declare class LocaleService { + protected logger: ILogger; + protected configServer: ConfigServer; + protected localeConfig: ILocaleConfig; + constructor(logger: ILogger, configServer: ConfigServer); + /** + * Gets the locale key from the locale.json file + * @returns locale e.g en/ge/cz/cn + */ + getDesiredLocale(): string; +} diff --git a/TypeScript/2EditDatabase/types/utils/DatabaseImporter.d.ts b/TypeScript/2EditDatabase/types/utils/DatabaseImporter.d.ts index 24c1cd6..b3156ea 100644 --- a/TypeScript/2EditDatabase/types/utils/DatabaseImporter.d.ts +++ b/TypeScript/2EditDatabase/types/utils/DatabaseImporter.d.ts @@ -5,7 +5,7 @@ import { ImageRouter } from "../routers/ImageRouter"; import { DatabaseServer } from "../servers/DatabaseServer"; import { CustomHandbookItemService } from "../services/CustomHandbookItemService"; import { CustomItemService } from "../services/CustomItemService"; -import { CustomPresetService } from "../services/customPresetService"; +import { CustomPresetService } from "../services/CustomPresetService"; import { CustomTraderAssortService } from "../services/CustomTraderAssortService"; import { JsonUtil } from "./JsonUtil"; import { VFS } from "./VFS"; diff --git a/TypeScript/2EditDatabase/types/utils/Logger.d.ts b/TypeScript/2EditDatabase/types/utils/Logger.d.ts index f5b774b..3d9013f 100644 --- a/TypeScript/2EditDatabase/types/utils/Logger.d.ts +++ b/TypeScript/2EditDatabase/types/utils/Logger.d.ts @@ -1,17 +1,13 @@ /// -import { Daum } from "../models/eft/itemEvent/IItemEventRouterRequest"; -import { ILogger } from "../models/spt/utils/ILogger"; -import winston from "winston"; -import { IAsyncQueue } from "../models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "../models/spt/utils/IUuidGenerator"; import fs from "fs"; -interface SptLogger { - error: (msg: string | Record) => void; - warn: (msg: string | Record) => void; - succ?: (msg: string | Record) => void; - info: (msg: string | Record) => void; - debug: (msg: string | Record) => void; -} +import winston from "winston"; +import { Daum } from "../models/eft/itemEvent/IItemEventRouterRequest"; +import { LogBackgroundColor } from "../models/spt/logging/LogBackgroundColor"; +import { LogTextColor } from "../models/spt/logging/LogTextColor"; +import { SptLogger } from "../models/spt/logging/SptLogger"; +import { IAsyncQueue } from "../models/spt/utils/IAsyncQueue"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { IUUidGenerator } from "../models/spt/utils/IUuidGenerator"; export declare class WinstonLogger implements ILogger { protected asyncQueue: IAsyncQueue; protected uuidGenerator: IUUidGenerator; @@ -36,16 +32,27 @@ export declare class WinstonLogger implements ILogger { custom: string; debug: string; }; + bgColors: { + default: string; + blackBG: string; + redBG: string; + greenBG: string; + yellowBG: string; + blueBG: string; + magentaBG: string; + cyanBG: string; + whiteBG: string; + }; }; protected logger: winston.Logger & SptLogger; - writeFilePromisify: (path: fs.PathLike, data: string, options?: any) => Promise; + protected writeFilePromisify: (path: fs.PathLike, data: string, options?: any) => Promise; constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); writeToLogFile(data: string | Daum): Promise; - log(data: string | Error | Record, color: string): Promise; + log(data: string | Error | Record, color: string, backgroundColor?: string): Promise; error(data: string | Record): Promise; warning(data: string | Record): Promise; success(data: string | Record): Promise; info(data: string | Record): Promise; + logWithColor(data: string | Record, textColor: LogTextColor, backgroundColor?: LogBackgroundColor): Promise; debug(data: string | Record, onlyShowInConsole?: boolean): Promise; } -export {}; diff --git a/TypeScript/3.0GetSptConfigFile/types/controllers/GameController.d.ts b/TypeScript/3.0GetSptConfigFile/types/controllers/GameController.d.ts index 7f632d6..5f516de 100644 --- a/TypeScript/3.0GetSptConfigFile/types/controllers/GameController.d.ts +++ b/TypeScript/3.0GetSptConfigFile/types/controllers/GameController.d.ts @@ -6,19 +6,23 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { IPmcDataRepeatableQuest, IRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; import { IGameConfigResponse } from "../models/eft/game/IGameConfigResponse"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; +import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { LocaleService } from "../services/LocaleService"; import { Watermark } from "../utils/Watermark"; export declare class GameController { protected logger: ILogger; protected watermark: Watermark; protected httpServerHelper: HttpServerHelper; + protected localeService: LocaleService; protected profileHelper: ProfileHelper; protected gameHelper: GameHelper; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; - constructor(logger: ILogger, watermark: Watermark, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper, gameHelper: GameHelper, configServer: ConfigServer); + protected coreConfig: ICoreConfig; + constructor(logger: ILogger, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, gameHelper: GameHelper, configServer: ConfigServer); gameStart(_url: string, _info: IEmptyRequestData, sessionID: string): void; protected addMissingBonusesProperty(pmcProfile: IPmcData): void; protected addMissingRepeatableQuestsProperty(pmcProfile: IPmcData): void; diff --git a/TypeScript/3.0GetSptConfigFile/types/controllers/QuestController.d.ts b/TypeScript/3.0GetSptConfigFile/types/controllers/QuestController.d.ts index c00cd6d..2cbccfb 100644 --- a/TypeScript/3.0GetSptConfigFile/types/controllers/QuestController.d.ts +++ b/TypeScript/3.0GetSptConfigFile/types/controllers/QuestController.d.ts @@ -14,6 +14,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ItemEventRouter } from "../routers/ItemEventRouter"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocaleService } from "../services/LocaleService"; import { PlayerService } from "../services/PlayerService"; import { TimeUtil } from "../utils/TimeUtil"; export declare class QuestController { @@ -27,9 +28,10 @@ export declare class QuestController { protected questHelper: QuestHelper; protected questConditionHelper: QuestConditionHelper; protected playerService: PlayerService; + protected localeService: LocaleService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, itemHelper: ItemHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, questConditionHelper: QuestConditionHelper, playerService: PlayerService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, itemHelper: ItemHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, questConditionHelper: QuestConditionHelper, playerService: PlayerService, localeService: LocaleService, configServer: ConfigServer); /** * Get all quests visible to player * Exclude quests with incomplete preconditions (level/loyalty) diff --git a/TypeScript/3.0GetSptConfigFile/types/helpers/ItemHelper.d.ts b/TypeScript/3.0GetSptConfigFile/types/helpers/ItemHelper.d.ts index 70c88d6..4fff11e 100644 --- a/TypeScript/3.0GetSptConfigFile/types/helpers/ItemHelper.d.ts +++ b/TypeScript/3.0GetSptConfigFile/types/helpers/ItemHelper.d.ts @@ -84,6 +84,11 @@ declare class ItemHelper { */ generateItemsFromStackSlot(item: ITemplateItem, parentId: string): Item[]; getItem(tpl: string): [boolean, ITemplateItem]; + /** + * get normalized value (0-1) based on item condition + * @param item + * @returns number between 0 and 1 + */ getItemQualityModifier(item: Item): number; findAndReturnChildrenByItems(items: Item[], itemID: string): string[]; /** diff --git a/TypeScript/3.0GetSptConfigFile/types/helpers/QuestHelper.d.ts b/TypeScript/3.0GetSptConfigFile/types/helpers/QuestHelper.d.ts index 04ede16..d6e382b 100644 --- a/TypeScript/3.0GetSptConfigFile/types/helpers/QuestHelper.d.ts +++ b/TypeScript/3.0GetSptConfigFile/types/helpers/QuestHelper.d.ts @@ -8,6 +8,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ItemEventRouter } from "../routers/ItemEventRouter"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocaleService } from "../services/LocaleService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -25,6 +26,7 @@ export declare class QuestHelper { protected itemHelper: ItemHelper; protected itemEventRouter: ItemEventRouter; protected databaseServer: DatabaseServer; + protected localeService: LocaleService; protected ragfairServerHelper: RagfairServerHelper; protected dialogueHelper: DialogueHelper; protected profileHelper: ProfileHelper; @@ -32,7 +34,7 @@ export declare class QuestHelper { protected traderHelper: TraderHelper; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, traderHelper: TraderHelper, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, traderHelper: TraderHelper, configServer: ConfigServer); static get STATUS(): Record; questStatus(pmcData: IPmcData, questID: string): string; /** @@ -74,7 +76,7 @@ export declare class QuestHelper { cleanQuestConditions(quest: IQuest): IQuest; failQuest(pmcData: IPmcData, body: any, sessionID: string): any; getQuestFromDb(questId: string, pmcData: IPmcData): IQuest; - getQuestLocaleIdFromDb(messageId: string, localisation?: string): string; + getQuestLocaleIdFromDb(messageId: string): string; applyQuestReward(pmcData: IPmcData, body: ICompleteQuestRequestData, state: string, sessionID: string): Reward[]; /** * Get the intel center bonus a player has diff --git a/TypeScript/3.0GetSptConfigFile/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/3.0GetSptConfigFile/types/helpers/RagfairOfferHelper.d.ts index 129bc1c..5a77e13 100644 --- a/TypeScript/3.0GetSptConfigFile/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/3.0GetSptConfigFile/types/helpers/RagfairOfferHelper.d.ts @@ -10,6 +10,7 @@ import { ItemEventRouter } from "../routers/ItemEventRouter"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocaleService } from "../services/LocaleService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { HashUtil } from "../utils/HashUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -37,11 +38,12 @@ export declare class RagfairOfferHelper { protected ragfairSortHelper: RagfairSortHelper; protected ragfairHelper: RagfairHelper; protected ragfairOfferService: RagfairOfferService; + protected localeService: LocaleService; protected configServer: ConfigServer; protected static TPL_GOODS_SOLD: string; protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, saveServer: SaveServer, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, saveServer: SaveServer, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, configServer: ConfigServer); getValidOffers(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; getOffersForBuild(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; processOffers(sessionID: string): boolean; diff --git a/TypeScript/3.0GetSptConfigFile/types/helpers/RagfairServerHelper.d.ts b/TypeScript/3.0GetSptConfigFile/types/helpers/RagfairServerHelper.d.ts index 2cb3ea5..a52306b 100644 --- a/TypeScript/3.0GetSptConfigFile/types/helpers/RagfairServerHelper.d.ts +++ b/TypeScript/3.0GetSptConfigFile/types/helpers/RagfairServerHelper.d.ts @@ -1,11 +1,12 @@ -import { MemberCategory } from "../models/enums/MemberCategory"; import { Item } from "../models/eft/common/tables/IItem"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { MemberCategory } from "../models/enums/MemberCategory"; import { IQuestConfig } from "../models/spt/config/IQuestConfig"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocaleService } from "../services/LocaleService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; @@ -19,13 +20,14 @@ export declare class RagfairServerHelper { protected databaseServer: DatabaseServer; protected profileHelper: ProfileHelper; protected itemHelper: ItemHelper; + protected localeService: LocaleService; protected dialogueHelper: DialogueHelper; protected jsonUtil: JsonUtil; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; protected static TPL_GOODS_RETURNED: string; - constructor(randomUtil: RandomUtil, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, profileHelper: ProfileHelper, itemHelper: ItemHelper, dialogueHelper: DialogueHelper, jsonUtil: JsonUtil, configServer: ConfigServer); + constructor(randomUtil: RandomUtil, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, profileHelper: ProfileHelper, itemHelper: ItemHelper, localeService: LocaleService, dialogueHelper: DialogueHelper, jsonUtil: JsonUtil, configServer: ConfigServer); /** * Is item valid / on blacklist / quest item * @param itemDetails diff --git a/TypeScript/3.0GetSptConfigFile/types/helpers/RagfairSortHelper.d.ts b/TypeScript/3.0GetSptConfigFile/types/helpers/RagfairSortHelper.d.ts index e983569..d20e10c 100644 --- a/TypeScript/3.0GetSptConfigFile/types/helpers/RagfairSortHelper.d.ts +++ b/TypeScript/3.0GetSptConfigFile/types/helpers/RagfairSortHelper.d.ts @@ -1,8 +1,10 @@ import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocaleService } from "../services/LocaleService"; export declare class RagfairSortHelper { protected databaseServer: DatabaseServer; - constructor(databaseServer: DatabaseServer); + protected localeService: LocaleService; + constructor(databaseServer: DatabaseServer, localeService: LocaleService); sortOffers(offers: IRagfairOffer[], type: number, direction?: number): IRagfairOffer[]; protected sortOffersByID(a: IRagfairOffer, b: IRagfairOffer): number; protected sortOffersByRating(a: IRagfairOffer, b: IRagfairOffer): number; diff --git a/TypeScript/3.0GetSptConfigFile/types/helpers/TraderHelper.d.ts b/TypeScript/3.0GetSptConfigFile/types/helpers/TraderHelper.d.ts index ab4a371..717351f 100644 --- a/TypeScript/3.0GetSptConfigFile/types/helpers/TraderHelper.d.ts +++ b/TypeScript/3.0GetSptConfigFile/types/helpers/TraderHelper.d.ts @@ -1,4 +1,6 @@ +import { FenceLevel } from "../models/eft/common/IGlobals"; import { IPmcData } from "../models/eft/common/IPmcData"; +import { Item } from "../models/eft/common/tables/IItem"; import { IBarterScheme, ITraderAssort, ITraderBase, LoyaltyLevel } from "../models/eft/common/tables/ITrader"; import { ITraderConfig } from "../models/spt/config/ITraderConfig"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -34,7 +36,48 @@ export declare class TraderHelper { */ resetTrader(sessionID: string, traderID: string): void; changeTraderDisplay(traderID: string, status: boolean, sessionID: string): void; + /** + * Get a list of items and their prices from player inventory that can be sold to a trader + * @param traderID trader id being traded with + * @param sessionID session id + * @returns IBarterScheme[][] + */ getPurchasesData(traderID: string, sessionID: string): Record; + /** + * Should item be skipped when selling to trader according to its sell categories and other checks + * @param pmcData + * @param item + * @param sellCategory + * @returns true if should NOT be sold to trader + */ + protected isItemUnSellableToTrader(pmcData: IPmcData, item: Item, sellCategory: string[]): boolean; + /** + * Can this weapon be sold to a trader with its current durabiltiy level + * @param traderID + * @param item + * @returns boolean + */ + protected isWeaponAndBelowTraderBuyDurability(traderID: string, item: Item): boolean; + /** + * Get the price of an item and all of its attached children + * Take into account bonuses/adjsutments e.g. discounts + * @param pmcData profile data + * @param item item to calculate price of + * @param buyPriceCoefficient + * @param fenceInfo fence data + * @param traderBase trader details + * @param currencyTpl Currency to get price as + * @returns price of item + children + */ + protected getAdjustedItemPrice(pmcData: IPmcData, item: Item, buyPriceCoefficient: number, fenceInfo: FenceLevel, traderBase: ITraderBase, currencyTpl: string): number; + /** + * Get the raw price of item+child items from handbook without any modification + * @param pmcData profile data + * @param item item to calculate price of + * @returns price as number + */ + protected getRawItemPrice(pmcData: IPmcData, item: Item): number; + protected getTraderDiscount(trader: ITraderBase, buyPriceCoefficient: number, fenceInfo: FenceLevel, traderID: string): number; /** * Calculate traders level based on exp amount and increment level if over threshold * @param traderID trader to process diff --git a/TypeScript/3.0GetSptConfigFile/types/loaders/AfterDbModLoader.d.ts b/TypeScript/3.0GetSptConfigFile/types/loaders/AfterDbModLoader.d.ts new file mode 100644 index 0000000..a9fc286 --- /dev/null +++ b/TypeScript/3.0GetSptConfigFile/types/loaders/AfterDbModLoader.d.ts @@ -0,0 +1,11 @@ +import { DependencyContainer } from "tsyringe"; +import { OnLoad } from "../di/OnLoad"; +import { InitialModLoader } from "./InitialModLoader"; +export declare class AfterDbModLoader implements OnLoad { + protected initialModLoader: InitialModLoader; + constructor(initialModLoader: InitialModLoader); + onLoad(): void; + getRoute(): string; + getModPath(mod: string): string; + protected executeMods(container: DependencyContainer): void; +} diff --git a/TypeScript/3.0GetSptConfigFile/types/models/enums/ConfigTypes.d.ts b/TypeScript/3.0GetSptConfigFile/types/models/enums/ConfigTypes.d.ts index 6bd31e8..1c49e62 100644 --- a/TypeScript/3.0GetSptConfigFile/types/models/enums/ConfigTypes.d.ts +++ b/TypeScript/3.0GetSptConfigFile/types/models/enums/ConfigTypes.d.ts @@ -8,6 +8,7 @@ export declare enum ConfigTypes { IN_RAID = "aki-inraid", INSURANCE = "aki-insurance", INVENTORY = "aki-inventory", + LOCALE = "aki-locale", LOCATION = "aki-location", MATCH = "aki-match", QUEST = "aki-quest", diff --git a/TypeScript/3.0GetSptConfigFile/types/models/external/IAfterDBLoadMod.d.ts b/TypeScript/3.0GetSptConfigFile/types/models/external/IAfterDBLoadMod.d.ts new file mode 100644 index 0000000..7f08b9e --- /dev/null +++ b/TypeScript/3.0GetSptConfigFile/types/models/external/IAfterDBLoadMod.d.ts @@ -0,0 +1,4 @@ +import { DependencyContainer } from "./tsyringe"; +export interface IAfterDBLoadMod { + loadAfterDbInit(container: DependencyContainer): void; +} diff --git a/TypeScript/3.0GetSptConfigFile/types/models/external/mod.d.ts b/TypeScript/3.0GetSptConfigFile/types/models/external/mod.d.ts index ecef460..47939e9 100644 --- a/TypeScript/3.0GetSptConfigFile/types/models/external/mod.d.ts +++ b/TypeScript/3.0GetSptConfigFile/types/models/external/mod.d.ts @@ -1,5 +1,5 @@ import { DependencyContainer } from "./tsyringe"; export interface IMod { - load: (container: DependencyContainer) => void; - delayedLoad: (container: DependencyContainer) => void; + load(container: DependencyContainer): void; + delayedLoad(container: DependencyContainer): void; } diff --git a/TypeScript/3.0GetSptConfigFile/types/models/spt/config/ILocaleConfig.d.ts b/TypeScript/3.0GetSptConfigFile/types/models/spt/config/ILocaleConfig.d.ts new file mode 100644 index 0000000..fe9abf7 --- /dev/null +++ b/TypeScript/3.0GetSptConfigFile/types/models/spt/config/ILocaleConfig.d.ts @@ -0,0 +1,5 @@ +import { IBaseConfig } from "./IBaseConfig"; +export interface ILocaleConfig extends IBaseConfig { + kind: "aki-locale"; + desiredLocale: string; +} diff --git a/TypeScript/3.0GetSptConfigFile/types/models/spt/logging/LogBackgroundColor.d.ts b/TypeScript/3.0GetSptConfigFile/types/models/spt/logging/LogBackgroundColor.d.ts new file mode 100644 index 0000000..87e08a9 --- /dev/null +++ b/TypeScript/3.0GetSptConfigFile/types/models/spt/logging/LogBackgroundColor.d.ts @@ -0,0 +1,11 @@ +export declare enum LogBackgroundColor { + default = "", + black = "blackBG", + red = "redBG", + green = "greenBG", + yellow = "yellowBG", + blue = "blueBG", + magenta = "magentaBG", + cyan = "cyanBG", + white = "whiteBG" +} diff --git a/TypeScript/3.0GetSptConfigFile/types/models/spt/logging/LogTextColor.d.ts b/TypeScript/3.0GetSptConfigFile/types/models/spt/logging/LogTextColor.d.ts new file mode 100644 index 0000000..7147ae3 --- /dev/null +++ b/TypeScript/3.0GetSptConfigFile/types/models/spt/logging/LogTextColor.d.ts @@ -0,0 +1,11 @@ +export declare enum LogTextColor { + black = "black", + red = "red", + green = "green", + yellow = "yellow", + blue = "blue", + magenta = "magenta", + cyan = "cyan", + white = "white", + gray = "" +} diff --git a/TypeScript/3.0GetSptConfigFile/types/models/spt/logging/SptLogger.d.ts b/TypeScript/3.0GetSptConfigFile/types/models/spt/logging/SptLogger.d.ts new file mode 100644 index 0000000..ea1b3d8 --- /dev/null +++ b/TypeScript/3.0GetSptConfigFile/types/models/spt/logging/SptLogger.d.ts @@ -0,0 +1,7 @@ +export interface SptLogger { + error: (msg: string | Record) => void; + warn: (msg: string | Record) => void; + succ?: (msg: string | Record) => void; + info: (msg: string | Record) => void; + debug: (msg: string | Record) => void; +} diff --git a/TypeScript/3.0GetSptConfigFile/types/models/spt/utils/ILogger.d.ts b/TypeScript/3.0GetSptConfigFile/types/models/spt/utils/ILogger.d.ts index c983701..2af3fac 100644 --- a/TypeScript/3.0GetSptConfigFile/types/models/spt/utils/ILogger.d.ts +++ b/TypeScript/3.0GetSptConfigFile/types/models/spt/utils/ILogger.d.ts @@ -1,7 +1,10 @@ import { Daum } from "../../eft/itemEvent/IItemEventRouterRequest"; +import { LogBackgroundColor } from "../logging/LogBackgroundColor"; +import { LogTextColor } from "../logging/LogTextColor"; export interface ILogger { writeToLogFile(data: string | Daum): void; - log(data: string | Record | Error, color: string): void; + log(data: string | Record | Error, color: string, backgroundColor?: string): void; + logWithColor(data: string | Record, textColor: LogTextColor, backgroundColor?: LogBackgroundColor): void; error(data: string): void; warning(data: string): void; success(data: string): void; diff --git a/TypeScript/3.0GetSptConfigFile/types/services/FenceService.d.ts b/TypeScript/3.0GetSptConfigFile/types/services/FenceService.d.ts index 12723fb..79058c6 100644 --- a/TypeScript/3.0GetSptConfigFile/types/services/FenceService.d.ts +++ b/TypeScript/3.0GetSptConfigFile/types/services/FenceService.d.ts @@ -29,8 +29,8 @@ export declare class FenceService { hasExpiredCache(refreshAssort: boolean): boolean; generateFenceAssortCache(pmcData: IPmcData): void; /** - * - * @param pmcData Get the fence level the passed in profile has + * Get the fence level the passed in profile has + * @param pmcData Player profile * @returns FenceLevel */ getFenceInfo(pmcData: IPmcData): FenceLevel; diff --git a/TypeScript/3.0GetSptConfigFile/types/services/LocaleService.d.ts b/TypeScript/3.0GetSptConfigFile/types/services/LocaleService.d.ts new file mode 100644 index 0000000..33bea7b --- /dev/null +++ b/TypeScript/3.0GetSptConfigFile/types/services/LocaleService.d.ts @@ -0,0 +1,14 @@ +import { ILocaleConfig } from "../models/spt/config/ILocaleConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +export declare class LocaleService { + protected logger: ILogger; + protected configServer: ConfigServer; + protected localeConfig: ILocaleConfig; + constructor(logger: ILogger, configServer: ConfigServer); + /** + * Gets the locale key from the locale.json file + * @returns locale e.g en/ge/cz/cn + */ + getDesiredLocale(): string; +} diff --git a/TypeScript/3.0GetSptConfigFile/types/utils/DatabaseImporter.d.ts b/TypeScript/3.0GetSptConfigFile/types/utils/DatabaseImporter.d.ts index 24c1cd6..b3156ea 100644 --- a/TypeScript/3.0GetSptConfigFile/types/utils/DatabaseImporter.d.ts +++ b/TypeScript/3.0GetSptConfigFile/types/utils/DatabaseImporter.d.ts @@ -5,7 +5,7 @@ import { ImageRouter } from "../routers/ImageRouter"; import { DatabaseServer } from "../servers/DatabaseServer"; import { CustomHandbookItemService } from "../services/CustomHandbookItemService"; import { CustomItemService } from "../services/CustomItemService"; -import { CustomPresetService } from "../services/customPresetService"; +import { CustomPresetService } from "../services/CustomPresetService"; import { CustomTraderAssortService } from "../services/CustomTraderAssortService"; import { JsonUtil } from "./JsonUtil"; import { VFS } from "./VFS"; diff --git a/TypeScript/3.0GetSptConfigFile/types/utils/Logger.d.ts b/TypeScript/3.0GetSptConfigFile/types/utils/Logger.d.ts index f5b774b..3d9013f 100644 --- a/TypeScript/3.0GetSptConfigFile/types/utils/Logger.d.ts +++ b/TypeScript/3.0GetSptConfigFile/types/utils/Logger.d.ts @@ -1,17 +1,13 @@ /// -import { Daum } from "../models/eft/itemEvent/IItemEventRouterRequest"; -import { ILogger } from "../models/spt/utils/ILogger"; -import winston from "winston"; -import { IAsyncQueue } from "../models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "../models/spt/utils/IUuidGenerator"; import fs from "fs"; -interface SptLogger { - error: (msg: string | Record) => void; - warn: (msg: string | Record) => void; - succ?: (msg: string | Record) => void; - info: (msg: string | Record) => void; - debug: (msg: string | Record) => void; -} +import winston from "winston"; +import { Daum } from "../models/eft/itemEvent/IItemEventRouterRequest"; +import { LogBackgroundColor } from "../models/spt/logging/LogBackgroundColor"; +import { LogTextColor } from "../models/spt/logging/LogTextColor"; +import { SptLogger } from "../models/spt/logging/SptLogger"; +import { IAsyncQueue } from "../models/spt/utils/IAsyncQueue"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { IUUidGenerator } from "../models/spt/utils/IUuidGenerator"; export declare class WinstonLogger implements ILogger { protected asyncQueue: IAsyncQueue; protected uuidGenerator: IUUidGenerator; @@ -36,16 +32,27 @@ export declare class WinstonLogger implements ILogger { custom: string; debug: string; }; + bgColors: { + default: string; + blackBG: string; + redBG: string; + greenBG: string; + yellowBG: string; + blueBG: string; + magentaBG: string; + cyanBG: string; + whiteBG: string; + }; }; protected logger: winston.Logger & SptLogger; - writeFilePromisify: (path: fs.PathLike, data: string, options?: any) => Promise; + protected writeFilePromisify: (path: fs.PathLike, data: string, options?: any) => Promise; constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); writeToLogFile(data: string | Daum): Promise; - log(data: string | Error | Record, color: string): Promise; + log(data: string | Error | Record, color: string, backgroundColor?: string): Promise; error(data: string | Record): Promise; warning(data: string | Record): Promise; success(data: string | Record): Promise; info(data: string | Record): Promise; + logWithColor(data: string | Record, textColor: LogTextColor, backgroundColor?: LogBackgroundColor): Promise; debug(data: string | Record, onlyShowInConsole?: boolean): Promise; } -export {}; diff --git a/TypeScript/4UseACustomConfigFile/types/controllers/GameController.d.ts b/TypeScript/4UseACustomConfigFile/types/controllers/GameController.d.ts index 7f632d6..5f516de 100644 --- a/TypeScript/4UseACustomConfigFile/types/controllers/GameController.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/controllers/GameController.d.ts @@ -6,19 +6,23 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { IPmcDataRepeatableQuest, IRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; import { IGameConfigResponse } from "../models/eft/game/IGameConfigResponse"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; +import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { LocaleService } from "../services/LocaleService"; import { Watermark } from "../utils/Watermark"; export declare class GameController { protected logger: ILogger; protected watermark: Watermark; protected httpServerHelper: HttpServerHelper; + protected localeService: LocaleService; protected profileHelper: ProfileHelper; protected gameHelper: GameHelper; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; - constructor(logger: ILogger, watermark: Watermark, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper, gameHelper: GameHelper, configServer: ConfigServer); + protected coreConfig: ICoreConfig; + constructor(logger: ILogger, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, gameHelper: GameHelper, configServer: ConfigServer); gameStart(_url: string, _info: IEmptyRequestData, sessionID: string): void; protected addMissingBonusesProperty(pmcProfile: IPmcData): void; protected addMissingRepeatableQuestsProperty(pmcProfile: IPmcData): void; diff --git a/TypeScript/4UseACustomConfigFile/types/controllers/QuestController.d.ts b/TypeScript/4UseACustomConfigFile/types/controllers/QuestController.d.ts index c00cd6d..2cbccfb 100644 --- a/TypeScript/4UseACustomConfigFile/types/controllers/QuestController.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/controllers/QuestController.d.ts @@ -14,6 +14,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ItemEventRouter } from "../routers/ItemEventRouter"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocaleService } from "../services/LocaleService"; import { PlayerService } from "../services/PlayerService"; import { TimeUtil } from "../utils/TimeUtil"; export declare class QuestController { @@ -27,9 +28,10 @@ export declare class QuestController { protected questHelper: QuestHelper; protected questConditionHelper: QuestConditionHelper; protected playerService: PlayerService; + protected localeService: LocaleService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, itemHelper: ItemHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, questConditionHelper: QuestConditionHelper, playerService: PlayerService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, itemHelper: ItemHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, questConditionHelper: QuestConditionHelper, playerService: PlayerService, localeService: LocaleService, configServer: ConfigServer); /** * Get all quests visible to player * Exclude quests with incomplete preconditions (level/loyalty) diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/ItemHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/ItemHelper.d.ts index 70c88d6..4fff11e 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/ItemHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/ItemHelper.d.ts @@ -84,6 +84,11 @@ declare class ItemHelper { */ generateItemsFromStackSlot(item: ITemplateItem, parentId: string): Item[]; getItem(tpl: string): [boolean, ITemplateItem]; + /** + * get normalized value (0-1) based on item condition + * @param item + * @returns number between 0 and 1 + */ getItemQualityModifier(item: Item): number; findAndReturnChildrenByItems(items: Item[], itemID: string): string[]; /** diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/QuestHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/QuestHelper.d.ts index 04ede16..d6e382b 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/QuestHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/QuestHelper.d.ts @@ -8,6 +8,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ItemEventRouter } from "../routers/ItemEventRouter"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocaleService } from "../services/LocaleService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -25,6 +26,7 @@ export declare class QuestHelper { protected itemHelper: ItemHelper; protected itemEventRouter: ItemEventRouter; protected databaseServer: DatabaseServer; + protected localeService: LocaleService; protected ragfairServerHelper: RagfairServerHelper; protected dialogueHelper: DialogueHelper; protected profileHelper: ProfileHelper; @@ -32,7 +34,7 @@ export declare class QuestHelper { protected traderHelper: TraderHelper; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, traderHelper: TraderHelper, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, traderHelper: TraderHelper, configServer: ConfigServer); static get STATUS(): Record; questStatus(pmcData: IPmcData, questID: string): string; /** @@ -74,7 +76,7 @@ export declare class QuestHelper { cleanQuestConditions(quest: IQuest): IQuest; failQuest(pmcData: IPmcData, body: any, sessionID: string): any; getQuestFromDb(questId: string, pmcData: IPmcData): IQuest; - getQuestLocaleIdFromDb(messageId: string, localisation?: string): string; + getQuestLocaleIdFromDb(messageId: string): string; applyQuestReward(pmcData: IPmcData, body: ICompleteQuestRequestData, state: string, sessionID: string): Reward[]; /** * Get the intel center bonus a player has diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/RagfairOfferHelper.d.ts index 129bc1c..5a77e13 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/RagfairOfferHelper.d.ts @@ -10,6 +10,7 @@ import { ItemEventRouter } from "../routers/ItemEventRouter"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocaleService } from "../services/LocaleService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { HashUtil } from "../utils/HashUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -37,11 +38,12 @@ export declare class RagfairOfferHelper { protected ragfairSortHelper: RagfairSortHelper; protected ragfairHelper: RagfairHelper; protected ragfairOfferService: RagfairOfferService; + protected localeService: LocaleService; protected configServer: ConfigServer; protected static TPL_GOODS_SOLD: string; protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, saveServer: SaveServer, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, saveServer: SaveServer, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, configServer: ConfigServer); getValidOffers(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; getOffersForBuild(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; processOffers(sessionID: string): boolean; diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/RagfairServerHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/RagfairServerHelper.d.ts index 2cb3ea5..a52306b 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/RagfairServerHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/RagfairServerHelper.d.ts @@ -1,11 +1,12 @@ -import { MemberCategory } from "../models/enums/MemberCategory"; import { Item } from "../models/eft/common/tables/IItem"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { MemberCategory } from "../models/enums/MemberCategory"; import { IQuestConfig } from "../models/spt/config/IQuestConfig"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocaleService } from "../services/LocaleService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; @@ -19,13 +20,14 @@ export declare class RagfairServerHelper { protected databaseServer: DatabaseServer; protected profileHelper: ProfileHelper; protected itemHelper: ItemHelper; + protected localeService: LocaleService; protected dialogueHelper: DialogueHelper; protected jsonUtil: JsonUtil; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; protected static TPL_GOODS_RETURNED: string; - constructor(randomUtil: RandomUtil, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, profileHelper: ProfileHelper, itemHelper: ItemHelper, dialogueHelper: DialogueHelper, jsonUtil: JsonUtil, configServer: ConfigServer); + constructor(randomUtil: RandomUtil, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, profileHelper: ProfileHelper, itemHelper: ItemHelper, localeService: LocaleService, dialogueHelper: DialogueHelper, jsonUtil: JsonUtil, configServer: ConfigServer); /** * Is item valid / on blacklist / quest item * @param itemDetails diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/RagfairSortHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/RagfairSortHelper.d.ts index e983569..d20e10c 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/RagfairSortHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/RagfairSortHelper.d.ts @@ -1,8 +1,10 @@ import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocaleService } from "../services/LocaleService"; export declare class RagfairSortHelper { protected databaseServer: DatabaseServer; - constructor(databaseServer: DatabaseServer); + protected localeService: LocaleService; + constructor(databaseServer: DatabaseServer, localeService: LocaleService); sortOffers(offers: IRagfairOffer[], type: number, direction?: number): IRagfairOffer[]; protected sortOffersByID(a: IRagfairOffer, b: IRagfairOffer): number; protected sortOffersByRating(a: IRagfairOffer, b: IRagfairOffer): number; diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/TraderHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/TraderHelper.d.ts index ab4a371..717351f 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/TraderHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/TraderHelper.d.ts @@ -1,4 +1,6 @@ +import { FenceLevel } from "../models/eft/common/IGlobals"; import { IPmcData } from "../models/eft/common/IPmcData"; +import { Item } from "../models/eft/common/tables/IItem"; import { IBarterScheme, ITraderAssort, ITraderBase, LoyaltyLevel } from "../models/eft/common/tables/ITrader"; import { ITraderConfig } from "../models/spt/config/ITraderConfig"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -34,7 +36,48 @@ export declare class TraderHelper { */ resetTrader(sessionID: string, traderID: string): void; changeTraderDisplay(traderID: string, status: boolean, sessionID: string): void; + /** + * Get a list of items and their prices from player inventory that can be sold to a trader + * @param traderID trader id being traded with + * @param sessionID session id + * @returns IBarterScheme[][] + */ getPurchasesData(traderID: string, sessionID: string): Record; + /** + * Should item be skipped when selling to trader according to its sell categories and other checks + * @param pmcData + * @param item + * @param sellCategory + * @returns true if should NOT be sold to trader + */ + protected isItemUnSellableToTrader(pmcData: IPmcData, item: Item, sellCategory: string[]): boolean; + /** + * Can this weapon be sold to a trader with its current durabiltiy level + * @param traderID + * @param item + * @returns boolean + */ + protected isWeaponAndBelowTraderBuyDurability(traderID: string, item: Item): boolean; + /** + * Get the price of an item and all of its attached children + * Take into account bonuses/adjsutments e.g. discounts + * @param pmcData profile data + * @param item item to calculate price of + * @param buyPriceCoefficient + * @param fenceInfo fence data + * @param traderBase trader details + * @param currencyTpl Currency to get price as + * @returns price of item + children + */ + protected getAdjustedItemPrice(pmcData: IPmcData, item: Item, buyPriceCoefficient: number, fenceInfo: FenceLevel, traderBase: ITraderBase, currencyTpl: string): number; + /** + * Get the raw price of item+child items from handbook without any modification + * @param pmcData profile data + * @param item item to calculate price of + * @returns price as number + */ + protected getRawItemPrice(pmcData: IPmcData, item: Item): number; + protected getTraderDiscount(trader: ITraderBase, buyPriceCoefficient: number, fenceInfo: FenceLevel, traderID: string): number; /** * Calculate traders level based on exp amount and increment level if over threshold * @param traderID trader to process diff --git a/TypeScript/4UseACustomConfigFile/types/loaders/AfterDbModLoader.d.ts b/TypeScript/4UseACustomConfigFile/types/loaders/AfterDbModLoader.d.ts new file mode 100644 index 0000000..a9fc286 --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/loaders/AfterDbModLoader.d.ts @@ -0,0 +1,11 @@ +import { DependencyContainer } from "tsyringe"; +import { OnLoad } from "../di/OnLoad"; +import { InitialModLoader } from "./InitialModLoader"; +export declare class AfterDbModLoader implements OnLoad { + protected initialModLoader: InitialModLoader; + constructor(initialModLoader: InitialModLoader); + onLoad(): void; + getRoute(): string; + getModPath(mod: string): string; + protected executeMods(container: DependencyContainer): void; +} diff --git a/TypeScript/4UseACustomConfigFile/types/models/enums/ConfigTypes.d.ts b/TypeScript/4UseACustomConfigFile/types/models/enums/ConfigTypes.d.ts index 6bd31e8..1c49e62 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/enums/ConfigTypes.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/enums/ConfigTypes.d.ts @@ -8,6 +8,7 @@ export declare enum ConfigTypes { IN_RAID = "aki-inraid", INSURANCE = "aki-insurance", INVENTORY = "aki-inventory", + LOCALE = "aki-locale", LOCATION = "aki-location", MATCH = "aki-match", QUEST = "aki-quest", diff --git a/TypeScript/4UseACustomConfigFile/types/models/external/IAfterDBLoadMod.d.ts b/TypeScript/4UseACustomConfigFile/types/models/external/IAfterDBLoadMod.d.ts new file mode 100644 index 0000000..7f08b9e --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/models/external/IAfterDBLoadMod.d.ts @@ -0,0 +1,4 @@ +import { DependencyContainer } from "./tsyringe"; +export interface IAfterDBLoadMod { + loadAfterDbInit(container: DependencyContainer): void; +} diff --git a/TypeScript/4UseACustomConfigFile/types/models/external/mod.d.ts b/TypeScript/4UseACustomConfigFile/types/models/external/mod.d.ts index ecef460..47939e9 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/external/mod.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/external/mod.d.ts @@ -1,5 +1,5 @@ import { DependencyContainer } from "./tsyringe"; export interface IMod { - load: (container: DependencyContainer) => void; - delayedLoad: (container: DependencyContainer) => void; + load(container: DependencyContainer): void; + delayedLoad(container: DependencyContainer): void; } diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/config/ILocaleConfig.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/config/ILocaleConfig.d.ts new file mode 100644 index 0000000..fe9abf7 --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/config/ILocaleConfig.d.ts @@ -0,0 +1,5 @@ +import { IBaseConfig } from "./IBaseConfig"; +export interface ILocaleConfig extends IBaseConfig { + kind: "aki-locale"; + desiredLocale: string; +} diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/logging/LogBackgroundColor.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/logging/LogBackgroundColor.d.ts new file mode 100644 index 0000000..87e08a9 --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/logging/LogBackgroundColor.d.ts @@ -0,0 +1,11 @@ +export declare enum LogBackgroundColor { + default = "", + black = "blackBG", + red = "redBG", + green = "greenBG", + yellow = "yellowBG", + blue = "blueBG", + magenta = "magentaBG", + cyan = "cyanBG", + white = "whiteBG" +} diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/logging/LogTextColor.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/logging/LogTextColor.d.ts new file mode 100644 index 0000000..7147ae3 --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/logging/LogTextColor.d.ts @@ -0,0 +1,11 @@ +export declare enum LogTextColor { + black = "black", + red = "red", + green = "green", + yellow = "yellow", + blue = "blue", + magenta = "magenta", + cyan = "cyan", + white = "white", + gray = "" +} diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/logging/SptLogger.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/logging/SptLogger.d.ts new file mode 100644 index 0000000..ea1b3d8 --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/logging/SptLogger.d.ts @@ -0,0 +1,7 @@ +export interface SptLogger { + error: (msg: string | Record) => void; + warn: (msg: string | Record) => void; + succ?: (msg: string | Record) => void; + info: (msg: string | Record) => void; + debug: (msg: string | Record) => void; +} diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/utils/ILogger.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/utils/ILogger.d.ts index c983701..2af3fac 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/spt/utils/ILogger.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/utils/ILogger.d.ts @@ -1,7 +1,10 @@ import { Daum } from "../../eft/itemEvent/IItemEventRouterRequest"; +import { LogBackgroundColor } from "../logging/LogBackgroundColor"; +import { LogTextColor } from "../logging/LogTextColor"; export interface ILogger { writeToLogFile(data: string | Daum): void; - log(data: string | Record | Error, color: string): void; + log(data: string | Record | Error, color: string, backgroundColor?: string): void; + logWithColor(data: string | Record, textColor: LogTextColor, backgroundColor?: LogBackgroundColor): void; error(data: string): void; warning(data: string): void; success(data: string): void; diff --git a/TypeScript/4UseACustomConfigFile/types/services/FenceService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/FenceService.d.ts index 12723fb..79058c6 100644 --- a/TypeScript/4UseACustomConfigFile/types/services/FenceService.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/services/FenceService.d.ts @@ -29,8 +29,8 @@ export declare class FenceService { hasExpiredCache(refreshAssort: boolean): boolean; generateFenceAssortCache(pmcData: IPmcData): void; /** - * - * @param pmcData Get the fence level the passed in profile has + * Get the fence level the passed in profile has + * @param pmcData Player profile * @returns FenceLevel */ getFenceInfo(pmcData: IPmcData): FenceLevel; diff --git a/TypeScript/4UseACustomConfigFile/types/services/LocaleService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/LocaleService.d.ts new file mode 100644 index 0000000..33bea7b --- /dev/null +++ b/TypeScript/4UseACustomConfigFile/types/services/LocaleService.d.ts @@ -0,0 +1,14 @@ +import { ILocaleConfig } from "../models/spt/config/ILocaleConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +export declare class LocaleService { + protected logger: ILogger; + protected configServer: ConfigServer; + protected localeConfig: ILocaleConfig; + constructor(logger: ILogger, configServer: ConfigServer); + /** + * Gets the locale key from the locale.json file + * @returns locale e.g en/ge/cz/cn + */ + getDesiredLocale(): string; +} diff --git a/TypeScript/4UseACustomConfigFile/types/utils/DatabaseImporter.d.ts b/TypeScript/4UseACustomConfigFile/types/utils/DatabaseImporter.d.ts index 24c1cd6..b3156ea 100644 --- a/TypeScript/4UseACustomConfigFile/types/utils/DatabaseImporter.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/utils/DatabaseImporter.d.ts @@ -5,7 +5,7 @@ import { ImageRouter } from "../routers/ImageRouter"; import { DatabaseServer } from "../servers/DatabaseServer"; import { CustomHandbookItemService } from "../services/CustomHandbookItemService"; import { CustomItemService } from "../services/CustomItemService"; -import { CustomPresetService } from "../services/customPresetService"; +import { CustomPresetService } from "../services/CustomPresetService"; import { CustomTraderAssortService } from "../services/CustomTraderAssortService"; import { JsonUtil } from "./JsonUtil"; import { VFS } from "./VFS"; diff --git a/TypeScript/4UseACustomConfigFile/types/utils/Logger.d.ts b/TypeScript/4UseACustomConfigFile/types/utils/Logger.d.ts index f5b774b..3d9013f 100644 --- a/TypeScript/4UseACustomConfigFile/types/utils/Logger.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/utils/Logger.d.ts @@ -1,17 +1,13 @@ /// -import { Daum } from "../models/eft/itemEvent/IItemEventRouterRequest"; -import { ILogger } from "../models/spt/utils/ILogger"; -import winston from "winston"; -import { IAsyncQueue } from "../models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "../models/spt/utils/IUuidGenerator"; import fs from "fs"; -interface SptLogger { - error: (msg: string | Record) => void; - warn: (msg: string | Record) => void; - succ?: (msg: string | Record) => void; - info: (msg: string | Record) => void; - debug: (msg: string | Record) => void; -} +import winston from "winston"; +import { Daum } from "../models/eft/itemEvent/IItemEventRouterRequest"; +import { LogBackgroundColor } from "../models/spt/logging/LogBackgroundColor"; +import { LogTextColor } from "../models/spt/logging/LogTextColor"; +import { SptLogger } from "../models/spt/logging/SptLogger"; +import { IAsyncQueue } from "../models/spt/utils/IAsyncQueue"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { IUUidGenerator } from "../models/spt/utils/IUuidGenerator"; export declare class WinstonLogger implements ILogger { protected asyncQueue: IAsyncQueue; protected uuidGenerator: IUUidGenerator; @@ -36,16 +32,27 @@ export declare class WinstonLogger implements ILogger { custom: string; debug: string; }; + bgColors: { + default: string; + blackBG: string; + redBG: string; + greenBG: string; + yellowBG: string; + blueBG: string; + magentaBG: string; + cyanBG: string; + whiteBG: string; + }; }; protected logger: winston.Logger & SptLogger; - writeFilePromisify: (path: fs.PathLike, data: string, options?: any) => Promise; + protected writeFilePromisify: (path: fs.PathLike, data: string, options?: any) => Promise; constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); writeToLogFile(data: string | Daum): Promise; - log(data: string | Error | Record, color: string): Promise; + log(data: string | Error | Record, color: string, backgroundColor?: string): Promise; error(data: string | Record): Promise; warning(data: string | Record): Promise; success(data: string | Record): Promise; info(data: string | Record): Promise; + logWithColor(data: string | Record, textColor: LogTextColor, backgroundColor?: LogBackgroundColor): Promise; debug(data: string | Record, onlyShowInConsole?: boolean): Promise; } -export {}; diff --git a/TypeScript/5ReplaceMethod/types/controllers/GameController.d.ts b/TypeScript/5ReplaceMethod/types/controllers/GameController.d.ts index 7f632d6..5f516de 100644 --- a/TypeScript/5ReplaceMethod/types/controllers/GameController.d.ts +++ b/TypeScript/5ReplaceMethod/types/controllers/GameController.d.ts @@ -6,19 +6,23 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { IPmcDataRepeatableQuest, IRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; import { IGameConfigResponse } from "../models/eft/game/IGameConfigResponse"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; +import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { LocaleService } from "../services/LocaleService"; import { Watermark } from "../utils/Watermark"; export declare class GameController { protected logger: ILogger; protected watermark: Watermark; protected httpServerHelper: HttpServerHelper; + protected localeService: LocaleService; protected profileHelper: ProfileHelper; protected gameHelper: GameHelper; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; - constructor(logger: ILogger, watermark: Watermark, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper, gameHelper: GameHelper, configServer: ConfigServer); + protected coreConfig: ICoreConfig; + constructor(logger: ILogger, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, gameHelper: GameHelper, configServer: ConfigServer); gameStart(_url: string, _info: IEmptyRequestData, sessionID: string): void; protected addMissingBonusesProperty(pmcProfile: IPmcData): void; protected addMissingRepeatableQuestsProperty(pmcProfile: IPmcData): void; diff --git a/TypeScript/5ReplaceMethod/types/controllers/QuestController.d.ts b/TypeScript/5ReplaceMethod/types/controllers/QuestController.d.ts index c00cd6d..2cbccfb 100644 --- a/TypeScript/5ReplaceMethod/types/controllers/QuestController.d.ts +++ b/TypeScript/5ReplaceMethod/types/controllers/QuestController.d.ts @@ -14,6 +14,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ItemEventRouter } from "../routers/ItemEventRouter"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocaleService } from "../services/LocaleService"; import { PlayerService } from "../services/PlayerService"; import { TimeUtil } from "../utils/TimeUtil"; export declare class QuestController { @@ -27,9 +28,10 @@ export declare class QuestController { protected questHelper: QuestHelper; protected questConditionHelper: QuestConditionHelper; protected playerService: PlayerService; + protected localeService: LocaleService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, itemHelper: ItemHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, questConditionHelper: QuestConditionHelper, playerService: PlayerService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, itemHelper: ItemHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, questConditionHelper: QuestConditionHelper, playerService: PlayerService, localeService: LocaleService, configServer: ConfigServer); /** * Get all quests visible to player * Exclude quests with incomplete preconditions (level/loyalty) diff --git a/TypeScript/5ReplaceMethod/types/helpers/ItemHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/ItemHelper.d.ts index 70c88d6..4fff11e 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/ItemHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/ItemHelper.d.ts @@ -84,6 +84,11 @@ declare class ItemHelper { */ generateItemsFromStackSlot(item: ITemplateItem, parentId: string): Item[]; getItem(tpl: string): [boolean, ITemplateItem]; + /** + * get normalized value (0-1) based on item condition + * @param item + * @returns number between 0 and 1 + */ getItemQualityModifier(item: Item): number; findAndReturnChildrenByItems(items: Item[], itemID: string): string[]; /** diff --git a/TypeScript/5ReplaceMethod/types/helpers/QuestHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/QuestHelper.d.ts index 04ede16..d6e382b 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/QuestHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/QuestHelper.d.ts @@ -8,6 +8,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ItemEventRouter } from "../routers/ItemEventRouter"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocaleService } from "../services/LocaleService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -25,6 +26,7 @@ export declare class QuestHelper { protected itemHelper: ItemHelper; protected itemEventRouter: ItemEventRouter; protected databaseServer: DatabaseServer; + protected localeService: LocaleService; protected ragfairServerHelper: RagfairServerHelper; protected dialogueHelper: DialogueHelper; protected profileHelper: ProfileHelper; @@ -32,7 +34,7 @@ export declare class QuestHelper { protected traderHelper: TraderHelper; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, traderHelper: TraderHelper, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, traderHelper: TraderHelper, configServer: ConfigServer); static get STATUS(): Record; questStatus(pmcData: IPmcData, questID: string): string; /** @@ -74,7 +76,7 @@ export declare class QuestHelper { cleanQuestConditions(quest: IQuest): IQuest; failQuest(pmcData: IPmcData, body: any, sessionID: string): any; getQuestFromDb(questId: string, pmcData: IPmcData): IQuest; - getQuestLocaleIdFromDb(messageId: string, localisation?: string): string; + getQuestLocaleIdFromDb(messageId: string): string; applyQuestReward(pmcData: IPmcData, body: ICompleteQuestRequestData, state: string, sessionID: string): Reward[]; /** * Get the intel center bonus a player has diff --git a/TypeScript/5ReplaceMethod/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/RagfairOfferHelper.d.ts index 129bc1c..5a77e13 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/RagfairOfferHelper.d.ts @@ -10,6 +10,7 @@ import { ItemEventRouter } from "../routers/ItemEventRouter"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocaleService } from "../services/LocaleService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { HashUtil } from "../utils/HashUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -37,11 +38,12 @@ export declare class RagfairOfferHelper { protected ragfairSortHelper: RagfairSortHelper; protected ragfairHelper: RagfairHelper; protected ragfairOfferService: RagfairOfferService; + protected localeService: LocaleService; protected configServer: ConfigServer; protected static TPL_GOODS_SOLD: string; protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, saveServer: SaveServer, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, saveServer: SaveServer, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, configServer: ConfigServer); getValidOffers(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; getOffersForBuild(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; processOffers(sessionID: string): boolean; diff --git a/TypeScript/5ReplaceMethod/types/helpers/RagfairServerHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/RagfairServerHelper.d.ts index 2cb3ea5..a52306b 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/RagfairServerHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/RagfairServerHelper.d.ts @@ -1,11 +1,12 @@ -import { MemberCategory } from "../models/enums/MemberCategory"; import { Item } from "../models/eft/common/tables/IItem"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { MemberCategory } from "../models/enums/MemberCategory"; import { IQuestConfig } from "../models/spt/config/IQuestConfig"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocaleService } from "../services/LocaleService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; @@ -19,13 +20,14 @@ export declare class RagfairServerHelper { protected databaseServer: DatabaseServer; protected profileHelper: ProfileHelper; protected itemHelper: ItemHelper; + protected localeService: LocaleService; protected dialogueHelper: DialogueHelper; protected jsonUtil: JsonUtil; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; protected static TPL_GOODS_RETURNED: string; - constructor(randomUtil: RandomUtil, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, profileHelper: ProfileHelper, itemHelper: ItemHelper, dialogueHelper: DialogueHelper, jsonUtil: JsonUtil, configServer: ConfigServer); + constructor(randomUtil: RandomUtil, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, profileHelper: ProfileHelper, itemHelper: ItemHelper, localeService: LocaleService, dialogueHelper: DialogueHelper, jsonUtil: JsonUtil, configServer: ConfigServer); /** * Is item valid / on blacklist / quest item * @param itemDetails diff --git a/TypeScript/5ReplaceMethod/types/helpers/RagfairSortHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/RagfairSortHelper.d.ts index e983569..d20e10c 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/RagfairSortHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/RagfairSortHelper.d.ts @@ -1,8 +1,10 @@ import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocaleService } from "../services/LocaleService"; export declare class RagfairSortHelper { protected databaseServer: DatabaseServer; - constructor(databaseServer: DatabaseServer); + protected localeService: LocaleService; + constructor(databaseServer: DatabaseServer, localeService: LocaleService); sortOffers(offers: IRagfairOffer[], type: number, direction?: number): IRagfairOffer[]; protected sortOffersByID(a: IRagfairOffer, b: IRagfairOffer): number; protected sortOffersByRating(a: IRagfairOffer, b: IRagfairOffer): number; diff --git a/TypeScript/5ReplaceMethod/types/helpers/TraderHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/TraderHelper.d.ts index ab4a371..717351f 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/TraderHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/TraderHelper.d.ts @@ -1,4 +1,6 @@ +import { FenceLevel } from "../models/eft/common/IGlobals"; import { IPmcData } from "../models/eft/common/IPmcData"; +import { Item } from "../models/eft/common/tables/IItem"; import { IBarterScheme, ITraderAssort, ITraderBase, LoyaltyLevel } from "../models/eft/common/tables/ITrader"; import { ITraderConfig } from "../models/spt/config/ITraderConfig"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -34,7 +36,48 @@ export declare class TraderHelper { */ resetTrader(sessionID: string, traderID: string): void; changeTraderDisplay(traderID: string, status: boolean, sessionID: string): void; + /** + * Get a list of items and their prices from player inventory that can be sold to a trader + * @param traderID trader id being traded with + * @param sessionID session id + * @returns IBarterScheme[][] + */ getPurchasesData(traderID: string, sessionID: string): Record; + /** + * Should item be skipped when selling to trader according to its sell categories and other checks + * @param pmcData + * @param item + * @param sellCategory + * @returns true if should NOT be sold to trader + */ + protected isItemUnSellableToTrader(pmcData: IPmcData, item: Item, sellCategory: string[]): boolean; + /** + * Can this weapon be sold to a trader with its current durabiltiy level + * @param traderID + * @param item + * @returns boolean + */ + protected isWeaponAndBelowTraderBuyDurability(traderID: string, item: Item): boolean; + /** + * Get the price of an item and all of its attached children + * Take into account bonuses/adjsutments e.g. discounts + * @param pmcData profile data + * @param item item to calculate price of + * @param buyPriceCoefficient + * @param fenceInfo fence data + * @param traderBase trader details + * @param currencyTpl Currency to get price as + * @returns price of item + children + */ + protected getAdjustedItemPrice(pmcData: IPmcData, item: Item, buyPriceCoefficient: number, fenceInfo: FenceLevel, traderBase: ITraderBase, currencyTpl: string): number; + /** + * Get the raw price of item+child items from handbook without any modification + * @param pmcData profile data + * @param item item to calculate price of + * @returns price as number + */ + protected getRawItemPrice(pmcData: IPmcData, item: Item): number; + protected getTraderDiscount(trader: ITraderBase, buyPriceCoefficient: number, fenceInfo: FenceLevel, traderID: string): number; /** * Calculate traders level based on exp amount and increment level if over threshold * @param traderID trader to process diff --git a/TypeScript/5ReplaceMethod/types/loaders/AfterDbModLoader.d.ts b/TypeScript/5ReplaceMethod/types/loaders/AfterDbModLoader.d.ts new file mode 100644 index 0000000..a9fc286 --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/loaders/AfterDbModLoader.d.ts @@ -0,0 +1,11 @@ +import { DependencyContainer } from "tsyringe"; +import { OnLoad } from "../di/OnLoad"; +import { InitialModLoader } from "./InitialModLoader"; +export declare class AfterDbModLoader implements OnLoad { + protected initialModLoader: InitialModLoader; + constructor(initialModLoader: InitialModLoader); + onLoad(): void; + getRoute(): string; + getModPath(mod: string): string; + protected executeMods(container: DependencyContainer): void; +} diff --git a/TypeScript/5ReplaceMethod/types/models/enums/ConfigTypes.d.ts b/TypeScript/5ReplaceMethod/types/models/enums/ConfigTypes.d.ts index 6bd31e8..1c49e62 100644 --- a/TypeScript/5ReplaceMethod/types/models/enums/ConfigTypes.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/enums/ConfigTypes.d.ts @@ -8,6 +8,7 @@ export declare enum ConfigTypes { IN_RAID = "aki-inraid", INSURANCE = "aki-insurance", INVENTORY = "aki-inventory", + LOCALE = "aki-locale", LOCATION = "aki-location", MATCH = "aki-match", QUEST = "aki-quest", diff --git a/TypeScript/5ReplaceMethod/types/models/external/IAfterDBLoadMod.d.ts b/TypeScript/5ReplaceMethod/types/models/external/IAfterDBLoadMod.d.ts new file mode 100644 index 0000000..7f08b9e --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/models/external/IAfterDBLoadMod.d.ts @@ -0,0 +1,4 @@ +import { DependencyContainer } from "./tsyringe"; +export interface IAfterDBLoadMod { + loadAfterDbInit(container: DependencyContainer): void; +} diff --git a/TypeScript/5ReplaceMethod/types/models/external/mod.d.ts b/TypeScript/5ReplaceMethod/types/models/external/mod.d.ts index ecef460..47939e9 100644 --- a/TypeScript/5ReplaceMethod/types/models/external/mod.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/external/mod.d.ts @@ -1,5 +1,5 @@ import { DependencyContainer } from "./tsyringe"; export interface IMod { - load: (container: DependencyContainer) => void; - delayedLoad: (container: DependencyContainer) => void; + load(container: DependencyContainer): void; + delayedLoad(container: DependencyContainer): void; } diff --git a/TypeScript/5ReplaceMethod/types/models/spt/config/ILocaleConfig.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/config/ILocaleConfig.d.ts new file mode 100644 index 0000000..fe9abf7 --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/models/spt/config/ILocaleConfig.d.ts @@ -0,0 +1,5 @@ +import { IBaseConfig } from "./IBaseConfig"; +export interface ILocaleConfig extends IBaseConfig { + kind: "aki-locale"; + desiredLocale: string; +} diff --git a/TypeScript/5ReplaceMethod/types/models/spt/logging/LogBackgroundColor.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/logging/LogBackgroundColor.d.ts new file mode 100644 index 0000000..87e08a9 --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/models/spt/logging/LogBackgroundColor.d.ts @@ -0,0 +1,11 @@ +export declare enum LogBackgroundColor { + default = "", + black = "blackBG", + red = "redBG", + green = "greenBG", + yellow = "yellowBG", + blue = "blueBG", + magenta = "magentaBG", + cyan = "cyanBG", + white = "whiteBG" +} diff --git a/TypeScript/5ReplaceMethod/types/models/spt/logging/LogTextColor.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/logging/LogTextColor.d.ts new file mode 100644 index 0000000..7147ae3 --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/models/spt/logging/LogTextColor.d.ts @@ -0,0 +1,11 @@ +export declare enum LogTextColor { + black = "black", + red = "red", + green = "green", + yellow = "yellow", + blue = "blue", + magenta = "magenta", + cyan = "cyan", + white = "white", + gray = "" +} diff --git a/TypeScript/5ReplaceMethod/types/models/spt/logging/SptLogger.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/logging/SptLogger.d.ts new file mode 100644 index 0000000..ea1b3d8 --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/models/spt/logging/SptLogger.d.ts @@ -0,0 +1,7 @@ +export interface SptLogger { + error: (msg: string | Record) => void; + warn: (msg: string | Record) => void; + succ?: (msg: string | Record) => void; + info: (msg: string | Record) => void; + debug: (msg: string | Record) => void; +} diff --git a/TypeScript/5ReplaceMethod/types/models/spt/utils/ILogger.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/utils/ILogger.d.ts index c983701..2af3fac 100644 --- a/TypeScript/5ReplaceMethod/types/models/spt/utils/ILogger.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/spt/utils/ILogger.d.ts @@ -1,7 +1,10 @@ import { Daum } from "../../eft/itemEvent/IItemEventRouterRequest"; +import { LogBackgroundColor } from "../logging/LogBackgroundColor"; +import { LogTextColor } from "../logging/LogTextColor"; export interface ILogger { writeToLogFile(data: string | Daum): void; - log(data: string | Record | Error, color: string): void; + log(data: string | Record | Error, color: string, backgroundColor?: string): void; + logWithColor(data: string | Record, textColor: LogTextColor, backgroundColor?: LogBackgroundColor): void; error(data: string): void; warning(data: string): void; success(data: string): void; diff --git a/TypeScript/5ReplaceMethod/types/services/FenceService.d.ts b/TypeScript/5ReplaceMethod/types/services/FenceService.d.ts index 12723fb..79058c6 100644 --- a/TypeScript/5ReplaceMethod/types/services/FenceService.d.ts +++ b/TypeScript/5ReplaceMethod/types/services/FenceService.d.ts @@ -29,8 +29,8 @@ export declare class FenceService { hasExpiredCache(refreshAssort: boolean): boolean; generateFenceAssortCache(pmcData: IPmcData): void; /** - * - * @param pmcData Get the fence level the passed in profile has + * Get the fence level the passed in profile has + * @param pmcData Player profile * @returns FenceLevel */ getFenceInfo(pmcData: IPmcData): FenceLevel; diff --git a/TypeScript/5ReplaceMethod/types/services/LocaleService.d.ts b/TypeScript/5ReplaceMethod/types/services/LocaleService.d.ts new file mode 100644 index 0000000..33bea7b --- /dev/null +++ b/TypeScript/5ReplaceMethod/types/services/LocaleService.d.ts @@ -0,0 +1,14 @@ +import { ILocaleConfig } from "../models/spt/config/ILocaleConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +export declare class LocaleService { + protected logger: ILogger; + protected configServer: ConfigServer; + protected localeConfig: ILocaleConfig; + constructor(logger: ILogger, configServer: ConfigServer); + /** + * Gets the locale key from the locale.json file + * @returns locale e.g en/ge/cz/cn + */ + getDesiredLocale(): string; +} diff --git a/TypeScript/5ReplaceMethod/types/utils/DatabaseImporter.d.ts b/TypeScript/5ReplaceMethod/types/utils/DatabaseImporter.d.ts index 24c1cd6..b3156ea 100644 --- a/TypeScript/5ReplaceMethod/types/utils/DatabaseImporter.d.ts +++ b/TypeScript/5ReplaceMethod/types/utils/DatabaseImporter.d.ts @@ -5,7 +5,7 @@ import { ImageRouter } from "../routers/ImageRouter"; import { DatabaseServer } from "../servers/DatabaseServer"; import { CustomHandbookItemService } from "../services/CustomHandbookItemService"; import { CustomItemService } from "../services/CustomItemService"; -import { CustomPresetService } from "../services/customPresetService"; +import { CustomPresetService } from "../services/CustomPresetService"; import { CustomTraderAssortService } from "../services/CustomTraderAssortService"; import { JsonUtil } from "./JsonUtil"; import { VFS } from "./VFS"; diff --git a/TypeScript/5ReplaceMethod/types/utils/Logger.d.ts b/TypeScript/5ReplaceMethod/types/utils/Logger.d.ts index f5b774b..3d9013f 100644 --- a/TypeScript/5ReplaceMethod/types/utils/Logger.d.ts +++ b/TypeScript/5ReplaceMethod/types/utils/Logger.d.ts @@ -1,17 +1,13 @@ /// -import { Daum } from "../models/eft/itemEvent/IItemEventRouterRequest"; -import { ILogger } from "../models/spt/utils/ILogger"; -import winston from "winston"; -import { IAsyncQueue } from "../models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "../models/spt/utils/IUuidGenerator"; import fs from "fs"; -interface SptLogger { - error: (msg: string | Record) => void; - warn: (msg: string | Record) => void; - succ?: (msg: string | Record) => void; - info: (msg: string | Record) => void; - debug: (msg: string | Record) => void; -} +import winston from "winston"; +import { Daum } from "../models/eft/itemEvent/IItemEventRouterRequest"; +import { LogBackgroundColor } from "../models/spt/logging/LogBackgroundColor"; +import { LogTextColor } from "../models/spt/logging/LogTextColor"; +import { SptLogger } from "../models/spt/logging/SptLogger"; +import { IAsyncQueue } from "../models/spt/utils/IAsyncQueue"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { IUUidGenerator } from "../models/spt/utils/IUuidGenerator"; export declare class WinstonLogger implements ILogger { protected asyncQueue: IAsyncQueue; protected uuidGenerator: IUUidGenerator; @@ -36,16 +32,27 @@ export declare class WinstonLogger implements ILogger { custom: string; debug: string; }; + bgColors: { + default: string; + blackBG: string; + redBG: string; + greenBG: string; + yellowBG: string; + blueBG: string; + magentaBG: string; + cyanBG: string; + whiteBG: string; + }; }; protected logger: winston.Logger & SptLogger; - writeFilePromisify: (path: fs.PathLike, data: string, options?: any) => Promise; + protected writeFilePromisify: (path: fs.PathLike, data: string, options?: any) => Promise; constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); writeToLogFile(data: string | Daum): Promise; - log(data: string | Error | Record, color: string): Promise; + log(data: string | Error | Record, color: string, backgroundColor?: string): Promise; error(data: string | Record): Promise; warning(data: string | Record): Promise; success(data: string | Record): Promise; info(data: string | Record): Promise; + logWithColor(data: string | Record, textColor: LogTextColor, backgroundColor?: LogBackgroundColor): Promise; debug(data: string | Record, onlyShowInConsole?: boolean): Promise; } -export {}; diff --git a/TypeScript/6ReferenceAnotherClass/types/controllers/GameController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/GameController.d.ts index 7f632d6..5f516de 100644 --- a/TypeScript/6ReferenceAnotherClass/types/controllers/GameController.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/controllers/GameController.d.ts @@ -6,19 +6,23 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { IPmcDataRepeatableQuest, IRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; import { IGameConfigResponse } from "../models/eft/game/IGameConfigResponse"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; +import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { LocaleService } from "../services/LocaleService"; import { Watermark } from "../utils/Watermark"; export declare class GameController { protected logger: ILogger; protected watermark: Watermark; protected httpServerHelper: HttpServerHelper; + protected localeService: LocaleService; protected profileHelper: ProfileHelper; protected gameHelper: GameHelper; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; - constructor(logger: ILogger, watermark: Watermark, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper, gameHelper: GameHelper, configServer: ConfigServer); + protected coreConfig: ICoreConfig; + constructor(logger: ILogger, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, gameHelper: GameHelper, configServer: ConfigServer); gameStart(_url: string, _info: IEmptyRequestData, sessionID: string): void; protected addMissingBonusesProperty(pmcProfile: IPmcData): void; protected addMissingRepeatableQuestsProperty(pmcProfile: IPmcData): void; diff --git a/TypeScript/6ReferenceAnotherClass/types/controllers/QuestController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/QuestController.d.ts index c00cd6d..2cbccfb 100644 --- a/TypeScript/6ReferenceAnotherClass/types/controllers/QuestController.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/controllers/QuestController.d.ts @@ -14,6 +14,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ItemEventRouter } from "../routers/ItemEventRouter"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocaleService } from "../services/LocaleService"; import { PlayerService } from "../services/PlayerService"; import { TimeUtil } from "../utils/TimeUtil"; export declare class QuestController { @@ -27,9 +28,10 @@ export declare class QuestController { protected questHelper: QuestHelper; protected questConditionHelper: QuestConditionHelper; protected playerService: PlayerService; + protected localeService: LocaleService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, itemHelper: ItemHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, questConditionHelper: QuestConditionHelper, playerService: PlayerService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, itemHelper: ItemHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, questConditionHelper: QuestConditionHelper, playerService: PlayerService, localeService: LocaleService, configServer: ConfigServer); /** * Get all quests visible to player * Exclude quests with incomplete preconditions (level/loyalty) diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/ItemHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/ItemHelper.d.ts index 70c88d6..4fff11e 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/ItemHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/ItemHelper.d.ts @@ -84,6 +84,11 @@ declare class ItemHelper { */ generateItemsFromStackSlot(item: ITemplateItem, parentId: string): Item[]; getItem(tpl: string): [boolean, ITemplateItem]; + /** + * get normalized value (0-1) based on item condition + * @param item + * @returns number between 0 and 1 + */ getItemQualityModifier(item: Item): number; findAndReturnChildrenByItems(items: Item[], itemID: string): string[]; /** diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/QuestHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/QuestHelper.d.ts index 04ede16..d6e382b 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/QuestHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/QuestHelper.d.ts @@ -8,6 +8,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ItemEventRouter } from "../routers/ItemEventRouter"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocaleService } from "../services/LocaleService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -25,6 +26,7 @@ export declare class QuestHelper { protected itemHelper: ItemHelper; protected itemEventRouter: ItemEventRouter; protected databaseServer: DatabaseServer; + protected localeService: LocaleService; protected ragfairServerHelper: RagfairServerHelper; protected dialogueHelper: DialogueHelper; protected profileHelper: ProfileHelper; @@ -32,7 +34,7 @@ export declare class QuestHelper { protected traderHelper: TraderHelper; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, traderHelper: TraderHelper, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, traderHelper: TraderHelper, configServer: ConfigServer); static get STATUS(): Record; questStatus(pmcData: IPmcData, questID: string): string; /** @@ -74,7 +76,7 @@ export declare class QuestHelper { cleanQuestConditions(quest: IQuest): IQuest; failQuest(pmcData: IPmcData, body: any, sessionID: string): any; getQuestFromDb(questId: string, pmcData: IPmcData): IQuest; - getQuestLocaleIdFromDb(messageId: string, localisation?: string): string; + getQuestLocaleIdFromDb(messageId: string): string; applyQuestReward(pmcData: IPmcData, body: ICompleteQuestRequestData, state: string, sessionID: string): Reward[]; /** * Get the intel center bonus a player has diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/RagfairOfferHelper.d.ts index 129bc1c..5a77e13 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/RagfairOfferHelper.d.ts @@ -10,6 +10,7 @@ import { ItemEventRouter } from "../routers/ItemEventRouter"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocaleService } from "../services/LocaleService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { HashUtil } from "../utils/HashUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -37,11 +38,12 @@ export declare class RagfairOfferHelper { protected ragfairSortHelper: RagfairSortHelper; protected ragfairHelper: RagfairHelper; protected ragfairOfferService: RagfairOfferService; + protected localeService: LocaleService; protected configServer: ConfigServer; protected static TPL_GOODS_SOLD: string; protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, saveServer: SaveServer, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, saveServer: SaveServer, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, configServer: ConfigServer); getValidOffers(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; getOffersForBuild(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; processOffers(sessionID: string): boolean; diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/RagfairServerHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/RagfairServerHelper.d.ts index 2cb3ea5..a52306b 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/RagfairServerHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/RagfairServerHelper.d.ts @@ -1,11 +1,12 @@ -import { MemberCategory } from "../models/enums/MemberCategory"; import { Item } from "../models/eft/common/tables/IItem"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { MemberCategory } from "../models/enums/MemberCategory"; import { IQuestConfig } from "../models/spt/config/IQuestConfig"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocaleService } from "../services/LocaleService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; @@ -19,13 +20,14 @@ export declare class RagfairServerHelper { protected databaseServer: DatabaseServer; protected profileHelper: ProfileHelper; protected itemHelper: ItemHelper; + protected localeService: LocaleService; protected dialogueHelper: DialogueHelper; protected jsonUtil: JsonUtil; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; protected static TPL_GOODS_RETURNED: string; - constructor(randomUtil: RandomUtil, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, profileHelper: ProfileHelper, itemHelper: ItemHelper, dialogueHelper: DialogueHelper, jsonUtil: JsonUtil, configServer: ConfigServer); + constructor(randomUtil: RandomUtil, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, profileHelper: ProfileHelper, itemHelper: ItemHelper, localeService: LocaleService, dialogueHelper: DialogueHelper, jsonUtil: JsonUtil, configServer: ConfigServer); /** * Is item valid / on blacklist / quest item * @param itemDetails diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/RagfairSortHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/RagfairSortHelper.d.ts index e983569..d20e10c 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/RagfairSortHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/RagfairSortHelper.d.ts @@ -1,8 +1,10 @@ import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocaleService } from "../services/LocaleService"; export declare class RagfairSortHelper { protected databaseServer: DatabaseServer; - constructor(databaseServer: DatabaseServer); + protected localeService: LocaleService; + constructor(databaseServer: DatabaseServer, localeService: LocaleService); sortOffers(offers: IRagfairOffer[], type: number, direction?: number): IRagfairOffer[]; protected sortOffersByID(a: IRagfairOffer, b: IRagfairOffer): number; protected sortOffersByRating(a: IRagfairOffer, b: IRagfairOffer): number; diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/TraderHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/TraderHelper.d.ts index ab4a371..717351f 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/TraderHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/TraderHelper.d.ts @@ -1,4 +1,6 @@ +import { FenceLevel } from "../models/eft/common/IGlobals"; import { IPmcData } from "../models/eft/common/IPmcData"; +import { Item } from "../models/eft/common/tables/IItem"; import { IBarterScheme, ITraderAssort, ITraderBase, LoyaltyLevel } from "../models/eft/common/tables/ITrader"; import { ITraderConfig } from "../models/spt/config/ITraderConfig"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -34,7 +36,48 @@ export declare class TraderHelper { */ resetTrader(sessionID: string, traderID: string): void; changeTraderDisplay(traderID: string, status: boolean, sessionID: string): void; + /** + * Get a list of items and their prices from player inventory that can be sold to a trader + * @param traderID trader id being traded with + * @param sessionID session id + * @returns IBarterScheme[][] + */ getPurchasesData(traderID: string, sessionID: string): Record; + /** + * Should item be skipped when selling to trader according to its sell categories and other checks + * @param pmcData + * @param item + * @param sellCategory + * @returns true if should NOT be sold to trader + */ + protected isItemUnSellableToTrader(pmcData: IPmcData, item: Item, sellCategory: string[]): boolean; + /** + * Can this weapon be sold to a trader with its current durabiltiy level + * @param traderID + * @param item + * @returns boolean + */ + protected isWeaponAndBelowTraderBuyDurability(traderID: string, item: Item): boolean; + /** + * Get the price of an item and all of its attached children + * Take into account bonuses/adjsutments e.g. discounts + * @param pmcData profile data + * @param item item to calculate price of + * @param buyPriceCoefficient + * @param fenceInfo fence data + * @param traderBase trader details + * @param currencyTpl Currency to get price as + * @returns price of item + children + */ + protected getAdjustedItemPrice(pmcData: IPmcData, item: Item, buyPriceCoefficient: number, fenceInfo: FenceLevel, traderBase: ITraderBase, currencyTpl: string): number; + /** + * Get the raw price of item+child items from handbook without any modification + * @param pmcData profile data + * @param item item to calculate price of + * @returns price as number + */ + protected getRawItemPrice(pmcData: IPmcData, item: Item): number; + protected getTraderDiscount(trader: ITraderBase, buyPriceCoefficient: number, fenceInfo: FenceLevel, traderID: string): number; /** * Calculate traders level based on exp amount and increment level if over threshold * @param traderID trader to process diff --git a/TypeScript/6ReferenceAnotherClass/types/loaders/AfterDbModLoader.d.ts b/TypeScript/6ReferenceAnotherClass/types/loaders/AfterDbModLoader.d.ts new file mode 100644 index 0000000..a9fc286 --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/loaders/AfterDbModLoader.d.ts @@ -0,0 +1,11 @@ +import { DependencyContainer } from "tsyringe"; +import { OnLoad } from "../di/OnLoad"; +import { InitialModLoader } from "./InitialModLoader"; +export declare class AfterDbModLoader implements OnLoad { + protected initialModLoader: InitialModLoader; + constructor(initialModLoader: InitialModLoader); + onLoad(): void; + getRoute(): string; + getModPath(mod: string): string; + protected executeMods(container: DependencyContainer): void; +} diff --git a/TypeScript/6ReferenceAnotherClass/types/models/enums/ConfigTypes.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/enums/ConfigTypes.d.ts index 6bd31e8..1c49e62 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/enums/ConfigTypes.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/enums/ConfigTypes.d.ts @@ -8,6 +8,7 @@ export declare enum ConfigTypes { IN_RAID = "aki-inraid", INSURANCE = "aki-insurance", INVENTORY = "aki-inventory", + LOCALE = "aki-locale", LOCATION = "aki-location", MATCH = "aki-match", QUEST = "aki-quest", diff --git a/TypeScript/6ReferenceAnotherClass/types/models/external/IAfterDBLoadMod.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/external/IAfterDBLoadMod.d.ts new file mode 100644 index 0000000..7f08b9e --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/models/external/IAfterDBLoadMod.d.ts @@ -0,0 +1,4 @@ +import { DependencyContainer } from "./tsyringe"; +export interface IAfterDBLoadMod { + loadAfterDbInit(container: DependencyContainer): void; +} diff --git a/TypeScript/6ReferenceAnotherClass/types/models/external/mod.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/external/mod.d.ts index ecef460..47939e9 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/external/mod.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/external/mod.d.ts @@ -1,5 +1,5 @@ import { DependencyContainer } from "./tsyringe"; export interface IMod { - load: (container: DependencyContainer) => void; - delayedLoad: (container: DependencyContainer) => void; + load(container: DependencyContainer): void; + delayedLoad(container: DependencyContainer): void; } diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/ILocaleConfig.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/ILocaleConfig.d.ts new file mode 100644 index 0000000..fe9abf7 --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/ILocaleConfig.d.ts @@ -0,0 +1,5 @@ +import { IBaseConfig } from "./IBaseConfig"; +export interface ILocaleConfig extends IBaseConfig { + kind: "aki-locale"; + desiredLocale: string; +} diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/logging/LogBackgroundColor.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/logging/LogBackgroundColor.d.ts new file mode 100644 index 0000000..87e08a9 --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/logging/LogBackgroundColor.d.ts @@ -0,0 +1,11 @@ +export declare enum LogBackgroundColor { + default = "", + black = "blackBG", + red = "redBG", + green = "greenBG", + yellow = "yellowBG", + blue = "blueBG", + magenta = "magentaBG", + cyan = "cyanBG", + white = "whiteBG" +} diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/logging/LogTextColor.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/logging/LogTextColor.d.ts new file mode 100644 index 0000000..7147ae3 --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/logging/LogTextColor.d.ts @@ -0,0 +1,11 @@ +export declare enum LogTextColor { + black = "black", + red = "red", + green = "green", + yellow = "yellow", + blue = "blue", + magenta = "magenta", + cyan = "cyan", + white = "white", + gray = "" +} diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/logging/SptLogger.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/logging/SptLogger.d.ts new file mode 100644 index 0000000..ea1b3d8 --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/logging/SptLogger.d.ts @@ -0,0 +1,7 @@ +export interface SptLogger { + error: (msg: string | Record) => void; + warn: (msg: string | Record) => void; + succ?: (msg: string | Record) => void; + info: (msg: string | Record) => void; + debug: (msg: string | Record) => void; +} diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/utils/ILogger.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/utils/ILogger.d.ts index c983701..2af3fac 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/spt/utils/ILogger.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/utils/ILogger.d.ts @@ -1,7 +1,10 @@ import { Daum } from "../../eft/itemEvent/IItemEventRouterRequest"; +import { LogBackgroundColor } from "../logging/LogBackgroundColor"; +import { LogTextColor } from "../logging/LogTextColor"; export interface ILogger { writeToLogFile(data: string | Daum): void; - log(data: string | Record | Error, color: string): void; + log(data: string | Record | Error, color: string, backgroundColor?: string): void; + logWithColor(data: string | Record, textColor: LogTextColor, backgroundColor?: LogBackgroundColor): void; error(data: string): void; warning(data: string): void; success(data: string): void; diff --git a/TypeScript/6ReferenceAnotherClass/types/services/FenceService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/FenceService.d.ts index 12723fb..79058c6 100644 --- a/TypeScript/6ReferenceAnotherClass/types/services/FenceService.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/services/FenceService.d.ts @@ -29,8 +29,8 @@ export declare class FenceService { hasExpiredCache(refreshAssort: boolean): boolean; generateFenceAssortCache(pmcData: IPmcData): void; /** - * - * @param pmcData Get the fence level the passed in profile has + * Get the fence level the passed in profile has + * @param pmcData Player profile * @returns FenceLevel */ getFenceInfo(pmcData: IPmcData): FenceLevel; diff --git a/TypeScript/6ReferenceAnotherClass/types/services/LocaleService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/LocaleService.d.ts new file mode 100644 index 0000000..33bea7b --- /dev/null +++ b/TypeScript/6ReferenceAnotherClass/types/services/LocaleService.d.ts @@ -0,0 +1,14 @@ +import { ILocaleConfig } from "../models/spt/config/ILocaleConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +export declare class LocaleService { + protected logger: ILogger; + protected configServer: ConfigServer; + protected localeConfig: ILocaleConfig; + constructor(logger: ILogger, configServer: ConfigServer); + /** + * Gets the locale key from the locale.json file + * @returns locale e.g en/ge/cz/cn + */ + getDesiredLocale(): string; +} diff --git a/TypeScript/6ReferenceAnotherClass/types/utils/DatabaseImporter.d.ts b/TypeScript/6ReferenceAnotherClass/types/utils/DatabaseImporter.d.ts index 24c1cd6..b3156ea 100644 --- a/TypeScript/6ReferenceAnotherClass/types/utils/DatabaseImporter.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/utils/DatabaseImporter.d.ts @@ -5,7 +5,7 @@ import { ImageRouter } from "../routers/ImageRouter"; import { DatabaseServer } from "../servers/DatabaseServer"; import { CustomHandbookItemService } from "../services/CustomHandbookItemService"; import { CustomItemService } from "../services/CustomItemService"; -import { CustomPresetService } from "../services/customPresetService"; +import { CustomPresetService } from "../services/CustomPresetService"; import { CustomTraderAssortService } from "../services/CustomTraderAssortService"; import { JsonUtil } from "./JsonUtil"; import { VFS } from "./VFS"; diff --git a/TypeScript/6ReferenceAnotherClass/types/utils/Logger.d.ts b/TypeScript/6ReferenceAnotherClass/types/utils/Logger.d.ts index f5b774b..3d9013f 100644 --- a/TypeScript/6ReferenceAnotherClass/types/utils/Logger.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/utils/Logger.d.ts @@ -1,17 +1,13 @@ /// -import { Daum } from "../models/eft/itemEvent/IItemEventRouterRequest"; -import { ILogger } from "../models/spt/utils/ILogger"; -import winston from "winston"; -import { IAsyncQueue } from "../models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "../models/spt/utils/IUuidGenerator"; import fs from "fs"; -interface SptLogger { - error: (msg: string | Record) => void; - warn: (msg: string | Record) => void; - succ?: (msg: string | Record) => void; - info: (msg: string | Record) => void; - debug: (msg: string | Record) => void; -} +import winston from "winston"; +import { Daum } from "../models/eft/itemEvent/IItemEventRouterRequest"; +import { LogBackgroundColor } from "../models/spt/logging/LogBackgroundColor"; +import { LogTextColor } from "../models/spt/logging/LogTextColor"; +import { SptLogger } from "../models/spt/logging/SptLogger"; +import { IAsyncQueue } from "../models/spt/utils/IAsyncQueue"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { IUUidGenerator } from "../models/spt/utils/IUuidGenerator"; export declare class WinstonLogger implements ILogger { protected asyncQueue: IAsyncQueue; protected uuidGenerator: IUUidGenerator; @@ -36,16 +32,27 @@ export declare class WinstonLogger implements ILogger { custom: string; debug: string; }; + bgColors: { + default: string; + blackBG: string; + redBG: string; + greenBG: string; + yellowBG: string; + blueBG: string; + magentaBG: string; + cyanBG: string; + whiteBG: string; + }; }; protected logger: winston.Logger & SptLogger; - writeFilePromisify: (path: fs.PathLike, data: string, options?: any) => Promise; + protected writeFilePromisify: (path: fs.PathLike, data: string, options?: any) => Promise; constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); writeToLogFile(data: string | Daum): Promise; - log(data: string | Error | Record, color: string): Promise; + log(data: string | Error | Record, color: string, backgroundColor?: string): Promise; error(data: string | Record): Promise; warning(data: string | Record): Promise; success(data: string | Record): Promise; info(data: string | Record): Promise; + logWithColor(data: string | Record, textColor: LogTextColor, backgroundColor?: LogBackgroundColor): Promise; debug(data: string | Record, onlyShowInConsole?: boolean): Promise; } -export {}; diff --git a/TypeScript/7OnLoadHook/types/controllers/GameController.d.ts b/TypeScript/7OnLoadHook/types/controllers/GameController.d.ts index 7f632d6..5f516de 100644 --- a/TypeScript/7OnLoadHook/types/controllers/GameController.d.ts +++ b/TypeScript/7OnLoadHook/types/controllers/GameController.d.ts @@ -6,19 +6,23 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { IPmcDataRepeatableQuest, IRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; import { IGameConfigResponse } from "../models/eft/game/IGameConfigResponse"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; +import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { LocaleService } from "../services/LocaleService"; import { Watermark } from "../utils/Watermark"; export declare class GameController { protected logger: ILogger; protected watermark: Watermark; protected httpServerHelper: HttpServerHelper; + protected localeService: LocaleService; protected profileHelper: ProfileHelper; protected gameHelper: GameHelper; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; - constructor(logger: ILogger, watermark: Watermark, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper, gameHelper: GameHelper, configServer: ConfigServer); + protected coreConfig: ICoreConfig; + constructor(logger: ILogger, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, gameHelper: GameHelper, configServer: ConfigServer); gameStart(_url: string, _info: IEmptyRequestData, sessionID: string): void; protected addMissingBonusesProperty(pmcProfile: IPmcData): void; protected addMissingRepeatableQuestsProperty(pmcProfile: IPmcData): void; diff --git a/TypeScript/7OnLoadHook/types/controllers/QuestController.d.ts b/TypeScript/7OnLoadHook/types/controllers/QuestController.d.ts index c00cd6d..2cbccfb 100644 --- a/TypeScript/7OnLoadHook/types/controllers/QuestController.d.ts +++ b/TypeScript/7OnLoadHook/types/controllers/QuestController.d.ts @@ -14,6 +14,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ItemEventRouter } from "../routers/ItemEventRouter"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocaleService } from "../services/LocaleService"; import { PlayerService } from "../services/PlayerService"; import { TimeUtil } from "../utils/TimeUtil"; export declare class QuestController { @@ -27,9 +28,10 @@ export declare class QuestController { protected questHelper: QuestHelper; protected questConditionHelper: QuestConditionHelper; protected playerService: PlayerService; + protected localeService: LocaleService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, itemHelper: ItemHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, questConditionHelper: QuestConditionHelper, playerService: PlayerService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, itemHelper: ItemHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, questConditionHelper: QuestConditionHelper, playerService: PlayerService, localeService: LocaleService, configServer: ConfigServer); /** * Get all quests visible to player * Exclude quests with incomplete preconditions (level/loyalty) diff --git a/TypeScript/7OnLoadHook/types/helpers/ItemHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/ItemHelper.d.ts index 70c88d6..4fff11e 100644 --- a/TypeScript/7OnLoadHook/types/helpers/ItemHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/ItemHelper.d.ts @@ -84,6 +84,11 @@ declare class ItemHelper { */ generateItemsFromStackSlot(item: ITemplateItem, parentId: string): Item[]; getItem(tpl: string): [boolean, ITemplateItem]; + /** + * get normalized value (0-1) based on item condition + * @param item + * @returns number between 0 and 1 + */ getItemQualityModifier(item: Item): number; findAndReturnChildrenByItems(items: Item[], itemID: string): string[]; /** diff --git a/TypeScript/7OnLoadHook/types/helpers/QuestHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/QuestHelper.d.ts index 04ede16..d6e382b 100644 --- a/TypeScript/7OnLoadHook/types/helpers/QuestHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/QuestHelper.d.ts @@ -8,6 +8,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ItemEventRouter } from "../routers/ItemEventRouter"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocaleService } from "../services/LocaleService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -25,6 +26,7 @@ export declare class QuestHelper { protected itemHelper: ItemHelper; protected itemEventRouter: ItemEventRouter; protected databaseServer: DatabaseServer; + protected localeService: LocaleService; protected ragfairServerHelper: RagfairServerHelper; protected dialogueHelper: DialogueHelper; protected profileHelper: ProfileHelper; @@ -32,7 +34,7 @@ export declare class QuestHelper { protected traderHelper: TraderHelper; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, traderHelper: TraderHelper, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, traderHelper: TraderHelper, configServer: ConfigServer); static get STATUS(): Record; questStatus(pmcData: IPmcData, questID: string): string; /** @@ -74,7 +76,7 @@ export declare class QuestHelper { cleanQuestConditions(quest: IQuest): IQuest; failQuest(pmcData: IPmcData, body: any, sessionID: string): any; getQuestFromDb(questId: string, pmcData: IPmcData): IQuest; - getQuestLocaleIdFromDb(messageId: string, localisation?: string): string; + getQuestLocaleIdFromDb(messageId: string): string; applyQuestReward(pmcData: IPmcData, body: ICompleteQuestRequestData, state: string, sessionID: string): Reward[]; /** * Get the intel center bonus a player has diff --git a/TypeScript/7OnLoadHook/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/RagfairOfferHelper.d.ts index 129bc1c..5a77e13 100644 --- a/TypeScript/7OnLoadHook/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/RagfairOfferHelper.d.ts @@ -10,6 +10,7 @@ import { ItemEventRouter } from "../routers/ItemEventRouter"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocaleService } from "../services/LocaleService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { HashUtil } from "../utils/HashUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -37,11 +38,12 @@ export declare class RagfairOfferHelper { protected ragfairSortHelper: RagfairSortHelper; protected ragfairHelper: RagfairHelper; protected ragfairOfferService: RagfairOfferService; + protected localeService: LocaleService; protected configServer: ConfigServer; protected static TPL_GOODS_SOLD: string; protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, saveServer: SaveServer, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, saveServer: SaveServer, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, configServer: ConfigServer); getValidOffers(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; getOffersForBuild(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; processOffers(sessionID: string): boolean; diff --git a/TypeScript/7OnLoadHook/types/helpers/RagfairServerHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/RagfairServerHelper.d.ts index 2cb3ea5..a52306b 100644 --- a/TypeScript/7OnLoadHook/types/helpers/RagfairServerHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/RagfairServerHelper.d.ts @@ -1,11 +1,12 @@ -import { MemberCategory } from "../models/enums/MemberCategory"; import { Item } from "../models/eft/common/tables/IItem"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { MemberCategory } from "../models/enums/MemberCategory"; import { IQuestConfig } from "../models/spt/config/IQuestConfig"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocaleService } from "../services/LocaleService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; @@ -19,13 +20,14 @@ export declare class RagfairServerHelper { protected databaseServer: DatabaseServer; protected profileHelper: ProfileHelper; protected itemHelper: ItemHelper; + protected localeService: LocaleService; protected dialogueHelper: DialogueHelper; protected jsonUtil: JsonUtil; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; protected static TPL_GOODS_RETURNED: string; - constructor(randomUtil: RandomUtil, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, profileHelper: ProfileHelper, itemHelper: ItemHelper, dialogueHelper: DialogueHelper, jsonUtil: JsonUtil, configServer: ConfigServer); + constructor(randomUtil: RandomUtil, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, profileHelper: ProfileHelper, itemHelper: ItemHelper, localeService: LocaleService, dialogueHelper: DialogueHelper, jsonUtil: JsonUtil, configServer: ConfigServer); /** * Is item valid / on blacklist / quest item * @param itemDetails diff --git a/TypeScript/7OnLoadHook/types/helpers/RagfairSortHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/RagfairSortHelper.d.ts index e983569..d20e10c 100644 --- a/TypeScript/7OnLoadHook/types/helpers/RagfairSortHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/RagfairSortHelper.d.ts @@ -1,8 +1,10 @@ import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocaleService } from "../services/LocaleService"; export declare class RagfairSortHelper { protected databaseServer: DatabaseServer; - constructor(databaseServer: DatabaseServer); + protected localeService: LocaleService; + constructor(databaseServer: DatabaseServer, localeService: LocaleService); sortOffers(offers: IRagfairOffer[], type: number, direction?: number): IRagfairOffer[]; protected sortOffersByID(a: IRagfairOffer, b: IRagfairOffer): number; protected sortOffersByRating(a: IRagfairOffer, b: IRagfairOffer): number; diff --git a/TypeScript/7OnLoadHook/types/helpers/TraderHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/TraderHelper.d.ts index ab4a371..717351f 100644 --- a/TypeScript/7OnLoadHook/types/helpers/TraderHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/TraderHelper.d.ts @@ -1,4 +1,6 @@ +import { FenceLevel } from "../models/eft/common/IGlobals"; import { IPmcData } from "../models/eft/common/IPmcData"; +import { Item } from "../models/eft/common/tables/IItem"; import { IBarterScheme, ITraderAssort, ITraderBase, LoyaltyLevel } from "../models/eft/common/tables/ITrader"; import { ITraderConfig } from "../models/spt/config/ITraderConfig"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -34,7 +36,48 @@ export declare class TraderHelper { */ resetTrader(sessionID: string, traderID: string): void; changeTraderDisplay(traderID: string, status: boolean, sessionID: string): void; + /** + * Get a list of items and their prices from player inventory that can be sold to a trader + * @param traderID trader id being traded with + * @param sessionID session id + * @returns IBarterScheme[][] + */ getPurchasesData(traderID: string, sessionID: string): Record; + /** + * Should item be skipped when selling to trader according to its sell categories and other checks + * @param pmcData + * @param item + * @param sellCategory + * @returns true if should NOT be sold to trader + */ + protected isItemUnSellableToTrader(pmcData: IPmcData, item: Item, sellCategory: string[]): boolean; + /** + * Can this weapon be sold to a trader with its current durabiltiy level + * @param traderID + * @param item + * @returns boolean + */ + protected isWeaponAndBelowTraderBuyDurability(traderID: string, item: Item): boolean; + /** + * Get the price of an item and all of its attached children + * Take into account bonuses/adjsutments e.g. discounts + * @param pmcData profile data + * @param item item to calculate price of + * @param buyPriceCoefficient + * @param fenceInfo fence data + * @param traderBase trader details + * @param currencyTpl Currency to get price as + * @returns price of item + children + */ + protected getAdjustedItemPrice(pmcData: IPmcData, item: Item, buyPriceCoefficient: number, fenceInfo: FenceLevel, traderBase: ITraderBase, currencyTpl: string): number; + /** + * Get the raw price of item+child items from handbook without any modification + * @param pmcData profile data + * @param item item to calculate price of + * @returns price as number + */ + protected getRawItemPrice(pmcData: IPmcData, item: Item): number; + protected getTraderDiscount(trader: ITraderBase, buyPriceCoefficient: number, fenceInfo: FenceLevel, traderID: string): number; /** * Calculate traders level based on exp amount and increment level if over threshold * @param traderID trader to process diff --git a/TypeScript/7OnLoadHook/types/loaders/AfterDbModLoader.d.ts b/TypeScript/7OnLoadHook/types/loaders/AfterDbModLoader.d.ts new file mode 100644 index 0000000..a9fc286 --- /dev/null +++ b/TypeScript/7OnLoadHook/types/loaders/AfterDbModLoader.d.ts @@ -0,0 +1,11 @@ +import { DependencyContainer } from "tsyringe"; +import { OnLoad } from "../di/OnLoad"; +import { InitialModLoader } from "./InitialModLoader"; +export declare class AfterDbModLoader implements OnLoad { + protected initialModLoader: InitialModLoader; + constructor(initialModLoader: InitialModLoader); + onLoad(): void; + getRoute(): string; + getModPath(mod: string): string; + protected executeMods(container: DependencyContainer): void; +} diff --git a/TypeScript/7OnLoadHook/types/models/enums/ConfigTypes.d.ts b/TypeScript/7OnLoadHook/types/models/enums/ConfigTypes.d.ts index 6bd31e8..1c49e62 100644 --- a/TypeScript/7OnLoadHook/types/models/enums/ConfigTypes.d.ts +++ b/TypeScript/7OnLoadHook/types/models/enums/ConfigTypes.d.ts @@ -8,6 +8,7 @@ export declare enum ConfigTypes { IN_RAID = "aki-inraid", INSURANCE = "aki-insurance", INVENTORY = "aki-inventory", + LOCALE = "aki-locale", LOCATION = "aki-location", MATCH = "aki-match", QUEST = "aki-quest", diff --git a/TypeScript/7OnLoadHook/types/models/external/IAfterDBLoadMod.d.ts b/TypeScript/7OnLoadHook/types/models/external/IAfterDBLoadMod.d.ts new file mode 100644 index 0000000..7f08b9e --- /dev/null +++ b/TypeScript/7OnLoadHook/types/models/external/IAfterDBLoadMod.d.ts @@ -0,0 +1,4 @@ +import { DependencyContainer } from "./tsyringe"; +export interface IAfterDBLoadMod { + loadAfterDbInit(container: DependencyContainer): void; +} diff --git a/TypeScript/7OnLoadHook/types/models/external/mod.d.ts b/TypeScript/7OnLoadHook/types/models/external/mod.d.ts index ecef460..47939e9 100644 --- a/TypeScript/7OnLoadHook/types/models/external/mod.d.ts +++ b/TypeScript/7OnLoadHook/types/models/external/mod.d.ts @@ -1,5 +1,5 @@ import { DependencyContainer } from "./tsyringe"; export interface IMod { - load: (container: DependencyContainer) => void; - delayedLoad: (container: DependencyContainer) => void; + load(container: DependencyContainer): void; + delayedLoad(container: DependencyContainer): void; } diff --git a/TypeScript/7OnLoadHook/types/models/spt/config/ILocaleConfig.d.ts b/TypeScript/7OnLoadHook/types/models/spt/config/ILocaleConfig.d.ts new file mode 100644 index 0000000..fe9abf7 --- /dev/null +++ b/TypeScript/7OnLoadHook/types/models/spt/config/ILocaleConfig.d.ts @@ -0,0 +1,5 @@ +import { IBaseConfig } from "./IBaseConfig"; +export interface ILocaleConfig extends IBaseConfig { + kind: "aki-locale"; + desiredLocale: string; +} diff --git a/TypeScript/7OnLoadHook/types/models/spt/logging/LogBackgroundColor.d.ts b/TypeScript/7OnLoadHook/types/models/spt/logging/LogBackgroundColor.d.ts new file mode 100644 index 0000000..87e08a9 --- /dev/null +++ b/TypeScript/7OnLoadHook/types/models/spt/logging/LogBackgroundColor.d.ts @@ -0,0 +1,11 @@ +export declare enum LogBackgroundColor { + default = "", + black = "blackBG", + red = "redBG", + green = "greenBG", + yellow = "yellowBG", + blue = "blueBG", + magenta = "magentaBG", + cyan = "cyanBG", + white = "whiteBG" +} diff --git a/TypeScript/7OnLoadHook/types/models/spt/logging/LogTextColor.d.ts b/TypeScript/7OnLoadHook/types/models/spt/logging/LogTextColor.d.ts new file mode 100644 index 0000000..7147ae3 --- /dev/null +++ b/TypeScript/7OnLoadHook/types/models/spt/logging/LogTextColor.d.ts @@ -0,0 +1,11 @@ +export declare enum LogTextColor { + black = "black", + red = "red", + green = "green", + yellow = "yellow", + blue = "blue", + magenta = "magenta", + cyan = "cyan", + white = "white", + gray = "" +} diff --git a/TypeScript/7OnLoadHook/types/models/spt/logging/SptLogger.d.ts b/TypeScript/7OnLoadHook/types/models/spt/logging/SptLogger.d.ts new file mode 100644 index 0000000..ea1b3d8 --- /dev/null +++ b/TypeScript/7OnLoadHook/types/models/spt/logging/SptLogger.d.ts @@ -0,0 +1,7 @@ +export interface SptLogger { + error: (msg: string | Record) => void; + warn: (msg: string | Record) => void; + succ?: (msg: string | Record) => void; + info: (msg: string | Record) => void; + debug: (msg: string | Record) => void; +} diff --git a/TypeScript/7OnLoadHook/types/models/spt/utils/ILogger.d.ts b/TypeScript/7OnLoadHook/types/models/spt/utils/ILogger.d.ts index c983701..2af3fac 100644 --- a/TypeScript/7OnLoadHook/types/models/spt/utils/ILogger.d.ts +++ b/TypeScript/7OnLoadHook/types/models/spt/utils/ILogger.d.ts @@ -1,7 +1,10 @@ import { Daum } from "../../eft/itemEvent/IItemEventRouterRequest"; +import { LogBackgroundColor } from "../logging/LogBackgroundColor"; +import { LogTextColor } from "../logging/LogTextColor"; export interface ILogger { writeToLogFile(data: string | Daum): void; - log(data: string | Record | Error, color: string): void; + log(data: string | Record | Error, color: string, backgroundColor?: string): void; + logWithColor(data: string | Record, textColor: LogTextColor, backgroundColor?: LogBackgroundColor): void; error(data: string): void; warning(data: string): void; success(data: string): void; diff --git a/TypeScript/7OnLoadHook/types/services/FenceService.d.ts b/TypeScript/7OnLoadHook/types/services/FenceService.d.ts index 12723fb..79058c6 100644 --- a/TypeScript/7OnLoadHook/types/services/FenceService.d.ts +++ b/TypeScript/7OnLoadHook/types/services/FenceService.d.ts @@ -29,8 +29,8 @@ export declare class FenceService { hasExpiredCache(refreshAssort: boolean): boolean; generateFenceAssortCache(pmcData: IPmcData): void; /** - * - * @param pmcData Get the fence level the passed in profile has + * Get the fence level the passed in profile has + * @param pmcData Player profile * @returns FenceLevel */ getFenceInfo(pmcData: IPmcData): FenceLevel; diff --git a/TypeScript/7OnLoadHook/types/services/LocaleService.d.ts b/TypeScript/7OnLoadHook/types/services/LocaleService.d.ts new file mode 100644 index 0000000..33bea7b --- /dev/null +++ b/TypeScript/7OnLoadHook/types/services/LocaleService.d.ts @@ -0,0 +1,14 @@ +import { ILocaleConfig } from "../models/spt/config/ILocaleConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +export declare class LocaleService { + protected logger: ILogger; + protected configServer: ConfigServer; + protected localeConfig: ILocaleConfig; + constructor(logger: ILogger, configServer: ConfigServer); + /** + * Gets the locale key from the locale.json file + * @returns locale e.g en/ge/cz/cn + */ + getDesiredLocale(): string; +} diff --git a/TypeScript/7OnLoadHook/types/utils/DatabaseImporter.d.ts b/TypeScript/7OnLoadHook/types/utils/DatabaseImporter.d.ts index 24c1cd6..b3156ea 100644 --- a/TypeScript/7OnLoadHook/types/utils/DatabaseImporter.d.ts +++ b/TypeScript/7OnLoadHook/types/utils/DatabaseImporter.d.ts @@ -5,7 +5,7 @@ import { ImageRouter } from "../routers/ImageRouter"; import { DatabaseServer } from "../servers/DatabaseServer"; import { CustomHandbookItemService } from "../services/CustomHandbookItemService"; import { CustomItemService } from "../services/CustomItemService"; -import { CustomPresetService } from "../services/customPresetService"; +import { CustomPresetService } from "../services/CustomPresetService"; import { CustomTraderAssortService } from "../services/CustomTraderAssortService"; import { JsonUtil } from "./JsonUtil"; import { VFS } from "./VFS"; diff --git a/TypeScript/7OnLoadHook/types/utils/Logger.d.ts b/TypeScript/7OnLoadHook/types/utils/Logger.d.ts index f5b774b..3d9013f 100644 --- a/TypeScript/7OnLoadHook/types/utils/Logger.d.ts +++ b/TypeScript/7OnLoadHook/types/utils/Logger.d.ts @@ -1,17 +1,13 @@ /// -import { Daum } from "../models/eft/itemEvent/IItemEventRouterRequest"; -import { ILogger } from "../models/spt/utils/ILogger"; -import winston from "winston"; -import { IAsyncQueue } from "../models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "../models/spt/utils/IUuidGenerator"; import fs from "fs"; -interface SptLogger { - error: (msg: string | Record) => void; - warn: (msg: string | Record) => void; - succ?: (msg: string | Record) => void; - info: (msg: string | Record) => void; - debug: (msg: string | Record) => void; -} +import winston from "winston"; +import { Daum } from "../models/eft/itemEvent/IItemEventRouterRequest"; +import { LogBackgroundColor } from "../models/spt/logging/LogBackgroundColor"; +import { LogTextColor } from "../models/spt/logging/LogTextColor"; +import { SptLogger } from "../models/spt/logging/SptLogger"; +import { IAsyncQueue } from "../models/spt/utils/IAsyncQueue"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { IUUidGenerator } from "../models/spt/utils/IUuidGenerator"; export declare class WinstonLogger implements ILogger { protected asyncQueue: IAsyncQueue; protected uuidGenerator: IUUidGenerator; @@ -36,16 +32,27 @@ export declare class WinstonLogger implements ILogger { custom: string; debug: string; }; + bgColors: { + default: string; + blackBG: string; + redBG: string; + greenBG: string; + yellowBG: string; + blueBG: string; + magentaBG: string; + cyanBG: string; + whiteBG: string; + }; }; protected logger: winston.Logger & SptLogger; - writeFilePromisify: (path: fs.PathLike, data: string, options?: any) => Promise; + protected writeFilePromisify: (path: fs.PathLike, data: string, options?: any) => Promise; constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); writeToLogFile(data: string | Daum): Promise; - log(data: string | Error | Record, color: string): Promise; + log(data: string | Error | Record, color: string, backgroundColor?: string): Promise; error(data: string | Record): Promise; warning(data: string | Record): Promise; success(data: string | Record): Promise; info(data: string | Record): Promise; + logWithColor(data: string | Record, textColor: LogTextColor, backgroundColor?: LogBackgroundColor): Promise; debug(data: string | Record, onlyShowInConsole?: boolean): Promise; } -export {}; diff --git a/TypeScript/8OnUpdateHook/types/controllers/GameController.d.ts b/TypeScript/8OnUpdateHook/types/controllers/GameController.d.ts index 7f632d6..5f516de 100644 --- a/TypeScript/8OnUpdateHook/types/controllers/GameController.d.ts +++ b/TypeScript/8OnUpdateHook/types/controllers/GameController.d.ts @@ -6,19 +6,23 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { IPmcDataRepeatableQuest, IRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; import { IGameConfigResponse } from "../models/eft/game/IGameConfigResponse"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; +import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { LocaleService } from "../services/LocaleService"; import { Watermark } from "../utils/Watermark"; export declare class GameController { protected logger: ILogger; protected watermark: Watermark; protected httpServerHelper: HttpServerHelper; + protected localeService: LocaleService; protected profileHelper: ProfileHelper; protected gameHelper: GameHelper; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; - constructor(logger: ILogger, watermark: Watermark, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper, gameHelper: GameHelper, configServer: ConfigServer); + protected coreConfig: ICoreConfig; + constructor(logger: ILogger, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, gameHelper: GameHelper, configServer: ConfigServer); gameStart(_url: string, _info: IEmptyRequestData, sessionID: string): void; protected addMissingBonusesProperty(pmcProfile: IPmcData): void; protected addMissingRepeatableQuestsProperty(pmcProfile: IPmcData): void; diff --git a/TypeScript/8OnUpdateHook/types/controllers/QuestController.d.ts b/TypeScript/8OnUpdateHook/types/controllers/QuestController.d.ts index c00cd6d..2cbccfb 100644 --- a/TypeScript/8OnUpdateHook/types/controllers/QuestController.d.ts +++ b/TypeScript/8OnUpdateHook/types/controllers/QuestController.d.ts @@ -14,6 +14,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ItemEventRouter } from "../routers/ItemEventRouter"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocaleService } from "../services/LocaleService"; import { PlayerService } from "../services/PlayerService"; import { TimeUtil } from "../utils/TimeUtil"; export declare class QuestController { @@ -27,9 +28,10 @@ export declare class QuestController { protected questHelper: QuestHelper; protected questConditionHelper: QuestConditionHelper; protected playerService: PlayerService; + protected localeService: LocaleService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, itemHelper: ItemHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, questConditionHelper: QuestConditionHelper, playerService: PlayerService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, itemHelper: ItemHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, questConditionHelper: QuestConditionHelper, playerService: PlayerService, localeService: LocaleService, configServer: ConfigServer); /** * Get all quests visible to player * Exclude quests with incomplete preconditions (level/loyalty) diff --git a/TypeScript/8OnUpdateHook/types/helpers/ItemHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/ItemHelper.d.ts index 70c88d6..4fff11e 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/ItemHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/ItemHelper.d.ts @@ -84,6 +84,11 @@ declare class ItemHelper { */ generateItemsFromStackSlot(item: ITemplateItem, parentId: string): Item[]; getItem(tpl: string): [boolean, ITemplateItem]; + /** + * get normalized value (0-1) based on item condition + * @param item + * @returns number between 0 and 1 + */ getItemQualityModifier(item: Item): number; findAndReturnChildrenByItems(items: Item[], itemID: string): string[]; /** diff --git a/TypeScript/8OnUpdateHook/types/helpers/QuestHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/QuestHelper.d.ts index 04ede16..d6e382b 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/QuestHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/QuestHelper.d.ts @@ -8,6 +8,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ItemEventRouter } from "../routers/ItemEventRouter"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocaleService } from "../services/LocaleService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -25,6 +26,7 @@ export declare class QuestHelper { protected itemHelper: ItemHelper; protected itemEventRouter: ItemEventRouter; protected databaseServer: DatabaseServer; + protected localeService: LocaleService; protected ragfairServerHelper: RagfairServerHelper; protected dialogueHelper: DialogueHelper; protected profileHelper: ProfileHelper; @@ -32,7 +34,7 @@ export declare class QuestHelper { protected traderHelper: TraderHelper; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, traderHelper: TraderHelper, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, traderHelper: TraderHelper, configServer: ConfigServer); static get STATUS(): Record; questStatus(pmcData: IPmcData, questID: string): string; /** @@ -74,7 +76,7 @@ export declare class QuestHelper { cleanQuestConditions(quest: IQuest): IQuest; failQuest(pmcData: IPmcData, body: any, sessionID: string): any; getQuestFromDb(questId: string, pmcData: IPmcData): IQuest; - getQuestLocaleIdFromDb(messageId: string, localisation?: string): string; + getQuestLocaleIdFromDb(messageId: string): string; applyQuestReward(pmcData: IPmcData, body: ICompleteQuestRequestData, state: string, sessionID: string): Reward[]; /** * Get the intel center bonus a player has diff --git a/TypeScript/8OnUpdateHook/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/RagfairOfferHelper.d.ts index 129bc1c..5a77e13 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/RagfairOfferHelper.d.ts @@ -10,6 +10,7 @@ import { ItemEventRouter } from "../routers/ItemEventRouter"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocaleService } from "../services/LocaleService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { HashUtil } from "../utils/HashUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -37,11 +38,12 @@ export declare class RagfairOfferHelper { protected ragfairSortHelper: RagfairSortHelper; protected ragfairHelper: RagfairHelper; protected ragfairOfferService: RagfairOfferService; + protected localeService: LocaleService; protected configServer: ConfigServer; protected static TPL_GOODS_SOLD: string; protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, saveServer: SaveServer, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, saveServer: SaveServer, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, configServer: ConfigServer); getValidOffers(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; getOffersForBuild(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; processOffers(sessionID: string): boolean; diff --git a/TypeScript/8OnUpdateHook/types/helpers/RagfairServerHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/RagfairServerHelper.d.ts index 2cb3ea5..a52306b 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/RagfairServerHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/RagfairServerHelper.d.ts @@ -1,11 +1,12 @@ -import { MemberCategory } from "../models/enums/MemberCategory"; import { Item } from "../models/eft/common/tables/IItem"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { MemberCategory } from "../models/enums/MemberCategory"; import { IQuestConfig } from "../models/spt/config/IQuestConfig"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocaleService } from "../services/LocaleService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; @@ -19,13 +20,14 @@ export declare class RagfairServerHelper { protected databaseServer: DatabaseServer; protected profileHelper: ProfileHelper; protected itemHelper: ItemHelper; + protected localeService: LocaleService; protected dialogueHelper: DialogueHelper; protected jsonUtil: JsonUtil; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; protected static TPL_GOODS_RETURNED: string; - constructor(randomUtil: RandomUtil, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, profileHelper: ProfileHelper, itemHelper: ItemHelper, dialogueHelper: DialogueHelper, jsonUtil: JsonUtil, configServer: ConfigServer); + constructor(randomUtil: RandomUtil, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, profileHelper: ProfileHelper, itemHelper: ItemHelper, localeService: LocaleService, dialogueHelper: DialogueHelper, jsonUtil: JsonUtil, configServer: ConfigServer); /** * Is item valid / on blacklist / quest item * @param itemDetails diff --git a/TypeScript/8OnUpdateHook/types/helpers/RagfairSortHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/RagfairSortHelper.d.ts index e983569..d20e10c 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/RagfairSortHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/RagfairSortHelper.d.ts @@ -1,8 +1,10 @@ import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocaleService } from "../services/LocaleService"; export declare class RagfairSortHelper { protected databaseServer: DatabaseServer; - constructor(databaseServer: DatabaseServer); + protected localeService: LocaleService; + constructor(databaseServer: DatabaseServer, localeService: LocaleService); sortOffers(offers: IRagfairOffer[], type: number, direction?: number): IRagfairOffer[]; protected sortOffersByID(a: IRagfairOffer, b: IRagfairOffer): number; protected sortOffersByRating(a: IRagfairOffer, b: IRagfairOffer): number; diff --git a/TypeScript/8OnUpdateHook/types/helpers/TraderHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/TraderHelper.d.ts index ab4a371..717351f 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/TraderHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/TraderHelper.d.ts @@ -1,4 +1,6 @@ +import { FenceLevel } from "../models/eft/common/IGlobals"; import { IPmcData } from "../models/eft/common/IPmcData"; +import { Item } from "../models/eft/common/tables/IItem"; import { IBarterScheme, ITraderAssort, ITraderBase, LoyaltyLevel } from "../models/eft/common/tables/ITrader"; import { ITraderConfig } from "../models/spt/config/ITraderConfig"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -34,7 +36,48 @@ export declare class TraderHelper { */ resetTrader(sessionID: string, traderID: string): void; changeTraderDisplay(traderID: string, status: boolean, sessionID: string): void; + /** + * Get a list of items and their prices from player inventory that can be sold to a trader + * @param traderID trader id being traded with + * @param sessionID session id + * @returns IBarterScheme[][] + */ getPurchasesData(traderID: string, sessionID: string): Record; + /** + * Should item be skipped when selling to trader according to its sell categories and other checks + * @param pmcData + * @param item + * @param sellCategory + * @returns true if should NOT be sold to trader + */ + protected isItemUnSellableToTrader(pmcData: IPmcData, item: Item, sellCategory: string[]): boolean; + /** + * Can this weapon be sold to a trader with its current durabiltiy level + * @param traderID + * @param item + * @returns boolean + */ + protected isWeaponAndBelowTraderBuyDurability(traderID: string, item: Item): boolean; + /** + * Get the price of an item and all of its attached children + * Take into account bonuses/adjsutments e.g. discounts + * @param pmcData profile data + * @param item item to calculate price of + * @param buyPriceCoefficient + * @param fenceInfo fence data + * @param traderBase trader details + * @param currencyTpl Currency to get price as + * @returns price of item + children + */ + protected getAdjustedItemPrice(pmcData: IPmcData, item: Item, buyPriceCoefficient: number, fenceInfo: FenceLevel, traderBase: ITraderBase, currencyTpl: string): number; + /** + * Get the raw price of item+child items from handbook without any modification + * @param pmcData profile data + * @param item item to calculate price of + * @returns price as number + */ + protected getRawItemPrice(pmcData: IPmcData, item: Item): number; + protected getTraderDiscount(trader: ITraderBase, buyPriceCoefficient: number, fenceInfo: FenceLevel, traderID: string): number; /** * Calculate traders level based on exp amount and increment level if over threshold * @param traderID trader to process diff --git a/TypeScript/8OnUpdateHook/types/loaders/AfterDbModLoader.d.ts b/TypeScript/8OnUpdateHook/types/loaders/AfterDbModLoader.d.ts new file mode 100644 index 0000000..a9fc286 --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/loaders/AfterDbModLoader.d.ts @@ -0,0 +1,11 @@ +import { DependencyContainer } from "tsyringe"; +import { OnLoad } from "../di/OnLoad"; +import { InitialModLoader } from "./InitialModLoader"; +export declare class AfterDbModLoader implements OnLoad { + protected initialModLoader: InitialModLoader; + constructor(initialModLoader: InitialModLoader); + onLoad(): void; + getRoute(): string; + getModPath(mod: string): string; + protected executeMods(container: DependencyContainer): void; +} diff --git a/TypeScript/8OnUpdateHook/types/models/enums/ConfigTypes.d.ts b/TypeScript/8OnUpdateHook/types/models/enums/ConfigTypes.d.ts index 6bd31e8..1c49e62 100644 --- a/TypeScript/8OnUpdateHook/types/models/enums/ConfigTypes.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/enums/ConfigTypes.d.ts @@ -8,6 +8,7 @@ export declare enum ConfigTypes { IN_RAID = "aki-inraid", INSURANCE = "aki-insurance", INVENTORY = "aki-inventory", + LOCALE = "aki-locale", LOCATION = "aki-location", MATCH = "aki-match", QUEST = "aki-quest", diff --git a/TypeScript/8OnUpdateHook/types/models/external/IAfterDBLoadMod.d.ts b/TypeScript/8OnUpdateHook/types/models/external/IAfterDBLoadMod.d.ts new file mode 100644 index 0000000..7f08b9e --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/models/external/IAfterDBLoadMod.d.ts @@ -0,0 +1,4 @@ +import { DependencyContainer } from "./tsyringe"; +export interface IAfterDBLoadMod { + loadAfterDbInit(container: DependencyContainer): void; +} diff --git a/TypeScript/8OnUpdateHook/types/models/external/mod.d.ts b/TypeScript/8OnUpdateHook/types/models/external/mod.d.ts index ecef460..47939e9 100644 --- a/TypeScript/8OnUpdateHook/types/models/external/mod.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/external/mod.d.ts @@ -1,5 +1,5 @@ import { DependencyContainer } from "./tsyringe"; export interface IMod { - load: (container: DependencyContainer) => void; - delayedLoad: (container: DependencyContainer) => void; + load(container: DependencyContainer): void; + delayedLoad(container: DependencyContainer): void; } diff --git a/TypeScript/8OnUpdateHook/types/models/spt/config/ILocaleConfig.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/config/ILocaleConfig.d.ts new file mode 100644 index 0000000..fe9abf7 --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/models/spt/config/ILocaleConfig.d.ts @@ -0,0 +1,5 @@ +import { IBaseConfig } from "./IBaseConfig"; +export interface ILocaleConfig extends IBaseConfig { + kind: "aki-locale"; + desiredLocale: string; +} diff --git a/TypeScript/8OnUpdateHook/types/models/spt/logging/LogBackgroundColor.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/logging/LogBackgroundColor.d.ts new file mode 100644 index 0000000..87e08a9 --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/models/spt/logging/LogBackgroundColor.d.ts @@ -0,0 +1,11 @@ +export declare enum LogBackgroundColor { + default = "", + black = "blackBG", + red = "redBG", + green = "greenBG", + yellow = "yellowBG", + blue = "blueBG", + magenta = "magentaBG", + cyan = "cyanBG", + white = "whiteBG" +} diff --git a/TypeScript/8OnUpdateHook/types/models/spt/logging/LogTextColor.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/logging/LogTextColor.d.ts new file mode 100644 index 0000000..7147ae3 --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/models/spt/logging/LogTextColor.d.ts @@ -0,0 +1,11 @@ +export declare enum LogTextColor { + black = "black", + red = "red", + green = "green", + yellow = "yellow", + blue = "blue", + magenta = "magenta", + cyan = "cyan", + white = "white", + gray = "" +} diff --git a/TypeScript/8OnUpdateHook/types/models/spt/logging/SptLogger.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/logging/SptLogger.d.ts new file mode 100644 index 0000000..ea1b3d8 --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/models/spt/logging/SptLogger.d.ts @@ -0,0 +1,7 @@ +export interface SptLogger { + error: (msg: string | Record) => void; + warn: (msg: string | Record) => void; + succ?: (msg: string | Record) => void; + info: (msg: string | Record) => void; + debug: (msg: string | Record) => void; +} diff --git a/TypeScript/8OnUpdateHook/types/models/spt/utils/ILogger.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/utils/ILogger.d.ts index c983701..2af3fac 100644 --- a/TypeScript/8OnUpdateHook/types/models/spt/utils/ILogger.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/spt/utils/ILogger.d.ts @@ -1,7 +1,10 @@ import { Daum } from "../../eft/itemEvent/IItemEventRouterRequest"; +import { LogBackgroundColor } from "../logging/LogBackgroundColor"; +import { LogTextColor } from "../logging/LogTextColor"; export interface ILogger { writeToLogFile(data: string | Daum): void; - log(data: string | Record | Error, color: string): void; + log(data: string | Record | Error, color: string, backgroundColor?: string): void; + logWithColor(data: string | Record, textColor: LogTextColor, backgroundColor?: LogBackgroundColor): void; error(data: string): void; warning(data: string): void; success(data: string): void; diff --git a/TypeScript/8OnUpdateHook/types/services/FenceService.d.ts b/TypeScript/8OnUpdateHook/types/services/FenceService.d.ts index 12723fb..79058c6 100644 --- a/TypeScript/8OnUpdateHook/types/services/FenceService.d.ts +++ b/TypeScript/8OnUpdateHook/types/services/FenceService.d.ts @@ -29,8 +29,8 @@ export declare class FenceService { hasExpiredCache(refreshAssort: boolean): boolean; generateFenceAssortCache(pmcData: IPmcData): void; /** - * - * @param pmcData Get the fence level the passed in profile has + * Get the fence level the passed in profile has + * @param pmcData Player profile * @returns FenceLevel */ getFenceInfo(pmcData: IPmcData): FenceLevel; diff --git a/TypeScript/8OnUpdateHook/types/services/LocaleService.d.ts b/TypeScript/8OnUpdateHook/types/services/LocaleService.d.ts new file mode 100644 index 0000000..33bea7b --- /dev/null +++ b/TypeScript/8OnUpdateHook/types/services/LocaleService.d.ts @@ -0,0 +1,14 @@ +import { ILocaleConfig } from "../models/spt/config/ILocaleConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +export declare class LocaleService { + protected logger: ILogger; + protected configServer: ConfigServer; + protected localeConfig: ILocaleConfig; + constructor(logger: ILogger, configServer: ConfigServer); + /** + * Gets the locale key from the locale.json file + * @returns locale e.g en/ge/cz/cn + */ + getDesiredLocale(): string; +} diff --git a/TypeScript/8OnUpdateHook/types/utils/DatabaseImporter.d.ts b/TypeScript/8OnUpdateHook/types/utils/DatabaseImporter.d.ts index 24c1cd6..b3156ea 100644 --- a/TypeScript/8OnUpdateHook/types/utils/DatabaseImporter.d.ts +++ b/TypeScript/8OnUpdateHook/types/utils/DatabaseImporter.d.ts @@ -5,7 +5,7 @@ import { ImageRouter } from "../routers/ImageRouter"; import { DatabaseServer } from "../servers/DatabaseServer"; import { CustomHandbookItemService } from "../services/CustomHandbookItemService"; import { CustomItemService } from "../services/CustomItemService"; -import { CustomPresetService } from "../services/customPresetService"; +import { CustomPresetService } from "../services/CustomPresetService"; import { CustomTraderAssortService } from "../services/CustomTraderAssortService"; import { JsonUtil } from "./JsonUtil"; import { VFS } from "./VFS"; diff --git a/TypeScript/8OnUpdateHook/types/utils/Logger.d.ts b/TypeScript/8OnUpdateHook/types/utils/Logger.d.ts index f5b774b..3d9013f 100644 --- a/TypeScript/8OnUpdateHook/types/utils/Logger.d.ts +++ b/TypeScript/8OnUpdateHook/types/utils/Logger.d.ts @@ -1,17 +1,13 @@ /// -import { Daum } from "../models/eft/itemEvent/IItemEventRouterRequest"; -import { ILogger } from "../models/spt/utils/ILogger"; -import winston from "winston"; -import { IAsyncQueue } from "../models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "../models/spt/utils/IUuidGenerator"; import fs from "fs"; -interface SptLogger { - error: (msg: string | Record) => void; - warn: (msg: string | Record) => void; - succ?: (msg: string | Record) => void; - info: (msg: string | Record) => void; - debug: (msg: string | Record) => void; -} +import winston from "winston"; +import { Daum } from "../models/eft/itemEvent/IItemEventRouterRequest"; +import { LogBackgroundColor } from "../models/spt/logging/LogBackgroundColor"; +import { LogTextColor } from "../models/spt/logging/LogTextColor"; +import { SptLogger } from "../models/spt/logging/SptLogger"; +import { IAsyncQueue } from "../models/spt/utils/IAsyncQueue"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { IUUidGenerator } from "../models/spt/utils/IUuidGenerator"; export declare class WinstonLogger implements ILogger { protected asyncQueue: IAsyncQueue; protected uuidGenerator: IUUidGenerator; @@ -36,16 +32,27 @@ export declare class WinstonLogger implements ILogger { custom: string; debug: string; }; + bgColors: { + default: string; + blackBG: string; + redBG: string; + greenBG: string; + yellowBG: string; + blueBG: string; + magentaBG: string; + cyanBG: string; + whiteBG: string; + }; }; protected logger: winston.Logger & SptLogger; - writeFilePromisify: (path: fs.PathLike, data: string, options?: any) => Promise; + protected writeFilePromisify: (path: fs.PathLike, data: string, options?: any) => Promise; constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); writeToLogFile(data: string | Daum): Promise; - log(data: string | Error | Record, color: string): Promise; + log(data: string | Error | Record, color: string, backgroundColor?: string): Promise; error(data: string | Record): Promise; warning(data: string | Record): Promise; success(data: string | Record): Promise; info(data: string | Record): Promise; + logWithColor(data: string | Record, textColor: LogTextColor, backgroundColor?: LogBackgroundColor): Promise; debug(data: string | Record, onlyShowInConsole?: boolean): Promise; } -export {}; diff --git a/TypeScript/9RouterHooks/types/controllers/GameController.d.ts b/TypeScript/9RouterHooks/types/controllers/GameController.d.ts index 7f632d6..5f516de 100644 --- a/TypeScript/9RouterHooks/types/controllers/GameController.d.ts +++ b/TypeScript/9RouterHooks/types/controllers/GameController.d.ts @@ -6,19 +6,23 @@ import { IPmcData } from "../models/eft/common/IPmcData"; import { IPmcDataRepeatableQuest, IRepeatableQuest } from "../models/eft/common/tables/IRepeatableQuests"; import { IGameConfigResponse } from "../models/eft/game/IGameConfigResponse"; import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; +import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; +import { LocaleService } from "../services/LocaleService"; import { Watermark } from "../utils/Watermark"; export declare class GameController { protected logger: ILogger; protected watermark: Watermark; protected httpServerHelper: HttpServerHelper; + protected localeService: LocaleService; protected profileHelper: ProfileHelper; protected gameHelper: GameHelper; protected configServer: ConfigServer; protected httpConfig: IHttpConfig; - constructor(logger: ILogger, watermark: Watermark, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper, gameHelper: GameHelper, configServer: ConfigServer); + protected coreConfig: ICoreConfig; + constructor(logger: ILogger, watermark: Watermark, httpServerHelper: HttpServerHelper, localeService: LocaleService, profileHelper: ProfileHelper, gameHelper: GameHelper, configServer: ConfigServer); gameStart(_url: string, _info: IEmptyRequestData, sessionID: string): void; protected addMissingBonusesProperty(pmcProfile: IPmcData): void; protected addMissingRepeatableQuestsProperty(pmcProfile: IPmcData): void; diff --git a/TypeScript/9RouterHooks/types/controllers/QuestController.d.ts b/TypeScript/9RouterHooks/types/controllers/QuestController.d.ts index c00cd6d..2cbccfb 100644 --- a/TypeScript/9RouterHooks/types/controllers/QuestController.d.ts +++ b/TypeScript/9RouterHooks/types/controllers/QuestController.d.ts @@ -14,6 +14,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ItemEventRouter } from "../routers/ItemEventRouter"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocaleService } from "../services/LocaleService"; import { PlayerService } from "../services/PlayerService"; import { TimeUtil } from "../utils/TimeUtil"; export declare class QuestController { @@ -27,9 +28,10 @@ export declare class QuestController { protected questHelper: QuestHelper; protected questConditionHelper: QuestConditionHelper; protected playerService: PlayerService; + protected localeService: LocaleService; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, itemHelper: ItemHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, questConditionHelper: QuestConditionHelper, playerService: PlayerService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, itemHelper: ItemHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, questHelper: QuestHelper, questConditionHelper: QuestConditionHelper, playerService: PlayerService, localeService: LocaleService, configServer: ConfigServer); /** * Get all quests visible to player * Exclude quests with incomplete preconditions (level/loyalty) diff --git a/TypeScript/9RouterHooks/types/helpers/ItemHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/ItemHelper.d.ts index 70c88d6..4fff11e 100644 --- a/TypeScript/9RouterHooks/types/helpers/ItemHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/ItemHelper.d.ts @@ -84,6 +84,11 @@ declare class ItemHelper { */ generateItemsFromStackSlot(item: ITemplateItem, parentId: string): Item[]; getItem(tpl: string): [boolean, ITemplateItem]; + /** + * get normalized value (0-1) based on item condition + * @param item + * @returns number between 0 and 1 + */ getItemQualityModifier(item: Item): number; findAndReturnChildrenByItems(items: Item[], itemID: string): string[]; /** diff --git a/TypeScript/9RouterHooks/types/helpers/QuestHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/QuestHelper.d.ts index 04ede16..d6e382b 100644 --- a/TypeScript/9RouterHooks/types/helpers/QuestHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/QuestHelper.d.ts @@ -8,6 +8,7 @@ import { ILogger } from "../models/spt/utils/ILogger"; import { ItemEventRouter } from "../routers/ItemEventRouter"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocaleService } from "../services/LocaleService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -25,6 +26,7 @@ export declare class QuestHelper { protected itemHelper: ItemHelper; protected itemEventRouter: ItemEventRouter; protected databaseServer: DatabaseServer; + protected localeService: LocaleService; protected ragfairServerHelper: RagfairServerHelper; protected dialogueHelper: DialogueHelper; protected profileHelper: ProfileHelper; @@ -32,7 +34,7 @@ export declare class QuestHelper { protected traderHelper: TraderHelper; protected configServer: ConfigServer; protected questConfig: IQuestConfig; - constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, traderHelper: TraderHelper, configServer: ConfigServer); + constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, traderHelper: TraderHelper, configServer: ConfigServer); static get STATUS(): Record; questStatus(pmcData: IPmcData, questID: string): string; /** @@ -74,7 +76,7 @@ export declare class QuestHelper { cleanQuestConditions(quest: IQuest): IQuest; failQuest(pmcData: IPmcData, body: any, sessionID: string): any; getQuestFromDb(questId: string, pmcData: IPmcData): IQuest; - getQuestLocaleIdFromDb(messageId: string, localisation?: string): string; + getQuestLocaleIdFromDb(messageId: string): string; applyQuestReward(pmcData: IPmcData, body: ICompleteQuestRequestData, state: string, sessionID: string): Reward[]; /** * Get the intel center bonus a player has diff --git a/TypeScript/9RouterHooks/types/helpers/RagfairOfferHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/RagfairOfferHelper.d.ts index 129bc1c..5a77e13 100644 --- a/TypeScript/9RouterHooks/types/helpers/RagfairOfferHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/RagfairOfferHelper.d.ts @@ -10,6 +10,7 @@ import { ItemEventRouter } from "../routers/ItemEventRouter"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocaleService } from "../services/LocaleService"; import { RagfairOfferService } from "../services/RagfairOfferService"; import { HashUtil } from "../utils/HashUtil"; import { TimeUtil } from "../utils/TimeUtil"; @@ -37,11 +38,12 @@ export declare class RagfairOfferHelper { protected ragfairSortHelper: RagfairSortHelper; protected ragfairHelper: RagfairHelper; protected ragfairOfferService: RagfairOfferService; + protected localeService: LocaleService; protected configServer: ConfigServer; protected static TPL_GOODS_SOLD: string; protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; - constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, saveServer: SaveServer, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, configServer: ConfigServer); + constructor(logger: ILogger, timeUtil: TimeUtil, hashUtil: HashUtil, itemEventRouter: ItemEventRouter, databaseServer: DatabaseServer, saveServer: SaveServer, dialogueHelper: DialogueHelper, itemHelper: ItemHelper, paymentHelper: PaymentHelper, presetHelper: PresetHelper, profileHelper: ProfileHelper, ragfairServerHelper: RagfairServerHelper, ragfairSortHelper: RagfairSortHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, localeService: LocaleService, configServer: ConfigServer); getValidOffers(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; getOffersForBuild(info: ISearchRequestData, itemsToAdd: string[], assorts: Record, pmcProfile: IPmcData): IRagfairOffer[]; processOffers(sessionID: string): boolean; diff --git a/TypeScript/9RouterHooks/types/helpers/RagfairServerHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/RagfairServerHelper.d.ts index 2cb3ea5..a52306b 100644 --- a/TypeScript/9RouterHooks/types/helpers/RagfairServerHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/RagfairServerHelper.d.ts @@ -1,11 +1,12 @@ -import { MemberCategory } from "../models/enums/MemberCategory"; import { Item } from "../models/eft/common/tables/IItem"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { MemberCategory } from "../models/enums/MemberCategory"; import { IQuestConfig } from "../models/spt/config/IQuestConfig"; import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; import { SaveServer } from "../servers/SaveServer"; +import { LocaleService } from "../services/LocaleService"; import { HashUtil } from "../utils/HashUtil"; import { JsonUtil } from "../utils/JsonUtil"; import { RandomUtil } from "../utils/RandomUtil"; @@ -19,13 +20,14 @@ export declare class RagfairServerHelper { protected databaseServer: DatabaseServer; protected profileHelper: ProfileHelper; protected itemHelper: ItemHelper; + protected localeService: LocaleService; protected dialogueHelper: DialogueHelper; protected jsonUtil: JsonUtil; protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; protected questConfig: IQuestConfig; protected static TPL_GOODS_RETURNED: string; - constructor(randomUtil: RandomUtil, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, profileHelper: ProfileHelper, itemHelper: ItemHelper, dialogueHelper: DialogueHelper, jsonUtil: JsonUtil, configServer: ConfigServer); + constructor(randomUtil: RandomUtil, hashUtil: HashUtil, saveServer: SaveServer, databaseServer: DatabaseServer, profileHelper: ProfileHelper, itemHelper: ItemHelper, localeService: LocaleService, dialogueHelper: DialogueHelper, jsonUtil: JsonUtil, configServer: ConfigServer); /** * Is item valid / on blacklist / quest item * @param itemDetails diff --git a/TypeScript/9RouterHooks/types/helpers/RagfairSortHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/RagfairSortHelper.d.ts index e983569..d20e10c 100644 --- a/TypeScript/9RouterHooks/types/helpers/RagfairSortHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/RagfairSortHelper.d.ts @@ -1,8 +1,10 @@ import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { LocaleService } from "../services/LocaleService"; export declare class RagfairSortHelper { protected databaseServer: DatabaseServer; - constructor(databaseServer: DatabaseServer); + protected localeService: LocaleService; + constructor(databaseServer: DatabaseServer, localeService: LocaleService); sortOffers(offers: IRagfairOffer[], type: number, direction?: number): IRagfairOffer[]; protected sortOffersByID(a: IRagfairOffer, b: IRagfairOffer): number; protected sortOffersByRating(a: IRagfairOffer, b: IRagfairOffer): number; diff --git a/TypeScript/9RouterHooks/types/helpers/TraderHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/TraderHelper.d.ts index ab4a371..717351f 100644 --- a/TypeScript/9RouterHooks/types/helpers/TraderHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/TraderHelper.d.ts @@ -1,4 +1,6 @@ +import { FenceLevel } from "../models/eft/common/IGlobals"; import { IPmcData } from "../models/eft/common/IPmcData"; +import { Item } from "../models/eft/common/tables/IItem"; import { IBarterScheme, ITraderAssort, ITraderBase, LoyaltyLevel } from "../models/eft/common/tables/ITrader"; import { ITraderConfig } from "../models/spt/config/ITraderConfig"; import { ILogger } from "../models/spt/utils/ILogger"; @@ -34,7 +36,48 @@ export declare class TraderHelper { */ resetTrader(sessionID: string, traderID: string): void; changeTraderDisplay(traderID: string, status: boolean, sessionID: string): void; + /** + * Get a list of items and their prices from player inventory that can be sold to a trader + * @param traderID trader id being traded with + * @param sessionID session id + * @returns IBarterScheme[][] + */ getPurchasesData(traderID: string, sessionID: string): Record; + /** + * Should item be skipped when selling to trader according to its sell categories and other checks + * @param pmcData + * @param item + * @param sellCategory + * @returns true if should NOT be sold to trader + */ + protected isItemUnSellableToTrader(pmcData: IPmcData, item: Item, sellCategory: string[]): boolean; + /** + * Can this weapon be sold to a trader with its current durabiltiy level + * @param traderID + * @param item + * @returns boolean + */ + protected isWeaponAndBelowTraderBuyDurability(traderID: string, item: Item): boolean; + /** + * Get the price of an item and all of its attached children + * Take into account bonuses/adjsutments e.g. discounts + * @param pmcData profile data + * @param item item to calculate price of + * @param buyPriceCoefficient + * @param fenceInfo fence data + * @param traderBase trader details + * @param currencyTpl Currency to get price as + * @returns price of item + children + */ + protected getAdjustedItemPrice(pmcData: IPmcData, item: Item, buyPriceCoefficient: number, fenceInfo: FenceLevel, traderBase: ITraderBase, currencyTpl: string): number; + /** + * Get the raw price of item+child items from handbook without any modification + * @param pmcData profile data + * @param item item to calculate price of + * @returns price as number + */ + protected getRawItemPrice(pmcData: IPmcData, item: Item): number; + protected getTraderDiscount(trader: ITraderBase, buyPriceCoefficient: number, fenceInfo: FenceLevel, traderID: string): number; /** * Calculate traders level based on exp amount and increment level if over threshold * @param traderID trader to process diff --git a/TypeScript/9RouterHooks/types/loaders/AfterDbModLoader.d.ts b/TypeScript/9RouterHooks/types/loaders/AfterDbModLoader.d.ts new file mode 100644 index 0000000..a9fc286 --- /dev/null +++ b/TypeScript/9RouterHooks/types/loaders/AfterDbModLoader.d.ts @@ -0,0 +1,11 @@ +import { DependencyContainer } from "tsyringe"; +import { OnLoad } from "../di/OnLoad"; +import { InitialModLoader } from "./InitialModLoader"; +export declare class AfterDbModLoader implements OnLoad { + protected initialModLoader: InitialModLoader; + constructor(initialModLoader: InitialModLoader); + onLoad(): void; + getRoute(): string; + getModPath(mod: string): string; + protected executeMods(container: DependencyContainer): void; +} diff --git a/TypeScript/9RouterHooks/types/models/enums/ConfigTypes.d.ts b/TypeScript/9RouterHooks/types/models/enums/ConfigTypes.d.ts index 6bd31e8..1c49e62 100644 --- a/TypeScript/9RouterHooks/types/models/enums/ConfigTypes.d.ts +++ b/TypeScript/9RouterHooks/types/models/enums/ConfigTypes.d.ts @@ -8,6 +8,7 @@ export declare enum ConfigTypes { IN_RAID = "aki-inraid", INSURANCE = "aki-insurance", INVENTORY = "aki-inventory", + LOCALE = "aki-locale", LOCATION = "aki-location", MATCH = "aki-match", QUEST = "aki-quest", diff --git a/TypeScript/9RouterHooks/types/models/external/IAfterDBLoadMod.d.ts b/TypeScript/9RouterHooks/types/models/external/IAfterDBLoadMod.d.ts new file mode 100644 index 0000000..7f08b9e --- /dev/null +++ b/TypeScript/9RouterHooks/types/models/external/IAfterDBLoadMod.d.ts @@ -0,0 +1,4 @@ +import { DependencyContainer } from "./tsyringe"; +export interface IAfterDBLoadMod { + loadAfterDbInit(container: DependencyContainer): void; +} diff --git a/TypeScript/9RouterHooks/types/models/external/mod.d.ts b/TypeScript/9RouterHooks/types/models/external/mod.d.ts index ecef460..47939e9 100644 --- a/TypeScript/9RouterHooks/types/models/external/mod.d.ts +++ b/TypeScript/9RouterHooks/types/models/external/mod.d.ts @@ -1,5 +1,5 @@ import { DependencyContainer } from "./tsyringe"; export interface IMod { - load: (container: DependencyContainer) => void; - delayedLoad: (container: DependencyContainer) => void; + load(container: DependencyContainer): void; + delayedLoad(container: DependencyContainer): void; } diff --git a/TypeScript/9RouterHooks/types/models/spt/config/ILocaleConfig.d.ts b/TypeScript/9RouterHooks/types/models/spt/config/ILocaleConfig.d.ts new file mode 100644 index 0000000..fe9abf7 --- /dev/null +++ b/TypeScript/9RouterHooks/types/models/spt/config/ILocaleConfig.d.ts @@ -0,0 +1,5 @@ +import { IBaseConfig } from "./IBaseConfig"; +export interface ILocaleConfig extends IBaseConfig { + kind: "aki-locale"; + desiredLocale: string; +} diff --git a/TypeScript/9RouterHooks/types/models/spt/logging/LogBackgroundColor.d.ts b/TypeScript/9RouterHooks/types/models/spt/logging/LogBackgroundColor.d.ts new file mode 100644 index 0000000..87e08a9 --- /dev/null +++ b/TypeScript/9RouterHooks/types/models/spt/logging/LogBackgroundColor.d.ts @@ -0,0 +1,11 @@ +export declare enum LogBackgroundColor { + default = "", + black = "blackBG", + red = "redBG", + green = "greenBG", + yellow = "yellowBG", + blue = "blueBG", + magenta = "magentaBG", + cyan = "cyanBG", + white = "whiteBG" +} diff --git a/TypeScript/9RouterHooks/types/models/spt/logging/LogTextColor.d.ts b/TypeScript/9RouterHooks/types/models/spt/logging/LogTextColor.d.ts new file mode 100644 index 0000000..7147ae3 --- /dev/null +++ b/TypeScript/9RouterHooks/types/models/spt/logging/LogTextColor.d.ts @@ -0,0 +1,11 @@ +export declare enum LogTextColor { + black = "black", + red = "red", + green = "green", + yellow = "yellow", + blue = "blue", + magenta = "magenta", + cyan = "cyan", + white = "white", + gray = "" +} diff --git a/TypeScript/9RouterHooks/types/models/spt/logging/SptLogger.d.ts b/TypeScript/9RouterHooks/types/models/spt/logging/SptLogger.d.ts new file mode 100644 index 0000000..ea1b3d8 --- /dev/null +++ b/TypeScript/9RouterHooks/types/models/spt/logging/SptLogger.d.ts @@ -0,0 +1,7 @@ +export interface SptLogger { + error: (msg: string | Record) => void; + warn: (msg: string | Record) => void; + succ?: (msg: string | Record) => void; + info: (msg: string | Record) => void; + debug: (msg: string | Record) => void; +} diff --git a/TypeScript/9RouterHooks/types/models/spt/utils/ILogger.d.ts b/TypeScript/9RouterHooks/types/models/spt/utils/ILogger.d.ts index c983701..2af3fac 100644 --- a/TypeScript/9RouterHooks/types/models/spt/utils/ILogger.d.ts +++ b/TypeScript/9RouterHooks/types/models/spt/utils/ILogger.d.ts @@ -1,7 +1,10 @@ import { Daum } from "../../eft/itemEvent/IItemEventRouterRequest"; +import { LogBackgroundColor } from "../logging/LogBackgroundColor"; +import { LogTextColor } from "../logging/LogTextColor"; export interface ILogger { writeToLogFile(data: string | Daum): void; - log(data: string | Record | Error, color: string): void; + log(data: string | Record | Error, color: string, backgroundColor?: string): void; + logWithColor(data: string | Record, textColor: LogTextColor, backgroundColor?: LogBackgroundColor): void; error(data: string): void; warning(data: string): void; success(data: string): void; diff --git a/TypeScript/9RouterHooks/types/services/FenceService.d.ts b/TypeScript/9RouterHooks/types/services/FenceService.d.ts index 12723fb..79058c6 100644 --- a/TypeScript/9RouterHooks/types/services/FenceService.d.ts +++ b/TypeScript/9RouterHooks/types/services/FenceService.d.ts @@ -29,8 +29,8 @@ export declare class FenceService { hasExpiredCache(refreshAssort: boolean): boolean; generateFenceAssortCache(pmcData: IPmcData): void; /** - * - * @param pmcData Get the fence level the passed in profile has + * Get the fence level the passed in profile has + * @param pmcData Player profile * @returns FenceLevel */ getFenceInfo(pmcData: IPmcData): FenceLevel; diff --git a/TypeScript/9RouterHooks/types/services/LocaleService.d.ts b/TypeScript/9RouterHooks/types/services/LocaleService.d.ts new file mode 100644 index 0000000..33bea7b --- /dev/null +++ b/TypeScript/9RouterHooks/types/services/LocaleService.d.ts @@ -0,0 +1,14 @@ +import { ILocaleConfig } from "../models/spt/config/ILocaleConfig"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; +export declare class LocaleService { + protected logger: ILogger; + protected configServer: ConfigServer; + protected localeConfig: ILocaleConfig; + constructor(logger: ILogger, configServer: ConfigServer); + /** + * Gets the locale key from the locale.json file + * @returns locale e.g en/ge/cz/cn + */ + getDesiredLocale(): string; +} diff --git a/TypeScript/9RouterHooks/types/utils/DatabaseImporter.d.ts b/TypeScript/9RouterHooks/types/utils/DatabaseImporter.d.ts index 24c1cd6..b3156ea 100644 --- a/TypeScript/9RouterHooks/types/utils/DatabaseImporter.d.ts +++ b/TypeScript/9RouterHooks/types/utils/DatabaseImporter.d.ts @@ -5,7 +5,7 @@ import { ImageRouter } from "../routers/ImageRouter"; import { DatabaseServer } from "../servers/DatabaseServer"; import { CustomHandbookItemService } from "../services/CustomHandbookItemService"; import { CustomItemService } from "../services/CustomItemService"; -import { CustomPresetService } from "../services/customPresetService"; +import { CustomPresetService } from "../services/CustomPresetService"; import { CustomTraderAssortService } from "../services/CustomTraderAssortService"; import { JsonUtil } from "./JsonUtil"; import { VFS } from "./VFS"; diff --git a/TypeScript/9RouterHooks/types/utils/Logger.d.ts b/TypeScript/9RouterHooks/types/utils/Logger.d.ts index f5b774b..3d9013f 100644 --- a/TypeScript/9RouterHooks/types/utils/Logger.d.ts +++ b/TypeScript/9RouterHooks/types/utils/Logger.d.ts @@ -1,17 +1,13 @@ /// -import { Daum } from "../models/eft/itemEvent/IItemEventRouterRequest"; -import { ILogger } from "../models/spt/utils/ILogger"; -import winston from "winston"; -import { IAsyncQueue } from "../models/spt/utils/IAsyncQueue"; -import { IUUidGenerator } from "../models/spt/utils/IUuidGenerator"; import fs from "fs"; -interface SptLogger { - error: (msg: string | Record) => void; - warn: (msg: string | Record) => void; - succ?: (msg: string | Record) => void; - info: (msg: string | Record) => void; - debug: (msg: string | Record) => void; -} +import winston from "winston"; +import { Daum } from "../models/eft/itemEvent/IItemEventRouterRequest"; +import { LogBackgroundColor } from "../models/spt/logging/LogBackgroundColor"; +import { LogTextColor } from "../models/spt/logging/LogTextColor"; +import { SptLogger } from "../models/spt/logging/SptLogger"; +import { IAsyncQueue } from "../models/spt/utils/IAsyncQueue"; +import { ILogger } from "../models/spt/utils/ILogger"; +import { IUUidGenerator } from "../models/spt/utils/IUuidGenerator"; export declare class WinstonLogger implements ILogger { protected asyncQueue: IAsyncQueue; protected uuidGenerator: IUUidGenerator; @@ -36,16 +32,27 @@ export declare class WinstonLogger implements ILogger { custom: string; debug: string; }; + bgColors: { + default: string; + blackBG: string; + redBG: string; + greenBG: string; + yellowBG: string; + blueBG: string; + magentaBG: string; + cyanBG: string; + whiteBG: string; + }; }; protected logger: winston.Logger & SptLogger; - writeFilePromisify: (path: fs.PathLike, data: string, options?: any) => Promise; + protected writeFilePromisify: (path: fs.PathLike, data: string, options?: any) => Promise; constructor(asyncQueue: IAsyncQueue, uuidGenerator: IUUidGenerator); writeToLogFile(data: string | Daum): Promise; - log(data: string | Error | Record, color: string): Promise; + log(data: string | Error | Record, color: string, backgroundColor?: string): Promise; error(data: string | Record): Promise; warning(data: string | Record): Promise; success(data: string | Record): Promise; info(data: string | Record): Promise; + logWithColor(data: string | Record, textColor: LogTextColor, backgroundColor?: LogBackgroundColor): Promise; debug(data: string | Record, onlyShowInConsole?: boolean): Promise; } -export {};