-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathstats.py
More file actions
65 lines (57 loc) · 1.82 KB
/
stats.py
File metadata and controls
65 lines (57 loc) · 1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
from script_api import *
def decode_stat(statType: int):
if statType == 4: # Hp
total = add_long("TotalHp")
base = add_long("BaseHp")
current = add_long("CurrentHp")
else:
total = add_int("StatTotal")
base = add_int("StatBase")
current = add_int("StatCurrent")
return total != current
def decode_specific_stat():
statType = add_byte("StatType")
decode_stat(statType)
def decode_player_delta_stats():
for i in {"Total", "Base", "Current"}:
with Node(i, True):
add_long("Health")
add_int("AtkSpd")
add_int("MoveSpd")
add_int("MountSpd")
add_int("JumpHeight")
def decode_npc_delta_stats():
for i in {"Total", "Base", "Current"}:
with Node(i, True):
add_long("Health")
add_int("AtkSpd")
''' Decode functions per type '''
def decode_npc_stats(): # class CNpc
with Node("NpcStats"):
count = add_byte("count")
if count == 1:
decode_specific_stat()
else:
decode_npc_delta_stats()
# this is for other players
def decode_player_stats(): # class PC
with Node("PlayerStats"):
count = add_byte("count")
if count == 35:
decode_player_delta_stats()
else:
for i in range(count):
with Node("Stat " + str(i), True):
decode_specific_stat()
# this is for own player
def decode_my_player_stats(): # class MyPC
with Node("MyPlayerStats"):
count = add_byte("count")
if count == 35:
for i in range(35):
with Node("Stat " + str(i), True):
decode_stat(i)
else:
for i in range(count):
with Node("Stat " + str(i), True):
decode_specific_stat()