Skip to content

战斗学院优化xxx#136

Merged
Q1213a merged 19 commits into
masterfrom
dev
May 20, 2026
Merged

战斗学院优化xxx#136
Q1213a merged 19 commits into
masterfrom
dev

Conversation

@Q1213a
Copy link
Copy Markdown
Collaborator

@Q1213a Q1213a commented May 20, 2026

No description provided.

a2893005741 and others added 19 commits May 19, 2026 09:33
1. 拆分海里数数据到独立的坐标轴计算与渲染逻辑
2. 新增左侧资产刻度标签绘制函数,动态适配资产显示
3. 调整侧边距计算逻辑,根据是否有资产数据动态调整左侧内边距
4. 优化额外坐标轴的判断条件,分离海里数轴逻辑
1. 修正海里数初始最小值的初始值错误
2. 新增虚拟资产和资产轴的范围自动计算
3. 重构左侧刻度绘制函数,移除堆叠配置数组改为直接条件渲染
4. 统一使用主图表轴坐标对齐左侧资产刻度
调整了初始极值的初始化值,新增最小值判断逻辑并添加了范围边距,让图表纵轴展示更合理
1.  抽离通用范围计算函数,减少重复代码
2.  统一管理布局常量,替换分散的硬编码配置
3.  拆分独立轴的Y轴计算函数,修复虚拟资产和资产轴的绘制问题
4.  统一刻度绘制的循环逻辑,使用常量控制刻度数量
优化图表轴系划分,将虚拟资产和资产系列从组合轴中拆分,仅保留黄币使用组合轴,简化hasCombined判断逻辑,同时调整对应刻度绘制的偏移和注释说明
1. 拆分海里数数据到独立的坐标轴计算与渲染逻辑
2. 新增左侧资产刻度标签绘制函数,动态适配资产显示
3. 调整侧边距计算逻辑,根据是否有资产数据动态调整左侧内边距
4. 优化额外坐标轴的判断条件,分离海里数轴逻辑

## Summary by Sourcery

重构图表坐标轴处理逻辑,将距离从合并的币种/资产坐标轴中分离,并支持为虚拟资产以及左侧资产提供独立的标签。

新功能:
- 增加独立的距离坐标轴,拥有自己的取值范围、缩放方式以及右侧刻度配置。
- 为虚拟资产和与主 AP 坐标轴刻度对齐的资产添加左侧刻度标签。

改进:
- 调整内边距,在存在资产或虚拟资产序列时动态增加左侧边距。
- 更新距离序列的渲染和悬停珠标位置计算,使其使用新的专用距离坐标轴。

<details>
<summary>Original summary in English</summary>

## Summary by Sourcery

Refactor chart axis handling to separate distance from the combined
coin/asset axis and support dedicated labels for virtual assets and
assets on the left side.

New Features:
- Add an independent distance axis with its own value range, scaling,
and right-side tick configuration.
- Add left-side tick labels for virtual assets and assets aligned with
the main AP axis ticks.

Enhancements:
- Adjust padding to dynamically increase left margin when asset or
virtual asset series are present.
- Update distance series rendering and hover bead positioning to use the
new dedicated distance axis.

</details>

<details>
<summary>Original summary in English</summary>

## Summary by Sourcery

重构图表坐标轴处理逻辑,将距离从合并的币种/资产坐标轴中分离,并支持为虚拟资产以及左侧资产提供独立的标签。

新功能:
- 增加独立的距离坐标轴,拥有自己的取值范围、缩放方式以及右侧刻度配置。
- 为虚拟资产和与主 AP 坐标轴刻度对齐的资产添加左侧刻度标签。

改进:
- 调整内边距,在存在资产或虚拟资产序列时动态增加左侧边距。
- 更新距离序列的渲染和悬停珠标位置计算,使其使用新的专用距离坐标轴。

<details>
<summary>Original summary in English</summary>

## Summary by Sourcery

Refactor chart axis handling to separate distance from the combined
coin/asset axis and support dedicated labels for virtual assets and
assets on the left side.

New Features:
- Add an independent distance axis with its own value range, scaling,
and right-side tick configuration.
- Add left-side tick labels for virtual assets and assets aligned with
the main AP axis ticks.

Enhancements:
- Adjust padding to dynamically increase left margin when asset or
virtual asset series are present.
- Update distance series rendering and hover bead positioning to use the
new dedicated distance axis.

</details>

</details>
Copy link
Copy Markdown

@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.

Sorry @Q1213a, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@Q1213a Q1213a merged commit 5099fe2 into master May 20, 2026
6 checks passed
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a RapidTrainingSkipFilter configuration to allow specific tactical training slots to bypass "RedToBlue" and "NoT4" filters. It also improves skill experience OCR, refines tactical training slot detection using a grid-based approach, and enhances event loop handling in the WebUI. Review feedback highlights a potential TypeError in handle_rapid_training if the slot variable is not an integer and suggests more robust error handling for OCR failures in _read_skill_exp to avoid unexpected behavior in calling methods.

# do_not_use
return False

slot_name = ['slot_1', 'slot_2', 'slot_3', 'slot_4'][slot]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

The variable slot is used here but its definition is not visible in the provided diff hunk for handle_rapid_training. If slot is derived from self.config.Tactical_RapidTrainingSlot and that value is a string (e.g., "slot_1"), the subsequent calculation slot * 220 will cause a TypeError. Please ensure slot is an integer index (0-3) before using it for coordinate calculations and list indexing.

Comment on lines +207 to +227
def _read_skill_exp(self, image, retry=True):
from module.base.utils import crop
if self._skill_exp_ocr is None:
self._skill_exp_ocr = AlOcr(name='zhcn' if self.config.SERVER == 'cn' else 'en')
area = OCR_SKILL_EXP.button
cropped = crop(image, area, copy=False)
text = self._skill_exp_ocr.ocr(cropped)

match = re.search(r'(\d+)\s*/\s*(\d+)', text)
if match:
current, total = int(match.group(1)), int(match.group(2))
if current > total and retry:
logger.warning(f'Skill exp OCR mismatch: {current}>{total}, retrying')
self.device.screenshot()
return self._read_skill_exp(self.device.image, retry=False)
current = min(current, total)
logger.info(f'[_read_skill_exp] {text} -> {current}/{total}')
return current, total - current, total

logger.warning(f'Skill exp OCR failed: {text}')
return 0, 0, 0
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The _read_skill_exp method returns (0, 0, 0) when OCR fails. This might lead to incorrect behavior in callers. For example, in _is_current_skill_max, if total is 0, it correctly returns False. However, in _tactical_books_filter_exp, if total is 0, the logic might skip filtering or behave unexpectedly depending on how remain is used. Consider returning None or raising an exception on failure to allow callers to handle OCR errors explicitly.

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.

4 participants