Removed unused endpoint + related service
This commit is contained in:
parent
08c955aa8a
commit
1c601cc33e
@ -82,16 +82,6 @@ export class InraidCallbacks
|
|||||||
return this.httpResponse.noBody(this.inraidController.getBTRConfig());
|
return this.httpResponse.noBody(this.inraidController.getBTRConfig());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Handle singleplayer/traderServices/getTraderServices
|
|
||||||
*/
|
|
||||||
public getTraderServices(url: string, info: IEmptyRequestData, sessionId: string): string
|
|
||||||
{
|
|
||||||
const lastSlashPos = url.lastIndexOf("/");
|
|
||||||
const traderId = url.substring(lastSlashPos + 1);
|
|
||||||
return this.httpResponse.noBody(this.inraidController.getTraderServices(sessionId, traderId));
|
|
||||||
}
|
|
||||||
|
|
||||||
public getTraitorScavHostileChance(url: string, info: IEmptyRequestData, sessionId: string): string
|
public getTraitorScavHostileChance(url: string, info: IEmptyRequestData, sessionId: string): string
|
||||||
{
|
{
|
||||||
return this.httpResponse.noBody(this.inraidController.getTraitorScavHostileChance(url, sessionId));
|
return this.httpResponse.noBody(this.inraidController.getTraitorScavHostileChance(url, sessionId));
|
||||||
|
@ -27,7 +27,6 @@ import { IInRaidConfig } from "@spt/models/spt/config/IInRaidConfig";
|
|||||||
import { ILocationConfig } from "@spt/models/spt/config/ILocationConfig";
|
import { ILocationConfig } from "@spt/models/spt/config/ILocationConfig";
|
||||||
import { IRagfairConfig } from "@spt/models/spt/config/IRagfairConfig";
|
import { IRagfairConfig } from "@spt/models/spt/config/IRagfairConfig";
|
||||||
import { ITraderConfig } from "@spt/models/spt/config/ITraderConfig";
|
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 { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||||
import { ConfigServer } from "@spt/servers/ConfigServer";
|
import { ConfigServer } from "@spt/servers/ConfigServer";
|
||||||
import { SaveServer } from "@spt/servers/SaveServer";
|
import { SaveServer } from "@spt/servers/SaveServer";
|
||||||
@ -37,7 +36,6 @@ import { LocalisationService } from "@spt/services/LocalisationService";
|
|||||||
import { MailSendService } from "@spt/services/MailSendService";
|
import { MailSendService } from "@spt/services/MailSendService";
|
||||||
import { MatchBotDetailsCacheService } from "@spt/services/MatchBotDetailsCacheService";
|
import { MatchBotDetailsCacheService } from "@spt/services/MatchBotDetailsCacheService";
|
||||||
import { PmcChatResponseService } from "@spt/services/PmcChatResponseService";
|
import { PmcChatResponseService } from "@spt/services/PmcChatResponseService";
|
||||||
import { TraderServicesService } from "@spt/services/TraderServicesService";
|
|
||||||
import { RandomUtil } from "@spt/utils/RandomUtil";
|
import { RandomUtil } from "@spt/utils/RandomUtil";
|
||||||
import { TimeUtil } from "@spt/utils/TimeUtil";
|
import { TimeUtil } from "@spt/utils/TimeUtil";
|
||||||
|
|
||||||
@ -69,7 +67,6 @@ export class InraidController
|
|||||||
@inject("PlayerScavGenerator") protected playerScavGenerator: PlayerScavGenerator,
|
@inject("PlayerScavGenerator") protected playerScavGenerator: PlayerScavGenerator,
|
||||||
@inject("HealthHelper") protected healthHelper: HealthHelper,
|
@inject("HealthHelper") protected healthHelper: HealthHelper,
|
||||||
@inject("TraderHelper") protected traderHelper: TraderHelper,
|
@inject("TraderHelper") protected traderHelper: TraderHelper,
|
||||||
@inject("TraderServicesService") protected traderServicesService: TraderServicesService,
|
|
||||||
@inject("LocalisationService") protected localisationService: LocalisationService,
|
@inject("LocalisationService") protected localisationService: LocalisationService,
|
||||||
@inject("InsuranceService") protected insuranceService: InsuranceService,
|
@inject("InsuranceService") protected insuranceService: InsuranceService,
|
||||||
@inject("InRaidHelper") protected inRaidHelper: InRaidHelper,
|
@inject("InRaidHelper") protected inRaidHelper: InRaidHelper,
|
||||||
@ -651,15 +648,6 @@ export class InraidController
|
|||||||
return this.btrConfig;
|
return this.btrConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Handle singleplayer/traderServices/getTraderServices
|
|
||||||
* @returns Trader services data
|
|
||||||
*/
|
|
||||||
public getTraderServices(sessionId: string, traderId: string): ITraderServiceModel[]
|
|
||||||
{
|
|
||||||
return this.traderServicesService.getTraderServices(sessionId, traderId);
|
|
||||||
}
|
|
||||||
|
|
||||||
public getTraitorScavHostileChance(url: string, sessionID: string): number
|
public getTraitorScavHostileChance(url: string, sessionID: string): number
|
||||||
{
|
{
|
||||||
return this.inRaidConfig.playerScavHostileChancePercent;
|
return this.inRaidConfig.playerScavHostileChancePercent;
|
||||||
|
@ -246,7 +246,6 @@ import { RepairService } from "@spt/services/RepairService";
|
|||||||
import { SeasonalEventService } from "@spt/services/SeasonalEventService";
|
import { SeasonalEventService } from "@spt/services/SeasonalEventService";
|
||||||
import { TraderAssortService } from "@spt/services/TraderAssortService";
|
import { TraderAssortService } from "@spt/services/TraderAssortService";
|
||||||
import { TraderPurchasePersisterService } from "@spt/services/TraderPurchasePersisterService";
|
import { TraderPurchasePersisterService } from "@spt/services/TraderPurchasePersisterService";
|
||||||
import { TraderServicesService } from "@spt/services/TraderServicesService";
|
|
||||||
import { App } from "@spt/utils/App";
|
import { App } from "@spt/utils/App";
|
||||||
import { AsyncQueue } from "@spt/utils/AsyncQueue";
|
import { AsyncQueue } from "@spt/utils/AsyncQueue";
|
||||||
import type { ICloner } from "@spt/utils/cloners/ICloner";
|
import type { ICloner } from "@spt/utils/cloners/ICloner";
|
||||||
@ -709,10 +708,6 @@ export class Container
|
|||||||
depContainer.register<TraderAssortService>("TraderAssortService", TraderAssortService, {
|
depContainer.register<TraderAssortService>("TraderAssortService", TraderAssortService, {
|
||||||
lifecycle: Lifecycle.Singleton,
|
lifecycle: Lifecycle.Singleton,
|
||||||
});
|
});
|
||||||
depContainer.register<TraderServicesService>("TraderServicesService", TraderServicesService, {
|
|
||||||
lifecycle: Lifecycle.Singleton,
|
|
||||||
});
|
|
||||||
|
|
||||||
depContainer.register<RagfairPriceService>("RagfairPriceService", RagfairPriceService, {
|
depContainer.register<RagfairPriceService>("RagfairPriceService", RagfairPriceService, {
|
||||||
lifecycle: Lifecycle.Singleton,
|
lifecycle: Lifecycle.Singleton,
|
||||||
});
|
});
|
||||||
|
@ -16,13 +16,6 @@ export class InraidDynamicRouter extends DynamicRouter
|
|||||||
return this.inraidCallbacks.registerPlayer(url, info, sessionID);
|
return this.inraidCallbacks.registerPlayer(url, info, sessionID);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
new RouteAction(
|
|
||||||
"/singleplayer/traderServices/getTraderServices/",
|
|
||||||
async (url: string, info: any, sessionID: string, output: string): Promise<string> =>
|
|
||||||
{
|
|
||||||
return this.inraidCallbacks.getTraderServices(url, info, sessionID);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,65 +0,0 @@
|
|||||||
import { inject, injectable } from "tsyringe";
|
|
||||||
import { ProfileHelper } from "@spt/helpers/ProfileHelper";
|
|
||||||
import { QuestStatus } from "@spt/models/enums/QuestStatus";
|
|
||||||
import { TraderServiceType } from "@spt/models/enums/TraderServiceType";
|
|
||||||
import { ITraderServiceModel } from "@spt/models/spt/services/ITraderServiceModel";
|
|
||||||
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
|
||||||
import { DatabaseService } from "@spt/services/DatabaseService";
|
|
||||||
import { ICloner } from "@spt/utils/cloners/ICloner";
|
|
||||||
|
|
||||||
@injectable()
|
|
||||||
export class TraderServicesService
|
|
||||||
{
|
|
||||||
constructor(
|
|
||||||
@inject("ProfileHelper") protected profileHelper: ProfileHelper,
|
|
||||||
@inject("PrimaryLogger") protected logger: ILogger,
|
|
||||||
@inject("DatabaseService") protected databaseService: DatabaseService,
|
|
||||||
@inject("PrimaryCloner") protected cloner: ICloner,
|
|
||||||
)
|
|
||||||
{}
|
|
||||||
|
|
||||||
public getTraderServices(sessionId: string, traderId: string): ITraderServiceModel[]
|
|
||||||
{
|
|
||||||
const pmcData = this.profileHelper.getPmcProfile(sessionId);
|
|
||||||
let traderServices = this.cloner.clone(this.databaseService.getTrader(traderId).services);
|
|
||||||
if (!traderServices)
|
|
||||||
{
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Filter out any service the user doesn't meet the conditions for
|
|
||||||
const servicesToDelete: TraderServiceType[] = [];
|
|
||||||
for (const service of traderServices)
|
|
||||||
{
|
|
||||||
if (service.requirements?.standings)
|
|
||||||
{
|
|
||||||
for (const [standingTrader, standing] of Object.entries(service.requirements.standings))
|
|
||||||
{
|
|
||||||
if (pmcData.TradersInfo[standingTrader].standing < standing)
|
|
||||||
{
|
|
||||||
servicesToDelete.push(service.serviceType);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (service.requirements?.completedQuests)
|
|
||||||
{
|
|
||||||
for (const questId of service.requirements.completedQuests)
|
|
||||||
{
|
|
||||||
const quest = pmcData.Quests.find((questStatus) => questStatus.qid === questId);
|
|
||||||
if (!quest || quest.status !== QuestStatus.Success)
|
|
||||||
{
|
|
||||||
servicesToDelete.push(service.serviceType);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Clear any unavailable services from the list
|
|
||||||
traderServices = traderServices.filter((service) => !servicesToDelete.includes(service.serviceType));
|
|
||||||
|
|
||||||
return traderServices;
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user