mirror of
https://github.com/wanderer-industries/wanderer
synced 2025-11-18 23:26:22 +00:00
Compare commits
1 Commits
tracking-c
...
all-system
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9196b42fc5 |
@@ -41,6 +41,10 @@ defmodule WandererApp.Api.MapSystem do
|
|||||||
action: :read_by_map_and_solar_system
|
action: :read_by_map_and_solar_system
|
||||||
)
|
)
|
||||||
|
|
||||||
|
define(:search_by_map,
|
||||||
|
action: :search_by_map
|
||||||
|
)
|
||||||
|
|
||||||
define(:update_name, action: :update_name)
|
define(:update_name, action: :update_name)
|
||||||
define(:update_description, action: :update_description)
|
define(:update_description, action: :update_description)
|
||||||
define(:update_locked, action: :update_locked)
|
define(:update_locked, action: :update_locked)
|
||||||
@@ -73,6 +77,20 @@ defmodule WandererApp.Api.MapSystem do
|
|||||||
filter(expr(map_id == ^arg(:map_id) and visible == true))
|
filter(expr(map_id == ^arg(:map_id) and visible == true))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
read :search_by_map do
|
||||||
|
argument(:map_id, :string, allow_nil?: false)
|
||||||
|
argument(:text, :string, allow_nil?: false)
|
||||||
|
|
||||||
|
filter(
|
||||||
|
expr(
|
||||||
|
(map_id == ^arg(:map_id) and
|
||||||
|
contains(string_downcase(name), string_downcase(^arg(:text)))) or
|
||||||
|
contains(string_downcase(custom_name), string_downcase(^arg(:text))) or
|
||||||
|
contains(string_downcase(description), string_downcase(^arg(:text)))
|
||||||
|
)
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
read :read_by_map_and_solar_system do
|
read :read_by_map_and_solar_system do
|
||||||
argument(:map_id, :string, allow_nil?: false)
|
argument(:map_id, :string, allow_nil?: false)
|
||||||
argument(:solar_system_id, :integer, allow_nil?: false)
|
argument(:solar_system_id, :integer, allow_nil?: false)
|
||||||
|
|||||||
@@ -523,7 +523,7 @@ defmodule WandererAppWeb.MapCoreEventHandler do
|
|||||||
%{
|
%{
|
||||||
systems:
|
systems:
|
||||||
systems
|
systems
|
||||||
|> Enum.map(fn system -> MapEventHandler.map_ui_system(system, include_static_data?) end),
|
|> Enum.map(fn system -> MapEventHandler.map_ui_system(system) end),
|
||||||
hubs: hubs,
|
hubs: hubs,
|
||||||
connections: connections |> Enum.map(&MapEventHandler.map_ui_connection/1),
|
connections: connections |> Enum.map(&MapEventHandler.map_ui_connection/1),
|
||||||
options: options
|
options: options
|
||||||
|
|||||||
@@ -267,6 +267,28 @@ defmodule WandererAppWeb.MapSystemsEventHandler do
|
|||||||
{:noreply, socket}
|
{:noreply, socket}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def handle_ui_event(
|
||||||
|
"get_all_systems",
|
||||||
|
_event,
|
||||||
|
%{
|
||||||
|
assigns: %{
|
||||||
|
map_id: map_id
|
||||||
|
}
|
||||||
|
} =
|
||||||
|
socket
|
||||||
|
) do
|
||||||
|
{:ok, systems} = WandererApp.MapSystemRepo.get_all_by_map(map_id)
|
||||||
|
|
||||||
|
systems =
|
||||||
|
systems
|
||||||
|
|> Enum.map(fn system -> MapEventHandler.map_ui_system(system, false) end)
|
||||||
|
|
||||||
|
{:reply,
|
||||||
|
%{
|
||||||
|
systems: systems
|
||||||
|
}, socket}
|
||||||
|
end
|
||||||
|
|
||||||
def handle_ui_event(
|
def handle_ui_event(
|
||||||
"get_system_static_infos",
|
"get_system_static_infos",
|
||||||
%{"solar_system_ids" => solar_system_ids} = _event,
|
%{"solar_system_ids" => solar_system_ids} = _event,
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ defmodule WandererAppWeb.MapEventHandler do
|
|||||||
"add_system",
|
"add_system",
|
||||||
"delete_systems",
|
"delete_systems",
|
||||||
"manual_add_system",
|
"manual_add_system",
|
||||||
|
"get_all_systems",
|
||||||
"get_system_static_infos",
|
"get_system_static_infos",
|
||||||
"update_system_position",
|
"update_system_position",
|
||||||
"update_system_positions",
|
"update_system_positions",
|
||||||
@@ -246,16 +247,23 @@ defmodule WandererAppWeb.MapEventHandler do
|
|||||||
status: status,
|
status: status,
|
||||||
visible: visible
|
visible: visible
|
||||||
} = _system,
|
} = _system,
|
||||||
_include_static_data? \\ true
|
include_signatures? \\ true
|
||||||
) do
|
) do
|
||||||
system_static_info = get_system_static_info(solar_system_id)
|
system_static_info = get_system_static_info(solar_system_id)
|
||||||
|
|
||||||
system_signatures =
|
system_signatures =
|
||||||
system_id
|
include_signatures?
|
||||||
|> WandererAppWeb.MapSignaturesEventHandler.get_system_signatures()
|
|> case do
|
||||||
|> Enum.filter(fn signature ->
|
true ->
|
||||||
is_nil(signature.linked_system) && signature.group == "Wormhole"
|
system_id
|
||||||
end)
|
|> WandererAppWeb.MapSignaturesEventHandler.get_system_signatures()
|
||||||
|
|> Enum.filter(fn signature ->
|
||||||
|
is_nil(signature.linked_system) && signature.group == "Wormhole"
|
||||||
|
end)
|
||||||
|
|
||||||
|
_ ->
|
||||||
|
[]
|
||||||
|
end
|
||||||
|
|
||||||
%{
|
%{
|
||||||
id: "#{solar_system_id}",
|
id: "#{solar_system_id}",
|
||||||
|
|||||||
Reference in New Issue
Block a user