Skip to content

Conversation

clansty
Copy link
Collaborator

@clansty clansty commented Sep 24, 2025

中二 XVerse 似乎修改了用户名的编码,导致打完 1PC 之后用户名变成 ????
然后,还有一种修复方式是不允许覆盖现有的用户名,但是这样的话第一 PC 也会炸
所以现在是进行了版本号的对比。要是 ICF 什么的有问题的话,那就自求多福吧

Sourcery 总结

Bug 修复:

  • 仅对低于 2.40 的客户端版本应用 fromChusanUsername 转换,在新版本上保留原始用户名
Original summary in English

Summary by Sourcery

Bug Fixes:

  • Only apply fromChusanUsername conversion for client versions below 2.40, preserving original usernames on newer versions

Copy link
Contributor

sourcery-ai bot commented Sep 24, 2025

审阅者指南

对 XVerse API 数据应用版本检查,仅对低于 2.40 版本的用户名进行有选择的解码,而对于更新版本则保留原始用户名。

文件级别更改

更改 详情 文件
用户数据更新时有条件地解码用户名
  • 从传入的 API 数据中提取“version”并解析为 double 类型
  • 如果 version ≥ 2.40,直接赋值 userName;否则调用 fromChusanUsername()
  • 保留备用默认版本 "0.00" 和安全解析
src/main/java/icu/samnyan/aqua/sega/chusan/handler/ChusanUpsertApis.kt
对选择和对手字段进行有条件地用户名解码
  • 复用版本提取和解析逻辑
  • 对于 version ≥ 2.40,保持 selectUserName 和 opponentUserName1–3 不变
  • 对于旧版本,应用 fromChusanUsername() 转换
src/main/java/icu/samnyan/aqua/sega/chusan/handler/ChusanUpsertApis.kt

提示和命令

与 Sourcery 交互

  • 触发新的审阅: 在拉取请求上评论 @sourcery-ai review
  • 继续讨论: 直接回复 Sourcery 的审阅评论。
  • 从审阅评论生成 GitHub issue: 通过回复审阅评论,请求 Sourcery 从中创建一个 issue。你也可以回复审阅评论并带上 @sourcery-ai issue 来创建一个 issue。
  • 生成拉取请求标题: 在拉取请求标题的任意位置写入 @sourcery-ai 即可随时生成标题。你也可以在拉取请求上评论 @sourcery-ai title 来随时(重新)生成标题。
  • 生成拉取请求摘要: 在拉取请求正文的任意位置写入 @sourcery-ai summary 即可随时在你想要的位置生成 PR 摘要。你也可以在拉取请求上评论 @sourcery-ai summary 来随时(重新)生成摘要。
  • 生成审阅者指南: 在拉取请求上评论 @sourcery-ai guide 即可随时(重新)生成审阅者指南。
  • 解决所有 Sourcery 评论: 在拉取请求上评论 @sourcery-ai resolve 以解决所有 Sourcery 评论。如果你已经解决了所有评论并且不想再看到它们,这会很有用。
  • 关闭所有 Sourcery 审阅: 在拉取请求上评论 @sourcery-ai dismiss 以关闭所有现有的 Sourcery 审阅。如果你想重新开始一个新的审阅,这会特别有用——别忘了评论 @sourcery-ai review 来触发新的审阅!

自定义你的体验

访问你的 仪表板 以:

  • 启用或禁用审阅功能,例如 Sourcery 生成的拉取请求摘要、审阅者指南等。
  • 更改审阅语言。
  • 添加、删除或编辑自定义审阅说明。
  • 调整其他审阅设置。

获取帮助

Original review guide in English

Reviewer's Guide

Apply a version check on XVerse API data to selectively decode usernames only for versions below 2.40, preserving original usernames for newer versions.

File-Level Changes

Change Details Files
Conditional username decoding during user data upsert
  • Extract ‘version’ from incoming API data and parse to double
  • If version ≥ 2.40, assign userName directly; otherwise call fromChusanUsername()
  • Retain fallback default version "0.00" and safe parsing
