loginBonusDb

This commit is contained in:
Remik1r3n
2025-06-11 10:01:09 +08:00
parent 31361541fd
commit 6bab65983d
4 changed files with 332 additions and 252 deletions

View File

@@ -3,6 +3,9 @@
import rapidjson as json
from loguru import logger
import xml.etree.ElementTree as ET
from Config import *
from API_TitleServer import apiSDGB
@@ -73,22 +76,23 @@ def generateLoginBonusList(UserLoginBonusList, generateMode=1):
# アップデートがある場合、このファイルを更新する必要があります
# 必ず最新のデータを使用してください
try:
with open(loginBonusDBPath, encoding='utf-8') as file:
cache = json.load(file)
tree = ET.parse(loginBonusDBPath)
root = tree.getroot()
loginBonusIdList = [int(item.find('id').text) for item in root.findall('.//StringID')]
logger.debug(f"ログインボーナスIDリスト: {loginBonusIdList}")
except FileNotFoundError:
try:
with open(loginBonusDBPathFallback, encoding='utf-8') as file:
cache = json.load(file)
tree = ET.parse(loginBonusDBPathFallback)
root = tree.getroot()
loginBonusIdList = [int(item.find('id').text) for item in root.findall('.//StringID')]
logger.debug(f"ログインボーナスIDリスト: {loginBonusIdList}")
except:
raise FileNotFoundError("ログインボーナスデータベースを読み込めません")
loginBonusIdList = [item['id'] for item in cache]
logger.debug(f"ログインボーナスIDリスト: {loginBonusIdList}")
# ログインボーナスの MAX POINT は5の場合があります
# その全部のボーナスIDをこのリストに追加してください
# 必ず最新のデータを使用してください
Bonus5Id = [12, 29, 30, 38, 43, 604]
Bonus5Id = [12, 29, 30, 38, 43, 604, 611]
# UserBonusList から bonusId を取得
UserLoginBonusIdList = [item['bonusId'] for item in UserLoginBonusList]