Skip to content

Commit 1ecb8f1

Browse files
committed
first build
1 parent 8e56427 commit 1ecb8f1

File tree

6 files changed

+370
-102
lines changed

6 files changed

+370
-102
lines changed

.github/workflows/build.yml

Lines changed: 43 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,41 @@ jobs:
4040
set PYTHONLEGACYWINDOWSSTDIO=utf-8
4141
echo PYTHONIOENCODING=utf-8 >> $GITHUB_ENV
4242
43-
- name: Get Changes between Tags
44-
id: changes
45-
uses: simbo/changes-between-tags-action@v1
46-
with:
47-
validate-tag: false
43+
- name: Get last release tag
44+
id: last_release
45+
run: |
46+
CURRENT_TAG="${{ github.event.release.tag_name }}" # Tag of the current release
47+
48+
# Use the GitHub API to find the most recent non-prerelease release
49+
RESPONSE=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
50+
"https://api.github.com/repos/${{ github.repository }}/releases" | jq -c '.[].tag_name')
51+
52+
# jq parses JSON, and can efficiently find the latest non-prerelease tag
53+
LAST_RELEASE_TAG=$(echo "$RESPONSE" | jq -r '. | select( . != "'"$CURRENT_TAG"'" ) | first')
54+
55+
# Check if no previous release tag found (first release)
56+
if [[ -z "$LAST_RELEASE_TAG" ]]; then
57+
LAST_RELEASE_TAG=$(git rev-list --max-parents=0 HEAD) # Get the initial commit
58+
echo "No previous release found. Using initial commit: $LAST_RELEASE_TAG"
59+
fi
60+
61+
echo "Current Tag: $CURRENT_TAG"
62+
echo "Last Release Tag: $LAST_RELEASE_TAG"
63+
echo "current_tag=$CURRENT_TAG" >> "$GITHUB_OUTPUT"
64+
echo "last_release_tag=$LAST_RELEASE_TAG" >> "$GITHUB_OUTPUT"
65+
66+
- name: Get commit messages
67+
id: commit_messages
68+
run: |
69+
LAST_RELEASE_TAG="${{ steps.last_release.outputs.last_release_tag }}"
70+
CURRENT_TAG="${{ steps.last_release.outputs.current_tag }}"
71+
72+
COMMIT_MESSAGES=$(git log --pretty=format:"%s" "${LAST_RELEASE_TAG}..${CURRENT_TAG}")
73+
echo "Commit Messages:"
74+
echo "$COMMIT_MESSAGES"
75+
echo "commit_messages<<EOF" >> "$GITHUB_OUTPUT"
76+
echo "$COMMIT_MESSAGES" >> "$GITHUB_OUTPUT"
77+
echo "EOF" >> "$GITHUB_OUTPUT"
4878
4979
- name: Get tag name
5080
id: tagName
@@ -78,13 +108,12 @@ jobs:
78108
79109
- name: Build Executable
80110
run: |
81-
echo "tag: ${{ steps.changes.outputs.tag }}"
82-
echo "changes: ${{ steps.changes.outputs.changes }}"
111+
echo "changes: ${{ steps.commit_messages.outputs.commit_messages }}
83112
84113
python -m ok.update.package_launcher ${{ steps.tagName.outputs.tag }} deploy.txt
85-
Copy-Item -Path "dist" -Destination "ok-ls" -Recurse
86-
7z a -t7z -r "ok-ls-full-${{ steps.tagName.outputs.tag }}.7z" "ok-ls"
87-
Remove-Item -Path "ok-ls" -Recurse -Force
114+
Copy-Item -Path "dist" -Destination "ok-gf2" -Recurse
115+
7z a -t7z -r "ok-gf2-${{ steps.tagName.outputs.tag }}.7z" "ok-gf2"
116+
Remove-Item -Path "ok-gf2" -Recurse -Force
88117
89118
shell: pwsh
90119

