From d401aa16ecbbc1357908e24aa86e7354016401f4 Mon Sep 17 00:00:00 2001 From: Nicolas Sanchez Date: Tue, 14 May 2024 19:15:44 -0300 Subject: [PATCH] Change lag spikes config in messages.proto --- .../lib/arena/serialization/messages.pb.ex | 16 +----- .../serialization/messages.pb.ex | 16 +----- apps/bot_manager/lib/protobuf/messages.pb.ex | 16 +----- .../assets/js/protobuf/messages_pb.js | 57 ++++++++++++------- .../lib/game_client/protobuf/messages.pb.ex | 16 +----- apps/serialization/messages.proto | 2 +- 6 files changed, 42 insertions(+), 81 deletions(-) diff --git a/apps/arena/lib/arena/serialization/messages.pb.ex b/apps/arena/lib/arena/serialization/messages.pb.ex index 31ce9f592..e9432d97a 100644 --- a/apps/arena/lib/arena/serialization/messages.pb.ex +++ b/apps/arena/lib/arena/serialization/messages.pb.ex @@ -206,26 +206,12 @@ defmodule Arena.Serialization.ConfigCharacter do ) end -defmodule Arena.Serialization.ClientConfig.LagSpikesEntry do - @moduledoc false - - use Protobuf, map: true, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" - - field(:key, 1, type: :string) - field(:value, 2, type: Arena.Serialization.ConfigLagSpikes) -end - defmodule Arena.Serialization.ClientConfig do @moduledoc false use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" - field(:lag_spikes, 1, - repeated: true, - type: Arena.Serialization.ClientConfig.LagSpikesEntry, - json_name: "lagSpikes", - map: true - ) + field(:lag_spikes, 1, type: Arena.Serialization.ConfigLagSpikes, json_name: "lagSpikes") end defmodule Arena.Serialization.ConfigLagSpikes do diff --git a/apps/arena_load_test/lib/arena_load_test/serialization/messages.pb.ex b/apps/arena_load_test/lib/arena_load_test/serialization/messages.pb.ex index 3f9101c46..6ea02f62b 100644 --- a/apps/arena_load_test/lib/arena_load_test/serialization/messages.pb.ex +++ b/apps/arena_load_test/lib/arena_load_test/serialization/messages.pb.ex @@ -210,26 +210,12 @@ defmodule ArenaLoadTest.Serialization.ConfigCharacter do ) end -defmodule ArenaLoadTest.Serialization.ClientConfig.LagSpikesEntry do - @moduledoc false - - use Protobuf, map: true, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" - - field(:key, 1, type: :string) - field(:value, 2, type: ArenaLoadTest.Serialization.ConfigLagSpikes) -end - defmodule ArenaLoadTest.Serialization.ClientConfig do @moduledoc false use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" - field(:lag_spikes, 1, - repeated: true, - type: ArenaLoadTest.Serialization.ClientConfig.LagSpikesEntry, - json_name: "lagSpikes", - map: true - ) + field(:lag_spikes, 1, type: ArenaLoadTest.Serialization.ConfigLagSpikes, json_name: "lagSpikes") end defmodule ArenaLoadTest.Serialization.ConfigLagSpikes do diff --git a/apps/bot_manager/lib/protobuf/messages.pb.ex b/apps/bot_manager/lib/protobuf/messages.pb.ex index 0d419dd5d..39949377a 100644 --- a/apps/bot_manager/lib/protobuf/messages.pb.ex +++ b/apps/bot_manager/lib/protobuf/messages.pb.ex @@ -206,26 +206,12 @@ defmodule BotManager.Protobuf.ConfigCharacter do ) end -defmodule BotManager.Protobuf.ClientConfig.LagSpikesEntry do - @moduledoc false - - use Protobuf, map: true, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" - - field(:key, 1, type: :string) - field(:value, 2, type: BotManager.Protobuf.ConfigLagSpikes) -end - defmodule BotManager.Protobuf.ClientConfig do @moduledoc false use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" - field(:lag_spikes, 1, - repeated: true, - type: BotManager.Protobuf.ClientConfig.LagSpikesEntry, - json_name: "lagSpikes", - map: true - ) + field(:lag_spikes, 1, type: BotManager.Protobuf.ConfigLagSpikes, json_name: "lagSpikes") end defmodule BotManager.Protobuf.ConfigLagSpikes do diff --git a/apps/game_client/assets/js/protobuf/messages_pb.js b/apps/game_client/assets/js/protobuf/messages_pb.js index 3a7c87edc..ef9b7d17e 100644 --- a/apps/game_client/assets/js/protobuf/messages_pb.js +++ b/apps/game_client/assets/js/protobuf/messages_pb.js @@ -3524,7 +3524,7 @@ proto.ClientConfig.prototype.toObject = function(opt_includeInstance) { */ proto.ClientConfig.toObject = function(includeInstance, msg) { var f, obj = { - lagSpikesMap: (f = msg.getLagSpikesMap()) ? f.toObject(includeInstance, proto.ConfigLagSpikes.toObject) : [] + lagSpikes: (f = msg.getLagSpikes()) && proto.ConfigLagSpikes.toObject(includeInstance, f) }; if (includeInstance) { @@ -3562,10 +3562,9 @@ proto.ClientConfig.deserializeBinaryFromReader = function(msg, reader) { var field = reader.getFieldNumber(); switch (field) { case 1: - var value = msg.getLagSpikesMap(); - reader.readMessage(value, function(message, reader) { - jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readMessage, proto.ConfigLagSpikes.deserializeBinaryFromReader, "", new proto.ConfigLagSpikes()); - }); + var value = new proto.ConfigLagSpikes; + reader.readMessage(value,proto.ConfigLagSpikes.deserializeBinaryFromReader); + msg.setLagSpikes(value); break; default: reader.skipField(); @@ -3596,33 +3595,51 @@ proto.ClientConfig.prototype.serializeBinary = function() { */ proto.ClientConfig.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getLagSpikesMap(true); - if (f && f.getLength() > 0) { - f.serializeBinary(1, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeMessage, proto.ConfigLagSpikes.serializeBinaryToWriter); + f = message.getLagSpikes(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.ConfigLagSpikes.serializeBinaryToWriter + ); } }; /** - * map lag_spikes = 1; - * @param {boolean=} opt_noLazyCreate Do not create the map if - * empty, instead returning `undefined` - * @return {!jspb.Map} + * optional ConfigLagSpikes lag_spikes = 1; + * @return {?proto.ConfigLagSpikes} */ -proto.ClientConfig.prototype.getLagSpikesMap = function(opt_noLazyCreate) { - return /** @type {!jspb.Map} */ ( - jspb.Message.getMapField(this, 1, opt_noLazyCreate, - proto.ConfigLagSpikes)); +proto.ClientConfig.prototype.getLagSpikes = function() { + return /** @type{?proto.ConfigLagSpikes} */ ( + jspb.Message.getWrapperField(this, proto.ConfigLagSpikes, 1)); }; /** - * Clears values from the map. The map will be non-null. + * @param {?proto.ConfigLagSpikes|undefined} value + * @return {!proto.ClientConfig} returns this +*/ +proto.ClientConfig.prototype.setLagSpikes = function(value) { + return jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. * @return {!proto.ClientConfig} returns this */ -proto.ClientConfig.prototype.clearLagSpikesMap = function() { - this.getLagSpikesMap().clear(); - return this; +proto.ClientConfig.prototype.clearLagSpikes = function() { + return this.setLagSpikes(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.ClientConfig.prototype.hasLagSpikes = function() { + return jspb.Message.getField(this, 1) != null; }; diff --git a/apps/game_client/lib/game_client/protobuf/messages.pb.ex b/apps/game_client/lib/game_client/protobuf/messages.pb.ex index f523a3c37..d20be13c9 100644 --- a/apps/game_client/lib/game_client/protobuf/messages.pb.ex +++ b/apps/game_client/lib/game_client/protobuf/messages.pb.ex @@ -206,26 +206,12 @@ defmodule GameClient.Protobuf.ConfigCharacter do ) end -defmodule GameClient.Protobuf.ClientConfig.LagSpikesEntry do - @moduledoc false - - use Protobuf, map: true, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" - - field(:key, 1, type: :string) - field(:value, 2, type: GameClient.Protobuf.ConfigLagSpikes) -end - defmodule GameClient.Protobuf.ClientConfig do @moduledoc false use Protobuf, syntax: :proto3, protoc_gen_elixir_version: "0.12.0" - field(:lag_spikes, 1, - repeated: true, - type: GameClient.Protobuf.ClientConfig.LagSpikesEntry, - json_name: "lagSpikes", - map: true - ) + field(:lag_spikes, 1, type: GameClient.Protobuf.ConfigLagSpikes, json_name: "lagSpikes") end defmodule GameClient.Protobuf.ConfigLagSpikes do diff --git a/apps/serialization/messages.proto b/apps/serialization/messages.proto index 7bc1d7e2c..21f2bc141 100644 --- a/apps/serialization/messages.proto +++ b/apps/serialization/messages.proto @@ -82,7 +82,7 @@ message ConfigCharacter { } message ClientConfig { - map lag_spikes = 1; + ConfigLagSpikes lag_spikes = 1; } message ConfigLagSpikes {