forked from Hay1tsme/artemis
Merge pull request 'develop' (#3) from Hay1tsme/artemis:develop into develop
Reviewed-on: ThatzOkay/artemis#3
This commit is contained in:
commit
21a09f2de9
@ -0,0 +1,54 @@
|
||||
"""pokken_fix_pokemon_uk
|
||||
|
||||
Revision ID: 3657efefc5a4
|
||||
Revises: 4a02e623e5e6
|
||||
Create Date: 2024-06-13 23:50:57.611998
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import mysql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '3657efefc5a4'
|
||||
down_revision = '4a02e623e5e6'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.alter_column('pokken_pokemon_data', 'char_id',
|
||||
existing_type=mysql.INTEGER(display_width=11),
|
||||
nullable=True)
|
||||
op.alter_column('pokken_pokemon_data', 'illustration_book_no',
|
||||
existing_type=mysql.INTEGER(display_width=11),
|
||||
nullable=False)
|
||||
op.drop_constraint('pokken_pokemon_data_ibfk_1', table_name='pokken_pokemon_data', type_='foreignkey')
|
||||
op.drop_index('pokken_pokemon_data_uk', table_name='pokken_pokemon_data')
|
||||
op.create_unique_constraint('pokken_pokemon_uk', 'pokken_pokemon_data', ['user', 'illustration_book_no'])
|
||||
op.create_foreign_key("pokken_pokemon_data_ibfk_1", "pokken_pokemon_data", "aime_user", ['user'], ['id'])
|
||||
op.alter_column('pokken_profile', 'trainer_name',
|
||||
existing_type=mysql.VARCHAR(length=16),
|
||||
type_=sa.String(length=14),
|
||||
existing_nullable=True)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.alter_column('pokken_profile', 'trainer_name',
|
||||
existing_type=sa.String(length=14),
|
||||
type_=mysql.VARCHAR(length=16),
|
||||
existing_nullable=True)
|
||||
op.drop_constraint('pokken_pokemon_data_ibfk_1', table_name='pokken_pokemon_data', type_='foreignkey')
|
||||
op.drop_constraint('pokken_pokemon_uk', 'pokken_pokemon_data', type_='unique')
|
||||
op.create_index('pokken_pokemon_data_uk', 'pokken_pokemon_data', ['user', 'char_id'], unique=True)
|
||||
op.create_foreign_key("pokken_pokemon_data_ibfk_1", "pokken_pokemon_data", "aime_user", ['user'], ['id'])
|
||||
op.alter_column('pokken_pokemon_data', 'illustration_book_no',
|
||||
existing_type=mysql.INTEGER(display_width=11),
|
||||
nullable=True)
|
||||
op.alter_column('pokken_pokemon_data', 'char_id',
|
||||
existing_type=mysql.INTEGER(display_width=11),
|
||||
nullable=False)
|
||||
# ### end Alembic commands ###
|
@ -49,7 +49,7 @@ class Utils:
|
||||
def get_title_port_ssl(cls, cfg: CoreConfig):
|
||||
if cls.real_title_port_ssl is not None: return cls.real_title_port_ssl
|
||||
|
||||
cls.real_title_port_ssl = cfg.server.proxy_port_ssl if cfg.server.is_using_proxy and cfg.server.proxy_port_ssl else Utils.get_title_port(cfg)
|
||||
cls.real_title_port_ssl = cfg.server.proxy_port_ssl if cfg.server.is_using_proxy and cfg.server.proxy_port_ssl else 443
|
||||
|
||||
return cls.real_title_port_ssl
|
||||
|
||||
|
@ -1,9 +1,7 @@
|
||||
from datetime import datetime, timedelta
|
||||
from datetime import datetime
|
||||
import json, logging
|
||||
from typing import Any, Dict, List
|
||||
import random
|
||||
|
||||
from core.data import Data
|
||||
from core import CoreConfig
|
||||
from .config import PokkenConfig
|
||||
from .proto import jackal_pb2
|
||||
@ -18,7 +16,6 @@ class PokkenBase:
|
||||
self.version = 0
|
||||
self.logger = logging.getLogger("pokken")
|
||||
self.data = PokkenData(core_cfg)
|
||||
self.SUPPORT_SET_NONE = 4294967295
|
||||
|
||||
async def handle_noop(self, request: Any) -> bytes:
|
||||
res = jackal_pb2.Response()
|
||||
@ -38,7 +35,30 @@ class PokkenBase:
|
||||
res = jackal_pb2.Response()
|
||||
res.result = 1
|
||||
res.type = jackal_pb2.MessageType.REGISTER_PCB
|
||||
self.logger.info(f"Register PCB {request.register_pcb.pcb_id}")
|
||||
pcbid = request.register_pcb.pcb_id
|
||||
if not pcbid.isdigit() or len(pcbid) != 12 or \
|
||||
not pcbid.startswith(f"{PokkenConstants.SERIAL_IDENT[0]}{PokkenConstants.SERIAL_REGIONS[0]}{PokkenConstants.SERIAL_ROLES[0]}{PokkenConstants.SERIAL_CAB_IDENTS[0]}"):
|
||||
self.logger.warn(f"Bad PCBID {pcbid}")
|
||||
res.result = 0
|
||||
return res
|
||||
|
||||
netid = PokkenConstants.NETID_PREFIX[0] + pcbid[5:]
|
||||
|
||||
self.logger.info(f"Register PCB {pcbid} (netID {netid})")
|
||||
|
||||
minfo = await self.data.arcade.get_machine(netid)
|
||||
|
||||
if not minfo and not self.core_cfg.server.allow_unregistered_serials:
|
||||
self.logger.warn(f"netID {netid} does not belong to any shop!")
|
||||
res.result = 0
|
||||
return res
|
||||
|
||||
elif not minfo:
|
||||
self.logger.warn(f"Orphaned netID {netid} allowed to connect")
|
||||
locid = 0
|
||||
|
||||
else:
|
||||
locid = minfo['arcade']
|
||||
|
||||
regist_pcb = jackal_pb2.RegisterPcbResponseData()
|
||||
regist_pcb.server_time = int(datetime.now().timestamp())
|
||||
@ -46,7 +66,7 @@ class PokkenBase:
|
||||
"MatchingServer": {
|
||||
"host": f"https://{self.game_cfg.server.hostname}",
|
||||
"port": self.game_cfg.ports.game,
|
||||
"url": "/SDAK/100/matching",
|
||||
"url": "/pokken/matching",
|
||||
},
|
||||
"StunServer": {
|
||||
"addr": self.game_cfg.server.stun_server_host,
|
||||
@ -56,10 +76,10 @@ class PokkenBase:
|
||||
"addr": self.game_cfg.server.stun_server_host,
|
||||
"port": self.game_cfg.server.stun_server_port,
|
||||
},
|
||||
"AdmissionUrl": f"ws://{self.game_cfg.server.hostname}:{self.game_cfg.ports.admission}",
|
||||
"locationId": 123, # FIXME: Get arcade's ID from the database
|
||||
"logfilename": "JackalMatchingLibrary.log",
|
||||
"biwalogfilename": "./biwa.log",
|
||||
"AdmissionUrl": f"ws://{self.game_cfg.server.hostname}:{self.game_cfg.ports.admission}/pokken/admission",
|
||||
"locationId": locid,
|
||||
"logfilename": "J:\\JackalMatchingLibrary.log",
|
||||
"biwalogfilename": "J:\\biwa_log.log",
|
||||
}
|
||||
regist_pcb.bnp_baseuri = f"{self.core_cfg.server.hostname}/bna"
|
||||
regist_pcb.biwa_setting = json.dumps(biwa_setting)
|
||||
@ -95,12 +115,11 @@ class PokkenBase:
|
||||
res.type = jackal_pb2.MessageType.LOAD_CLIENT_SETTINGS
|
||||
settings = jackal_pb2.LoadClientSettingsResponseData()
|
||||
|
||||
# TODO: Make configurable
|
||||
settings.money_magnification = 1
|
||||
settings.continue_bonus_exp = 100
|
||||
settings.continue_fight_money = 100
|
||||
settings.event_bonus_exp = 100
|
||||
settings.level_cap = 999
|
||||
settings.level_cap = 100
|
||||
settings.op_movie_flag = 0xFFFFFFFF
|
||||
settings.lucky_bonus_rate = 1
|
||||
settings.fail_support_num = 10
|
||||
@ -132,9 +151,13 @@ class PokkenBase:
|
||||
res.type = jackal_pb2.MessageType.LOAD_USER
|
||||
access_code = request.load_user.access_code
|
||||
load_usr = jackal_pb2.LoadUserResponseData()
|
||||
user_id = await self.data.card.get_user_id_from_card(access_code)
|
||||
load_usr.load_hash = 1
|
||||
load_usr.access_code = access_code
|
||||
load_usr.precedent_release_flag = 0xFFFFFFFF
|
||||
load_usr.cardlock_status = False
|
||||
card = await self.data.card.get_card_by_access_code(access_code)
|
||||
|
||||
if user_id is None and self.game_cfg.server.auto_register:
|
||||
if card is None and self.game_cfg.server.auto_register:
|
||||
user_id = await self.data.user.create_user()
|
||||
card_id = await self.data.card.create_card(user_id, access_code)
|
||||
|
||||
@ -142,54 +165,34 @@ class PokkenBase:
|
||||
f"Register new card {access_code} (UserId {user_id}, CardId {card_id})"
|
||||
)
|
||||
|
||||
elif user_id is None:
|
||||
elif card is None:
|
||||
self.logger.info(f"Registration of card {access_code} blocked!")
|
||||
res.load_user.CopyFrom(load_usr)
|
||||
return res.SerializeToString()
|
||||
|
||||
else:
|
||||
user_id = card['user']
|
||||
card_id = card['id']
|
||||
|
||||
"""
|
||||
TODO: Add repeated values
|
||||
tutorial_progress_flag
|
||||
rankmatch_progress
|
||||
TODO: Unlock all supports? Probably
|
||||
support_pokemon_list
|
||||
support_set_1
|
||||
support_set_2
|
||||
support_set_3
|
||||
aid_skill_list
|
||||
achievement_flag
|
||||
event_achievement_flag
|
||||
event_achievement_param
|
||||
"""
|
||||
profile = await self.data.profile.get_profile(user_id)
|
||||
load_usr.commidserv_result = 1
|
||||
load_usr.load_hash = 1
|
||||
load_usr.cardlock_status = False
|
||||
load_usr.banapass_id = user_id
|
||||
load_usr.access_code = access_code
|
||||
load_usr.precedent_release_flag = 0xFFFFFFFF
|
||||
|
||||
if profile is None:
|
||||
if profile is None or profile['trainer_name'] is None:
|
||||
profile_id = await self.data.profile.create_profile(user_id)
|
||||
self.logger.info(f"Create new profile {profile_id} for user {user_id}")
|
||||
profile_dict = {"id": profile_id, "user": user_id}
|
||||
pokemon_data = []
|
||||
tutorial_progress = []
|
||||
rankmatch_progress = []
|
||||
achievement_flag = []
|
||||
event_achievement_flag = []
|
||||
event_achievement_param = []
|
||||
load_usr.new_card_flag = True
|
||||
|
||||
else:
|
||||
profile_dict = {k: v for k, v in profile._asdict().items() if v is not None}
|
||||
self.logger.info(
|
||||
f"Card-in user {user_id} (Trainer name {profile_dict.get('trainer_name', '')})"
|
||||
)
|
||||
self.logger.info(f"Card-in user {user_id} (Trainer name {profile_dict.get('trainer_name', '')})")
|
||||
pokemon_data = await self.data.profile.get_all_pokemon_data(user_id)
|
||||
tutorial_progress = []
|
||||
rankmatch_progress = []
|
||||
achievement_flag = []
|
||||
event_achievement_flag = []
|
||||
event_achievement_param = []
|
||||
load_usr.new_card_flag = False
|
||||
|
||||
load_usr.navi_newbie_flag = profile_dict.get("navi_newbie_flag", True)
|
||||
@ -201,9 +204,9 @@ class PokkenBase:
|
||||
load_usr.trainer_name = profile_dict.get(
|
||||
"trainer_name", f"Newb{str(user_id).zfill(4)}"
|
||||
)
|
||||
load_usr.trainer_rank_point = profile_dict.get("trainer_rank_point", 0)
|
||||
load_usr.wallet = profile_dict.get("wallet", 0)
|
||||
load_usr.fight_money = profile_dict.get("fight_money", 0)
|
||||
load_usr.trainer_rank_point = profile_dict.get("trainer_rank_point", 0) # determines rank
|
||||
load_usr.wallet = profile_dict.get("wallet", 0) # pg count
|
||||
load_usr.fight_money = profile_dict.get("fight_money", 0) # ?
|
||||
load_usr.score_point = profile_dict.get("score_point", 0)
|
||||
load_usr.grade_max_num = profile_dict.get("grade_max_num", 0)
|
||||
load_usr.extra_counter = profile_dict.get("extra_counter", 0)
|
||||
@ -218,18 +221,18 @@ class PokkenBase:
|
||||
load_usr.rank_event = profile_dict.get("rank_event", 0)
|
||||
load_usr.awake_num = profile_dict.get("awake_num", 0)
|
||||
load_usr.use_support_num = profile_dict.get("use_support_num", 0)
|
||||
load_usr.rankmatch_flag = profile_dict.get("rankmatch_flag", 0)
|
||||
load_usr.rankmatch_flag = profile_dict.get("rankmatch_flag", 0) # flags that next rank match will be rank up
|
||||
load_usr.rankmatch_max = profile_dict.get("rankmatch_max", 0)
|
||||
load_usr.rankmatch_success = profile_dict.get("rankmatch_success", 0)
|
||||
load_usr.beat_num = profile_dict.get("beat_num", 0)
|
||||
load_usr.title_text_id = profile_dict.get("title_text_id", 0)
|
||||
load_usr.title_plate_id = profile_dict.get("title_plate_id", 0)
|
||||
load_usr.title_decoration_id = profile_dict.get("title_decoration_id", 0)
|
||||
load_usr.title_text_id = profile_dict.get("title_text_id", 2)
|
||||
load_usr.title_plate_id = profile_dict.get("title_plate_id", 1)
|
||||
load_usr.title_decoration_id = profile_dict.get("title_decoration_id", 1)
|
||||
load_usr.navi_trainer = profile_dict.get("navi_trainer", 0)
|
||||
load_usr.navi_version_id = profile_dict.get("navi_version_id", 0)
|
||||
load_usr.aid_skill = profile_dict.get("aid_skill", 0)
|
||||
load_usr.comment_text_id = profile_dict.get("comment_text_id", 0)
|
||||
load_usr.comment_word_id = profile_dict.get("comment_word_id", 0)
|
||||
load_usr.comment_text_id = profile_dict.get("comment_text_id", 1)
|
||||
load_usr.comment_word_id = profile_dict.get("comment_word_id", 1)
|
||||
load_usr.latest_use_pokemon = profile_dict.get("latest_use_pokemon", 0)
|
||||
load_usr.ex_ko_num = profile_dict.get("ex_ko_num", 0)
|
||||
load_usr.wko_num = profile_dict.get("wko_num", 0)
|
||||
@ -237,11 +240,11 @@ class PokkenBase:
|
||||
load_usr.cool_ko_num = profile_dict.get("cool_ko_num", 0)
|
||||
load_usr.perfect_ko_num = profile_dict.get("perfect_ko_num", 0)
|
||||
load_usr.record_flag = profile_dict.get("record_flag", 0)
|
||||
load_usr.site_register_status = profile_dict.get("site_register_status", 0)
|
||||
load_usr.site_register_status = profile_dict.get("site_register_status", 1)
|
||||
load_usr.continue_num = profile_dict.get("continue_num", 0)
|
||||
|
||||
load_usr.avatar_body = profile_dict.get("avatar_body", 0)
|
||||
load_usr.avatar_gender = profile_dict.get("avatar_gender", 0)
|
||||
load_usr.avatar_gender = profile_dict.get("avatar_gender", 1)
|
||||
load_usr.avatar_background = profile_dict.get("avatar_background", 0)
|
||||
load_usr.avatar_head = profile_dict.get("avatar_head", 0)
|
||||
load_usr.avatar_battleglass = profile_dict.get("avatar_battleglass", 0)
|
||||
@ -283,6 +286,31 @@ class PokkenBase:
|
||||
pkm.bp_point_sp = pkmn_d.get('bp_point_sp', 0)
|
||||
|
||||
load_usr.pokemon_data.append(pkm)
|
||||
|
||||
for x in profile_dict.get("tutorial_progress_flag", []):
|
||||
load_usr.tutorial_progress_flag.append(x)
|
||||
|
||||
for x in profile_dict.get("achievement_flag", []):
|
||||
load_usr.achievement_flag.append(x)
|
||||
|
||||
for x in profile_dict.get("aid_skill_list", []):
|
||||
load_usr.aid_skill_list.append(x)
|
||||
|
||||
for x in profile_dict.get("rankmatch_progress", []):
|
||||
load_usr.rankmatch_progress.append(x)
|
||||
|
||||
for x in profile_dict.get("event_achievement_flag", []):
|
||||
load_usr.event_achievement_flag.append(x)
|
||||
|
||||
for x in profile_dict.get("event_achievement_param", []):
|
||||
load_usr.event_achievement_param.append(x)
|
||||
|
||||
load_usr.support_set_1.append(profile_dict.get("support_set_1_1", 587))
|
||||
load_usr.support_set_1.append(profile_dict.get("support_set_1_2", 653))
|
||||
load_usr.support_set_2.append(profile_dict.get("support_set_2_1", 495))
|
||||
load_usr.support_set_2.append(profile_dict.get("support_set_2_2", 131))
|
||||
load_usr.support_set_3.append(profile_dict.get("support_set_3_1", 657))
|
||||
load_usr.support_set_3.append(profile_dict.get("support_set_3_2", 133))
|
||||
|
||||
res.load_user.CopyFrom(load_usr)
|
||||
return res.SerializeToString()
|
||||
@ -300,6 +328,8 @@ class PokkenBase:
|
||||
|
||||
req = request.save_user
|
||||
user_id = req.banapass_id
|
||||
|
||||
self.logger.info(f"Save user data for {user_id}")
|
||||
|
||||
tut_flgs: List[int] = []
|
||||
ach_flgs: List[int] = []
|
||||
@ -339,7 +369,7 @@ class PokkenBase:
|
||||
for ach_flg in req.achievement_flag:
|
||||
ach_flgs.append(ach_flg)
|
||||
|
||||
await self.data.profile.update_profile_tutorial_flags(user_id, ach_flg)
|
||||
await self.data.profile.update_profile_achievement_flags(user_id, ach_flgs)
|
||||
|
||||
for evt_flg in req.event_achievement_flag:
|
||||
evt_flgs.append(evt_flg)
|
||||
@ -353,18 +383,23 @@ class PokkenBase:
|
||||
await self.data.item.add_reward(user_id, reward.get_category_id, reward.get_content_id, reward.get_type_id)
|
||||
|
||||
await self.data.profile.add_profile_points(user_id, get_rank_pts, get_money, get_score_pts, grade_max)
|
||||
|
||||
# Inconsistant underscore use AND a typo??
|
||||
#await self.data.profile.update_rankmatch_data(user_id, req.rankmatch_flag, req.rank_match_max, req.rank_match_success, req.rank_match_process)
|
||||
|
||||
await self.data.profile.update_support_team(user_id, 1, req.support_set_1[0], req.support_set_1[1])
|
||||
await self.data.profile.update_support_team(user_id, 2, req.support_set_2[0], req.support_set_2[1])
|
||||
await self.data.profile.update_support_team(user_id, 3, req.support_set_3[0], req.support_set_3[1])
|
||||
|
||||
await self.data.profile.put_pokemon(user_id, mon.char_id, mon.illustration_book_no, mon.bp_point_atk, mon.bp_point_res, mon.bp_point_def, mon.bp_point_sp)
|
||||
await self.data.profile.add_pokemon_xp(user_id, mon.char_id, mon.get_pokemon_exp)
|
||||
await self.data.profile.add_pokemon_xp(user_id, mon.illustration_book_no, mon.get_pokemon_exp)
|
||||
await self.data.profile.set_latest_mon(user_id, mon.illustration_book_no)
|
||||
|
||||
for x in range(len(battle.play_mode)):
|
||||
self.logger.info(f"Save {PokkenConstants.BATTLE_TYPE(battle.play_mode[x]).name} battle {PokkenConstants.BATTLE_RESULT(battle.result[x]).name} for {user_id} with mon {mon.illustration_book_no}")
|
||||
await self.data.profile.put_pokemon_battle_result(
|
||||
user_id,
|
||||
mon.char_id,
|
||||
mon.illustration_book_no,
|
||||
PokkenConstants.BATTLE_TYPE(battle.play_mode[x]),
|
||||
PokkenConstants.BATTLE_RESULT(battle.result[x])
|
||||
)
|
||||
@ -391,7 +426,6 @@ class PokkenBase:
|
||||
last_evt
|
||||
)
|
||||
|
||||
|
||||
return res.SerializeToString()
|
||||
|
||||
async def handle_save_ingame_log(self, data: jackal_pb2.Request) -> bytes:
|
||||
@ -419,6 +453,13 @@ class PokkenBase:
|
||||
async def handle_matching_is_matching(
|
||||
self, data: Dict = {}, client_ip: str = "127.0.0.1"
|
||||
) -> Dict:
|
||||
"""
|
||||
"sessionId":"12345678",
|
||||
"A":{
|
||||
"pcb_id": data["data"]["must"]["pcb_id"],
|
||||
"gip": client_ip
|
||||
},
|
||||
"""
|
||||
return {
|
||||
"data": {
|
||||
"sessionId":"12345678",
|
||||
@ -435,6 +476,11 @@ class PokkenBase:
|
||||
) -> Dict:
|
||||
return {}
|
||||
|
||||
async def handle_matching_obtain_matching(
|
||||
self, data: Dict = {}, client_ip: str = "127.0.0.1"
|
||||
) -> Dict:
|
||||
return {}
|
||||
|
||||
async def handle_admission_noop(self, data: Dict, req_ip: str = "127.0.0.1") -> Dict:
|
||||
return {}
|
||||
|
||||
|
140
titles/pokken/data/fighters.json
Normal file
140
titles/pokken/data/fighters.json
Normal file
@ -0,0 +1,140 @@
|
||||
{
|
||||
"448": {
|
||||
"name_en": "Lucario",
|
||||
"name_jp": "ルカリオ",
|
||||
"type": 0,
|
||||
"artwork": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/448.png"
|
||||
},
|
||||
"25": {
|
||||
"name_en": "Pikachu",
|
||||
"name_jp": "ピカチュウ",
|
||||
"type": 0,
|
||||
"artwork": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/25.png"
|
||||
},
|
||||
"68": {
|
||||
"name_en": "Machamp",
|
||||
"name_jp": "カイリキー",
|
||||
"type": 1,
|
||||
"artwork": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/68.png"
|
||||
},
|
||||
"282": {
|
||||
"name_en": "Gardevoir",
|
||||
"name_jp": "サーナイト",
|
||||
"type": 2,
|
||||
"artwork": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/282.png"
|
||||
},
|
||||
"461": {
|
||||
"name_en": "Weavile",
|
||||
"name_jp": "マニューラ",
|
||||
"type": 3,
|
||||
"artwork": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/461.png"
|
||||
},
|
||||
"245": {
|
||||
"name_en": "Suicune",
|
||||
"name_jp": "スイクン",
|
||||
"type": 0,
|
||||
"artwork": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/245.png"
|
||||
},
|
||||
"6": {
|
||||
"name_en": "Charizard",
|
||||
"name_jp": "リザードン",
|
||||
"type": 1,
|
||||
"artwork": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/6.png"
|
||||
},
|
||||
"94": {
|
||||
"name_en": "Gengar",
|
||||
"name_jp": "ゲンガー",
|
||||
"type": 2,
|
||||
"artwork": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/94.png"
|
||||
},
|
||||
"257": {
|
||||
"name_en": "Blaziken",
|
||||
"name_jp": "バシャーモ",
|
||||
"type": 0,
|
||||
"artwork": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/257.png"
|
||||
},
|
||||
"10025": {
|
||||
"name_en": "Pikachu Libre",
|
||||
"name_jp": "マスクド・ピカチュウ",
|
||||
"type": 3,
|
||||
"artwork": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/10084.png"
|
||||
},
|
||||
"254": {
|
||||
"name_en": "Sceptile",
|
||||
"name_jp": "ジュカイン",
|
||||
"type": 3,
|
||||
"artwork": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/254.png"
|
||||
},
|
||||
"609": {
|
||||
"name_en": "Chandelure",
|
||||
"name_jp": "シャンデラ",
|
||||
"type": 1,
|
||||
"artwork": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/609.png"
|
||||
},
|
||||
"150": {
|
||||
"name_en": "Mewtwo",
|
||||
"name_jp": "ミュウツー",
|
||||
"type": 0,
|
||||
"artwork": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/150.png"
|
||||
},
|
||||
"10150": {
|
||||
"name_en": "Shadow Mewtwo",
|
||||
"name_jp": "ダークミュウツー",
|
||||
"type": 2,
|
||||
"artwork": "https://archives.bulbagarden.net/media/upload/7/7a/Pokk%C3%A9n_Shadow_Mewtwo.png"
|
||||
},
|
||||
"445": {
|
||||
"name_en": "Garchomp",
|
||||
"name_jp": "ガブリアス",
|
||||
"type": 1,
|
||||
"artwork": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/445.png"
|
||||
},
|
||||
"654": {
|
||||
"name_en": "Braixen",
|
||||
"name_jp": "テールナー",
|
||||
"type": 0,
|
||||
"artwork": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/654.png"
|
||||
},
|
||||
"491": {
|
||||
"name_en": "Darkrai",
|
||||
"name_jp": "ダークライ",
|
||||
"type": 2,
|
||||
"artwork": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/491.png"
|
||||
},
|
||||
"212": {
|
||||
"name_en": "Scizor",
|
||||
"name_jp": "ハッサム",
|
||||
"type": 1,
|
||||
"artwork": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/212.png"
|
||||
},
|
||||
"453": {
|
||||
"name_en": "Croagunk",
|
||||
"name_jp": "グレッグル",
|
||||
"type": 3,
|
||||
"artwork": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/453.png"
|
||||
},
|
||||
"395": {
|
||||
"name_en": "Empoleon",
|
||||
"name_jp": "エンペルト",
|
||||
"type": 0,
|
||||
"artwork": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/395.png"
|
||||
},
|
||||
"724": {
|
||||
"name_en": "Decidueye",
|
||||
"name_jp": "ジュナイパー",
|
||||
"type": 0,
|
||||
"artwork": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/724.png"
|
||||
},
|
||||
"681": {
|
||||
"name_en": "Aegislash",
|
||||
"name_jp": "ギルガルド",
|
||||
"type": 2,
|
||||
"artwork": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/681.png"
|
||||
},
|
||||
"9": {
|
||||
"name_en": "Blastoise",
|
||||
"name_jp": "カメックス",
|
||||
"type": 1,
|
||||
"artwork": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/9.png"
|
||||
}
|
||||
}
|
218
titles/pokken/data/support.json
Normal file
218
titles/pokken/data/support.json
Normal file
@ -0,0 +1,218 @@
|
||||
{
|
||||
"587": {
|
||||
"name_en": "Emolga",
|
||||
"name_jp": "エモンガ",
|
||||
"desc": "Uses Shock Wave to shock the opponent and temporarily decrease its speed.",
|
||||
"artwork": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/587.png"
|
||||
},
|
||||
"653": {
|
||||
"name_en": "Fennekin",
|
||||
"name_jp": "フォッコ",
|
||||
"desc": "Uses Ember to surround itself with fire, creating a trap.",
|
||||
"artwork": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/653.png"
|
||||
},
|
||||
"495": {
|
||||
"name_en": "Snivy",
|
||||
"name_jp": "ツタージャ",
|
||||
"desc": "Uses Leaf Tornado to perform an anti-air attack and send the opponent flying.",
|
||||
"artwork": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/495.png"
|
||||
},
|
||||
"131": {
|
||||
"name_en": "Lapras",
|
||||
"name_jp": "ラプラス",
|
||||
"desc": "Uses Surf as it enters the stage, damaging the enemy with a wave of water.",
|
||||
"artwork": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/131.png"
|
||||
},
|
||||
"657": {
|
||||
"name_en": "Frogadier",
|
||||
"name_jp": "ゲコガシラ",
|
||||
"desc": "Uses Water Pulse to attack from a distance by firing water bullets. Effective when striking from long distance.",
|
||||
"artwork": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/657.png"
|
||||
},
|
||||
"133": {
|
||||
"name_en": "Eevee",
|
||||
"name_jp": "イーブイ",
|
||||
"desc": "Uses Helping Hand to heal the user and temporarily increase their attack power.",
|
||||
"artwork": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/133.png"
|
||||
},
|
||||
"385": {
|
||||
"name_en": "Jirachi",
|
||||
"name_jp": "ジラーチ",
|
||||
"desc": "Uses Wish to restore the Synergy Gauge and temporarily strengthen the user's attack power during Synergy Burst.",
|
||||
"artwork": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/385.png"
|
||||
},
|
||||
"547": {
|
||||
"name_en": "Whimsicott",
|
||||
"name_jp": "エルフーン",
|
||||
"desc": "Uses Substitute to render attacks from opponents useless and heal the user.",
|
||||
"artwork": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/547.png"
|
||||
},
|
||||
"38": {
|
||||
"name_en": "Ninetales",
|
||||
"name_jp": "キュウコン",
|
||||
"desc": "Uses Will-O-Wisp to send small flames in front of the user. Enemy's attack power decreased temporarily when contacted.",
|
||||
"artwork": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/38.png"
|
||||
},
|
||||
"429": {
|
||||
"name_en": "Mismagius",
|
||||
"name_jp": "ムウマージ",
|
||||
"desc": "Uses Ominous Wind to attack the opponent and temporarily increase the user's attack power.",
|
||||
"artwork": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/429.png"
|
||||
},
|
||||
"83": {
|
||||
"name_en": "Farfetch'd",
|
||||
"name_jp": "カモネギ",
|
||||
"desc": "Uses Fury Cutter to perform a flurry of attacks toward the opponent.",
|
||||
"artwork": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/83.png"
|
||||
},
|
||||
"101": {
|
||||
"name_en": "Electrode",
|
||||
"name_jp": "マルマイン",
|
||||
"desc": "Uses Explosion to counter an opponent's attack upon defending.",
|
||||
"artwork": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/101.png"
|
||||
},
|
||||
"479": {
|
||||
"name_en": "Rotom",
|
||||
"name_jp": "ロトム",
|
||||
"desc": "Uses Thunder Shock to target enemies in the air and temporarily decrease their speed.",
|
||||
"artwork": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/479.png"
|
||||
},
|
||||
"468": {
|
||||
"name_en": "Togekiss",
|
||||
"name_jp": "トゲキッス",
|
||||
"desc": "Uses Tailwind to temporarily increase the user's speed and recover some health.",
|
||||
"artwork": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/468.png"
|
||||
},
|
||||
"149": {
|
||||
"name_en": "Dragonite",
|
||||
"name_jp": "カイリュー",
|
||||
"desc": "Uses Draco Meteor to attack multiple times over a wide area.",
|
||||
"artwork": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/149.png"
|
||||
},
|
||||
"494": {
|
||||
"name_en": "Victini",
|
||||
"name_jp": "ビクティニ",
|
||||
"desc": "Uses V-create to temporarily make the user's attacks critical hits, restores some of the user's health, and increases the user's Synergy Gauge. Unlike other Enhance Pokémon, Victini can actually damage the foe if they're above it when flying off the screen.",
|
||||
"artwork": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/494.png"
|
||||
},
|
||||
"453": {
|
||||
"name_en": "Croagunk",
|
||||
"name_jp": "グレッグル",
|
||||
"desc": "Uses Toxic to attack opponent and temporarily decrease its defense.",
|
||||
"artwork": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/453.png"
|
||||
},
|
||||
"700": {
|
||||
"name_en": "Sylveon",
|
||||
"name_jp": "ニンフィア",
|
||||
"desc": "Uses Reflect to heal user and temporarily increase their defense.",
|
||||
"artwork": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/700.png"
|
||||
},
|
||||
"417": {
|
||||
"name_en": "Pachirisu",
|
||||
"name_jp": "パチリス",
|
||||
"desc": "Uses Follow Me to eliminate long distance attacks. Effective when get in close.",
|
||||
"artwork": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/417.png"
|
||||
},
|
||||
"129": {
|
||||
"name_en": "Magikarp",
|
||||
"name_jp": "コイキング",
|
||||
"desc": "Uses Bounce to disrupt the enemy's attack when hit by an opponent. Effective for interrupting combos.",
|
||||
"artwork": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/129.png"
|
||||
},
|
||||
"104": {
|
||||
"name_en": "Cubone",
|
||||
"name_jp": "カラカラ",
|
||||
"desc": "Uses Bonemerang to attack from a distance and can pull an enemy in.",
|
||||
"artwork": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/104.png"
|
||||
},
|
||||
"50": {
|
||||
"name_en": "Diglett",
|
||||
"name_jp": "ディグダ",
|
||||
"desc": "Uses Dig to attack from below, making easy to aim for a combo.",
|
||||
"artwork": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/50.png"
|
||||
},
|
||||
"82": {
|
||||
"name_en": "Magneton",
|
||||
"name_jp": "レアコイル",
|
||||
"desc": "Uses Tri Attack to attack from a distance diagonally upward and inflict two random negative statuses.",
|
||||
"artwork": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/82.png"
|
||||
},
|
||||
"195": {
|
||||
"name_en": "Quagsire",
|
||||
"name_jp": "ヌオー",
|
||||
"desc": "Uses Mud Bomb to attack opponent on the ground, even when blocked.",
|
||||
"artwork": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/195.png"
|
||||
},
|
||||
"196": {
|
||||
"name_en": "Espeon",
|
||||
"name_jp": "エーフィ",
|
||||
"desc": "Uses Morning Sun to remove any statuses and recover health, with more health recovered with less time remaining in the round.",
|
||||
"artwork": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/196.png"
|
||||
},
|
||||
"197": {
|
||||
"name_en": "Umbreon",
|
||||
"name_jp": "ブラッキー",
|
||||
"desc": "Uses Snarl to absorb an opponent's Synergy Gauge and prevent them from performing any critical hits.",
|
||||
"artwork": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/197.png"
|
||||
},
|
||||
"643": {
|
||||
"name_en": "Reshiram",
|
||||
"name_jp": "レシラム",
|
||||
"desc": "Uses Blue Flare to attack straight forward with a powerful flame. In the DX version, it can only be called once per round.",
|
||||
"artwork": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/643.png"
|
||||
},
|
||||
"488": {
|
||||
"name_en": "Cresselia",
|
||||
"name_jp": "クレセリア",
|
||||
"desc": "Uses Lunar Dance to heal the user of any negative status, recovers health and Synergy Gauge, but can only be used once per round.",
|
||||
"artwork": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/488.png"
|
||||
},
|
||||
"717": {
|
||||
"name_en": "Yveltal",
|
||||
"name_jp": "イベルタル",
|
||||
"desc": "Uses Oblivion Wing to attack from the sky and seal off the opponent's Synergy Burst. In the DX version, it can only be called once per round.",
|
||||
"artwork": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/717.png"
|
||||
},
|
||||
"381": {
|
||||
"name_en": "Latios",
|
||||
"name_jp": "ラティオス",
|
||||
"desc": "Uses Luster Purge to place attacks around the enemy in order to restrict their movements. In the DX version, it can only be called once per round.",
|
||||
"artwork": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/381.png"
|
||||
},
|
||||
"725": {
|
||||
"name_en": "Litten",
|
||||
"name_jp": "ニャビー",
|
||||
"desc": "Uses Fire Fang to attack toward the enemy. Damage increases when the player's at lower HP.",
|
||||
"artwork": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/725.png"
|
||||
},
|
||||
"728": {
|
||||
"name_en": "Popplio",
|
||||
"name_jp": "アシマリ",
|
||||
"desc": "Uses Bubble Beam to temporarily increase attack and grant a double jump while in midair.",
|
||||
"artwork": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/728.png"
|
||||
},
|
||||
"10079": {
|
||||
"name_en": "Mega Rayquaza",
|
||||
"name_jp": "レックウザ",
|
||||
"desc": "Uses Dragon Ascent to attack from a distance at tremendous speed. It also consumes the user's Synergy Gauge. It can only be called once per round.",
|
||||
"artwork": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/10079.png"
|
||||
},
|
||||
"778": {
|
||||
"name_en": "Mimikyu",
|
||||
"name_jp": "ミミッキュ",
|
||||
"desc": "Uses Play Rough to attack continuously from behind and inflict double negative status.",
|
||||
"artwork": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/778.png"
|
||||
},
|
||||
"151": {
|
||||
"name_en": "Mew",
|
||||
"name_jp": "ミュウ",
|
||||
"desc": "Uses Miraculous Power to randomly increase the user's Synergy Gauge, temporarily makes the user's attacks critical hits, and/or gives the user additional random positive status.",
|
||||
"artwork": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/151.png"
|
||||
},
|
||||
"251": {
|
||||
"name_en": "Celebi",
|
||||
"name_jp": "セレビィ",
|
||||
"desc": "Uses Time Travel (Japanese: ときわたり Time Travel) to switch between Phases at almost any given moment, even when enemy guards an attack.",
|
||||
"artwork": "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/251.png"
|
||||
}
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
from typing import Optional, Dict, List, Union
|
||||
from sqlalchemy import Table, Column, UniqueConstraint, PrimaryKeyConstraint, and_, case
|
||||
from sqlalchemy.types import Integer, String, TIMESTAMP, Boolean, JSON
|
||||
from sqlalchemy.types import Integer, String, TIMESTAMP, Boolean, JSON, INTEGER
|
||||
from sqlalchemy.schema import ForeignKey
|
||||
from sqlalchemy.sql import func, select, update, delete
|
||||
from sqlalchemy.sql.functions import coalesce
|
||||
@ -16,13 +16,8 @@ profile = Table(
|
||||
"pokken_profile",
|
||||
metadata,
|
||||
Column("id", Integer, primary_key=True, nullable=False),
|
||||
Column(
|
||||
"user",
|
||||
ForeignKey("aime_user.id", ondelete="cascade", onupdate="cascade"),
|
||||
nullable=False,
|
||||
unique=True,
|
||||
),
|
||||
Column("trainer_name", String(16)), # optional
|
||||
Column("user", Integer, ForeignKey("aime_user.id", ondelete="cascade", onupdate="cascade"), nullable=False, unique=True),
|
||||
Column("trainer_name", String(14)), # optional
|
||||
Column("home_region_code", Integer),
|
||||
Column("home_loc_name", String(255)),
|
||||
Column("pref_code", Integer),
|
||||
@ -66,7 +61,7 @@ profile = Table(
|
||||
Column("navi_trainer", Integer),
|
||||
Column("navi_version_id", Integer),
|
||||
Column("aid_skill_list", JSON), # Repeated, Integer
|
||||
Column("aid_skill", Integer),
|
||||
Column("aid_skill", Integer), # Cheer skill, 6 of them, unlocked by lucky bonus
|
||||
Column("comment_text_id", Integer),
|
||||
Column("comment_word_id", Integer),
|
||||
Column("latest_use_pokemon", Integer),
|
||||
@ -105,20 +100,16 @@ profile = Table(
|
||||
Column("battle_num_vs_cpu", Integer), # 2
|
||||
Column("win_cpu", Integer),
|
||||
Column("battle_num_tutorial", Integer), # 1?
|
||||
mysql_charset="utf8mb4",
|
||||
mysql_charset="utf8mb4"
|
||||
)
|
||||
|
||||
pokemon_data = Table(
|
||||
"pokken_pokemon_data",
|
||||
metadata,
|
||||
Column("id", Integer, primary_key=True, nullable=False),
|
||||
Column(
|
||||
"user",
|
||||
ForeignKey("aime_user.id", ondelete="cascade", onupdate="cascade"),
|
||||
nullable=False,
|
||||
),
|
||||
Column("char_id", Integer, nullable=False),
|
||||
Column("illustration_book_no", Integer),
|
||||
Column("user", Integer, ForeignKey("aime_user.id", ondelete="cascade", onupdate="cascade"), nullable=False),
|
||||
Column("char_id", Integer),
|
||||
Column("illustration_book_no", Integer, nullable=False), # This is the fucking pokedex number????
|
||||
Column("pokemon_exp", Integer),
|
||||
Column("battle_num_vs_wan", Integer), # 4?
|
||||
Column("win_vs_wan", Integer),
|
||||
@ -132,8 +123,8 @@ pokemon_data = Table(
|
||||
Column("bp_point_res", Integer),
|
||||
Column("bp_point_def", Integer),
|
||||
Column("bp_point_sp", Integer),
|
||||
UniqueConstraint("user", "char_id", name="pokken_pokemon_data_uk"),
|
||||
mysql_charset="utf8mb4",
|
||||
UniqueConstraint("user", "illustration_book_no", name="pokken_pokemon_uk"),
|
||||
mysql_charset="utf8mb4"
|
||||
)
|
||||
|
||||
|
||||
@ -157,8 +148,8 @@ class PokkenProfileData(BaseData):
|
||||
return result.lastrowid
|
||||
|
||||
async def set_profile_name(self, user_id: int, new_name: str, gender: Union[int, None] = None) -> None:
|
||||
sql = update(profile).where(profile.c.user == user_id).values(
|
||||
trainer_name=new_name,
|
||||
sql = profile.update(profile.c.user == user_id).values(
|
||||
trainer_name=new_name if new_name else profile.c.trainer_name,
|
||||
avatar_gender=gender if gender is not None else profile.c.avatar_gender
|
||||
)
|
||||
result = await self.execute(sql)
|
||||
@ -179,12 +170,12 @@ class PokkenProfileData(BaseData):
|
||||
aid_skill: int,
|
||||
last_evt: int
|
||||
) -> None:
|
||||
sql = update(profile).where(profile.c.user == user_id).values(
|
||||
sql = profile.update(profile.c.user == user_id).values(
|
||||
extra_counter=extra_counter,
|
||||
event_reward_get_flag=evt_reward_get_flg,
|
||||
total_play_days=total_play_days,
|
||||
awake_num=awake_num,
|
||||
use_support_num=use_support_ct,
|
||||
total_play_days=coalesce(profile.c.total_play_days, 0) + total_play_days,
|
||||
awake_num=coalesce(profile.c.awake_num, 0) + awake_num,
|
||||
use_support_num=coalesce(profile.c.use_support_num, 0) + use_support_ct,
|
||||
beat_num=beat_num,
|
||||
aid_skill=aid_skill,
|
||||
last_play_event_id=last_evt
|
||||
@ -195,7 +186,7 @@ class PokkenProfileData(BaseData):
|
||||
self.logger.error(f"Failed to put extra data for user {user_id}")
|
||||
|
||||
async def update_profile_tutorial_flags(self, user_id: int, tutorial_flags: List) -> None:
|
||||
sql = update(profile).where(profile.c.user == user_id).values(
|
||||
sql = profile.update(profile.c.user == user_id).values(
|
||||
tutorial_progress_flag=tutorial_flags,
|
||||
)
|
||||
result = await self.execute(sql)
|
||||
@ -205,7 +196,7 @@ class PokkenProfileData(BaseData):
|
||||
)
|
||||
|
||||
async def update_profile_achievement_flags(self, user_id: int, achievement_flags: List) -> None:
|
||||
sql = update(profile).where(profile.c.user == user_id).values(
|
||||
sql = profile.update(profile.c.user == user_id).values(
|
||||
achievement_flag=achievement_flags,
|
||||
)
|
||||
result = await self.execute(sql)
|
||||
@ -215,7 +206,7 @@ class PokkenProfileData(BaseData):
|
||||
)
|
||||
|
||||
async def update_profile_event(self, user_id: int, event_state: List, event_flags: List[int], event_param: List[int], last_evt: int = None) -> None:
|
||||
sql = update(profile).where(profile.c.user == user_id).values(
|
||||
sql = profile.update(profile.c.user == user_id).values(
|
||||
event_state=event_state,
|
||||
event_achievement_flag=event_flags,
|
||||
event_achievement_param=event_param,
|
||||
@ -230,12 +221,16 @@ class PokkenProfileData(BaseData):
|
||||
async def add_profile_points(
|
||||
self, user_id: int, rank_pts: int, money: int, score_pts: int, grade_max: int
|
||||
) -> None:
|
||||
sql = update(profile).where(profile.c.user == user_id).values(
|
||||
trainer_rank_point = profile.c.trainer_rank_point + rank_pts,
|
||||
fight_money = profile.c.fight_money + money,
|
||||
score_point = profile.c.score_point + score_pts,
|
||||
sql = profile.update(profile.c.user == user_id).values(
|
||||
trainer_rank_point = coalesce(profile.c.trainer_rank_point, 0) + rank_pts,
|
||||
wallet = coalesce(profile.c.wallet, 0) + money,
|
||||
score_point = coalesce(profile.c.score_point, 0) + score_pts,
|
||||
grade_max_num = grade_max
|
||||
)
|
||||
|
||||
result = await self.execute(sql)
|
||||
if result is None:
|
||||
return None
|
||||
|
||||
async def get_profile(self, user_id: int) -> Optional[Row]:
|
||||
sql = profile.select(profile.c.user == user_id)
|
||||
@ -248,7 +243,7 @@ class PokkenProfileData(BaseData):
|
||||
self,
|
||||
user_id: int,
|
||||
pokemon_id: int,
|
||||
illust_no: int,
|
||||
pokedex_number: int,
|
||||
atk: int,
|
||||
res: int,
|
||||
defe: int,
|
||||
@ -257,7 +252,7 @@ class PokkenProfileData(BaseData):
|
||||
sql = insert(pokemon_data).values(
|
||||
user=user_id,
|
||||
char_id=pokemon_id,
|
||||
illustration_book_no=illust_no,
|
||||
illustration_book_no=pokedex_number,
|
||||
pokemon_exp=0,
|
||||
battle_num_vs_wan=0,
|
||||
win_vs_wan=0,
|
||||
@ -274,7 +269,7 @@ class PokkenProfileData(BaseData):
|
||||
)
|
||||
|
||||
conflict = sql.on_duplicate_key_update(
|
||||
illustration_book_no=illust_no,
|
||||
illustration_book_no=pokedex_number,
|
||||
bp_point_atk=pokemon_data.c.bp_point_atk + atk,
|
||||
bp_point_res=pokemon_data.c.bp_point_res + res,
|
||||
bp_point_def=pokemon_data.c.bp_point_def + defe,
|
||||
@ -293,7 +288,7 @@ class PokkenProfileData(BaseData):
|
||||
pokemon_id: int,
|
||||
xp: int
|
||||
) -> None:
|
||||
sql = update(pokemon_data).where(and_(pokemon_data.c.user==user_id, pokemon_data.c.char_id==pokemon_id)).values(
|
||||
sql = pokemon_data.update(and_(pokemon_data.c.user==user_id, pokemon_data.c.illustration_book_no==pokemon_id)).values(
|
||||
pokemon_exp=coalesce(pokemon_data.c.pokemon_exp, 0) + xp
|
||||
)
|
||||
|
||||
@ -302,7 +297,7 @@ class PokkenProfileData(BaseData):
|
||||
self.logger.warning(f"Failed to add {xp} XP to pokemon ID {pokemon_id} for user {user_id}")
|
||||
|
||||
async def get_pokemon_data(self, user_id: int, pokemon_id: int) -> Optional[Row]:
|
||||
sql = pokemon_data.select(and_(pokemon_data.c.user == user_id, pokemon_data.c.char_id == pokemon_id))
|
||||
sql = pokemon_data.select(and_(pokemon_data.c.user == user_id, pokemon_data.c.illustration_book_no == pokemon_id))
|
||||
result = await self.execute(sql)
|
||||
if result is None:
|
||||
return None
|
||||
@ -315,6 +310,14 @@ class PokkenProfileData(BaseData):
|
||||
return None
|
||||
return result.fetchall()
|
||||
|
||||
async def set_latest_mon(self, user_id: int, pokedex_no: int) -> None:
|
||||
sql = profile.update(profile.c.user == user_id).values(
|
||||
latest_use_pokemon=pokedex_no
|
||||
)
|
||||
result = await self.execute(sql)
|
||||
if result is None:
|
||||
self.logger.warning(f"Failed to update user {user_id}'s last used pokemon {pokedex_no}")
|
||||
|
||||
async def put_pokemon_battle_result(
|
||||
self, user_id: int, pokemon_id: int, match_type: PokkenConstants.BATTLE_TYPE, match_result: PokkenConstants.BATTLE_RESULT
|
||||
) -> None:
|
||||
@ -322,7 +325,7 @@ class PokkenProfileData(BaseData):
|
||||
Records the match stats (type and win/loss) for the pokemon and profile
|
||||
coalesce(pokemon_data.c.win_vs_wan, 0)
|
||||
"""
|
||||
sql = update(pokemon_data).where(and_(pokemon_data.c.user==user_id, pokemon_data.c.char_id==pokemon_id)).values(
|
||||
sql = pokemon_data.update(and_(pokemon_data.c.user==user_id, pokemon_data.c.illustration_book_no==pokemon_id)).values(
|
||||
battle_num_tutorial=coalesce(pokemon_data.c.battle_num_tutorial, 0) + 1 if match_type==PokkenConstants.BATTLE_TYPE.TUTORIAL else coalesce(pokemon_data.c.battle_num_tutorial, 0),
|
||||
battle_all_num_tutorial=coalesce(pokemon_data.c.battle_all_num_tutorial, 0) + 1 if match_type==PokkenConstants.BATTLE_TYPE.TUTORIAL else coalesce(pokemon_data.c.battle_all_num_tutorial, 0),
|
||||
|
||||
@ -353,7 +356,7 @@ class PokkenProfileData(BaseData):
|
||||
"""
|
||||
Records profile stats
|
||||
"""
|
||||
sql = update(profile).where(profile.c.user==user_id).values(
|
||||
sql = profile.update(profile.c.user==user_id).values(
|
||||
ex_ko_num=coalesce(profile.c.ex_ko_num, 0) + exkos,
|
||||
wko_num=coalesce(profile.c.wko_num, 0) + wkos,
|
||||
timeup_win_num=coalesce(profile.c.timeup_win_num, 0) + timeout_wins,
|
||||
@ -367,7 +370,12 @@ class PokkenProfileData(BaseData):
|
||||
self.logger.warning(f"Failed to update stats for user {user_id}")
|
||||
|
||||
async def update_support_team(self, user_id: int, support_id: int, support1: int = None, support2: int = None) -> None:
|
||||
sql = update(profile).where(profile.c.user==user_id).values(
|
||||
if support1 == 4294967295:
|
||||
support1 = None
|
||||
|
||||
if support2 == 4294967295:
|
||||
support2 = None
|
||||
sql = profile.update(profile.c.user==user_id).values(
|
||||
support_set_1_1=support1 if support_id == 1 else profile.c.support_set_1_1,
|
||||
support_set_1_2=support2 if support_id == 1 else profile.c.support_set_1_2,
|
||||
support_set_2_1=support1 if support_id == 2 else profile.c.support_set_2_1,
|
||||
@ -379,3 +387,15 @@ class PokkenProfileData(BaseData):
|
||||
result = await self.execute(sql)
|
||||
if result is None:
|
||||
self.logger.warning(f"Failed to update support team {support_id} for user {user_id}")
|
||||
|
||||
async def update_rankmatch_data(self, user_id: int, flag: int, rm_max: Optional[int], success: Optional[int], progress: List[int]) -> None:
|
||||
sql = profile.update(profile.c.user==user_id).values(
|
||||
rankmatch_flag=flag,
|
||||
rankmatch_max=rm_max,
|
||||
rankmatch_progress=progress,
|
||||
rankmatch_success=success,
|
||||
)
|
||||
|
||||
result = await self.execute(sql)
|
||||
if result is None:
|
||||
self.logger.warning(f"Failed to update rankmatch data for user {user_id}")
|
||||
|
Loading…
Reference in New Issue
Block a user