diff --git a/protobuf/user_storage.proto b/protobuf/user_storage.proto index 6675c57f..73de647b 100644 --- a/protobuf/user_storage.proto +++ b/protobuf/user_storage.proto @@ -1,18 +1,18 @@ syntax = "proto2"; message UserStorage { - optional GameSettings game_settings = 2; + optional Attributes attributes = 2; } -message GameSettings { - optional Attributes f22 = 22; +message Attributes { + optional GameSettings game_settings = 22; } -message Attributes { +message GameSettings { optional float f2 = 2; - optional int32 f3 = 3; - optional int32 f4 = 4; - optional int32 f5 = 5; - optional int32 f6 = 6; - optional int32 f7 = 7; + optional int32 leaderboards = 3; + optional int32 power_meter_slot0 = 4; + optional int32 power_meter_slot1 = 5; + optional int32 power_meter_slot2 = 6; + optional int32 power_meter_slot3 = 7; } diff --git a/protobuf/user_storage_pb2.py b/protobuf/user_storage_pb2.py index 22e6d5b4..5316d71e 100644 --- a/protobuf/user_storage_pb2.py +++ b/protobuf/user_storage_pb2.py @@ -13,7 +13,7 @@ -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x12user_storage.proto\"3\n\x0bUserStorage\x12$\n\rgame_settings\x18\x02 \x01(\x0b\x32\r.GameSettings\"(\n\x0cGameSettings\x12\x18\n\x03\x66\x32\x32\x18\x16 \x01(\x0b\x32\x0b.Attributes\"T\n\nAttributes\x12\n\n\x02\x66\x32\x18\x02 \x01(\x02\x12\n\n\x02\x66\x33\x18\x03 \x01(\x05\x12\n\n\x02\x66\x34\x18\x04 \x01(\x05\x12\n\n\x02\x66\x35\x18\x05 \x01(\x05\x12\n\n\x02\x66\x36\x18\x06 \x01(\x05\x12\n\n\x02\x66\x37\x18\x07 \x01(\x05') +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x12user_storage.proto\".\n\x0bUserStorage\x12\x1f\n\nattributes\x18\x02 \x01(\x0b\x32\x0b.Attributes\"2\n\nAttributes\x12$\n\rgame_settings\x18\x16 \x01(\x0b\x32\r.GameSettings\"\x9c\x01\n\x0cGameSettings\x12\n\n\x02\x66\x32\x18\x02 \x01(\x02\x12\x14\n\x0cleaderboards\x18\x03 \x01(\x05\x12\x19\n\x11power_meter_slot0\x18\x04 \x01(\x05\x12\x19\n\x11power_meter_slot1\x18\x05 \x01(\x05\x12\x19\n\x11power_meter_slot2\x18\x06 \x01(\x05\x12\x19\n\x11power_meter_slot3\x18\x07 \x01(\x05') _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals()) _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'user_storage_pb2', globals()) @@ -21,9 +21,9 @@ DESCRIPTOR._options = None _USERSTORAGE._serialized_start=22 - _USERSTORAGE._serialized_end=73 - _GAMESETTINGS._serialized_start=75 - _GAMESETTINGS._serialized_end=115 - _ATTRIBUTES._serialized_start=117 - _ATTRIBUTES._serialized_end=201 + _USERSTORAGE._serialized_end=68 + _ATTRIBUTES._serialized_start=70 + _ATTRIBUTES._serialized_end=120 + _GAMESETTINGS._serialized_start=123 + _GAMESETTINGS._serialized_end=279 # @@protoc_insertion_point(module_scope) diff --git a/zwift_offline.py b/zwift_offline.py index 16faad05..b0ee296f 100644 --- a/zwift_offline.py +++ b/zwift_offline.py @@ -3674,10 +3674,10 @@ def api_player_profile_user_game_storage_attributes(): return '', 202 ret = user_storage_pb2.UserStorage() n = int(request.args.get('n')) - if n in user_storage.game_settings.DESCRIPTOR.fields_by_number: - field = user_storage.game_settings.DESCRIPTOR.fields_by_number[n].name - if user_storage.game_settings.HasField(field): - getattr(ret.game_settings, field).CopyFrom(getattr(user_storage.game_settings, field)) + if n in user_storage.attributes.DESCRIPTOR.fields_by_number: + field = user_storage.attributes.DESCRIPTOR.fields_by_number[n].name + if user_storage.attributes.HasField(field): + getattr(ret.attributes, field).CopyFrom(getattr(user_storage.attributes, field)) return ret.SerializeToString(), 200