Regenerated pscav data on raid end

Moved pmc code into own function
This commit is contained in:
Dev 2024-07-06 09:41:40 +01:00
parent 61da90f33d
commit 0ac8fbfe8e

View File

@ -4,6 +4,7 @@ import { ContextVariableType } from "@spt/context/ContextVariableType";
import { InraidController } from "@spt/controllers/InraidController"; import { InraidController } from "@spt/controllers/InraidController";
import { LocationController } from "@spt/controllers/LocationController"; import { LocationController } from "@spt/controllers/LocationController";
import { LootGenerator } from "@spt/generators/LootGenerator"; import { LootGenerator } from "@spt/generators/LootGenerator";
import { PlayerScavGenerator } from "@spt/generators/PlayerScavGenerator";
import { HealthHelper } from "@spt/helpers/HealthHelper"; import { HealthHelper } from "@spt/helpers/HealthHelper";
import { InRaidHelper } from "@spt/helpers/InRaidHelper"; import { InRaidHelper } from "@spt/helpers/InRaidHelper";
import { ProfileHelper } from "@spt/helpers/ProfileHelper"; import { ProfileHelper } from "@spt/helpers/ProfileHelper";
@ -71,6 +72,7 @@ export class MatchController
@inject("MatchLocationService") protected matchLocationService: MatchLocationService, @inject("MatchLocationService") protected matchLocationService: MatchLocationService,
@inject("MatchBotDetailsCacheService") protected matchBotDetailsCacheService: MatchBotDetailsCacheService, @inject("MatchBotDetailsCacheService") protected matchBotDetailsCacheService: MatchBotDetailsCacheService,
@inject("PmcChatResponseService") protected pmcChatResponseService: PmcChatResponseService, @inject("PmcChatResponseService") protected pmcChatResponseService: PmcChatResponseService,
@inject("PlayerScavGenerator") protected playerScavGenerator: PlayerScavGenerator,
@inject("TraderHelper") protected traderHelper: TraderHelper, @inject("TraderHelper") protected traderHelper: TraderHelper,
@inject("BotLootCacheService") protected botLootCacheService: BotLootCacheService, @inject("BotLootCacheService") protected botLootCacheService: BotLootCacheService,
@inject("LocalisationService") protected localisationService: LocalisationService, @inject("LocalisationService") protected localisationService: LocalisationService,
@ -419,16 +421,48 @@ export class MatchController
const locationName = serverDetails[0].toLowerCase(); const locationName = serverDetails[0].toLowerCase();
const isPmc = serverDetails[1].toLowerCase() === "pmc"; const isPmc = serverDetails[1].toLowerCase() === "pmc";
const map = this.databaseService.getLocation(locationName).base; const mapBase = this.databaseService.getLocation(locationName).base;
const isDead = this.isPlayerDead(request.results); const isDead = this.isPlayerDead(request.results);
if (!isPmc) if (!isPmc)
{ {
this.handlePostRaidPlayerScav(); this.handlePostRaidPlayerScav(sessionId, pmcProfile, scavProfile, isDead);
return; return;
} }
this.handlePostRaidPmc(sessionId, pmcProfile, scavProfile, postRaidProfile, isDead, request);
}
protected handlePostRaidPlayerScav(
sessionId: string,
pmcProfile: IPmcData,
scavProfile: IPmcData,
isDead: boolean,
): void
{
// Scav died, regen scav loadout and set timer
if (isDead)
{
this.playerScavGenerator.generate(sessionId);
}
// Update last played property
pmcProfile.Info.LastTimePlayedAsSavage = this.timeUtil.getTimestamp();
// Force a profile save
this.saveServer.saveProfile(sessionId);
}
protected handlePostRaidPmc(
sessionId: string,
pmcProfile: IPmcData,
scavProfile: IPmcData,
postRaidProfile: IPmcData,
isDead: boolean,
request: IEndLocalRaidRequestData,
): void
{
// Update inventory // Update inventory
this.inRaidHelper.setInventory(sessionId, pmcProfile, postRaidProfile); this.inRaidHelper.setInventory(sessionId, pmcProfile, postRaidProfile);
@ -511,11 +545,6 @@ export class MatchController
} }
} }
protected handlePostRaidPlayerScav(): void
{
// TODO
}
/** /**
* Handle singleplayer/traderServices/itemDelivery * Handle singleplayer/traderServices/itemDelivery
*/ */