src/main/java/icu/samnyan/aqua/sega/chusan/handler/ChusanUpsertApis.kt
Conditional username decoding for select and opponent fields
  • Reuse version extraction and parsing logic
  • For version ≥ 2.40, leave selectUserName and opponentUserName1–3 unchanged
  • For older versions, apply fromChusanUsername() conversion
src/main/java/icu/samnyan/aqua/sega/chusan/handler/ChusanUpsertApis.kt

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

你好 - 我已审阅你的更改 - 以下是一些反馈意见:

  • 版本解析和比较逻辑在两个代码块中重复,请将其提取到一个辅助函数中以避免重复。
  • 使用 toDoubleOrNull 进行版本比较可能无法正确处理“2.4.1”等语义化版本格式;请考虑使用一个合适的语义化版本比较库。
  • 版本 ≥ 2.40 的分支执行了空操作赋值(例如 selectUserName = selectUserName);这些可以简化或完全删除。
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The version parsing and comparison logic is duplicated in both blocks – extract it into a single helper function to avoid repetition.
- Using toDoubleOrNull for version comparison may break on semantic formats like “2.4.1”; consider using a proper semantic version comparator library.
- The branches for version ≥ 2.40 perform no-op assignments (e.g. selectUserName = selectUserName); these can be simplified or removed entirely.

## Individual Comments

### Comment 1
<location> `src/main/java/icu/samnyan/aqua/sega/chusan/handler/ChusanUpsertApis.kt:105-107` </location>
<code_context>
+                // 版本 >= 2.40 时不需要转换用户名编码,直接使用原始用户名
+                val version = data["version"] as? String ?: "0.00"
+                val versionNumber = version.toDoubleOrNull() ?: 0.0
+                if (versionNumber >= 2.40) {
+                    // 2.40及以上版本直接使用原始用户名
+                    selectUserName = selectUserName
+                    opponentUserName1 = opponentUserName1
+                    opponentUserName2 = opponentUserName2
</code_context>

<issue_to_address>
**nitpick:** Redundant assignment of variable to itself.

These assignments can be removed to improve code clarity, as they do not change the variable values.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
帮助我更有用!请点击每个评论上的 👍 或 👎,我将根据反馈改进你的审阅。
Original comment in English

Hey there - I've reviewed your changes - here's some feedback:

  • The version parsing and comparison logic is duplicated in both blocks – extract it into a single helper function to avoid repetition.
  • Using toDoubleOrNull for version comparison may break on semantic formats like “2.4.1”; consider using a proper semantic version comparator library.
  • The branches for version ≥ 2.40 perform no-op assignments (e.g. selectUserName = selectUserName); these can be simplified or removed entirely.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The version parsing and comparison logic is duplicated in both blocks – extract it into a single helper function to avoid repetition.
- Using toDoubleOrNull for version comparison may break on semantic formats like “2.4.1”; consider using a proper semantic version comparator library.
- The branches for version ≥ 2.40 perform no-op assignments (e.g. selectUserName = selectUserName); these can be simplified or removed entirely.

## Individual Comments

### Comment 1
<location> `src/main/java/icu/samnyan/aqua/sega/chusan/handler/ChusanUpsertApis.kt:105-107` </location>
<code_context>
+                // 版本 >= 2.40 时不需要转换用户名编码,直接使用原始用户名
+                val version = data["version"] as? String ?: "0.00"
+                val versionNumber = version.toDoubleOrNull() ?: 0.0
+                if (versionNumber >= 2.40) {
+                    // 2.40及以上版本直接使用原始用户名
+                    selectUserName = selectUserName
+                    opponentUserName1 = opponentUserName1
+                    opponentUserName2 = opponentUserName2
</code_context>

<issue_to_address>
**nitpick:** Redundant assignment of variable to itself.

These assignments can be removed to improve code clarity, as they do not change the variable values.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@raymonable raymonable merged commit d830854 into MewoLab:v1-dev Sep 30, 2025
1 check passed
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.

2 participants