查看: 1503|回复: 9

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

[复制链接]
梦石
0
星屑
96
在线时间
19 小时
注册时间
2024-2-4
回帖
8
发表于 2024-2-26 14:47:55 | 显示全部楼层 |阅读模式

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

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

×
原设置货币单位为“文”, 但是想要引入新的单位“贯”,和“文”是1000进制,例如,“2800文”统统显示为“2贯800文”。
梦石
0
星屑
3230
在线时间
445 小时
注册时间
2022-1-21
回帖
197
发表于 2024-2-26 20:26:55 | 显示全部楼层
用条件分支,这个直接纯事件可以做,,共同事件
回复 0 1

使用道具 举报

梦石
0
星屑
96
在线时间
19 小时
注册时间
2024-2-4
回帖
8
 楼主| 发表于 2024-2-27 10:04:31 | 显示全部楼层
动漫二次元 发表于 2024-2-26 20:26
用条件分支,这个直接纯事件可以做,,共同事件

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

使用道具 举报

梦石
0
星屑
29896
在线时间
5733 小时
注册时间
2016-3-8
回帖
1653
发表于 2024-2-27 12:29:26 | 显示全部楼层
本帖最后由 alexncf125 于 2024-2-27 12:44 编辑
二十八画员 发表于 2024-2-27 10:04
谢谢,最近刚接触呢,还得一点一点研究。


别听楼上乱说了,打开rmmz_windows.js查找以下代码修改,或者另写成一个插件也行
[pre lang="javascript"]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");
};[/pre]
回复 1 0

使用道具 举报

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

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

使用道具 举报

梦石
0
星屑
29896
在线时间
5733 小时
注册时间
2016-3-8
回帖
1653
发表于 2024-2-28 17:08:53 | 显示全部楼层
本帖最后由 alexncf125 于 2024-2-28 17:12 编辑
二十八画员 发表于 2024-2-28 16:58
大佬牛啤!  那么同理,商店的单价显示也在rmmz_windows.js吗?


是的也在rmmz_windows.js
[pre lang="javascript"]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;
};[/pre]

priceWidth改192是因为,当显示999贯999文时只得96的话,文字会被收窄显示
回复

使用道具 举报

梦石
0
星屑
96
在线时间
19 小时
注册时间
2024-2-4
回帖
8
 楼主| 发表于 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文,哪里自己定义卖出价格呢?
回复

使用道具 举报

梦石
0
星屑
29896
在线时间
5733 小时
注册时间
2016-3-8
回帖
1653
发表于 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/
回复

使用道具 举报

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

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

使用道具 举报

梦石
0
星屑
1737
在线时间
123 小时
注册时间
2023-12-26
回帖
184
发表于 2025-2-26 18:10:04 | 显示全部楼层
看不懂哦。。
回复

使用道具 举报

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

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部