@@ -3697,16 +3697,22 @@ def api_player_profile_user_game_storage_attributes():
36973697 if request .method == 'POST' :
36983698 new = user_storage_pb2 .UserStorage ()
36993699 new .ParseFromString (request .stream .read ())
3700- user_storage .MergeFrom (new )
3700+ for n in new .attributes :
3701+ for f in n .DESCRIPTOR .fields_by_name :
3702+ if n .HasField (f ):
3703+ for a in list (user_storage .attributes ):
3704+ if a .HasField (f ) and (not 'signature' in getattr (a , f ).DESCRIPTOR .fields_by_name \
3705+ or getattr (a , f ).signature == getattr (n , f ).signature ):
3706+ user_storage .attributes .remove (a )
3707+ user_storage .attributes .add ().CopyFrom (n )
37013708 with open (user_storage_file , 'wb' ) as f :
37023709 f .write (user_storage .SerializeToString ())
37033710 return '' , 202
37043711 ret = user_storage_pb2 .UserStorage ()
3705- n = int (request .args .get ('n' ))
3706- if n in user_storage .attributes .DESCRIPTOR .fields_by_number :
3707- field = user_storage .attributes .DESCRIPTOR .fields_by_number [n ].name
3708- if user_storage .attributes .HasField (field ):
3709- getattr (ret .attributes , field ).CopyFrom (getattr (user_storage .attributes , field ))
3712+ for n in request .args .getlist ('n' ):
3713+ for a in user_storage .attributes :
3714+ if int (n ) in a .DESCRIPTOR .fields_by_number and a .HasField (a .DESCRIPTOR .fields_by_number [int (n )].name ):
3715+ ret .attributes .add ().CopyFrom (a )
37103716 return ret .SerializeToString (), 200
37113717
37123718
0 commit comments