Further refinement of loot generation code switch

This commit is contained in:
Dev 2024-10-03 15:17:00 +01:00
parent 7b1a37e71e
commit 5a7f03a2d4

View File

@ -96,7 +96,7 @@ export class LocationLifecycleService {
serverId: `${request.location}.${request.playerSide}.${this.timeUtil.getTimestamp()}`, // TODO - does this need to be more verbose - investigate client? serverId: `${request.location}.${request.playerSide}.${this.timeUtil.getTimestamp()}`, // TODO - does this need to be more verbose - investigate client?
serverSettings: this.databaseService.getLocationServices(), // TODO - is this per map or global? serverSettings: this.databaseService.getLocationServices(), // TODO - is this per map or global?
profile: { insuredItems: playerProfile.InsuredItems }, profile: { insuredItems: playerProfile.InsuredItems },
locationLoot: request.sptSkipLootGeneration ? null : this.generateLocationAndLoot(request.location), locationLoot: this.generateLocationAndLoot(request.location, !request.sptSkipLootGeneration),
transition: { transition: {
isLocationTransition: false, isLocationTransition: false,
transitionRaidId: "66f5750951530ca5ae09876d", transitionRaidId: "66f5750951530ca5ae09876d",
@ -227,9 +227,10 @@ export class LocationLifecycleService {
/** /**
* Generate a maps base location (cloned) and loot * Generate a maps base location (cloned) and loot
* @param name Map name * @param name Map name
* @param generateLoot OPTIONAL - Should loot be generated for the map before being returned
* @returns ILocationBase * @returns ILocationBase
*/ */
protected generateLocationAndLoot(name: string): ILocationBase { protected generateLocationAndLoot(name: string, generateLoot = true): ILocationBase {
const location = this.databaseService.getLocation(name); const location = this.databaseService.getLocation(name);
const locationBaseClone = this.cloner.clone(location.base); const locationBaseClone = this.cloner.clone(location.base);
@ -241,6 +242,11 @@ export class LocationLifecycleService {
return locationBaseClone; return locationBaseClone;
} }
// We only need the base data
if (!generateLoot) {
return locationBaseClone;
}
// Check for a loot multipler adjustment in app context and apply if one is found // Check for a loot multipler adjustment in app context and apply if one is found
let locationConfigClone: ILocationConfig; let locationConfigClone: ILocationConfig;
const raidAdjustments = this.applicationContext const raidAdjustments = this.applicationContext