summaryrefslogtreecommitdiff
path: root/servergreps/packets.py
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-03-23 00:49:36 +0300
committerAndrei Karas <akaras@inbox.ru>2016-03-23 00:49:36 +0300
commit2670c36bab9530180d33bfaa99ddd3e7b8b9e956 (patch)
treef2cbb2a8e873231bda171fcee7d6603b17cce46e /servergreps/packets.py
parenteb92f38ef3ec7cef80521ad116fda53669ab87cd (diff)
downloadevol-tools-2670c36bab9530180d33bfaa99ddd3e7b8b9e956.tar.gz
evol-tools-2670c36bab9530180d33bfaa99ddd3e7b8b9e956.tar.bz2
evol-tools-2670c36bab9530180d33bfaa99ddd3e7b8b9e956.tar.xz
evol-tools-2670c36bab9530180d33bfaa99ddd3e7b8b9e956.zip
servergreps: add logs with different versions.
Diffstat (limited to 'servergreps/packets.py')
-rwxr-xr-xservergreps/packets.py18
1 files changed, 13 insertions, 5 deletions
diff --git a/servergreps/packets.py b/servergreps/packets.py
index 7810188..ef469a3 100755
--- a/servergreps/packets.py
+++ b/servergreps/packets.py
@@ -6,6 +6,7 @@
import os
import re
+import sys
filt = re.compile(".+[.]c", re.IGNORECASE)
serverpacketre = re.compile("(WFIFOW|WBUFW)([ ]*)[(]([ ]*)([\w>_-]+),([ ]*)"
@@ -135,7 +136,7 @@ def processManaPlusCppFiles(parentDir):
collectManaPlusUsedPackets(file2)
def printPackets():
- with open("serverpackets.txt", "w") as w:
+ with open(sys.argv[1] + "/serverpackets.txt", "w") as w:
for packet in serverpacketsSorted:
data = packet
while data[0] == "0":
@@ -158,14 +159,14 @@ def printPackets():
if packet in clientPackets:
funcDict[clientPackets[packet][1]] = packet
- with open("uselesspackets.txt", "w") as w:
+ with open(sys.argv[1] + "/uselesspackets.txt", "w") as w:
for packet in clientPacketsManaPlusClient:
if packet not in clientPackets:
w.write("Useless packet {0}.\n".format(packet))
manaplusFunc = set()
rev = []
- with open("clientpackets.txt", "w") as w:
+ with open(sys.argv[1] + "/clientpackets.txt", "w") as w:
for packet in clientPacketsManaPlusClient:
clientName = clientPacketsManaPlusClient[packet]
if clientName not in manaplusUsedPacketsSet and clientName.find("_OUTDATED") <= 0:
@@ -184,7 +185,7 @@ def printPackets():
w.write(data)
w.write("\n")
-# with open("wrongpackersizes.txt", "w") as w:
+# with open(sys.argv[1] + "/wrongpackersizes.txt", "w") as w:
# for packet in sizes:
# if packet == "0000":
# continue
@@ -195,10 +196,17 @@ def printPackets():
# if sizes[packet] != clientPackets[packet][0]:
# w.write("{0:>4} {1:4} -> {2:4}\n".format(data, sizes[packet], clientPackets[packet][0]))
+def showHelp():
+ print("Usage: packets.py version");
+ exit(1)
+
+if len(sys.argv) != 2:
+ showHelp()
+
srcPath = "../../server-code/src/"
manaplusPath = "../../manaplus/src/"
protocolPath = manaplusPath + "net/eathena/packets"
-clientPacketsPath = "./packets.h"
+clientPacketsPath = sys.argv[1] + "/packets.h"
packetsPath = manaplusPath + "net/eathena/packetsin.inc"
eathenaPath = manaplusPath + "net/eathena/"