Skip to content

fix: 1052014 GraalJS -1*0 类型错误导致兑奖中断#804

Open
ArthurZhu1992 wants to merge 1 commit into
BeiDouMS:masterfrom
ArthurZhu1992:fix/1052014-graaljs-crash
Open

fix: 1052014 GraalJS -1*0 类型错误导致兑奖中断#804
ArthurZhu1992 wants to merge 1 commit into
BeiDouMS:masterfrom
ArthurZhu1992:fix/1052014-graaljs-crash

Conversation

@ArthurZhu1992

@ArthurZhu1992 ArthurZhu1992 commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

废都橡皮擦兑换功能bug

根因

原版 HeavenMS 使用 Nashorn 引擎, 被转为 Integer 0,调用 gainItem(int, short) 正常。BeiDou 改用 GraalJS 后 -1 * 0 保留为 Double -0.0,Java 找不到 gainItem(int, double) 重载,抛出 ScriptException 中断 givePrize() 流程。

结果:橡皮擦已扣除但奖励物品未发放。

改动

  1. 橡皮擦扣减循环:仅 tickets[i] > 0 时才调用 gainItem,避免 -1 * 0 类型错误(英文版新增,中文版已有守卫)
  2. 硬币扣减:从 hasCoin(包里有羽毛)改为 coins > 0(实际提交了才扣),防止 coins=0 时误执行
  3. 兑奖成功后弹窗显示具体获得的物品名和数量,避免玩家以为没给奖励

原版 HeavenMS 使用 Nashorn 引擎,-1*0 被引擎转为 Integer 0,
调用 gainItem(int, short) 正常。BeiDou 改为 GraalJS 后 -1*0
始终保留为 Double 类型 -0.0,Java 找不到 gainItem(int, double)
重载,抛出 ScriptException 中断 givePrize() 流程。
结果:橡皮擦已被扣除但奖励物品未发放。

修复:
- 橡皮擦扣减循环:仅 tickets[i] > 0 才调用 gainItem
- 硬币扣减:从 hasCoin(包里有) 改为 coins > 0(实际提交了)
- 兑奖成功后弹窗显示具体获得的物品名称和数量
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant