335 lines
13 KiB
TypeScript
Raw Normal View History

2022-05-27 23:13:35 +01:00
import { inject, injectable } from "tsyringe";
2022-06-02 00:58:26 +01:00
import type { BossLocationSpawn } from "@spt-aki/models/eft/common/ILocationBase";
import type { DatabaseServer } from "@spt-aki/servers/DatabaseServer";
2022-05-27 23:13:35 +01:00
import { AIOConfigHandler } from "./AIOConfigHandler";
import { Other } from "./other";
2022-05-27 23:13:35 +01:00
@injectable()
export class Raids
{
2022-05-27 23:13:35 +01:00
constructor(
2022-05-27 23:13:35 +01:00
@inject("AIOConfigHandler") private configHandler: AIOConfigHandler,
@inject("DatabaseServer") private database: DatabaseServer,
@inject("AIOOther") private other: Other
)
{}
2022-05-27 23:13:35 +01:00
public applyChanges(): void
{
2022-05-27 23:13:35 +01:00
const hideout = this.database.getTables().hideout;
const locations = this.database.getTables().locations;
//Change hideout fuel consumption
2022-05-27 23:13:35 +01:00
if (this.configHandler.getConfig().hideout.changeFuelConsumptionRate !== false && typeof this.configHandler.getConfig().hideout.changeFuelConsumptionRate === "number")
{
2022-05-27 23:13:35 +01:00
hideout.settings.generatorFuelFlowRate = <number> this.configHandler.getConfig().hideout.changeFuelConsumptionRate;
}
//Enable hideout fast constructions
2022-05-27 23:13:35 +01:00
if (this.configHandler.getConfig().hideout.fastHideoutConstruction)
{
for (const data in hideout.areas)
{
2022-05-27 23:13:35 +01:00
const areaData = hideout.areas[data];
2022-05-27 23:13:35 +01:00
if (this.other.isThisIDaMod([areaData._id]) === false)
{
for (const i in areaData.stages)
{
if (areaData.stages[i].constructionTime > 0)
{
areaData.stages[i].constructionTime = 1;
}
}
}
}
}
//Enable fast hideout production
2022-05-27 23:13:35 +01:00
if (this.configHandler.getConfig().hideout.fastHideoutProduction === true)
{
for (const data in hideout.production)
{
2022-05-27 23:13:35 +01:00
const productionData = hideout.production[data];
2022-05-27 23:13:35 +01:00
if (this.other.isThisIDaMod([productionData._id]) === false)
{
if (!productionData.continuous && productionData.productionTime > 10)
{
productionData.productionTime = 10;
}
}
}
}
//Scav cases modifications
2022-05-27 23:13:35 +01:00
if (this.configHandler.getConfig().hideout.fastScavCase === true)
{
for (const scav in hideout.scavcase)
{
2022-05-27 23:13:35 +01:00
const caseData = hideout.scavcase[scav];
2022-05-27 23:13:35 +01:00
if (this.other.isThisIDaMod([caseData._id]) === false)
{
if (caseData.ProductionTime > 10)
{
caseData.ProductionTime = 10;
}
}
}
}
2022-05-27 23:13:35 +01:00
if (this.configHandler.getConfig().hideout.scavCasePriceReducer === true)
{
for (const scase in hideout.scavcase)
{
2022-05-27 23:13:35 +01:00
const caseData = hideout.scavcase[scase];
2022-05-27 23:13:35 +01:00
if (this.other.isThisIDaMod([caseData._id]) === false)
{
2022-05-27 23:13:35 +01:00
if (caseData.Requirements[0].count > 10 && (caseData.Requirements[0].templateId === "5449016a4bdc2d6f028b456f" ||
caseData.Requirements[0].templateId === "5696686a4bdc2da3298b456a" ||
caseData.Requirements[0].templateId === "569668774bdc2da2298b4568"))
{
caseData.Requirements[0].count = 10;
}
}
}
}
//Remove construction requirements
2022-05-27 23:13:35 +01:00
if (this.configHandler.getConfig().hideout.removeConstructionRequirements)
{
for (const data in hideout.areas)
{
2022-05-27 23:13:35 +01:00
const areaData = hideout.areas[data];
2022-05-27 23:13:35 +01:00
if (this.other.isThisIDaMod([areaData._id]) === false)
{
for (const i in areaData.stages)
{
if (areaData.stages[i].requirements !== undefined)
{
areaData.stages[i].requirements = [];
}
}
}
}
}
//Remove labs entry keycard
2022-05-27 23:13:35 +01:00
if (this.configHandler.getConfig().raids.removeLabsKeycard)
{
locations.laboratory.base.AccessKeys = []
}
//Remove extracts restrictions
2022-05-27 23:13:35 +01:00
if (this.configHandler.getConfig().raids.noExtractRestrictions)
{
2022-05-27 23:13:35 +01:00
for (const i in locations)
{
if (i !== "base")
{
2022-05-27 23:13:35 +01:00
for (const x in locations[i].base.exits)
{
if (locations[i].base.exits[x].Name !== "EXFIL_Train" &&
!locations[i].base.exits[x].Name.includes("lab") ||
locations[i].base.exits[x].Name === "lab_Vent")
2022-05-27 23:13:35 +01:00
{
if (locations[i].base.exits[x].PassageRequirement !== "None")
{
locations[i].base.exits[x].PassageRequirement = "None";
}
if (locations[i].base.exits[x].ExfiltrationType !== "Individual")
{
locations[i].base.exits[x].ExfiltrationType = "Individual";
}
2022-05-27 23:13:35 +01:00
if (locations[i].base.exits[x].Id !== "")
{
2022-05-27 23:13:35 +01:00
locations[i].base.exits[x].Id = "";
}
if (locations[i].base.exits[x].Count !== 0)
{
locations[i].base.exits[x].Count = 0;
}
2022-05-27 23:13:35 +01:00
if (locations[i].base.exits[x].RequirementTip !== "")
{
2022-05-27 23:13:35 +01:00
locations[i].base.exits[x].RequirementTip = "";
}
if (locations[i].base.exits[x].RequiredSlot)
{
delete locations[i].base.exits[x].RequiredSlot;
}
}
}
}
}
}
//Make all extractions available to extract
2022-05-27 23:13:35 +01:00
if (this.configHandler.getConfig().raids.allExtractionsAvailable)
{
2022-05-27 23:13:35 +01:00
for (const i in locations)
{
if (i !== "base")
{
2022-05-27 23:13:35 +01:00
for (const x in locations[i].base.exits)
{
if (locations[i].base.exits[x].Name !== "EXFIL_Train")
{
if (locations[i].base.exits[x].Chance !== 100)
{
locations[i].base.exits[x].Chance = 100;
}
}
}
}
}
}
//Make all maps have functional insurance
2022-05-27 23:13:35 +01:00
if (this.configHandler.getConfig().raids.insuranceOnAllMaps)
{
2022-05-27 23:13:35 +01:00
for (const i in locations)
{
if (i !== "base")
{
locations[i].base.Insurance = true;
}
}
}
//Make all bosses to 100% spawn
2022-05-27 23:13:35 +01:00
if (this.configHandler.getConfig().raids.increasedBossChance)
{
2022-05-27 23:13:35 +01:00
for (const i in locations)
{
if (i !== "base")
{
if (locations[i].base.BossLocationSpawn !== [])
{
2022-05-27 23:13:35 +01:00
for (const x in locations[i].base.BossLocationSpawn)
{
locations[i].base.BossLocationSpawn[x].BossChance = 100;
}
}
}
}
}
2022-05-27 23:13:35 +01:00
if (this.configHandler.getConfig().other.preWipeEvents.killaOnFactory)
{
2022-05-27 23:13:35 +01:00
const killaWave = this.other.createBossWave("bossKilla", 100, "followerBully", 0, locations.factory4_day.base.OpenZones);
locations.factory4_day.base.BossLocationSpawn.push(killaWave);
locations.factory4_night.base.BossLocationSpawn.push(killaWave);
}
2022-05-27 23:13:35 +01:00
if (this.configHandler.getConfig().other.preWipeEvents.allBossesOnReserve)
{
2022-05-27 23:13:35 +01:00
let bossWave = this.other.createBossWave("bossKilla", 100, "followerBully", 0, locations.rezervbase.base.OpenZones);
locations.rezervbase.base.BossLocationSpawn.push(bossWave);
bossWave = this.other.createBossWave("bossBully", 100, "followerBully", 4, locations.rezervbase.base.OpenZones);
locations.rezervbase.base.BossLocationSpawn.push(bossWave);
bossWave = this.other.createBossWave("bossKojaniy", 100, "followerKojaniy", 2, locations.rezervbase.base.OpenZones);
locations.rezervbase.base.BossLocationSpawn.push(bossWave);
bossWave = this.other.createBossWave("bossSanitar", 100, "followerSanitar", 2, locations.rezervbase.base.OpenZones);
locations.rezervbase.base.BossLocationSpawn.push(bossWave);
}
2022-05-27 23:13:35 +01:00
if (this.configHandler.getConfig().other.preWipeEvents.gluhkarOnLabs)
{
2022-05-27 23:13:35 +01:00
const glugluWave: BossLocationSpawn = {
"BossName": "bossGluhar",
"BossChance": 43,
"BossZone": "ZoneRailStrorage,ZoneRailStrorage,ZoneRailStrorage,ZonePTOR1,ZonePTOR2,ZoneBarrack,ZoneBarrack,ZoneBarrack,ZoneSubStorage",
"BossPlayer": false,
"BossDifficult": "normal",
"BossEscortType": "followerGluharAssault",
"BossEscortDifficult": "normal",
"BossEscortAmount": "0",
"Time": -1,
"TriggerId": "",
"TriggerName": "",
"Supports": [
{
"BossEscortType": "followerGluharAssault",
"BossEscortDifficult": [
"normal"
],
"BossEscortAmount": "2"
},
{
"BossEscortType": "followerGluharSecurity",
"BossEscortDifficult": [
"normal"
],
"BossEscortAmount": "2"
},
{
"BossEscortType": "followerGluharScout",
"BossEscortDifficult": [
"normal"
],
"BossEscortAmount": "2"
}
]
}
2022-05-27 23:13:35 +01:00
glugluWave.BossZone = locations.laboratory.base.OpenZones;
locations.laboratory.base.BossLocationSpawn.push(glugluWave);
}
//Extend raids to defined number
2022-05-27 23:13:35 +01:00
if (this.configHandler.getConfig().raids.extendedRaid != false && typeof this.configHandler.getConfig().raids.extendedRaid === "number")
{
2022-05-27 23:13:35 +01:00
for (const map in locations)
{
if (map !== "base")
{
2022-05-27 23:13:35 +01:00
locations[map].base.exit_access_time = this.configHandler.getConfig().raids.extendedRaid;
locations[map].base.escape_time_limit = this.configHandler.getConfig().raids.extendedRaid;
}
}
}
//Make all extractions of the map available regardless of the infill
2022-05-27 23:13:35 +01:00
if (this.configHandler.getConfig().raids.extractionsExtended)
{
2022-05-27 23:13:35 +01:00
for (const map in locations)
{
2022-05-27 23:13:35 +01:00
switch (map)
{
case "base":
break;
case "bigmap":
for (const extract in locations[map].base.exits)
{
locations[map].base.exits[extract].EntryPoints = "Customs,Boiler Tanks";
}
break;
case "interchange":
for (const extract in locations[map].base.exits)
{
locations[map].base.exits[extract].EntryPoints = "MallSE,MallNW";
}
break;
case "shoreline":
for (const extract in locations[map].base.exits)
{
locations[map].base.exits[extract].EntryPoints = "Village,Riverside";
}
break;
case "woods":
for (const extract in locations[map].base.exits)
{
locations[map].base.exits[extract].EntryPoints = "House,Old Station";
}
break;
default:
break;
}
}
}
}
}