refactor: Redesign the Currency System API#1152
Conversation
There was a problem hiding this comment.
Hey - 我发现了 1 个问题,并给出了一些整体性的反馈:
NumberValidator中新增的负值检查很好,但条件if(num < 0)的空格与文件其余部分不一致(例如if (num < 0)),建议和现有代码风格保持一致。- 请考虑这里是否应该允许 0,如果不允许,需要同时更新条件和错误信息(例如改为
num <= 0),以便校验逻辑和用户可见的信息都能清晰反映预期的业务规则。
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The new negative-value check in `NumberValidator` is good, but the condition `if(num < 0)` has inconsistent spacing compared to the rest of the file (`if (num < 0)`), so it would be good to align this with the existing style.
- Consider whether zero should be allowed here and, if not, update the condition and error message (e.g., `num <= 0`) so the validation logic and user-facing message clearly match the intended business rule.
## Individual Comments
### Comment 1
<location path="src/Economics.Core/Command/BankCommand.cs" line_range="24-26" />
<code_context>
args.Player.SendErrorMessage(GetString("请输入一个有效数值!"));
return true;
}
+ if(num < 0)
+ {
+ args.Player.SendErrorMessage(GetString("数值必须为正数!"));
+ return true;
+ }
</code_context>
<issue_to_address>
**question:** Clarify whether zero should be allowed given the "must be positive" error message.
`num < 0` treats `0` as valid, but the message "数值必须为正数!" typically means `num > 0`. If zero should be rejected, change the condition to `num <= 0`. If zero is allowed, update the message to something like "数值必须为非负数" to match the logic.
</issue_to_address>帮我变得更有用!请在每条评论上点击 👍 或 👎,我会根据你的反馈改进后续的评审。
Original comment in English
Hey - I've found 1 issue, and left some high level feedback:
- The new negative-value check in
NumberValidatoris good, but the conditionif(num < 0)has inconsistent spacing compared to the rest of the file (if (num < 0)), so it would be good to align this with the existing style. - Consider whether zero should be allowed here and, if not, update the condition and error message (e.g.,
num <= 0) so the validation logic and user-facing message clearly match the intended business rule.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The new negative-value check in `NumberValidator` is good, but the condition `if(num < 0)` has inconsistent spacing compared to the rest of the file (`if (num < 0)`), so it would be good to align this with the existing style.
- Consider whether zero should be allowed here and, if not, update the condition and error message (e.g., `num <= 0`) so the validation logic and user-facing message clearly match the intended business rule.
## Individual Comments
### Comment 1
<location path="src/Economics.Core/Command/BankCommand.cs" line_range="24-26" />
<code_context>
args.Player.SendErrorMessage(GetString("请输入一个有效数值!"));
return true;
}
+ if(num < 0)
+ {
+ args.Player.SendErrorMessage(GetString("数值必须为正数!"));
+ return true;
+ }
</code_context>
<issue_to_address>
**question:** Clarify whether zero should be allowed given the "must be positive" error message.
`num < 0` treats `0` as valid, but the message "数值必须为正数!" typically means `num > 0`. If zero should be rejected, change the condition to `num <= 0`. If zero is allowed, update the message to something like "数值必须为非负数" to match the logic.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
|
you forgot prevent player send big amount to other player example player balance 400sen do /bank pay 99999 to target player i think no handled corectly please check curencymanager.cs |
This comment was marked as outdated.
This comment was marked as outdated.
|
maybe in bank cash check if there no redemption relathionship added this in dedudct |
I believe the current plugin's currency exchange system has serious issues, and modifying it may require structural changes. |
|
tmd |
添加插件
更新插件/修复BUG
其他
Summary by Sourcery
错误修复:
Original summary in English
Summary by Sourcery
Bug Fixes: