proto++, fix private event feed bug

This commit is contained in:
Юрий Першин
2022-04-17 15:10:31 -03:00
committed by oldnapalm
parent 69c7d0a5fa
commit c4d16d05f6
6 changed files with 160 additions and 76 deletions
+3 -3
View File
@@ -43,13 +43,13 @@ message PrivateEventFeedListProto {
message PlayerJoinedEvent {
required uint64 ev_sg_id = 1;
required uint64 player_id = 2;
optional uint64 player_id = 2;
optional uint64 pje_f3 = 3;
}
message PlayerLeftEvent { //didn't decompiled yet, just a guess
required uint64 ev_sg_id = 1;
required uint64 player_id = 2;
optional uint64 player_id = 2;
optional uint64 ple_f3 = 3;
}
@@ -185,7 +185,7 @@ message Event { //real name: EventProtobuf; where is shortName, shortDescription
optional EventType eventType = 24;
optional uint64 e_f25 = 25;
optional string e_f26 = 26;
optional uint64 e_f27 = 27; //<=4, ENUM?
optional uint64 e_f27 = 27; //<=4, ENUM? saw = 2
optional bool overrideMapPreferences = 28;
optional bool invisibleToNonParticipants = 29;
optional EventSeriesProtobuf evSeries = 30;
+65 -25
View File
File diff suppressed because one or more lines are too long
+2 -2
View File
@@ -8,7 +8,7 @@ message SegmentResult {
optional uint64 f4 = 4; //=CourseID
optional uint64 segment_id = 5;
optional uint64 event_subgroup_id = 6;
required string first_name = 7;
required string first_name = 7; //only first letter
required string last_name = 8;
optional uint64 world_time = 9;
optional string finish_time_str = 10;
@@ -24,7 +24,7 @@ message SegmentResult {
optional int64 f20 = 20; //-> enum Sport sport
//optional uint64 f21 = 21; //:=activityId (may be -1)
//optional bool f22 = 22;
//optional string f23 = 23;
//optional string f23 = 23; //only first letter of first_name
}
message SegmentResults {
+28 -7
View File
@@ -36,6 +36,19 @@ enum WA_TYPE {
WAT_PPI = 116; //ZNETWORK_INTERNAL_HandlePacePartnerInfo
}
enum UserBikeAction {
UBA_ELBOW = 0;
UBA_WAVE = 1;
UBA_02 = 2; //BikeEntity::UpdateAnimation
UBA_RIDEON = 3;
UBA_HAMMER = 4;
UBA_NICE = 5;
UBA_BRING_IT = 6;
UBA_TOAST = 7;
UBA_BELL = 8;
UBA_HOLIDAY_WAVE = 9; //not sure
}
message WorldAttribute {
optional int64 wa_f1 = 1; //not r/w by game? 587645624533328784, later 5876456 85771834256
optional int64 server_realm = 2;
@@ -51,10 +64,18 @@ message WorldAttribute {
optional int64 wa_f12 = 12; //not r/w by game? Not in package when testing
optional int32 wa_f13 = 13; //not r/w by game?
optional int64 timestamp = 14; //not written by game? (from server) looks like "The Current Epoch Unix Timestamp" in Microseconds
optional int32 wa_f15 = 15; //not r/w by game? 6, might be course
optional int32 wa_f15 = 15; //6, not r/w by game?
optional int64 wa_f16 = 16; //not r/w by game? stored as bool
}
message PlayerLeftWorld {
required int64 player_id = 1;
optional int64 world_time = 2; // not sure
optional bool anotherLogin = 3; // user profile logged in twice -> one of them should be logged out
optional bool plw_f4 = 4; //true
repeated sint64 plw_f5 = 5; // [1056322864]
}
/*message WorldAttributes {
repeated WorldAttribute world_attributes = 1;
required int64 world_time = 2;
@@ -117,7 +138,7 @@ message PlayerState {
optional Sport sport = 31;
optional float ps_f32 = 32;
optional uint32 ps_f33 = 33;
optional float ps_f34 = 34; //= BikeEntity.field_F00 (=219.56387 and incr if moving)
optional float dist_lat = 34; //= BikeEntity.field_F00 (=219.56387 and incr if moving: actual distance moved included lateral movement)
optional int32 world = 35;
optional uint32 ps_f36 = 36; // = f(BikeEntity.field_2a28) BikeEntity::CreateNewPacket
optional uint32 ps_f37 = 37; // = f(BikeEntity.field_2a28) BikeEntity::CreateNewPacket
@@ -195,16 +216,16 @@ message UdpConfigVOD {
}
message PlayerRouteDistance {
optional int32 bikeId = 1; //BikeManager::FindBikeWithNetworkID
optional float prd_f2 = 2; //or fixed
optional int32 player_id = 1; //BikeManager::FindBikeWithNetworkID
optional float distance_covered = 2; //not sure
optional int32 prd_f3 = 3; //-> m_bikeEntity->field_9C8
}
message EventSubgroupPlacements {
optional int32 esp_f1 = 1; //-> m_bikeEntity->field_9C0; UdpStatistics::registerFanViewLatestPlayerStateInfo
optional int32 position = 1; //-> m_bikeEntity->field_9C0; UdpStatistics::registerFanViewLatestPlayerStateInfo
repeated PlayerRouteDistance player_rd1 = 2;
repeated PlayerRouteDistance player_rd2 = 3;
repeated PlayerRouteDistance player_rd3 = 4;
repeated PlayerRouteDistance eventRiderPosition = 4;
repeated PlayerRouteDistance player_rd4 = 5;
optional int32 eventTotalRiders = 6;
optional int32 bikeNetworkId = 7;
@@ -230,7 +251,7 @@ message ServerToClient {
optional int64 stc_f13 = 13;
optional int32 zwifters = 14;
optional int32 zc_local_port = 15;
optional IPProtocol zc_protocol = 16; //TODO: enum; 2: TCP
optional IPProtocol zc_protocol = 16;
optional int64 stc_f17 = 17; //read in WorldClockService::calculateOneLegLatency
optional int32 num_msgs = 18;
optional int32 msgnum = 19;
File diff suppressed because one or more lines are too long
+3 -4
View File
@@ -1928,20 +1928,19 @@ def api_private_event_new(): #{"culling":true,"description":"mesg","distanceInMe
partial_profile = get_partial_profile(current_user.player_id)
json_pe['organizerProfileId'] = current_user.player_id
json_pe['organizerFirstName'] = partial_profile.first_name
json_pe['organizerProfileId'] = partial_profile.last_name
json_pe['organizerLastName'] = partial_profile.last_name
json_pe['updateDate'] = datetime.datetime.now().strftime("%Y-%m-%dT%H:%M:%SZ")
json_pe['organizerImageUrl'] = "https://us-or-rly101.zwift.com/download/%s/avatarLarge.jpg" % current_user.player_id
#"invitedProfileIds":[id1,id2,...] - todo: send WorldAttribute 'invite'
#"invitedProfileIds":[id1,id2,...] - todo: send WAT_JOIN_E(PlayerJoinedEvent with ev_sg_id) to myself and 'invite' to others
glb_private_events[pe_id] = json_pe
return jsonify({"id":pe_id}), 201
@app.route('/api/private_event/feed', methods=['GET', 'POST'])
#[{"id":2894545,"eventSubgroupId":3459785,"name":"Beach Island Loop","sport":"CYCLING","eventStart":"2022-03-17T16:27:00Z","routeId":2474227587,"durationInSeconds":0,"distanceInMeters":13800.0,"inviteStatus":"ACCEPTED","invitedTotalCount":3,"acceptedTotalCount":1,"acceptedFolloweeCount":0,"organizerImageUrl":"https://static-cdn.zwift.com/prod/profile/b44242c2-2367483","organizerProfileId":4485018,"organizerFirstName":"Youry","organizerLastName":"Pershin","updateDate":"2022-03-16T21:21:41Z","laps":0,"rubberbanding":true}]
def api_private_event_feed():
ret = []
for pe in glb_private_events.values():
ret.append(pe)
print(ret)
#print(ret)
return jsonify(ret)
@app.route('/api/private_event/entitlement', methods=['GET'])