SaltyMonkey лет назад: 6
Родитель
Сommit
f89ec20071
3 измененных файлов с 78 добавлено и 59 удалено
  1. 19 2
      docs/presets.md
  2. 7 7
      lib/unitState.js
  3. 52 50
      settings/presets/common.json

+ 19 - 2
docs/presets.md

@@ -10,6 +10,23 @@ Path for preset folder: `<modfolder>/settings/presets/`
 * `Mode` - concrete set of setting
 * `Directives` - service part in every `preset`. Describes started point, and events behavior.
 
+## Load process:
+
+### Basics:
+
+FPS Manager must have at least 1 preset installed; if zero presets detected then mod will be not able to load, exception will be raised. By default `preset` with name `common` will be activated for `all classes`. YOU MUST KEEP THIS PRESET JUST AS FAILOVER. `Presets` must be placed  in folder `<modfolder>/settings/presets/` and have proper file names (look Naming explanation below).
+
+If FPS Manager configured in options to support `class based presets` it will try load preset for your class firstly, after, if failed, will use `common` one.
+Example: you can create custom preset for your `warrior` with custom modes, another classes will use `common` preset. 
+
+### Naming:
+
+FPS Manager using internal client data instead of hardcoded strings and it leads to some differences in game class naming scheme.
+
+|  Expected preset name         | Game class           |
+| ------------------------------| ---------------------|
+
+
 ## `Preset` structure
 
 Preset structure MUST HAVE `directives` `object` and `modes` `object`.
@@ -32,7 +49,7 @@ Simplified example below:
 }
 ```
 
-### `directives` object fields
+### `directives` structure
 
 Every `directives` field except `default` can be removed or have value `false` - leads to "no jobs needed by event" state.
 
@@ -59,7 +76,7 @@ Simplified example with explanation (WARNING: you can't place comments as below
 }
 ```
 
-### `modes` object fields
+### `modes` structure
 
 Every `modes` field explains `MODE NAME` and contains ` desired options` as object. This name can be used in in-game commands to forcefully switch mode and can be added to directives as value for options.
 

+ 7 - 7
lib/unitState.js

@@ -96,7 +96,7 @@ class unitState extends EventEmitter {
 
 			if (!this.preset) { throw new Error("Preset can't be loaded! Critical error. "); }
 
-			this.activeMode = this.preset[this.preset.directives["default"]];
+			this.activeMode = this.preset.modes[this.preset.directives["default"]];
 		});
 
 		this.__mod.hook(...this.__proto.getData("S_LOAD_TOPO"), HOOK_SETTINGS.FIRST, (event) => {
@@ -105,17 +105,17 @@ class unitState extends EventEmitter {
 			this.prevMode = rfdc(this.activeMode);
 
 			if (this.__mod.game.me.inOpenWorld && this.preset.directives.triggerOW) {
-				this.activeMode = this.preset[this.preset.directives.triggerOW];
+				this.activeMode = this.preset.modes[this.preset.directives.triggerOW];
 			}
 			else if (this.__mod.game.me.inBattleground && this.preset.directives.triggerBG) {
-				this.activeMode = this.preset[this.preset.directives.triggerBG];
+				this.activeMode = this.preset.modes[this.preset.directives.triggerBG];
 			}
 			else if (this.__mod.game.me.inCivilUnrest && this.preset.directives.triggerCU) {
-				this.activeMode = this.preset[this.preset.directives.triggerCU];
+				this.activeMode = this.preset.modes[this.preset.directives.triggerCU];
 			}
 			else if (this.__mod.game.me.inDungeon && this.preset.directives.triggerDungeons) {
-				this.activeMode = this.preset[this.preset.directives.triggerDungeons[event.zone]] ||
-					this.preset[this.preset.directives.triggerDungeons["all"]];
+				this.activeMode = this.preset.modes[this.preset.directives.triggerDungeons[event.zone]] ||
+					this.preset.modes[this.preset.directives.triggerDungeons["all"]];
 			}
 		});
 
@@ -124,7 +124,7 @@ class unitState extends EventEmitter {
 
 			this.prevMode = rfdc(this.activeMode);
 
-			this.activeMode = this.preset[this.preset.directives.triggerGuardians];
+			this.activeMode = this.preset.modes[this.preset.directives.triggerGuardians];
 			this._eventTrigger();
 		});
 

