summaryrefslogtreecommitdiff
path: root/servergreps/hercules/packets.py
diff options
context:
space:
mode:
Diffstat (limited to 'servergreps/hercules/packets.py')
-rwxr-xr-xservergreps/hercules/packets.py26
1 files changed, 23 insertions, 3 deletions
diff --git a/servergreps/hercules/packets.py b/servergreps/hercules/packets.py
index 38a8143..25e223d 100755
--- a/servergreps/hercules/packets.py
+++ b/servergreps/hercules/packets.py
@@ -31,7 +31,7 @@ clientPackets = dict()
sizes = dict()
manaplusUsedPacketsSet = set()
namedPackets = dict()
-#idToServerFunction = dict()
+serverFunctionToId = dict()
def addServerPacket(data):
if data in namedPackets:
@@ -143,8 +143,7 @@ def collectClientPackets(fileName):
while len(data) < 4:
data = "0" + data
clientPackets[data] = (int(m.group("len")), m.group("function"));
- #idToServerFunction[data] = m.group("function")
- #print "{0},{1},{2}".format(m.group("packet"), m.group("len"), m.group("function"))
+ serverFunctionToId[m.group("function")] = data
def collectManaPlusSizes(fileName):
cnt = 0
@@ -298,6 +297,27 @@ def printPackets(packetDir):
w.write(data)
w.write("\n")
+ rev = []
+ with open(packetDir + "/clientbadpackets.txt", "w") as w:
+ for packet in clientPacketsManaPlusClient:
+ if packet in clientPackets and clientPacketsManaPlusClient[packet][2] != clientPackets[packet][1]:
+ packet1 = clientPacketsManaPlusClient[packet]
+ packet2 = clientPackets[packet]
+ if packet1[2] in serverFunctionToId:
+ data = serverFunctionToId[packet1[2]]
+ else:
+ data = "UNKNOWN"
+ rev.append("{0:4} {1:33} client: {2:35} server: {3:35} Change id to {4}".format(packet,
+ packet1[0],
+ packet1[2],
+ packet2[1],
+ data))
+ rev.sort()
+
+ for data in rev:
+ w.write(data)
+ w.write("\n")
+
def showHelp():
print("Usage: packets.py version");
exit(1)