summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--net/packet_handler.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/net/packet_handler.py b/net/packet_handler.py
new file mode 100644
index 0000000..48a0a6d
--- /dev/null
+++ b/net/packet_handler.py
@@ -0,0 +1,24 @@
+from packet import *
+from protocol import *
+
+def handle_stat_update_1(packet, player_node, logging):
+ stat_type = packet.read_int16()
+ value = packet.read_int32()
+ if stat_type == 0x0005:
+ player_node.HP = value
+ elif stat_type == 0x0006:
+ player_node.MaxHP = value
+ elif stat_type == 0x0007:
+ player_node.MP = value
+ elif stat_type == 0x0008:
+ player_node.MaxMP = value
+ elif stat_type == 0x000b:
+ player_node.LEVEL = value
+ elif stat_type == 0x0018:
+ logging.info("Weight changed from %s/%s to %s/%s", \
+ player_node.WEIGHT, player_node.MaxWEIGHT, value, player_node.MaxWEIGHT)
+ player_node.WEIGHT = value
+ elif stat_type == 0x0019:
+ logging.info("Max Weight: %s", value)
+ player_node.MaxWEIGHT = value
+