From 053294c48a960ca0db67ce6c9ff4e3e4f36847ce Mon Sep 17 00:00:00 2001 From: VforValens Date: Sun, 28 Aug 2022 23:48:57 -0400 Subject: [PATCH] Hotfix for 86x70 AmmoType. --- package.json | 2 +- src/ammo.ts | 4 ++-- types/helpers/HideoutHelper.d.ts | 9 +++++++++ types/helpers/ProfileHelper.d.ts | 13 +++++++++++++ types/helpers/RagfairOfferHelper.d.ts | 2 +- types/helpers/RagfairSellHelper.d.ts | 10 ++++++++-- types/models/enums/AmmoTypes.d.ts | 2 +- types/models/spt/config/IRagfairConfig.d.ts | 1 + types/services/ProfileFixerService.d.ts | 5 +++++ types/utils/TimeUtil.d.ts | 6 ++++++ 10 files changed, 47 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 8e25e6c..7acd5e0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "Valens-AIO", - "version": "1.4.5", + "version": "1.4.6", "main": "src/mod.js", "license": "CC BY-NC-ND 4.0", "author": "Valens", diff --git a/src/ammo.ts b/src/ammo.ts index 6b4c1e5..d2699d4 100644 --- a/src/ammo.ts +++ b/src/ammo.ts @@ -1,6 +1,6 @@ import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { Logger } from "./logger"; -import { Grenade, Ammo762x51, Ammo762x54, Ammo338Lapua, Ammo46x30, Ammo57x28, Ammo762x25, Ammo9x18, Ammo9x19, Ammo9x21, Ammo357Mag, Ammo45ACP, Ammo545x39, Ammo556x45, Ammo300Blackout, Ammo762x39, Ammo9x39, Ammo366TKM, Ammo127x55, Ammo12Gauge, Ammo20Gauge, Ammo23x75, Ammo30x29, Ammo26x75 } from "@spt-aki/models/enums/AmmoTypes"; +import { Grenade, Ammo762x51, Ammo762x54, Ammo86x70, Ammo46x30, Ammo57x28, Ammo762x25, Ammo9x18, Ammo9x19, Ammo9x21, Ammo357Mag, Ammo45ACP, Ammo545x39, Ammo556x45, Ammo300Blackout, Ammo762x39, Ammo9x39, Ammo366TKM, Ammo127x55, Ammo12Gauge, Ammo20Gauge, Ammo23x75, Ammo30x29, Ammo26x75 } from "@spt-aki/models/enums/AmmoTypes"; import { AmmoConfig } from "../config/ts/ammo"; export class Ammo @@ -34,7 +34,7 @@ export class Ammo // Sets .338 Lapua Magnum max stacks. if (mod.a86x70 != 30) { - for (const value of Object.values(Ammo338Lapua)) + for (const value of Object.values(Ammo86x70)) { items[value]._props.StackMaxSize = mod.a86x70; this.logger.info(`.338 Lapua Magnum Max Stacks set to ${mod.a86x70}`); diff --git a/types/helpers/HideoutHelper.d.ts b/types/helpers/HideoutHelper.d.ts index 36e4009..a822045 100644 --- a/types/helpers/HideoutHelper.d.ts +++ b/types/helpers/HideoutHelper.d.ts @@ -49,6 +49,15 @@ export declare class HideoutHelper { protected updateWaterCollector(sessionId: string, pmcData: IPmcData, area: HideoutArea, isGeneratorOn: boolean): void; protected doesWaterCollectorHaveFilter(waterCollector: HideoutArea): boolean; protected updateFuel(generatorArea: HideoutArea, pmcData: IPmcData): HideoutArea; + /** + * + * Filters are deleted when reaching 0 resourceValue + * @param waterFilterArea + * @param pwProd + * @param isGeneratorOn + * @param pmcData + * @returns + */ protected updateWaterFilters(waterFilterArea: HideoutArea, pwProd: Production, isGeneratorOn: boolean, pmcData: IPmcData): HideoutArea; protected getAreaUpdObject(stackCount: number, resourceValue: number, resourceUnitsConsumed: number): Upd; protected updateAirFilters(airFilterArea: HideoutArea, pmcData: IPmcData): HideoutArea; diff --git a/types/helpers/ProfileHelper.d.ts b/types/helpers/ProfileHelper.d.ts index 9d4ff98..4c5ef61 100644 --- a/types/helpers/ProfileHelper.d.ts +++ b/types/helpers/ProfileHelper.d.ts @@ -24,6 +24,19 @@ export declare class ProfileHelper { constructor(logger: ILogger, jsonUtil: JsonUtil, watermark: Watermark, timeUtil: TimeUtil, saveServer: SaveServer, databaseServer: DatabaseServer, itemHelper: ItemHelper, profileSnapshotService: ProfileSnapshotService, fenceService: FenceService); resetProfileQuestCondition(sessionID: string, conditionId: string): void; getCompleteProfile(sessionID: string): IPmcData[]; + /** + * Fix xp doubling on post-raid xp reward screen by sending a 'dummy' profile to the post-raid screen + * Server saves the post-raid changes prior to the xp screen getting the profile, this results in the xp screen using + * the now updated profile values as a base, meaning it shows x2 xp gained + * Instead, clone the post-raid profile (so we dont alter its values), apply the pre-raid xp values to the cloned objects and return + * Delete snapshot of pre-raid profile prior to returning profile data + * @param sessionId Session id + * @param output pmc and scav profiles array + * @param pmcProfile post-raid pmc profile + * @param scavProfile post-raid scav profile + * @returns updated profile array + */ + postRaidXpWorkaroundFix(sessionId: string, output: IPmcData[], pmcProfile: IPmcData, scavProfile: IPmcData): IPmcData[]; isNicknameTaken(info: IValidateNicknameRequestData, sessionID: string): boolean; /** * Add experience to a PMC inside the players profile diff --git a/types/helpers/RagfairOfferHelper.d.ts b/types/helpers/RagfairOfferHelper.d.ts index 8d03bee..0b7317c 100644 --- a/types/helpers/RagfairOfferHelper.d.ts +++ b/types/helpers/RagfairOfferHelper.d.ts @@ -46,7 +46,7 @@ export declare class RagfairOfferHelper { 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; + processOffersOnProfile(sessionID: string): boolean; protected getProfileOffers(sessionID: string): IRagfairOffer[]; protected deleteOfferByOfferId(sessionID: string, offerId: string): void; protected completeOffer(sessionID: string, offer: IRagfairOffer, boughtAmount: number): IItemEventRouterResponse; diff --git a/types/helpers/RagfairSellHelper.d.ts b/types/helpers/RagfairSellHelper.d.ts index 6ec004a..91b8a20 100644 --- a/types/helpers/RagfairSellHelper.d.ts +++ b/types/helpers/RagfairSellHelper.d.ts @@ -11,6 +11,12 @@ export declare class RagfairSellHelper { protected configServer: ConfigServer; protected ragfairConfig: IRagfairConfig; constructor(logger: ILogger, randomUtil: RandomUtil, timeUtil: TimeUtil, configServer: ConfigServer); - calculateSellChance(baseChance: number, offerPrice: number, requirementsPriceInRub: number): number; - rollForSale(sellChance: number, count: number): SellResult[]; + calculateSellChance(baseChancePercent: number, offerPriceRub: number, playerListedPriceRub: number): number; + /** + * Determine if the offer being listed will be sold + * @param sellChancePercent chance item will sell + * @param itemSellCount count of items to sell + * @returns Array of purchases of item(s) lsited + */ + rollForSale(sellChancePercent: number, itemSellCount: number): SellResult[]; } diff --git a/types/models/enums/AmmoTypes.d.ts b/types/models/enums/AmmoTypes.d.ts index b52ddcf..735eae4 100644 --- a/types/models/enums/AmmoTypes.d.ts +++ b/types/models/enums/AmmoTypes.d.ts @@ -23,7 +23,7 @@ export declare enum Ammo762x54 { BT_GZH = "5e023d34e8a400319a28ed44", BS_GZH = "5e023d48186a883be655e551" } -export declare enum Ammo338Lapua { +export declare enum Ammo86x70 { TAC_X = "5fc382b6d6fa9c00c571bbc3", UCW = "5fc382c1016cce60e8341b20", AP = "5fc382a9d724d907e2077dab", diff --git a/types/models/spt/config/IRagfairConfig.d.ts b/types/models/spt/config/IRagfairConfig.d.ts index 6369eda..3088717 100644 --- a/types/models/spt/config/IRagfairConfig.d.ts +++ b/types/models/spt/config/IRagfairConfig.d.ts @@ -12,6 +12,7 @@ export interface Sell { chance: Chance; time: Time; reputation: Reputation; + simulatedSellHours: number; } export interface Chance { base: number; diff --git a/types/services/ProfileFixerService.d.ts b/types/services/ProfileFixerService.d.ts index ed1dec7..9cb5a38 100644 --- a/types/services/ProfileFixerService.d.ts +++ b/types/services/ProfileFixerService.d.ts @@ -45,6 +45,11 @@ export declare class ProfileFixerService { * @param pmcProfile Profile to find and remove slots from */ protected removeResourcesFromSlotsInHideoutWithoutLocationIndexValue(pmcProfile: IPmcData): void; + /** + * Hideout slots need to be in a specific order, locationIndex in ascending order + * @param pmcProfile profile to edit + */ + protected reorderHideoutAreasWithResouceInputs(pmcProfile: IPmcData): void; /** * add in objects equal to the number of slots * @param areaType area to check diff --git a/types/utils/TimeUtil.d.ts b/types/utils/TimeUtil.d.ts index f437f8a..e72fbc1 100644 --- a/types/utils/TimeUtil.d.ts +++ b/types/utils/TimeUtil.d.ts @@ -19,4 +19,10 @@ export declare class TimeUtil { * @returns current date in format: 00.00.0000 (dd.mm.yyyy) */ getDateMailFormat(): string; + /** + * Convert hours into seconds + * @param hours hours to convert to seconds + * @returns number + */ + getHoursAsSeconds(hours: number): number; }