From a2fe11d654553cdee1276b2c3e68ee436594d099 Mon Sep 17 00:00:00 2001 From: Midorica Date: Mon, 29 May 2023 20:57:02 -0400 Subject: [PATCH] Fixing level calculation saving & loading on SAO --- titles/sao/base.py | 22 ++- titles/sao/data/HeroLogLevel.csv | 121 +++++++++++++ titles/sao/data/PlayerRank.csv | 301 +++++++++++++++++++++++++++++++ titles/sao/handlers/base.py | 29 ++- 4 files changed, 467 insertions(+), 6 deletions(-) create mode 100644 titles/sao/data/HeroLogLevel.csv create mode 100644 titles/sao/data/PlayerRank.csv diff --git a/titles/sao/base.py b/titles/sao/base.py index 609c5ac..9626647 100644 --- a/titles/sao/base.py +++ b/titles/sao/base.py @@ -3,6 +3,7 @@ import json, logging from typing import Any, Dict import random import struct +import csv from core.data import Data from core import CoreConfig @@ -29,7 +30,6 @@ class SaoBase: def handle_c122(self, request: Any) -> bytes: #common/get_maintenance_info - resp = SaoGetMaintResponse(int.from_bytes(bytes.fromhex(request[:4]), "big")+1) return resp.make() @@ -438,11 +438,29 @@ class SaoBase: exp = int(profile["rank_exp"]) + 100 #always 100 extra exp for some reason col = int(profile["own_col"]) + int(req_data.base_get_data[0].get_col) + # Calculate level based off experience and the CSV list + with open(r'titles/sao/data/PlayerRank.csv') as csv_file: + csv_reader = csv.reader(csv_file, delimiter=',') + line_count = 0 + data = [] + rowf = False + for row in csv_reader: + if rowf==False: + rowf=True + else: + data.append(row) + + for i in range(0,len(data)): + if exp>=int(data[i][1]) and exp None: @@ -493,9 +494,29 @@ class SaoGetHeroLogUserDataListResponse(SaoBaseResponse): self.last_set_skill_slot5_skill_id = [] for i in range(len(hero_data)): + + # Calculate level based off experience and the CSV list + with open(r'titles/sao/data/HeroLogLevel.csv') as csv_file: + csv_reader = csv.reader(csv_file, delimiter=',') + line_count = 0 + data = [] + rowf = False + for row in csv_reader: + if rowf==False: + rowf=True + else: + data.append(row) + + exp = hero_data[i][4] + + for e in range(0,len(data)): + if exp>=int(data[e][1]) and exp