Fix WeightChanges option
This commit is contained in:
parent
48d66c0c22
commit
d4bf80cbc6
@ -42,8 +42,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
"enableChristmasGifts": false
|
|
||||||
},
|
},
|
||||||
"Raids values": {
|
"Raids values": {
|
||||||
"Loot values": {
|
"Loot values": {
|
||||||
|
@ -215,7 +215,6 @@ export interface ServerValues
|
|||||||
http: HTTP;
|
http: HTTP;
|
||||||
health: Health;
|
health: Health;
|
||||||
hideout: Hideout;
|
hideout: Hideout;
|
||||||
enableChristmasGifts: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface RaidsValues
|
export interface RaidsValues
|
||||||
|
@ -215,7 +215,6 @@ export interface ServerValues
|
|||||||
http: HTTP;
|
http: HTTP;
|
||||||
health: Health;
|
health: Health;
|
||||||
hideout: Hideout;
|
hideout: Hideout;
|
||||||
enableChristmasGifts: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface RaidsValues
|
export interface RaidsValues
|
||||||
|
@ -1,18 +1,25 @@
|
|||||||
/*
|
import { inject, injectable } from "tsyringe";
|
||||||
エレシュキガル
|
import type { DatabaseServer } from "@spt-aki/servers/DatabaseServer";
|
||||||
*/
|
import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig";
|
||||||
|
import { AkiConfigHandler } from "./AkiConfigHandler";
|
||||||
|
|
||||||
"use strict";
|
@injectable()
|
||||||
|
export class bots
|
||||||
class bots
|
|
||||||
{
|
{
|
||||||
static applyValues()
|
constructor(
|
||||||
{
|
@inject("AkiConfigHandler") private configHandler: AkiConfigHandler,
|
||||||
const bots = BotConfig;
|
@inject("DatabaseServer") private database: DatabaseServer
|
||||||
const config = require('../../config/pmcConfig.json');
|
)
|
||||||
|
{}
|
||||||
|
|
||||||
const pmcsConfig = config.pmc.types
|
public applyChanges(): void
|
||||||
for (const bot in pmcsConfig) {
|
{
|
||||||
|
const configServer = container.resolve<ConfigServer>("ConfigServer");
|
||||||
|
const BotConfig = configServer.getConfig<IBotConfig>(ConfigTypes.BOT);
|
||||||
|
|
||||||
|
const pmcsConfig = this.configHandler.getPmcConfig().pmc.types
|
||||||
|
for (const bot in pmcsConfig)
|
||||||
|
{
|
||||||
switch (bot) {
|
switch (bot) {
|
||||||
default:
|
default:
|
||||||
bots.pmc.types[bot] = pmcsConfig[bot]
|
bots.pmc.types[bot] = pmcsConfig[bot]
|
||||||
|
@ -1,12 +1,29 @@
|
|||||||
/*
|
import type { ILogger } from "@spt-aki/models/spt/utils/ILogger";
|
||||||
エレシュキガル
|
import { inject, injectable } from "tsyringe";
|
||||||
*/
|
import { VFS } from "@spt-aki/utils/VFS";
|
||||||
|
import { ConfigServer } from "@spt-aki/servers/ConfigServer";
|
||||||
|
import { ConfigTypes } from "@spt-aki/models/enums/ConfigTypes";
|
||||||
|
import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig";
|
||||||
|
import { IAirdropConfig } from "@spt-aki/models/spt/config/IAirdropConfig";
|
||||||
|
import { IInRaidConfig } from "@spt-aki/models/spt/config/IInRaidConfig";
|
||||||
|
import { IInventoryConfig } from "@spt-aki/models/spt/config/IInventoryConfig";
|
||||||
|
import { ILocationConfig } from "@spt-aki/models/spt/config/ILocationConfig";
|
||||||
|
import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig";
|
||||||
|
|
||||||
"use strict";
|
@injectable()
|
||||||
|
export class AkiGenerator
|
||||||
|
{
|
||||||
|
private mod;
|
||||||
|
private firstRun;
|
||||||
|
|
||||||
class generator {
|
constructor(
|
||||||
static createConfig(file) {
|
@inject("WinstonLogger") private logger: ILogger
|
||||||
const mod = require("../../package.json");
|
)
|
||||||
|
{}
|
||||||
|
|
||||||
|
private createConfig(file: string): void
|
||||||
|
{
|
||||||
|
this.mod = require("../package.json");
|
||||||
this.firstRun = true;
|
this.firstRun = true;
|
||||||
let config = null;
|
let config = null;
|
||||||
let dailyConfig = null;
|
let dailyConfig = null;
|
||||||
@ -41,7 +58,7 @@ class generator {
|
|||||||
pmcConfig = {};
|
pmcConfig = {};
|
||||||
|
|
||||||
//We will have to gather every config that exists atm and throw them together into the object
|
//We will have to gather every config that exists atm and throw them together into the object
|
||||||
const bots = BotConfig;
|
const bots = ConfigServer.getConfig<IBotConfig>(ConfigTypes.BOT);
|
||||||
const health = HealthConfig;
|
const health = HealthConfig;
|
||||||
const hideout = HideoutConfig;
|
const hideout = HideoutConfig;
|
||||||
const http = HttpConfig;
|
const http = HttpConfig;
|
||||||
@ -128,7 +145,7 @@ class generator {
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Logger.warning(`[AKI-CONFIG] - Generating ${file} file`)
|
this.logger.warning(`[AKI-CONFIG] - Generating ${file} file`)
|
||||||
let toWrite = null
|
let toWrite = null
|
||||||
if(file === "config"){toWrite = config}else if(file === 'dailyConfig'){toWrite = dailyConfig}else if(file === 'pmcConfig'){toWrite = pmcConfig}
|
if(file === "config"){toWrite = config}else if(file === 'dailyConfig'){toWrite = dailyConfig}else if(file === 'pmcConfig'){toWrite = pmcConfig}
|
||||||
VFS.writeFile(
|
VFS.writeFile(
|
||||||
@ -136,10 +153,11 @@ class generator {
|
|||||||
JsonUtil.serialize(toWrite, true)
|
JsonUtil.serialize(toWrite, true)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Logger.error("[AKI-Config]: New configuration file created, please restart your server to use it.");
|
this.logger.error("[AKI-Config]: New configuration file created, please restart your server to use it.");
|
||||||
}
|
}
|
||||||
|
|
||||||
static checkConfigExisting() {
|
public checkConfigExisting(): void
|
||||||
|
{
|
||||||
const mod = require("../../package.json");
|
const mod = require("../../package.json");
|
||||||
const modPath = ModLoader.getModPath(mod.name);
|
const modPath = ModLoader.getModPath(mod.name);
|
||||||
const validation = [];
|
const validation = [];
|
||||||
@ -162,12 +180,12 @@ class generator {
|
|||||||
}
|
}
|
||||||
//All configurations files existing
|
//All configurations files existing
|
||||||
if ((validation.length === 3)) {
|
if ((validation.length === 3)) {
|
||||||
Logger.success(
|
this.logger.success(
|
||||||
`[AKI-CONFIG] - All configurations files already created, all green.`
|
`[AKI-CONFIG] - All configurations files already created, all green.`
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
//One of the 3 file is missing, we only want to regenerate the missing one
|
//One of the 3 file is missing, we only want to regenerate the missing one
|
||||||
Logger.error(
|
this.logger.error(
|
||||||
`[AKI-CONFIG] - A config file is missing. Generating the missing file`
|
`[AKI-CONFIG] - A config file is missing. Generating the missing file`
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -182,12 +200,10 @@ class generator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Logger.warning(
|
this.logger.warning(
|
||||||
"First time AKI-Configurator is run, generating the config file..."
|
"First time AKI-Configurator is run, generating the config file..."
|
||||||
);
|
);
|
||||||
this.createConfig(null);
|
this.createConfig(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = generator;
|
|
@ -1,6 +1,7 @@
|
|||||||
import { DependencyContainer, Lifecycle } from "tsyringe";
|
import { DependencyContainer, Lifecycle } from "tsyringe";
|
||||||
import type { IMod } from "@spt-aki/models/external/mod";
|
import type { IMod } from "@spt-aki/models/external/mod";
|
||||||
import type { ILogger } from "@spt-aki/models/spt/utils/ILogger";
|
import type { ILogger } from "@spt-aki/models/spt/utils/ILogger";
|
||||||
|
import { Bots } from "./bots";
|
||||||
|
|
||||||
class AkiConfig implements IMod
|
class AkiConfig implements IMod
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user