summaryrefslogtreecommitdiff
path: root/servergreps/hercules/packets.py
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-04-05 20:19:59 +0300
committerAndrei Karas <akaras@inbox.ru>2016-04-05 20:19:59 +0300
commitfd702b5be1a53d12278439310a79de3964ce8f18 (patch)
treee281bb513655a46e0a393ae6021a9aee674d1dc8 /servergreps/hercules/packets.py
parente61c09fe7426adfd85417703ef05c0912981006f (diff)
downloadtools-fd702b5be1a53d12278439310a79de3964ce8f18.tar.gz
tools-fd702b5be1a53d12278439310a79de3964ce8f18.tar.bz2
tools-fd702b5be1a53d12278439310a79de3964ce8f18.tar.xz
tools-fd702b5be1a53d12278439310a79de3964ce8f18.zip
servergreps: add packet version check in parsing packetsout.inc
Diffstat (limited to 'servergreps/hercules/packets.py')
-rwxr-xr-xservergreps/hercules/packets.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/servergreps/hercules/packets.py b/servergreps/hercules/packets.py
index 559a1c7..4303c63 100755
--- a/servergreps/hercules/packets.py
+++ b/servergreps/hercules/packets.py
@@ -111,9 +111,17 @@ def collectManaPlusInPackets(fileName, packetVersion):
clientPacketsManaPlus[m.group("packet").lower()] = m.group("name")
sizes[m.group("packet").lower()] = m.group("len")
-def collectManaPlusOutPackets(fileName):
+def collectManaPlusOutPackets(fileName, packetVersion):
+ version = 0
with open(fileName, "r") as f:
for line in f:
+ m = protocolinverre.search(line)
+ if m is not None:
+ version = int(m.group("ver"))
+ continue
+ # skip bigger versions than requested
+ if version > packetVersion:
+ continue
m = protocoloutre.search(line)
if m is not None:
clientPacketsManaPlus[m.group("packet").lower()] = m.group("name")
@@ -271,7 +279,7 @@ collectNamedPackets(namedPacketsPath);
collectServerPackets(srcPath)
collectClientPackets(clientPacketsPath)
collectManaPlusInPackets(protocolPath + "in.inc", int(packetVersion))
-collectManaPlusOutPackets(protocolPath + "out.inc")
+collectManaPlusOutPackets(protocolPath + "out.inc", int(packetVersion))
#collectManaPlusSizes(packetsPath);
processManaPlusCppFiles(eathenaPath);
sortClientPackets()