From 3ebb8062eb11ebfd764bd09c137c68b94db7d32c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=AE=D1=80=D0=B8=D0=B9=20=D0=9F=D0=B5=D1=80=D1=88=D0=B8?= =?UTF-8?q?=D0=BD?= Date: Sun, 20 Feb 2022 16:36:48 +0500 Subject: [PATCH] proto++ --- protobuf/world.proto | 20 ++++++++++---------- protobuf/world_pb2.py | 12 ++++++------ zwift_offline.py | 6 +++--- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/protobuf/world.proto b/protobuf/world.proto index 97ff17e..cee56ab 100644 --- a/protobuf/world.proto +++ b/protobuf/world.proto @@ -2,16 +2,16 @@ syntax = "proto2"; message DropInWorld { required uint64 id = 1; optional string name = 2; - optional uint64 f3 = 3; + optional uint64 course_id = 3; optional bool f4 = 4; optional uint64 zwifters = 5; optional uint64 world_time = 6; optional uint64 real_time = 7; - repeated DropInPlayer player_states = 8; - repeated DropInPlayer f9 = 9; - repeated DropInPlayer f10 = 10; - optional uint64 f11 = 11; - repeated DropInPlayer pace_partner_states = 12; + repeated DropInPlayer pro_players = 8; + repeated DropInPlayer followees = 9; + repeated DropInPlayer others = 10; + optional uint64 max_zwifters = 11; //stored as int32 + repeated DropInPlayer pacer_bots = 12; } message DropInWorldList { @@ -25,9 +25,9 @@ message DropInPlayer { optional uint64 distance = 4; optional uint64 time = 5; optional uint64 country_code = 6; - optional sint64 f7 = 7; - optional uint64 sport = 8; - optional uint64 f9 = 9; + optional int64 player_type = 7; // PlayerType, stored as int32 + optional uint64 sport = 8; //stored as int32 + optional bool f9 = 9; optional bool f10 = 10; optional uint64 f11 = 11; optional uint64 power = 12; @@ -37,5 +37,5 @@ message DropInPlayer { optional float y = 16; optional int32 route = 17; optional uint32 ride_power = 18; - optional float speed = 19; + optional uint32 speed = 19; } \ No newline at end of file diff --git a/protobuf/world_pb2.py b/protobuf/world_pb2.py index 3f49cb1..d1f1bed 100644 --- a/protobuf/world_pb2.py +++ b/protobuf/world_pb2.py @@ -14,7 +14,7 @@ _sym_db = _symbol_database.Default() -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0bworld.proto\"\x8e\x02\n\x0b\x44ropInWorld\x12\n\n\x02id\x18\x01 \x02(\x04\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\n\n\x02\x66\x33\x18\x03 \x01(\x04\x12\n\n\x02\x66\x34\x18\x04 \x01(\x08\x12\x10\n\x08zwifters\x18\x05 \x01(\x04\x12\x12\n\nworld_time\x18\x06 \x01(\x04\x12\x11\n\treal_time\x18\x07 \x01(\x04\x12$\n\rplayer_states\x18\x08 \x03(\x0b\x32\r.DropInPlayer\x12\x19\n\x02\x66\x39\x18\t \x03(\x0b\x32\r.DropInPlayer\x12\x1a\n\x03\x66\x31\x30\x18\n \x03(\x0b\x32\r.DropInPlayer\x12\x0b\n\x03\x66\x31\x31\x18\x0b \x01(\x04\x12*\n\x13pace_partner_states\x18\x0c \x03(\x0b\x32\r.DropInPlayer\"/\n\x0f\x44ropInWorldList\x12\x1c\n\x06worlds\x18\x01 \x03(\x0b\x32\x0c.DropInWorld\"\xac\x02\n\x0c\x44ropInPlayer\x12\n\n\x02id\x18\x01 \x02(\x04\x12\x11\n\tfirstName\x18\x02 \x02(\t\x12\x10\n\x08lastName\x18\x03 \x02(\t\x12\x10\n\x08\x64istance\x18\x04 \x01(\x04\x12\x0c\n\x04time\x18\x05 \x01(\x04\x12\x14\n\x0c\x63ountry_code\x18\x06 \x01(\x04\x12\n\n\x02\x66\x37\x18\x07 \x01(\x12\x12\r\n\x05sport\x18\x08 \x01(\x04\x12\n\n\x02\x66\x39\x18\t \x01(\x04\x12\x0b\n\x03\x66\x31\x30\x18\n \x01(\x08\x12\x0b\n\x03\x66\x31\x31\x18\x0b \x01(\x04\x12\r\n\x05power\x18\x0c \x01(\x04\x12\x0b\n\x03\x66\x31\x33\x18\r \x01(\x04\x12\t\n\x01x\x18\x0e \x01(\x02\x12\x10\n\x08\x61ltitude\x18\x0f \x01(\x02\x12\t\n\x01y\x18\x10 \x01(\x02\x12\r\n\x05route\x18\x11 \x01(\x05\x12\x12\n\nride_power\x18\x12 \x01(\r\x12\r\n\x05speed\x18\x13 \x01(\x02') +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0bworld.proto\"\x9d\x02\n\x0b\x44ropInWorld\x12\n\n\x02id\x18\x01 \x02(\x04\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x11\n\tcourse_id\x18\x03 \x01(\x04\x12\n\n\x02\x66\x34\x18\x04 \x01(\x08\x12\x10\n\x08zwifters\x18\x05 \x01(\x04\x12\x12\n\nworld_time\x18\x06 \x01(\x04\x12\x11\n\treal_time\x18\x07 \x01(\x04\x12\"\n\x0bpro_players\x18\x08 \x03(\x0b\x32\r.DropInPlayer\x12 \n\tfollowees\x18\t \x03(\x0b\x32\r.DropInPlayer\x12\x1d\n\x06others\x18\n \x03(\x0b\x32\r.DropInPlayer\x12\x14\n\x0cmax_zwifters\x18\x0b \x01(\x04\x12!\n\npacer_bots\x18\x0c \x03(\x0b\x32\r.DropInPlayer\"/\n\x0f\x44ropInWorldList\x12\x1c\n\x06worlds\x18\x01 \x03(\x0b\x32\x0c.DropInWorld\"\xb5\x02\n\x0c\x44ropInPlayer\x12\n\n\x02id\x18\x01 \x02(\x04\x12\x11\n\tfirstName\x18\x02 \x02(\t\x12\x10\n\x08lastName\x18\x03 \x02(\t\x12\x10\n\x08\x64istance\x18\x04 \x01(\x04\x12\x0c\n\x04time\x18\x05 \x01(\x04\x12\x14\n\x0c\x63ountry_code\x18\x06 \x01(\x04\x12\x13\n\x0bplayer_type\x18\x07 \x01(\x03\x12\r\n\x05sport\x18\x08 \x01(\x04\x12\n\n\x02\x66\x39\x18\t \x01(\x08\x12\x0b\n\x03\x66\x31\x30\x18\n \x01(\x08\x12\x0b\n\x03\x66\x31\x31\x18\x0b \x01(\x04\x12\r\n\x05power\x18\x0c \x01(\x04\x12\x0b\n\x03\x66\x31\x33\x18\r \x01(\x04\x12\t\n\x01x\x18\x0e \x01(\x02\x12\x10\n\x08\x61ltitude\x18\x0f \x01(\x02\x12\t\n\x01y\x18\x10 \x01(\x02\x12\r\n\x05route\x18\x11 \x01(\x05\x12\x12\n\nride_power\x18\x12 \x01(\r\x12\r\n\x05speed\x18\x13 \x01(\r') @@ -46,9 +46,9 @@ if _descriptor._USE_C_DESCRIPTORS == False: DESCRIPTOR._options = None _DROPINWORLD._serialized_start=16 - _DROPINWORLD._serialized_end=286 - _DROPINWORLDLIST._serialized_start=288 - _DROPINWORLDLIST._serialized_end=335 - _DROPINPLAYER._serialized_start=338 - _DROPINPLAYER._serialized_end=638 + _DROPINWORLD._serialized_end=301 + _DROPINWORLDLIST._serialized_start=303 + _DROPINWORLDLIST._serialized_end=350 + _DROPINPLAYER._serialized_start=353 + _DROPINPLAYER._serialized_end=662 # @@protoc_insertion_point(module_scope) diff --git a/zwift_offline.py b/zwift_offline.py index 5b9217b..0245977 100644 --- a/zwift_offline.py +++ b/zwift_offline.py @@ -1826,14 +1826,14 @@ def add_player_to_world(player, course_world, is_pace_partner): if not partial_profile == None: online_player = None if is_pace_partner: - online_player = course_world[course_id].pace_partner_states.add() + online_player = course_world[course_id].pacer_bots.add() online_player.route = partial_profile.route if player.sport == 0: online_player.ride_power = player.power else: online_player.speed = player.speed else: - online_player = course_world[course_id].player_states.add() + online_player = course_world[course_id].pro_players.add() online_player.id = player.id online_player.firstName = partial_profile.first_name online_player.lastName = partial_profile.last_name @@ -1926,7 +1926,7 @@ def relay_worlds_generic(world_id=None): world = worlds.worlds.add() world.id = 1 world.name = 'Public Watopia' - world.f3 = course + world.course_id = course world.world_time = world_time() world.real_time = int(get_utc_time()) world.zwifters = 0