This commit is contained in:
parent
47a12b9839
commit
2aa76570f7
16 changed files with 377 additions and 179 deletions
|
@ -1,3 +1,22 @@
|
|||
"""
|
||||
Copyright (c) 2024 Elaina <2901432375@qq.com>
|
||||
Copyright (c) 2024 zhbaor <zhbaor@zhaozuohong.vip>
|
||||
|
||||
This file is part of mower-ng (https://git.zhaozuohong.vip/mower-ng/mower-ng).
|
||||
|
||||
Mower-ng is free software: you may copy, redistribute and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation, version 3 or later.
|
||||
|
||||
This file is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
"""
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
from mower.utils.recognize.data import color, template_matching, template_matching_score
|
||||
|
|
|
@ -1,3 +1,21 @@
|
|||
"""
|
||||
Copyright (c) 2024 zhbaor <zhbaor@zhaozuohong.vip>
|
||||
|
||||
This file is part of mower-ng (https://git.zhaozuohong.vip/mower-ng/mower-ng).
|
||||
|
||||
Mower-ng is free software: you may copy, redistribute and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation, version 3 or later.
|
||||
|
||||
This file is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
"""
|
||||
|
||||
from mower.data import scene_list
|
||||
|
||||
scene_class = "class Scene:"
|
||||
|
|
18
manager.py
18
manager.py
|
@ -1,5 +1,23 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
"""
|
||||
Copyright (c) 2024 zhbaor <zhbaor@zhaozuohong.vip>
|
||||
|
||||
This file is part of mower-ng (https://git.zhaozuohong.vip/mower-ng/mower-ng).
|
||||
|
||||
Mower-ng is free software: you may copy, redistribute and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation, version 3 or later.
|
||||
|
||||
This file is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
"""
|
||||
|
||||
import json
|
||||
import mimetypes
|
||||
|
||||
|
|
|
@ -1,3 +1,25 @@
|
|||
"""
|
||||
Copyright (c) 2024 xxyz30 <ts187579@163.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
"""
|
||||
|
||||
# from https://gitee.com/FancyCabbage/skyland-auto-sign
|
||||
|
||||
import base64
|
||||
|
|
|
@ -1,3 +1,23 @@
|
|||
"""
|
||||
Copyright (c) 2024 EightyDollars <eightydollars@163.com>
|
||||
Copyright (c) 2024 Elaina <2901432375@qq.com>
|
||||
Copyright (c) 2024 zhbaor <zhbaor@zhaozuohong.vip>
|
||||
|
||||
This file is part of mower-ng (https://git.zhaozuohong.vip/mower-ng/mower-ng).
|
||||
|
||||
Mower-ng is free software: you may copy, redistribute and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation, version 3 or later.
|
||||
|
||||
This file is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
"""
|
||||
|
||||
from functools import partial
|
||||
from typing import Callable
|
||||
|
||||
|
|
|
@ -1,3 +1,21 @@
|
|||
"""
|
||||
Copyright (c) 2024 zhbaor <zhbaor@zhaozuohong.vip>
|
||||
|
||||
This file is part of mower-ng (https://git.zhaozuohong.vip/mower-ng/mower-ng).
|
||||
|
||||
Mower-ng is free software: you may copy, redistribute and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation, version 3 or later.
|
||||
|
||||
This file is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
"""
|
||||
|
||||
import json
|
||||
from typing import Dict, List, Optional
|
||||
from zlib import compress, decompress
|
||||
|
|
|
@ -1,3 +1,21 @@
|
|||
"""
|
||||
Copyright (c) 2024 zhbaor <zhbaor@zhaozuohong.vip>
|
||||
|
||||
This file is part of mower-ng (https://git.zhaozuohong.vip/mower-ng/mower-ng).
|
||||
|
||||
Mower-ng is free software: you may copy, redistribute and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation, version 3 or later.
|
||||
|
||||
This file is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
"""
|
||||
|
||||
from rapidocr_onnxruntime import RapidOCR
|
||||
|
||||
from mower.utils import typealias as tp
|
||||
|
|
|
@ -1,3 +1,44 @@
|
|||
"""
|
||||
Copyright (c) 2024 zhbaor <zhbaor@zhaozuohong.vip>
|
||||
|
||||
This file is part of mower-ng (https://git.zhaozuohong.vip/mower-ng/mower-ng).
|
||||
|
||||
Mower-ng is free software: you may copy, redistribute and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation, version 3 or later.
|
||||
|
||||
This file is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
This file incorporates work covered by the following copyright and
|
||||
permission notice:
|
||||
|
||||
Copyright (c) 2023 Shawnsdaddy <wu2xx@dukes.jmu.edu>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
"""
|
||||
|
||||
import copy
|
||||
from datetime import datetime, timedelta
|
||||
from enum import Enum
|
||||
|
@ -18,8 +59,6 @@ class TaskTypes(Enum):
|
|||
CLUE_PARTY = ("Impart", "趴体", 2)
|
||||
MAA_MALL = ("maa_Mall", "MAA信用购物", 2)
|
||||
NOT_SPECIFIC = ("", "空任务", 2)
|
||||
RECRUIT = ("recruit", "公招", 2)
|
||||
SKLAND = ("skland", "森空岛签到", 2)
|
||||
RE_ORDER = ("宿舍排序", "宿舍排序", 2)
|
||||
RELEASE_DORM = ("释放宿舍空位", "释放宿舍空位", 2)
|
||||
REFRESH_TIME = ("强制刷新任务时间", "强制刷新任务时间", 2)
|
||||
|
|
|
@ -1,3 +1,45 @@
|
|||
"""
|
||||
Copyright (c) 2024 fuyn101 <fuynshile@outlook.com>
|
||||
Copyright (c) 2024 zhbaor <zhbaor@zhaozuohong.vip>
|
||||
|
||||
This file is part of mower-ng (https://git.zhaozuohong.vip/mower-ng/mower-ng).
|
||||
|
||||
Mower-ng is free software: you may copy, redistribute and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation, version 3 or later.
|
||||
|
||||
This file is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
This file incorporates work covered by the following copyright and
|
||||
permission notice:
|
||||
|
||||
Copyright (c) 2023 xxyz30 <ts187579@163.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
"""
|
||||
|
||||
import hashlib
|
||||
import hmac
|
||||
import json
|
||||
|
|
|
@ -1,3 +1,53 @@
|
|||
"""
|
||||
Copyright (c) 2024 EightyDollars <eightydollars@163.com>
|
||||
Copyright (c) 2024 Elaina <2901432375@qq.com>
|
||||
Copyright (c) 2024 fuyn101 <fuynshile@outlook.com>
|
||||
Copyright (c) 2024 zhbaor <zhbaor@zhaozuohong.vip>
|
||||
|
||||
This file is part of mower-ng (https://git.zhaozuohong.vip/mower-ng/mower-ng).
|
||||
|
||||
Mower-ng is free software: you may copy, redistribute and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation, version 3 or later.
|
||||
|
||||
This file is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
This file incorporates work covered by the following copyright and
|
||||
permission notice:
|
||||
|
||||
Copyright (c) 2023 BiologyHazard <3482991796@qq.com>
|
||||
Copyright (c) 2023 minine <<xxz@ixoixi.com>>
|
||||
Copyright (c) 2024 MuelNova <muel@nova.gal>
|
||||
Copyright (c) 2021 Nano <nanoapezlk@gmail.com>
|
||||
Copyright (c) 2023 Peace2F <https://github.com/Peace2F>
|
||||
Copyright (c) 2022 rebelice <yangrebelice@gmail.com>
|
||||
Copyright (c) 2023 Shawnsdaddy <wu2xx@dukes.jmu.edu>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
"""
|
||||
|
||||
import random
|
||||
from abc import abstractmethod
|
||||
from datetime import datetime, timedelta
|
||||
|
|
|
@ -1,3 +1,47 @@
|
|||
"""
|
||||
Copyright (c) 2024 zhbaor <zhbaor@zhaozuohong.vip>
|
||||
|
||||
This file is part of mower-ng (https://git.zhaozuohong.vip/mower-ng/mower-ng).
|
||||
|
||||
Mower-ng is free software: you may copy, redistribute and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation, version 3 or later.
|
||||
|
||||
This file is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
This file incorporates work covered by the following copyright and
|
||||
permission notice:
|
||||
|
||||
Copyright (c) 2022 yuanyan3060 <1846865993@qq.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
如果你的产品或项目,直接或间接使用了本仓库中的内容
|
||||
请注明出处并包括github url: https://github.com/yuanyan3060/Arknights-Tile-Pos
|
||||
"""
|
||||
|
||||
import math
|
||||
from dataclasses import dataclass
|
||||
from typing import Any, List, Optional, Tuple
|
||||
|
|
|
@ -1,3 +1,29 @@
|
|||
"""
|
||||
Copyright (c) 2024 fuyn101 <fuynshile@outlook.com>
|
||||
Copyright (c) 2024 zhbaor <zhbaor@zhaozuohong.vip>
|
||||
|
||||
This file is part of mower-ng (https://git.zhaozuohong.vip/mower-ng/mower-ng).
|
||||
|
||||
Mower-ng is free software: you may copy, redistribute and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation, version 3 or later.
|
||||
|
||||
This file is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
This file incorporates work covered by the following copyright and
|
||||
permission notice:
|
||||
|
||||
Copyright (c) 2024 Kache <https://stackoverflow.com/users/234593/kache>
|
||||
|
||||
CC BY-SA 4.0
|
||||
"""
|
||||
|
||||
import inspect
|
||||
import itertools
|
||||
from pathlib import Path
|
||||
|
|
|
@ -1,3 +1,24 @@
|
|||
"""
|
||||
Copyright (c) 2024 Elaina <2901432375@qq.com>
|
||||
Copyright (c) 2024 fuyn101 <fuynshile@outlook.com>
|
||||
Copyright (c) 2024 zhbaor <zhbaor@zhaozuohong.vip>
|
||||
|
||||
This file is part of mower-ng (https://git.zhaozuohong.vip/mower-ng/mower-ng).
|
||||
|
||||
Mower-ng is free software: you may copy, redistribute and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation, version 3 or later.
|
||||
|
||||
This file is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
"""
|
||||
|
||||
|
||||
def translate_room(room):
|
||||
translations = {
|
||||
"room": lambda parts: f"B{parts[1]}0{parts[2]}",
|
||||
|
|
|
@ -1,3 +1,22 @@
|
|||
"""
|
||||
Copyright (c) 2024 Elaina <2901432375@qq.com>
|
||||
Copyright (c) 2024 zhbaor <zhbaor@zhaozuohong.vip>
|
||||
|
||||
This file is part of mower-ng (https://git.zhaozuohong.vip/mower-ng/mower-ng).
|
||||
|
||||
Mower-ng is free software: you may copy, redistribute and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation, version 3 or later.
|
||||
|
||||
This file is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
"""
|
||||
|
||||
from mower.utils import typealias as tp
|
||||
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ permission notice:
|
|||
|
||||
Copyright (c) 2023 Ks-luow <1048879349@qq.com>
|
||||
Copyright (c) 2024 MuelNova <muel@nova.gal>
|
||||
Copyright (c) 2023 Peace2F <144162630+Peace2F@users.noreply.github.com>
|
||||
Copyright (c) 2023 Peace2F <https://github.com/Peace2F>
|
||||
Copyright (c) 2023 Shawnsdaddy <wu2xx@dukes.jmu.edu>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
|
|
176
明日方舟森空岛数据.py
176
明日方舟森空岛数据.py
|
@ -1,176 +0,0 @@
|
|||
import hashlib
|
||||
import hmac
|
||||
import json
|
||||
import time
|
||||
from urllib import parse
|
||||
|
||||
import requests
|
||||
|
||||
app_code = "4ca99fa6b56cc2ba"
|
||||
|
||||
# 签到url
|
||||
sign_url = "https://zonai.skland.com/api/v1/game/attendance"
|
||||
# 绑定的角色url
|
||||
binding_url = "https://zonai.skland.com/api/v1/game/player/binding"
|
||||
# 验证码url
|
||||
login_code_url = "https://as.hypergryph.com/general/v1/send_phone_code"
|
||||
# 验证码登录
|
||||
token_phone_code_url = "https://as.hypergryph.com/user/auth/v2/token_by_phone_code"
|
||||
# 密码登录
|
||||
token_password_url = "https://as.hypergryph.com/user/auth/v1/token_by_phone_password"
|
||||
# 使用token获得认证代码
|
||||
grant_code_url = "https://as.hypergryph.com/user/oauth2/v2/grant"
|
||||
# 使用认证代码获得cred
|
||||
cred_code_url = "https://zonai.skland.com/api/v1/user/auth/generate_cred_by_code"
|
||||
|
||||
|
||||
class SKLand:
|
||||
def __init__(
|
||||
self,
|
||||
):
|
||||
self.record_path = "./skland.csv"
|
||||
self.account_list = []
|
||||
|
||||
self.account_list.append(
|
||||
{
|
||||
"account": "account",
|
||||
"isCheck": True,
|
||||
"password": "password",
|
||||
}
|
||||
)
|
||||
self.header = {
|
||||
"cred": "",
|
||||
"User-Agent": "Skland/1.0.1 (com.hypergryph.skland; build:100001014; Android 31; ) Okhttp/4.11.0",
|
||||
"Accept-Encoding": "gzip",
|
||||
"Connection": "close",
|
||||
}
|
||||
self.header_login = {
|
||||
"User-Agent": "Skland/1.0.1 (com.hypergryph.skland; build:100001014; Android 31; ) Okhttp/4.11.0",
|
||||
"Accept-Encoding": "gzip",
|
||||
"Connection": "close",
|
||||
}
|
||||
|
||||
self.reward = []
|
||||
# 签名请求头一定要这个顺序,否则失败
|
||||
# timestamp是必填的,其它三个随便填,不要为none即可
|
||||
self.header_for_sign = {"platform": "", "timestamp": "", "dId": "", "vName": ""}
|
||||
self.sign_token = ""
|
||||
self.all_recorded = True
|
||||
|
||||
def start(self):
|
||||
for item in self.account_list:
|
||||
self.all_recorded = False
|
||||
self.save_param(self.get_cred_by_token(self.log(item)))
|
||||
for i in self.get_binding_list():
|
||||
body = {"gameId": 1, "uid": i.get("uid")}
|
||||
ingame = f"https://zonai.skland.com/api/v1/game/player/info?uid={i.get('uid')}"
|
||||
resp = requests.get(
|
||||
ingame,
|
||||
headers=self.get_sign_header(ingame, "get", body, self.header),
|
||||
).json()
|
||||
with open("森空岛数据.json", "w", encoding="utf-8") as 保存:
|
||||
json.dump(resp, 保存, ensure_ascii=False, indent=4)
|
||||
print(resp["data"]["chars"])
|
||||
|
||||
def save_param(self, cred_resp):
|
||||
self.header["cred"] = cred_resp["cred"]
|
||||
self.sign_token = cred_resp["token"]
|
||||
|
||||
def log(self, account):
|
||||
r = requests.post(
|
||||
token_password_url,
|
||||
json={"phone": account["account"], "password": account["password"]},
|
||||
headers=self.header_login,
|
||||
).json()
|
||||
if r.get("status") != 0:
|
||||
raise Exception(f'获得token失败:{r["msg"]}')
|
||||
return r["data"]["token"]
|
||||
|
||||
def get_cred_by_token(self, token):
|
||||
return self.get_cred(self.get_grant_code(token))
|
||||
|
||||
def get_grant_code(self, token):
|
||||
response = requests.post(
|
||||
grant_code_url,
|
||||
json={"appCode": app_code, "token": token, "type": 0},
|
||||
headers=self.header_login,
|
||||
)
|
||||
resp = response.json()
|
||||
if response.status_code != 200:
|
||||
raise Exception(f"获得认证代码失败:{resp}")
|
||||
if resp.get("status") != 0:
|
||||
raise Exception(f'获得认证代码失败:{resp["msg"]}')
|
||||
return resp["data"]["code"]
|
||||
|
||||
def get_cred(self, grant):
|
||||
resp = requests.post(
|
||||
cred_code_url, json={"code": grant, "kind": 1}, headers=self.header_login
|
||||
).json()
|
||||
if resp["code"] != 0:
|
||||
raise Exception(f'获得cred失败:{resp["message"]}')
|
||||
return resp["data"]
|
||||
|
||||
def get_binding_list(self):
|
||||
v = []
|
||||
resp = requests.get(
|
||||
binding_url,
|
||||
headers=self.get_sign_header(binding_url, "get", None, self.header),
|
||||
).json()
|
||||
|
||||
if resp["code"] != 0:
|
||||
print(f"请求角色列表出现问题:{resp['message']}")
|
||||
if resp.get("message") == "用户未登录":
|
||||
print("用户登录可能失效了,请重新运行此程序!")
|
||||
return []
|
||||
for i in resp["data"]["list"]:
|
||||
if i.get("appCode") != "arknights":
|
||||
continue
|
||||
v.extend(i.get("bindingList"))
|
||||
return v
|
||||
|
||||
def get_sign_header(self, url: str, method, body, old_header):
|
||||
h = json.loads(json.dumps(old_header))
|
||||
p = parse.urlparse(url)
|
||||
if method.lower() == "get":
|
||||
h["sign"], header_ca = self.generate_signature(
|
||||
self.sign_token, p.path, p.query
|
||||
)
|
||||
else:
|
||||
h["sign"], header_ca = self.generate_signature(
|
||||
self.sign_token, p.path, json.dumps(body)
|
||||
)
|
||||
for i in header_ca:
|
||||
h[i] = header_ca[i]
|
||||
return h
|
||||
|
||||
def generate_signature(self, token: str, path, body_or_query):
|
||||
"""
|
||||
获得签名头
|
||||
接口地址+方法为Get请求?用query否则用body+时间戳+ 请求头的四个重要参数(dId,platform,timestamp,vName).toJSON()
|
||||
将此字符串做HMAC加密,算法为SHA-256,密钥token为请求cred接口会返回的一个token值
|
||||
再将加密后的字符串做MD5即得到sign
|
||||
:param token: 拿cred时候的token
|
||||
:param path: 请求路径(不包括网址)
|
||||
:param body_or_query: 如果是GET,则是它的query。POST则为它的body
|
||||
:return: 计算完毕的sign
|
||||
"""
|
||||
# 总是说请勿修改设备时间,怕不是yj你的服务器有问题吧,所以这里特地-2
|
||||
|
||||
t = str(int(time.time()) - 2)
|
||||
token = token.encode("utf-8")
|
||||
header_ca = json.loads(json.dumps(self.header_for_sign))
|
||||
header_ca["timestamp"] = t
|
||||
header_ca_str = json.dumps(header_ca, separators=(",", ":"))
|
||||
s = path + body_or_query + t + header_ca_str
|
||||
hex_s = hmac.new(token, s.encode("utf-8"), hashlib.sha256).hexdigest()
|
||||
md5 = (
|
||||
hashlib.md5(hex_s.encode("utf-8"))
|
||||
.hexdigest()
|
||||
.encode("utf-8")
|
||||
.decode("utf-8")
|
||||
)
|
||||
return md5, header_ca
|
||||
|
||||
|
||||
a = SKLand()
|
||||
a.start()
|
Loading…
Add table
Reference in a new issue