2022-08-17 02:18:04 -04:00
|
|
|
import { PrewipeConfig } from "../config/prewipe";
|
2022-08-03 21:57:37 -04:00
|
|
|
import { Money } from "@spt-aki/models/enums/Money"
|
2022-08-17 02:18:04 -04:00
|
|
|
import type { BossLocationSpawn } from "@spt-aki/models/eft/common/ILocationBase";
|
|
|
|
import { Logger } from "./logger";
|
|
|
|
import { DatabaseServer } from "@spt-aki/servers/DatabaseServer";
|
2022-08-04 18:05:23 -04:00
|
|
|
import { ITrader } from "@spt-aki/models/eft/common/tables/ITrader";
|
2022-07-30 23:04:18 -04:00
|
|
|
|
2022-08-17 02:18:04 -04:00
|
|
|
export class Prewipe
|
2022-07-30 23:04:18 -04:00
|
|
|
{
|
2022-08-17 02:18:04 -04:00
|
|
|
private modConfig: PrewipeConfig = require("../config/prewipe.json");
|
2022-08-03 21:57:37 -04:00
|
|
|
private logger: Logger;
|
2022-08-08 20:03:48 -04:00
|
|
|
private tables: DatabaseServer;
|
2022-08-04 18:05:23 -04:00
|
|
|
private traders: Record<string, ITrader>;
|
2022-07-30 23:04:18 -04:00
|
|
|
|
2022-08-17 02:18:04 -04:00
|
|
|
constructor(logger: Logger, databaseServer: DatabaseServer)
|
2022-07-30 23:04:18 -04:00
|
|
|
{
|
|
|
|
this.logger = logger;
|
2022-08-17 02:18:04 -04:00
|
|
|
this.tables = databaseServer;
|
|
|
|
this.traders = this.tables.getTables().traders;
|
2022-07-30 23:04:18 -04:00
|
|
|
}
|
|
|
|
|
2022-08-17 02:18:04 -04:00
|
|
|
public updatePrewipe(): void
|
2022-07-30 23:04:18 -04:00
|
|
|
{
|
2022-08-08 20:03:48 -04:00
|
|
|
// modConfig variables
|
2022-08-17 02:18:04 -04:00
|
|
|
const preWipe = this.modConfig;
|
2022-08-08 20:03:48 -04:00
|
|
|
|
|
|
|
// Start modifications
|
2022-08-03 21:57:37 -04:00
|
|
|
// Prewipe Events
|
2022-08-08 20:03:48 -04:00
|
|
|
|
|
|
|
// Spawn Killa On Factory
|
|
|
|
if (preWipe.killaOnFactory)
|
2022-08-03 21:57:37 -04:00
|
|
|
{
|
2022-08-08 20:03:48 -04:00
|
|
|
this.spawnKillaOnFactory();
|
|
|
|
this.logger.info("Killa On Factry Enabled");
|
2022-08-03 21:57:37 -04:00
|
|
|
}
|
2022-07-30 23:04:18 -04:00
|
|
|
|
2022-08-08 20:03:48 -04:00
|
|
|
|
|
|
|
// Spawns All Bosses On Reserve
|
|
|
|
if (preWipe.allBossesOnReserve)
|
2022-08-03 21:57:37 -04:00
|
|
|
{
|
2022-08-08 20:03:48 -04:00
|
|
|
this.spawnAllBossesOnReserve();
|
2022-08-03 21:57:37 -04:00
|
|
|
this.logger.info("Bosses On Reserve Prewipe Event Enabled");
|
|
|
|
}
|
2022-08-08 20:03:48 -04:00
|
|
|
|
2022-08-03 21:57:37 -04:00
|
|
|
|
2022-08-08 20:03:48 -04:00
|
|
|
// Spawns Gluhar On Labs
|
|
|
|
if (preWipe.gluharOnLabs)
|
2022-08-03 21:57:37 -04:00
|
|
|
{
|
2022-08-08 20:03:48 -04:00
|
|
|
this.spawnGluharOnLabs();
|
|
|
|
this.logger.info("Gluhar On Labs Prewipe Event Enabled");
|
2022-08-03 21:57:37 -04:00
|
|
|
}
|
2022-07-30 23:04:18 -04:00
|
|
|
|
2022-08-08 20:03:48 -04:00
|
|
|
|
2022-08-03 21:57:37 -04:00
|
|
|
// All cheap items on traders
|
2022-08-08 20:03:48 -04:00
|
|
|
if (preWipe.allTradersSellCheapItems)
|
2022-08-03 21:57:37 -04:00
|
|
|
{
|
2022-08-08 20:03:48 -04:00
|
|
|
this.allTradersSellCheapItems();
|
2022-08-03 21:57:37 -04:00
|
|
|
this.logger.info("Cheap Items On Traders Prewipe Event Enabled");
|
|
|
|
}
|
2022-07-30 23:04:18 -04:00
|
|
|
|
2022-08-08 20:03:48 -04:00
|
|
|
// Makes Obdolbos Super Powered
|
|
|
|
if (preWipe.makeObdolbosPowerful)
|
2022-08-03 21:57:37 -04:00
|
|
|
{
|
2022-08-08 20:03:48 -04:00
|
|
|
this.makeObdolbosPowerful();
|
2022-08-03 21:57:37 -04:00
|
|
|
this.logger.info("Make Obdolbos Powerful Prewipe Event Enabled");
|
|
|
|
}
|
2022-08-04 18:05:23 -04:00
|
|
|
}
|
|
|
|
|
2022-08-04 14:43:56 -04:00
|
|
|
|
2022-08-17 02:18:04 -04:00
|
|
|
// Functions start here.
|
2022-08-08 20:03:48 -04:00
|
|
|
public createBossWave(role: string, chance: number, followers: string, escortAmount: number, zones: string): any
|
2022-08-04 14:43:56 -04:00
|
|
|
{
|
|
|
|
return {
|
|
|
|
"BossName": role,
|
|
|
|
"BossChance": chance,
|
|
|
|
"BossZone": zones,
|
|
|
|
"BossPlayer": false,
|
|
|
|
"BossDifficult": "normal",
|
|
|
|
"BossEscortType": followers,
|
|
|
|
"BossEscortDifficult": "normal",
|
|
|
|
"BossEscortAmount": escortAmount,
|
|
|
|
"Time": -1
|
|
|
|
}
|
|
|
|
}
|
2022-08-08 20:03:48 -04:00
|
|
|
|
|
|
|
private spawnKillaOnFactory(): void
|
|
|
|
{
|
2022-08-17 02:18:04 -04:00
|
|
|
const locations = this.tables.getTables().locations;
|
2022-08-08 20:03:48 -04:00
|
|
|
const killaWave = this.createBossWave("bossKilla", 100, "followerBully", 0, locations.factory4_day.base.OpenZones);
|
2022-08-17 02:18:04 -04:00
|
|
|
locations.factory4_day.base.BossLocationSpawn.push(killaWave);
|
2022-08-08 20:03:48 -04:00
|
|
|
locations.factory4_night.base.BossLocationSpawn.push(killaWave);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private spawnAllBossesOnReserve(): void
|
|
|
|
{
|
2022-08-17 02:18:04 -04:00
|
|
|
const locations = this.tables.getTables().locations;
|
2022-08-08 20:03:48 -04:00
|
|
|
let bossWave = this.createBossWave("bossKilla", 100, "followerBully", 0, locations.rezervbase.base.OpenZones);
|
|
|
|
locations.rezervbase.base.BossLocationSpawn.push(bossWave);
|
|
|
|
bossWave = this.createBossWave("bossBully", 100, "followerBully", 4, locations.rezervbase.base.OpenZones);
|
|
|
|
locations.rezervbase.base.BossLocationSpawn.push(bossWave);
|
|
|
|
bossWave = this.createBossWave("bossKojaniy", 100, "followerKojaniy", 2, locations.rezervbase.base.OpenZones);
|
|
|
|
locations.rezervbase.base.BossLocationSpawn.push(bossWave);
|
|
|
|
bossWave = this.createBossWave("bossSanitar", 100, "followerSanitar", 2, locations.rezervbase.base.OpenZones);
|
|
|
|
locations.rezervbase.base.BossLocationSpawn.push(bossWave);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private spawnGluharOnLabs(): void
|
|
|
|
{
|
2022-08-17 02:18:04 -04:00
|
|
|
const locations = this.tables.getTables().locations;
|
2022-08-08 20:03:48 -04: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"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
RandomTimeSpawn: false
|
|
|
|
}
|
|
|
|
|
|
|
|
glugluWave.BossZone = locations.laboratory.base.OpenZones;
|
|
|
|
locations.laboratory.base.BossLocationSpawn.push(glugluWave);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private allTradersSellCheapItems(): void
|
|
|
|
{
|
|
|
|
|
|
|
|
for (const trader in this.traders)
|
|
|
|
{
|
|
|
|
for (const assort in this.traders[trader].assort.barter_scheme)
|
|
|
|
{
|
|
|
|
const itemScheme = this.traders[trader].assort.barter_scheme[assort];
|
|
|
|
switch (itemScheme[0][0]._tpl)
|
|
|
|
{
|
|
|
|
case Money.ROUBLES:
|
|
|
|
itemScheme[0][0].count = itemScheme[0][0].count * 0.01;
|
|
|
|
break;
|
|
|
|
case Money.DOLLARS:
|
|
|
|
itemScheme[0][0].count = itemScheme[0][0].count * 0.1;
|
|
|
|
break;
|
|
|
|
case Money.EUROS:
|
|
|
|
itemScheme[0][0].count = itemScheme[0][0].count * 0.05;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private makeObdolbosPowerful(): void
|
|
|
|
{
|
|
|
|
|
|
|
|
const obdolbosBuff = [
|
|
|
|
{
|
|
|
|
"BuffType": "StaminaRate",
|
|
|
|
"Chance": 1,
|
|
|
|
"Delay": 1,
|
|
|
|
"Duration": 1800,
|
|
|
|
"Value": 0.5,
|
|
|
|
"AbsoluteValue": true,
|
|
|
|
"SkillName": ""
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"BuffType": "SkillRate",
|
|
|
|
"Chance": 1,
|
|
|
|
"Delay": 1,
|
|
|
|
"Duration": 1800,
|
|
|
|
"Value": 10,
|
|
|
|
"AbsoluteValue": true,
|
|
|
|
"SkillName": "Endurance"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"BuffType": "SkillRate",
|
|
|
|
"Chance": 1,
|
|
|
|
"Delay": 1,
|
|
|
|
"Duration": 1800,
|
|
|
|
"Value": 10,
|
|
|
|
"AbsoluteValue": true,
|
|
|
|
"SkillName": "Strength"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"BuffType": "SkillRate",
|
|
|
|
"Chance": 1,
|
|
|
|
"Delay": 1,
|
|
|
|
"Duration": 1800,
|
|
|
|
"Value": 20,
|
|
|
|
"AbsoluteValue": true,
|
|
|
|
"SkillName": "StressResistance"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"BuffType": "SkillRate",
|
|
|
|
"Chance": 1,
|
|
|
|
"Delay": 1,
|
|
|
|
"Duration": 1800,
|
|
|
|
"Value": 20,
|
|
|
|
"AbsoluteValue": true,
|
|
|
|
"SkillName": "Charisma"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"BuffType": "SkillRate",
|
|
|
|
"Chance": 1,
|
|
|
|
"Delay": 1,
|
|
|
|
"Duration": 1800,
|
|
|
|
"Value": -20,
|
|
|
|
"AbsoluteValue": true,
|
|
|
|
"SkillName": "Memory"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"BuffType": "SkillRate",
|
|
|
|
"Chance": 1,
|
|
|
|
"Delay": 1,
|
|
|
|
"Duration": 1800,
|
|
|
|
"Value": -20,
|
|
|
|
"AbsoluteValue": true,
|
|
|
|
"SkillName": "Intellect"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"BuffType": "SkillRate",
|
|
|
|
"Chance": 1,
|
|
|
|
"Delay": 1,
|
|
|
|
"Duration": 1800,
|
|
|
|
"Value": -20,
|
|
|
|
"AbsoluteValue": true,
|
|
|
|
"SkillName": "Attention"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"BuffType": "Pain",
|
|
|
|
"Chance": 0.25,
|
|
|
|
"Delay": 1,
|
|
|
|
"Duration": 1800,
|
|
|
|
"Value": 0,
|
|
|
|
"AbsoluteValue": false,
|
|
|
|
"SkillName": ""
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"BuffType": "StomachBloodloss",
|
|
|
|
"Chance": 0.25,
|
|
|
|
"Delay": 1,
|
|
|
|
"Duration": 1800,
|
|
|
|
"Value": 0,
|
|
|
|
"AbsoluteValue": false,
|
|
|
|
"SkillName": ""
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"BuffType": "HydrationRate",
|
|
|
|
"Chance": 0.25,
|
|
|
|
"Delay": 1,
|
|
|
|
"Duration": 1800,
|
|
|
|
"Value": -0.05,
|
|
|
|
"AbsoluteValue": true,
|
|
|
|
"SkillName": ""
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"BuffType": "EnergyRate",
|
|
|
|
"Chance": 0.25,
|
|
|
|
"Delay": 1,
|
|
|
|
"Duration": 1800,
|
|
|
|
"Value": -0.05,
|
|
|
|
"AbsoluteValue": true,
|
|
|
|
"SkillName": ""
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"BuffType": "DamageModifier",
|
|
|
|
"Chance": 0.25,
|
|
|
|
"Delay": 1,
|
|
|
|
"Duration": 1800,
|
|
|
|
"Value": 0.2,
|
|
|
|
"AbsoluteValue": false,
|
|
|
|
"SkillName": ""
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"BuffType": "QuantumTunnelling",
|
|
|
|
"Chance": 0.25,
|
|
|
|
"Delay": 1,
|
|
|
|
"Duration": 1800,
|
|
|
|
"Value": 0,
|
|
|
|
"AbsoluteValue": false,
|
|
|
|
"SkillName": ""
|
|
|
|
}]
|
2022-08-17 02:18:04 -04:00
|
|
|
this.tables.getTables().globals.config.Health.Effects.Stimulator.Buffs.Buffs_Obdolbos = obdolbosBuff;
|
2022-08-08 20:03:48 -04:00
|
|
|
}
|
2022-08-03 21:57:37 -04:00
|
|
|
}
|