Updated various classes to use DatabaseService
instead of DatabaseServer
This commit is contained in:
parent
9f1e0693f5
commit
fdb7a2b7d8
@ -13,7 +13,7 @@ import { IHideoutSettingsBase } from "@spt/models/eft/hideout/IHideoutSettingsBa
|
||||
import { IGetBodyResponseData } from "@spt/models/eft/httpResponse/IGetBodyResponseData";
|
||||
import { Money } from "@spt/models/enums/Money";
|
||||
import { ISettingsBase } from "@spt/models/spt/server/ISettingsBase";
|
||||
import { DatabaseServer } from "@spt/servers/DatabaseServer";
|
||||
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||
import { HttpResponseUtil } from "@spt/utils/HttpResponseUtil";
|
||||
|
||||
/**
|
||||
@ -24,7 +24,7 @@ export class DataCallbacks
|
||||
{
|
||||
constructor(
|
||||
@inject("HttpResponseUtil") protected httpResponse: HttpResponseUtil,
|
||||
@inject("DatabaseServer") protected databaseServer: DatabaseServer,
|
||||
@inject("DatabaseService") protected databaseServer: DatabaseService,
|
||||
@inject("RagfairController") protected ragfairController: RagfairController,
|
||||
@inject("HideoutController") protected hideoutController: HideoutController,
|
||||
)
|
||||
@ -36,7 +36,7 @@ export class DataCallbacks
|
||||
*/
|
||||
public getSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<ISettingsBase>
|
||||
{
|
||||
return this.httpResponse.getBody(this.databaseServer.getTables().settings!);
|
||||
return this.httpResponse.getBody(this.databaseServer.getSettings());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -45,8 +45,10 @@ export class DataCallbacks
|
||||
*/
|
||||
public getGlobals(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<IGlobals>
|
||||
{
|
||||
this.databaseServer.getTables().globals!.time = Date.now() / 1000;
|
||||
return this.httpResponse.getBody(this.databaseServer.getTables().globals!);
|
||||
const globals = this.databaseServer.getGlobals();
|
||||
globals.time = Date.now() / 1000;
|
||||
|
||||
return this.httpResponse.getBody(this.databaseServer.getGlobals());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -55,7 +57,7 @@ export class DataCallbacks
|
||||
*/
|
||||
public getTemplateItems(url: string, info: IEmptyRequestData, sessionID: string): string
|
||||
{
|
||||
return this.httpResponse.getUnclearedBody(this.databaseServer.getTables().templates!.items);
|
||||
return this.httpResponse.getUnclearedBody(this.databaseServer.getItems());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -68,7 +70,7 @@ export class DataCallbacks
|
||||
sessionID: string,
|
||||
): IGetBodyResponseData<IHandbookBase>
|
||||
{
|
||||
return this.httpResponse.getBody(this.databaseServer.getTables().templates!.handbook);
|
||||
return this.httpResponse.getBody(this.databaseServer.getHandbook());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -81,7 +83,7 @@ export class DataCallbacks
|
||||
sessionID: string,
|
||||
): IGetBodyResponseData<Record<string, ICustomizationItem>>
|
||||
{
|
||||
return this.httpResponse.getBody(this.databaseServer.getTables().templates!.customization);
|
||||
return this.httpResponse.getBody(this.databaseServer.getTemplates().customization);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -94,7 +96,7 @@ export class DataCallbacks
|
||||
sessionID: string,
|
||||
): IGetBodyResponseData<string[]>
|
||||
{
|
||||
return this.httpResponse.getBody(this.databaseServer.getTables().templates!.character);
|
||||
return this.httpResponse.getBody(this.databaseServer.getTemplates().character);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -107,7 +109,7 @@ export class DataCallbacks
|
||||
sessionID: string,
|
||||
): IGetBodyResponseData<IHideoutSettingsBase>
|
||||
{
|
||||
return this.httpResponse.getBody(this.databaseServer.getTables().hideout!.settings);
|
||||
return this.httpResponse.getBody(this.databaseServer.getHideout().settings);
|
||||
}
|
||||
|
||||
public getHideoutAreas(
|
||||
@ -116,7 +118,7 @@ export class DataCallbacks
|
||||
sessionID: string,
|
||||
): IGetBodyResponseData<IHideoutArea[]>
|
||||
{
|
||||
return this.httpResponse.getBody(this.databaseServer.getTables().hideout!.areas);
|
||||
return this.httpResponse.getBody(this.databaseServer.getHideout().areas);
|
||||
}
|
||||
|
||||
public gethideoutProduction(
|
||||
@ -125,7 +127,7 @@ export class DataCallbacks
|
||||
sessionID: string,
|
||||
): IGetBodyResponseData<IHideoutProduction[]>
|
||||
{
|
||||
return this.httpResponse.getBody(this.databaseServer.getTables().hideout!.production);
|
||||
return this.httpResponse.getBody(this.databaseServer.getHideout().production);
|
||||
}
|
||||
|
||||
public getHideoutScavcase(
|
||||
@ -134,7 +136,7 @@ export class DataCallbacks
|
||||
sessionID: string,
|
||||
): IGetBodyResponseData<IHideoutScavCase[]>
|
||||
{
|
||||
return this.httpResponse.getBody(this.databaseServer.getTables().hideout!.scavcase);
|
||||
return this.httpResponse.getBody(this.databaseServer.getHideout().scavcase);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -146,7 +148,7 @@ export class DataCallbacks
|
||||
sessionID: string,
|
||||
): IGetBodyResponseData<Record<string, string>>
|
||||
{
|
||||
return this.httpResponse.getBody(this.databaseServer.getTables().locales!.languages);
|
||||
return this.httpResponse.getBody(this.databaseServer.getLocales().languages);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -155,12 +157,12 @@ export class DataCallbacks
|
||||
public getLocalesMenu(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<string>
|
||||
{
|
||||
const localeId = url.replace("/client/menu/locale/", "");
|
||||
const tables = this.databaseServer.getTables();
|
||||
let result = tables.locales?.menu[localeId];
|
||||
const locales = this.databaseServer.getLocales();
|
||||
let result = locales.menu[localeId];
|
||||
|
||||
if (result === undefined)
|
||||
{
|
||||
result = tables.locales?.menu.en;
|
||||
result = locales.menu.en;
|
||||
}
|
||||
|
||||
if (result === undefined)
|
||||
@ -175,12 +177,12 @@ export class DataCallbacks
|
||||
public getLocalesGlobal(url: string, info: IEmptyRequestData, sessionID: string): string
|
||||
{
|
||||
const localeId = url.replace("/client/locale/", "");
|
||||
const tables = this.databaseServer.getTables();
|
||||
let result = tables.locales?.global[localeId];
|
||||
const locales = this.databaseServer.getLocales();
|
||||
let result = locales.global[localeId];
|
||||
|
||||
if (result === undefined)
|
||||
{
|
||||
result = tables.locales?.global["en"];
|
||||
result = locales.global["en"];
|
||||
}
|
||||
|
||||
return this.httpResponse.getUnclearedBody(result);
|
||||
|
@ -2,7 +2,7 @@ import { inject, injectable } from "tsyringe";
|
||||
import { ICompletedAchievementsResponse } from "@spt/models/eft/profile/ICompletedAchievementsResponse";
|
||||
import { IGetAchievementsResponse } from "@spt/models/eft/profile/IGetAchievementsResponse";
|
||||
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||
import { DatabaseServer } from "@spt/servers/DatabaseServer";
|
||||
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||
|
||||
/**
|
||||
* Logic for handling In Raid callbacks
|
||||
@ -12,7 +12,7 @@ export class AchievementController
|
||||
{
|
||||
constructor(
|
||||
@inject("WinstonLogger") protected logger: ILogger,
|
||||
@inject("DatabaseServer") protected databaseServer: DatabaseServer,
|
||||
@inject("DatabaseService") protected databaseService: DatabaseService,
|
||||
)
|
||||
{}
|
||||
|
||||
@ -22,7 +22,7 @@ export class AchievementController
|
||||
*/
|
||||
public getAchievements(sessionID: string): IGetAchievementsResponse
|
||||
{
|
||||
return { elements: this.databaseServer.getTables().templates!.achievements };
|
||||
return { elements: this.databaseService.getAchievements() };
|
||||
}
|
||||
|
||||
/**
|
||||
@ -32,7 +32,7 @@ export class AchievementController
|
||||
*/
|
||||
public getAchievementStatistics(sessionId: string): ICompletedAchievementsResponse
|
||||
{
|
||||
const achievements = this.databaseServer.getTables().templates!.achievements;
|
||||
const achievements = this.databaseService.getAchievements();
|
||||
const stats = {};
|
||||
|
||||
for (const achievement of achievements)
|
||||
|
@ -19,8 +19,8 @@ import { IBotConfig } from "@spt/models/spt/config/IBotConfig";
|
||||
import { IPmcConfig } from "@spt/models/spt/config/IPmcConfig";
|
||||
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||
import { ConfigServer } from "@spt/servers/ConfigServer";
|
||||
import { DatabaseServer } from "@spt/servers/DatabaseServer";
|
||||
import { BotGenerationCacheService } from "@spt/services/BotGenerationCacheService";
|
||||
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||
import { LocalisationService } from "@spt/services/LocalisationService";
|
||||
import { MatchBotDetailsCacheService } from "@spt/services/MatchBotDetailsCacheService";
|
||||
import { SeasonalEventService } from "@spt/services/SeasonalEventService";
|
||||
@ -35,7 +35,7 @@ export class BotController
|
||||
|
||||
constructor(
|
||||
@inject("WinstonLogger") protected logger: ILogger,
|
||||
@inject("DatabaseServer") protected databaseServer: DatabaseServer,
|
||||
@inject("DatabaseService") protected databaseService: DatabaseService,
|
||||
@inject("BotGenerator") protected botGenerator: BotGenerator,
|
||||
@inject("BotHelper") protected botHelper: BotHelper,
|
||||
@inject("BotDifficultyHelper") protected botDifficultyHelper: BotDifficultyHelper,
|
||||
@ -80,7 +80,7 @@ export class BotController
|
||||
*/
|
||||
public getBotCoreDifficulty(): IBotCore
|
||||
{
|
||||
return this.databaseServer.getTables().bots!.core;
|
||||
return this.databaseService.getBots().core;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -146,7 +146,7 @@ export class BotController
|
||||
{
|
||||
const result = {};
|
||||
|
||||
const botDb = this.databaseServer.getTables().bots!.types;
|
||||
const botTypesDb = this.databaseService.getBots().types;
|
||||
const botTypes = Object.keys(WildSpawnTypeNumber).filter((v) => Number.isNaN(Number(v)));
|
||||
for (let botType of botTypes)
|
||||
{
|
||||
@ -156,7 +156,7 @@ export class BotController
|
||||
? this.botHelper.getPmcSideByRole(botType).toLowerCase()
|
||||
: botType.toLowerCase();
|
||||
|
||||
const botDetails = botDb[botType];
|
||||
const botDetails = botTypesDb[botType];
|
||||
if (!botDetails?.difficulty)
|
||||
{
|
||||
continue;
|
||||
@ -183,6 +183,9 @@ export class BotController
|
||||
{
|
||||
const pmcProfile = this.profileHelper.getPmcProfile(sessionId);
|
||||
|
||||
// If there's more than 1 condition, this is the first time client has requested bots
|
||||
// Client sends every bot type it will need in raid
|
||||
// Use this opportunity to create and cache bots for later retreval
|
||||
const isFirstGen = info.conditions.length > 1;
|
||||
if (isFirstGen)
|
||||
{
|
||||
|
@ -8,8 +8,8 @@ import { IEquipmentBuild, IMagazineBuild, IUserBuilds, IWeaponBuild } from "@spt
|
||||
import { EquipmentBuildType } from "@spt/models/enums/EquipmentBuildType";
|
||||
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||
import { EventOutputHolder } from "@spt/routers/EventOutputHolder";
|
||||
import { DatabaseServer } from "@spt/servers/DatabaseServer";
|
||||
import { SaveServer } from "@spt/servers/SaveServer";
|
||||
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||
import { LocalisationService } from "@spt/services/LocalisationService";
|
||||
import { ICloner } from "@spt/utils/cloners/ICloner";
|
||||
import { HashUtil } from "@spt/utils/HashUtil";
|
||||
@ -21,7 +21,7 @@ export class BuildController
|
||||
@inject("WinstonLogger") protected logger: ILogger,
|
||||
@inject("HashUtil") protected hashUtil: HashUtil,
|
||||
@inject("EventOutputHolder") protected eventOutputHolder: EventOutputHolder,
|
||||
@inject("DatabaseServer") protected databaseServer: DatabaseServer,
|
||||
@inject("DatabaseService") protected databaseService: DatabaseService,
|
||||
@inject("ProfileHelper") protected profileHelper: ProfileHelper,
|
||||
@inject("LocalisationService") protected localisationService: LocalisationService,
|
||||
@inject("ItemHelper") protected itemHelper: ItemHelper,
|
||||
@ -42,7 +42,7 @@ export class BuildController
|
||||
|
||||
// Ensure the secure container in the default presets match what the player has equipped
|
||||
const defaultEquipmentPresetsClone = this.cloner.clone(
|
||||
this.databaseServer.getTables().templates!.defaultEquipmentPresets,
|
||||
this.databaseService.getTemplates().defaultEquipmentPresets,
|
||||
);
|
||||
const playerSecureContainer = profile.characters.pmc.Inventory.items?.find(
|
||||
(x) => x.slotId === secureContainerSlotId,
|
||||
|
@ -7,8 +7,8 @@ import { IWearClothingRequestData } from "@spt/models/eft/customization/IWearClo
|
||||
import { IItemEventRouterResponse } from "@spt/models/eft/itemEvent/IItemEventRouterResponse";
|
||||
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||
import { EventOutputHolder } from "@spt/routers/EventOutputHolder";
|
||||
import { DatabaseServer } from "@spt/servers/DatabaseServer";
|
||||
import { SaveServer } from "@spt/servers/SaveServer";
|
||||
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||
import { LocalisationService } from "@spt/services/LocalisationService";
|
||||
|
||||
@injectable()
|
||||
@ -22,7 +22,7 @@ export class CustomizationController
|
||||
constructor(
|
||||
@inject("WinstonLogger") protected logger: ILogger,
|
||||
@inject("EventOutputHolder") protected eventOutputHolder: EventOutputHolder,
|
||||
@inject("DatabaseServer") protected databaseServer: DatabaseServer,
|
||||
@inject("DatabaseService") protected databaseService: DatabaseService,
|
||||
@inject("SaveServer") protected saveServer: SaveServer,
|
||||
@inject("LocalisationService") protected localisationService: LocalisationService,
|
||||
@inject("ProfileHelper") protected profileHelper: ProfileHelper,
|
||||
@ -37,15 +37,15 @@ export class CustomizationController
|
||||
*/
|
||||
public getTraderSuits(traderID: string, sessionID: string): ISuit[]
|
||||
{
|
||||
const pmcData: IPmcData = this.profileHelper.getPmcProfile(sessionID);
|
||||
const templates = this.databaseServer.getTables().templates!.customization;
|
||||
const suits = this.databaseServer.getTables().traders![traderID].suits;
|
||||
const pmcData = this.profileHelper.getPmcProfile(sessionID);
|
||||
const clothing = this.databaseService.getCustomization();
|
||||
const suits = this.databaseService.getTraders()[traderID].suits;
|
||||
|
||||
// Get an inner join of clothing from templates.customization and Ragman's suits array
|
||||
const matchingSuits = suits?.filter((x) => x.suiteId in templates);
|
||||
const matchingSuits = suits?.filter((suit) => suit.suiteId in clothing);
|
||||
|
||||
// Return all suits that have a side array containing the players side (usec/bear)
|
||||
const matchedSuits = matchingSuits?.filter((x) => templates[x.suiteId]._props.Side.includes(pmcData.Info.Side));
|
||||
const matchedSuits = matchingSuits?.filter((matchingSuit) => clothing[matchingSuit.suiteId]._props.Side.includes(pmcData.Info.Side));
|
||||
if (matchingSuits === undefined)
|
||||
throw new Error(this.localisationService.getText("customisation-unable_to_get_trader_suits", traderID));
|
||||
|
||||
@ -65,7 +65,7 @@ export class CustomizationController
|
||||
for (const suitId of wearClothingRequest.suites)
|
||||
{
|
||||
// Find desired clothing item in db
|
||||
const dbSuit = this.databaseServer.getTables().templates!.customization[suitId];
|
||||
const dbSuit = this.databaseService.getCustomization()[suitId];
|
||||
|
||||
// Legs
|
||||
if (dbSuit._parent === this.clothingIds.lowerParentId)
|
||||
@ -98,7 +98,6 @@ export class CustomizationController
|
||||
sessionId: string,
|
||||
): IItemEventRouterResponse
|
||||
{
|
||||
const db = this.databaseServer.getTables();
|
||||
const output = this.eventOutputHolder.getOutput(sessionId);
|
||||
|
||||
const traderOffer = this.getTraderClothingOffer(sessionId, buyClothingRequest.offer);
|
||||
@ -114,7 +113,7 @@ export class CustomizationController
|
||||
const suitId = traderOffer.suiteId;
|
||||
if (this.outfitAlreadyPurchased(suitId, sessionId))
|
||||
{
|
||||
const suitDetails = db.templates!.customization[suitId];
|
||||
const suitDetails = this.databaseService.getCustomization()[suitId];
|
||||
this.logger.error(
|
||||
this.localisationService.getText("customisation-item_already_purchased", {
|
||||
itemId: suitDetails._id,
|
||||
@ -230,7 +229,7 @@ export class CustomizationController
|
||||
|
||||
protected getAllTraderSuits(sessionID: string): ISuit[]
|
||||
{
|
||||
const traders = this.databaseServer.getTables().traders;
|
||||
const traders = this.databaseService.getTraders();
|
||||
let result: ISuit[] = [];
|
||||
|
||||
for (const traderID in traders)
|
||||
|
@ -41,8 +41,8 @@ import { IHideoutConfig } from "@spt/models/spt/config/IHideoutConfig";
|
||||
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||
import { EventOutputHolder } from "@spt/routers/EventOutputHolder";
|
||||
import { ConfigServer } from "@spt/servers/ConfigServer";
|
||||
import { DatabaseServer } from "@spt/servers/DatabaseServer";
|
||||
import { SaveServer } from "@spt/servers/SaveServer";
|
||||
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||
import { FenceService } from "@spt/services/FenceService";
|
||||
import { LocalisationService } from "@spt/services/LocalisationService";
|
||||
import { PlayerService } from "@spt/services/PlayerService";
|
||||
@ -64,7 +64,7 @@ export class HideoutController
|
||||
@inject("WinstonLogger") protected logger: ILogger,
|
||||
@inject("HashUtil") protected hashUtil: HashUtil,
|
||||
@inject("TimeUtil") protected timeUtil: TimeUtil,
|
||||
@inject("DatabaseServer") protected databaseServer: DatabaseServer,
|
||||
@inject("DatabaseService") protected databaseService: DatabaseService,
|
||||
@inject("RandomUtil") protected randomUtil: RandomUtil,
|
||||
@inject("InventoryHelper") protected inventoryHelper: InventoryHelper,
|
||||
@inject("ItemHelper") protected itemHelper: ItemHelper,
|
||||
@ -146,7 +146,7 @@ export class HideoutController
|
||||
return;
|
||||
}
|
||||
|
||||
const hideoutDataDb = this.databaseServer
|
||||
const hideoutDataDb = this.databaseService
|
||||
.getTables()
|
||||
.hideout.areas.find((area) => area.type === request.areaType);
|
||||
if (!hideoutDataDb)
|
||||
@ -188,7 +188,8 @@ export class HideoutController
|
||||
output: IItemEventRouterResponse,
|
||||
): void
|
||||
{
|
||||
const db = this.databaseServer.getTables();
|
||||
const hideout = this.databaseService.getHideout();
|
||||
const globals = this.databaseService.getGlobals();
|
||||
|
||||
const profileHideoutArea = pmcData.Hideout.Areas.find((area) => area.type === request.areaType);
|
||||
if (!profileHideoutArea)
|
||||
@ -204,7 +205,7 @@ export class HideoutController
|
||||
profileHideoutArea.completeTime = 0;
|
||||
profileHideoutArea.constructing = false;
|
||||
|
||||
const hideoutData = db.hideout.areas.find((area) => area.type === profileHideoutArea.type);
|
||||
const hideoutData = hideout.areas.find((area) => area.type === profileHideoutArea.type);
|
||||
if (!hideoutData)
|
||||
{
|
||||
this.logger.error(
|
||||
@ -252,7 +253,7 @@ export class HideoutController
|
||||
this.profileHelper.addSkillPointsToPlayer(
|
||||
pmcData,
|
||||
SkillTypes.HIDEOUT_MANAGEMENT,
|
||||
db.globals.config.SkillsSettings.HideoutManagement.SkillPointsPerAreaUpgrade,
|
||||
globals.config.SkillsSettings.HideoutManagement.SkillPointsPerAreaUpgrade,
|
||||
);
|
||||
}
|
||||
|
||||
@ -308,9 +309,8 @@ export class HideoutController
|
||||
}
|
||||
|
||||
// Some areas like gun stand have a child area linked to it, it needs to do the same as above
|
||||
const childDbArea = this.databaseServer
|
||||
.getTables()
|
||||
.hideout.areas.find((x) => x.parentArea === dbHideoutArea._id);
|
||||
const childDbArea = this.databaseService.getHideout().areas
|
||||
.find((area) => area.parentArea === dbHideoutArea._id);
|
||||
if (childDbArea)
|
||||
{
|
||||
// Add key/value to `hideoutAreaStashes` dictionary - used to link hideout area to inventory stash by its id
|
||||
@ -320,9 +320,10 @@ export class HideoutController
|
||||
}
|
||||
|
||||
// Set child area level to same as parent area
|
||||
pmcData.Hideout.Areas.find((x) => x.type === childDbArea.type).level = pmcData.Hideout.Areas.find(
|
||||
(x) => x.type === profileParentHideoutArea.type,
|
||||
).level;
|
||||
pmcData.Hideout.Areas
|
||||
.find((x) => x.type === childDbArea.type).level = pmcData.Hideout.Areas
|
||||
.find((x) => x.type === profileParentHideoutArea.type,
|
||||
).level;
|
||||
|
||||
// Add/upgrade stash item in player inventory
|
||||
const childDbAreaStage = childDbArea.stages[profileParentHideoutArea.level];
|
||||
@ -524,7 +525,8 @@ export class HideoutController
|
||||
const slotIndexToRemove = removeResourceRequest.slots[0];
|
||||
|
||||
// Assume only one item in slot
|
||||
const itemToReturn = hideoutArea.slots.find((slot) => slot.locationIndex === slotIndexToRemove).item[0];
|
||||
const itemToReturn = hideoutArea.slots
|
||||
.find((slot) => slot.locationIndex === slotIndexToRemove).item[0];
|
||||
|
||||
const request: IAddItemDirectRequest = {
|
||||
itemWithModsToAdd: [itemToReturn],
|
||||
@ -596,7 +598,8 @@ export class HideoutController
|
||||
this.hideoutHelper.registerProduction(pmcData, body, sessionID);
|
||||
|
||||
// Find the recipe of the production
|
||||
const recipe = this.databaseServer.getTables().hideout.production.find((p) => p._id === body.recipeId);
|
||||
const recipe = this.databaseService.getHideout().production
|
||||
.find((p) => p._id === body.recipeId);
|
||||
|
||||
// Find the actual amount of items we need to remove because body can send weird data
|
||||
const recipeRequirementsClone = this.cloner.clone(
|
||||
@ -671,12 +674,14 @@ export class HideoutController
|
||||
}
|
||||
}
|
||||
|
||||
const recipe = this.databaseServer.getTables().hideout.scavcase.find((r) => r._id === body.recipeId);
|
||||
const recipe = this.databaseService.getHideout().scavcase
|
||||
.find((r) => r._id === body.recipeId);
|
||||
if (!recipe)
|
||||
{
|
||||
this.logger.error(
|
||||
this.localisationService.getText("hideout-unable_to_find_scav_case_recipie_in_database", body.recipeId),
|
||||
);
|
||||
|
||||
return this.httpResponse.appendErrorToOutput(output);
|
||||
}
|
||||
|
||||
@ -689,7 +694,7 @@ export class HideoutController
|
||||
pmcData,
|
||||
recipe.ProductionTime,
|
||||
SkillTypes.CRAFTING,
|
||||
this.databaseServer.getTables().globals.config.SkillsSettings.Crafting.CraftTimeReductionPerLevel,
|
||||
this.databaseService.getGlobals().config.SkillsSettings.Crafting.CraftTimeReductionPerLevel,
|
||||
);
|
||||
|
||||
const modifiedScavCaseTime = this.getScavCaseTime(pmcData, adjustedCraftTime);
|
||||
@ -766,7 +771,7 @@ export class HideoutController
|
||||
): IItemEventRouterResponse
|
||||
{
|
||||
const output = this.eventOutputHolder.getOutput(sessionID);
|
||||
const hideoutDb = this.databaseServer.getTables().hideout;
|
||||
const hideoutDb = this.databaseService.getHideout();
|
||||
|
||||
if (request.recipeId === HideoutHelper.bitcoinFarm)
|
||||
{
|
||||
@ -1008,7 +1013,7 @@ export class HideoutController
|
||||
// - delete the production in profile Hideout.Production
|
||||
// Hideout Management skill
|
||||
// ? use a configuration variable for the value?
|
||||
const globals = this.databaseServer.getTables().globals;
|
||||
const globals = this.databaseService.getGlobals();
|
||||
this.profileHelper.addSkillPointsToPlayer(
|
||||
pmcData,
|
||||
SkillTypes.HIDEOUT_MANAGEMENT,
|
||||
@ -1147,7 +1152,7 @@ export class HideoutController
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public getQteList(sessionId: string): IQteData[]
|
||||
{
|
||||
return this.databaseServer.getTables().hideout.qte;
|
||||
return this.databaseService.getHideout().qte;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1204,9 +1209,9 @@ export class HideoutController
|
||||
}
|
||||
|
||||
// Find counter by key and update value
|
||||
const shootingRangeHighScore = pmcData.Stats.Eft.OverallCounters.Items.find((x) =>
|
||||
x.Key.includes("ShootingRangePoints"),
|
||||
);
|
||||
const shootingRangeHighScore = pmcData.Stats.Eft.OverallCounters.Items
|
||||
.find((counter) => counter.Key.includes("ShootingRangePoints"),
|
||||
);
|
||||
shootingRangeHighScore.Value = request.points;
|
||||
}
|
||||
|
||||
@ -1264,7 +1269,8 @@ export class HideoutController
|
||||
return this.httpResponse.appendErrorToOutput(output);
|
||||
}
|
||||
|
||||
const hideoutDbData = this.databaseServer.getTables().hideout.areas.find((x) => x.type === request.areaType);
|
||||
const hideoutDbData = this.databaseService.getHideout().areas
|
||||
.find((area) => area.type === request.areaType);
|
||||
if (!hideoutDbData)
|
||||
{
|
||||
this.logger.error(
|
||||
|
@ -30,8 +30,8 @@ import { ITraderConfig } from "@spt/models/spt/config/ITraderConfig";
|
||||
import { ITraderServiceModel } from "@spt/models/spt/services/ITraderServiceModel";
|
||||
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||
import { ConfigServer } from "@spt/servers/ConfigServer";
|
||||
import { DatabaseServer } from "@spt/servers/DatabaseServer";
|
||||
import { SaveServer } from "@spt/servers/SaveServer";
|
||||
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||
import { InsuranceService } from "@spt/services/InsuranceService";
|
||||
import { LocalisationService } from "@spt/services/LocalisationService";
|
||||
import { MailSendService } from "@spt/services/MailSendService";
|
||||
@ -59,7 +59,7 @@ export class InraidController
|
||||
@inject("WinstonLogger") protected logger: ILogger,
|
||||
@inject("SaveServer") protected saveServer: SaveServer,
|
||||
@inject("TimeUtil") protected timeUtil: TimeUtil,
|
||||
@inject("DatabaseServer") protected databaseServer: DatabaseServer,
|
||||
@inject("DatabaseService") protected databaseService: DatabaseService,
|
||||
@inject("PmcChatResponseService") protected pmcChatResponseService: PmcChatResponseService,
|
||||
@inject("MatchBotDetailsCacheService") protected matchBotDetailsCacheService: MatchBotDetailsCacheService,
|
||||
@inject("QuestHelper") protected questHelper: QuestHelper,
|
||||
@ -153,8 +153,7 @@ export class InraidController
|
||||
|
||||
const locationName = serverProfile.inraid.location.toLowerCase();
|
||||
|
||||
const map: ILocationBase = this.databaseServer.getTables().locations[locationName].base;
|
||||
const mapHasInsuranceEnabled = map.Insurance;
|
||||
const map: ILocationBase = this.databaseService.getLocations()[locationName].base;
|
||||
|
||||
const serverPmcProfile = serverProfile.characters.pmc;
|
||||
const serverScavProfile = serverProfile.characters.scav;
|
||||
@ -467,7 +466,7 @@ export class InraidController
|
||||
*/
|
||||
protected migrateScavQuestProgressToPmcProfile(scavProfile: IPmcData, pmcProfile: IPmcData): void
|
||||
{
|
||||
const achievements = this.databaseServer.getTables().templates.achievements;
|
||||
const achievements = this.databaseService.getAchievements();
|
||||
|
||||
for (const quest of scavProfile.Quests)
|
||||
{
|
||||
@ -676,7 +675,7 @@ export class InraidController
|
||||
const serverProfile = this.saveServer.getProfile(sessionId);
|
||||
const pmcData = serverProfile.characters.pmc;
|
||||
|
||||
const dialogueTemplates = this.databaseServer.getTables().traders[traderId].dialogue;
|
||||
const dialogueTemplates = this.databaseService.getTraders()[traderId].dialogue;
|
||||
if (!dialogueTemplates)
|
||||
{
|
||||
this.logger.error(this.localisationService.getText("inraid-unable_to_deliver_item_no_trader_found", traderId));
|
||||
|
@ -18,8 +18,8 @@ import { IInsuranceConfig } from "@spt/models/spt/config/IInsuranceConfig";
|
||||
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||
import { EventOutputHolder } from "@spt/routers/EventOutputHolder";
|
||||
import { ConfigServer } from "@spt/servers/ConfigServer";
|
||||
import { DatabaseServer } from "@spt/servers/DatabaseServer";
|
||||
import { SaveServer } from "@spt/servers/SaveServer";
|
||||
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||
import { InsuranceService } from "@spt/services/InsuranceService";
|
||||
import { LocalisationService } from "@spt/services/LocalisationService";
|
||||
import { MailSendService } from "@spt/services/MailSendService";
|
||||
@ -45,7 +45,7 @@ export class InsuranceController
|
||||
@inject("EventOutputHolder") protected eventOutputHolder: EventOutputHolder,
|
||||
@inject("TimeUtil") protected timeUtil: TimeUtil,
|
||||
@inject("SaveServer") protected saveServer: SaveServer,
|
||||
@inject("DatabaseServer") protected databaseServer: DatabaseServer,
|
||||
@inject("DatabaseService") protected databaseServer: DatabaseService,
|
||||
@inject("ItemHelper") protected itemHelper: ItemHelper,
|
||||
@inject("ProfileHelper") protected profileHelper: ProfileHelper,
|
||||
@inject("DialogueHelper") protected dialogueHelper: DialogueHelper,
|
||||
@ -586,12 +586,12 @@ export class InsuranceController
|
||||
const labsId = "laboratory";
|
||||
// After all of the item filtering that we've done, if there are no items remaining, the insurance has
|
||||
// successfully "failed" to return anything and an appropriate message should be sent to the player.
|
||||
const traderDialogMessages = this.databaseServer.getTables().traders[insurance.traderId].dialogue;
|
||||
const traderDialogMessages = this.databaseServer.getTraders()[insurance.traderId].dialogue;
|
||||
|
||||
// Map is labs + insurance is disabled in base.json
|
||||
if (
|
||||
insurance.systemData?.location.toLowerCase() === labsId
|
||||
&& !this.databaseServer.getTables().locations[labsId].base.Insurance
|
||||
insurance.systemData?.location?.toLowerCase() === labsId
|
||||
&& !(this.databaseServer.getLocations()[labsId].base.Insurance)
|
||||
)
|
||||
{
|
||||
// Trader has labs-specific messages
|
||||
|
@ -38,7 +38,7 @@ import { SkillTypes } from "@spt/models/enums/SkillTypes";
|
||||
import { Traders } from "@spt/models/enums/Traders";
|
||||
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||
import { EventOutputHolder } from "@spt/routers/EventOutputHolder";
|
||||
import { DatabaseServer } from "@spt/servers/DatabaseServer";
|
||||
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||
import { FenceService } from "@spt/services/FenceService";
|
||||
import { LocalisationService } from "@spt/services/LocalisationService";
|
||||
import { PlayerService } from "@spt/services/PlayerService";
|
||||
@ -56,7 +56,7 @@ export class InventoryController
|
||||
@inject("HashUtil") protected hashUtil: HashUtil,
|
||||
@inject("ItemHelper") protected itemHelper: ItemHelper,
|
||||
@inject("RandomUtil") protected randomUtil: RandomUtil,
|
||||
@inject("DatabaseServer") protected databaseServer: DatabaseServer,
|
||||
@inject("DatabaseService") protected databaseService: DatabaseService,
|
||||
@inject("FenceService") protected fenceService: FenceService,
|
||||
@inject("PresetHelper") protected presetHelper: PresetHelper,
|
||||
@inject("InventoryHelper") protected inventoryHelper: InventoryHelper,
|
||||
@ -641,7 +641,7 @@ export class InventoryController
|
||||
if (!itemId)
|
||||
{
|
||||
// item template
|
||||
if (body.item in this.databaseServer.getTables().templates.items)
|
||||
if (body.item in this.databaseService.getItems())
|
||||
{
|
||||
itemId = body.item;
|
||||
}
|
||||
@ -724,9 +724,8 @@ export class InventoryController
|
||||
{
|
||||
// Not fence
|
||||
// get tpl from trader assort
|
||||
return this.databaseServer
|
||||
.getTables()
|
||||
.traders[request.fromOwner.id].assort.items.find((item) => item._id === request.item)._tpl;
|
||||
return this.databaseService.getTraders()[request.fromOwner.id].assort.items
|
||||
.find((item) => item._id === request.item)._tpl;
|
||||
}
|
||||
|
||||
if (request.fromOwner.type === "RagFair")
|
||||
|
@ -12,8 +12,8 @@ import { ICoreConfig } from "@spt/models/spt/config/ICoreConfig";
|
||||
import { IPackageJsonData } from "@spt/models/spt/mod/IPackageJsonData";
|
||||
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||
import { ConfigServer } from "@spt/servers/ConfigServer";
|
||||
import { DatabaseServer } from "@spt/servers/DatabaseServer";
|
||||
import { SaveServer } from "@spt/servers/SaveServer";
|
||||
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||
import { LocalisationService } from "@spt/services/LocalisationService";
|
||||
import { HashUtil } from "@spt/utils/HashUtil";
|
||||
import { RandomUtil } from "@spt/utils/RandomUtil";
|
||||
@ -32,7 +32,7 @@ export class LauncherController
|
||||
@inject("SaveServer") protected saveServer: SaveServer,
|
||||
@inject("HttpServerHelper") protected httpServerHelper: HttpServerHelper,
|
||||
@inject("ProfileHelper") protected profileHelper: ProfileHelper,
|
||||
@inject("DatabaseServer") protected databaseServer: DatabaseServer,
|
||||
@inject("DatabaseService") protected databaseServer: DatabaseService,
|
||||
@inject("LocalisationService") protected localisationService: LocalisationService,
|
||||
@inject("PreSptModLoader") protected preSptModLoader: PreSptModLoader,
|
||||
@inject("ConfigServer") protected configServer: ConfigServer,
|
||||
@ -46,7 +46,7 @@ export class LauncherController
|
||||
return {
|
||||
backendUrl: this.httpServerHelper.getBackendUrl(),
|
||||
name: this.coreConfig.serverName,
|
||||
editions: Object.keys(this.databaseServer.getTables().templates.profiles),
|
||||
editions: Object.keys(this.databaseServer.getProfiles()),
|
||||
profileDescriptions: this.getProfileDescriptions(),
|
||||
};
|
||||
}
|
||||
@ -58,7 +58,7 @@ export class LauncherController
|
||||
protected getProfileDescriptions(): Record<string, string>
|
||||
{
|
||||
const result = {};
|
||||
const dbProfiles = this.databaseServer.getTables().templates.profiles;
|
||||
const dbProfiles = this.databaseServer.getProfiles();
|
||||
for (const profileKey in dbProfiles)
|
||||
{
|
||||
const localeKey = dbProfiles[profileKey]?.descriptionLocaleKey;
|
||||
|
@ -19,7 +19,7 @@ import { ILocations } from "@spt/models/spt/server/ILocations";
|
||||
import { LootRequest } from "@spt/models/spt/services/LootRequest";
|
||||
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||
import { ConfigServer } from "@spt/servers/ConfigServer";
|
||||
import { DatabaseServer } from "@spt/servers/DatabaseServer";
|
||||
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||
import { ItemFilterService } from "@spt/services/ItemFilterService";
|
||||
import { LocalisationService } from "@spt/services/LocalisationService";
|
||||
import { RaidTimeAdjustmentService } from "@spt/services/RaidTimeAdjustmentService";
|
||||
@ -44,7 +44,7 @@ export class LocationController
|
||||
@inject("RaidTimeAdjustmentService") protected raidTimeAdjustmentService: RaidTimeAdjustmentService,
|
||||
@inject("ItemFilterService") protected itemFilterService: ItemFilterService,
|
||||
@inject("LootGenerator") protected lootGenerator: LootGenerator,
|
||||
@inject("DatabaseServer") protected databaseServer: DatabaseServer,
|
||||
@inject("DatabaseService") protected databaseService: DatabaseService,
|
||||
@inject("TimeUtil") protected timeUtil: TimeUtil,
|
||||
@inject("ConfigServer") protected configServer: ConfigServer,
|
||||
@inject("ApplicationContext") protected applicationContext: ApplicationContext,
|
||||
@ -72,16 +72,16 @@ export class LocationController
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a maps base location with loot
|
||||
* Generate a maps base location and loot
|
||||
* @param name Map name
|
||||
* @returns ILocationBase
|
||||
*/
|
||||
protected generate(name: string): ILocationBase
|
||||
{
|
||||
const db = this.databaseServer.getTables();
|
||||
const location: ILocation = db.locations[name];
|
||||
const location: ILocation = this.databaseService.getLocations()[name];
|
||||
const locationBaseClone: ILocationBase = this.cloner.clone(location.base);
|
||||
|
||||
// Update datetime property to now
|
||||
locationBaseClone.UnixDateTime = this.timeUtil.getTimestamp();
|
||||
|
||||
// Don't generate loot for hideout
|
||||
@ -146,7 +146,7 @@ export class LocationController
|
||||
*/
|
||||
public generateAll(sessionId: string): ILocationsGenerateAllResponse
|
||||
{
|
||||
const locationsFromDb = this.databaseServer.getTables().locations;
|
||||
const locationsFromDb = this.databaseService.getLocations();
|
||||
const locations: ILocations = {};
|
||||
for (const mapName in locationsFromDb)
|
||||
{
|
||||
|
@ -2,7 +2,7 @@ import { inject, injectable } from "tsyringe";
|
||||
import { PresetHelper } from "@spt/helpers/PresetHelper";
|
||||
import { IPreset } from "@spt/models/eft/common/IGlobals";
|
||||
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||
import { DatabaseServer } from "@spt/servers/DatabaseServer";
|
||||
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||
|
||||
@injectable()
|
||||
export class PresetController
|
||||
@ -10,13 +10,13 @@ export class PresetController
|
||||
constructor(
|
||||
@inject("WinstonLogger") protected logger: ILogger,
|
||||
@inject("PresetHelper") protected presetHelper: PresetHelper,
|
||||
@inject("DatabaseServer") protected databaseServer: DatabaseServer,
|
||||
@inject("DatabaseService") protected databaseService: DatabaseService,
|
||||
)
|
||||
{}
|
||||
|
||||
public initialize(): void
|
||||
{
|
||||
const presets: [string, IPreset][] = Object.entries(this.databaseServer.getTables().globals.ItemPresets);
|
||||
const presets: [string, IPreset][] = Object.entries(this.databaseService.getGlobals().ItemPresets);
|
||||
const reverse: Record<string, string[]> = {};
|
||||
|
||||
for (const [id, preset] of presets)
|
||||
|
@ -23,8 +23,8 @@ import { MessageType } from "@spt/models/enums/MessageType";
|
||||
import { QuestStatus } from "@spt/models/enums/QuestStatus";
|
||||
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||
import { EventOutputHolder } from "@spt/routers/EventOutputHolder";
|
||||
import { DatabaseServer } from "@spt/servers/DatabaseServer";
|
||||
import { SaveServer } from "@spt/servers/SaveServer";
|
||||
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||
import { LocalisationService } from "@spt/services/LocalisationService";
|
||||
import { MailSendService } from "@spt/services/MailSendService";
|
||||
import { ProfileFixerService } from "@spt/services/ProfileFixerService";
|
||||
@ -35,12 +35,14 @@ import { TimeUtil } from "@spt/utils/TimeUtil";
|
||||
@injectable()
|
||||
export class ProfileController
|
||||
{
|
||||
protected defaultInventoryTpl = "55d7217a4bdc2d86028b456d";
|
||||
|
||||
constructor(
|
||||
@inject("WinstonLogger") protected logger: ILogger,
|
||||
@inject("HashUtil") protected hashUtil: HashUtil,
|
||||
@inject("TimeUtil") protected timeUtil: TimeUtil,
|
||||
@inject("SaveServer") protected saveServer: SaveServer,
|
||||
@inject("DatabaseServer") protected databaseServer: DatabaseServer,
|
||||
@inject("DatabaseService") protected databaseService: DatabaseService,
|
||||
@inject("ItemHelper") protected itemHelper: ItemHelper,
|
||||
@inject("ProfileFixerService") protected profileFixerService: ProfileFixerService,
|
||||
@inject("LocalisationService") protected localisationService: LocalisationService,
|
||||
@ -130,7 +132,7 @@ export class ProfileController
|
||||
{
|
||||
const account = this.saveServer.getProfile(sessionID).info;
|
||||
const profile: ITemplateSide
|
||||
= this.databaseServer.getTables().templates.profiles[account.edition][info.side.toLowerCase()];
|
||||
= this.databaseService.getProfiles()[account.edition][info.side.toLowerCase()];
|
||||
const pmcData = profile.character;
|
||||
|
||||
// Delete existing profile
|
||||
@ -144,7 +146,7 @@ export class ProfileController
|
||||
pmcData.Info.Nickname = info.nickname;
|
||||
pmcData.Info.LowerNickname = info.nickname.toLowerCase();
|
||||
pmcData.Info.RegistrationDate = this.timeUtil.getTimestamp();
|
||||
pmcData.Info.Voice = this.databaseServer.getTables().templates.customization[info.voiceId]._name;
|
||||
pmcData.Info.Voice = this.databaseService.getCustomization()[info.voiceId]._name;
|
||||
pmcData.Stats = this.profileHelper.getDefaultCounters();
|
||||
pmcData.Info.NeedWipeOptions = [];
|
||||
pmcData.Customization.Head = info.headId;
|
||||
@ -321,13 +323,13 @@ export class ProfileController
|
||||
|
||||
/**
|
||||
* For each trader reset their state to what a level 1 player would see
|
||||
* @param sessionID Session id of profile to reset
|
||||
* @param sessionId Session id of profile to reset
|
||||
*/
|
||||
protected resetAllTradersInProfile(sessionID: string): void
|
||||
protected resetAllTradersInProfile(sessionId: string): void
|
||||
{
|
||||
for (const traderID in this.databaseServer.getTables().traders)
|
||||
for (const traderId in this.databaseService.getTraders())
|
||||
{
|
||||
this.traderHelper.resetTrader(sessionID, traderID);
|
||||
this.traderHelper.resetTrader(sessionId, traderId);
|
||||
}
|
||||
}
|
||||
|
||||
@ -462,7 +464,7 @@ export class ProfileController
|
||||
skills: playerPmc.Skills,
|
||||
equipment: {
|
||||
// Default inventory tpl
|
||||
Id: playerPmc.Inventory.items.find((x) => x._tpl === "55d7217a4bdc2d86028b456d")._id,
|
||||
Id: playerPmc.Inventory.items.find((item) => item._tpl === this.defaultInventoryTpl)._id,
|
||||
Items: playerPmc.Inventory.items,
|
||||
},
|
||||
achievements: playerPmc.Achievements,
|
||||
|
@ -23,7 +23,7 @@ import { IQuestConfig } from "@spt/models/spt/config/IQuestConfig";
|
||||
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||
import { EventOutputHolder } from "@spt/routers/EventOutputHolder";
|
||||
import { ConfigServer } from "@spt/servers/ConfigServer";
|
||||
import { DatabaseServer } from "@spt/servers/DatabaseServer";
|
||||
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||
import { LocaleService } from "@spt/services/LocaleService";
|
||||
import { LocalisationService } from "@spt/services/LocalisationService";
|
||||
import { MailSendService } from "@spt/services/MailSendService";
|
||||
@ -43,7 +43,7 @@ export class QuestController
|
||||
@inject("TimeUtil") protected timeUtil: TimeUtil,
|
||||
@inject("HttpResponseUtil") protected httpResponseUtil: HttpResponseUtil,
|
||||
@inject("EventOutputHolder") protected eventOutputHolder: EventOutputHolder,
|
||||
@inject("DatabaseServer") protected databaseServer: DatabaseServer,
|
||||
@inject("DatabaseService") protected databaseService: DatabaseService,
|
||||
@inject("ItemHelper") protected itemHelper: ItemHelper,
|
||||
@inject("DialogueHelper") protected dialogueHelper: DialogueHelper,
|
||||
@inject("MailSendService") protected mailSendService: MailSendService,
|
||||
|
@ -31,9 +31,9 @@ import { IRagfairConfig } from "@spt/models/spt/config/IRagfairConfig";
|
||||
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||
import { EventOutputHolder } from "@spt/routers/EventOutputHolder";
|
||||
import { ConfigServer } from "@spt/servers/ConfigServer";
|
||||
import { DatabaseServer } from "@spt/servers/DatabaseServer";
|
||||
import { RagfairServer } from "@spt/servers/RagfairServer";
|
||||
import { SaveServer } from "@spt/servers/SaveServer";
|
||||
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||
import { LocalisationService } from "@spt/services/LocalisationService";
|
||||
import { PaymentService } from "@spt/services/PaymentService";
|
||||
import { RagfairOfferService } from "@spt/services/RagfairOfferService";
|
||||
@ -58,7 +58,7 @@ export class RagfairController
|
||||
@inject("EventOutputHolder") protected eventOutputHolder: EventOutputHolder,
|
||||
@inject("RagfairServer") protected ragfairServer: RagfairServer,
|
||||
@inject("RagfairPriceService") protected ragfairPriceService: RagfairPriceService,
|
||||
@inject("DatabaseServer") protected databaseServer: DatabaseServer,
|
||||
@inject("DatabaseService") protected databaseService: DatabaseService,
|
||||
@inject("ItemHelper") protected itemHelper: ItemHelper,
|
||||
@inject("SaveServer") protected saveServer: SaveServer,
|
||||
@inject("RagfairSellHelper") protected ragfairSellHelper: RagfairSellHelper,
|
||||
@ -207,7 +207,7 @@ export class RagfairController
|
||||
{
|
||||
// Linked/required search categories
|
||||
const playerHasFleaUnlocked
|
||||
= pmcProfile.Info.Level >= this.databaseServer.getTables().globals.config.RagFair.minUserLevel;
|
||||
= pmcProfile.Info.Level >= this.databaseService.getGlobals().config.RagFair.minUserLevel;
|
||||
let offerPool = [];
|
||||
if (this.isLinkedSearch(searchRequest) || this.isRequiredSearch(searchRequest))
|
||||
{
|
||||
@ -325,7 +325,7 @@ export class RagfairController
|
||||
const pmcProfile = profilesDict[sessionID].characters.pmc;
|
||||
if (
|
||||
pmcProfile.RagfairInfo !== undefined
|
||||
&& pmcProfile.Info.Level >= this.databaseServer.getTables().globals.config.RagFair.minUserLevel
|
||||
&& pmcProfile.Info.Level >= this.databaseService.getGlobals().config.RagFair.minUserLevel
|
||||
)
|
||||
{
|
||||
this.ragfairOfferHelper.processOffersOnProfile(sessionID);
|
||||
@ -391,9 +391,7 @@ export class RagfairController
|
||||
}
|
||||
|
||||
// No offers listed, get price from live ragfair price list prices.json
|
||||
const templatesDb = this.databaseServer.getTables().templates;
|
||||
|
||||
let tplPrice = templatesDb.prices[getPriceRequest.templateId];
|
||||
let tplPrice = this.databaseService.getPrices()[getPriceRequest.templateId];
|
||||
if (!tplPrice)
|
||||
{
|
||||
// No flea price, get handbook price
|
||||
|
@ -10,7 +10,7 @@ import { ITraderRepairActionDataRequest } from "@spt/models/eft/repair/ITraderRe
|
||||
import { IRepairConfig } from "@spt/models/spt/config/IRepairConfig";
|
||||
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||
import { EventOutputHolder } from "@spt/routers/EventOutputHolder";
|
||||
import { DatabaseServer } from "@spt/servers/DatabaseServer";
|
||||
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||
import { PaymentService } from "@spt/services/PaymentService";
|
||||
import { RepairService } from "@spt/services/RepairService";
|
||||
|
||||
@ -22,7 +22,7 @@ export class RepairController
|
||||
constructor(
|
||||
@inject("WinstonLogger") protected logger: ILogger,
|
||||
@inject("EventOutputHolder") protected eventOutputHolder: EventOutputHolder,
|
||||
@inject("DatabaseServer") protected databaseServer: DatabaseServer,
|
||||
@inject("DatabaseService") protected databaseService: DatabaseService,
|
||||
@inject("QuestHelper") protected questHelper: QuestHelper,
|
||||
@inject("TraderHelper") protected traderHelper: TraderHelper,
|
||||
@inject("PaymentService") protected paymentService: PaymentService,
|
||||
|
@ -23,7 +23,7 @@ import { IQuestTypePool } from "@spt/models/spt/repeatable/IQuestTypePool";
|
||||
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||
import { EventOutputHolder } from "@spt/routers/EventOutputHolder";
|
||||
import { ConfigServer } from "@spt/servers/ConfigServer";
|
||||
import { DatabaseServer } from "@spt/servers/DatabaseServer";
|
||||
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||
import { LocalisationService } from "@spt/services/LocalisationService";
|
||||
import { PaymentService } from "@spt/services/PaymentService";
|
||||
import { ProfileFixerService } from "@spt/services/ProfileFixerService";
|
||||
@ -40,7 +40,7 @@ export class RepeatableQuestController
|
||||
|
||||
constructor(
|
||||
@inject("WinstonLogger") protected logger: ILogger,
|
||||
@inject("DatabaseServer") protected databaseServer: DatabaseServer,
|
||||
@inject("DatabaseService") protected databaseService: DatabaseService,
|
||||
@inject("TimeUtil") protected timeUtil: TimeUtil,
|
||||
@inject("RandomUtil") protected randomUtil: RandomUtil,
|
||||
@inject("HttpResponseUtil") protected httpResponse: HttpResponseUtil,
|
||||
@ -220,7 +220,7 @@ export class RepeatableQuestController
|
||||
// Elite charisma skill gives extra daily quest(s)
|
||||
return (
|
||||
repeatableConfig.numQuests
|
||||
+ this.databaseServer.getTables().globals.config.SkillsSettings.Charisma.BonusSettings.EliteBonusSettings
|
||||
+ this.databaseService.getGlobals().config.SkillsSettings.Charisma.BonusSettings.EliteBonusSettings
|
||||
.RepeatableQuestExtraCount
|
||||
);
|
||||
}
|
||||
@ -394,7 +394,7 @@ export class RepeatableQuestController
|
||||
return true;
|
||||
}
|
||||
|
||||
const locationBase: ILocationBase = this.databaseServer.getTables().locations[location.toLowerCase()]?.base;
|
||||
const locationBase: ILocationBase = this.databaseService.getLocations()[location.toLowerCase()]?.base;
|
||||
if (!locationBase)
|
||||
{
|
||||
return true;
|
||||
|
@ -26,8 +26,8 @@ import { ITraderConfig } from "@spt/models/spt/config/ITraderConfig";
|
||||
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||
import { EventOutputHolder } from "@spt/routers/EventOutputHolder";
|
||||
import { ConfigServer } from "@spt/servers/ConfigServer";
|
||||
import { DatabaseServer } from "@spt/servers/DatabaseServer";
|
||||
import { RagfairServer } from "@spt/servers/RagfairServer";
|
||||
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||
import { LocalisationService } from "@spt/services/LocalisationService";
|
||||
import { MailSendService } from "@spt/services/MailSendService";
|
||||
import { RagfairPriceService } from "@spt/services/RagfairPriceService";
|
||||
@ -46,7 +46,7 @@ export class TradeController
|
||||
|
||||
constructor(
|
||||
@inject("WinstonLogger") protected logger: ILogger,
|
||||
@inject("DatabaseServer") protected databaseServer: DatabaseServer,
|
||||
@inject("DatabaseService") protected databaseService: DatabaseService,
|
||||
@inject("EventOutputHolder") protected eventOutputHolder: EventOutputHolder,
|
||||
@inject("TradeHelper") protected tradeHelper: TradeHelper,
|
||||
@inject("TimeUtil") protected timeUtil: TimeUtil,
|
||||
@ -288,7 +288,7 @@ export class TradeController
|
||||
sessionId,
|
||||
this.traderHelper.getTraderById(trader),
|
||||
MessageType.MESSAGE_WITH_ITEMS,
|
||||
this.randomUtil.getArrayValue(this.databaseServer.getTables().traders[trader].dialogue.soldItems),
|
||||
this.randomUtil.getArrayValue(this.databaseService.getTraders()[trader].dialogue.soldItems),
|
||||
curencyReward.flatMap((x) => x),
|
||||
this.timeUtil.getHoursAsSeconds(72),
|
||||
);
|
||||
|
@ -9,7 +9,7 @@ import { Traders } from "@spt/models/enums/Traders";
|
||||
import { ITraderConfig } from "@spt/models/spt/config/ITraderConfig";
|
||||
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||
import { ConfigServer } from "@spt/servers/ConfigServer";
|
||||
import { DatabaseServer } from "@spt/servers/DatabaseServer";
|
||||
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||
import { FenceService } from "@spt/services/FenceService";
|
||||
import { TraderAssortService } from "@spt/services/TraderAssortService";
|
||||
import { TraderPurchasePersisterService } from "@spt/services/TraderPurchasePersisterService";
|
||||
@ -24,7 +24,7 @@ export class TraderController
|
||||
constructor(
|
||||
@inject("WinstonLogger") protected logger: ILogger,
|
||||
@inject("TimeUtil") protected timeUtil: TimeUtil,
|
||||
@inject("DatabaseServer") protected databaseServer: DatabaseServer,
|
||||
@inject("DatabaseService") protected databaseService: DatabaseService,
|
||||
@inject("TraderAssortHelper") protected traderAssortHelper: TraderAssortHelper,
|
||||
@inject("ProfileHelper") protected profileHelper: ProfileHelper,
|
||||
@inject("TraderHelper") protected traderHelper: TraderHelper,
|
||||
@ -49,7 +49,9 @@ export class TraderController
|
||||
{
|
||||
const nextHourTimestamp = this.timeUtil.getTimestampOfNextHour();
|
||||
const traderResetStartsWithServer = this.traderConfig.tradersResetFromServerStart;
|
||||
for (const traderId in this.databaseServer.getTables().traders)
|
||||
|
||||
const traders = this.databaseService.getTraders();
|
||||
for (const traderId in traders)
|
||||
{
|
||||
if (traderId === "ragfair" || traderId === Traders.LIGHTHOUSEKEEPER)
|
||||
{
|
||||
@ -63,7 +65,7 @@ export class TraderController
|
||||
continue;
|
||||
}
|
||||
|
||||
const trader = this.databaseServer.getTables().traders[traderId];
|
||||
const trader = traders[traderId];
|
||||
|
||||
// Create dict of trader assorts on server start
|
||||
if (!this.traderAssortService.getPristineTraderAssort(traderId))
|
||||
@ -78,7 +80,7 @@ export class TraderController
|
||||
trader.base.nextResupply = traderResetStartsWithServer
|
||||
? this.traderHelper.getNextUpdateTimestamp(trader.base._id)
|
||||
: nextHourTimestamp;
|
||||
this.databaseServer.getTables().traders[trader.base._id].base = trader.base;
|
||||
traders[trader.base._id].base = trader.base;
|
||||
}
|
||||
}
|
||||
|
||||
@ -90,7 +92,7 @@ export class TraderController
|
||||
*/
|
||||
public update(): boolean
|
||||
{
|
||||
for (const traderId in this.databaseServer.getTables().traders)
|
||||
for (const traderId in this.databaseService.getTables().traders)
|
||||
{
|
||||
if (traderId === "ragfair" || traderId === Traders.LIGHTHOUSEKEEPER)
|
||||
{
|
||||
@ -107,7 +109,7 @@ export class TraderController
|
||||
continue;
|
||||
}
|
||||
|
||||
const trader = this.databaseServer.getTables().traders[traderId];
|
||||
const trader = this.databaseService.getTables().traders[traderId];
|
||||
|
||||
// trader needs to be refreshed
|
||||
if (this.traderAssortHelper.traderAssortsHaveExpired(traderId))
|
||||
@ -132,9 +134,9 @@ export class TraderController
|
||||
{
|
||||
const traders: ITraderBase[] = [];
|
||||
const pmcData = this.profileHelper.getPmcProfile(sessionID);
|
||||
for (const traderID in this.databaseServer.getTables().traders)
|
||||
for (const traderID in this.databaseService.getTables().traders)
|
||||
{
|
||||
if (this.databaseServer.getTables().traders[traderID].base._id === "ragfair")
|
||||
if (this.databaseService.getTables().traders[traderID].base._id === "ragfair")
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@ -2,7 +2,10 @@ import { error } from "console";
|
||||
import { inject, injectable } from "tsyringe";
|
||||
import { IGlobals } from "@spt/models/eft/common/IGlobals";
|
||||
import { IAchievement } from "@spt/models/eft/common/tables/IAchievement";
|
||||
import { ICustomizationItem } from "@spt/models/eft/common/tables/ICustomizationItem";
|
||||
import { IHandbookBase } from "@spt/models/eft/common/tables/IHandbookBase";
|
||||
import { IMatch } from "@spt/models/eft/common/tables/IMatch";
|
||||
import { IProfileTemplates } from "@spt/models/eft/common/tables/IProfileTemplate";
|
||||
import { IQuest } from "@spt/models/eft/common/tables/IQuest";
|
||||
import { ITemplateItem } from "@spt/models/eft/common/tables/ITemplateItem";
|
||||
import { ITrader } from "@spt/models/eft/common/tables/ITrader";
|
||||
@ -170,6 +173,32 @@ export class DatabaseService
|
||||
return this.databaseServer.getTables().templates!.achievements!;
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns assets/database/templates/customisation.json
|
||||
*/
|
||||
public getCustomization(): Record<string, ICustomizationItem>
|
||||
{
|
||||
if (!this.databaseServer.getTables().templates!.customization)
|
||||
{
|
||||
throw new error(this.localisationService.getText("database-data_at_path_missing", "assets/database/templates/customization.json"));
|
||||
}
|
||||
|
||||
return this.databaseServer.getTables().templates!.customization!;
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns assets/database/templates/items.json
|
||||
*/
|
||||
public getHandbook(): IHandbookBase
|
||||
{
|
||||
if (!this.databaseServer.getTables().templates!.handbook)
|
||||
{
|
||||
throw new error(this.localisationService.getText("database-data_at_path_missing", "assets/database/templates/handbook.json"));
|
||||
}
|
||||
|
||||
return this.databaseServer.getTables().templates!.handbook!;
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns assets/database/templates/items.json
|
||||
*/
|
||||
@ -183,6 +212,32 @@ export class DatabaseService
|
||||
return this.databaseServer.getTables().templates!.items!;
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns assets/database/templates/prices.json
|
||||
*/
|
||||
public getPrices(): Record<string, number>
|
||||
{
|
||||
if (!this.databaseServer.getTables().templates!.prices)
|
||||
{
|
||||
throw new error(this.localisationService.getText("database-data_at_path_missing", "assets/database/templates/prices.json"));
|
||||
}
|
||||
|
||||
return this.databaseServer.getTables().templates!.prices!;
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns assets/database/templates/profiles.json
|
||||
*/
|
||||
public getProfiles(): IProfileTemplates
|
||||
{
|
||||
if (!this.databaseServer.getTables().templates!.profiles)
|
||||
{
|
||||
throw new error(this.localisationService.getText("database-data_at_path_missing", "assets/database/templates/profiles.json"));
|
||||
}
|
||||
|
||||
return this.databaseServer.getTables().templates!.profiles!;
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns assets/database/templates/items.json
|
||||
*/
|
||||
|
@ -14,7 +14,7 @@ import { ISeasonalEvent, ISeasonalEventConfig } from "@spt/models/spt/config/ISe
|
||||
import { IWeatherConfig } from "@spt/models/spt/config/IWeatherConfig";
|
||||
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||
import { ConfigServer } from "@spt/servers/ConfigServer";
|
||||
import { DatabaseServer } from "@spt/servers/DatabaseServer";
|
||||
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||
import { GiftService } from "@spt/services/GiftService";
|
||||
import { LocalisationService } from "@spt/services/LocalisationService";
|
||||
import { DatabaseImporter } from "@spt/utils/DatabaseImporter";
|
||||
@ -35,7 +35,7 @@ export class SeasonalEventService
|
||||
|
||||
constructor(
|
||||
@inject("WinstonLogger") protected logger: ILogger,
|
||||
@inject("DatabaseServer") protected databaseServer: DatabaseServer,
|
||||
@inject("DatabaseService") protected databaseService: DatabaseService,
|
||||
@inject("DatabaseImporter") protected databaseImporter: DatabaseImporter,
|
||||
@inject("GiftService") protected giftService: GiftService,
|
||||
@inject("LocalisationService") protected localisationService: LocalisationService,
|
||||
@ -222,7 +222,7 @@ export class SeasonalEventService
|
||||
{
|
||||
if (this.currentlyActiveEvents)
|
||||
{
|
||||
const globalConfig = this.databaseServer.getTables().globals!.config;
|
||||
const globalConfig = this.databaseService.getGlobals().config;
|
||||
for (const event of this.currentlyActiveEvents)
|
||||
{
|
||||
this.updateGlobalEvents(sessionId, globalConfig, event);
|
||||
@ -405,12 +405,12 @@ export class SeasonalEventService
|
||||
|
||||
protected adjustZryachiyMeleeChance(): void
|
||||
{
|
||||
this.databaseServer.getTables().bots!.types.bosszryachiy.chances.equipment.Scabbard = 100;
|
||||
this.databaseService.getBots().types.bosszryachiy.chances.equipment.Scabbard = 100;
|
||||
}
|
||||
|
||||
protected enableHalloweenSummonEvent(): void
|
||||
{
|
||||
this.databaseServer.getTables().globals!.config.EventSettings.EventActive = true;
|
||||
this.databaseService.getGlobals().config.EventSettings.EventActive = true;
|
||||
}
|
||||
|
||||
protected addEventBossesToMaps(eventType: SeasonalEventType): void
|
||||
@ -433,11 +433,12 @@ export class SeasonalEventService
|
||||
}
|
||||
for (const boss of bossesToAdd)
|
||||
{
|
||||
const mapBosses: BossLocationSpawn[]
|
||||
= this.databaseServer.getTables().locations![mapKey].base.BossLocationSpawn;
|
||||
if (!mapBosses.find((x) => x.BossName === boss.BossName))
|
||||
const locations = this.databaseService.getLocations();
|
||||
|
||||
const mapBosses: BossLocationSpawn[] = locations[mapKey].base.BossLocationSpawn;
|
||||
if (!mapBosses.find((bossSpawn) => bossSpawn.BossName === boss.BossName))
|
||||
{
|
||||
this.databaseServer.getTables().locations![mapKey].base.BossLocationSpawn.push(...bossesToAdd);
|
||||
locations[mapKey].base.BossLocationSpawn.push(...bossesToAdd);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -486,7 +487,7 @@ export class SeasonalEventService
|
||||
*/
|
||||
protected addLootItemsToGifterDropItemsList(): void
|
||||
{
|
||||
const gifterBot = this.databaseServer.getTables().bots!.types.gifter;
|
||||
const gifterBot = this.databaseService.getBots().types.gifter;
|
||||
for (const difficulty in gifterBot.difficulty)
|
||||
{
|
||||
gifterBot.difficulty[difficulty].Patrol.ITEMS_TO_DROP = Object.keys(
|
||||
@ -512,7 +513,7 @@ export class SeasonalEventService
|
||||
// Iterate over bots with changes to apply
|
||||
for (const bot in botGearChanges)
|
||||
{
|
||||
const botToUpdate = this.databaseServer.getTables().bots!.types[bot.toLowerCase()];
|
||||
const botToUpdate = this.databaseService.getBots().types[bot.toLowerCase()];
|
||||
if (!botToUpdate)
|
||||
{
|
||||
this.logger.warning(this.localisationService.getText("gameevent-bot_not_found", bot));
|
||||
@ -541,7 +542,7 @@ export class SeasonalEventService
|
||||
|
||||
protected addPumpkinsToScavBackpacks(): void
|
||||
{
|
||||
this.databaseServer.getTables().bots!.types.assault.inventory.items.Backpack["634959225289190e5e773b3b"] = 400;
|
||||
this.databaseService.getBots().types.assault.inventory.items.Backpack["634959225289190e5e773b3b"] = 400;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -549,7 +550,7 @@ export class SeasonalEventService
|
||||
*/
|
||||
protected enableDancingTree(): void
|
||||
{
|
||||
const maps = this.databaseServer.getTables().locations;
|
||||
const maps = this.databaseService.getLocations();
|
||||
for (const mapName in maps)
|
||||
{
|
||||
// Skip maps that have no tree
|
||||
@ -572,7 +573,7 @@ export class SeasonalEventService
|
||||
protected addGifterBotToMaps(): void
|
||||
{
|
||||
const gifterSettings = this.seasonalEventConfig.gifterSettings;
|
||||
const maps = this.databaseServer.getTables().locations!;
|
||||
const maps = this.databaseService.getLocations();
|
||||
for (const gifterMapSettings of gifterSettings)
|
||||
{
|
||||
const mapData: ILocation = maps[gifterMapSettings.map];
|
||||
|
Loading…
x
Reference in New Issue
Block a user