Skip to content

Commit

Permalink
支持自动登录游戏
Browse files Browse the repository at this point in the history
  • Loading branch information
ok-oldking committed Oct 14, 2024
1 parent c4aea96 commit fcacbe5
Show file tree
Hide file tree
Showing 6 changed files with 131 additions and 40 deletions.
Binary file added assets/images/54.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
95 changes: 60 additions & 35 deletions assets/result.json
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,12 @@
"height": 2160,
"id": 53,
"file_name": "images/53.png"
},
{
"width": 3840,
"height": 2160,
"id": 54,
"file_name": "images/54.png"
}
],
"categories": [
Expand Down Expand Up @@ -748,74 +754,78 @@
},
{
"id": 105,
"name": "monthly_card"
"name": "login_account"
},
{
"id": 106,
"name": "multiplayer_world_mark"
"name": "monthly_card"
},
{
"id": 107,
"name": "pick_up_f_hcenter_vcenter"
"name": "multiplayer_world_mark"
},
{
"id": 108,
"name": "purple_target_distance_icon"
"name": "pick_up_f_hcenter_vcenter"
},
{
"id": 109,
"name": "remove_custom"
"name": "purple_target_distance_icon"
},
{
"id": 110,
"name": "revive_confirm_hcenter_vcenter"
"name": "remove_custom"
},
{
"id": 111,
"name": "set_name_0"
"name": "revive_confirm_hcenter_vcenter"
},
{
"id": 112,
"name": "set_name_1"
"name": "set_name_0"
},
{
"id": 113,
"name": "set_name_2"
"name": "set_name_1"
},
{
"id": 114,
"name": "set_name_3"
"name": "set_name_2"
},
{
"id": 115,
"name": "set_name_4"
"name": "set_name_3"
},
{
"id": 116,
"name": "set_name_5"
"name": "set_name_4"
},
{
"id": 117,
"name": "set_name_6"
"name": "set_name_5"
},
{
"id": 118,
"name": "set_name_7"
"name": "set_name_6"
},
{
"id": 119,
"name": "set_name_8"
"name": "set_name_7"
},
{
"id": 120,
"name": "skip_quest_confirm"
"name": "set_name_8"
},
{
"id": 121,
"name": "target_enemy_white"
"name": "skip_quest_confirm"
},
{
"id": 122,
"name": "target_enemy_white"
},
{
"id": 123,
"name": "ww"
}
],
Expand Down Expand Up @@ -1168,7 +1178,7 @@
{
"id": 23,
"image_id": 8,
"category_id": 110,
"category_id": 111,
"segmentation": [],
"bbox": [
2887.0,
Expand Down Expand Up @@ -1543,7 +1553,7 @@
{
"id": 48,
"image_id": 21,
"category_id": 109,
"category_id": 110,
"segmentation": [],
"bbox": [
3083.8938053097336,
Expand Down Expand Up @@ -1618,7 +1628,7 @@
{
"id": 53,
"image_id": 24,
"category_id": 108,
"category_id": 109,
"segmentation": [],
"bbox": [
2090.0,
Expand Down Expand Up @@ -1753,7 +1763,7 @@
{
"id": 62,
"image_id": 28,
"category_id": 105,
"category_id": 106,
"segmentation": [],
"bbox": [
1555.0000000000002,
Expand Down Expand Up @@ -1783,7 +1793,7 @@
{
"id": 64,
"image_id": 30,
"category_id": 107,
"category_id": 108,
"segmentation": [],
"bbox": [
2440.9999999999995,
Expand Down Expand Up @@ -1843,7 +1853,7 @@
{
"id": 68,
"image_id": 33,
"category_id": 121,
"category_id": 122,
"segmentation": [],
"bbox": [
1688.0,
Expand Down Expand Up @@ -1873,7 +1883,7 @@
{
"id": 70,
"image_id": 34,
"category_id": 106,
"category_id": 107,
"segmentation": [],
"bbox": [
76.77271661865221,
Expand All @@ -1888,7 +1898,7 @@
{
"id": 71,
"image_id": 35,
"category_id": 120,
"category_id": 121,
"segmentation": [],
"bbox": [
2296.991150442478,
Expand Down Expand Up @@ -2053,7 +2063,7 @@
{
"id": 82,
"image_id": 39,
"category_id": 111,
"category_id": 112,
"segmentation": [],
"bbox": [
2010.731069247442,
Expand All @@ -2068,7 +2078,7 @@
{
"id": 83,
"image_id": 39,
"category_id": 113,
"category_id": 114,
"segmentation": [],
"bbox": [
2010.138498421424,
Expand All @@ -2083,7 +2093,7 @@
{
"id": 84,
"image_id": 39,
"category_id": 114,
"category_id": 115,
"segmentation": [],
"bbox": [
1475.0999455437145,
Expand All @@ -2098,7 +2108,7 @@
{
"id": 85,
"image_id": 39,
"category_id": 119,
"category_id": 120,
"segmentation": [],
"bbox": [
1742.61922198257,
Expand All @@ -2113,7 +2123,7 @@
{
"id": 86,
"image_id": 39,
"category_id": 118,
"category_id": 119,
"segmentation": [],
"bbox": [
1207.5806691048583,
Expand All @@ -2128,7 +2138,7 @@
{
"id": 87,
"image_id": 39,
"category_id": 116,
"category_id": 117,
"segmentation": [],
"bbox": [
134.87430187125648,
Expand All @@ -2143,7 +2153,7 @@
{
"id": 88,
"image_id": 39,
"category_id": 115,
"category_id": 116,
"segmentation": [],
"bbox": [
402.8245815888193,
Expand All @@ -2158,7 +2168,7 @@
{
"id": 89,
"image_id": 39,
"category_id": 112,
"category_id": 113,
"segmentation": [],
"bbox": [
2010.2654867256613,
Expand Down Expand Up @@ -2338,7 +2348,7 @@
{
"id": 101,
"image_id": 50,
"category_id": 117,
"category_id": 118,
"segmentation": [],
"bbox": [
1742.61922198257,
Expand Down Expand Up @@ -2394,6 +2404,21 @@
"ignore": 0,
"iscrowd": 0,
"area": 24511.23815490614
},
{
"id": 105,
"image_id": 54,
"category_id": 105,
"segmentation": [],
"bbox": [
3567.136929460579,
1187.5518672199169,
129.95850622406957,
103.07053941908717
],
"ignore": 0,
"iscrowd": 0,
"area": 13394.893338613647
}
],
"info": {
Expand All @@ -2402,6 +2427,6 @@
"description": "",
"contributor": "Label Studio",
"url": "",
"date_created": "2024-10-04 19:35:09.109616"
"date_created": "2024-10-14 23:31:11.716414"
}
}
3 changes: 2 additions & 1 deletion config.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ def calculate_pc_exe_path(running_path):
["src.task.AutoPickTask", "AutoPickTask"],
["src.task.SkipDialogTask", "AutoDialogTask"],
["src.task.MultiplayerAutoCombatTask", "MultiplayerAutoCombatTask"],
["src.task.MouseResetTask", "MouseResetTask"]
["src.task.MouseResetTask", "MouseResetTask"],
["src.task.AutoLoginTask", "AutoLoginTask"],
]
}
15 changes: 15 additions & 0 deletions i18n/en_US/LC_MESSAGES/ok.po
Original file line number Diff line number Diff line change
Expand Up @@ -560,3 +560,18 @@ msgstr ""

msgid "load chars success [Encore, ShoreKeeper, Xiangliyao]"
msgstr ""

msgid "Auto Echo Data Merge"
msgstr ""

msgid "Auto Login"
msgstr ""

msgid "Auto Login After Game Starts"
msgstr ""

msgid "Auto Start Game"
msgstr ""

msgid "Auto Start Game When App Starts"
msgstr ""
23 changes: 19 additions & 4 deletions i18n/zh_CN/LC_MESSAGES/ok.po
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#
msgid ""
msgstr ""

msgid ""
msgstr ""
"Project-Id-Version: 1.0\n"
Expand All @@ -9,9 +12,6 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"

msgid ""
msgstr ""

msgid "(1-6) Important, Choose which level to farm, lower levels might not produce a echo"
msgstr "(1-6) 重要, 选择你对应世界等级可以产出声骸的难度, 从上到下为1-6"

Expand Down Expand Up @@ -370,4 +370,19 @@ msgid "Data Merge Completed!"
msgstr "自动合成声骸完成!"

msgid "Auto combat error: Make sure you're equipping echos and turn off effect that changes the game color, (Game Gammar/Nvidia AMD Game Filter), turn off Motion Blur in game video options"
msgstr "自动战斗错误:请确认已装备声骸,关闭运动模糊,游戏为默认亮度,并关闭夜灯模式/显示器高级色彩/显卡滤镜等一切改变游戏颜色的配置."
msgstr "自动战斗错误:请确认已装备声骸,关闭运动模糊,游戏为默认亮度,并关闭夜灯模式/显示器高级色彩/显卡滤镜等一切改变游戏颜色的配置."

msgid "Auto Login"
msgstr "自动登录游戏"

msgid "Auto Login After Game Starts"
msgstr "游戏启动后自动登录游戏"

msgid "Auto Start Game"
msgstr "自动启动游戏"

msgid "Auto Start Game When App Starts"
msgstr "APP启动后自动启动游戏"

msgid "Auto Login Success"
msgstr "自动登录成功"
35 changes: 35 additions & 0 deletions src/task/AutoLoginTask.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
from qfluentwidgets import FluentIcon

from ok.logging.Logger import get_logger
from ok.task.TriggerTask import TriggerTask
from src.task.BaseWWTask import BaseWWTask

logger = get_logger(__name__)


class AutoLoginTask(BaseWWTask, TriggerTask):

def __init__(self):
super().__init__()
self.default_config = {'_enabled': True}
self.trigger_interval = 5
self.name = "Auto Login"
self.description = "Auto Login After Game Starts"
self.icon = FluentIcon.ACCEPT
self._logged_in = False

def trigger(self):
if self._logged_in:
pass
elif self.in_team_and_world():
self._logged_in = True
elif self.find_one('login_account', threshold=0.7):
self.wait_until(lambda: self.find_one('login_account', threshold=0.7) is None,
pre_action=lambda: self.click_relative(0.5, 0.9),
wait_until_check_delay=3, time_out=20)
self.wait_until(lambda: self.find_one('monthly_card', threshold=0.7) or self.in_team_and_world(),
pre_action=lambda: self.click_relative(0.5, 0.9),
wait_until_check_delay=3, time_out=60)
self.click_relative(0.5, 0.9)
self.log_info('Auto Login Success', notify=True)
self._logged_in = True

0 comments on commit fcacbe5

Please sign in to comment.