Skip to content

Conversation

@Nanboom233
Copy link
Contributor

@Nanboom233 Nanboom233 commented Sep 10, 2025

after u2 update
check #318

Nanboom233 and others added 30 commits June 22, 2025 16:59
uiautomator2==3.4.0 depends on adbutils>=2.9.3,<2.10.0, so it requires a dependency version bump
# Conflicts:
#	core/Baas_thread.py
#	core/image.py
#	main.py
#	module/ExploreTasks/TaskUtils.py
#	module/ExploreTasks/explore_task.py
#	module/__init__.py
…pr-activity-refactor)

Moved all individual activity definition files into a new `activitiy_data`
subpackage. This improves module organization by separating activity data
from core logic, making the `module/activities` directory cleaner.
Adds a `if __name__ == "__main__":` guard, allowing direct execution
of the `update_activity()` function. This facilitates easier testing,
debugging, and manual runs of the activity update process without
needing to import the module elsewhere.
… (activity-refactor)

This new GitHub Actions workflow automates the regular synchronization
of game activities. It runs daily to execute `activity_updater.py`,
ensuring that the script always uses the latest game data. This reduces
manual intervention and keeps the repository's activity data fresh.
The workflow name was updated for conciseness and to adopt a more
programmatic naming convention. This makes the name easier to read
and reference within the GitHub Actions UI and logs.
… add output function (activity-refactor)

Introduces a data merging strategy for activity information,
prioritizing BAWiki, then SchaleDB, and finally Gamekee API.
This ensures the most complete and accurate data is used.

Adds logic to prevent redundant file updates if no changes are
detected in the activity data. The output JSON now maintains a
consistent key order for better readability and stability.
…rmat (pr-activity-refactor)

Redirect the activity update script's console output to a Markdown
log file. This enhances observability by persisting detailed
information about API responses and the final merged data.

The output format has also been improved with Markdown headers,
code blocks, and direct links to the data sources, making the
log easier to read and understand. The new log file is ignored
by Git to prevent unnecessary commits.
The workflow now automatically copies the newly generated
`tmp_activity.json` to `activity.json` upon successful update.
An update log (`activity_update_log.md`) is now uploaded as an
artifact for review. A pull request is automatically created
if the activity data is updated, using the update log as the PR body.
This streamlines the process of keeping activity data current
and reduces manual intervention for publishing updates.
…actor)

Replaced direct assignment to sys.stdout/stderr with contextlib.redirect_stdout
and redirect_stderr. This ensures output streams are safely restored, even
if errors occur, preventing state leakage and improving robustness.

Additionally, updated file path construction to use os.path.join and
os.path.dirname(__file__). This makes the script more reliable by resolving
file paths relative to the script's location, ensuring it functions
correctly regardless of the current working directory.
@pur1fying
Copy link
Owner

  1. 在 update_activity_bawiki() 方法中重复出现的以下request.get --> etree.HTML 方法可以提取一个函数
image
  1. 有关日志, 建议使用logging库, 并将日志打印在终端, 这样在github action中可以直接查看, 写入文件的格式并不需要为md格式, 另外日志可以再详细一些, 并记录错误(如果网络未连通会直接抛出异常)
  2. gamekee的api需要额外记录
  • 未开启的活动的起始 / 结束时间
  • 已开启的双倍 / 三倍活动的起始和结束时间,
  • 未开启的 双倍/三倍活动
    也就是说最终每一条记录都应该是列表的形式
  1. BASIC_RESULT_FORMAT 中Rewards字段需要调整为
"Rewards": {
        "Commissions": [],
        "Scrimmage": [],
        "Bounty": [],
        "Schedule": [],
        "normal_task": [],
        "hard_task": [],
        "level_exp": []
}

即调整了

  • 字段名称
  • 按照3. 调整结果为列表
  1. 按照3. 调整Raids字段为列表
"Raids": {
    "total_assault": [],
    "grand_assault": [],
    "limit_break_assault": [],
    "joint_firing_drill": []
}

目前来看发现以上需要修改的问题

@Nanboom233
Copy link
Contributor Author

  1. 上述格式问题大致有数,本版本是先可运行来考虑的,很多异常处理都没有做,后续会再重构优化
  2. 我个人反对使用logging库,因为没有必要。首先该模块日志量不大,且也并不是作为baas的函数来运行,作为一个简单的脚本加入logging库并无必要。关于md格式,在处理之初是思考着复用到pr的body上来设计的,的确缺失了很多日志,这部分后续会修改
  3. 与其关注是否加入未开放的活动,当下更应该解决的问题是 a.维护者能否及时检查合并新的活动数据 b.后续函数具体设计。 显然,加入未开放的活动有利于开发者未及时更新的问题,但同时也要考虑代码的设计协调问题。结构调整4,5同样出自以上相同理由,需要更多的考量。如果需要未开放的数据,或许一个新的结构会是更好的答案

