mirror of
https://gitea.tendokyu.moe/Hay1tsme/artemis.git
synced 2026-02-12 18:57:29 +08:00
ongeki: bright MEMORY Act.3 support added
This commit is contained in:
@@ -196,7 +196,7 @@ class OngekiBright(OngekiBase):
|
||||
|
||||
# make sure to only show gachas for the current version
|
||||
# so only up to bright, 1140 is the first bright memory gacha
|
||||
if self.version == OngekiConstants.VER_ONGEKI_BRIGHT_MEMORY:
|
||||
if self.version >= OngekiConstants.VER_ONGEKI_BRIGHT_MEMORY:
|
||||
game_gacha_list.append(tmp)
|
||||
elif (
|
||||
self.version == OngekiConstants.VER_ONGEKI_BRIGHT
|
||||
|
||||
24
titles/ongeki/brightmemoryact3.py
Normal file
24
titles/ongeki/brightmemoryact3.py
Normal file
@@ -0,0 +1,24 @@
|
||||
from typing import Dict
|
||||
|
||||
from core.config import CoreConfig
|
||||
from titles.ongeki.brightmemory import OngekiBrightMemory
|
||||
from titles.ongeki.const import OngekiConstants
|
||||
from titles.ongeki.config import OngekiConfig
|
||||
|
||||
|
||||
class OngekiBrightMemoryAct3(OngekiBrightMemory):
|
||||
def __init__(self, core_cfg: CoreConfig, game_cfg: OngekiConfig) -> None:
|
||||
super().__init__(core_cfg, game_cfg)
|
||||
self.version = OngekiConstants.VER_ONGEKI_BRIGHT_MEMORY_ACT3
|
||||
|
||||
async def handle_get_game_setting_api_request(self, data: Dict) -> Dict:
|
||||
ret = await super().handle_get_game_setting_api_request(data)
|
||||
ret["gameSetting"]["dataVersion"] = "1.45.00"
|
||||
ret["gameSetting"]["onlineDataVersion"] = "1.45.00"
|
||||
ret["gameSetting"]["maxCountCharacter"] = 50
|
||||
ret["gameSetting"]["maxCountCard"] = 300
|
||||
ret["gameSetting"]["maxCountItem"] = 300
|
||||
ret["gameSetting"]["maxCountMusic"] = 50
|
||||
ret["gameSetting"]["maxCountMusicItem"] = 300
|
||||
ret["gameSetting"]["maxCountRivalMusic"] = 300
|
||||
return ret
|
||||
@@ -15,6 +15,7 @@ class OngekiConstants:
|
||||
VER_ONGEKI_RED_PLUS = 5
|
||||
VER_ONGEKI_BRIGHT = 6
|
||||
VER_ONGEKI_BRIGHT_MEMORY = 7
|
||||
VER_ONGEKI_BRIGHT_MEMORY_ACT3 = 8
|
||||
|
||||
EVT_TYPES: Enum = Enum(
|
||||
"EVT_TYPES",
|
||||
@@ -94,14 +95,15 @@ class OngekiConstants:
|
||||
Lunatic = 10
|
||||
|
||||
VERSION_NAMES = (
|
||||
"ONGEKI",
|
||||
"ONGEKI +",
|
||||
"ONGEKI SUMMER",
|
||||
"ONGEKI SUMMER +",
|
||||
"ONGEKI R.E.D.",
|
||||
"ONGEKI R.E.D. +",
|
||||
"ONGEKI bright",
|
||||
"ONGEKI bright MEMORY",
|
||||
"O.N.G.E.K.I.",
|
||||
"O.N.G.E.K.I. PLUS",
|
||||
"O.N.G.E.K.I. SUMMER",
|
||||
"O.N.G.E.K.I. SUMMER PLUS",
|
||||
"O.N.G.E.K.I. R.E.D.",
|
||||
"O.N.G.E.K.I. R.E.D. PLUS",
|
||||
"O.N.G.E.K.I. bright",
|
||||
"O.N.G.E.K.I. bright MEMORY",
|
||||
"O.N.G.E.K.I. bright MEMORY Act.3",
|
||||
)
|
||||
|
||||
@classmethod
|
||||
|
||||
@@ -29,6 +29,7 @@ from .red import OngekiRed
|
||||
from .redplus import OngekiRedPlus
|
||||
from .bright import OngekiBright
|
||||
from .brightmemory import OngekiBrightMemory
|
||||
from .brightmemoryact3 import OngekiBrightMemoryAct3
|
||||
|
||||
|
||||
class OngekiServlet(BaseServlet):
|
||||
@@ -50,6 +51,7 @@ class OngekiServlet(BaseServlet):
|
||||
OngekiRedPlus(core_cfg, self.game_cfg),
|
||||
OngekiBright(core_cfg, self.game_cfg),
|
||||
OngekiBrightMemory(core_cfg, self.game_cfg),
|
||||
OngekiBrightMemoryAct3(core_cfg, self.game_cfg),
|
||||
]
|
||||
|
||||
self.logger = logging.getLogger("ongeki")
|
||||
@@ -150,26 +152,28 @@ class OngekiServlet(BaseServlet):
|
||||
return Response(zlib.compress(b'{"returnCode": 1}'))
|
||||
|
||||
req_raw = await request.body()
|
||||
encrtped = False
|
||||
encrypted = False
|
||||
internal_ver = 0
|
||||
client_ip = Utils.get_ip_addr(request)
|
||||
|
||||
if version < 105: # 1.0
|
||||
internal_ver = OngekiConstants.VER_ONGEKI
|
||||
elif version >= 105 and version < 110: # Plus
|
||||
elif version >= 105 and version < 110: # PLUS
|
||||
internal_ver = OngekiConstants.VER_ONGEKI_PLUS
|
||||
elif version >= 110 and version < 115: # Summer
|
||||
elif version >= 110 and version < 115: # SUMMER
|
||||
internal_ver = OngekiConstants.VER_ONGEKI_SUMMER
|
||||
elif version >= 115 and version < 120: # Summer Plus
|
||||
elif version >= 115 and version < 120: # SUMMER PLUS
|
||||
internal_ver = OngekiConstants.VER_ONGEKI_SUMMER_PLUS
|
||||
elif version >= 120 and version < 125: # Red
|
||||
elif version >= 120 and version < 125: # R.E.D.
|
||||
internal_ver = OngekiConstants.VER_ONGEKI_RED
|
||||
elif version >= 125 and version < 130: # Red Plus
|
||||
elif version >= 125 and version < 130: # R.E.D. PLUS
|
||||
internal_ver = OngekiConstants.VER_ONGEKI_RED_PLUS
|
||||
elif version >= 130 and version < 135: # Bright
|
||||
elif version >= 130 and version < 135: # bright
|
||||
internal_ver = OngekiConstants.VER_ONGEKI_BRIGHT
|
||||
elif version >= 135 and version < 145: # Bright Memory
|
||||
elif version >= 135 and version < 145: # bright MEMORY
|
||||
internal_ver = OngekiConstants.VER_ONGEKI_BRIGHT_MEMORY
|
||||
elif version >= 145: # bright MEMORY Act 3
|
||||
internal_ver = OngekiConstants.VER_ONGEKI_BRIGHT_MEMORY_ACT3
|
||||
|
||||
if all(c in string.hexdigits for c in endpoint) and len(endpoint) == 32:
|
||||
# If we get a 32 character long hex string, it's a hash and we're
|
||||
@@ -204,10 +208,10 @@ class OngekiServlet(BaseServlet):
|
||||
)
|
||||
return Response(zlib.compress(b'{"stat": "0"}'))
|
||||
|
||||
encrtped = True
|
||||
encrypted = True
|
||||
|
||||
if (
|
||||
not encrtped
|
||||
not encrypted
|
||||
and self.game_cfg.crypto.encrypted_only
|
||||
and version >= 120
|
||||
):
|
||||
@@ -258,7 +262,7 @@ class OngekiServlet(BaseServlet):
|
||||
resp_raw = json.dumps(resp, ensure_ascii=False).encode("utf-8")
|
||||
zipped = zlib.compress(resp_raw)
|
||||
|
||||
if not encrtped or version < 120:
|
||||
if not encrypted or version < 120:
|
||||
if version < 105:
|
||||
return Response(resp_raw)
|
||||
return Response(zipped)
|
||||
|
||||
@@ -37,7 +37,8 @@ class OngekiReader(BaseReader):
|
||||
"1025": OngekiConstants.VER_ONGEKI_RED_PLUS,
|
||||
"1030": OngekiConstants.VER_ONGEKI_BRIGHT,
|
||||
"1035": OngekiConstants.VER_ONGEKI_BRIGHT_MEMORY,
|
||||
"1040": OngekiConstants.VER_ONGEKI_BRIGHT_MEMORY
|
||||
"1040": OngekiConstants.VER_ONGEKI_BRIGHT_MEMORY,
|
||||
"1045": OngekiConstants.VER_ONGEKI_BRIGHT_MEMORY_ACT3,
|
||||
}
|
||||
|
||||
node = troot.find("VersionID").find("id")
|
||||
|
||||
@@ -578,7 +578,11 @@ class OngekiItemData(BaseData):
|
||||
return result.lastrowid
|
||||
|
||||
async def get_mission_points(self, version: int, aime_id: int) -> Optional[List[Dict]]:
|
||||
sql = select(mission_point).where(and_(mission_point.c.user == aime_id, mission_point.c.version == version))
|
||||
sql = select(mission_point).where(and_(
|
||||
mission_point.c.user == aime_id,
|
||||
mission_point.c.version <= version)
|
||||
).order_by(mission_point.c.version.desc())
|
||||
|
||||
result = await self.execute(sql)
|
||||
|
||||
if result is None:
|
||||
@@ -702,7 +706,11 @@ class OngekiItemData(BaseData):
|
||||
return result.lastrowid
|
||||
|
||||
async def get_tech_event(self, version: int, aime_id: int) -> Optional[List[Dict]]:
|
||||
sql = select(tech_event).where(and_(tech_event.c.user == aime_id, tech_event.c.version == version))
|
||||
sql = select(tech_event).where(and_(
|
||||
tech_event.c.user == aime_id,
|
||||
tech_event.c.version <= version)
|
||||
).order_by(tech_event.c.version.desc())
|
||||
|
||||
result = await self.execute(sql)
|
||||
|
||||
if result is None:
|
||||
@@ -794,7 +802,7 @@ class OngekiItemData(BaseData):
|
||||
|
||||
async def get_ranking_event_ranks(self, version: int, aime_id: int) -> Optional[List[Dict]]:
|
||||
# Calculates player rank on GameRequest from server, and sends it back, official spec would rank players in maintenance period, on TODO list
|
||||
sql = select(event_point.c.id, event_point.c.user, event_point.c.eventId, event_point.c.type, func.row_number().over(partition_by=event_point.c.eventId, order_by=event_point.c.point.desc()).label('rank'), event_point.c.date, event_point.c.point).where(event_point.c.version == version)
|
||||
sql = select(event_point.c.id, event_point.c.user, event_point.c.eventId, event_point.c.type, func.row_number().over(partition_by=event_point.c.eventId, order_by=event_point.c.point.desc()).label('rank'), event_point.c.date, event_point.c.point).where(event_point.c.version <= version).order_by(event_point.c.version.desc())
|
||||
result = await self.execute(sql)
|
||||
if result is None:
|
||||
self.logger.error(f"failed to rank aime_id: {aime_id} ranking event positions")
|
||||
|
||||
Reference in New Issue
Block a user