3
2
forked from Dniel97/artemis

Merge branch 'develop' into fork_develop

This commit is contained in:
Dniel97 2024-03-20 20:37:32 +01:00
commit 3cd3910b0d
Signed by untrusted user: Dniel97
GPG Key ID: 6180B3C768FB2E08
13 changed files with 221 additions and 104 deletions

View File

@ -1,6 +1,10 @@
# Changelog
Documenting updates to ARTEMiS, to be updated every time the master branch is pushed to.
## 20240318
### CXB
+ Fixing handle_data_shop_list_detail_request for Sunrise S1
## 20240302
### SAO
+ Fixing new profile creation with right heroes and start VP

View File

@ -0,0 +1,56 @@
"""GekiChu rating tables
Revision ID: 6a7e8277763b
Revises: d8950c7ce2fc
Create Date: 2024-03-13 12:18:53.210018
"""
from alembic import op
from sqlalchemy import Column, Integer, String
# revision identifiers, used by Alembic.
revision = '6a7e8277763b'
down_revision = 'd8950c7ce2fc'
branch_labels = None
depends_on = None
GEKICHU_RATING_TABLE_NAMES = [
"chuni_profile_rating",
"ongeki_profile_rating",
]
def upgrade():
for table_name in GEKICHU_RATING_TABLE_NAMES:
op.create_table(
table_name,
Column("id", Integer, primary_key=True, nullable=False),
Column("user", Integer, nullable=False),
Column("version", Integer, nullable=False),
Column("type", String(255), nullable=False),
Column("index", Integer, nullable=False),
Column("musicId", Integer),
Column("difficultId", Integer),
Column("romVersionCode", Integer),
Column("score", Integer),
mysql_charset="utf8mb4",
)
op.create_foreign_key(
None,
table_name,
"aime_user",
["user"],
["id"],
ondelete="cascade",
onupdate="cascade",
)
op.create_unique_constraint(
f"{table_name}_uk",
table_name,
["user", "version", "type", "index"],
)
def downgrade():
for table_name in GEKICHU_RATING_TABLE_NAMES:
op.drop_table(table_name)

View File

@ -21,3 +21,4 @@ starlette
asyncio
uvicorn
alembic
python-multipart

View File

@ -925,6 +925,17 @@ class ChuniBase:
for rp in upsert["userRecentPlayerList"]:
pass
for rating_type in {"userRatingBaseList", "userRatingBaseHotList", "userRatingBaseNextList"}:
if rating_type not in upsert:
continue
await self.data.profile.put_profile_rating(
user_id,
self.version,
rating_type,
upsert[rating_type],
)
return {"returnCode": "1"}
async def handle_upsert_user_chargelog_api_request(self, data: Dict) -> Dict:

View File

@ -1,10 +1,9 @@
from typing import Dict, List, Optional
from sqlalchemy import Table, Column, UniqueConstraint, PrimaryKeyConstraint, and_
from sqlalchemy.types import Integer, String, TIMESTAMP, Boolean, JSON, BigInteger
from sqlalchemy.engine.base import Connection
from sqlalchemy import Table, Column, UniqueConstraint, and_
from sqlalchemy.types import Integer, String, Boolean, JSON, BigInteger
from sqlalchemy.schema import ForeignKey
from sqlalchemy.engine import Row
from sqlalchemy.sql import func, select
from sqlalchemy.sql import select, delete
from sqlalchemy.dialects.mysql import insert
from core.data.schema import BaseData, metadata
@ -393,6 +392,26 @@ team = Table(
mysql_charset="utf8mb4",
)
rating = Table(
"chuni_profile_rating",
metadata,
Column("id", Integer, primary_key=True, nullable=False),
Column(
"user",
ForeignKey("aime_user.id", ondelete="cascade", onupdate="cascade"),
nullable=False,
),
Column("version", Integer, nullable=False),
Column("type", String(255), nullable=False),
Column("index", Integer, nullable=False),
Column("musicId", Integer),
Column("difficultId", Integer),
Column("romVersionCode", Integer),
Column("score", Integer),
UniqueConstraint("user", "version", "type", "index", name="chuni_profile_rating_best_uk"),
mysql_charset="utf8mb4",
)
class ChuniProfileData(BaseData):
async def update_name(self, user_id: int, new_name: str) -> bool:
@ -714,3 +733,27 @@ class ChuniProfileData(BaseData):
return {
"total_play_count": total_play_count
}
async def put_profile_rating(
self,
aime_id: int,
version: int,
rating_type: str,
rating_data: List[Dict],
):
inserted_values = [
{"user": aime_id, "version": version, "type": rating_type, "index": i, **x}
for (i, x) in enumerate(rating_data)
]
sql = insert(rating).values(inserted_values)
update_dict = {x.name: x for x in sql.inserted if x.name != "id"}
sql = sql.on_duplicate_key_update(**update_dict)
result = await self.execute(sql)
if result is None:
self.logger.warn(
f"put_profile_rating: Could not insert {rating_type}, aime_id: {aime_id}",
)
return
return result.lastrowid

