summaryrefslogtreecommitdiff
path: root/servergreps/hercules/src/server.py
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-10-14 19:26:29 +0300
committerAndrei Karas <akaras@inbox.ru>2016-10-14 19:26:29 +0300
commiteec80633694f983ccba12c5a3986c6e29e850b2c (patch)
treeb3a91b542b5ab7bc9cf35121f0e70e1ffa56f27b /servergreps/hercules/src/server.py
parente45dd72f3e372104f75803753dd11b5da60a86d0 (diff)
downloadtools-eec80633694f983ccba12c5a3986c6e29e850b2c.tar.gz
tools-eec80633694f983ccba12c5a3986c6e29e850b2c.tar.bz2
tools-eec80633694f983ccba12c5a3986c6e29e850b2c.tar.xz
tools-eec80633694f983ccba12c5a3986c6e29e850b2c.zip
Remove servergreps tool and add readme about moving to new repository.
Diffstat (limited to 'servergreps/hercules/src/server.py')
-rwxr-xr-xservergreps/hercules/src/server.py56
1 files changed, 0 insertions, 56 deletions
diff --git a/servergreps/hercules/src/server.py b/servergreps/hercules/src/server.py
deleted file mode 100755
index 614feb5..0000000
--- a/servergreps/hercules/src/server.py
+++ /dev/null
@@ -1,56 +0,0 @@
-#! /usr/bin/env python2
-# -*- coding: utf8 -*-
-#
-# Copyright (C) 2015-2016 Evol Online
-# Author: Andrei Karas (4144)
-
-import re
-
-class Server:
- packetre = re.compile(
- "([ ]*)HEADER_(?P<type>[A-Z][A-Z])_(?P<name>[A-Z0-9_]+)([ ]*)=" +
- "([ ]*)0x(?P<packet>[0-9a-fA-F]+),")
-
- def __init__(self):
- self.outPackets = set()
- self.inPackets = set()
- self.outPacketsSorted = []
- self.inPacketsSorted = []
- self.idToName = dict()
-
- def collectPackets(self):
- with open("../links/" + self.dirName + "/packets.txt", "r") as f:
- for line in f:
- m = self.packetre.search(line)
- if m is not None:
- data = m.group("packet").lower()
- packetType = m.group("type")
- partName = m.group("name")
- if len(data) > 2 and data[:2] == "0x":
- data = data[2:]
- while len(data) < 4:
- data = "0" + data
- if packetType in ("CA", "CH", "CZ"):
- self.inPackets.add(data)
- if packetType in ("AC", "HC", "ZC"):
- self.outPackets.add(data)
- self.idToName[data] = "HEADER_{0}_{1}".format(packetType, partName)
-
-
- def sortOutPackets(self):
- for packet in self.outPackets:
- self.outPacketsSorted.append(packet)
- self.outPacketsSorted.sort()
-
-
- def sortInPackets(self):
- for packet in self.inPackets:
- self.inPacketsSorted.append(packet)
- self.inPacketsSorted.sort()
-
-
- def processPackets(self, dirName):
- self.dirName = dirName
- self.collectPackets()
- self.sortInPackets()
- self.sortOutPackets()