class GameInformation(Packet): pid = 1 version = packets.UInt8Field(ordering=1, is_version_identifier=True) grfinfo = packets.RepeatingField(ordering=2, count=packets.UInt8Field(ordering=-1), fields={ "id": packets.UInt32Field(ordering=1), "md5": packets.MD5Field(ordering=2), }) game_date = packets.DateField(ordering=3) start_date = packets.DateField(ordering=4) companies_max = packets.UInt8Field(ordering=5) companies_on = packets.UInt8Field(ordering=6) spectators_max = packets.UInt8Field(ordering=7) name = packets.StringField(ordering=8, trim_length=constants.NETWORK_NAME_LENGTH) revision = packets.StringField( ordering=9, trim_length=constants.NETWORK_REVISION_LENGTH) language = packets.UInt8Field(ordering=10) passworded = packets.BooleanField(ordering=11) clients_max = packets.UInt8Field(ordering=12) clients_on = packets.UInt8Field(ordering=13) spectators_on = packets.UInt8Field(ordering=14) map_name = packets.StringField(ordering=15) map_width = packets.UInt16Field(ordering=16) map_height = packets.UInt16Field(ordering=17) map_set = packets.UInt8Field(ordering=18) dedicated = packets.UInt8Field(ordering=19)
class ClientInfo(Packet): pid = 109 client_id = packets.UInt32Field(ordering=1) hostname = packets.StringField(ordering=2) name = packets.StringField(ordering=3) language = packets.UInt8Field(ordering=4) joindate = packets.DateField(ordering=5) play_as = packets.UInt8Field(ordering=6)
class CompanyUpdate(Packet): pid = 115 company_id = packets.UInt8Field(ordering=1) name = packets.StringField(ordering=2) manager_name = packets.StringField(ordering=3) colour = packets.UInt8Field(ordering=4) passworded = packets.BooleanField(ordering=5) bankrupcy_counter = packets.UInt8Field(ordering=8) shareholder = packets.UInt8Field(ordering=9, count=4)
class Join(Packet): pid = 0 password = packets.StringField( ordering=1, validators=[validators.MaxLength(constants.NETWORK_PASSWORD_LENGTH)]) name = packets.StringField( ordering=2, trim_length=constants.NETWORK_CLIENT_NAME_LENGTH) version = packets.StringField( ordering=3, trim_length=constants.NETWORK_REVISION_LENGTH)
class CompanyInfo(Packet): pid = 114 company_id = packets.UInt8Field(ordering=1) name = packets.StringField(ordering=2) manager_name = packets.StringField(ordering=3) colour = packets.UInt8Field(ordering=4) passworded = packets.BooleanField(ordering=5) startyear = packets.UInt32Field(ordering=6) is_ai = packets.BooleanField(ordering=7) bankrupcy_counter = packets.UInt8Field(ordering=8) shareholder = packets.UInt8Field(ordering=9, count=4)
class Welcome(Packet): pid = 104 name = packets.StringField(ordering=1) version = packets.StringField(ordering=2) dedicated = packets.BooleanField(ordering=3) map_name = packets.StringField(ordering=4) seed = packets.UInt32Field(ordering=5) landscape = packets.UInt8Field(ordering=6) startyear = packets.DateField(ordering=7) size_x = packets.UInt16Field(ordering=8) size_y = packets.UInt16Field(ordering=9)
class TestPacket(packets.Packet): testa = packets.UInt16Field(ordering=1) testb = packets.UInt32Field(ordering=2) testc = packets.UInt16Field( ordering=100) # Set to highest to ensure last packet field. testd = packets.Int16Field(ordering=3) teste = packets.StringField(ordering=4) testf = packets.StringField(ordering=5) testg = packets.UInt8Field(ordering=6) testh = packets.StringField(ordering=90) class Meta: virtual = True
class Rcon(Packet): pid = 5 command = packets.StringField(ordering=1, validators=[ validators.MaxLength( constants.NETWORK_RCONCOMMAND_LENGTH) ])
class CmdNames(Packet): pid = 122 commands = packets.DictField(ordering=1, key=packets.UInt16Field(ordering=1), value=packets.StringField(ordering=2), is_next=packets.BooleanField(ordering=3, is_next=True))
class Chat(Packet): pid = 119 action = packets.UInt8Field(ordering=1) dest_type = packets.UInt8Field(ordering=2) client_id = packets.UInt32Field(ordering=3) message = packets.StringField(ordering=4) data = packets.UInt64Field(ordering=5)
class CmdLogging(Packet): pid = 123 client_id = packets.UInt32Field(ordering=1) company_id = packets.UInt8Field(ordering=2) command_id = packets.UInt16Field(ordering=3) params = packets.UInt32Field(ordering=4, count=2) tile = packets.UInt32Field(ordering=5) text = packets.StringField(ordering=6) frame = packets.UInt32Field(ordering=7)
class Register(Packet): pid = 4 welcome_message = packets.StringField( default=constants.NETWORK_MASTER_SERVER_WELCOME_MESSAGE) version = packets.UInt8Field( default=constants.NETWORK_MASTER_SERVER_VERSION, is_version_identifier=True) server_port = packets.UInt16Field(default=constants.NETWORK_DEFAULT_PORT) session_key = packets.UInt64Field()
class Chat(Packet): pid = 4 action = packets.UInt8Field(ordering=1, validators=[enums.Action.is_valid_admin_chat]) dest_type = packets.UInt8Field(ordering=2, validators=[enums.DestType.is_valid]) client_id = packets.UInt32Field(ordering=3) message = packets.StringField( ordering=4, validators=[validators.MaxLength(constants.NETWORK_CHAT_LENGTH)])
class NewGRF(Packet): pid = 10 newgrfs = packets.RepeatingField(ordering=1, count=packets.UInt8Field(ordering=-1), fields={ "id": packets.UInt32Field(ordering=1), "md5": packets.MD5Field(ordering=2), "name": packets.StringField(ordering=3), })
class DetailInformation(Packet): pid = 3 company_info_version = packets.UInt8Field(ordering=1) companies = packets.RepeatingField( ordering=2, count=packets.UInt8Field(ordering=-1), fields={ "index": packets.UInt8Field(ordering=1), "name": packets.StringField(ordering=2), "inaugurated_year": packets.UInt32Field(ordering=3), "value": packets.Int64Field(ordering=4), "money": packets.Int64Field(ordering=5), "income": packets.Int64Field(ordering=6), "performance": packets.UInt16Field(ordering=7), "passworded": packets.BooleanField(ordering=8), "vehicles": packets.GroupedField(ordering=9, fields={ 'train': packets.UInt16Field(ordering=1), 'lorry': packets.UInt16Field(ordering=2), 'bus': packets.UInt16Field(ordering=3), 'plane': packets.UInt16Field(ordering=4), 'ship': packets.UInt16Field(ordering=5), }), "stations": packets.GroupedField(ordering=10, fields={ 'train': packets.UInt16Field(ordering=1), 'lorry': packets.UInt16Field(ordering=2), 'bus': packets.UInt16Field(ordering=3), 'plane': packets.UInt16Field(ordering=4), 'ship': packets.UInt16Field(ordering=5), }), "is_ai": packets.BooleanField(ordering=11), })
class Rcon(Packet): pid = 120 colour = packets.UInt16Field(ordering=1) result = packets.StringField(ordering=2)
class Console(Packet): pid = 121 origin = packets.StringField(ordering=1) message = packets.StringField(ordering=2)
class RconEnd(Packet): pid = 125 command = packets.StringField(ordering=1)
class ClientUpdate(Packet): pid = 110 client_id = packets.UInt32Field(ordering=1) name = packets.StringField(ordering=2) play_as = packets.UInt8Field(ordering=3)