Compare commits
24 Commits
testBranch
...
master
Author | SHA1 | Date |
---|---|---|
|
a51c8117d0 | |
|
b5d63d1d00 | |
|
11edbf3abf | |
|
3f8f9f708f | |
|
18aa1843cd | |
|
8733294f13 | |
|
fee0ecfe75 | |
|
fb4ad30d03 | |
|
2623106212 | |
|
16c7792b7f | |
|
2a852388bf | |
|
50559223ed | |
|
6b0de05a80 | |
|
155394ab75 | |
|
794bf9d30b | |
|
6157eb1e40 | |
|
db728f21ba | |
|
cbe0074c70 | |
|
3a247d6ce1 | |
|
e7d21a90bb | |
|
8b12ca9dae | |
|
76b6c6cb79 | |
|
2b121be258 | |
|
eefb47476a |
4
app.py
4
app.py
|
@ -3,6 +3,7 @@ from flask_restful import Api
|
|||
|
||||
from modules.KF3.database import Database as KF3DB
|
||||
from modules.Kingdom.database import Database as KFKDB
|
||||
from modules.proxy import AgreementProxy, LaunchProxy, UpdateProxy
|
||||
|
||||
app = Flask(__name__)
|
||||
app.config['JSON_AS_ASCII'] = False
|
||||
|
@ -10,6 +11,9 @@ app.databases = {}
|
|||
|
||||
api = Api(app)
|
||||
|
||||
api.add_resource(LaunchProxy, "/DMM/launch")
|
||||
api.add_resource(UpdateProxy, "/DMM/filelist", "/DMM/update")
|
||||
api.add_resource(AgreementProxy, "/DMM/agreement")
|
||||
KF3DB(api)
|
||||
KFKDB(api)
|
||||
|
||||
|
|
|
@ -123,7 +123,7 @@ class Database:
|
|||
chara = {}
|
||||
|
||||
charaData = self.charaData[id]
|
||||
alphaBase = self.paramAlphaBases[id]
|
||||
alphaBase = self.paramAlphaBases[id] if id in self.paramAlphaBases else None
|
||||
|
||||
wrLocked = False
|
||||
promoIds = []
|
||||
|
@ -190,6 +190,12 @@ class Database:
|
|||
else:
|
||||
level_curve = self.limitlevel_rising_status[patternId] if patternId != 0 else None
|
||||
|
||||
if alphaBase is None:
|
||||
chara["stats_min"] = {"level" : 0,"status" : 0,"wr" : 0,"hp" : 0,"atk" : 0,"def" : 0,"evd" : 0,"beat" : 0,"act" : 0,"try" : 0}
|
||||
chara["stats_max"] = {"level" : 0,"status" : 0,"wr" : 0,"hp" : 0,"atk" : 0,"def" : 0,"evd" : 0,"beat" : 0,"act" : 0,"try" : 0}
|
||||
chara["plasmPoint"] = 0
|
||||
chara["cards"] = {0,0,0,0,0}
|
||||
else:
|
||||
chara["stats_min"] = get_all_stats(chara, alphaBase, max_level = False, rising_status_pattern=level_curve)
|
||||
chara["stats_max"] = get_all_stats(chara, alphaBase, max_level = True, rising_status_pattern=level_curve)
|
||||
chara["plasmPoint"] = alphaBase["plasmPoint"]
|
||||
|
@ -200,6 +206,7 @@ class Database:
|
|||
{"type":alphaBase["orderCardType03"], "value":alphaBase["orderCardValue03"]},
|
||||
{"type":alphaBase["orderCardType04"], "value":alphaBase["orderCardValue04"]}
|
||||
]
|
||||
|
||||
chara["synergy_flag"] = self.paramArts[id]["authParam"]["SynergyFlag"] if id in self.paramArts else 0
|
||||
|
||||
chara["arts"] = self.paramArts[id] if id in self.paramArts else None
|
||||
|
|
|
@ -82,7 +82,10 @@ async def download_cache(server_name, server : str):
|
|||
file.write(data)
|
||||
with open(file_path_json, "wt", encoding="utf-8") as out_file:
|
||||
data = gzip.decompress(data)
|
||||
json.dump(json.loads(data), out_file, ensure_ascii=False, indent=1)
|
||||
data = json.loads(data)
|
||||
# if key == "GACHA_DATA":
|
||||
# download_banners(data, server_name)
|
||||
json.dump(data, out_file, ensure_ascii=False, indent=1)
|
||||
|
||||
old_mst_ver[key] = new_mst_ver[key]
|
||||
|
||||
|
@ -93,6 +96,36 @@ async def download_cache(server_name, server : str):
|
|||
await session.close()
|
||||
return downloaded_files
|
||||
|
||||
async def download_banners(gacha_data, server_name, session):
|
||||
path = f"/var/www/html/Katworks/KF/assets/KF3/{server_name}/banners/"
|
||||
os.makedirs(path, exist_ok=True)
|
||||
|
||||
for entry in gacha_data:
|
||||
banner_name = entry["banner"]
|
||||
if banner_name == "" or banner_name == None:
|
||||
continue
|
||||
banner_name += ".png"
|
||||
file_path = path + banner_name
|
||||
if os.path.exists(file_path):
|
||||
continue
|
||||
|
||||
file_url = "https://parade-mobile-prod-cdn.kemono-friends-3.jp/Texture2D/GachaTop/" + banner_name
|
||||
file_url_alt = "https://parade-mobile-develop01-app.kemono-friends-3.jp/Texture2D/GachaTop/" + banner_name
|
||||
|
||||
status = 0
|
||||
async with session.get(file_url) as resp:
|
||||
response = await resp.read()
|
||||
status = resp.status
|
||||
if status != 200:
|
||||
async with session.get(file_url_alt) as resp:
|
||||
response = await resp.read()
|
||||
status = resp.status
|
||||
if status != 200: continue
|
||||
|
||||
with open(file_path, "wb") as file:
|
||||
file.write(response)
|
||||
|
||||
|
||||
async def download_files(server_name, asset_bundle_url, srv_platform : str):
|
||||
def parse_ab_list(filecontent : str):
|
||||
out = {}
|
||||
|
@ -194,6 +227,15 @@ async def convert_files():
|
|||
print("Conversion failed", f)
|
||||
|
||||
async def manual():
|
||||
|
||||
# session = aiohttp.ClientSession()
|
||||
|
||||
# path = f"/var/www/html/Katworks/KF/assets/KF3/{server_name}/cache/"
|
||||
|
||||
# await session.close()
|
||||
|
||||
# return
|
||||
|
||||
downloaded_cache = {}
|
||||
downloaded_files = {}
|
||||
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
from flask_restful import Resource
|
||||
from flask import current_app as app, request, Request
|
||||
|
||||
import requests
|
||||
|
||||
def relayRequest(user_request : Request, url, headers):
|
||||
with requests.Session() as session:
|
||||
requests.utils.add_dict_to_cookiejar(session.cookies, user_request.cookies)
|
||||
response = session.post(url, headers=headers, data=request.data)
|
||||
|
||||
result = app.response_class(
|
||||
response=response.text,
|
||||
status=200,
|
||||
mimetype='application/json'
|
||||
)
|
||||
result.headers.add("Access-Control-Allow-Origin", "*")
|
||||
|
||||
return result
|
||||
|
||||
class LaunchProxy(Resource):
|
||||
def post(self):
|
||||
url = "https://apidgp-gameplayer.games.dmm.com/v5/launch/cl"
|
||||
headers = {"User-Agent": "DMMGamePlayer5-Win/5.3.12 Electron/32.1.0",
|
||||
"Client-App": "DMMGamePlayer5",
|
||||
"Client-version": "5.3.12",
|
||||
"Content-Type": "application/json"}
|
||||
|
||||
return relayRequest(request, url, headers)
|
||||
|
||||
class UpdateProxy(Resource):
|
||||
def post(self):
|
||||
url = "https://apidgp-gameplayer.games.dmm.com/v5/r2/launch/cl"
|
||||
headers = {"User-Agent": "DMMGamePlayer5-Win/5.3.12 Electron/32.1.0",
|
||||
"Client-App": "DMMGamePlayer5",
|
||||
"Client-version": "5.3.12",
|
||||
"Content-Type": "application/json"}
|
||||
|
||||
return relayRequest(request, url, headers)
|
||||
|
||||
class AgreementProxy(Resource):
|
||||
def post(self):
|
||||
url = "https://apidgp-gameplayer.games.dmm.com/v5/agreement/confirm/client"
|
||||
headers = {"User-Agent": "DMMGamePlayer5-Win/5.3.12 Electron/32.1.0",
|
||||
"Client-App": "DMMGamePlayer5",
|
||||
"Client-version": "5.3.12",
|
||||
"Content-Type": "application/json"}
|
||||
|
||||
return relayRequest(request, url, headers)
|
|
@ -0,0 +1,2 @@
|
|||
#!/usr/bin/env bash
|
||||
gunicorn --bind 127.0.0.1:8081 --config gunicorn_config.py wsgi:app
|
Loading…
Reference in New Issue