Project1
标题: 有什么插件来修改货币系统的显示吗? [打印本页]
作者: 二十八画员 时间: 2024-2-26 14:47
标题: 有什么插件来修改货币系统的显示吗?
原设置货币单位为“文”, 但是想要引入新的单位“贯”,和“文”是1000进制,例如,“2800文”统统显示为“2贯800文”。
作者: 动漫二次元 时间: 2024-2-26 20:26
用条件分支,这个直接纯事件可以做,,共同事件
作者: 二十八画员 时间: 2024-2-27 10:04
谢谢,最近刚接触呢,还得一点一点研究。
作者: alexncf125 时间: 2024-2-27 12:29
本帖最后由 alexncf125 于 2024-2-27 12:44 编辑
别听楼上乱说了,打开rmmz_windows.js查找以下代码修改,或者另写成一个插件也行
Window_Base.prototype.drawCurrencyValue = function (value, unit, x, y, width) {
// const unitWidth = Math.min(80, this.textWidth(unit));
// this.resetTextColor();
// this.drawText(value, x, y, width - unitWidth - 6, "right");
// this.changeTextColor(ColorManager.systemColor());
// this.drawText(unit, x + width - unitWidth, y, unitWidth, "right");
const guan = Math.floor(value / 1000);
const wen = value % 1000;
const wenWidth = Math.min(80, this.textWidth(String(wen)));
const unitWidth = Math.min(80, this.textWidth(unit));
if (guan > 0) {
this.resetTextColor();
this.drawText(guan, x, y, width - unitWidth * 2 - wenWidth - 18, "right");
this.changeTextColor(ColorManager.systemColor());
this.drawText("贯", x + width - unitWidth * 2 - wenWidth - 12, y, unitWidth, "right");
};
this.resetTextColor();
this.drawText(wen, x, y, width - unitWidth - 6, "right");
this.changeTextColor(ColorManager.systemColor());
this.drawText(unit, x + width - unitWidth, y, unitWidth, "right");
};
Window_Base.prototype.drawCurrencyValue = function (value, unit, x, y, width) {
// const unitWidth = Math.min(80, this.textWidth(unit));
// this.resetTextColor();
// this.drawText(value, x, y, width - unitWidth - 6, "right");
// this.changeTextColor(ColorManager.systemColor());
// this.drawText(unit, x + width - unitWidth, y, unitWidth, "right");
const guan = Math.floor(value / 1000);
const wen = value % 1000;
const wenWidth = Math.min(80, this.textWidth(String(wen)));
const unitWidth = Math.min(80, this.textWidth(unit));
if (guan > 0) {
this.resetTextColor();
this.drawText(guan, x, y, width - unitWidth * 2 - wenWidth - 18, "right");
this.changeTextColor(ColorManager.systemColor());
this.drawText("贯", x + width - unitWidth * 2 - wenWidth - 12, y, unitWidth, "right");
};
this.resetTextColor();
this.drawText(wen, x, y, width - unitWidth - 6, "right");
this.changeTextColor(ColorManager.systemColor());
this.drawText(unit, x + width - unitWidth, y, unitWidth, "right");
};
作者: 二十八画员 时间: 2024-2-28 16:58
大佬牛啤! 那么同理,商店的单价显示也在rmmz_windows.js吗?
作者: alexncf125 时间: 2024-2-28 17:08
本帖最后由 alexncf125 于 2024-2-28 17:12 编辑
是的也在rmmz_windows.js
Window_ShopBuy.prototype.drawItem = function (index) {
const item = this.itemAt(index);
const price = this.price(item);
const guan = Math.floor(price / 1000);
const wen = price % 1000;
const guanwen = guan > 0 ? guan + "贯" + wen + "文" : wen + "文";
const rect = this.itemLineRect(index);
const priceWidth = this.priceWidth();
const priceX = rect.x + rect.width - priceWidth;
const nameWidth = rect.width - priceWidth;
this.changePaintOpacity(this.isEnabled(item));
this.drawItemName(item, rect.x, rect.y, nameWidth);
// this.drawText(price, priceX, rect.y, priceWidth, "right");
this.drawText(guanwen, priceX, rect.y, priceWidth, "right");
this.changePaintOpacity(true);
};
Window_ShopBuy.prototype.priceWidth = function () {
// return 96;
return 192;
};
Window_ShopBuy.prototype.drawItem = function (index) {
const item = this.itemAt(index);
const price = this.price(item);
const guan = Math.floor(price / 1000);
const wen = price % 1000;
const guanwen = guan > 0 ? guan + "贯" + wen + "文" : wen + "文";
const rect = this.itemLineRect(index);
const priceWidth = this.priceWidth();
const priceX = rect.x + rect.width - priceWidth;
const nameWidth = rect.width - priceWidth;
this.changePaintOpacity(this.isEnabled(item));
this.drawItemName(item, rect.x, rect.y, nameWidth);
// this.drawText(price, priceX, rect.y, priceWidth, "right");
this.drawText(guanwen, priceX, rect.y, priceWidth, "right");
this.changePaintOpacity(true);
};
Window_ShopBuy.prototype.priceWidth = function () {
// return 96;
return 192;
};
priceWidth改192是因为,当显示999贯999文时只得96的话,文字会被收窄显示
作者: 二十八画员 时间: 2024-2-28 17:59
非常感谢!
但是有个bug,购买一个单价999文的物品,销售的价格却为1贯500文,哪里自己定义卖出价格呢?
作者: alexncf125 时间: 2024-2-28 21:06
RM默认的卖出价是数据库价格的一半,我这边新建工程测试,
买一个单价999文的物品,销售的价格为499文,
所以不知道你那边何以会是1贯500文
至于自己定义卖出价格,可以试试这个插件
https://forums.rpgmakerweb.com/i ... -formula-mz.129116/
作者: 二十八画员 时间: 2024-2-29 09:49
找到原因了,商店处理时,设999选的是“指定”,而不是数据库的“标准”。数据库里是3000,所以是1贯500文
作者: djs789783 时间: 2025-2-26 18:10
看不懂哦。。
欢迎光临 Project1 (https://rpg.blue/) |
Powered by Discuz! X3.1 |