Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f39317301b | ||
|
|
389784ce82 | ||
|
|
2f13596885 | ||
|
|
85b73e634d | ||
|
|
09c4f8cda4 |
@@ -27,9 +27,9 @@ class Data:
|
||||
|
||||
if self.config.database.sha2_password:
|
||||
passwd = sha256(self.config.database.password.encode()).digest()
|
||||
self.__url = f"{self.config.database.protocol}://{self.config.database.username}:{passwd.hex()}@{self.config.database.host}/{self.config.database.name}?charset=utf8mb4"
|
||||
self.__url = f"{self.config.database.protocol}://{self.config.database.username}:{passwd.hex()}@{self.config.database.host}:{self.config.database.port}/{self.config.database.name}?charset=utf8mb4"
|
||||
else:
|
||||
self.__url = f"{self.config.database.protocol}://{self.config.database.username}:{self.config.database.password}@{self.config.database.host}/{self.config.database.name}?charset=utf8mb4"
|
||||
self.__url = f"{self.config.database.protocol}://{self.config.database.username}:{self.config.database.password}@{self.config.database.host}:{self.config.database.port}/{self.config.database.name}?charset=utf8mb4"
|
||||
|
||||
if Data.engine is None:
|
||||
Data.engine = create_engine(self.__url, pool_recycle=3600)
|
||||
@@ -94,7 +94,7 @@ class Data:
|
||||
game_mod.database(self.config)
|
||||
metadata.create_all(self.__engine.connect())
|
||||
|
||||
self.base.set_schema_ver(
|
||||
self.base.touch_schema_ver(
|
||||
game_mod.current_schema_version, game_mod.game_codes[0]
|
||||
)
|
||||
|
||||
|
||||
@@ -102,6 +102,18 @@ class BaseData:
|
||||
return None
|
||||
|
||||
return row["version"]
|
||||
|
||||
def touch_schema_ver(self, ver: int, game: str = "CORE") -> Optional[int]:
|
||||
sql = insert(schema_ver).values(game=game, version=ver)
|
||||
conflict = sql.on_duplicate_key_update(version=schema_ver.c.version)
|
||||
|
||||
result = self.execute(conflict)
|
||||
if result is None:
|
||||
self.logger.error(
|
||||
f"Failed to update schema version for game {game} (v{ver})"
|
||||
)
|
||||
return None
|
||||
return result.lastrowid
|
||||
|
||||
def set_schema_ver(self, ver: int, game: str = "CORE") -> Optional[int]:
|
||||
sql = insert(schema_ver).values(game=game, version=ver)
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
ALTER TABLE ongeki_static_events
|
||||
DROP COLUMN startDate;
|
||||
@@ -1,2 +0,0 @@
|
||||
ALTER TABLE ongeki_static_events
|
||||
ADD COLUMN startDate TIMESTAMP NOT NULL DEFAULT current_timestamp();
|
||||
@@ -51,7 +51,7 @@ ALTER TABLE mai2_item_favorite MODIFY COLUMN itemKind int(11) NOT NULL;
|
||||
|
||||
ALTER TABLE mai2_item_friend_season_ranking MODIFY COLUMN seasonId int(11) NOT NULL;
|
||||
ALTER TABLE mai2_item_friend_season_ranking MODIFY COLUMN point int(11) NOT NULL;
|
||||
ALTER TABLE mai2_item_friend_season_ranking MODIFY COLUMN rank int(11) NOT NULL;
|
||||
ALTER TABLE mai2_item_friend_season_ranking MODIFY COLUMN `rank` int(11) NOT NULL;
|
||||
ALTER TABLE mai2_item_friend_season_ranking MODIFY COLUMN rewardGet tinyint(1) NOT NULL;
|
||||
ALTER TABLE mai2_item_friend_season_ranking MODIFY COLUMN userName varchar(8) NOT NULL;
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ ALTER TABLE mai2_item_favorite MODIFY COLUMN itemKind int(11) NULL;
|
||||
|
||||
ALTER TABLE mai2_item_friend_season_ranking MODIFY COLUMN seasonId int(11) NULL;
|
||||
ALTER TABLE mai2_item_friend_season_ranking MODIFY COLUMN point int(11) NULL;
|
||||
ALTER TABLE mai2_item_friend_season_ranking MODIFY COLUMN rank int(11) NULL;
|
||||
ALTER TABLE mai2_item_friend_season_ranking MODIFY COLUMN `rank` int(11) NULL;
|
||||
ALTER TABLE mai2_item_friend_season_ranking MODIFY COLUMN rewardGet tinyint(1) NULL;
|
||||
ALTER TABLE mai2_item_friend_season_ranking MODIFY COLUMN userName varchar(8) NULL;
|
||||
|
||||
|
||||
+68
-13
@@ -4,6 +4,7 @@ from logging.handlers import TimedRotatingFileHandler
|
||||
from twisted.web import resource
|
||||
from twisted.web.http import Request
|
||||
from datetime import datetime
|
||||
from Crypto.Cipher import Blowfish
|
||||
import pytz
|
||||
|
||||
from core import CoreConfig
|
||||
@@ -56,18 +57,22 @@ class MuchaServlet:
|
||||
self.logger.error(
|
||||
f"Error processing mucha request {request.content.getvalue()}"
|
||||
)
|
||||
return b""
|
||||
return b"RESULTS=000"
|
||||
|
||||
req = MuchaAuthRequest(req_dict)
|
||||
self.logger.info(f"Boardauth request from {client_ip} for {req.gameVer}")
|
||||
self.logger.debug(f"Mucha request {vars(req)}")
|
||||
self.logger.info(f"Boardauth request from {client_ip} for {req.gameVer}")
|
||||
|
||||
if req.gameCd not in self.mucha_registry:
|
||||
self.logger.warn(f"Unknown gameCd {req.gameCd}")
|
||||
return b""
|
||||
return b"RESULTS=000"
|
||||
|
||||
# TODO: Decrypt S/N
|
||||
|
||||
#cipher = Blowfish.new(req.sendDate.encode(), Blowfish.MODE_ECB)
|
||||
#sn_decrypt = cipher.decrypt(bytes.fromhex(req.serialNum))
|
||||
#self.logger.debug(f"Decrypt SN to {sn_decrypt.hex()}")
|
||||
|
||||
resp = MuchaAuthResponse(
|
||||
f"{self.config.mucha.hostname}{':' + str(self.config.allnet.port) if self.config.server.is_develop else ''}"
|
||||
)
|
||||
@@ -84,22 +89,37 @@ class MuchaServlet:
|
||||
self.logger.error(
|
||||
f"Error processing mucha request {request.content.getvalue()}"
|
||||
)
|
||||
return b""
|
||||
return b"RESULTS=000"
|
||||
|
||||
req = MuchaUpdateRequest(req_dict)
|
||||
self.logger.info(f"Updatecheck request from {client_ip} for {req.gameVer}")
|
||||
self.logger.debug(f"Mucha request {vars(req)}")
|
||||
self.logger.info(f"Updatecheck request from {client_ip} for {req.gameVer}")
|
||||
|
||||
if req.gameCd not in self.mucha_registry:
|
||||
self.logger.warn(f"Unknown gameCd {req.gameCd}")
|
||||
return b""
|
||||
return b"RESULTS=000"
|
||||
|
||||
resp = MuchaUpdateResponseStub(req.gameVer)
|
||||
resp = MuchaUpdateResponse(req.gameVer, f"{self.config.mucha.hostname}{':' + str(self.config.allnet.port) if self.config.server.is_develop else ''}")
|
||||
|
||||
self.logger.debug(f"Mucha response {vars(resp)}")
|
||||
|
||||
return self.mucha_postprocess(vars(resp))
|
||||
|
||||
def handle_dlstate(self, request: Request, _: Dict) -> bytes:
|
||||
req_dict = self.mucha_preprocess(request.content.getvalue())
|
||||
client_ip = Utils.get_ip_addr(request)
|
||||
|
||||
if req_dict is None:
|
||||
self.logger.error(
|
||||
f"Error processing mucha request {request.content.getvalue()}"
|
||||
)
|
||||
return b""
|
||||
|
||||
req = MuchaDownloadStateRequest(req_dict)
|
||||
self.logger.info(f"DownloadState request from {client_ip} for {req.gameCd} -> {req.updateVer}")
|
||||
self.logger.debug(f"request {vars(req)}")
|
||||
return b"RESULTS=001"
|
||||
|
||||
def mucha_preprocess(self, data: bytes) -> Optional[Dict]:
|
||||
try:
|
||||
ret: Dict[str, Any] = {}
|
||||
@@ -202,22 +222,57 @@ class MuchaUpdateRequest:
|
||||
|
||||
class MuchaUpdateResponse:
|
||||
def __init__(self, game_ver: str, mucha_url: str) -> None:
|
||||
self.RESULTS = "001"
|
||||
self.RESULTS = "001"
|
||||
self.EXE_VER = game_ver
|
||||
|
||||
self.UPDATE_VER_1 = game_ver
|
||||
self.UPDATE_URL_1 = f"https://{mucha_url}/updUrl1/"
|
||||
self.UPDATE_SIZE_1 = "0"
|
||||
self.UPDATE_CRC_1 = "0000000000000000"
|
||||
self.CHECK_URL_1 = f"https://{mucha_url}/checkUrl/"
|
||||
self.EXE_VER_1 = game_ver
|
||||
self.UPDATE_URL_1 = f"http://{mucha_url}/updUrl1/"
|
||||
self.UPDATE_SIZE_1 = "20"
|
||||
|
||||
self.CHECK_CRC_1 = "0000000000000000"
|
||||
self.CHECK_URL_1 = f"http://{mucha_url}/checkUrl/"
|
||||
self.CHECK_SIZE_1 = "20"
|
||||
|
||||
self.INFO_SIZE_1 = "0"
|
||||
self.COM_SIZE_1 = "0"
|
||||
self.COM_TIME_1 = "0"
|
||||
self.LAN_INFO_SIZE_1 = "0"
|
||||
|
||||
self.USER_ID = ""
|
||||
self.PASSWORD = ""
|
||||
|
||||
"""
|
||||
RESULTS
|
||||
EXE_VER
|
||||
|
||||
UPDATE_VER_%d
|
||||
UPDATE_URL_%d
|
||||
UPDATE_SIZE_%d
|
||||
|
||||
CHECK_CRC_%d
|
||||
CHECK_URL_%d
|
||||
CHECK_SIZE_%d
|
||||
|
||||
INFO_SIZE_1
|
||||
COM_SIZE_1
|
||||
COM_TIME_1
|
||||
LAN_INFO_SIZE_1
|
||||
|
||||
USER_ID
|
||||
PASSWORD
|
||||
"""
|
||||
class MuchaUpdateResponseStub:
|
||||
def __init__(self, game_ver: str) -> None:
|
||||
self.RESULTS = "001"
|
||||
self.UPDATE_VER_1 = game_ver
|
||||
|
||||
class MuchaDownloadStateRequest:
|
||||
def __init__(self, request: Dict) -> None:
|
||||
self.gameCd = request.get("gameCd", "")
|
||||
self.updateVer = request.get("updateVer", "")
|
||||
self.serialNum = request.get("serialNum", "")
|
||||
self.fileSize = request.get("fileSize", "")
|
||||
self.compFileSize = request.get("compFileSize", "")
|
||||
self.boardId = request.get("boardId", "")
|
||||
self.placeId = request.get("placeId", "")
|
||||
self.storeRouterIp = request.get("storeRouterIp", "")
|
||||
|
||||
@@ -230,12 +230,12 @@ python dbutils.py --game SBZV upgrade
|
||||
|------------|----------------------------|
|
||||
| 0 | O.N.G.E.K.I. |
|
||||
| 1 | O.N.G.E.K.I. + |
|
||||
| 2 | O.N.G.E.K.I. SUMMER |
|
||||
| 3 | O.N.G.E.K.I. SUMMER + |
|
||||
| 4 | O.N.G.E.K.I. R.E.D. |
|
||||
| 5 | O.N.G.E.K.I. R.E.D. + |
|
||||
| 6 | O.N.G.E.K.I. bright |
|
||||
| 7 | O.N.G.E.K.I. bright MEMORY |
|
||||
| 2 | O.N.G.E.K.I. Summer |
|
||||
| 3 | O.N.G.E.K.I. Summer + |
|
||||
| 4 | O.N.G.E.K.I. Red |
|
||||
| 5 | O.N.G.E.K.I. Red + |
|
||||
| 6 | O.N.G.E.K.I. Bright |
|
||||
| 7 | O.N.G.E.K.I. Bright Memory |
|
||||
|
||||
|
||||
### Importer
|
||||
@@ -285,12 +285,12 @@ python dbutils.py --game SDDT upgrade
|
||||
* Card Maker 1.30:
|
||||
* CHUNITHM NEW!!: Yes
|
||||
* maimai DX UNiVERSE: Yes
|
||||
* O.N.G.E.K.I. bright: Yes
|
||||
* O.N.G.E.K.I. Bright: Yes
|
||||
|
||||
* Card Maker 1.35:
|
||||
* CHUNITHM SUN: Yes (NEW PLUS!! up to A032)
|
||||
* maimai DX FESTiVAL: Yes (up to A035) (UNiVERSE PLUS up to A031)
|
||||
* O.N.G.E.K.I. bright MEMORY: Yes
|
||||
* O.N.G.E.K.I. Bright Memory: Yes
|
||||
|
||||
|
||||
### Importer
|
||||
@@ -345,15 +345,7 @@ Now update your `config/cardmaker.yaml` with the correct version number, for exa
|
||||
version:
|
||||
1: # Card Maker 1.35
|
||||
ongeki: 1.35.03
|
||||
```
|
||||
|
||||
For now you also need to update your `config/ongeki.yaml` with the correct version number, for example:
|
||||
|
||||
```yaml
|
||||
version:
|
||||
7: # O.N.G.E.K.I. bright MEMORY
|
||||
card_maker: 1.35.03
|
||||
```
|
||||
```
|
||||
|
||||
### O.N.G.E.K.I.
|
||||
|
||||
|
||||
@@ -29,9 +29,3 @@ gachas:
|
||||
- 1156
|
||||
- 1163
|
||||
- 1164
|
||||
|
||||
version:
|
||||
6:
|
||||
card_maker: 1.30.01
|
||||
7:
|
||||
card_maker: 1.35.03
|
||||
|
||||
@@ -113,6 +113,13 @@ class HttpDispatcher(resource.Resource):
|
||||
action="handle_updatecheck",
|
||||
conditions=dict(method=["POST"]),
|
||||
)
|
||||
self.map_post.connect(
|
||||
"mucha_dlstate",
|
||||
"/mucha/downloadstate.do",
|
||||
controller="mucha",
|
||||
action="handle_dlstate",
|
||||
conditions=dict(method=["POST"]),
|
||||
)
|
||||
|
||||
self.map_get.connect(
|
||||
"title_get",
|
||||
|
||||
@@ -21,7 +21,7 @@ Games listed below have been tested and confirmed working. Only game versions ol
|
||||
+ 1.35
|
||||
|
||||
+ O.N.G.E.K.I.
|
||||
+ All versions up to bright MEMORY
|
||||
+ All versions up to Bright Memory
|
||||
|
||||
+ WACCA
|
||||
+ Lily R
|
||||
|
||||
+1
-1
@@ -129,6 +129,6 @@ class CardMakerServlet:
|
||||
if resp is None:
|
||||
resp = {"returnCode": 1}
|
||||
|
||||
self.logger.info(f"Response {resp}")
|
||||
self.logger.debug(f"Response {resp}")
|
||||
|
||||
return zlib.compress(json.dumps(resp, ensure_ascii=False).encode("utf-8"))
|
||||
|
||||
+8
-4
@@ -89,8 +89,7 @@ class CardMakerReader(BaseReader):
|
||||
version_ids = {
|
||||
"v2_00": ChuniConstants.VER_CHUNITHM_NEW,
|
||||
"v2_05": ChuniConstants.VER_CHUNITHM_NEW_PLUS,
|
||||
# Chunithm SUN, ignore for now
|
||||
"v2_10": ChuniConstants.VER_CHUNITHM_NEW_PLUS + 1,
|
||||
"v2_10": ChuniConstants.VER_CHUNITHM_SUN,
|
||||
}
|
||||
|
||||
for root, dirs, files in os.walk(base_dir):
|
||||
@@ -138,8 +137,7 @@ class CardMakerReader(BaseReader):
|
||||
version_ids = {
|
||||
"v2_00": ChuniConstants.VER_CHUNITHM_NEW,
|
||||
"v2_05": ChuniConstants.VER_CHUNITHM_NEW_PLUS,
|
||||
# Chunithm SUN, ignore for now
|
||||
"v2_10": ChuniConstants.VER_CHUNITHM_NEW_PLUS + 1,
|
||||
"v2_10": ChuniConstants.VER_CHUNITHM_SUN,
|
||||
}
|
||||
|
||||
for root, dirs, files in os.walk(base_dir):
|
||||
@@ -226,6 +224,12 @@ class CardMakerReader(BaseReader):
|
||||
True if troot.find("disable").text == "false" else False
|
||||
)
|
||||
|
||||
# check if a date is part of the name and disable the
|
||||
# card if it is
|
||||
enabled = (
|
||||
False if re.search(r"\d{2}/\d{2}/\d{2}", name) else enabled
|
||||
)
|
||||
|
||||
self.mai2_data.static.put_card(
|
||||
version, card_id, name, enabled=enabled
|
||||
)
|
||||
|
||||
+164
-135
@@ -11,6 +11,7 @@ from titles.cxb.config import CxbConfig
|
||||
from titles.cxb.const import CxbConstants
|
||||
from titles.cxb.database import CxbData
|
||||
|
||||
from threading import Thread
|
||||
|
||||
class CxbBase:
|
||||
def __init__(self, cfg: CoreConfig, game_cfg: CxbConfig) -> None:
|
||||
@@ -54,6 +55,151 @@ class CxbBase:
|
||||
self.logger.warn(f"User {data['login']['authid']} does not have a profile")
|
||||
return {}
|
||||
|
||||
def task_generateCoupon(index, data1):
|
||||
# Coupons
|
||||
for i in range(500, 510):
|
||||
index.append(str(i))
|
||||
couponid = int(i) - 500
|
||||
dataValue = [
|
||||
{
|
||||
"couponId": str(couponid),
|
||||
"couponNum": "1",
|
||||
"couponLog": [],
|
||||
}
|
||||
]
|
||||
data1.append(
|
||||
b64encode(
|
||||
bytes(json.dumps(dataValue[0], separators=(",", ":")), "utf-8")
|
||||
).decode("utf-8")
|
||||
)
|
||||
|
||||
def task_generateShopListTitle(index, data1):
|
||||
# ShopList_Title
|
||||
for i in range(200000, 201451):
|
||||
index.append(str(i))
|
||||
shopid = int(i) - 200000
|
||||
dataValue = [
|
||||
{
|
||||
"shopId": shopid,
|
||||
"shopState": "2",
|
||||
"isDisable": "t",
|
||||
"isDeleted": "f",
|
||||
"isSpecialFlag": "f",
|
||||
}
|
||||
]
|
||||
data1.append(
|
||||
b64encode(
|
||||
bytes(json.dumps(dataValue[0], separators=(",", ":")), "utf-8")
|
||||
).decode("utf-8")
|
||||
)
|
||||
|
||||
def task_generateShopListIcon(index, data1):
|
||||
# ShopList_Icon
|
||||
for i in range(202000, 202264):
|
||||
index.append(str(i))
|
||||
shopid = int(i) - 200000
|
||||
dataValue = [
|
||||
{
|
||||
"shopId": shopid,
|
||||
"shopState": "2",
|
||||
"isDisable": "t",
|
||||
"isDeleted": "f",
|
||||
"isSpecialFlag": "f",
|
||||
}
|
||||
]
|
||||
data1.append(
|
||||
b64encode(
|
||||
bytes(json.dumps(dataValue[0], separators=(",", ":")), "utf-8")
|
||||
).decode("utf-8")
|
||||
)
|
||||
|
||||
def task_generateStories(index, data1):
|
||||
# Stories
|
||||
for i in range(900000, 900003):
|
||||
index.append(str(i))
|
||||
storyid = int(i) - 900000
|
||||
dataValue = [
|
||||
{
|
||||
"storyId": storyid,
|
||||
"unlockState1": ["t"] * 10,
|
||||
"unlockState2": ["t"] * 10,
|
||||
"unlockState3": ["t"] * 10,
|
||||
"unlockState4": ["t"] * 10,
|
||||
"unlockState5": ["t"] * 10,
|
||||
"unlockState6": ["t"] * 10,
|
||||
"unlockState7": ["t"] * 10,
|
||||
"unlockState8": ["t"] * 10,
|
||||
"unlockState9": ["t"] * 10,
|
||||
"unlockState10": ["t"] * 10,
|
||||
"unlockState11": ["t"] * 10,
|
||||
"unlockState12": ["t"] * 10,
|
||||
"unlockState13": ["t"] * 10,
|
||||
"unlockState14": ["t"] * 10,
|
||||
"unlockState15": ["t"] * 10,
|
||||
"unlockState16": ["t"] * 10,
|
||||
}
|
||||
]
|
||||
data1.append(
|
||||
b64encode(
|
||||
bytes(json.dumps(dataValue[0], separators=(",", ":")), "utf-8")
|
||||
).decode("utf-8")
|
||||
)
|
||||
|
||||
def task_generateScoreData(song, index, data1):
|
||||
song_data = song["data"]
|
||||
songCode = []
|
||||
|
||||
songCode.append(
|
||||
{
|
||||
"mcode": song_data["mcode"],
|
||||
"musicState": song_data["musicState"],
|
||||
"playCount": song_data["playCount"],
|
||||
"totalScore": song_data["totalScore"],
|
||||
"highScore": song_data["highScore"],
|
||||
"everHighScore": song_data["everHighScore"]
|
||||
if "everHighScore" in song_data
|
||||
else ["0", "0", "0", "0", "0"],
|
||||
"clearRate": song_data["clearRate"],
|
||||
"rankPoint": song_data["rankPoint"],
|
||||
"normalCR": song_data["normalCR"]
|
||||
if "normalCR" in song_data
|
||||
else ["0", "0", "0", "0", "0"],
|
||||
"survivalCR": song_data["survivalCR"]
|
||||
if "survivalCR" in song_data
|
||||
else ["0", "0", "0", "0", "0"],
|
||||
"ultimateCR": song_data["ultimateCR"]
|
||||
if "ultimateCR" in song_data
|
||||
else ["0", "0", "0", "0", "0"],
|
||||
"nohopeCR": song_data["nohopeCR"]
|
||||
if "nohopeCR" in song_data
|
||||
else ["0", "0", "0", "0", "0"],
|
||||
"combo": song_data["combo"],
|
||||
"coupleUserId": song_data["coupleUserId"],
|
||||
"difficulty": song_data["difficulty"],
|
||||
"isFullCombo": song_data["isFullCombo"],
|
||||
"clearGaugeType": song_data["clearGaugeType"],
|
||||
"fieldType": song_data["fieldType"],
|
||||
"gameType": song_data["gameType"],
|
||||
"grade": song_data["grade"],
|
||||
"unlockState": song_data["unlockState"],
|
||||
"extraState": song_data["extraState"],
|
||||
}
|
||||
)
|
||||
index.append(song_data["index"])
|
||||
data1.append(
|
||||
b64encode(
|
||||
bytes(json.dumps(songCode[0], separators=(",", ":")), "utf-8")
|
||||
).decode("utf-8")
|
||||
)
|
||||
|
||||
def task_generateIndexData(versionindex):
|
||||
try:
|
||||
v_profile = self.data.profile.get_profile_index(0, uid, self.version)
|
||||
v_profile_data = v_profile["data"]
|
||||
versionindex.append(int(v_profile_data["appVersion"]))
|
||||
except:
|
||||
versionindex.append("10400")
|
||||
|
||||
def handle_action_loadrange_request(self, data: Dict) -> Dict:
|
||||
range_start = data["loadrange"]["range"][0]
|
||||
range_end = data["loadrange"]["range"][1]
|
||||
@@ -107,146 +253,29 @@ class CxbBase:
|
||||
900000 = Stories
|
||||
"""
|
||||
|
||||
# Coupons
|
||||
for i in range(500, 510):
|
||||
index.append(str(i))
|
||||
couponid = int(i) - 500
|
||||
dataValue = [
|
||||
{
|
||||
"couponId": str(couponid),
|
||||
"couponNum": "1",
|
||||
"couponLog": [],
|
||||
}
|
||||
]
|
||||
data1.append(
|
||||
b64encode(
|
||||
bytes(json.dumps(dataValue[0], separators=(",", ":")), "utf-8")
|
||||
).decode("utf-8")
|
||||
)
|
||||
# Async threads to generate the response
|
||||
thread_Coupon = Thread(target=CxbBase.task_generateCoupon(index, data1))
|
||||
thread_ShopListTitle = Thread(target=CxbBase.task_generateShopListTitle(index, data1))
|
||||
thread_ShopListIcon = Thread(target=CxbBase.task_generateShopListIcon(index, data1))
|
||||
thread_Stories = Thread(target=CxbBase.task_generateStories(index, data1))
|
||||
|
||||
# ShopList_Title
|
||||
for i in range(200000, 201451):
|
||||
index.append(str(i))
|
||||
shopid = int(i) - 200000
|
||||
dataValue = [
|
||||
{
|
||||
"shopId": shopid,
|
||||
"shopState": "2",
|
||||
"isDisable": "t",
|
||||
"isDeleted": "f",
|
||||
"isSpecialFlag": "f",
|
||||
}
|
||||
]
|
||||
data1.append(
|
||||
b64encode(
|
||||
bytes(json.dumps(dataValue[0], separators=(",", ":")), "utf-8")
|
||||
).decode("utf-8")
|
||||
)
|
||||
thread_Coupon.start()
|
||||
thread_ShopListTitle.start()
|
||||
thread_ShopListIcon.start()
|
||||
thread_Stories.start()
|
||||
|
||||
# ShopList_Icon
|
||||
for i in range(202000, 202264):
|
||||
index.append(str(i))
|
||||
shopid = int(i) - 200000
|
||||
dataValue = [
|
||||
{
|
||||
"shopId": shopid,
|
||||
"shopState": "2",
|
||||
"isDisable": "t",
|
||||
"isDeleted": "f",
|
||||
"isSpecialFlag": "f",
|
||||
}
|
||||
]
|
||||
data1.append(
|
||||
b64encode(
|
||||
bytes(json.dumps(dataValue[0], separators=(",", ":")), "utf-8")
|
||||
).decode("utf-8")
|
||||
)
|
||||
|
||||
# Stories
|
||||
for i in range(900000, 900003):
|
||||
index.append(str(i))
|
||||
storyid = int(i) - 900000
|
||||
dataValue = [
|
||||
{
|
||||
"storyId": storyid,
|
||||
"unlockState1": ["t"] * 10,
|
||||
"unlockState2": ["t"] * 10,
|
||||
"unlockState3": ["t"] * 10,
|
||||
"unlockState4": ["t"] * 10,
|
||||
"unlockState5": ["t"] * 10,
|
||||
"unlockState6": ["t"] * 10,
|
||||
"unlockState7": ["t"] * 10,
|
||||
"unlockState8": ["t"] * 10,
|
||||
"unlockState9": ["t"] * 10,
|
||||
"unlockState10": ["t"] * 10,
|
||||
"unlockState11": ["t"] * 10,
|
||||
"unlockState12": ["t"] * 10,
|
||||
"unlockState13": ["t"] * 10,
|
||||
"unlockState14": ["t"] * 10,
|
||||
"unlockState15": ["t"] * 10,
|
||||
"unlockState16": ["t"] * 10,
|
||||
}
|
||||
]
|
||||
data1.append(
|
||||
b64encode(
|
||||
bytes(json.dumps(dataValue[0], separators=(",", ":")), "utf-8")
|
||||
).decode("utf-8")
|
||||
)
|
||||
thread_Coupon.join()
|
||||
thread_ShopListTitle.join()
|
||||
thread_ShopListIcon.join()
|
||||
thread_Stories.join()
|
||||
|
||||
for song in songs:
|
||||
song_data = song["data"]
|
||||
songCode = []
|
||||
|
||||
songCode.append(
|
||||
{
|
||||
"mcode": song_data["mcode"],
|
||||
"musicState": song_data["musicState"],
|
||||
"playCount": song_data["playCount"],
|
||||
"totalScore": song_data["totalScore"],
|
||||
"highScore": song_data["highScore"],
|
||||
"everHighScore": song_data["everHighScore"]
|
||||
if "everHighScore" in song_data
|
||||
else ["0", "0", "0", "0", "0"],
|
||||
"clearRate": song_data["clearRate"],
|
||||
"rankPoint": song_data["rankPoint"],
|
||||
"normalCR": song_data["normalCR"]
|
||||
if "normalCR" in song_data
|
||||
else ["0", "0", "0", "0", "0"],
|
||||
"survivalCR": song_data["survivalCR"]
|
||||
if "survivalCR" in song_data
|
||||
else ["0", "0", "0", "0", "0"],
|
||||
"ultimateCR": song_data["ultimateCR"]
|
||||
if "ultimateCR" in song_data
|
||||
else ["0", "0", "0", "0", "0"],
|
||||
"nohopeCR": song_data["nohopeCR"]
|
||||
if "nohopeCR" in song_data
|
||||
else ["0", "0", "0", "0", "0"],
|
||||
"combo": song_data["combo"],
|
||||
"coupleUserId": song_data["coupleUserId"],
|
||||
"difficulty": song_data["difficulty"],
|
||||
"isFullCombo": song_data["isFullCombo"],
|
||||
"clearGaugeType": song_data["clearGaugeType"],
|
||||
"fieldType": song_data["fieldType"],
|
||||
"gameType": song_data["gameType"],
|
||||
"grade": song_data["grade"],
|
||||
"unlockState": song_data["unlockState"],
|
||||
"extraState": song_data["extraState"],
|
||||
}
|
||||
)
|
||||
index.append(song_data["index"])
|
||||
data1.append(
|
||||
b64encode(
|
||||
bytes(json.dumps(songCode[0], separators=(",", ":")), "utf-8")
|
||||
).decode("utf-8")
|
||||
)
|
||||
thread_ScoreData = Thread(target=CxbBase.task_generateScoreData(song, index, data1))
|
||||
thread_ScoreData.start()
|
||||
|
||||
for v in index:
|
||||
try:
|
||||
v_profile = self.data.profile.get_profile_index(0, uid, self.version)
|
||||
v_profile_data = v_profile["data"]
|
||||
versionindex.append(int(v_profile_data["appVersion"]))
|
||||
except:
|
||||
versionindex.append("10400")
|
||||
thread_IndexData = Thread(target=CxbBase.task_generateIndexData(versionindex))
|
||||
thread_IndexData.start()
|
||||
|
||||
return {"index": index, "data": data1, "version": versionindex}
|
||||
|
||||
@@ -544,4 +573,4 @@ class CxbBase:
|
||||
|
||||
def handle_action_stampreq_request(self, data: Dict) -> Dict:
|
||||
self.logger.info(data)
|
||||
return {"stampreq": ""}
|
||||
return {"stampreq": ""}
|
||||
@@ -568,176 +568,3 @@ class Mai2DX(Mai2Base):
|
||||
"nextIndex": next_index,
|
||||
"userMusicList": [{"userMusicDetailList": music_detail_list}],
|
||||
}
|
||||
|
||||
def handle_cm_get_user_preview_api_request(self, data: Dict) -> Dict:
|
||||
p = self.data.profile.get_profile_detail(data["userId"], self.version)
|
||||
if p is None:
|
||||
return {}
|
||||
|
||||
return {
|
||||
"userName": p["userName"],
|
||||
"rating": p["playerRating"],
|
||||
# hardcode lastDataVersion for CardMaker 1.34
|
||||
"lastDataVersion": "1.20.00",
|
||||
"isLogin": False,
|
||||
"isExistSellingCard": False,
|
||||
}
|
||||
|
||||
def handle_cm_get_user_data_api_request(self, data: Dict) -> Dict:
|
||||
# user already exists, because the preview checks that already
|
||||
p = self.data.profile.get_profile_detail(data["userId"], self.version)
|
||||
|
||||
cards = self.data.card.get_user_cards(data["userId"])
|
||||
if cards is None or len(cards) == 0:
|
||||
# This should never happen
|
||||
self.logger.error(
|
||||
f"handle_get_user_data_api_request: Internal error - No cards found for user id {data['userId']}"
|
||||
)
|
||||
return {}
|
||||
|
||||
# get the dict representation of the row so we can modify values
|
||||
user_data = p._asdict()
|
||||
|
||||
# remove the values the game doesn't want
|
||||
user_data.pop("id")
|
||||
user_data.pop("user")
|
||||
user_data.pop("version")
|
||||
|
||||
return {"userId": data["userId"], "userData": user_data}
|
||||
|
||||
def handle_cm_login_api_request(self, data: Dict) -> Dict:
|
||||
return {"returnCode": 1}
|
||||
|
||||
def handle_cm_logout_api_request(self, data: Dict) -> Dict:
|
||||
return {"returnCode": 1}
|
||||
|
||||
def handle_cm_get_selling_card_api_request(self, data: Dict) -> Dict:
|
||||
selling_cards = self.data.static.get_enabled_cards(self.version)
|
||||
if selling_cards is None:
|
||||
return {"length": 0, "sellingCardList": []}
|
||||
|
||||
selling_card_list = []
|
||||
for card in selling_cards:
|
||||
tmp = card._asdict()
|
||||
tmp.pop("id")
|
||||
tmp.pop("version")
|
||||
tmp.pop("cardName")
|
||||
tmp.pop("enabled")
|
||||
|
||||
tmp["startDate"] = datetime.strftime(tmp["startDate"], "%Y-%m-%d %H:%M:%S")
|
||||
tmp["endDate"] = datetime.strftime(tmp["endDate"], "%Y-%m-%d %H:%M:%S")
|
||||
tmp["noticeStartDate"] = datetime.strftime(
|
||||
tmp["noticeStartDate"], "%Y-%m-%d %H:%M:%S"
|
||||
)
|
||||
tmp["noticeEndDate"] = datetime.strftime(
|
||||
tmp["noticeEndDate"], "%Y-%m-%d %H:%M:%S"
|
||||
)
|
||||
|
||||
selling_card_list.append(tmp)
|
||||
|
||||
return {"length": len(selling_card_list), "sellingCardList": selling_card_list}
|
||||
|
||||
def handle_cm_get_user_card_api_request(self, data: Dict) -> Dict:
|
||||
user_cards = self.data.item.get_cards(data["userId"])
|
||||
if user_cards is None:
|
||||
return {"returnCode": 1, "length": 0, "nextIndex": 0, "userCardList": []}
|
||||
|
||||
max_ct = data["maxCount"]
|
||||
next_idx = data["nextIndex"]
|
||||
start_idx = next_idx
|
||||
end_idx = max_ct + start_idx
|
||||
|
||||
if len(user_cards[start_idx:]) > max_ct:
|
||||
next_idx += max_ct
|
||||
else:
|
||||
next_idx = 0
|
||||
|
||||
card_list = []
|
||||
for card in user_cards:
|
||||
tmp = card._asdict()
|
||||
tmp.pop("id")
|
||||
tmp.pop("user")
|
||||
|
||||
tmp["startDate"] = datetime.strftime(tmp["startDate"], "%Y-%m-%d %H:%M:%S")
|
||||
tmp["endDate"] = datetime.strftime(tmp["endDate"], "%Y-%m-%d %H:%M:%S")
|
||||
card_list.append(tmp)
|
||||
|
||||
return {
|
||||
"returnCode": 1,
|
||||
"length": len(card_list[start_idx:end_idx]),
|
||||
"nextIndex": next_idx,
|
||||
"userCardList": card_list[start_idx:end_idx],
|
||||
}
|
||||
|
||||
def handle_cm_get_user_item_api_request(self, data: Dict) -> Dict:
|
||||
super().handle_get_user_item_api_request(data)
|
||||
|
||||
def handle_cm_get_user_character_api_request(self, data: Dict) -> Dict:
|
||||
characters = self.data.item.get_characters(data["userId"])
|
||||
|
||||
chara_list = []
|
||||
for chara in characters:
|
||||
chara_list.append(
|
||||
{
|
||||
"characterId": chara["characterId"],
|
||||
# no clue why those values are even needed
|
||||
"point": 0,
|
||||
"count": 0,
|
||||
"level": chara["level"],
|
||||
"nextAwake": 0,
|
||||
"nextAwakePercent": 0,
|
||||
"favorite": False,
|
||||
"awakening": chara["awakening"],
|
||||
"useCount": chara["useCount"],
|
||||
}
|
||||
)
|
||||
|
||||
return {
|
||||
"returnCode": 1,
|
||||
"length": len(chara_list),
|
||||
"userCharacterList": chara_list,
|
||||
}
|
||||
|
||||
def handle_cm_get_user_card_print_error_api_request(self, data: Dict) -> Dict:
|
||||
return {"length": 0, "userPrintDetailList": []}
|
||||
|
||||
def handle_cm_upsert_user_print_api_request(self, data: Dict) -> Dict:
|
||||
user_id = data["userId"]
|
||||
upsert = data["userPrintDetail"]
|
||||
|
||||
# set a random card serial number
|
||||
serial_id = "".join([str(randint(0, 9)) for _ in range(20)])
|
||||
|
||||
user_card = upsert["userCard"]
|
||||
self.data.item.put_card(
|
||||
user_id,
|
||||
user_card["cardId"],
|
||||
user_card["cardTypeId"],
|
||||
user_card["charaId"],
|
||||
user_card["mapId"],
|
||||
)
|
||||
|
||||
# properly format userPrintDetail for the database
|
||||
upsert.pop("userCard")
|
||||
upsert.pop("serialId")
|
||||
upsert["printDate"] = datetime.strptime(upsert["printDate"], "%Y-%m-%d")
|
||||
|
||||
self.data.item.put_user_print_detail(user_id, serial_id, upsert)
|
||||
|
||||
return {
|
||||
"returnCode": 1,
|
||||
"orderId": 0,
|
||||
"serialId": serial_id,
|
||||
"startDate": "2018-01-01 00:00:00",
|
||||
"endDate": "2038-01-01 00:00:00",
|
||||
}
|
||||
|
||||
def handle_cm_upsert_user_printlog_api_request(self, data: Dict) -> Dict:
|
||||
return {
|
||||
"returnCode": 1,
|
||||
"orderId": 0,
|
||||
"serialId": data["userPrintlog"]["serialId"],
|
||||
}
|
||||
|
||||
def handle_cm_upsert_buy_card_api_request(self, data: Dict) -> Dict:
|
||||
return {"returnCode": 1}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
from typing import Dict
|
||||
|
||||
from core.config import CoreConfig
|
||||
from titles.mai2.dx import Mai2DX
|
||||
from titles.mai2.universeplus import Mai2UniversePlus
|
||||
from titles.mai2.const import Mai2Constants
|
||||
from titles.mai2.config import Mai2Config
|
||||
|
||||
|
||||
class Mai2Festival(Mai2DX):
|
||||
class Mai2Festival(Mai2UniversePlus):
|
||||
def __init__(self, cfg: CoreConfig, game_cfg: Mai2Config) -> None:
|
||||
super().__init__(cfg, game_cfg)
|
||||
self.version = Mai2Constants.VER_MAIMAI_DX_FESTIVAL
|
||||
@@ -14,7 +14,7 @@ class Mai2Festival(Mai2DX):
|
||||
def handle_cm_get_user_preview_api_request(self, data: Dict) -> Dict:
|
||||
user_data = super().handle_cm_get_user_preview_api_request(data)
|
||||
|
||||
# hardcode lastDataVersion for CardMaker 1.36
|
||||
# hardcode lastDataVersion for CardMaker 1.35
|
||||
user_data["lastDataVersion"] = "1.30.00"
|
||||
return user_data
|
||||
|
||||
|
||||
@@ -4,12 +4,12 @@ import pytz
|
||||
import json
|
||||
|
||||
from core.config import CoreConfig
|
||||
from titles.mai2.dx import Mai2DX
|
||||
from titles.mai2.dxplus import Mai2DXPlus
|
||||
from titles.mai2.config import Mai2Config
|
||||
from titles.mai2.const import Mai2Constants
|
||||
|
||||
|
||||
class Mai2Splash(Mai2DX):
|
||||
class Mai2Splash(Mai2DXPlus):
|
||||
def __init__(self, cfg: CoreConfig, game_cfg: Mai2Config) -> None:
|
||||
super().__init__(cfg, game_cfg)
|
||||
self.version = Mai2Constants.VER_MAIMAI_DX_SPLASH
|
||||
|
||||
@@ -4,12 +4,12 @@ import pytz
|
||||
import json
|
||||
|
||||
from core.config import CoreConfig
|
||||
from titles.mai2.dx import Mai2DX
|
||||
from titles.mai2.splash import Mai2Splash
|
||||
from titles.mai2.config import Mai2Config
|
||||
from titles.mai2.const import Mai2Constants
|
||||
|
||||
|
||||
class Mai2SplashPlus(Mai2DX):
|
||||
class Mai2SplashPlus(Mai2Splash):
|
||||
def __init__(self, cfg: CoreConfig, game_cfg: Mai2Config) -> None:
|
||||
super().__init__(cfg, game_cfg)
|
||||
self.version = Mai2Constants.VER_MAIMAI_DX_SPLASH_PLUS
|
||||
|
||||
@@ -5,12 +5,12 @@ import pytz
|
||||
import json
|
||||
|
||||
from core.config import CoreConfig
|
||||
from titles.mai2.dx import Mai2DX
|
||||
from titles.mai2.splashplus import Mai2SplashPlus
|
||||
from titles.mai2.const import Mai2Constants
|
||||
from titles.mai2.config import Mai2Config
|
||||
|
||||
|
||||
class Mai2Universe(Mai2DX):
|
||||
class Mai2Universe(Mai2SplashPlus):
|
||||
def __init__(self, cfg: CoreConfig, game_cfg: Mai2Config) -> None:
|
||||
super().__init__(cfg, game_cfg)
|
||||
self.version = Mai2Constants.VER_MAIMAI_DX_UNIVERSE
|
||||
@@ -70,13 +70,13 @@ class Mai2Universe(Mai2DX):
|
||||
tmp.pop("cardName")
|
||||
tmp.pop("enabled")
|
||||
|
||||
tmp["startDate"] = datetime.strftime(tmp["startDate"], "%Y-%m-%d %H:%M:%S")
|
||||
tmp["endDate"] = datetime.strftime(tmp["endDate"], "%Y-%m-%d %H:%M:%S")
|
||||
tmp["startDate"] = datetime.strftime(tmp["startDate"], Mai2Constants.DATE_TIME_FORMAT)
|
||||
tmp["endDate"] = datetime.strftime(tmp["endDate"], Mai2Constants.DATE_TIME_FORMAT)
|
||||
tmp["noticeStartDate"] = datetime.strftime(
|
||||
tmp["noticeStartDate"], "%Y-%m-%d %H:%M:%S"
|
||||
tmp["noticeStartDate"], Mai2Constants.DATE_TIME_FORMAT
|
||||
)
|
||||
tmp["noticeEndDate"] = datetime.strftime(
|
||||
tmp["noticeEndDate"], "%Y-%m-%d %H:%M:%S"
|
||||
tmp["noticeEndDate"], Mai2Constants.DATE_TIME_FORMAT
|
||||
)
|
||||
|
||||
selling_card_list.append(tmp)
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
from typing import Dict
|
||||
|
||||
from core.config import CoreConfig
|
||||
from titles.mai2.dx import Mai2DX
|
||||
from titles.mai2.universe import Mai2Universe
|
||||
from titles.mai2.const import Mai2Constants
|
||||
from titles.mai2.config import Mai2Config
|
||||
|
||||
|
||||
class Mai2UniversePlus(Mai2DX):
|
||||
class Mai2UniversePlus(Mai2Universe):
|
||||
def __init__(self, cfg: CoreConfig, game_cfg: Mai2Config) -> None:
|
||||
super().__init__(cfg, game_cfg)
|
||||
self.version = Mai2Constants.VER_MAIMAI_DX_UNIVERSE_PLUS
|
||||
|
||||
@@ -7,4 +7,4 @@ index = OngekiServlet
|
||||
database = OngekiData
|
||||
reader = OngekiReader
|
||||
game_codes = [OngekiConstants.GAME_CODE]
|
||||
current_schema_version = 5
|
||||
current_schema_version = 4
|
||||
|
||||
+5
-13
@@ -142,7 +142,7 @@ class OngekiBase:
|
||||
|
||||
def handle_get_game_point_api_request(self, data: Dict) -> Dict:
|
||||
"""
|
||||
Sets the GP amount for A and B sets for 1 - 3 credits
|
||||
Sets the GP ammount for A and B sets for 1 - 3 crdits
|
||||
"""
|
||||
return {
|
||||
"length": 6,
|
||||
@@ -155,13 +155,13 @@ class OngekiBase:
|
||||
},
|
||||
{
|
||||
"type": 1,
|
||||
"cost": 230,
|
||||
"cost": 200,
|
||||
"startDate": "2000-01-01 05:00:00.0",
|
||||
"endDate": "2099-01-01 05:00:00.0",
|
||||
},
|
||||
{
|
||||
"type": 2,
|
||||
"cost": 370,
|
||||
"cost": 300,
|
||||
"startDate": "2000-01-01 05:00:00.0",
|
||||
"endDate": "2099-01-01 05:00:00.0",
|
||||
},
|
||||
@@ -256,11 +256,7 @@ class OngekiBase:
|
||||
{
|
||||
"type": event["type"],
|
||||
"id": event["eventId"],
|
||||
# actually use the startDate from the import so it
|
||||
# properly shows all the events when new ones are imported
|
||||
"startDate": datetime.strftime(
|
||||
event["startDate"], "%Y-%m-%d %H:%M:%S.0"
|
||||
),
|
||||
"startDate": "2017-12-05 07:00:00.0",
|
||||
"endDate": "2099-12-31 00:00:00.0",
|
||||
}
|
||||
)
|
||||
@@ -564,11 +560,7 @@ class OngekiBase:
|
||||
def handle_get_user_recent_rating_api_request(self, data: Dict) -> Dict:
|
||||
recent_rating = self.data.profile.get_profile_recent_rating(data["userId"])
|
||||
if recent_rating is None:
|
||||
return {
|
||||
"userId": data["userId"],
|
||||
"length": 0,
|
||||
"userRecentRatingList": [],
|
||||
}
|
||||
return {}
|
||||
|
||||
userRecentRatingList = recent_rating["recentRating"]
|
||||
|
||||
|
||||
+7
-12
@@ -43,15 +43,15 @@ class OngekiBright(OngekiBase):
|
||||
user_data.pop("user")
|
||||
user_data.pop("version")
|
||||
|
||||
# TODO: replace datetime objects with strings
|
||||
|
||||
# add access code that we don't store
|
||||
user_data["accessCode"] = cards[0]["access_code"]
|
||||
|
||||
# add the compatible card maker version from config
|
||||
card_maker_ver = self.game_cfg.version.version(self.version)
|
||||
if card_maker_ver and card_maker_ver.get("card_maker"):
|
||||
# Card Maker 1.30 = 1.30.01+
|
||||
# Card Maker 1.35 = 1.35.03+
|
||||
user_data["compatibleCmVersion"] = card_maker_ver.get("card_maker")
|
||||
# hardcode Card Maker version for now
|
||||
# Card Maker 1.34.00 = 1.30.01
|
||||
# Card Maker 1.36.00 = 1.35.04
|
||||
user_data["compatibleCmVersion"] = "1.30.01"
|
||||
|
||||
return {"userId": data["userId"], "userData": user_data}
|
||||
|
||||
@@ -333,8 +333,6 @@ class OngekiBright(OngekiBase):
|
||||
select_point = data["selectPoint"]
|
||||
|
||||
total_gacha_count, ceiling_gacha_count = 0, 0
|
||||
# 0 = can still use Gacha Select, 1 = already used Gacha Select
|
||||
use_select_point = 0
|
||||
daily_gacha_cnt, five_gacha_cnt, eleven_gacha_cnt = 0, 0, 0
|
||||
daily_gacha_date = datetime.strptime("2000-01-01", "%Y-%m-%d")
|
||||
|
||||
@@ -346,9 +344,6 @@ class OngekiBright(OngekiBase):
|
||||
daily_gacha_cnt = user_gacha["dailyGachaCnt"]
|
||||
five_gacha_cnt = user_gacha["fiveGachaCnt"]
|
||||
eleven_gacha_cnt = user_gacha["elevenGachaCnt"]
|
||||
# if the Gacha Select has been used, make sure to keep it
|
||||
if user_gacha["useSelectPoint"] == 1:
|
||||
use_select_point = 1
|
||||
# parse just the year, month and date
|
||||
daily_gacha_date = user_gacha["dailyGachaDate"]
|
||||
|
||||
@@ -364,7 +359,7 @@ class OngekiBright(OngekiBase):
|
||||
totalGachaCnt=total_gacha_count + gacha_count,
|
||||
ceilingGachaCnt=ceiling_gacha_count + gacha_count,
|
||||
selectPoint=select_point,
|
||||
useSelectPoint=use_select_point,
|
||||
useSelectPoint=0,
|
||||
dailyGachaCnt=daily_gacha_cnt + gacha_count,
|
||||
fiveGachaCnt=five_gacha_cnt + 1 if gacha_count == 5 else five_gacha_cnt,
|
||||
elevenGachaCnt=eleven_gacha_cnt + 1
|
||||
|
||||
@@ -136,3 +136,14 @@ class OngekiBrightMemory(OngekiBright):
|
||||
|
||||
def handle_get_game_music_release_state_api_request(self, data: Dict) -> Dict:
|
||||
return {"techScore": 0, "cardNum": 0}
|
||||
|
||||
def handle_cm_get_user_data_api_request(self, data: Dict) -> Dict:
|
||||
# check for a bright memory profile
|
||||
user_data = super().handle_cm_get_user_data_api_request(data)
|
||||
|
||||
# hardcode Card Maker version for now
|
||||
# Card Maker 1.34 = 1.30.01
|
||||
# Card Maker 1.35 = 1.35.03
|
||||
user_data["userData"]["compatibleCmVersion"] = "1.35.03"
|
||||
|
||||
return user_data
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
from ast import Dict
|
||||
from typing import List
|
||||
|
||||
from core.config import CoreConfig
|
||||
@@ -34,23 +33,7 @@ class OngekiGachaConfig:
|
||||
)
|
||||
|
||||
|
||||
class OngekiCardMakerVersionConfig:
|
||||
def __init__(self, parent_config: "OngekiConfig") -> None:
|
||||
self.__config = parent_config
|
||||
|
||||
def version(self, version: int) -> Dict:
|
||||
"""
|
||||
in the form of:
|
||||
<ongeki version>: {"card_maker": <compatible card maker version>}
|
||||
6: {"card_maker": 1.30.01}
|
||||
"""
|
||||
return CoreConfig.get_config_field(
|
||||
self.__config, "ongeki", "version", default={}
|
||||
).get(version)
|
||||
|
||||
|
||||
class OngekiConfig(dict):
|
||||
def __init__(self) -> None:
|
||||
self.server = OngekiServerConfig(self)
|
||||
self.gachas = OngekiGachaConfig(self)
|
||||
self.version = OngekiCardMakerVersionConfig(self)
|
||||
|
||||
@@ -66,13 +66,13 @@ class OngekiConstants:
|
||||
|
||||
VERSION_NAMES = (
|
||||
"ONGEKI",
|
||||
"ONGEKI +",
|
||||
"ONGEKI SUMMER",
|
||||
"ONGEKI SUMMER +",
|
||||
"ONGEKI R.E.D.",
|
||||
"ONGEKI R.E.D. +",
|
||||
"ONGEKI bright",
|
||||
"ONGEKI bright MEMORY",
|
||||
"ONGEKI+",
|
||||
"ONGEKI Summer",
|
||||
"ONGEKI Summer+",
|
||||
"ONGEKI Red",
|
||||
"ONGEKI Red+",
|
||||
"ONGEKI Bright",
|
||||
"ONGEKI Bright Memory",
|
||||
)
|
||||
|
||||
@classmethod
|
||||
|
||||
@@ -11,7 +11,6 @@ from os import path
|
||||
from typing import Tuple
|
||||
|
||||
from core.config import CoreConfig
|
||||
from core.utils import Utils
|
||||
from titles.ongeki.config import OngekiConfig
|
||||
from titles.ongeki.const import OngekiConstants
|
||||
from titles.ongeki.base import OngekiBase
|
||||
@@ -102,7 +101,6 @@ class OngekiServlet:
|
||||
url_split = url_path.split("/")
|
||||
internal_ver = 0
|
||||
endpoint = url_split[len(url_split) - 1]
|
||||
client_ip = Utils.get_ip_addr(request)
|
||||
|
||||
if version < 105: # 1.0
|
||||
internal_ver = OngekiConstants.VER_ONGEKI
|
||||
@@ -139,10 +137,7 @@ class OngekiServlet:
|
||||
|
||||
req_data = json.loads(unzip)
|
||||
|
||||
self.logger.info(
|
||||
f"v{version} {endpoint} request from {client_ip}"
|
||||
)
|
||||
self.logger.debug(req_data)
|
||||
self.logger.info(f"v{version} {endpoint} request - {req_data}")
|
||||
|
||||
func_to_find = "handle_" + inflection.underscore(endpoint) + "_request"
|
||||
|
||||
@@ -161,6 +156,6 @@ class OngekiServlet:
|
||||
if resp == None:
|
||||
resp = {"returnCode": 1}
|
||||
|
||||
self.logger.debug(f"Response {resp}")
|
||||
self.logger.info(f"Response {resp}")
|
||||
|
||||
return zlib.compress(json.dumps(resp, ensure_ascii=False).encode("utf-8"))
|
||||
|
||||
@@ -316,7 +316,7 @@ class OngekiProfileData(BaseData):
|
||||
return result.fetchone()
|
||||
|
||||
def get_profile_rating_log(self, aime_id: int) -> Optional[List[Row]]:
|
||||
sql = select(rating_log).where(rating_log.c.user == aime_id)
|
||||
sql = select(rating_log).where(recent_rating.c.user == aime_id)
|
||||
|
||||
result = self.execute(sql)
|
||||
if result is None:
|
||||
|
||||
@@ -16,7 +16,6 @@ events = Table(
|
||||
Column("eventId", Integer),
|
||||
Column("type", Integer),
|
||||
Column("name", String(255)),
|
||||
Column("startDate", TIMESTAMP, server_default=func.now()),
|
||||
Column("enabled", Boolean, server_default="1"),
|
||||
UniqueConstraint("version", "eventId", "type", name="ongeki_static_events_uk"),
|
||||
mysql_charset="utf8mb4",
|
||||
|
||||
Reference in New Issue
Block a user