@@ -93,12 +122,12 @@ jobs:
93122
if: startsWith(github.ref, 'refs/tags/')
94123
with:
95124
body: |
96-
ok-ls-CPU-full (AMD or other GPUs)
125+
ok-gf2
97126
Updates:
98-
${{ steps.changes.outputs.changes }}
127+
${{ steps.commit_messages.outputs.commit_messages }}
99128
files: |
100-
ok-ls-full-${{ steps.tagName.outputs.tag }}.7z
129+
ok-gf2-${{ steps.tagName.outputs.tag }}.7z
101130
102131
- name: push to coding
103132
run: |
104-
python -m ok.update.push_repos --repos https://${{ secrets.CODING_USERNAME }}:${{ secrets.CODING_PASSWORD }}@e.coding.net/g-frfh1513/ok-wuthering-waves/ok-ls.git --files deploy.txt --tag ${{ steps.tagName.outputs.tag }}
133+
python -m ok.update.push_repos --repos https://${{ secrets.CODING_USERNAME }}:${{ secrets.CODING_PASSWORD }}@e.coding.net/g-frfh1513/ok-wuthering-waves/ok-gf2.git --files deploy.txt --tag ${{ steps.tagName.outputs.tag }}

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
1. 支持PC版(无法后台)和模拟器(可后台推荐MuMu12国内版, 截图较快)
2+
2. 仅支持游戏语言为简体中文
3+
3. 一键除了活动的所有日常收菜
4+
5+
*** 下载

config.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import os
2-
31
version = "v5.0.11"
42

