ScavXpCounts/types/services/ProfileFixerService.d.ts

195 lines
9.7 KiB
TypeScript
Raw Normal View History

2024-11-12 11:51:30 -07:00
import { HideoutHelper } from "@spt/helpers/HideoutHelper";
import { InventoryHelper } from "@spt/helpers/InventoryHelper";
import { ItemHelper } from "@spt/helpers/ItemHelper";
import { ProfileHelper } from "@spt/helpers/ProfileHelper";
import { TraderHelper } from "@spt/helpers/TraderHelper";
import { IPmcData } from "@spt/models/eft/common/IPmcData";
import { Bonus, HideoutSlot } from "@spt/models/eft/common/tables/IBotBase";
import { IPmcDataRepeatableQuest, IRepeatableQuest } from "@spt/models/eft/common/tables/IRepeatableQuests";
import { ITemplateItem } from "@spt/models/eft/common/tables/ITemplateItem";
import { StageBonus } from "@spt/models/eft/hideout/IHideoutArea";
import { IEquipmentBuild, IMagazineBuild, ISptProfile, IWeaponBuild } from "@spt/models/eft/profile/ISptProfile";
import { HideoutAreas } from "@spt/models/enums/HideoutAreas";
import { ICoreConfig } from "@spt/models/spt/config/ICoreConfig";
import { IRagfairConfig } from "@spt/models/spt/config/IRagfairConfig";
import { ILogger } from "@spt/models/spt/utils/ILogger";
import { ConfigServer } from "@spt/servers/ConfigServer";
import { DatabaseService } from "@spt/services/DatabaseService";
import { LocalisationService } from "@spt/services/LocalisationService";
import { HashUtil } from "@spt/utils/HashUtil";
import { JsonUtil } from "@spt/utils/JsonUtil";
import { TimeUtil } from "@spt/utils/TimeUtil";
import { Watermark } from "@spt/utils/Watermark";
import { ICloner } from "@spt/utils/cloners/ICloner";
2023-08-17 19:49:16 -06:00
export declare class ProfileFixerService {
protected logger: ILogger;
protected watermark: Watermark;
2024-11-12 11:51:30 -07:00
protected databaseService: DatabaseService;
2023-08-17 19:49:16 -06:00
protected hideoutHelper: HideoutHelper;
protected inventoryHelper: InventoryHelper;
protected traderHelper: TraderHelper;
2024-02-23 15:06:00 -07:00
protected profileHelper: ProfileHelper;
2023-08-17 19:49:16 -06:00
protected itemHelper: ItemHelper;
protected localisationService: LocalisationService;
protected timeUtil: TimeUtil;
2024-02-23 15:06:00 -07:00
protected jsonUtil: JsonUtil;
protected hashUtil: HashUtil;
2023-08-17 19:49:16 -06:00
protected configServer: ConfigServer;
2024-11-12 11:51:30 -07:00
protected cloner: ICloner;
2023-08-17 19:49:16 -06:00
protected coreConfig: ICoreConfig;
protected ragfairConfig: IRagfairConfig;
2024-11-12 11:51:30 -07:00
constructor(logger: ILogger, watermark: Watermark, databaseService: DatabaseService, hideoutHelper: HideoutHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, profileHelper: ProfileHelper, itemHelper: ItemHelper, localisationService: LocalisationService, timeUtil: TimeUtil, jsonUtil: JsonUtil, hashUtil: HashUtil, configServer: ConfigServer, cloner: ICloner);
2023-08-17 19:49:16 -06:00
/**
* Find issues in the pmc profile data that may cause issues and fix them
* @param pmcProfile profile to check and fix
*/
checkForAndFixPmcProfileIssues(pmcProfile: IPmcData): void;
2024-02-23 15:06:00 -07:00
/**
* Find issues in the scav profile data that may cause issues
* @param scavProfile profile to check and fix
*/
checkForAndFixScavProfileIssues(scavProfile: IPmcData): void;
protected addMissingGunStandContainerImprovements(pmcProfile: IPmcData): void;
2024-04-19 21:23:52 -06:00
protected addMissingHallOfFameContainerImprovements(pmcProfile: IPmcData): void;
2024-02-23 15:06:00 -07:00
protected ensureGunStandLevelsMatch(pmcProfile: IPmcData): void;
protected addHideoutAreaStashes(pmcProfile: IPmcData): void;
protected addMissingHideoutWallAreas(pmcProfile: IPmcData): void;
2023-08-17 19:49:16 -06:00
/**
* Add tag to profile to indicate when it was made
* @param fullProfile
*/
2024-11-12 11:51:30 -07:00
addMissingSptVersionTagToProfile(fullProfile: ISptProfile): void;
2023-08-17 19:49:16 -06:00
/**
* TODO - make this non-public - currently used by RepeatableQuestController
* Remove unused condition counters
* @param pmcProfile profile to remove old counters from
*/
removeDanglingConditionCounters(pmcProfile: IPmcData): void;
addLighthouseKeeperIfMissing(pmcProfile: IPmcData): void;
protected addUnlockedInfoObjectIfMissing(pmcProfile: IPmcData): void;
2024-04-19 21:23:52 -06:00
/**
* Repeatable quests leave behind TaskConditionCounter objects that make the profile bloat with time, remove them
* @param pmcProfile Player profile to check
*/
protected removeDanglingTaskConditionCounters(pmcProfile: IPmcData): void;
2023-08-17 19:49:16 -06:00
protected getActiveRepeatableQuests(repeatableQuests: IPmcDataRepeatableQuest[]): IRepeatableQuest[];
2024-11-12 11:51:30 -07:00
protected fixNullRagfairRatings(pmcProfile: IPmcData): void;
2023-08-17 19:49:16 -06:00
protected fixNullTraderSalesSums(pmcProfile: IPmcData): void;
protected addMissingBonusesProperty(pmcProfile: IPmcData): void;
/**
* Adjust profile quest status and statusTimers object values
* quest.status is numeric e.g. 2
* quest.statusTimers keys are numeric as strings e.g. "2"
2024-02-23 15:06:00 -07:00
* @param profile profile to update
2023-08-17 19:49:16 -06:00
*/
2024-02-23 15:06:00 -07:00
protected updateProfileQuestDataValues(profile: IPmcData): void;
2023-08-17 19:49:16 -06:00
protected addMissingRepeatableQuestsProperty(pmcProfile: IPmcData): void;
/**
* Some profiles have hideout maxed and therefore no improvements
* @param pmcProfile Profile to add improvement data to
*/
protected addMissingWallImprovements(pmcProfile: IPmcData): void;
/**
* A new property was added to slot items "locationIndex", if this is missing, the hideout slot item must be removed
* @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
* @param pmcProfile profile to update
*/
protected addEmptyObjectsToHideoutAreaSlots(areaType: HideoutAreas, emptyItemCount: number, pmcProfile: IPmcData): void;
protected addObjectsToArray(count: number, slots: HideoutSlot[]): HideoutSlot[];
/**
* Iterate over players hideout areas and find what's build, look for missing bonuses those areas give and add them if missing
* @param pmcProfile Profile to update
*/
addMissingHideoutBonusesToProfile(pmcProfile: IPmcData): void;
/**
* @param profileBonuses bonuses from profile
* @param bonus bonus to find
* @returns matching bonus
*/
2024-11-12 11:51:30 -07:00
protected getBonusFromProfile(profileBonuses: Bonus[], bonus: StageBonus): Bonus | undefined;
2023-08-17 19:49:16 -06:00
/**
* Checks profile inventiory for items that do not exist inside the items db
* @param sessionId Session id
* @param pmcProfile Profile to check inventory of
*/
2024-11-12 11:51:30 -07:00
checkForOrphanedModdedItems(sessionId: string, fullProfile: ISptProfile): void;
/**
* @param buildType The type of build, used for logging only
* @param build The build to check for invalid items
* @param itemsDb The items database to use for item lookup
* @returns True if the build should be removed from the build list, false otherwise
*/
protected shouldRemoveWeaponEquipmentBuild(buildType: string, build: IWeaponBuild | IEquipmentBuild, itemsDb: Record<string, ITemplateItem>): boolean;
/**
* @param magazineBuild The magazine build to check for validity
* @param itemsDb The items database to use for item lookup
* @returns True if the build should be removed from the build list, false otherwise
*/
protected shouldRemoveMagazineBuild(magazineBuild: IMagazineBuild, itemsDb: Record<string, ITemplateItem>): boolean;
2024-02-23 15:06:00 -07:00
/**
* Attempt to fix common item issues that corrupt profiles
* @param pmcProfile Profile to check items of
*/
fixProfileBreakingInventoryItemIssues(pmcProfile: IPmcData): void;
2023-08-17 19:49:16 -06:00
/**
* Add `Improvements` object to hideout if missing - added in eft 13.0.21469
* @param pmcProfile profile to update
*/
addMissingUpgradesPropertyToHideout(pmcProfile: IPmcData): void;
/**
* Iterate over associated profile template and check all hideout areas exist, add if not
* @param fullProfile Profile to update
*/
2024-11-12 11:51:30 -07:00
addMissingHideoutAreasToProfile(fullProfile: ISptProfile): void;
2023-08-17 19:49:16 -06:00
/**
* These used to be used for storing scav case rewards, rewards are now generated on pickup
* @param pmcProfile Profile to update
*/
removeLegacyScavCaseProductionCrafts(pmcProfile: IPmcData): void;
2024-02-23 15:06:00 -07:00
/**
* 3.7.0 moved AIDs to be numeric, old profiles need to be migrated
* We store the old AID value in new field `sessionId`
* @param fullProfile Profile to update
*/
2024-11-12 11:51:30 -07:00
fixIncorrectAidValue(fullProfile: ISptProfile): void;
2024-02-23 15:06:00 -07:00
/**
* Bsg nested `stats` into a sub object called 'eft'
* @param fullProfile Profile to check for and migrate stats data
*/
2024-11-12 11:51:30 -07:00
migrateStatsToNewStructure(fullProfile: ISptProfile): void;
2024-02-23 15:06:00 -07:00
/**
* 26126 (7th August) requires bonuses to have an ID, these were not included in the default profile presets
* @param pmcProfile Profile to add missing IDs to
*/
addMissingIdsToBonuses(pmcProfile: IPmcData): void;
2024-11-12 11:51:30 -07:00
/**
* 3.8.0 utilized the wrong ProductionTime for bitcoin, fix it if it's found
*/
fixBitcoinProductionTime(pmcProfile: IPmcData): void;
2024-02-23 15:06:00 -07:00
/**
* At some point the property name was changed,migrate data across to new name
* @param pmcProfile Profile to migrate improvements in
*/
protected migrateImprovements(pmcProfile: IPmcData): void;
2024-04-19 21:23:52 -06:00
/**
* After removing mods that add quests, the quest panel will break without removing these
* @param pmcProfile Profile to remove dead quests from
*/
protected removeOrphanedQuests(pmcProfile: IPmcData): void;
2024-11-12 11:51:30 -07:00
/**
* If someone has run a mod from pre-3.8.0, it results in an invalid `nextResupply` value
* Resolve this by setting the nextResupply to 0 if it's undefined
*/
protected fixNullTraderNextResupply(pmcProfile: IPmcData): void;
2023-08-17 19:49:16 -06:00
}