/*:
* @plugindesc The heart of all maker-style plugins; it adds a playtesting editor that can be opened with F12.
* @author SumRndmDde
*
* @param Connect Editor
* @type boolean
* @desc If ON, the Editor Window will be "connected" to the main window.
* @default true
*
* @param Auto Open Window
* @type boolean
* @desc If ON, the game window will automatically open the Editor Window is opened.
* @default false
*
* @param Auto Move Window
* @type boolean
* @desc If ON, the game window will automatically be moved to the side when Editor Window is opened.
* @default true
*
* @param Menu Editor Exempt List
* @type text[]
* @desc This is a list of all the windows that are not allowed to be manipulated using the Menu Editor
* @default ["Window_BattleLog","Window_MapName"]
*
* @help
*
* Super Tools Engine
* Version 1.31
* SumRndmDde
*
*
* This plugin is the core of all maker-style plugins; it adds a playtest editor
* that can be opened with F12 while playtesting. Using this editor, various
* actions can be taken and different tools can be used to help test or
* build one's game.
*
*
* ==============================================================================
* Tool Kit
* ==============================================================================
*
* This is where lanuchers for the various tools will appear. By default, there
* are only three tools, but extension plugins will add more later.
*
*
*
* Database EX
*
* A tool that adds, edits, and upgrades various MV Database inputs. It can also
* have custom editors added to it through extension plugins.
*
*
*
* Debug Tool
*
* A tool containing various features for testing one's game.
*
*
*
* Menu Editor
*
* A tool that allows developers to edit the window setups for scenes.
*
*
* ==============================================================================
* Playtester
* ==============================================================================
*
* The functions here are to support general playtesting. They involve using
* quick and simple restarts, saves, and loads.
*
*
*
* Reload Game
*
* Restarts the game and reloads all data. Allows developers to apply edits
* to the game without closing the playtesting window.
*
*
*
* Quick Save
*
* Quickly saves the game so it can be loaded through "Quick Load".
*
*
*
* Quick Load
*
* Quickly loads the game from the last quick save.
*
*
*
* Quick Load + Reload
*
* Preforms the same function as "reload game", but loads the most recent quick
* save after loading.
*
*
* ==============================================================================
* Options
* ==============================================================================
*
* These allow developers to customize the design/mechanics of the playtesting
* editor.
*
*
*
* Theme
*
* Chooses the color scheme of the editor.
* "Absolute Randomness" generates random colors every time it is selected.
*
*
*
* Follow Mode
*
* If checked, then the playtesting editor will follow the game window on screen
* based off of its position.
*
*
*
* Follow X
*
* The relative X position for the playtesting editor while using "Follow Mode".
*
*
*
* Follow Y
*
* The relative Y position for the playtesting editor while using "Follow Mode".
*
*
* ==============================================================================
* End of Help File
* ==============================================================================
*
* Welcome to the bottom of the Help file.
*
*
* Thanks for reading!
* If you have questions, or if you enjoyed this Plugin, please check
* out my YouTube channel!
*
* https://www.youtube.com/c/SumRndmDde
*
*
* Until next time,
* ~ SumRndmDde
*
*/
/*:ja
* @plugindesc 全てのメーカースタイルのプラグインの心臓部であり、F12で開くことができるテストプレイ用エディタを追加。
* @author SumRndmDde
*
* @param Connect Editor
* @text エディタ接続
* @type boolean
* @on 有効
* @off 無効
* @desc エディタウィンドウがメインウィンドウに接続
* 有効:true / 無効:false
* @default true
*
* @param Auto Open Window
* @text 自動オープンウィンドウ
* @type boolean
* @on 有効
* @off 無効
* @desc エディタウィンドウを開いた時、自動的にゲームウィンドウを開く
* 有効:true / 無効:false
* @default false
*
* @param Auto Move Window
* @text 自動移動ウィンドウ
* @type boolean
* @on 有効
* @off 無効
* @desc エディタウィンドウを開いた時、ゲームウィンドウが自動的に横に移動
* 有効:true / 無効:false
* @default true
*
* @param Menu Editor Exempt List
* @text メニューエディタ除外リスト
* @type text[]
* @desc メニューエディタで操作できないウィンドウの一覧
* @default ["Window_BattleLog","Window_MapName"]
*
* @help
* 翻訳:ムノクラ
* https://fungamemake.com/
* https://twitter.com/munokura/
*
* 元プラグイン: http://sumrndm.site/super-tools-engine/
*
* Super Tools Engine
* Version 1.31
* SumRndmDde
*
*
* このプラグインは全てのメーカースタイルのプラグインの中核となるもので、
* テストプレイ中にF12で開くことができるテストプレイエディタを追加します。
* このエディタを使用して、様々なアクションを実行したり、
* 様々なツールを使用してゲームのテストやビルドを支援することができます。
*
*
* ===========================================================================
* ツールキット
* ===========================================================================
*
* ここに様々なツールのランチャーが表示されます。
* デフォルトでは3つのツールしかありませんが、
* 拡張プラグインは後から追加していきます。
*
*
* Database EX
*
* 様々なMVDatabase入力を追加、編集、アップグレードするツールです。
* 拡張プラグインを介してカスタムエディタを追加することもできます。
*
*
* Debug Tool
*
* 自分のゲームをテストするための様々な機能を含んだツールです。
*
*
* Menu Editor
*
* 開発者がシーンのウィンドウ設定を編集できるツール。
*
*
* ===========================================================================
* プレイテスター
* ===========================================================================
*
* ここでの機能は、一般的なテストプレイをサポートするためのものです。
* これらの機能には、迅速で簡単な再起動、保存、ロードが含まれています。
*
*
* Reload Game
*
* ゲームを再起動し、全てのデータをリロードします。
* 開発者がテストプレイウィンドウを閉じずに
* ゲームに編集を適用できるようにします。
*
*
* Quick Save
*
* "Quick Load"で読み込めるように、ゲームを素早く保存します。
*
*
* Quick Load
*
* 最後のクイックセーブから素早くゲームをロードします。
*
*
* Quick Load + Reload
*
* ゲームのリロード'と同じ機能ですが、
* ロード後に最新のクイックセーブをロードします。
*
*
* ===========================================================================
* オプション
* ===========================================================================
*
* これらの機能により、開発者はテストプレイ用エディタのデザイン/機能を
* カスタマイズすることができます。
*
*
* Theme
*
* エディタの配色を選択します。
* "Absolute Randomness"は、選択される度にランダムな色を生成します。
*
*
* Follow Mode
*
* チェックした場合、テストプレイエディタはゲームウィンドウの位置に基づいて
* 画面上のゲームウィンドウを追従します。
*
*
* Follow X
*
* "Follow Mode"を使用時のテストプレイエディタの相対的なX位置。
*
*
*
* Follow Y
*
* "Follow Mode"を使用時のテストプレイエディタの相対的なY位置。
*
*
* ===========================================================================
* ヘルプファイルの終わり
* ===========================================================================
*
* ヘルプファイルの終わりへようこそ。
*
* 読んでくれてありがとう!
* 質問があったり、このプラグインを楽しめたら、
* 私のYouTubeチャンネルを登録してください!!
*
* https://www.youtube.com/c/SumRndmDde
*
*
* 次の機会まで
* ~ SumRndmDde
*
*/
var SRD = SRD || {};
SRD.SuperToolsEngine = SRD.SuperToolsEngine || {};
SRD.NotetagGetters = SRD.NotetagGetters || [];
var Imported = Imported || {};
Imported["SumRndmDde Super Tools Engine"] = 1.31;
var $dataWindows = {};
var $dataBasicEX = {};
var $dataNotes = {};
function MakerManager() {
throw new Error('You silly-billy, MakerManager is a static class! (。•̀ᴗ-)✧');
}
function FileManager() {
throw new Error('Hey, noob! FileManager is a static class! ヾ(о-ω・)ノ⌒★');
}
function DataManagerEX() {
throw new Error('It doesn\'t matter how extreme, DataManagerEX is a static class! (╬Ò^Ó)');
}
function DebugManager() {
throw new Error('Uh... DebugManager is a static class! (/ε\*)');
}
function WindowManager() {
throw new Error('Great job. WindowManager is a static class! ʕ·ᴥ· ʔ');
}
// Fix the flag check for 1.6 editor and 1.5 or below project
if (process.versions['node-webkit'] >= "0.13.0" && Utils.RPGMAKER_VERSION < "1.6.0") {
Utils.isOptionValid = function (name) {
if (location.search.slice(1).split('&').contains(name)) { return 1; };
if (typeof nw !== "undefined" && nw.App.argv.length > 0 && nw.App.argv[0].split('&').contains(name)) { return 1; };
return 0;
};
}
(function (_) {
"use strict";
//-----------------------------------------------------------------------------
// SRD.SuperToolsEngine
//-----------------------------------------------------------------------------
const params = PluginManager.parameters('SRD_SuperToolsEngine');
if (!params['Menu Editor Exempt List']) {
alert('SRD_SuperToolsEngine has updated its parameter system!\nPlease reinstall the plugin or update the parameters!');
return;
}
_.connect = String(params['Connect Editor']).trim().toLowerCase() === 'true';
_.move = String(params['Auto Move Window']).trim().toLowerCase() === 'true';
_.open = String(params['Auto Open Window']).trim().toLowerCase() === 'true';
_.banList = JSON.parse(params['Menu Editor Exempt List']);
_.isPlaytest = Utils.isOptionValid('test') && Utils.isNwjs();
_.isNewNWjs = process.versions['node-webkit'] >= "0.13.0";
if (_.isPlaytest && _.isNewNWjs) {
if (!require('fs').existsSync("supertoolsengine.html")) require('fs').writeFileSync("supertoolsengine.html", "
");
}
_.pad = function (value) {
return (value < 10) ? "0" + value : value;
};
_.capFirst = function (value) {
return value.substring(0, 1).toUpperCase() + value.substring(1);
};
_.loadNotetags = function () {
_.loadBasicData();
_.loadNoteData();
_.checkPartySystem();
};
_.loadBasicData = function () {
Object.keys($dataBasicEX).forEach(function (key) {
const dataObj = window["$data" + key];
const ids = $dataBasicEX[key];
Object.keys(ids).forEach(function (id) {
const data = dataObj[parseInt(id)];
if (data) {
const props = ids[id];
Object.keys(props).forEach(function (prop) {
const type = props[prop].substring(0, 1);
const value = props[prop].substring(1);
if (type === '^') {
data[prop] = String(value);
} else if (type === '#') {
data[prop] = Number(value);
} else if (type === '$') {
Object.defineProperty(data, prop, {
get: function () {
try {
return eval(value);
} catch (e) {
alert('There was error. Please visit console.')
console.log(value + '\n' + e);
return '';
}
},
set: function (value) { },
configurable: true
});
}
});
}
});
});
};
_.loadNoteData = function () {
Object.keys($dataNotes).forEach(function (key) {
const dataObj = window["$data" + key];
const ids = $dataNotes[key];
Object.keys(ids).forEach(function (id) {
const data = dataObj[parseInt(id)];
const note = ids[id];
if (data && note) {
if (data.note === undefined) data.note = '';
data.note += '\n' + note;
}
});
});
};
_.checkPartySystem = function () {
if (Imported.YEP_PartySystem && Yanfly.Party.version < 1.12) {
alert('Please update YEP_PartySystem to version 1.12 or above!');
}
};
SRD.NotetagGetters.push(_.loadNotetags);
//-----------------------------------------------------------------------------
// DataManager
//-----------------------------------------------------------------------------
DataManager._testExceptions = ["Windows.json", "DataEX.json", "Notes.json"];
DataManager._databaseFiles.push({ name: '$dataWindows', src: "Windows.json" });
DataManager._databaseFiles.push({ name: '$dataBasicEX', src: "DataEX.json" });
DataManager._databaseFiles.push({ name: '$dataNotes', src: "Notes.json" });
if (!SRD.DataManager_isDatabaseLoaded) {
SRD.notetagsLoaded = false;
SRD.DataManager_isDatabaseLoaded = DataManager.isDatabaseLoaded;
DataManager.isDatabaseLoaded = function () {
if (!SRD.DataManager_isDatabaseLoaded.apply(this, arguments)) return false;
if (!SRD.notetagsLoaded) {
SRD.NotetagGetters.forEach(function (func) {
func.call(this);
}, this);
SRD.notetagsLoaded = true;
}
return true;
};
}
DataManager.deleteGlobal = function (id) {
const globalInfo = this.loadGlobalInfo();
if (!globalInfo) return;
delete globalInfo[id];
const newGlobalInfo = [];
for (let i = 0; i < globalInfo.length; i++) {
if (globalInfo[i]) newGlobalInfo[i] = globalInfo[i];
}
this.saveGlobalInfo(newGlobalInfo);
};
_.DataManager_loadDataFile = DataManager.loadDataFile;
DataManager.loadDataFile = function (name, src) {
if (src.substring(0, 5) === 'Test_') {
const oriSrc = src.substring(5);
if (this._testExceptions.contains(oriSrc)) {
src = oriSrc;
}
}
_.DataManager_loadDataFile.call(this, name, src);
};
//-----------------------------------------------------------------------------
// ConfigManager
//-----------------------------------------------------------------------------
ConfigManager.STE_Theme = 0;
ConfigManager.STE_Follow = false;
ConfigManager.STE_FollowX = 6;
ConfigManager.STE_FollowY = 0;
_.ConfigManager_makeData = ConfigManager.makeData;
ConfigManager.makeData = function () {
const config = _.ConfigManager_makeData.apply(this, arguments);
config.STE_Theme = this.STE_Theme;
config.STE_Follow = this.STE_Follow;
config.STE_FollowX = this.STE_FollowX;
config.STE_FollowY = this.STE_FollowY;
return config;
};
_.ConfigManager_applyData = ConfigManager.applyData;
ConfigManager.applyData = function (config) {
_.ConfigManager_applyData.apply(this, arguments);
this.STE_Theme = this.readSTECoord(config, 'STE_Theme');
this.STE_Follow = this.readFlag(config, 'STE_Follow');
this.STE_FollowX = this.readSTECoord(config, 'STE_FollowX', 6);
this.STE_FollowY = this.readSTECoord(config, 'STE_FollowY');
};
ConfigManager.readSTECoord = function (config, name, def) {
const value = config[name];
if (value !== undefined) {
return Number(value);
} else {
return def || 0;
}
};
//-----------------------------------------------------------------------------
// SceneManager
//-----------------------------------------------------------------------------
_.SceneManager_onSceneStart = SceneManager.onSceneStart;
SceneManager.onSceneStart = function () {
_.SceneManager_onSceneStart.apply(this, arguments);
this._scene.initCustomWindowPositions();
};
if (_.isPlaytest) {
_.SceneManager_onKeyDown = SceneManager.onKeyDown;
SceneManager.onKeyDown = function (event) {
_.SceneManager_onKeyDown.apply(this, arguments);
if (event.keyCode === 123) {
this.openMaker();
}
};
SceneManager.openMaker = function () {
if (MakerManager.window) {
MakerManager.closeMaker();
} else {
MakerManager.openMaker();
}
};
_.SceneManager_updateMain = SceneManager.updateMain;
SceneManager.updateMain = function () {
if (DebugManager.gameSpeed === 1) {
_.SceneManager_updateMain.apply(this, arguments);
} else {
for (let i = 0; i < DebugManager.gameSpeed; i++) {
this.updateInputData();
this.changeScene();
this.updateScene();
if (i + 1 === DebugManager.gameSpeed) {
this.renderScene();
this.requestUpdate();
}
}
}
};
//-----------------------------------------------------------------------------
// MakerManager
//-----------------------------------------------------------------------------
MakerManager._window = null;
MakerManager._styling = null;
MakerManager._mode = '';
Object.defineProperty(MakerManager, 'window', {
get: function () {
return this._window;
},
configurable: true
});
Object.defineProperty(MakerManager, 'mainHTML', {
get: function () {
if (!this._document) return null;
return this._document.body.innerHTML
},
set: function (value) {
if (!this._document) return;
this._document.body.innerHTML = value;
},
configurable: true
});
Object.defineProperty(MakerManager, 'document', {
get: function () {
if (!this._window) return null;
if (!this._document) {
this._document = this._window.window.document;
}
return this._document;
},
configurable: true
});
Object.defineProperty(MakerManager, 'style', {
get: function () {
return this._styling;
},
configurable: true
});
Object.defineProperty(MakerManager, 'mode', {
get: function () {
return this._mode;
},
set: function (value) {
return this._mode = value;
},
configurable: true
});
Object.defineProperty(MakerManager, 'colors', {
get: function () {
return this._colors;
},
configurable: true
});
MakerManager.initManager = function () {
this._listIndex = 0;
this.setupGameWindow();
this.updateTheme();
};
MakerManager.openMaker = function () {
if (this._window) this._window.close(true);
this.createWindow();
if (!_.isNewNWjs) {
this.moveWindow();
this.setupWindow();
this._window.on('loaded', this.onWindowLoad.bind(this));
}
};
MakerManager.closeMaker = function () {
this.onFinish();
this._window.close(true);
};
MakerManager.deleteMaker = function () {
this._window = null;
};
MakerManager.createWindow = function () {
const gui = require('nw.gui');
if (_.isNewNWjs) {
gui.Window.open('supertoolsengine.html', {
title: "Super Tools Engine - Core Editor | SumRndmDde",
width: 600,
height: 680,
resizable: false,
icon: "www/icon/icon.png"
}, function (newWindow) {
this._window = newWindow;
this._window.setShowInTaskbar(false);
this.moveWindow();
this.setupWindow();
this._window.on('loaded', this.onWindowLoad.bind(this));
}.bind(this));
} else {
this._window = gui.Window.open('', {
title: "Super Tools Engine - Core Editor | SumRndmDde",
width: 600,
height: 680,
resizable: false,
toolbar: false,
icon: "www/icon/icon.png"
});
this._window.setShowInTaskbar(false);
}
};
MakerManager.moveWindow = function () {
if (_.move) {
window.moveBy(-300, 0);
this._window.moveTo(window.screenX + Graphics.boxWidth + 6, window.screenY);
}
};
MakerManager.setupWindow = function () {
this._window.on('closed', this.deleteMaker.bind(this));
this._window.on('close', this.closeMaker.bind(this));
};
MakerManager.onWindowLoad = function () {
this.buildWindow();
this.assignWindow();
this.focusWindow();
};
MakerManager.buildWindow = function () {
this._document = this._window.window.document;
this._styling = this._document.createElement('style');
this._document.head.appendChild(this._styling);
this._document.addEventListener('keydown', SceneManager.onKeyDown.bind(SceneManager));
this.setupWindowHtml();
};
MakerManager.assignWindow = function () {
this._window.window.MakerManager = this;
this._window.window.DataManagerEX = DataManagerEX;
this._window.window.DebugManager = DebugManager;
this._window.window.WindowManager = WindowManager;
};
MakerManager.focusWindow = function () {
this._window.focus();
};
MakerManager.onFinish = function () {
if (this.mode === 'data') {
DataManagerEX.onFinish();
}
if (this.mode === 'debug') {
DebugManager.onFinish();
}
if (this.mode === 'window') {
WindowManager.onFinish();
}
if (_.move) {
window.moveBy(300, 0);
}
};
if (Imported["SumRndmDde Game Upgrade"]) {
MakerManager.onWindowClose = function () {
GameWindowManager.onWindowClose();
};
_.GameWindowManager_closeGame = GameWindowManager.closeGame;
GameWindowManager.closeGame = function () {
if (_.isPlaytest && MakerManager.window) {
MakerManager.closeTheWindows.call(GameWindowManager.window);
} else {
_.GameWindowManager_closeGame.apply(this, arguments);
}
};
} else {
MakerManager.onWindowClose = function () {
MakerManager.closeTheWindows.call(this);
};
}
MakerManager.closeTheWindows = function () {
DebugManager.deleteQuickSave();
if (MakerManager.window) {
if (window.confirm('Are you sure you wish to close the game while Editor Window is active? Your changes will not be saved.')) {
MakerManager.window.close(true);
this.close(true);
}
} else {
this.close(true);
}
};
MakerManager.setupGameWindow = function () {
const gui = require('nw.gui');
const win = gui.Window.get();
//Set up closing
win.removeAllListeners('close');
win.on('close', this.onWindowClose.bind(win));
//Set up connection
if (_.connect) {
win.removeAllListeners('restore');
win.removeAllListeners('focus');
win.removeAllListeners('minimize');
win.on('focus', function () {
if (MakerManager.window) {
MakerManager.window.setAlwaysOnTop(true);
//MakerManager.window.show();
MakerManager.window.restore();
MakerManager.window.setAlwaysOnTop(false);
}
});
win.on('restore', function () {
if (MakerManager.window) {
MakerManager.window.restore();
}
});
win.on('minimize', function () {
if (MakerManager.window) {
MakerManager.window.minimize();
}
});
}
//Set up movement
win.removeAllListeners('move');
win.on('move', function (x, y) {
if (ConfigManager.STE_Follow && MakerManager.window) {
MakerManager.window.x = x + Graphics.width + ConfigManager.STE_FollowX;
MakerManager.window.y = y + ConfigManager.STE_FollowY;
}
});
};
MakerManager.setupWindowHtml = function () {
this.updateStyle();
MakerManager.window.title = "Super Tools Engine - Core Editor | SumRndmDde";
MakerManager.mode = '';
this.setLauncherPage();
};
MakerManager.updateStyle = function () {
this.updateTheme();
this._styling.innerHTML = this.getStyle();
this._document.body.style.cssText = `background-color: ${this._colors[3]}`;
this._document.body.text = this._colors[0];
};
MakerManager.setLauncherPage = function () {
this.mainHTML = this.topBar(0) + this.getLauncherHtml();
this.refreshEverything();
};
MakerManager.setPlaytesterPage = function () {
this.mainHTML = this.topBar(1) + this.getPlaytesterHtml();
};
MakerManager.setOptionsPage = function () {
this.mainHTML = this.topBar(2) + this.getOptionsHtml();
};
MakerManager.topBar = function (index) {
const active = ['', '', ''];
active[index] = 'class="active"';
return `
${this.getLauncherTable()}`;
};
MakerManager.refreshPages = function () {
const pages = this._document.getElementById('PageControl');
pages.innerHTML = this.getPageControl();
};
MakerManager.refreshEverything = function () {
this.refreshTable();
this.refreshPages();
};
MakerManager.getLauncherTable = function () {
let result = '';
const buttons = this.getLauncherButtons();
const count = this.getLauncherTableCount();
const max = Math.min((this._listIndex + 1) * 5, count);
for (let i = this._listIndex * 5; i < max; i++) {
result += buttons[i];
}
return result;
};
MakerManager.getLauncherButtons = function () {
if (this._buttons === undefined) this._buttons = this.getLauncherButtonsRaw();
return this._buttons;
};
MakerManager.getLauncherButtonsRaw = function () {
return [
`${this.generateLauncherRow("Database EX", "A tool that adds, edits, and upgrades various MV Database inputs.", "DataManagerEX.setupWindowHtml()", "#f41f1f")}`,
`${this.generateLauncherRow("Debug Tool", "A tool containing various features for testing one's game.", "DebugManager.setupWindowHtml()", "#1f8af4")}`,
`${this.generateLauncherRow("Menu Editor", "A tool that allows developers to edit the window setups for scenes.", "WindowManager.setupWindowHtml()", "#8a1ff4")}`
];
};
MakerManager.getLauncherTableCount = function () {
return this.getLauncherButtons().length;
};
MakerManager.getLauncherTableMax = function () {
const count = this.getLauncherTableCount();
return Math.ceil(count / 5);
};
MakerManager.generateLauncherRow = function (name, description, method, color) {
color = color || "#000000";
return `
${description}
`;
};
MakerManager.getPageControl = function () {
const count = this.getLauncherTableCount();
if (count < 6) return '';
const max = this.getLauncherTableMax();
return `
\u21D2
Page: (${this._listIndex + 1}/${max})
\u21D0
`;
};
MakerManager.incrementPage = function () {
const max = this.getLauncherTableMax();
this._listIndex++;
if (this._listIndex + 1 > max) {
this._listIndex = 0;
}
this.refreshEverything();
};
MakerManager.decrementPage = function () {
const max = this.getLauncherTableMax();
this._listIndex--;
if (this._listIndex < 0) {
this._listIndex = max - 1;
}
this.refreshEverything();
};
MakerManager.getOptionsHtml = function () {
const selected = ['', ''];
selected[ConfigManager.STE_Theme] = 'selected';
const selected2 = (ConfigManager.STE_Follow) ? 'checked' : '';
const list = this.getOptionsList(selected);
return `
Option
Value
Theme
Follow Mode
Follow X
Follow Y
`;
};
MakerManager.updateFollow = function () {
ConfigManager.STE_Follow = this._document.getElementById('Follow').checked;
ConfigManager.STE_FollowX = parseInt(this._document.getElementById('FollowX').value);
ConfigManager.STE_FollowY = parseInt(this._document.getElementById('FollowY').value);
ConfigManager.save();
if (ConfigManager.STE_Follow && MakerManager.window) {
MakerManager.window.x = window.screenX + Graphics.width + ConfigManager.STE_FollowX;
MakerManager.window.y = window.screenY + ConfigManager.STE_FollowY;
}
};
MakerManager.getOptionsList = function (selected) {
return `
`;
};
MakerManager.getMakerTheme = function () {
const val = this._document.getElementById('Theme').value;
ConfigManager.STE_Theme = parseInt(val);
ConfigManager.save();
this.updateStyle();
};
MakerManager.updateTheme = function () {
switch (ConfigManager.STE_Theme) {
case 0:
this._colors = [
'#000', // Text Color
'#3E8E41', // Base Color
'#275929', // Base Color 2
'white', // Background Color
'#E7E7E7', // Border Color
'#F3F3F3', // Background Color 2
'#ddd', // Top Menu On-Mouse
'#eee', // Top Menu No Select
'#ddd', // Table Border
'#f2f2f2', // Off-grid Color
'#ddd', // Grid Hover Color
'#999', // Button Shadow
'#666', // Pushed Button Shadow
'#ffffff', // Input Background
'#888888', // Input Border
'#ffffff', // Select Background
'#888888', // Select Border
'#ff9900', // Input Highlight
'#666' // Top Menu Text Color
];
break;
case 1:
this._colors = [
'#fff', // Text Color
'#4c4cae', // Base Color
'#3e3e8e', // Base Color 2
'#222', // Background Color
'#1a1a1a', // Border Color
'#2d2d2d', // Background Color 2
'#444', // Top Menu On-Mouse
'#333', // Top Menu No Select
'#444', // Table Border
'#2d2d2d', // Off-grid Color
'#444', // Grid Hover Color
'#333', // Button Shadow
'#000', // Pushed Button Shadow
'#444444', // Input Background
'#888888', // Input Border
'#444444', // Select Background
'#888888', // Select Border
'#0099ff', // Input Highlight
'#666' // Top Menu Text Color
];
break;
case 2:
this._colors = [
'#000', // Text Color
'#4caeae', // Base Color
'#3e8e8e', // Base Color 2
'#eeeeff', // Background Color
'#d6d6E7', // Border Color
'#e2e2F3', // Background Color 2
'#ccccdd', // Top Menu On-Mouse
'#ddddee', // Top Menu No Select
'#ddd', // Table Border
'#e1e1f2', // Off-grid Color
'#ccccdd', // Grid Hover Color
'#999', // Button Shadow
'#666', // Pushed Button Shadow
'#ffffff', // Input Background
'#888888', // Input Border
'#ffffff', // Select Background
'#888888', // Select Border
'#0099ff', // Input Highlight
'#666' // Top Menu Text Color
];
break;
case 3:
this._colors = [
'#000', // Text Color
'#ae4cae', // Base Color
'#8e3e8e', // Base Color 2
'#fff0ff', // Background Color
'#e6d5e6', // Border Color
'#f3e2f3', // Background Color 2
'#dccbdc', // Top Menu On-Mouse
'#eeddee', // Top Menu No Select
'#ddd', // Table Border
'#f3e2f3', // Off-grid Color
'#dccbdc', // Grid Hover Color
'#999', // Button Shadow
'#666', // Pushed Button Shadow
'#ffffff', // Input Background
'#888888', // Input Border
'#ffffff', // Select Background
'#888888', // Select Border
'#ff00ff', // Input Highlight
'#666' // Top Menu Text Color
];
break;
case 4:
this._colors = [
'#fff', // Text Color
'#ae4c4c', // Base Color
'#8e3e3e', // Base Color 2
'#222', // Background Color
'#1a1a1a', // Border Color
'#2d2d2d', // Background Color 2
'#444', // Top Menu On-Mouse
'#333', // Top Menu No Select
'#444', // Table Border
'#2d2d2d', // Off-grid Color
'#444', // Grid Hover Color
'#333', // Button Shadow
'#000', // Pushed Button Shadow
'#444444', // Input Background
'#888888', // Input Border
'#444444', // Select Background
'#888888', // Select Border
'#ff0000', // Input Highlight
'#666' // Top Menu Text Color
];
break;
case 5:
this._colors = [
'#fff', // Text Color
'#8e8e3e', // Base Color
'#595927', // Base Color 2
'#222211', // Background Color
'#1a1a09', // Border Color
'#2d2d1c', // Background Color 2
'#444433', // Top Menu On-Mouse
'#333322', // Top Menu No Select
'#444433', // Table Border
'#2d2d1c', // Off-grid Color
'#444433', // Grid Hover Color
'#333322', // Button Shadow
'#000', // Pushed Button Shadow
'#444433', // Input Background
'#888877', // Input Border
'#444433', // Select Background
'#888877', // Select Border
'#ffff00', // Input Highlight
'#666' // Top Menu Text Color
];
break;
case 6:
this._colors = [
'#fff', // Text Color
'#ae7d4c', // Base Color
'#8e663e', // Base Color 2
'#805300', // Background Color
'#ffd280', // Border Color
'#9c7d5e', // Background Color 2
'#9c7d5e', // Top Menu On-Mouse
'#9c7d5e', // Top Menu No Select
'#67ccff', // Table Border
'#ffa600', // Off-grid Color
'#cc8500', // Grid Hover Color
'#333', // Button Shadow
'#000', // Pushed Button Shadow
'#444466', // Input Background
'#8888aa', // Input Border
'#444466', // Select Background
'#8888aa', // Select Border
'orange', // Input Highlight
'#666' // Top Menu Text Color
];
break;
case 7:
this._colors = [
'#fff', // Text Color
'#aeae4c', // Base Color
'#8e8e3e', // Base Color 2
'#444', // Background Color
'#303030', // Border Color
'#4d4d4d', // Background Color 2
'#666', // Top Menu On-Mouse
'#555', // Top Menu No Select
'#666', // Table Border
'#4d4d4d', // Off-grid Color
'#666', // Grid Hover Color
'#333', // Button Shadow
'#000', // Pushed Button Shadow
'#666666', // Input Background
'#aaaaaa', // Input Border
'#6666666', // Select Background
'#aaaaaa', // Select Border
'#ae4c4c', // Input Highlight
'#888', // Top Menu Text Color
'#ae4c4c', // Button Color 1
'#8e3e3e' // Button Color 2
];
break;
case 8:
this._colors = [(Math.random() > 0.5) ? "#000000" : "#ffffff"];
for (let i = 0; i < 17; i++) {
this._colors.push(`rgba(${Math.randomInt(255)}, ${Math.randomInt(255)}, ${Math.randomInt(255)}, 255)`)
}
break;
}
};
MakerManager.getPlaytesterHtml = function () {
return `
Playtest Feature
Description
Reload Game
Once activated, the game will save, restart, and load quickly in order to reload any changed data.
Quick Save
Quickly saves the game without the need to open any menus or activate any events.
Quick Load
Quickly loads the most recent quick save.
Quick Load + Reload
Preforms a game reload, then starts the player back at the most recent quick save.
`;
};
/*
* Use the array to input custom menu pieces.
* Each piece will be a 2 length array.
* Example: ['Name', 'HTML Getting Function']
*/
DataManagerEX.getCustomInfo = function () {
return [
//['Custom Name', 'DataManagerEX.getCustomHtml']
];
};
DataManagerEX.getBasicHtml = function () {
return `
Section:
Object:
${this.getProperties()}
${this.getPages()}
`;
};
DataManagerEX.getProperties = function () {
return `
Property
Eval
Input
${this.getPropertyList()}`;
};
DataManagerEX.getTypeList = function () {
let result = '';
this._types.forEach(function (type) {
const selected = (this._type === type) ? 'selected' : '';
result += ``;
}, this);
return result;
};
DataManagerEX.getObjectList = function () {
if (!$dataBasicEX[this._type]) $dataBasicEX[this._type] = {};
const data = window['$data' + this._type];
let result = '';
for (let i = 1; i < data.length; i++) {
const obj = data[i];
if (obj) {
const selected = (parseInt(this._id) === i) ? 'selected' : '';
const changed = ($dataBasicEX[this._type][String(i)]) ? '*' : '';
result += ``;
}
}
return result;
};
DataManagerEX.getPropertyList = function () {
const list = this._props[this._type];
const data = $dataBasicEX[this._type][this._id];
let result = '';
for (let i = (this._listIndex * 6); i < Math.min((this._listIndex + 1) * 6, list.length); i++) {
const name = (list[i].substring(0, 1) === '#') ? list[i].substring(1) : list[i];
let value = (data && data[name]) ? data[name] : '';
const checked = (value.substring(0, 1) === '$') ? 'checked' : '';
if (checked === 'checked') value = value.replace(/'/g, '\"');
value = value.substring(1);
result += `
${_.capFirst(name)}
`;
}
return result;
};
DataManagerEX.getPages = function () {
const max = Math.ceil(this._props[this._type].length / 6);
if (max === 1) {
return `
Save Object!
`;
}
return `
\u21D2
Page: (${this._listIndex + 1}/${max})
\u21D0
Save Object!
`;
};
DataManagerEX.updateTypes = function () {
this._type = MakerManager.document.getElementById('SectionSelect').value;
this._id = MakerManager.document.getElementById('ObjectSelect').value;
this._listIndex = 0;
this.refreshObjects();
this.refreshPages();
};
DataManagerEX.updateObjects = function () {
this._id = MakerManager.document.getElementById('ObjectSelect').value;
this.refreshProperties();
};
DataManagerEX.refreshObjects = function () {
MakerManager.document.getElementById('ObjectSelect').innerHTML = this.getObjectList();
this.refreshProperties();
};
DataManagerEX.refreshProperties = function () {
MakerManager.document.getElementById('PropertyList').innerHTML = this.getProperties();
};
DataManagerEX.refreshPages = function () {
MakerManager.document.getElementById('PageControl').innerHTML = this.getPages();
};
DataManagerEX.saveCurrent = function () {
if (!$dataBasicEX[this._type][this._id]) $dataBasicEX[this._type][this._id] = {};
const list = this._props[this._type];
const data = $dataBasicEX[this._type][this._id];
for (let i = 0; i < list.length; i++) {
const element = MakerManager.document.getElementById(list[i]);
const chkElem = MakerManager.document.getElementById('check_' + list[i]);
const propName = (list[i].substring(0, 1) === '#') ? list[i].substring(1) : list[i];
if (element && chkElem && element.value.trim().length > 0) {
let value = String(element.value).trim();
if (chkElem.checked) {
value = '$' + value; //Eval
} else if (list[i].substring(0, 1) === '#') {
value = '#' + value; //Number
} else {
value = '^' + value; //String
}
$dataBasicEX[this._type][this._id][propName] = value;
} else if (typeof ($dataBasicEX[this._type][this._id][propName]) !== "undefined") {
delete $dataBasicEX[this._type][this._id][propName];
}
}
if (JSON.stringify($dataBasicEX[this._type][this._id]) === "{}") {
delete $dataBasicEX[this._type][this._id];
}
this.updateTypes();
};
DataManagerEX.incrementPageExists = function () {
return ((this._listIndex + 1) * 6) < this._props[this._type].length;
};
DataManagerEX.decrementPageExists = function () {
return this._listIndex > 0;
};
DataManagerEX.incrementPage = function () {
if (this.incrementPageExists()) {
this._listIndex++;
this.refreshProperties();
this.refreshPages();
}
};
DataManagerEX.decrementPage = function () {
if (this.decrementPageExists()) {
this._listIndex--;
this.refreshProperties();
this.refreshPages();
}
};
DataManagerEX.updateTypesNote = function () {
this._type = MakerManager.document.getElementById('SectionSelect').value;
this._id = MakerManager.document.getElementById('ObjectSelect').value;
this.refreshObjectsNote();
};
DataManagerEX.updateObjectsNote = function () {
this._id = MakerManager.document.getElementById('ObjectSelect').value;
this.refreshBigNote();
};
DataManagerEX.refreshObjectsNote = function () {
MakerManager.document.getElementById('ObjectSelect').innerHTML = this.getObjectListNote();
this.refreshBigNote();
};
DataManagerEX.refreshBigNote = function () {
MakerManager.document.getElementById('NoteInput').value = this.getCurrentNote();
};
DataManagerEX.getNoteHtml = function () {
return `
Section:
Object:
Save Object!
`;
};
DataManagerEX.getObjectListNote = function () {
if (!$dataNotes[this._type]) $dataNotes[this._type] = {};
const data = window['$data' + this._type];
let result = '';
for (let i = 1; i < data.length; i++) {
const obj = data[i];
if (obj) {
const selected = (parseInt(this._id) === i) ? 'selected' : '';
const changed = ($dataNotes[this._type][String(i)]) ? '*' : '';
result += ``;
}
}
return result;
};
DataManagerEX.getCurrentNote = function () {
if ($dataNotes[this._type] && $dataNotes[this._type][this._id]) {
return $dataNotes[this._type][this._id];
}
return '';
};
DataManagerEX.saveCurrentNote = function () {
this._type = MakerManager.document.getElementById('SectionSelect').value;
this._id = MakerManager.document.getElementById('ObjectSelect').value;
const note = MakerManager.document.getElementById('NoteInput').value;
if (!$dataNotes[this._type]) $dataNotes[this._type] = {};
$dataNotes[this._type][this._id] = note;
if (typeof ($dataNotes[this._type][this._id]) === "string" && $dataNotes[this._type][this._id] === '') {
delete $dataNotes[this._type][this._id];
}
this.updateTypesNote();
};
DataManagerEX.onFinish = function () {
this.save();
this.requestRestart();
};
DataManagerEX.requestRestart = function () {
if (this.requestRestartCondition()) {
if (window.confirm("Database EX changes are detected! Would you like to preform a SUPER RESTART to apply the changes?")) {
_.move = false;
DebugManager.restartGame();
}
}
};
DataManagerEX.requestRestartCondition = function () {
return this._oldDataEx !== JsonEx.stringify($dataBasicEX) || this._oldNotes !== JsonEx.stringify($dataNotes);
};
DataManagerEX.returnToMaker = function () {
this.onFinish();
MakerManager.setupWindowHtml();
};
DataManagerEX.initManager();
//-----------------------------------------------------------------------------
// DebugManager
//-----------------------------------------------------------------------------
DebugManager.gameSpeed = 1;
DebugManager.disableEncounters = false;
DebugManager.disableCollisions = false;
DebugManager.isOnMap = function () {
return SceneManager._scene.constructor === Scene_Map && SceneManager._sceneStarted;
};
/*
* Player Transfer
*/
DebugManager.preformPlayerTransfer = function () {
if (this.isOnMap()) {
const mapId = MakerManager.document.getElementById('mapId').value;
$gamePlayer.reserveTransfer(parseInt(mapId), 0, 0, 0, 2);
_._isSuperTransfer = true;
SoundManager.playLoad();
} else {
alert("This feature can only be used while the player is on the map!");
}
};
/*
* Game Speed
*/
DebugManager.refreshGameSpeed = function () {
const speed = MakerManager.document.getElementById('gameSpd').value;
this.gameSpeed = parseInt(speed);
SoundManager.playLoad();
};
/*
* Gold
*/
DebugManager.setGold = function () {
const gold = MakerManager.document.getElementById('gold').value;
$gameParty._gold = parseInt(gold).clamp(0, $gameParty.maxGold());
SoundManager.playLoad();
};
/*
* Encounters/Collision
*/
DebugManager.refreshCollisions = function () {
this.disableCollisions = !!MakerManager.document.getElementById('collision').checked;
};
DebugManager.refreshEncounters = function () {
this.disableEncounters = !!MakerManager.document.getElementById('encounter').checked;
};
/*
* Givers
*/
DebugManager.giveActorSkill = function () {
const id = MakerManager.document.getElementById('actorId').value;
const skill = MakerManager.document.getElementById('skillId').value;
$gameActors.actor(parseInt(id)).learnSkill(parseInt(skill));
SoundManager.playUseItem();
};
DebugManager.givePartyItems = function () {
const id = MakerManager.document.getElementById('itemId').value;
const count = MakerManager.document.getElementById('itemCount').value;
$gameParty.gainItem($dataItems[parseInt(id)], parseInt(count));
SoundManager.playUseItem();
};
DebugManager.givePartyWeapons = function () {
const id = MakerManager.document.getElementById('weaponId').value;
const count = MakerManager.document.getElementById('weaponCount').value;
$gameParty.gainItem($dataWeapons[parseInt(id)], parseInt(count));
SoundManager.playUseItem();
};
DebugManager.givePartyArmors = function () {
const id = MakerManager.document.getElementById('armorId').value;
const count = MakerManager.document.getElementById('armorCount').value;
$gameParty.gainItem($dataArmors[parseInt(id)], parseInt(count));
SoundManager.playUseItem();
};
DebugManager.givePartyMembers = function () {
const id = MakerManager.document.getElementById('allActorId').value;
$gameParty.addActor(parseInt(id));
};
DebugManager.takePartyMembers = function () {
const id = MakerManager.document.getElementById('allActorId').value;
$gameParty.removeActor(parseInt(id));
};
/*
* Super Restart Functions
*/
DebugManager.restartGame = function () {
if (!SceneManager._sceneStarted) setTimeout(this.restartGame.bind(this), 10);
if (!this.isOnMap()) {
if (SceneManager._scene.constructor === Scene_Title) {
this.restartGameForRealizies();
return;
}
if (!SceneManager._stack[0] || SceneManager._stack[0] !== Scene_Map) {
alert("The game could not be restarted!");
return;
}
}
if (DataManager.saveGame(999)) {
StorageManager.cleanBackup(999);
}
this.restartGameForRealizies();
};
DebugManager.restartGameForRealizies = function () {
this.setToReopen(999);
location.reload();
MakerManager.window.close(true);
};
DebugManager.localPath = function () {
const path = require('path');
return path.dirname(process.mainModule.filename);
};
DebugManager.getReopenPath = function () {
return this.localPath() + "ShouldOpenSTE";
};
DebugManager.setToReopen = function (id) {
const fs = require('fs');
const filePath = this.getReopenPath();
fs.writeFileSync(filePath, String(id));
};
DebugManager.removeReopener = function () {
const fs = require('fs');
const filePath = this.getReopenPath();
if (fs.existsSync(filePath)) {
fs.unlinkSync(filePath);
}
};
DebugManager.isSetToReopen = function () {
const fs = require('fs');
const filePath = this.getReopenPath();
if (!fs.existsSync(filePath)) {
return false;
} else {
return fs.readFileSync(filePath, { encoding: 'utf8' });
}
};
/*
* Quick Save/Load
*/
DebugManager.quickSave = function () {
const id = DataManager.maxSavefiles() + 1;
if (DataManager.saveGame(id)) {
StorageManager.cleanBackup(id);
}
};
DebugManager.quickLoad = function () {
const id = DataManager.maxSavefiles() + 1;
if (StorageManager.exists(id)) {
DataManager.loadGame(id);
Scene_Load.prototype.reloadMapIfUpdated.call(this);
if (SceneManager._scene.constructor !== Scene_Map) SceneManager.goto(Scene_Map);
} else {
alert('No quick save file exists!');
}
};
DebugManager.quickRestartLoad = function () {
const id = DataManager.maxSavefiles() + 1;
if (StorageManager.exists(id)) {
this.setToReopen(DataManager.maxSavefiles() + 1);
location.reload();
MakerManager.window.close(true);
} else {
alert('No quick save file exists!');
}
}
DebugManager.deleteQuickSave = function () {
const id = DataManager.maxSavefiles() + 1;
if (StorageManager.exists(id)) {
StorageManager.remove(id);
DataManager.deleteGlobal(id);
}
};
/*
* Debug Tool Stuff
*/
DebugManager.initManager = function () {
this.active = false;
this.mode = '';
this._listIndex = 0;
};
DebugManager.setupWindowHtml = function () {
this.active = true;
this._listIndex = 0;
this._maxSwitches = $dataSystem.switches.length - 1;
this._maxVariables = $dataSystem.variables.length - 1;
MakerManager.window.title = "Super Tools Engine - Debug Tool | SumRndmDde";
MakerManager.mode = 'debug';
this.setBasicPage();
};
DebugManager.setBasicPage = function () {
this.mode = 'basic';
MakerManager.mainHTML = this.topBar(0) + this.getBasicHtml();
};
DebugManager.setGiverPage = function () {
this.mode = 'give';
MakerManager.mainHTML = this.topBar(1) + this.getGiverHtml();
};
DebugManager.setGiver2Page = function () {
this.mode = 'give2';
MakerManager.mainHTML = this.topBar(2) + this.getGiver2Html();
};
DebugManager.setSwitchPage = function () {
this.mode = 'switch';
this._listIndex = 0;
MakerManager.mainHTML = this.topBar(3) + this.getSwitchHtml();
this.refreshSwitchTables();
};
DebugManager.setVariablePage = function () {
this.mode = 'variable';
this._listIndex = 0;
MakerManager.mainHTML = this.topBar(4) + this.getVariableHtml();
this.refreshVariableTables();
};
DebugManager.topBar = function (index) {
const active = ['', '', ''];
active[index] = 'class="active"';
return `
`;
};
DebugManager.getMapList = function () {
let result = ``;
return result;
};
DebugManager.getSkillList = function () {
let result = ``;
return result;
};
DebugManager.getActorList = function () {
let result = ``;
return result;
};
DebugManager.getEntireActorList = function () {
let result = ``;
return result;
};
DebugManager.getItemList = function () {
let result = ``;
return result;
};
DebugManager.getWeaponList = function () {
let result = ``;
return result;
};
DebugManager.getArmorList = function () {
let result = ``;
return result;
};
DebugManager.getBasicHtml = function () {
return `
Name
Control
Description
Speed Master
Allows the game to have its speed changed to make playtesting easier.
Transfer
${this.getMapList()}
Allows developers to immediately transfer to any map within their game.
Gold Set
Set Gold
Sets the party's gold to whatever value is inputted.
Disable Collisions
When checked, the player will be able to walk around without collision.
Disable Encounters
When checked, all random enemy encounters will be disabled.
`;
};
DebugManager.getGiverHtml = function () {
return `
Control
Description
${this.getSkillList()}
${this.getActorList()}
Give Skill
Allows any Actor within the party to learn any Skill immediately.
${this.getItemList()}
Give Item
Allows the party to immediately obtain a specified amount of any item.
${this.getWeaponList()}
Give Weapon
Allows the party to immediately obtain a specified amount of any weapon.
${this.getArmorList()}
Give Armor
Allows the party to immediately obtain a specified amount of any armor.
`;
};
DebugManager.getGiver2Html = function () {
return `
Control
Description
${this.getEntireActorList()}
Add
Remove
Allows developers to control the actors within the current party.
`;
};
DebugManager.getSwitchHtml = function () {
let result = `
`;
if (this._maxSwitches > 40) {
result += `
\u21D2
\u21D0
`;
}
result += '';
return result;
};
DebugManager.refreshSwitchTables = function () {
let result1 = '';
let result2 = '';
const first = (this._listIndex * 40) + 1;
for (let i = first; i <= Math.min(first + 19, this._maxSwitches); i++) {
const value = $gameSwitches.value(i);
const str = $dataSystem.switches[i];
result1 += `