diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-04-19 14:30:10 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-04-19 14:31:48 +0300 |
commit | 3e5ab5de17dc8d215f7ed653cdf9eb954113025a (patch) | |
tree | 4f0d70cc0ddbf99d3372ca9ce8e11f16e3f1e351 /servergreps/hercules | |
parent | a3a1410376877d7d30d206ba3cba44a6e07679c6 (diff) | |
download | evol-tools-3e5ab5de17dc8d215f7ed653cdf9eb954113025a.tar.gz evol-tools-3e5ab5de17dc8d215f7ed653cdf9eb954113025a.tar.bz2 evol-tools-3e5ab5de17dc8d215f7ed653cdf9eb954113025a.tar.xz evol-tools-3e5ab5de17dc8d215f7ed653cdf9eb954113025a.zip |
servergreps: add parsing for new login packets format
Diffstat (limited to 'servergreps/hercules')
-rwxr-xr-x | servergreps/hercules/packets.py | 11 | ||||
-rwxr-xr-x | servergreps/hercules/update.sh | 1 |
2 files changed, 11 insertions, 1 deletions
diff --git a/servergreps/hercules/packets.py b/servergreps/hercules/packets.py index 85e4b43..34c91dd 100755 --- a/servergreps/hercules/packets.py +++ b/servergreps/hercules/packets.py @@ -8,13 +8,14 @@ import os import re import sys -filt = re.compile(".+[.]c", re.IGNORECASE) +filt = re.compile(".+[.](c|h)", re.IGNORECASE) serverpacketre = re.compile("(WFIFOW|WBUFW)([ ]*)[(]([ ]*)([\w>_-]+),([ ]*)" + "(?P<offset>0)([ ]*)[)]([ ]*)=([ ]*)0x(?P<packet>[0-9a-fA-F]+)([ ]*)[;]") serverpacketre2 = re.compile("PacketType([ ]*)=([ ]*)(?P<name>[\w_]+);") serverpacketre3 = re.compile("(WFIFOW|WBUFW)([ ]*)[(]([ ]*)([\w>_-]+),([ ]*)" + "(?P<offset>0)([ ]*)[)]([ ]*)=([ ]*)(?P<packet>[0-9\w]+)([ ]*)[;]") serverpacketre4 = re.compile("int cmd([ ]*)=([ ]*)0x(?P<packet>[0-9a-fA-F]+);") +serverpacketre5 = re.compile("([ ]*)PACKET_ID_(?P<name>[A-Z_]+)([ ]*)=([ ]*)0x(?P<packet>[0-9a-fA-F]+),") protocolinre = re.compile("packet[(](?P<name>[A-Z0-9_]+),([ ]*)0x(?P<packet>[0-9a-fA-F]+),([ ]*)(?P<len>[\w-]+),([ ]*)") protocolinverre = re.compile("^// (?P<ver>[0-9]+)$") protocoloutre = re.compile("packet[(](?P<name>CMSG_[A-Z0-9_]+),([ ]*)0x(?P<packet>[0-9a-fA-F]+),([ ]*)(?P<len>[\w-]+),([ ]*)(?P<function>[0-9a-zA-Z_>-]+)[)];") @@ -61,6 +62,14 @@ def collectServerPackets(parentDir): while len(data) < 4: data = "0" + data addServerPacket(data) + m = serverpacketre5.findall(line) + if len(m) > 0: + for str in m: + # here we ignoring str[1] or "name" for packet name + data = str[4] + while len(data) < 4: + data = "0" + data + addServerPacket(data) m = serverpacketre.findall(line) if len(m) == 0: m = serverpacketre3.findall(line) diff --git a/servergreps/hercules/update.sh b/servergreps/hercules/update.sh index c6608b4..c15c479 100755 --- a/servergreps/hercules/update.sh +++ b/servergreps/hercules/update.sh @@ -19,6 +19,7 @@ function genpackets { preproc $1 $2 char char.c preproc $1 $2 login login.c preproc $1 $2 map clif.c + preproc $1 $2 login lclif.p.h ./packets.py $2 } |