64 lines
2.2 KiB
JavaScript
64 lines
2.2 KiB
JavaScript
//=============================================================================
|
|
// RPG Maker MZ - IM_TrialSwitch
|
|
//
|
|
// Copyright 2025 min-pub. All rights reserved.
|
|
// This source code or any portion thereof must not be
|
|
// reproduced or used without licensed in any manner whatsoever.
|
|
//=============================================================================
|
|
/*:
|
|
* @target MZ
|
|
* @plugindesc 体験版スイッチ有効化
|
|
* @author 四号戦車
|
|
* @base PluginCommonBase
|
|
* @base PluginUtils
|
|
* @orderAfter PluginCommonBase
|
|
* @orderAfter PluginUtils
|
|
*
|
|
* @param targetSwitch
|
|
* @text 体験版スイッチ
|
|
* @desc 指定のスイッチを体験版時だけ有効にします。
|
|
* @type switch
|
|
* @default 0
|
|
*
|
|
* @help IM_TrialSwitch.js
|
|
*
|
|
* Version: 0.0.1
|
|
*
|
|
* 体験版スイッチ有効化プラグイン
|
|
*
|
|
*/
|
|
(() => {
|
|
"use strict";
|
|
|
|
//========================================================================
|
|
// プラグイン定義
|
|
//========================================================================
|
|
const pluginName = "IM_TrialSwitch";
|
|
const script = document.currentScript;
|
|
const param = PluginManagerEx.createParameter(script);
|
|
|
|
//========================================================================
|
|
// 定数定義
|
|
//========================================================================
|
|
const updateTrialSwitch = () => {
|
|
if (param.targetSwitch > 0) {
|
|
$gameSwitches.setValue(param.targetSwitch, Utils.isOptionValid("trial"));
|
|
}
|
|
};
|
|
|
|
//========================================================================
|
|
// コアスクリプト変更部 (DataManager)
|
|
//========================================================================
|
|
const _DataManager_setupNewGame = DataManager.setupNewGame;
|
|
DataManager.setupNewGame = function() {
|
|
_DataManager_setupNewGame.apply(this, arguments);
|
|
updateTrialSwitch();
|
|
};
|
|
|
|
const _DataManager_extractSaveContents = DataManager.extractSaveContents;
|
|
DataManager.extractSaveContents = function(contents) {
|
|
_DataManager_extractSaveContents.apply(this, arguments);
|
|
updateTrialSwitch();
|
|
};
|
|
|
|
})();
|