1
0
mirror of synced 2024-11-12 00:40:50 +01:00

Fixing level calculation saving & loading on SAO

This commit is contained in:
Midorica 2023-05-29 20:57:02 -04:00
parent 2b4ac06389
commit a2fe11d654
4 changed files with 45 additions and 6 deletions

View File

@ -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<int(data[i+1][1]):
player_level = int(data[i][0])
break
# Update profile
updated_profile = self.game_data.profile.put_profile(
req_data.user_id,
profile["user_type"],
profile["nick_name"],
profile["rank_num"],
player_level,
exp,
col,
profile["own_vp"],

Binary file not shown.
1 HeroLogLevelId,RequireExp
2 1,0,
3 2,1000,
4 3,1200,
5 4,1400,
6 5,1600,
7 6,1900,
8 7,2200,
9 8,2500,
10 9,2800,
11 10,3100,
12 11,3500,
13 12,3900,
14 13,4300,
15 14,4700,
16 15,5100,
17 16,5550,
18 17,6000,
19 18,6450,
20 19,6900,
21 20,7350,
22 21,7850,
23 22,8350,
24 23,8850,
25 24,9350,
26 25,9850,
27 26,10450,
28 27,11050,
29 28,11650,
30 29,12250,
31 30,12850,
32 31,13550,
33 32,14250,
34 33,14950,
35 34,15650,
36 35,16350,
37 36,17150,
38 37,17950,
39 38,18750,
40 39,19550,
41 40,20350,
42 41,21250,
43 42,22150,
44 43,23050,
45 44,23950,
46 45,24850,
47 46,25850,
48 47,26850,
49 48,27850,
50 49,28850,
51 50,29850,
52 51,30950,
53 52,32050,
54 53,33150,
55 54,34250,
56 55,35350,
57 56,36550,
58 57,37750,
59 58,38950,
60 59,40150,
61 60,41350,
62 61,42650,
63 62,43950,
64 63,45250,
65 64,46550,
66 65,47850,
67 66,49250,
68 67,50650,
69 68,52050,
70 69,53450,
71 70,54850,
72 71,56350,
73 72,57850,
74 73,59350,
75 74,60850,
76 75,62350,
77 76,63950,
78 77,65550,
79 78,67150,
80 79,68750,
81 80,70350,
82 81,72050,
83 82,73750,
84 83,75450,
85 84,77150,
86 85,78850,
87 86,80650,
88 87,82450,
89 88,84250,
90 89,86050,
91 90,87850,
92 91,89750,
93 92,91650,
94 93,93550,
95 94,95450,
96 95,97350,
97 96,99350,
98 97,101350,
99 98,103350,
100 99,105350,
101 100,107350,
102 101,200000,
103 102,300000,
104 103,450000,
105 104,600000,
106 105,800000,
107 106,1000000,
108 107,1250000,
109 108,1500000,
110 109,1800000,
111 110,2100000,
112 111,2100000,
113 112,2100000,
114 113,2100000,
115 114,2100000,
116 115,2100000,
117 116,2100000,
118 117,2100000,
119 118,2100000,
120 119,2100000,
121 120,2100000,

Binary file not shown.
Can't render this file because it has a wrong number of fields in line 11.

View File

@ -2,6 +2,7 @@ import struct
from datetime import datetime
from construct import *
import sys
import csv
class SaoBaseRequest:
def __init__(self, data: bytes) -> 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<int(data[e+1][1]):
hero_level = int(data[e][0])
break
self.user_hero_log_id.append(hero_data[i][2])
self.log_level.append(hero_data[i][3])
self.max_log_level_extended_num.append(hero_data[i][3])
self.log_level.append(hero_level)
self.max_log_level_extended_num.append(hero_level)
self.log_exp.append(hero_data[i][4])
self.last_set_skill_slot1_skill_id.append(hero_data[i][7])
self.last_set_skill_slot2_skill_id.append(hero_data[i][8])
@ -510,8 +531,8 @@ class SaoGetHeroLogUserDataListResponse(SaoBaseResponse):
self.user_hero_log_id = list(map(str,self.user_hero_log_id)) #str
self.hero_log_id = list(map(int,self.user_hero_log_id)) #int
self.log_level = list(map(int,self.log_level)) #short
self.max_log_level_extended_num = list(map(int,self.log_level)) #short
self.log_exp = list(map(int,self.log_level)) #int
self.max_log_level_extended_num = list(map(int,self.max_log_level_extended_num)) #short
self.log_exp = list(map(int,self.log_exp)) #int
self.possible_awakening_flag = 0 #byte
self.awakening_stage = 0 #short
self.awakening_exp = 0 #int