Repository navigation
fix(基础库): 修复团队面板气血刷新取到空值的问题 - #120
Merged
yefansky merged 1 commit intoOct 26, 2026
Merged
Conversation
29.0.12 中 GetCharacterLife 直接返回 fCurrentLife64 / fMaxLife64。但该函数的 入参不只 userdata:MY_CataclysmParty、MY_LifeBar 等会把 X.GetTeamMemberInfo 返回的普通 table 传进来,这类 table 只有 nCurrentLife / nMaxLife,取 f 字段 得到 nil,最终在 MY_CataclysmParty 的 math.max(1, fMaxLife) 处抛出 bad argument tinymins#2 to 'max' (number expected, got nil),团队面板气血刷新中断。 改为按字段是否存在取值:有 fCurrentLife64 / fMaxLife64 就用(多管血 NPC 拿到 的是引擎展开后的总血池),没有则回退 nCurrentLife / nMaxLife(普通 table 与 单管角色)。缘起与重制版行为一致,也不再依赖 IS_REMAKE 判断。
yefansky
approved these changes
Oct 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
29.0.12 发布后,团队面板在气血刷新时会抛错并中断:
真机复现环境:重制版(
zhcn)客户端,组队后打开团队面板即持续报错。原因
29.0.12 把
GetCharacterLife改成了直接返回 64 位字段:这个函数不只有 userdata 入参。
MY_CataclysmParty、MY_LifeBar等会把它传给X.GetTeamMemberInfo(dwID)的返回值,而那是MY_!Base/src/lib/Game.Team.lua里构造的普通 Lua table:只有
nCurrentLife/nMaxLife,没有fCurrentLife64/fMaxLife64。于是取到nil, nil,回退逻辑拿到的也是nil,最后落在math.max(1, fMaxLife)上抛错。触发路径(
MY_CataclysmParty.lua):修复
改为按字段是否存在取值,不再依赖版本判断:
f字段,拿到的是引擎按nMaxLifeCount展开后的总血池 —— 29.0.12 想修的多管血百分比问题依然修好GetTeamMemberInfo的普通 table:没有f字段,回退单管值 —— 不再得到nil验证
本地用 lua5.1 对四种实现 × 三种入参做了对照:
nMaxLife = 3,728,359,500、nMaxLifeCount = 1、fMaxLife64 = 7,456,719,000,百分比从错误的 73% 变为正确的 36%lua5.1语法检查通过真机已在内网缘起环境验证团队面板不再报错、焦点列表百分比正确。重制版环境的回归验证欢迎协助确认。
说明
GetCharacterLife一处,未动MY_CataclysmParty的回退逻辑(那边的math.max本身缺判空,但既是既有代码,也与本次回归无关,可另开一单处理)。CHANGELOG.md里把 29.0.12 遗留的「未发布」段合并为本次一条记录。