def __init__(self, sequence, id, modify_time, categories, name, desc, used, owner, components, feedback, properties): Processed.__init__(self, sequence) # Length is: # self.length = 4 + 8 + \ 4 + len(categories)*4 + \ 4 + len(name) + \ 4 + len(desc) + \ 4 + 4 + \ 4 + len(components)*8 + \ 4 + len(feedback) + \ 4 for x, s in properties: self.length += 4 + 4 + len(s) self.id = id self.modify_time = modify_time self.categories = categories self.name = name self.desc = desc self.used = used self.owner = owner self.components = components self.feedback = feedback self.properties = properties
def __init__(self, sequence, time): Processed.__init__(self, sequence) # Length is: # * 4 bytes UInt32 # self.length = 4 self.time = time
def __init__(self, sequence, key, left, ids): Processed.__init__(self, sequence) self.length = 4 + 4 + 4 + (4+8) * len(ids) self.key = key self.left = left self.ids = ids
def __init__(self, sequence, key, start, amount): Processed.__init__(self, sequence) self.length = 4 + 4 + 4 self.key = key self.start = start self.amount = amount
def __init__(self, sequence, ids): Processed.__init__(self, sequence) # Length is: # * 4 bytes (uint32 - id) # self.length = 4 + 4 * len(ids) self.ids = ids
def __init__(self, sequence, s=""): Processed.__init__(self, sequence) # Length is: # * 4 bytes (uint32 - string length) # * the string # * null terminator # self.length = 4 + len(s) self.s = s
def __init__(self, sequence): Processed.__init__(self, sequence) # Length is: # * 4 bytes (uint32 - error code # * 4 bytes (uint32 - string length) # * the string # * null terminator # self.length = 0
def __init__(self, sequence, id, slots): Processed.__init__(self, sequence) # Length is: # * 4 bytes (uint32 - id) # self.length = 4 + 4 + 4 * len(slots) self.id = id self.slots = slots
def __init__(self, sequence, s=""): if 1 > sequence: raise ValueError("OK is a reply packet so needs a valid sequence number (%i)" % sequence) Processed.__init__(self, sequence) # Length is: # * 4 bytes (32 bit integer) # * the string # * null terminator # self.length = 4 + len(s) self.s = s
def __init__(self, sequence, id, name, race_name): Processed.__init__(self, sequence) # Length is: # self.length = 4 + \ 4 + len(name) + \ 4 + len(race_name) self.id = id self.name = name self.race_name = race_name
def __init__(self, sequence, posx, posy, posz, size): if sequence != 0: raise ValueError("Object_Get is a normal packet so needs a zero sequence number (%i)" % sequence) Processed.__init__(self, sequence) # Length is: # * 24 bytes (position) # * 8 bytes (radius) self.length = 32 self.pos = [posx, posy, posz] self.size = size
def __init__(self, sequence, id, modify_time, name, description): Processed.__init__(self, sequence) # Length is: # self.length = 4 + 8 + \ 4 + len(name) + \ 4 + len(description) self.id = id self.modify_time = modify_time self.name = name self.description = description
def __init__(self, sequence, time, reason, turn_num, turn_name): Processed.__init__(self, sequence) # Length is: # * 4 bytes UInt32 # * 4 bytes UInt32 # * 4 bytes UInt32 # * length of string # self.length = 4 + 4 + 4 + 4 + len(turn_name) self.time = time self.reason = reason self.turn_num = turn_num self.turn_name = turn_name
def __init__(self, sequence, number): if 1 > sequence: raise ValueError("Sequence is a reply packet so needs a valid sequence number (%i)" % sequence) Processed.__init__(self, sequence) # Length is: # * 4 bytes (uint32 - error code # * 4 bytes (uint32 - string length) # * the string # * null terminator # self.length = 4 self.number = number
def __init__(self, sequence, name, key, \ tp, server, sertype, rule, rulever, \ locations, optional, media): Processed.__init__(self, sequence) # Length is: # self.length = \ 4 + len(name) + \ 4 + len(key) + \ 4 + len(server) + \ 4 + len(sertype) + \ 4 + len(rule) + \ 4 + len(rulever) self.length += 4 for version in tp: self.length += 4 + len(version) self.length += 4 for location in locations: self.length += \ 4 + len(location[0]) + \ 4 + len(location[1]) + \ 4 + len(location[2]) + \ 4 self.length += 4 if isinstance(optional, list): for option in optional: self.length += 4 + 4 + len(option[1]) + 4 else: for option in optional.values(): if isinstance(option, (str, unicode)): self.length += 4 + 4 + len(option) + 4 else: self.length += 4 + 4 + 0 + 4 self.length += 4 + len(media) self.name = name self.key = key self.tp = tp self.server = server self.sertype = sertype self.rule = rule self.rulever = rulever self.locations = locations self._optional = optional self.media = media
def __init__(self, sequence, username, password): Processed.__init__(self, sequence) # Length is: # * 4 bytes (uint32 - string length) # * the string # * null terminator # * 4 bytes (uint32 - string length) # * the string # * null terminator # self.length = 4 + len(username) + 4 + len(password) self.username = username self.password = password
def __init__(self, sequence, errno, s=""): if errno != 0 and sequence < 1: raise ValueError("Fail is a reply packet so needs a valid sequence number (%i)" % sequence) Processed.__init__(self, sequence) # Length is: # * 4 bytes (uint32 - error code # * 4 bytes (uint32 - string length) # * the string # * null terminator # self.length = 4 + 4 + len(s) self.errno = errno self.s = s
def __init__(self, sequence, username, password, email, comment): Processed.__init__(self, sequence) # Length is: # * 4 bytes (uint32 - string length) # * the string # self.length = \ 4 + len(username) + \ 4 + len(password) + \ 4 + len(email) + \ 4 + len(comment) self.username = username self.password = password self.email = email self.comment = comment
def __init__(self, sequence, id, modify_time, categories, name, description, requirements, properties): Processed.__init__(self, sequence) # Length is: # self.length = 4 + 4 + 8 + \ 4 + len(categories)*4 + \ 4 + len(name) + \ 4 + len(description) + \ 4 + len(requirements) for x, value in properties: self.length += 4 + 4 + len(value) self.id = id self.modify_time = modify_time self.categories = categories self.name = name self.description = description self.requirements = requirements self.properties = properties
def __init__(self, sequence, id, slot, types, subject, body, turn, references): Processed.__init__(self, sequence) if not isinstance(references, GenericRS.References): references = GenericRS.References(references) # Length is: # self.length = 4 + 4 + \ 4 + len(types)*4 + \ 4 + len(subject) + \ 4 + len(body) + \ 4 + \ 4 + len(references)*(4*4) self.id = id self.slot = slot self.types = types self.subject = subject self.body = body self.turn = turn self.references = references
def __init__( self, sequence, id, name_singular, name_plural, unit_singular, unit_plural, description, weight, size, modify_time, ): Processed.__init__(self, sequence) # Length is: # self.length = ( 4 + 4 + len(name_singular) + 4 + len(name_plural) + 4 + len(unit_singular) + 4 + len(unit_plural) + 4 + len(description) + 4 + 4 + 8 ) self.id = id self.name_singular, self.name_plural = name_singular, name_plural self.unit_singular, self.unit_plural = unit_singular, unit_plural self.description, self.weight, self.size, self.modify_time = description, weight, size, modify_time
def __init__(self, sequence, id, modify_time, categories, rank, name, display_name, description, calculate, requirements): Processed.__init__(self, sequence) # Length is: # self.length = 4 + 8 + \ 4 + len(categories)*4 + \ 4 + \ 4 + len(name) + \ 4 + len(display_name) + \ 4 + len(description) + \ 4 + len(calculate) + \ 4 + len(requirements) self.id = id self.modify_time = modify_time self.categories = categories self.rank = rank self.name = name self.display_name = display_name self.description = description self.calculate = calculate self.requirements = requirements
def __init__(self, sequence, id): Processed.__init__(self, sequence) self.id = id
def __init__(self, sequence): Processed.__init__(self, sequence) self.length = 0
def __init__(self, sequence, features): Processed.__init__(self, sequence) self.length = 4 + len(features) * 4 self.features = features