53
config = {
@@ -24,7 +22,7 @@
2422
'bit_blt_render_full': True,
2523
'check_hdr': False,
2624
'force_no_hdr': False,
27-
'check_night_light': True,
25+
# 'check_night_light': True,
2826
'force_no_night_light': False,
2927
'require_bg': True
3028
},
@@ -37,7 +35,7 @@
3735
# 'default_threshold': 0.78,
3836
# },
3937
'adb': {
40-
'packages': ['com.haoplay.game.and.exilium']
38+
'packages': ['com.Sunborn.SnqxExilium', 'com.haoplay.game.and.exilium']
4139
},
4240
'window_size': {
4341
'width': 1200,

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ numpy==2.1.3
5353
# rapidocr-openvino
5454
# shapely
5555
pydirectinput==1.0.4
56-
ok-script==0.0.447
56+
ok-script==0.0.452
5757
# via -r .\requirements.in
5858
opencv-contrib-python==4.10.0.84
5959
# via -r .\requirements.in

src/tasks/BaseGfTask.py

Lines changed: 74 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import re
2-
import sys
3-
import time
42

5-
from ok import BaseTask
3+
from ok import BaseTask, find_boxes_within_boundary, find_boxes_by_name
64
from ok import Logger
75

86
logger = Logger.get_logger(__name__)
@@ -18,19 +16,48 @@ def __init__(self, *args, **kwargs):
1816
# sys.exit(1)
1917

2018
def ensure_main(self, recheck_time=1, time_out=30, esc=True):
19+
self.info_set('current_task', 'go_to_main')
2120
if not self.wait_until(lambda: self.is_main(recheck_time=recheck_time, esc=esc), time_out=time_out):
2221
raise Exception("请从游戏主页进入")
2322

23+
def auto_battle(self, end_match=None, end_box=None):
24+
self.info_set('current_task', 'auto battle')
25+
result = self.wait_ocr(match=['作战开始', '行动结束'], box='bottom', time_out=60,
26+
raise_if_not_found=True)
27+
if result[0].name == '作战开始':
28+
self.click_box(result, after_sleep=1)
29+
start_result = self.wait_ocr(match=['行动结束', re.compile('还有可部署')],
30+
raise_if_not_found=True, time_out=30)
31+
if '还有可部署' in start_result[0].name:
32+
self.log_error('阵容没上满, 请上阵后再点击继续任务, 不支持选择助战!', notify=True)
33+
self.pause()
34+
self.wait_click_ocr(match=['作战开始'], box='bottom', time_out=5,
35+
raise_if_not_found=True)
36+
self.wait_ocr(match=['行动结束'],
37+
raise_if_not_found=True, time_out=30)
38+
self.sleep(0.5)
39+
self.click_relative(0.85, 0.05, after_sleep=1)
40+
result = self.wait_ocr(match=['任务完成', '任务失败', '战斗失败'], raise_if_not_found=True, time_out=600)
41+
if result[0].name == '任务失败':
42+
raise Exception('任务失败, 没打过!')
43+
else:
44+
self.click(result[0])
45+
if result[0].name != '战斗失败':
46+
self.wait_click_ocr(match='确认', box='bottom_right', raise_if_not_found=True, time_out=5)
47+
if end_match and end_box:
48+
self.wait_ocr(match=end_match, box=end_box, raise_if_not_found=True, time_out=30)
49+
self.sleep(0.5)
50+
2451
def is_main(self, recheck_time=0, esc=True):
25-
boxes = self.ocr(match=['整备室','公共区','招募'], box='right')
52+
boxes = self.ocr(match=['整备室', '公共区', '招募'], box='right')
2653
if len(boxes) == 3:
2754
if recheck_time:
2855
self.sleep(recheck_time)
2956
return self.is_main(recheck_time=0, esc=False)
3057
else:
3158
return True
3259
# if not self.do_handle_alert()[0]:
33-
if box:=self.ocr(box="bottom", match=["点击开始", "点击空白处关闭"],
60+
if box := self.ocr(box="bottom", match=["点击开始", "点击空白处关闭"],
3461
log=True):
3562
self.click(box)
3663
return False
@@ -40,3 +67,45 @@ def is_main(self, recheck_time=0, esc=True):
4067
# self.do_handle_alert()
4168
self.next_frame()
4269

70+
def find_top_right_count(self):
71+
result = self.ocr(0.89, 0.01, 0.99, 0.1, match=re.compile(r"^\d+/\d+$"), box='top_right')
72+
if not result:
73+
raise Exception('找不到当前体力或票')
74+
return int(result[0].name.split('/')[0])
75+
76+
def fast_combat(self):
77+
self.wait_click_ocr(match=['自律'], box='bottom_right', after_sleep=1, raise_if_not_found=True)
78+
boxes = self.ocr()
79+
current = find_boxes_within_boundary(boxes, self.box_of_screen(0.84, 0, 0.99, 0.10))[0].name
80+
current = int(current.split('/')[0])
81+
if len(find_boxes_by_name(boxes, ["确认", "取消"])) != 2:
82+
self.log_info("自律没有弹窗, 可能是调度权限不足")
83+
return current
84+
85+
cost = int(find_boxes_within_boundary(boxes, self.box_of_screen(0.48, 0.56, 0.57, 0.67))[0].name)
86+
battle_max = int(find_boxes_within_boundary(boxes, self.box_of_screen(0.61, 0.50, 0.66, 0.57))[0].name)
87+
88+
self.info_set('current_stamina', current)
89+
self.info_set('battle_cost', cost)
90+
self.info_set('battle_max', battle_max)
91+
can_fast_count = min(int(current / cost), battle_max)
92+
self.info_set('can_fast_count', can_fast_count)
93+
self.info_set('click_battle_plus', 0)
94+
remaining = current - can_fast_count * cost
95+
self.info_set('remaining_stamina', remaining)
96+
for _ in range(can_fast_count - 1):
97+
self.click(0.68, 0.54)
98+
self.info_incr('click_battle_plus')
99+
self.sleep(0.2)
100+
if can_fast_count > 0:
101+
self.click(find_boxes_by_name(boxes, "确认"))
102+
self.wait_pop_up()
103+
else:
104+
self.click(find_boxes_by_name(boxes, "取消"))
105+
return remaining
106+
107+
def wait_pop_up(self, time_out=15):
108+
return self.wait_click_ocr(match=['点击空白处关闭', '点击屏幕任意位置继续'], box='bottom', time_out=time_out,
109+
after_sleep=2,
110+
recheck_time=1,
111+
raise_if_not_found=False)

0 commit comments

Comments
 (0)