kimi gone wild
This commit is contained in:
@@ -127,6 +127,52 @@ defmodule Odinsea.Game.MapFactory do
|
||||
]
|
||||
end
|
||||
|
||||
defmodule SpawnPoint do
|
||||
@moduledoc "Represents a monster spawn point on a map"
|
||||
|
||||
@type t :: %__MODULE__{
|
||||
mob_id: integer(),
|
||||
x: integer(),
|
||||
y: integer(),
|
||||
fh: integer(),
|
||||
cy: integer(),
|
||||
f: integer(),
|
||||
mob_time: integer()
|
||||
}
|
||||
|
||||
defstruct [
|
||||
:mob_id,
|
||||
:x,
|
||||
:y,
|
||||
:fh,
|
||||
:cy,
|
||||
:f,
|
||||
:mob_time
|
||||
]
|
||||
end
|
||||
|
||||
defmodule ReactorSpawn do
|
||||
@moduledoc "Represents a reactor spawn point on a map"
|
||||
|
||||
@type t :: %__MODULE__{
|
||||
reactor_id: integer(),
|
||||
x: integer(),
|
||||
y: integer(),
|
||||
facing_direction: integer(),
|
||||
name: String.t(),
|
||||
delay: integer()
|
||||
}
|
||||
|
||||
defstruct [
|
||||
:reactor_id,
|
||||
:x,
|
||||
:y,
|
||||
facing_direction: 0,
|
||||
name: "",
|
||||
delay: 0
|
||||
]
|
||||
end
|
||||
|
||||
defmodule FieldTemplate do
|
||||
@moduledoc "Map field template containing all map data"
|
||||
|
||||
@@ -143,7 +189,8 @@ defmodule Odinsea.Game.MapFactory do
|
||||
dec_hp_interval: integer(),
|
||||
portal_map: %{String.t() => Portal.t()},
|
||||
portals: [Portal.t()],
|
||||
spawn_points: [Portal.t()],
|
||||
spawn_points: [SpawnPoint.t()],
|
||||
reactor_spawns: [ReactorSpawn.t()],
|
||||
footholds: [Foothold.t()],
|
||||
top: integer(),
|
||||
bottom: integer(),
|
||||
@@ -175,6 +222,7 @@ defmodule Odinsea.Game.MapFactory do
|
||||
:portal_map,
|
||||
:portals,
|
||||
:spawn_points,
|
||||
:reactor_spawns,
|
||||
:footholds,
|
||||
:top,
|
||||
:bottom,
|
||||
@@ -341,10 +389,15 @@ defmodule Odinsea.Game.MapFactory do
|
||||
|> Enum.map(fn portal -> {portal.name, portal} end)
|
||||
|> Enum.into(%{})
|
||||
|
||||
# Parse spawn points
|
||||
spawn_points =
|
||||
Enum.filter(portals, fn portal ->
|
||||
portal.type == :spawn || portal.name == "sp"
|
||||
end)
|
||||
(map_data[:spawns] || [])
|
||||
|> Enum.map(&build_spawn_point/1)
|
||||
|
||||
# Parse reactor spawns
|
||||
reactor_spawns =
|
||||
(map_data[:reactors] || [])
|
||||
|> Enum.map(&build_reactor_spawn/1)
|
||||
|
||||
# Parse footholds
|
||||
footholds =
|
||||
@@ -365,6 +418,7 @@ defmodule Odinsea.Game.MapFactory do
|
||||
portal_map: portal_map,
|
||||
portals: portals,
|
||||
spawn_points: spawn_points,
|
||||
reactor_spawns: reactor_spawns,
|
||||
footholds: footholds,
|
||||
top: map_data[:top] || 0,
|
||||
bottom: map_data[:bottom] || 0,
|
||||
@@ -415,6 +469,29 @@ defmodule Odinsea.Game.MapFactory do
|
||||
}
|
||||
end
|
||||
|
||||
defp build_spawn_point(spawn_data) do
|
||||
%SpawnPoint{
|
||||
mob_id: spawn_data[:mob_id] || 0,
|
||||
x: spawn_data[:x] || 0,
|
||||
y: spawn_data[:y] || 0,
|
||||
fh: spawn_data[:fh] || 0,
|
||||
cy: spawn_data[:cy] || 0,
|
||||
f: spawn_data[:f] || 0,
|
||||
mob_time: spawn_data[:mob_time] || 10_000
|
||||
}
|
||||
end
|
||||
|
||||
defp build_reactor_spawn(reactor_data) do
|
||||
%ReactorSpawn{
|
||||
reactor_id: reactor_data[:reactor_id] || reactor_data[:id] || 0,
|
||||
x: reactor_data[:x] || 0,
|
||||
y: reactor_data[:y] || 0,
|
||||
facing_direction: reactor_data[:f] || reactor_data[:facing_direction] || 0,
|
||||
name: reactor_data[:name] || "",
|
||||
delay: reactor_data[:reactor_time] || reactor_data[:delay] || 0
|
||||
}
|
||||
end
|
||||
|
||||
# Fallback data for basic testing
|
||||
defp create_fallback_maps do
|
||||
# Common beginner maps
|
||||
@@ -441,7 +518,7 @@ defmodule Odinsea.Game.MapFactory do
|
||||
%{id: 0, name: "sp", type: "sp", x: -1283, y: 86, target_map: 100000000, target_portal: ""}
|
||||
]
|
||||
},
|
||||
# Henesys Hunting Ground I
|
||||
# Henesys Hunting Ground I - with monsters!
|
||||
%{
|
||||
map_id: 100010000,
|
||||
map_name: "Henesys Hunting Ground I",
|
||||
@@ -450,6 +527,15 @@ defmodule Odinsea.Game.MapFactory do
|
||||
forced_return: 100000000,
|
||||
portals: [
|
||||
%{id: 0, name: "sp", type: "sp", x: 0, y: 0, target_map: 100010000, target_portal: ""}
|
||||
],
|
||||
spawns: [
|
||||
# Blue Snails (mob_id: 100001)
|
||||
%{mob_id: 100001, x: -500, y: 100, fh: 0, cy: 0, f: 0, mob_time: 8000},
|
||||
%{mob_id: 100001, x: -200, y: 100, fh: 0, cy: 0, f: 1, mob_time: 8000},
|
||||
%{mob_id: 100001, x: 200, y: 100, fh: 0, cy: 0, f: 0, mob_time: 8000},
|
||||
# Orange Mushrooms (mob_id: 1210102)
|
||||
%{mob_id: 1210102, x: 500, y: 100, fh: 0, cy: 0, f: 1, mob_time: 10000},
|
||||
%{mob_id: 1210102, x: 800, y: 100, fh: 0, cy: 0, f: 0, mob_time: 10000}
|
||||
]
|
||||
},
|
||||
# Hidden Street - FM Entrance
|
||||
|
||||
Reference in New Issue
Block a user