View File

@ -1,3 +0,0 @@
saleID.,<2C>J<EFBFBD>n<EFBFBD><6E>,<2C>I<EFBFBD><49><EFBFBD><EFBFBD>,ShopID,Price,
0,1411696799,1443236400,0,7000,
1,1411783199,1443322800,1,7000,
1 saleID. �J�n�� �I���� ShopID Price
2 0 1411696799 1443236400 0 7000
3 1 1411783199 1443322800 1 7000

View File

@ -1,4 +0,0 @@
shopID.,整理用No.,Ver.,出現フラグ,出現フラグ参照ID,条件,出現時間,消滅時間,ItemCode,価格,表示タイプ,Text,Type,Value(op),Value,対象曲,Difficulty(op),Difficulty,Level(op),Level,Grade(Op),Grade,GaugeType(op),GaugeType,HS(op)i,HS,APP,DAP,F-V,F-H,FullCombo,Combo(op),Combo,ClearRate(op),ClearRate,プレイ日,地域,
3000,1,1.00.00,1,-1,-,1411697520.0288,1443233520.0288,skb0000,10,1,MASTER以上の2曲S+以上フルコンボクリアする。,1,1,1,-,1,2,-1,-1,1,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,,,
3001,2,1.00.00,1,-1,-,1411697520.0288,1443233520.0288,skb0001,10,1,Next Frontier (Masterをクリア,0,-1,-1,bleeze,1,2,-1,-1,1,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,,,
3002,3,1.00.00,1,-1,-,1412103600.0288,1443639598.992,skb0002,10,2,Master以上を1曲をS+以上でクリアする。,1,1,1,-,1,2,-1,-1,1,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,,1,
1 shopID. 整理用No. Ver. 出現フラグ 出現フラグ参照ID 条件 出現時間 消滅時間 ItemCode 価格 表示タイプ Text Type Value(op) Value 対象曲 Difficulty(op) Difficulty Level(op) Level Grade(Op) Grade GaugeType(op) GaugeType HS(op)i HS APP DAP F-V F-H FullCombo Combo(op) Combo ClearRate(op) ClearRate プレイ日 地域
2 3000 1 1.00.00 1 -1 - 1411697520.0288 1443233520.0288 skb0000 10 1 MASTER以上の2曲S+以上フルコンボクリアする。 1 1 1 - 1 2 -1 -1 1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
3 3001 2 1.00.00 1 -1 - 1411697520.0288 1443233520.0288 skb0001 10 1 Next Frontier (Master)をクリア 0 -1 -1 bleeze 1 2 -1 -1 1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
4 3002 3 1.00.00 1 -1 - 1412103600.0288 1443639598.992 skb0002 10 2 Master以上を1曲をS+以上でクリアする。 1 1 1 - 1 2 -1 -1 1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1

View File

@ -1,11 +0,0 @@
shopID.,<2C><><EFBFBD><EFBFBD><EFBFBD>pNo.,Ver.,<2C>o<EFBFBD><6F><EFBFBD>t<EFBFBD><74><EFBFBD>O,<2C>o<EFBFBD><6F><EFBFBD>t<EFBFBD><74><EFBFBD>O<EFBFBD>Q<EFBFBD><51>ID,<2C><><EFBFBD><EFBFBD>,<2C>o<EFBFBD><6F><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD>Ŏ<EFBFBD><C58E><EFBFBD>,ItemCode,<2C><><EFBFBD>i,<2C>\<5C><><EFBFBD>^<5E>C<EFBFBD>v,Text,Type,Value(op),Value,<2C>Ώۋ<CE8F>,Difficulty(op),Difficulty,Level(op),Level,Grade(Op),Grade,GaugeType(op),GaugeType,HS(op)i,HS,APP,DAP,F-V,F-H,FullCombo,Combo(op),Combo,ClearRate(op),ClearRate,<2C>v<EFBFBD><76><EFBFBD>C<EFBFBD><43>,<2C>n<EFBFBD><6E>,
5000,1,10000,1,-1,-,1411697520,1443233520,ske0000,10,1,MASTER<45>ȏ<EFBFBD><C88F>2<EFBFBD><32>S+<2B>ȏ<EFBFBD>t<EFBFBD><74><EFBFBD>R<EFBFBD><52><EFBFBD>{<7B>N<EFBFBD><4E><EFBFBD>A<EFBFBD><41><EFBFBD><EFBFBD>B,1,1,1,-,1,2,-1,-1,1,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,,,
5001,2,10000,1,-1,-,1411697520,1443233520,ske0001,10,1,Next Frontier (Master<65>j<EFBFBD><6A><EFBFBD>N<EFBFBD><4E><EFBFBD>A,0,-1,-1,megaro,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,,,
5002,3,10000,1,-1,-,1412103600,1443639598,ske0002,10,2,Master<65>ȏ<EFBFBD><C88F>1<EFBFBD>Ȃ<EFBFBD>S+<2B>ȏ<EFBFBD>ŃN<C583><4E><EFBFBD>A<EFBFBD><41><EFBFBD><EFBFBD>B,1,1,1,-,1,2,-1,-1,1,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,,1,
5003,4,10000,1,-1,-,1412103600,1443639598,ske0003,10,0,Master<65>ȏ<EFBFBD><C88F>1<EFBFBD>Ȃ<EFBFBD>S+<2B>ȏ<EFBFBD>ŃN<C583><4E><EFBFBD>A<EFBFBD><41><EFBFBD><EFBFBD>B,1,1,1,-,1,2,-1,-1,1,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,,,
5004,5,10000,1,-1,-,1412103600,1443639598,ske0004,10,2,2<>ȃN<C883><4E><EFBFBD>A,1,1,2,-,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,,,
5005,5,10000,1,-1,-,1412103600,1443639598,ske0005,10,2,3<>ȃN<C883><4E><EFBFBD>A,1,1,3,-,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,,,
5006,5,10000,1,-1,-,1412103600,1443639598,ske0006,10,2,4<>ȃN<C883><4E><EFBFBD>A,1,1,4,-,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,,,
5007,5,10000,1,-1,-,1412103600,1443639598,ske0007,10,2,5<>ȃN<C883><4E><EFBFBD>A,1,1,5,-,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,,,
5008,5,10000,1,-1,-,1412103600,1443639598,ske0008,10,2,6<>ȃN<C883><4E><EFBFBD>A,1,1,6,-,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,,,
5009,5,10000,1,-1,-,1412103600,1443639598,ske0009,10,2,7<>ȃN<C883><4E><EFBFBD>A,1,1,7,-,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,,,
1 shopID. �����pNo. Ver. �o���t���O �o���t���O�Q��ID ���� �o������ ���Ŏ��� ItemCode ���i �\���^�C�v Text Type Value(op) Value �Ώۋ� Difficulty(op) Difficulty Level(op) Level Grade(Op) Grade GaugeType(op) GaugeType HS(op)i HS APP DAP F-V F-H FullCombo Combo(op) Combo ClearRate(op) ClearRate �v���C�� �n��
2 5000 1 10000 1 -1 - 1411697520 1443233520 ske0000 10 1 MASTER�ȏ��2��S+�ȏ�t���R���{�N���A����B 1 1 1 - 1 2 -1 -1 1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
3 5001 2 10000 1 -1 - 1411697520 1443233520 ske0001 10 1 Next Frontier (Master�j���N���A 0 -1 -1 megaro -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
4 5002 3 10000 1 -1 - 1412103600 1443639598 ske0002 10 2 Master�ȏ��1�Ȃ�S+�ȏ�ŃN���A����B 1 1 1 - 1 2 -1 -1 1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1
5 5003 4 10000 1 -1 - 1412103600 1443639598 ske0003 10 0 Master�ȏ��1�Ȃ�S+�ȏ�ŃN���A����B 1 1 1 - 1 2 -1 -1 1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
6 5004 5 10000 1 -1 - 1412103600 1443639598 ske0004 10 2 2�ȃN���A 1 1 2 - -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
7 5005 5 10000 1 -1 - 1412103600 1443639598 ske0005 10 2 3�ȃN���A 1 1 3 - -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
8 5006 5 10000 1 -1 - 1412103600 1443639598 ske0006 10 2 4�ȃN���A 1 1 4 - -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
9 5007 5 10000 1 -1 - 1412103600 1443639598 ske0007 10 2 5�ȃN���A 1 1 5 - -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
10 5008 5 10000 1 -1 - 1412103600 1443639598 ske0008 10 2 6�ȃN���A 1 1 6 - -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
11 5009 5 10000 1 -1 - 1412103600 1443639598 ske0009 10 2 7�ȃN���A 1 1 7 - -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1

View File

@ -1,6 +0,0 @@
shopID.,<2C><><EFBFBD><EFBFBD><EFBFBD>pNo.,Ver.,<2C>o<EFBFBD><6F><EFBFBD>t<EFBFBD><74><EFBFBD>O,<2C>o<EFBFBD><6F><EFBFBD>t<EFBFBD><74><EFBFBD>O<EFBFBD>Q<EFBFBD><51>ID,<2C><><EFBFBD><EFBFBD>,<2C>o<EFBFBD><6F><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD>Ŏ<EFBFBD><C58E><EFBFBD>,ItemCode,<2C><><EFBFBD>i,<2C>\<5C><><EFBFBD>^<5E>C<EFBFBD>v,Text,Type,Value(op),Value,<2C>Ώۋ<CE8F>,Difficulty(op),Difficulty,Level(op),Level,Grade(Op),Grade,GaugeType(op),GaugeType,HS(op)i,HS,APP,DAP,F-V,F-H,FullCombo,Combo(op),Combo,ClearRate(op),ClearRate,<2C>v<EFBFBD><76><EFBFBD>C<EFBFBD><43>,<2C>n<EFBFBD><6E>,
4000,1,10000,1,-1,-,1411697520,4096483201,skt0000,10,1,MASTER<45>ȏ<EFBFBD><C88F>2<EFBFBD><32>S+<2B>ȏ<EFBFBD>t<EFBFBD><74><EFBFBD>R<EFBFBD><52><EFBFBD>{<7B>N<EFBFBD><4E><EFBFBD>A<EFBFBD><41><EFBFBD><EFBFBD>B,1,1,1,-,1,2,-1,-1,1,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,,,
4001,2,10000,1,-1,-,1411697520,4096483201,skt0001,10,1,Next Frontier (Master<65>j<EFBFBD><6A><EFBFBD>N<EFBFBD><4E><EFBFBD>A,0,-1,-1,megaro,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,,,
4002,3,10000,1,-1,-,1412103600,4096483201,skt0002,10,2,Master<65>ȏ<EFBFBD><C88F>1<EFBFBD>Ȃ<EFBFBD>S+<2B>ȏ<EFBFBD>ŃN<C583><4E><EFBFBD>A<EFBFBD><41><EFBFBD><EFBFBD>B,1,1,1,-,1,2,-1,-1,1,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,,1,
4003,4,10000,1,-1,-,1412103600,4096483201,skt0003,10,0,Master<65>ȏ<EFBFBD><C88F>1<EFBFBD>Ȃ<EFBFBD>S+<2B>ȏ<EFBFBD>ŃN<C583><4E><EFBFBD>A<EFBFBD><41><EFBFBD><EFBFBD>B,1,1,1,-,1,2,-1,-1,1,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,,,
4004,5,10000,1,-1,-,1412103600,4096483201,skt0004,10,2,aaaaaaaaaaaaaaaaa,1,1,20,-,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,,,
1 shopID. �����pNo. Ver. �o���t���O �o���t���O�Q��ID ���� �o������ ���Ŏ��� ItemCode ���i �\���^�C�v Text Type Value(op) Value �Ώۋ� Difficulty(op) Difficulty Level(op) Level Grade(Op) Grade GaugeType(op) GaugeType HS(op)i HS APP DAP F-V F-H FullCombo Combo(op) Combo ClearRate(op) ClearRate �v���C�� �n��
2 4000 1 10000 1 -1 - 1411697520 4096483201 skt0000 10 1 MASTER�ȏ��2��S+�ȏ�t���R���{�N���A����B 1 1 1 - 1 2 -1 -1 1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
3 4001 2 10000 1 -1 - 1411697520 4096483201 skt0001 10 1 Next Frontier (Master�j���N���A 0 -1 -1 megaro -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
4 4002 3 10000 1 -1 - 1412103600 4096483201 skt0002 10 2 Master�ȏ��1�Ȃ�S+�ȏ�ŃN���A����B 1 1 1 - 1 2 -1 -1 1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1
5 4003 4 10000 1 -1 - 1412103600 4096483201 skt0003 10 0 Master�ȏ��1�Ȃ�S+�ȏ�ŃN���A����B 1 1 1 - 1 2 -1 -1 1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
6 4004 5 10000 1 -1 - 1412103600 4096483201 skt0004 10 2 aaaaaaaaaaaaaaaaa 1 1 20 - -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1

View File

@ -73,42 +73,6 @@ class CxbRevSunriseS1(CxbBase):
for line in lines:
ret_str += f"{line[:-1]}\r\n"
# ShopListSale load
ret_str += "\r\n#ShopListSale\r\n"
with open(
r"titles/cxb/data/rss1/Shop/ShopList_Sale.csv", encoding="shift-jis"
) as shop:
lines = shop.readlines()
for line in lines:
ret_str += f"{line[:-1]}\r\n"
# ShopListSkinBg load
ret_str += "\r\n#ShopListSkinBg\r\n"
with open(
r"titles/cxb/data/rss1/Shop/ShopList_SkinBg.csv", encoding="shift-jis"
) as shop:
lines = shop.readlines()
for line in lines:
ret_str += f"{line[:-1]}\r\n"
# ShopListSkinEffect load
ret_str += "\r\n#ShopListSkinEffect\r\n"
with open(
r"titles/cxb/data/rss1/Shop/ShopList_SkinEffect.csv", encoding="shift-jis"
) as shop:
lines = shop.readlines()
for line in lines:
ret_str += f"{line[:-1]}\r\n"
# ShopListSkinNotes load
ret_str += "\r\n#ShopListSkinNotes\r\n"
with open(
r"titles/cxb/data/rss1/Shop/ShopList_SkinNotes.csv", encoding="shift-jis"
) as shop:
lines = shop.readlines()
for line in lines:
ret_str += f"{line[:-1]}\r\n"
# ShopListTitle load
ret_str += "\r\n#ShopListTitle\r\n"
with open(

View File

@ -1068,6 +1068,24 @@ class OngekiBase:
for x in upsert["userKopList"]:
await self.data.profile.put_kop(user_id, x)
for rating_type in {
"userRatingBaseBestList",
"userRatingBaseBestNewList",
"userRatingBaseHotList",
"userRatingBaseNextList",
"userRatingBaseNextNewList",
"userRatingBaseHotNextList",
}:
if rating_type not in upsert:
continue
await self.data.profile.put_profile_rating(
user_id,
self.version,
rating_type,
upsert[rating_type],
)
return {"returnCode": 1, "apiName": "upsertUserAll"}
async def handle_get_user_rival_api_request(self, data: Dict) -> Dict:

View File

@ -246,6 +246,26 @@ rival = Table(
mysql_charset="utf8mb4",
)
rating = Table(
"ongeki_profile_rating",
metadata,
Column("id", Integer, primary_key=True, nullable=False),
Column(
"user",
ForeignKey("aime_user.id", ondelete="cascade", onupdate="cascade"),
nullable=False,
),
Column("version", Integer, nullable=False),
Column("type", String(255), nullable=False),
Column("index", Integer, nullable=False),
Column("musicId", Integer),
Column("difficultId", Integer),
Column("romVersionCode", Integer),
Column("score", Integer),
UniqueConstraint("user", "version", "type", "index", name="ongeki_profile_rating_best_uk"),
mysql_charset="utf8mb4",
)
class OngekiProfileData(BaseData):
def __init__(self, cfg: CoreConfig, conn: Connection) -> None:
@ -508,6 +528,7 @@ class OngekiProfileData(BaseData):
)
return None
return result.lastrowid
async def delete_rival(self, aime_id: int, rival_id: int) -> Optional[int]:
sql = delete(rival).where(rival.c.user==aime_id, rival.c.rivalUserId==rival_id)
result = await self.execute(sql)
@ -515,3 +536,27 @@ class OngekiProfileData(BaseData):
self.logger.error(f"delete_rival: failed to delete! aime_id: {aime_id}, rival_id: {rival_id}")
else:
return result.rowcount
async def put_profile_rating(
self,
aime_id: int,
version: int,
rating_type: str,
rating_data: List[Dict],
):
inserted_values = [
{"user": aime_id, "version": version, "type": rating_type, "index": i, **x}
for (i, x) in enumerate(rating_data)
]
sql = insert(rating).values(inserted_values)
update_dict = {x.name: x for x in sql.inserted if x.name != "id"}
sql = sql.on_duplicate_key_update(**update_dict)
result = await self.execute(sql)
if result is None:
self.logger.warn(
f"put_profile_rating_{rating_type}: Could not insert rating entries, aime_id: {aime_id}",
)
return
return result.lastrowid

View File

@ -11,7 +11,10 @@ from titles.wacca.handlers import *
class WaccaS(WaccaBase):
allowed_stages = [
def __init__(self, cfg: CoreConfig, game_cfg: WaccaConfig) -> None:
super().__init__(cfg, game_cfg)
self.version = WaccaConstants.VER_WACCA_S
self.allowed_stages = [
(1513, 13),
(1512, 12),
(1511, 11),
@ -21,16 +24,12 @@ class WaccaS(WaccaBase):
(1507, 7),
(1506, 6),
(1505, 5),
(1514, 4),
(1513, 3),
(1512, 2),
(1511, 1),
(1504, 4),
(1503, 3),
(1502, 2),
(1501, 1),
]
def __init__(self, cfg: CoreConfig, game_cfg: WaccaConfig) -> None:
super().__init__(cfg, game_cfg)
self.version = WaccaConstants.VER_WACCA_S
async def handle_advertise_GetNews_request(self, data: Dict) -> Dict:
resp = GetNewsResponseV2()
return resp.make()