slave-thistle/www/js/plugins/MrTS_SimpleShopTax.js
2025-05-26 09:44:24 -05:00

112 lines
4.1 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//=============================================================================
// MrTS_SimpleShopTax.js (日本語版価格0機能追加)
//=============================================================================
/*:
* @plugindesc ショップ全体の売買価格を簡単に一括変更できます価格を0にする機能追加
* @author Mr. Trivel
*
* @help
* --------------------------------------------------------------------------------
* 使用規約
* --------------------------------------------------------------------------------
* ヘッダーを削除したり、このプラグインの作者を偽らないでください。
* プロジェクトでこのプラグインを使用する場合は、Mr. Trivel をクレジットしてください。
* 商用・非商用プロジェクトに自由に使用可能です。
* --------------------------------------------------------------------------------
* Version 1.2
* --------------------------------------------------------------------------------
*
* --------------------------------------------------------------------------------
* プラグインコマンド
* --------------------------------------------------------------------------------
* SetTaxTo Buy [税率] - 購入価格を指定した税率(%)で増減させます。
* SetTaxTo Sell [税率] - 売却価格を指定した税率(%)で増減させます。
* SetTaxTo Buy Zero - 購入価格を0にします。
* SetTaxTo Sell Zero - 売却価格を0にします。
*
* 使用例:
* SetTaxTo Buy 50 - 購入価格を50%値上げ
* SetTaxTo Buy -75 - 購入価格を75%値下げ
* SetTaxTo Sell 25 - 売却価格を25%値下げ
* SetTaxTo Sell -50 - 売却価格を50%値上げ
* SetTaxTo Buy Zero - 購入価格を0に設定
* SetTaxTo Sell Zero - 売却価格を0に設定
* --------------------------------------------------------------------------------
* 更新履歴
* --------------------------------------------------------------------------------
* 1.2 - 価格を0にする機能追加、日本語化
* 1.1 - 売却価格変更機能追加
* 1.0 - 初版リリース
*/
(function() {
//--------------------------------------------------------------------------
// Game_Interpreter
//
var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
Game_Interpreter.prototype.pluginCommand = function(command, args) {
_Game_Interpreter_pluginCommand.call(this, command, args);
if (command.toLowerCase() === 'settaxto') {
var type = args[0].toUpperCase();
var value = args[1].toUpperCase();
if (value === 'ZERO') {
if (type === 'BUY') $gameSystem.setBuyTaxTo(-100);
if (type === 'SELL') $gameSystem.setSellTaxTo(100);
} else {
switch(type) {
case 'BUY':
$gameSystem.setBuyTaxTo(Number(args[1]));
break;
case 'SELL':
$gameSystem.setSellTaxTo(Number(args[1]));
break;
}
}
}
};
//--------------------------------------------------------------------------
// Window_ShopBuy
//
var _WindowShopBuy_price = Window_ShopBuy.prototype.price;
Window_ShopBuy.prototype.price = function(item) {
var price = _WindowShopBuy_price.call(this, item);
price += Math.floor(price * $gameSystem.getBuyTax());
return Math.max(price, 0);
};
//--------------------------------------------------------------------------
// Scene_Shop
//
var _Scene_Shop_sellingPrice = Scene_Shop.prototype.sellingPrice;
Scene_Shop.prototype.sellingPrice = function() {
var sellingPrice = _Scene_Shop_sellingPrice.call(this);
return Math.max(0, sellingPrice - Math.floor(sellingPrice * $gameSystem.getSellTax()));
};
//--------------------------------------------------------------------------
// Game_System
//
Game_System.prototype.setBuyTaxTo = function(tax) {
this._shopBuyTax = tax;
};
Game_System.prototype.setSellTaxTo = function(tax) {
this._shopSellTax = tax;
};
Game_System.prototype.getBuyTax = function() {
return this._shopBuyTax / 100 || 0;
};
Game_System.prototype.getSellTax = function() {
return this._shopSellTax / 100 || 0;
};
})();