+ 52 - 50
settings/presets/common.json

@@ -9,56 +9,58 @@
 		"triggerBG": "default",
 		"triggerOW": "default"
 	},
-	"default": {
-		"throttleSomePackets": false,
-		"blockCustomAppearanceChanges": false,
-		"blockUselessPackets": false,
-		"blockAnnoyingScreenMessages": false,
-		"blockNpcsDeathAnimations": false,
-		"blockAchievementsInCombat": false,
-		"blockInventoryInCombat": false,
-		"blockHuntingRewardsBuffs": false,
-		"blockShapeChangeBuffs": false,
-		"blockOnScreenEffectsBuffs": false,
-		"blockAreaBuffs": false,
-		"blockShakeEffects": false,
-		"blockAreaHits": false,
-		"blockOwnHits": false,
-		"blockOwnServants": false,
-		"blockAreaServants": false,
-		"blockOwnSummons": false,
-		"blockAreaSummons": false,
-		"blockCollections": false,
-		"blockNumbersPopups": false,
-		"blockNumbersPopupsOptions": {
-			"hp": false,
-			"mp": false,
-			"damage": false
-		},
-		"blockAdditionalSkillEffects": false,
-		"blockAdditionalSkillEffectsOptions": {
-			"own": false,
-			"players": false
-		},
-		"blockProjectiles": false,
-		"blockProjectilesOptions": {
-			"players": true
-		},
-		"blockDropItems": false,
-		"blockDropItemsOptions": {
-			"all": false,
-			"templateId": []
-		},
-		"blockNpcs": false,
-		"blockNpcsOptions": {
-			"templateId": [],
-			"huntingZoneId": []
-		},
-		"blockPlayers": false,
-		"blockPlayersOptions": {
-			"all": false,
-			"class": [],
-			"name": []
+	"modes": {
+		"default": {
+			"throttleSomePackets": false,
+			"blockCustomAppearanceChanges": false,
+			"blockUselessPackets": false,
+			"blockAnnoyingScreenMessages": false,
+			"blockNpcsDeathAnimations": false,
+			"blockAchievementsInCombat": false,
+			"blockInventoryInCombat": false,
+			"blockHuntingRewardsBuffs": false,
+			"blockShapeChangeBuffs": false,
+			"blockOnScreenEffectsBuffs": false,
+			"blockAreaBuffs": false,
+			"blockShakeEffects": false,
+			"blockAreaHits": false,
+			"blockOwnHits": false,
+			"blockOwnServants": false,
+			"blockAreaServants": false,
+			"blockOwnSummons": false,
+			"blockAreaSummons": false,
+			"blockCollections": false,
+			"blockNumbersPopups": false,
+			"blockNumbersPopupsOptions": {
+				"hp": false,
+				"mp": false,
+				"damage": false
+			},
+			"blockAdditionalSkillEffects": false,
+			"blockAdditionalSkillEffectsOptions": {
+				"own": false,
+				"players": false
+			},
+			"blockProjectiles": false,
+			"blockProjectilesOptions": {
+				"players": true
+			},
+			"blockDropItems": false,
+			"blockDropItemsOptions": {
+				"all": false,
+				"templateId": []
+			},
+			"blockNpcs": false,
+			"blockNpcsOptions": {
+				"templateId": [],
+				"huntingZoneId": []
+			},
+			"blockPlayers": false,
+			"blockPlayersOptions": {
+				"all": false,
+				"class": [],
+				"name": []
+			}
 		}
 	}
 }