1
0
mirror of synced 2024-12-21 09:15:52 +01:00
artemis/titles/cxb/rss1.py

251 lines
9.4 KiB
Python
Raw Normal View History

import json
from decimal import Decimal
from base64 import b64encode
from typing import Any, Dict
from hashlib import md5
from datetime import datetime
from core.config import CoreConfig
from core.data import Data, cached
from .config import CxbConfig
from .base import CxbBase
from .const import CxbConstants
2023-03-09 17:38:58 +01:00
class CxbRevSunriseS1(CxbBase):
def __init__(self, cfg: CoreConfig, game_cfg: CxbConfig) -> None:
super().__init__(cfg, game_cfg)
self.version = CxbConstants.VER_CROSSBEATS_REV_SUNRISE_S1
2023-03-09 17:38:58 +01:00
2024-01-09 09:07:04 +01:00
async def handle_data_path_list_request(self, data: Dict) -> Dict:
2023-03-09 17:38:58 +01:00
return {"data": ""}
2023-03-09 17:38:58 +01:00
@cached(lifetime=86400)
2024-01-09 09:07:04 +01:00
async def handle_data_music_list_request(self, data: Dict) -> Dict:
ret_str = ""
with open(r"titles/cxb/data/rss1/MusicArchiveList.csv") as music:
lines = music.readlines()
for line in lines:
2023-03-09 17:38:58 +01:00
line_split = line.split(",")
ret_str += f"{line_split[0]},{line_split[1]},{line_split[2]},{line_split[3]},{line_split[4]},{line_split[5]},{line_split[6]},{line_split[7]},{line_split[8]},{line_split[9]},{line_split[10]},{line_split[11]},{line_split[12]},{line_split[13]},{line_split[14]},\r\n"
2023-03-09 17:38:58 +01:00
return {"data": ret_str}
@cached(lifetime=86400)
2024-01-09 09:07:04 +01:00
async def handle_data_item_list_detail_request(self, data: Dict) -> Dict:
2023-03-09 17:38:58 +01:00
# ItemListIcon load
ret_str = "#ItemListIcon\r\n"
2023-03-09 17:38:58 +01:00
with open(
r"titles/cxb/data/rss1/Item/ItemList_Icon.csv", encoding="shift-jis"
2023-03-09 17:38:58 +01:00
) as item:
lines = item.readlines()
for line in lines:
ret_str += f"{line[:-1]}\r\n"
2023-03-09 17:38:58 +01:00
# ItemListTitle load
ret_str += "\r\n#ItemListTitle\r\n"
2023-03-09 17:38:58 +01:00
with open(
r"titles/cxb/data/rss1/Item/ItemList_Title.csv", encoding="shift-jis"
2023-03-09 17:38:58 +01:00
) as item:
lines = item.readlines()
for line in lines:
ret_str += f"{line[:-1]}\r\n"
2023-03-09 17:38:58 +01:00
return {"data": ret_str}
2023-03-09 17:38:58 +01:00
@cached(lifetime=86400)
2024-01-09 09:07:04 +01:00
async def handle_data_shop_list_detail_request(self, data: Dict) -> Dict:
2023-03-09 17:38:58 +01:00
# ShopListIcon load
ret_str = "#ShopListIcon\r\n"
2023-03-09 17:38:58 +01:00
with open(
r"titles/cxb/data/rss1/Shop/ShopList_Icon.csv", encoding="utf-8"
2023-03-09 17:38:58 +01:00
) as shop:
lines = shop.readlines()
for line in lines:
ret_str += f"{line[:-1]}\r\n"
2023-03-09 17:38:58 +01:00
# ShopListMusic load
ret_str += "\r\n#ShopListMusic\r\n"
2023-03-09 17:38:58 +01:00
with open(
r"titles/cxb/data/rss1/Shop/ShopList_Music.csv", encoding="utf-8"
2023-03-09 17:38:58 +01:00
) as shop:
lines = shop.readlines()
for line in lines:
ret_str += f"{line[:-1]}\r\n"
2023-03-09 17:38:58 +01:00
# ShopListTitle load
ret_str += "\r\n#ShopListTitle\r\n"
2023-03-09 17:38:58 +01:00
with open(
r"titles/cxb/data/rss1/Shop/ShopList_Title.csv", encoding="utf-8"
2023-03-09 17:38:58 +01:00
) as shop:
lines = shop.readlines()
for line in lines:
ret_str += f"{line[:-1]}\r\n"
2023-03-09 17:38:58 +01:00
return {"data": ret_str}
2024-01-09 09:07:04 +01:00
async def handle_data_extra_stage_list_request(self, data: Dict) -> Dict:
2023-03-09 17:38:58 +01:00
return {"data": ""}
2024-01-09 09:07:04 +01:00
async def handle_data_exxxxx_request(self, data: Dict) -> Dict:
2023-03-09 17:38:58 +01:00
return {"data": ""}
2024-01-09 09:07:04 +01:00
async def handle_data_one_more_extra_list_request(self, data: Dict) -> Dict:
2023-03-09 17:38:58 +01:00
return {"data": ""}
2024-01-09 09:07:04 +01:00
async def handle_data_bonus_list10100_request(self, data: Dict) -> Dict:
2023-03-09 17:38:58 +01:00
return {"data": ""}
2024-01-09 09:07:04 +01:00
async def handle_data_oexxxx_request(self, data: Dict) -> Dict:
2023-03-09 17:38:58 +01:00
return {"data": ""}
2024-01-09 09:07:04 +01:00
async def handle_data_free_coupon_request(self, data: Dict) -> Dict:
2023-03-09 17:38:58 +01:00
return {"data": ""}
2023-03-09 17:38:58 +01:00
@cached(lifetime=86400)
2024-01-09 09:07:04 +01:00
async def handle_data_news_list_request(self, data: Dict) -> Dict:
ret_str = ""
with open(r"titles/cxb/data/rss1/NewsList.csv", encoding="UTF-8") as news:
lines = news.readlines()
for line in lines:
ret_str += f"{line[:-1]}\r\n"
2023-03-09 17:38:58 +01:00
return {"data": ret_str}
2024-01-09 09:07:04 +01:00
async def handle_data_tips_request(self, data: Dict) -> Dict:
2023-03-09 17:38:58 +01:00
return {"data": ""}
2024-01-09 09:07:04 +01:00
async def handle_data_release_info_list_request(self, data: Dict) -> Dict:
2023-03-09 17:38:58 +01:00
return {"data": ""}
@cached(lifetime=86400)
2024-01-09 09:07:04 +01:00
async def handle_data_random_music_list_request(self, data: Dict) -> Dict:
ret_str = ""
with open(r"titles/cxb/data/rss1/MusicArchiveList.csv") as music:
lines = music.readlines()
count = 0
for line in lines:
line_split = line.split(",")
2023-03-09 17:38:58 +01:00
ret_str += (
str(count) + "," + line_split[0] + "," + line_split[0] + ",\r\n"
)
return {"data": ret_str}
@cached(lifetime=86400)
2024-01-09 09:07:04 +01:00
async def handle_data_license_request(self, data: Dict) -> Dict:
ret_str = ""
with open(r"titles/cxb/data/rss1/License.csv", encoding="UTF-8") as licenses:
lines = licenses.readlines()
for line in lines:
ret_str += f"{line[:-1]}\r\n"
2023-03-09 17:38:58 +01:00
return {"data": ret_str}
@cached(lifetime=86400)
2024-01-09 09:07:04 +01:00
async def handle_data_course_list_request(self, data: Dict) -> Dict:
ret_str = ""
2023-03-09 17:38:58 +01:00
with open(
r"titles/cxb/data/rss1/Course/CourseList.csv", encoding="UTF-8"
2023-03-09 17:38:58 +01:00
) as course:
lines = course.readlines()
for line in lines:
ret_str += f"{line[:-1]}\r\n"
2023-03-09 17:38:58 +01:00
return {"data": ret_str}
@cached(lifetime=86400)
2024-01-09 09:07:04 +01:00
async def handle_data_csxxxx_request(self, data: Dict) -> Dict:
extra_num = int(data["dldate"]["filetype"][-4:])
ret_str = ""
2023-03-09 17:38:58 +01:00
with open(
rf"titles/cxb/data/rss1/Course/Cs{extra_num}.csv", encoding="shift-jis"
2023-03-09 17:38:58 +01:00
) as course:
lines = course.readlines()
for line in lines:
ret_str += f"{line[:-1]}\r\n"
2023-03-09 17:38:58 +01:00
return {"data": ret_str}
2024-01-09 09:07:04 +01:00
async def handle_data_mission_list_request(self, data: Dict) -> Dict:
2023-03-09 17:38:58 +01:00
return {"data": ""}
2024-01-09 09:07:04 +01:00
async def handle_data_mission_bonus_request(self, data: Dict) -> Dict:
2023-03-09 17:38:58 +01:00
return {"data": ""}
2024-01-09 09:07:04 +01:00
async def handle_data_unlimited_mission_request(self, data: Dict) -> Dict:
2023-03-09 17:38:58 +01:00
return {"data": ""}
2024-01-09 09:07:04 +01:00
async def handle_data_partner_list_request(self, data: Dict) -> Dict:
ret_str = ""
# Lord forgive me for the sins I am about to commit
2023-03-09 17:38:58 +01:00
for i in range(0, 10):
ret_str += f"80000{i},{i},{i},0,10000,,\r\n"
ret_str += f"80000{i},{i},{i},1,10500,,\r\n"
ret_str += f"80000{i},{i},{i},2,10500,,\r\n"
2023-03-09 17:38:58 +01:00
for i in range(10, 13):
ret_str += f"8000{i},{i},{i},0,10000,,\r\n"
ret_str += f"8000{i},{i},{i},1,10500,,\r\n"
ret_str += f"8000{i},{i},{i},2,10500,,\r\n"
2023-03-09 17:38:58 +01:00
ret_str += "\r\n---\r\n0,150,100,100,100,100,\r\n"
for i in range(1, 130):
ret_str += f"{i},100,100,100,100,100,\r\n"
ret_str += "---\r\n"
2023-03-09 17:38:58 +01:00
return {"data": ret_str}
@cached(lifetime=86400)
2024-01-09 09:07:04 +01:00
async def handle_data_partnerxxxx_request(self, data: Dict) -> Dict:
partner_num = int(data["dldate"]["filetype"][-4:])
ret_str = f"{partner_num},,{partner_num},1,10000,\r\n"
with open(r"titles/cxb/data/rss1/Partner0000.csv") as partner:
lines = partner.readlines()
for line in lines:
ret_str += f"{line[:-1]}\r\n"
2023-03-09 17:38:58 +01:00
return {"data": ret_str}
2024-01-09 09:07:04 +01:00
async def handle_data_server_state_request(self, data: Dict) -> Dict:
2023-03-09 17:38:58 +01:00
return {"data": True}
2024-01-09 09:07:04 +01:00
async def handle_data_settings_request(self, data: Dict) -> Dict:
2023-03-09 17:38:58 +01:00
return {"data": "2,\r\n"}
2024-01-09 09:07:04 +01:00
async def handle_data_story_list_request(self, data: Dict) -> Dict:
2023-03-09 17:38:58 +01:00
# story id, story name, game version, start time, end time, course arc, unlock flag, song mcode for menu
ret_str = "\r\n"
2023-03-09 17:38:58 +01:00
ret_str += (
f"st0000,RISING PURPLE,10104,1464370990,4096483201,Cs1000,-1,purple,\r\n"
)
ret_str += (
f"st0001,REBEL YELL,10104,1467999790,4096483201,Cs1000,-1,chaset,\r\n"
)
ret_str += f"st0002,REMNANT,10104,1502127790,4096483201,Cs1000,-1,overcl,\r\n"
2023-03-09 17:38:58 +01:00
return {"data": ret_str}
2024-01-09 09:07:04 +01:00
async def handle_data_stxxxx_request(self, data: Dict) -> Dict:
story_num = int(data["dldate"]["filetype"][-4:])
ret_str = ""
2023-03-09 17:38:58 +01:00
for i in range(1, 11):
ret_str += f"{i},st000{story_num}_{i-1},,,,,,,,,,,,,,,,1,,-1,1,\r\n"
return {"data": ret_str}
2024-01-09 09:07:04 +01:00
async def handle_data_event_stamp_list_request(self, data: Dict) -> Dict:
2023-03-09 17:38:58 +01:00
return {"data": "Cs1032,1,1,1,1,1,1,1,1,1,1,\r\n"}
2024-01-09 09:07:04 +01:00
async def handle_data_premium_list_request(self, data: Dict) -> Dict:
2023-03-09 17:38:58 +01:00
return {"data": "1,,,,10,,,,,99,,,,,,,,,100,,\r\n"}
2024-01-09 09:07:04 +01:00
async def handle_data_event_list_request(self, data: Dict) -> Dict:
2023-03-09 17:38:58 +01:00
return {"data": ""}
2024-01-09 09:07:04 +01:00
async def handle_data_event_detail_list_request(self, data: Dict) -> Dict:
event_id = data["dldate"]["filetype"].split("/")[2]
if "EventStampMapListCs1002" in event_id:
2023-03-09 17:38:58 +01:00
return {"data": "1,2,1,1,2,3,9,5,6,7,8,9,10,\r\n"}
elif "EventStampList" in event_id:
2023-03-09 17:38:58 +01:00
return {"data": "Cs1002,1,1,1,1,1,1,1,1,1,1,\r\n"}
else:
2023-03-09 17:38:58 +01:00
return {"data": ""}
2024-01-09 09:07:04 +01:00
async def handle_data_event_stamp_map_list_csxxxx_request(self, data: Dict) -> Dict:
event_id = data["dldate"]["filetype"].split("/")[2]
if "EventStampMapListCs1002" in event_id:
2023-03-09 17:38:58 +01:00
return {"data": "1,2,1,1,2,3,9,5,6,7,8,9,10,\r\n"}
else:
2023-03-09 17:38:58 +01:00
return {"data": ""}