@pur1fying
Copy link
Owner

  1. 上述格式问题大致有数,本版本是先可运行来考虑的,很多异常处理都没有做,后续会再重构优化
  2. 我个人反对使用logging库,因为没有必要。首先该模块日志量不大,且也并不是作为baas的函数来运行,作为一个简单的脚本加入logging库并无必要。关于md格式,在处理之初是思考着复用到pr的body上来设计的,的确缺失了很多日志,这部分后续会修改
  3. 与其关注是否加入未开放的活动,当下更应该解决的问题是 a.维护者能否及时检查合并新的活动数据 b.后续函数具体设计。 显然,加入未开放的活动有利于开发者未及时更新的问题,但同时也要考虑代码的设计协调问题。结构调整4,5同样出自以上相同理由,需要更多的考量。如果需要未开放的数据,或许一个新的结构会是更好的答案
  1. 用logging库是需要在控制台及时看到日志, 由于api下载的数据较多, 运行一次脚本耗时较长, 如果在github action运行, 要等完全运行完毕才能看到上传的日志, 无法实时关注运行状态
  2. 你没有理解这个pr的意义, 更新活动信息是为了让BAAS在不同活动交错开启时选择性的消耗体力, 记录的活动时间范围越大越好, 而不是只记录运行这个脚本时的活动状态

@Nanboom233
Copy link
Contributor Author

Nanboom233 commented Sep 13, 2025 via email

@pur1fying
Copy link
Owner

  1. logging是标准库, 不存在大不大的问题, 目前场景需要同时写入文件和控制台就是它最佳使用时机
  2. 活动不只是游戏里有特殊货币的活动, 还包括 普通图 / 困难图 / 特殊委托 的 双倍 / 三倍, 要实现的效果, 举一个简单的例子, 在仅有特殊委托双倍开启时把所有体力投入特殊委托, 而在仅有普通图双倍时把体力扫荡普通图, BAAS在不同活动开启时将体力投入最高收益的活动, 可以理解吗?

@Nanboom233
Copy link
Contributor Author

Nanboom233 commented Sep 13, 2025 via email

Nanboom233 and others added 9 commits September 19, 2025 19:04
…c (pr-activity-updater)

Integrate header mapping and column management directly into
`_fetch_activity_table`, removing the redundant `_table_transform`
helper function. Introduce `DEFAULT_HEADER_MAP` for consistent column
renaming and dropping across various activity tables.

This refactoring adds a `force_list` parameter to `_fetch_activity_table`
for flexible return types and streamlines activity object creation in
`update_activity_bawiki`.

This refactoring also removes redundant codes in `update_activity_gamekee_api`
Consolidate localization data and simplify activity parsing logic.

This commit refactors the activity data processing by:
- Introducing a unified `localization_dict` for event and raid names,
  reducing redundant data structures.
- Simplifying the logic for assigning raid data to the result
  dictionary using a `raid_type_translator`.
- Renaming `regularized_activity` to `activity_info` for better
  clarity and consistency.
- Standardizing time variable names to `begin_time` and `end_time`.
- Removing unnecessary trailing commas in requests headers.
…vability

Replaced ad-hoc print statements with structured logging for better
output management and debugging. Introduced a retry mechanism for
network requests to improve robustness against temporary network issues.
Added comprehensive error handling, including exiting with an error code
on failure, which is beneficial for CI/CD pipelines. Automated the
generation of a detailed pull request markdown body, including a diff of
activity.json changes, to streamline code reviews and provide clear
context for updates.
…flow

* Initial plan

* Add maintainer notification to sync_activity workflow

Co-authored-by: Nanboom233 <[email protected]>

* Clean up __pycache__ and update .gitignore

Co-authored-by: Nanboom233 <[email protected]>

* fix: Only notify repository owner for activity sync PRs

Co-authored-by: Nanboom233 <[email protected]>

* fix: Dynamically read repository owner for notifications

Co-authored-by: Nanboom233 <[email protected]>

* chore(activity-updater): Discard an unnecessary .gitignore commit

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: Nanboom233 <[email protected]>
@Nanboom233
Copy link
Contributor Author

1.refactor,合并大量相似方法
2.改进log输出,使用Logging
3.改进pr body,更直观
4.增加pr提醒owner review
示例: Nanboom233/blue_archive_auto_script#17

@Nanboom233
Copy link
Contributor Author

基本功能已经完成,该pr的目标也完成
后续功能会新开pr

@Nanboom233
Copy link
Contributor Author

目前刷取倍数获取疑似还有些问题

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