Project1

标题: 有什么插件来修改货币系统的显示吗? [打印本页]

作者: 二十八画员    时间: 2024-2-26 14:47
标题: 有什么插件来修改货币系统的显示吗?
原设置货币单位为“文”, 但是想要引入新的单位“贯”,和“文”是1000进制,例如,“2800文”统统显示为“2贯800文”。
作者: 动漫二次元    时间: 2024-2-26 20:26
用条件分支,这个直接纯事件可以做,,共同事件
作者: 二十八画员    时间: 2024-2-27 10:04
动漫二次元 发表于 2024-2-26 20:26
用条件分支,这个直接纯事件可以做,,共同事件

谢谢,最近刚接触呢,还得一点一点研究。
作者: alexncf125    时间: 2024-2-27 12:29
本帖最后由 alexncf125 于 2024-2-27 12:44 编辑
二十八画员 发表于 2024-2-27 10:04
谢谢,最近刚接触呢,还得一点一点研究。


别听楼上乱说了,打开rmmz_windows.js查找以下代码修改,或者另写成一个插件也行
JAVASCRIPT 代码复制
  1. Window_Base.prototype.drawCurrencyValue = function (value, unit, x, y, width) {
  2.     // const unitWidth = Math.min(80, this.textWidth(unit));
  3.     // this.resetTextColor();
  4.     // this.drawText(value, x, y, width - unitWidth - 6, "right");
  5.     // this.changeTextColor(ColorManager.systemColor());
  6.     // this.drawText(unit, x + width - unitWidth, y, unitWidth, "right");
  7.     const guan = Math.floor(value / 1000);
  8.     const wen = value % 1000;
  9.     const wenWidth = Math.min(80, this.textWidth(String(wen)));
  10.     const unitWidth = Math.min(80, this.textWidth(unit));
  11.     if (guan > 0) {
  12.         this.resetTextColor();
  13.         this.drawText(guan, x, y, width - unitWidth * 2 - wenWidth - 18, "right");
  14.         this.changeTextColor(ColorManager.systemColor());
  15.         this.drawText("贯", x + width - unitWidth * 2 - wenWidth - 12, y, unitWidth, "right");
  16.     };
  17.     this.resetTextColor();
  18.     this.drawText(wen, x, y, width - unitWidth - 6, "right");
  19.     this.changeTextColor(ColorManager.systemColor());
  20.     this.drawText(unit, x + width - unitWidth, y, unitWidth, "right");
  21. };

作者: 二十八画员    时间: 2024-2-28 16:58
alexncf125 发表于 2024-2-27 12:29
别听楼上乱说了,打开rmmz_windows.js查找以下代码修改,或者另写成一个插件也行
Window_Base.prototype. ...

大佬牛啤!  那么同理,商店的单价显示也在rmmz_windows.js吗?

作者: alexncf125    时间: 2024-2-28 17:08
本帖最后由 alexncf125 于 2024-2-28 17:12 编辑
二十八画员 发表于 2024-2-28 16:58
大佬牛啤!  那么同理,商店的单价显示也在rmmz_windows.js吗?


是的也在rmmz_windows.js
JAVASCRIPT 代码复制
  1. Window_ShopBuy.prototype.drawItem = function (index) {
  2.     const item = this.itemAt(index);
  3.     const price = this.price(item);
  4.  
  5.     const guan = Math.floor(price / 1000);
  6.     const wen = price % 1000;
  7.     const guanwen = guan > 0 ? guan + "贯" + wen + "文" : wen + "文";
  8.  
  9.     const rect = this.itemLineRect(index);
  10.     const priceWidth = this.priceWidth();
  11.     const priceX = rect.x + rect.width - priceWidth;
  12.     const nameWidth = rect.width - priceWidth;
  13.     this.changePaintOpacity(this.isEnabled(item));
  14.     this.drawItemName(item, rect.x, rect.y, nameWidth);
  15.  
  16.     // this.drawText(price, priceX, rect.y, priceWidth, "right");
  17.     this.drawText(guanwen, priceX, rect.y, priceWidth, "right");
  18.  
  19.     this.changePaintOpacity(true);
  20. };
  21.  
  22. Window_ShopBuy.prototype.priceWidth = function () {
  23.     // return 96;
  24.     return 192;
  25. };


priceWidth改192是因为,当显示999贯999文时只得96的话,文字会被收窄显示
作者: 二十八画员    时间: 2024-2-28 17:59
alexncf125 发表于 2024-2-28 17:08
是的也在rmmz_windows.js
Window_ShopBuy.prototype.drawItem = function (index) {
    const item = th ...

非常感谢!

但是有个bug,购买一个单价999文的物品,销售的价格却为1贯500文,哪里自己定义卖出价格呢?
作者: alexncf125    时间: 2024-2-28 21:06
二十八画员 发表于 2024-2-28 17:59
非常感谢!

但是有个bug,购买一个单价999文的物品,销售的价格却为1贯500文,哪里自己定义卖出价格呢? ...


RM默认的卖出价是数据库价格的一半,我这边新建工程测试,
买一个单价999文的物品,销售的价格为499文,
所以不知道你那边何以会是1贯500文

至于自己定义卖出价格,可以试试这个插件
https://forums.rpgmakerweb.com/i ... -formula-mz.129116/

作者: 二十八画员    时间: 2024-2-29 09:49
alexncf125 发表于 2024-2-28 21:06
RM默认的卖出价是数据库价格的一半,我这边新建工程测试,
买一个单价999文的物品,销售的价格为499文,
...

找到原因了,商店处理时,设999选的是“指定”,而不是数据库的“标准”。数据库里是3000,所以是1贯500文
作者: djs789783    时间: 2025-2-26 18:10
看不懂哦。。




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1