/*------------------------------ Copyright (c) 2025 PotatoDragon Released under the MIT License. https://opensource.org/license/mit ------------------------------*/ /*: @target MZ @url https://raw.githubusercontent.com/pota-gon/RPGMakerMZ/refs/heads/main/plugins/System/Name/NameShop.js @plugindesc Name Shop Ver1.3.8 (2025/1/18) @author PotatoDragon @license MIT License @help English Help Translator: munokura This is an unofficial English translation of the plugin help, created to support global RPG Maker users. Feedback is welcome to improve translation quality (see: https://github.com/munokura/PotatoDragon-MZ-plugins ). Original plugin by PotatoDragon. Please check the latest official version at: https://github.com/pota-gon/RPGMakerMZ/wiki ----- ## Overview Specify a name to call a shop process. ## Usage 1. Select the "Name Shop" plugin command. 2. Configure the shop using the plugin command. 3. When you call an event, the configured shop will be called. @command name_shop_item @text Name Shop @desc Calling a shop process by name @arg goods @text Product List @desc Shop product list @type struct[] @arg buyOnly @text Purchase only @desc Should I just buy it? @type boolean @on Purchase only @off Buying and selling @default false */ /*:ja @plugindesc 名前ショップ Ver1.3.8(2025/1/18) @url https://raw.githubusercontent.com/pota-gon/RPGMakerMZ/refs/heads/main/plugins/System/Name/NameShop.js @target MZ @author ポテトードラゴン ・アップデート情報 Ver1.3.8 - 名前検索用のパラメータ位置変更 - ヘルプ更新 - リファクタリング Ver1.3.7: 名前検索用のパラメータ追加 Ver1.3.6 - 検索時のバグ修正 - 他プラグイン導入時の convertBool が無条件で true を返すバグ修正 Copyright (c) 2025 ポテトードラゴン Released under the MIT License. https://opensource.org/license/mit @help ## 概要 名前を指定してショップの処理を呼び出します ## 使い方 1. プラグインコマンド「名前ショップ」を選択 2. プラグインコマンドからショップの設定を実施 3. イベントを呼び出すと、設定したショップが呼び出されます @command name_shop_item @text 名前ショップ @desc 名前を指定してショップの処理を呼び出す @arg goods @type struct[] @text 商品リスト @desc ショップの商品リスト @arg buyOnly @type boolean @text 購入のみ @desc 購入するのみにするか @on 購入のみ @off 購入と売却 @default false */ (() => { 'use strict'; // ベースプラグインの処理 function Potadra_getPluginName(extension = 'js') { const reg = new RegExp(".+\/(.+)\." + extension); return decodeURIComponent(document.currentScript.src).replace(reg, '$1'); } function Potadra_convertBool(bool) { if (bool === "false" || bool === '' || bool === undefined) { return false; } else { return true; } } function Potadra_search(data, id, column = "name", search_column = "id", val = "", initial = 1) { if (!id) return val; for (let i = initial; i < data.length; i++) { if (!data[i]) continue; if (search_column && data[i][search_column] == id) { val = column ? data[i][column] : data[i]; break; } else if (i == id) { val = data[i]; break; } } return val; } function Potadra_nameSearch(data, name, column = "id", search_column = "name", val = "", initial = 1) { return Potadra_search(data, name, column, search_column, val, initial); } // パラメータ用変数 const plugin_name = Potadra_getPluginName(); // プラグインコマンド(名前ショップ) PluginManager.registerCommand(plugin_name, "name_shop_item", args => { const goods = []; const buy_only = Potadra_convertBool(args.buyOnly); if (args.goods) { const good_lists = JSON.parse(args.goods); let type, val; for (const good_list of good_lists) { const good_data = JSON.parse(good_list); const name = good_data.name; const price = good_data.price; // アイテム type = 0; val = Potadra_nameSearch($dataItems, name); if (!val) { // 武器 type = 1; val = Potadra_nameSearch($dataWeapons, name); if (!val) { // 防具 type = 2; val = Potadra_nameSearch($dataArmors, name); } } if (val) { let set = 0; if (price > 0) { set = 1; } goods.push([type, val, set, price]); } } } SceneManager.push(Scene_Shop); SceneManager.prepareNextScene(goods, buy_only); }); })();