设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 358|回复: 8
打印 上一主题 下一主题

[有事请教] 有什么插件来修改货币系统的显示吗?

[复制链接]

Lv1.梦旅人

梦石
0
星屑
96
在线时间
19 小时
注册时间
2024-2-4
帖子
9
跳转到指定楼层
1
发表于 2024-2-26 14:47:55 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
原设置货币单位为“文”, 但是想要引入新的单位“贯”,和“文”是1000进制,例如,“2800文”统统显示为“2贯800文”。

Lv3.寻梦者

梦石
0
星屑
2847
在线时间
408 小时
注册时间
2022-1-21
帖子
213
2
发表于 2024-2-26 20:26:55 | 只看该作者
用条件分支,这个直接纯事件可以做,,共同事件
回复 支持 0 反对 1

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
96
在线时间
19 小时
注册时间
2024-2-4
帖子
9
3
 楼主| 发表于 2024-2-27 10:04:31 | 只看该作者
动漫二次元 发表于 2024-2-26 20:26
用条件分支,这个直接纯事件可以做,,共同事件

谢谢,最近刚接触呢,还得一点一点研究。
回复 支持 反对

使用道具 举报

Lv5.捕梦者

梦石
0
星屑
24302
在线时间
5050 小时
注册时间
2016-3-8
帖子
1618
4
发表于 2024-2-27 12:29:26 | 只看该作者
本帖最后由 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. };
回复 支持 1 反对 0

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
96
在线时间
19 小时
注册时间
2024-2-4
帖子
9
5
 楼主| 发表于 2024-2-28 16:58:43 | 只看该作者
alexncf125 发表于 2024-2-27 12:29
别听楼上乱说了,打开rmmz_windows.js查找以下代码修改,或者另写成一个插件也行
Window_Base.prototype. ...

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

使用道具 举报

Lv5.捕梦者

梦石
0
星屑
24302
在线时间
5050 小时
注册时间
2016-3-8
帖子
1618
6
发表于 2024-2-28 17:08:53 | 只看该作者
本帖最后由 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的话,文字会被收窄显示
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
96
在线时间
19 小时
注册时间
2024-2-4
帖子
9
7
 楼主| 发表于 2024-2-28 17:59:09 | 只看该作者
alexncf125 发表于 2024-2-28 17:08
是的也在rmmz_windows.js
Window_ShopBuy.prototype.drawItem = function (index) {
    const item = th ...

非常感谢!

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

使用道具 举报

Lv5.捕梦者

梦石
0
星屑
24302
在线时间
5050 小时
注册时间
2016-3-8
帖子
1618
8
发表于 2024-2-28 21:06:30 | 只看该作者
二十八画员 发表于 2024-2-28 17:59
非常感谢!

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


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

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

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
96
在线时间
19 小时
注册时间
2024-2-4
帖子
9
9
 楼主| 发表于 2024-2-29 09:49:26 | 只看该作者
alexncf125 发表于 2024-2-28 21:06
RM默认的卖出价是数据库价格的一半,我这边新建工程测试,
买一个单价999文的物品,销售的价格为499文,
...

找到原因了,商店处理时,设999选的是“指定”,而不是数据库的“标准”。数据库里是3000,所以是1贯500文
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-4-28 16:05

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表