|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
|
|
| (() => {
|
| "use strict";
|
| const pluginName = "LL_MenuScreenBase";
|
|
|
| const parameters = PluginManager.parameters(pluginName);
|
| const paramJsonParse = function(key, value) {
|
| try {
|
| return JSON.parse(value);
|
| } catch(e) {
|
| return value;
|
| }
|
| };
|
|
|
| const menuPictures = String(parameters["menuPictures"] || "[]");
|
| const onSpbPluginEnable = eval(parameters["onSpbPluginEnable"] || "true");
|
| const menuPictureLists = JSON.parse(JSON.stringify(menuPictures, paramJsonParse));
|
|
|
|
|
|
|
|
|
|
|
| const spbPluginName = "LL_StandingPictureBattle";
|
| const spbParameters = PluginManager.parameters(spbPluginName);
|
| const spbCommandPictures = String(spbParameters["sbCommandPictures"] || "[]");
|
| const spbCommandPictureLists = JSON.parse(JSON.stringify(spbCommandPictures, paramJsonParse));
|
|
|
|
|
|
|
|
|
|
|
|
|
| class ExMenuScreenBase {
|
|
|
|
|
|
|
|
|
| static getImageName (actorId) {
|
|
|
| let pictureLists = this.getPictureLists();
|
| if (!pictureLists) return;
|
|
|
|
|
| let actorStates = [];
|
| if (actorId) actorStates = $gameActors.actor(actorId)._states;
|
| let specificPicture = null;
|
|
|
|
|
| pictureLists = pictureLists.filter(function(item) {
|
| if (Number(item.actorId) == actorId) {
|
| return true;
|
| }
|
| });
|
|
|
|
|
| if (actorStates.length) {
|
|
|
| specificPicture = pictureLists.filter(function(item) {
|
| if (item.variableCase) {
|
| if (
|
| actorStates.indexOf(Number(item.stateId)) !== -1 &&
|
| $gameSwitches.value(Number(item.switchId)) &&
|
| (
|
| String(item.variableCase.type) == "equal" && $gameVariables.value(Number(item.variableCase.id)) == Number(item.variableCase.value) ||
|
| String(item.variableCase.type) == "higher" && $gameVariables.value(Number(item.variableCase.id)) >= Number(item.variableCase.value) ||
|
| String(item.variableCase.type) == "lower" && $gameVariables.value(Number(item.variableCase.id)) <= Number(item.variableCase.value)
|
| )
|
| ) {
|
| return true;
|
| }
|
| }
|
| });
|
| if (specificPicture.length) return this.checkHpPercentage(actorId, specificPicture);
|
|
|
| specificPicture = pictureLists.filter(function(item) {
|
| if (actorStates.indexOf(Number(item.stateId)) !== -1 && $gameSwitches.value(Number(item.switchId)) && !item.variableCase) {
|
| return true;
|
| }
|
| });
|
| if (specificPicture.length) return this.checkHpPercentage(actorId, specificPicture);
|
|
|
| specificPicture = pictureLists.filter(function(item) {
|
| if (item.variableCase) {
|
| if (
|
| actorStates.indexOf(Number(item.stateId)) !== -1 &&
|
| (Number(item.switchId) === 0 || !item.switchId) &&
|
| (
|
| String(item.variableCase.type) == "equal" && $gameVariables.value(Number(item.variableCase.id)) == Number(item.variableCase.value) ||
|
| String(item.variableCase.type) == "higher" && $gameVariables.value(Number(item.variableCase.id)) >= Number(item.variableCase.value) ||
|
| String(item.variableCase.type) == "lower" && $gameVariables.value(Number(item.variableCase.id)) <= Number(item.variableCase.value)
|
| )
|
| ) {
|
| return true;
|
| }
|
| }
|
| });
|
| if (specificPicture.length) return this.checkHpPercentage(actorId, specificPicture);
|
|
|
| specificPicture = pictureLists.filter(function(item) {
|
| if (actorStates.indexOf(Number(item.stateId)) !== -1 && (Number(item.switchId) === 0 || !item.switchId) && !item.variableCase) {
|
| return true;
|
| }
|
| });
|
| if (specificPicture.length) return this.checkHpPercentage(actorId, specificPicture);
|
| }
|
|
|
|
|
| specificPicture = pictureLists.filter(function(item) {
|
| if (item.variableCase) {
|
| if (
|
| (Number(item.stateId) === 0 || !item.stateId) &&
|
| $gameSwitches.value(Number(item.switchId)) &&
|
| (
|
| String(item.variableCase.type) == "equal" && $gameVariables.value(Number(item.variableCase.id)) == Number(item.variableCase.value) ||
|
| String(item.variableCase.type) == "higher" && $gameVariables.value(Number(item.variableCase.id)) >= Number(item.variableCase.value) ||
|
| String(item.variableCase.type) == "lower" && $gameVariables.value(Number(item.variableCase.id)) <= Number(item.variableCase.value)
|
| )
|
| ) {
|
| return true;
|
| }
|
| }
|
| });
|
| if (specificPicture.length) return this.checkHpPercentage(actorId, specificPicture);
|
|
|
| specificPicture = pictureLists.filter(function(item) {
|
| if ((Number(item.stateId) === 0 || !item.stateId) && $gameSwitches.value(Number(item.switchId)) && !item.variableCase) {
|
| return true;
|
| }
|
| });
|
| if (specificPicture.length) return this.checkHpPercentage(actorId, specificPicture);
|
|
|
| specificPicture = pictureLists.filter(function(item) {
|
| if (item.variableCase) {
|
| if (
|
| (Number(item.stateId) === 0 || !item.stateId) &&
|
| (Number(item.switchId) === 0 || !item.switchId) &&
|
| (
|
| String(item.variableCase.type) == "equal" && $gameVariables.value(Number(item.variableCase.id)) == Number(item.variableCase.value) ||
|
| String(item.variableCase.type) == "higher" && $gameVariables.value(Number(item.variableCase.id)) >= Number(item.variableCase.value) ||
|
| String(item.variableCase.type) == "lower" && $gameVariables.value(Number(item.variableCase.id)) <= Number(item.variableCase.value)
|
| )
|
| ) {
|
| return true;
|
| }
|
| }
|
| });
|
| if (specificPicture.length) return this.checkHpPercentage(actorId, specificPicture);
|
|
|
|
|
| let normalPicture = pictureLists.filter(function(item) {
|
| if ((Number(item.stateId) === 0 || !item.stateId) && (Number(item.switchId) === 0 || !item.switchId) && !item.variableCase) return true;
|
| });
|
| if (normalPicture.length) return this.checkHpPercentage(actorId, normalPicture);
|
| }
|
|
|
| static checkHpPercentage (actorId, pictureLists) {
|
|
|
| let hpRate = this.getHpRate(actorId);
|
|
|
| let minHpRate = 100;
|
| let result = null;
|
| pictureLists.forEach(function(item) {
|
| if (hpRate <= Number(item.hpPercentage) && minHpRate >= Number(item.hpPercentage)) {
|
| result = item;
|
| minHpRate = Number(item.hpPercentage);
|
| } else if (!item.hpPercentage && minHpRate >= 100) {
|
|
|
| result = item;
|
| minHpRate = Number(item.hpPercentage);
|
| }
|
| });
|
| return result;
|
| }
|
|
|
| static getPictureLists () {
|
| return onSpbPluginEnable ? spbCommandPictureLists : menuPictureLists;
|
| }
|
|
|
| static onSpbPluginEnable () {
|
| return onSpbPluginEnable;
|
| }
|
|
|
|
|
| static getHpRate (actorId) {
|
| if (!$gameActors.actor(actorId)) return 0;
|
| return $gameActors.actor(actorId).mhp > 0 ? $gameActors.actor(actorId).hp / $gameActors.actor(actorId).mhp * 100 : 0;
|
| }
|
| }
|
|
|
| window.ExMenuScreenBase = ExMenuScreenBase;
|
| })();
|
|
|