implement proper all 3 ability showing (including MAIN)

This commit is contained in:
kittentm 2026-03-17 03:35:55 +01:00
commit e60f0ac108
No known key found for this signature in database
GPG key ID: AC43DFDBC1F44A91
3 changed files with 1356 additions and 409 deletions

File diff suppressed because it is too large Load diff

View file

@ -4,9 +4,15 @@ from database import SessionLocal, User, Session as UserSession, Equipment, Equi
from services import auth from services import auth
from config import cipher from config import cipher
import json import json
import os
router = APIRouter() router = APIRouter()
CURRENT_DIR = os.path.dirname(os.path.abspath(__file__))
GEAR_SKILLS_PATH = os.path.join(CURRENT_DIR, "abilitymain.json")
with open(GEAR_SKILLS_PATH, "r") as f:
GEAR_SKILLS = json.load(f)
def get_db(): def get_db():
db = SessionLocal() db = SessionLocal()
try: try:
@ -30,11 +36,50 @@ async def get_equipment_composite(request: Request, db: DBSession = Depends(get_
profile = json.loads(auth.get_profile(token_data["token"])) profile = json.loads(auth.get_profile(token_data["token"]))
pid_val = int(profile.get("pid")) pid_val = int(profile.get("pid"))
mii_name = profile.get("name", user.username) mii_name = profile.get("name", user.username)
last_gear = db.query(EquipmentLast).filter(EquipmentLast.PId == pid_val).first() last_gear = db.query(EquipmentLast).filter(EquipmentLast.PId == pid_val).first()
if last_gear:
data = {column.name: getattr(last_gear, column.name) for column in last_gear.__table__.columns}
hed_id = str(data.get("Gear_Head", "0"))
clt_id = str(data.get("Gear_Clothes", "0"))
shs_id = str(data.get("Gear_Shoes", "0"))
gear_data = {
"PId": data.get("PId"),
"Rank": data.get("Rank"),
"Udemae": data.get("Udemae"),
"weapon": data.get("weapon"),
"Gear_Head": data.get("Gear_Head"),
"Gear_Clothes": data.get("Gear_Clothes"),
"Gear_Shoes": data.get("Gear_Shoes"),
# have to do this tomfoolery because ninty was a dumbass.
# discovered this only AFTER making most of the code that
# the /post doesnt actually send ur main ability. So its undetectable!!
# Yay!!!! also means gotta code in our own main ability
"Gear_Head_Skill0": GEAR_SKILLS.get("HeadGear", {}).get(hed_id, {}).get("Skill0"),
"Gear_Head_Skill1": data.get("Gear_Head_Skill0"),
"Gear_Head_Skill2": data.get("Gear_Head_Skill1"),
"Gear_Head_Skill3": data.get("Gear_Head_Skill2"),
"Gear_Clothes_Skill0": GEAR_SKILLS.get("Clothes", {}).get(clt_id, {}).get("Skill0"),
"Gear_Clothes_Skill1": data.get("Gear_Clothes_Skill0"),
"Gear_Clothes_Skill2": data.get("Gear_Clothes_Skill1"),
"Gear_Clothes_Skill3": data.get("Gear_Clothes_Skill2"),
"Gear_Shoes_Skill0": GEAR_SKILLS.get("Shoes", {}).get(shs_id, {}).get("Skill0"),
"Gear_Shoes_Skill1": data.get("Gear_Shoes_Skill0"),
"Gear_Shoes_Skill2": data.get("Gear_Shoes_Skill1"),
"Gear_Shoes_Skill3": data.get("Gear_Shoes_Skill2"),
}
else:
gear_data = None
return { return {
"mii_name": mii_name, "mii_name": mii_name,
"last_equipped": last_gear "last_equipped": gear_data
} }
except Exception as e: except Exception as e:
print(f"Equipment Route Error: {e}") print(f"Equipment Route Error: {e}")

View file

@ -1,408 +0,0 @@
{
"shoes": {
"0": 10,
"1": 10,
"1000": 1,
"1001": 13,
"1002": 3,
"1003": 4,
"1004": 6,
"1005": 6,
"1006": 7,
"1007": 13,
"1008": 3,
"1009": 14,
"1010": 13,
"1011": 14,
"1012": 1,
"1013": 5,
"1014": 4,
"1015": 11,
"2000": 5,
"2001": 3,
"2002": 0,
"2003": 11,
"2004": 1,
"2005": 2,
"2006": 6,
"2007": 4,
"2008": 7,
"2009": 10,
"2010": 9,
"2011": 8,
"2012": 1,
"2013": 0,
"2014": 13,
"3000": 6,
"3001": 4,
"3002": 10,
"3003": 11,
"3004": 2,
"3005": 0,
"3006": 1,
"3007": 8,
"3008": 10,
"3009": 5,
"3010": 3,
"3011": 9,
"3012": 6,
"3013": 7,
"4000": 1,
"4001": 11,
"4002": 4,
"4003": 10,
"4004": 0,
"4005": 3,
"4006": 5,
"4007": 2,
"4008": 0,
"5000": 11,
"5001": 2,
"5002": 6,
"5003": 8,
"5004": 1,
"5005": 10,
"5006": 3,
"5007": 5,
"6000": 1,
"6001": 10,
"6002": 2,
"6003": 3,
"6004": 4,
"6005": 6,
"6006": 0,
"6007": 5,
"6008": 8,
"6009": 11,
"6010": 10,
"6011": 9,
"6012": 2,
"6013": 7,
"6014": 4,
"7000": 2,
"7001": 5,
"7002": 11,
"7003": 8,
"7004": 0,
"7005": 3,
"7006": 1,
"7007": 4,
"7008": 10,
"7009": 6,
"7010": 7,
"8000": 11,
"8001": 8,
"8002": 0,
"8003": 10,
"8004": 2,
"8005": 4,
"8006": 1,
"8007": 3,
"8008": 6,
"8009": 5,
"8010": 9,
"8011": 7,
"21001": 2,
"25000": 11,
"25001": 13,
"25002": 1,
"25003": 2,
"25004": 1,
"26000": 6,
"26001": 11,
"26002": 1,
"26003": 8,
"27000": 6,
"27004": 6,
"29014": 14,
"29015": 111,
"29500": 1,
"29501": 10
},
"clothes": {
"0": 12,
"1": 9,
"1000": 3,
"1001": 5,
"1003": 104,
"1004": 4,
"1005": 0,
"1006": 8,
"1007": 7,
"1008": 2,
"1009": 10,
"1010": 6,
"1011": 1,
"1012": 4,
"1013": 2,
"1014": 11,
"1015": 3,
"1016": 106,
"1017": 6,
"1018": 8,
"1019": 5,
"1020": 107,
"1021": 1,
"1022": 105,
"1023": 107,
"1024": 6,
"1025": 10,
"1026": 1,
"1027": 3,
"1028": 106,
"1029": 105,
"2000": 9,
"2001": 11,
"2002": 12,
"2003": 0,
"2004": 1,
"2005": 107,
"2006": 6,
"2007": 11,
"2008": 4,
"2009": 105,
"2010": -1,
"2011": 12,
"2012": 0,
"2013": 8,
"2014": 2,
"2015": 104,
"2016": 5,
"2017": 1,
"2018": 10,
"2019": 3,
"2020": 104,
"2021": 7,
"2022": 10,
"3000": 1,
"3001": 10,
"3002": 11,
"3003": 105,
"3004": 3,
"3005": 0,
"3006": 6,
"3007": 5,
"3008": 8,
"3009": 2,
"3010": 4,
"3011": 106,
"3012": 107,
"3013": 1,
"4000": 3,
"4001": 5,
"4002": 10,
"4003": 107,
"4004": 1,
"4005": 0,
"4006": 4,
"4007": 6,
"4008": 11,
"5000": 11,
"5001": 8,
"5002": 10,
"5003": 106,
"5004": 6,
"5005": 4,
"5006": 0,
"5007": 1,
"5008": 5,
"5009": 3,
"5010": 2,
"6000": 11,
"6001": 6,
"6002": 0,
"6003": 104,
"6004": 3,
"6005": 1,
"6006": 10,
"6007": 5,
"6008": 8,
"6009": 106,
"6010": 107,
"6011": 2,
"6012": 4,
"6013": 1,
"6014": 105,
"6015": 104,
"7000": 106,
"7001": 1,
"7002": 3,
"7003": 6,
"7004": 11,
"7005": 10,
"7006": 0,
"7007": 5,
"7008": 8,
"7009": 105,
"7010": 2,
"7011": 4,
"7012": 107,
"8000": 8,
"8001": 0,
"8002": 11,
"8003": 1,
"8004": 6,
"8005": 106,
"8006": 10,
"8007": 107,
"8008": 3,
"8009": 5,
"8010": 2,
"8011": 4,
"8012": 105,
"9000": 0,
"9001": 1,
"9002": 6,
"9003": 11,
"9004": 3,
"9005": 10,
"9006": 8,
"9007": 5,
"9008": 105,
"21000": 1,
"25000": 1,
"25001": 1,
"25002": 0,
"25003": 1,
"25004": 6,
"26000": 2,
"26001": 10,
"27000": 0,
"27004": 0,
"29016": 107,
"29500": 5,
"29501": 0
},
"head": {
"0": 11,
"1": 4,
"1000": 12,
"1001": 6,
"1002": 1,
"1003": 3,
"1004": 100,
"1005": 7,
"1006": 6,
"1007": 103,
"1008": 11,
"1009": 9,
"1010": 10,
"1011": 10,
"1012": 12,
"1013": -1,
"1014": 11,
"1015": 101,
"1016": 100,
"1017": 5,
"1018": 103,
"1019": 101,
"1020": 1,
"1021": 0,
"1022": 4,
"1023": 8,
"2000": 1,
"2001": 11,
"2002": 6,
"2003": 102,
"2004": 100,
"2005": 0,
"2006": 103,
"2007": 10,
"2008": 5,
"2009": 8,
"2010": 101,
"2011": 3,
"2012": 2,
"2013": 4,
"2014": 9,
"3000": 102,
"3001": 11,
"3002": 4,
"3003": 0,
"3004": 101,
"3005": 3,
"3006": 100,
"3007": 1,
"3008": 5,
"3009": 103,
"3010": 6,
"3011": 10,
"3012": 8,
"3013": 2,
"4000": 11,
"4001": 6,
"4002": 0,
"4003": 3,
"4004": 5,
"4005": 10,
"4006": 8,
"4007": 1,
"4008": 4,
"5000": 11,
"5001": 101,
"5002": 102,
"5003": 0,
"5004": 3,
"5005": 5,
"5006": 1,
"5007": 10,
"5008": 6,
"5009": 103,
"5010": 4,
"5011": 8,
"6000": 11,
"6001": 6,
"6002": 3,
"6003": 102,
"6004": 101,
"6005": 0,
"6006": 4,
"6007": 10,
"6008": 5,
"6009": 1,
"6010": 103,
"6011": 8,
"6012": 100,
"6013": 2,
"7000": 100,
"7001": 0,
"7002": 3,
"7003": 6,
"7004": 11,
"7005": 10,
"7006": 1,
"7007": 102,
"7008": 101,
"7009": 8,
"7010": 5,
"7011": 103,
"7012": 4,
"8000": 11,
"8001": 0,
"8002": 6,
"8003": 100,
"8004": 101,
"8005": 10,
"8006": 1,
"8007": 102,
"8008": 3,
"8009": 8,
"8010": 5,
"8011": 4,
"8012": 103,
"21000": 1,
"25000": 103,
"25001": 11,
"25002": 0,
"25003": 1,
"25004": 11,
"26000": 11,
"26001": 10,
"27000": 100,
"27004": 100,
"29015": 102,
"29016": 103,
"29500": 11,
"29501": 11
}
}