diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-10-14 19:26:29 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-10-14 19:26:29 +0300 |
commit | eec80633694f983ccba12c5a3986c6e29e850b2c (patch) | |
tree | b3a91b542b5ab7bc9cf35121f0e70e1ffa56f27b /servergreps/hercules/src/server.py | |
parent | e45dd72f3e372104f75803753dd11b5da60a86d0 (diff) | |
download | tools-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-x | servergreps/hercules/src/server.py | 56 |
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() |