diff --git a/lib/teiserver/battle/schemas/match.ex b/lib/teiserver/battle/schemas/match.ex index f32d64d68..290b65012 100644 --- a/lib/teiserver/battle/schemas/match.ex +++ b/lib/teiserver/battle/schemas/match.ex @@ -4,6 +4,7 @@ defmodule Teiserver.Battle.Match do schema "teiserver_battle_matches" do field :server_uuid, :string field :uuid, :string + field :game_id, :string field :map, :string # The end of match data to be provided by clients field :data, :map, default: %{} @@ -45,7 +46,7 @@ defmodule Teiserver.Battle.Match do struct |> cast( params, - ~w(server_uuid uuid map data tags team_count team_size passworded game_type founder_id bots started winning_team finished processed queue_id rating_type_id lobby_policy_id game_duration)a + ~w(server_uuid uuid game_id map data tags team_count team_size passworded game_type founder_id bots started winning_team finished processed queue_id rating_type_id lobby_policy_id game_duration)a ) |> validate_required( ~w(server_uuid uuid map tags team_count team_size passworded game_type founder_id bots started)a @@ -57,7 +58,7 @@ defmodule Teiserver.Battle.Match do struct |> cast( params, - ~w(server_uuid uuid map data tags team_count team_size passworded game_type founder_id bots started winning_team finished processed queue_id game_duration)a + ~w(server_uuid uuid game_id map data tags team_count team_size passworded game_type founder_id bots started winning_team finished processed queue_id game_duration)a ) |> validate_required(~w(founder_id)a) end diff --git a/lib/teiserver/battle/tasks/post_match_process_task.ex b/lib/teiserver/battle/tasks/post_match_process_task.ex index 3a2a72785..9c27f2656 100644 --- a/lib/teiserver/battle/tasks/post_match_process_task.ex +++ b/lib/teiserver/battle/tasks/post_match_process_task.ex @@ -151,7 +151,11 @@ defmodule Teiserver.Battle.Tasks.PostMatchProcessTask do |> hd_or_x({nil, nil}) |> elem(0) - Battle.update_match(match, %{winning_team: winning_team, game_duration: host_game_duration}) + Battle.update_match(match, %{ + winning_team: winning_team, + game_duration: host_game_duration, + game_id: export_data["gameId"] + }) memberships |> Enum.map(fn m -> diff --git a/lib/teiserver/coordinator/spads_parser.ex b/lib/teiserver/coordinator/spads_parser.ex index ba61b9206..72385ad5c 100644 --- a/lib/teiserver/coordinator/spads_parser.ex +++ b/lib/teiserver/coordinator/spads_parser.ex @@ -43,6 +43,13 @@ defmodule Teiserver.Coordinator.SpadsParser do _match = Regex.run(~r/Boss mode disabled by \S+/, msg) -> {:host_update, %{host_bosses: []}} + # Remove an individual boss + match = Regex.run(~r/Boss mode disabled for (\S+) \(by \S+\)/, msg) -> + [_, player_name] = match + player_id = CacheUser.get_userid(player_name) + + {:host_update, %{host_bosses: List.delete(state.host_bosses, player_id)}} + # Not handling it, return nil true -> nil diff --git a/lib/teiserver/helpers/styling_helpers.ex b/lib/teiserver/helpers/styling_helpers.ex index 90684ef41..6fe5cc928 100644 --- a/lib/teiserver/helpers/styling_helpers.ex +++ b/lib/teiserver/helpers/styling_helpers.ex @@ -92,6 +92,8 @@ defmodule Teiserver.Helper.StylingHelper do def icon(:quarter, _fa_type), do: "" def icon(:year, _fa_type), do: "" + def icon(:replay, _fa_type), do: "fa-solid fa-arrow-rotate-left" + # defp split_colour(c) do # {r, _} = c |> String.slice(1, 2) |> Integer.parse(16) # {g, _} = c |> String.slice(3, 2) |> Integer.parse(16) diff --git a/lib/teiserver_web/live/battles/match/match_components.ex b/lib/teiserver_web/live/battles/match/match_components.ex index 45910b47e..9ed0a8d6b 100644 --- a/lib/teiserver_web/live/battles/match/match_components.ex +++ b/lib/teiserver_web/live/battles/match/match_components.ex @@ -10,6 +10,7 @@ defmodule TeiserverWeb.Battle.MatchComponents do attr :active, :string, required: true attr :current_user, :map, required: true attr :match_id, :integer, default: nil + attr :replay, :string, default: nil def section_menu(assigns) do ~H""" @@ -63,13 +64,13 @@ defmodule TeiserverWeb.Battle.MatchComponents do