|
@@ -42,7 +42,6 @@ class unitState extends EventEmitter {
|
|
|
|
|
|
|
|
Object.assign(this, {
|
|
Object.assign(this, {
|
|
|
//main properties for state management
|
|
//main properties for state management
|
|
|
- "settings": {}, //mod settings
|
|
|
|
|
"presets": {}, // all loaded per class presets
|
|
"presets": {}, // all loaded per class presets
|
|
|
"preset": {}, //current chosen preset
|
|
"preset": {}, //current chosen preset
|
|
|
"activeMode": undefined,
|
|
"activeMode": undefined,
|
|
@@ -78,9 +77,6 @@ class unitState extends EventEmitter {
|
|
|
|
|
|
|
|
Init() {
|
|
Init() {
|
|
|
console.log("DEBUG: unitState -> Init");
|
|
console.log("DEBUG: unitState -> Init");
|
|
|
-
|
|
|
|
|
- this.settings = utils.loadJson(utils.getFullPath(__dirname, "../settings/settings.json"));
|
|
|
|
|
- if (!this.settings) throw new Error("Settings file can't be loaded! Critical error. ");
|
|
|
|
|
|
|
|
|
|
this.availableClasses.forEach(x => {
|
|
this.availableClasses.forEach(x => {
|
|
|
this.presets[x] = utils.loadJson(utils.getFullPath(__dirname, `../settings/presets/${x}.json`));
|
|
this.presets[x] = utils.loadJson(utils.getFullPath(__dirname, `../settings/presets/${x}.json`));
|
|
@@ -93,7 +89,7 @@ class unitState extends EventEmitter {
|
|
|
this.smtsSet = new Set(...staticData.blockedSmt);
|
|
this.smtsSet = new Set(...staticData.blockedSmt);
|
|
|
|
|
|
|
|
this.__mod.hook("S_LOGIN", RAW_HOOK_MODE.EVENT, HOOK_SETTINGS.FIRST, () => {
|
|
this.__mod.hook("S_LOGIN", RAW_HOOK_MODE.EVENT, HOOK_SETTINGS.FIRST, () => {
|
|
|
- this.preset = this.settings["classBasedPresets"]
|
|
|
|
|
|
|
+ this.preset = this.__mod.settings["classBasedPresets"]
|
|
|
? (this.presets[this.__mod.game.me.class] || this.presets["common"])
|
|
? (this.presets[this.__mod.game.me.class] || this.presets["common"])
|
|
|
: this.presets["common"];
|
|
: this.presets["common"];
|
|
|
|
|
|
|
@@ -103,7 +99,7 @@ class unitState extends EventEmitter {
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
this.__mod.hook(...this.__proto.getData("S_LOAD_TOPO"), HOOK_SETTINGS.FIRST, (event) => {
|
|
this.__mod.hook(...this.__proto.getData("S_LOAD_TOPO"), HOOK_SETTINGS.FIRST, (event) => {
|
|
|
- if (!this.settings["applyTrigger"] || equal(this.prevMode, this.activeMode)) return;
|
|
|
|
|
|
|
+ if (!this.__mod.settings["applyTrigger"] || equal(this.prevMode, this.activeMode)) return;
|
|
|
|
|
|
|
|
this.prevMode = rfdc(this.activeMode);
|
|
this.prevMode = rfdc(this.activeMode);
|
|
|
|
|
|
|
@@ -123,7 +119,7 @@ class unitState extends EventEmitter {
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
this.__mod.hook("S_FIELD_EVENT_ON_ENTER", RAW_HOOK_MODE.EVENT, HOOK_SETTINGS.FIRST, () => {
|
|
this.__mod.hook("S_FIELD_EVENT_ON_ENTER", RAW_HOOK_MODE.EVENT, HOOK_SETTINGS.FIRST, () => {
|
|
|
- if (!this.settings["applyTrigger"] || equal(this.prevMode, this.activeMode)) return;
|
|
|
|
|
|
|
+ if (!this.__mod.settings["applyTrigger"] || equal(this.prevMode, this.activeMode)) return;
|
|
|
|
|
|
|
|
this.prevMode = rfdc(this.activeMode);
|
|
this.prevMode = rfdc(this.activeMode);
|
|
|
|
|
|
|
@@ -132,7 +128,7 @@ class unitState extends EventEmitter {
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
this.__mod.hook("S_FIELD_EVENT_ON_LEAVE", RAW_HOOK_MODE.EVENT, HOOK_SETTINGS.FIRST, () => {
|
|
this.__mod.hook("S_FIELD_EVENT_ON_LEAVE", RAW_HOOK_MODE.EVENT, HOOK_SETTINGS.FIRST, () => {
|
|
|
- if (!this.settings["applyTrigger"] || equal(this.prevMode, this.activeMode)) return;
|
|
|
|
|
|
|
+ if (!this.__mod.settings["applyTrigger"] || equal(this.prevMode, this.activeMode)) return;
|
|
|
|
|
|
|
|
this.activeMode = rfdc(this.prevMode);
|
|
this.activeMode = rfdc(this.prevMode);
|
|
|
|
|
|