docs(reference): import Dune: Awakening server-manager references
All checks were successful
CI / backend-types (push) Successful in 10s
CI / frontend-build (push) Successful in 15s
CI / agent-tests (push) Successful in 39s
CI / integration (push) Successful in 22s

Phase 2 references for the host-agent Dune adapter, moved out of volatile /tmp
into docs/reference-repos/ (per Commander). Three upstream projects, .git +
node_modules + compiled binaries stripped (16MB source). Nested AI-instruction
files (.claude/, CLAUDE.md) removed so they don't pollute Corrosion sessions.

- icehunter/    dune-admin (Go+React) — 4 control planes; SETUP_DOCKER.md is the
                closest analog to our agent's Dune docker control plane (compose
                lifecycle, docker logs, RabbitMQ-via-exec, dune Postgres schema)
- adainrivers/  Rust/Tauri desktop — SSH+k8s BattleGroup control, maintenance
                daemon, in-game admin console (Rust idiom reference)
- the4rchangel/ Node web UI replacing battlegroup.bat — matches the Commander's
                Hyper-V self-host path + game-config schema

See docs/reference-repos/README.md for the full index + how we use each.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Vantz Stockwell
2026-06-11 21:08:05 -04:00
parent 0715492ddf
commit 651a35d4be
1334 changed files with 238971 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
-- corilis_cleanup_map(in_server_info dune.serverinfo, in_map_info dune.coriolismapinfo) -> void
-- oid: 58177 kind: FUNCTION category: misc
CREATE OR REPLACE FUNCTION dune.corilis_cleanup_map(in_server_info dune.serverinfo, in_map_info dune.coriolismapinfo)
RETURNS void
LANGUAGE plpgsql
AS $function$
BEGIN
PERFORM delete_markers_for_all_players(in_map_info.marker_types_to_keep, in_server_info.map);
IF in_map_info.should_clear_surveyed_areas
THEN
DELETE FROM map_areas WHERE map_name = in_server_info.map;
END IF;
IF in_map_info.is_outside_shieldwall
THEN
DELETE FROM resourcefield_state WHERE map = in_server_info.map;
END IF;
END
$function$

View File

@@ -0,0 +1,51 @@
-- downgrade_map_name(in_map_name text) -> text
-- oid: 58239 kind: FUNCTION category: misc
CREATE OR REPLACE FUNCTION dune.downgrade_map_name(in_map_name text)
RETURNS text
LANGUAGE plpgsql
AS $function$
BEGIN
return
CASE in_map_name
WHEN 'HaggaBasin' THEN 'Survival_1'
WHEN 'HarkoVillage' THEN 'SH_HarkoVillage'
WHEN 'DeepDesert' THEN 'DeepDesert_1'
WHEN 'Overland' THEN 'Overmap'
WHEN 'Arrakeen' THEN 'SH_Arrakeen'
WHEN 'WreckOfHephaestus' THEN 'CB_Story_Hephaestus'
WHEN 'BeneathCarthag' THEN 'CB_Story_Ecolab_Carthag'
WHEN 'Station15' THEN 'CB_SurvivalChallenge_Station_15'
WHEN 'WaterFat' THEN 'CB_Story_WaterFatManor'
WHEN 'FallenLight' THEN 'SH_FallenLight'
WHEN 'ProcesVerbal' THEN 'Story_ProcesVerbal'
WHEN 'LostHarvest' THEN 'DLC_Story_LostHarvest'
WHEN 'LostHarvest_EcolabA' THEN 'DLC_Story_LostHarvest_EcolabA'
WHEN 'LostHarvest_EcolabB' THEN 'DLC_Story_LostHarvest_EcolabB'
WHEN 'LostHarvest_ForgottenLab' THEN 'DLC_Story_LostHarvest_ForgottenLab'
WHEN 'ArtOfKanly' THEN 'Story_ArtOfKanly'
WHEN 'HeighlinerDungeon' THEN 'Story_HeighlinerDungeon'
WHEN 'WreckOfHephaestusDungeon' THEN 'CB_Dungeon_Hephaestus'
WHEN 'OldCarthagDungeon' THEN 'CB_Dungeon_OldCarthag'
WHEN 'SandfliesFortress' THEN 'CB_Story_BanditFortress01'
WHEN 'ClosedOffTestingStationIsland' THEN 'CB_Overland_S_05'
WHEN 'GroundVehicleTimeTrialIsland' THEN 'CB_Overland_S_06'
WHEN 'ErythriteCaveIsland' THEN 'CB_Overland_S_04'
WHEN 'RadioactiveShipwreck' THEN 'CB_Overland_M_01'
WHEN 'TheRuinsOfTsimpo' THEN 'CB_Overland_S_07'
WHEN 'Story_Faction_Outpost_Hark' THEN 'Story_Faction_Outpost_Hark'
WHEN 'Story_Faction_Outpost_Atre' THEN 'Story_Faction_Outpost_Atre'
WHEN 'RadiationDungeon' THEN 'CB_Ecolab_Bronze_Green_089'
WHEN 'ElectricityDungeon' THEN 'CB_Ecolab_Bronze_Green_152'
WHEN 'PoisonDungeon' THEN 'CB_Ecolab_Bronze_Green_195'
WHEN 'DarknessDungeon' THEN 'CB_Ecolab_Bronze_Green_024'
WHEN 'FireDungeon' THEN 'CB_Ecolab_Bronze_Green_136'
WHEN 'DestroyedZanovar' THEN 'CB_Story_DestroyedZanovar'
WHEN 'OrbitalMonitor' THEN 'CB_Story_OrbitalMonitor'
WHEN 'FacilityDungeon' THEN 'CB_Dungeon_TheFacility'
WHEN 'PitDungeon' THEN 'CB_Dungeon_ThePit'
WHEN 'WindPass' THEN 'CB_Overland_S_08'
ELSE in_map_name
END;
END;
$function$

View File

@@ -0,0 +1,153 @@
-- fix_broken_harkonnen_players_due_to_fooled_thufir() -> void
-- oid: 58264 kind: FUNCTION category: misc
CREATE OR REPLACE FUNCTION dune.fix_broken_harkonnen_players_due_to_fooled_thufir()
RETURNS void
LANGUAGE plpgsql
AS $function$
BEGIN
-- Dropping tables due to them being created in temp_backup_tables.sql
drop table if exists da_6358_pre_broken_players;
drop table if exists da_6358_broken_players_12400;
drop table if exists da_6358_broken_players_1300;
---Fix players that are in a broken state but haven't been blocked yet
--Tag combo to check for:
--DialogueFlags.Factions.Hark_ThufirBetrayedComplete
--DialogueFlags.Faction.FooledThufir
--PlayerIsFactionTier Harkonnen 5
--TO FIX:
--Remove DialogueFlags.Faction.FooledThufir
create table if not exists da_6358_pre_broken_players as
select pt.account_id from player_tags pt
group by pt.account_id
HAVING array_agg(DISTINCT tag) @> ARRAY['DialogueFlags.Factions.Hark_ThufirBetrayedComplete', 'DialogueFlags.Faction.FooledThufir', 'Faction.Harkonnen.Tier5'];
delete from player_tags pt using da_6358_pre_broken_players where pt.account_id = da_6358_pre_broken_players.account_id and pt.tag = 'DialogueFlags.Faction.FooledThufir';
---Fix players that are in a broken state since 1.2.40
---Tag combo to check for:
---DialogueFlags.Factions.Hark_ThufirBetrayedComplete
---DialogueFlags.Faction.FooledThufir
---Contract.Tracking.FactionStory.R4C6Completed
---PlayerIsFactionTier Harkonnen 4
---TO FIX:
---Remove DialogueFlags.Faction.FooledThufir
---Promote player to Harkonnen 5
create table if not exists da_6358_broken_players_12400 as
with broken_accounts as (
select pt.account_id
from player_tags pt
group by pt.account_id
having array_agg(distinct pt.tag) @> array[
'DialogueFlags.Factions.Hark_ThufirBetrayedComplete',
'DialogueFlags.Faction.FooledThufir',
'Contract.Tracking.FactionStory.R4C6Completed',
'Faction.Harkonnen.Tier4'
]
and not array_agg(distinct pt.tag) && array['Faction.Harkonnen.Tier5']
),
one_state_row_per_account as (
-- If player_state can theoretically have duplicates per account_id,
-- pick one deterministically.
select distinct on (ps.account_id)
ps.account_id,
ps.player_controller_id
from player_state ps
join broken_accounts ba on ba.account_id = ps.account_id
order by ps.account_id, ps.player_controller_id desc
)
select
s.account_id,
s.player_controller_id,
a.properties as backup_properties
from one_state_row_per_account s
join actors a on a.id = s.player_controller_id;
INSERT INTO player_tags (account_id, tag)
SELECT account_id, 'Faction.Harkonnen.Tier5' as tag
FROM da_6358_broken_players_12400
ON CONFLICT (account_id, tag) DO NOTHING;
delete from player_tags pt using da_6358_broken_players_12400 where pt.account_id = da_6358_broken_players_12400.account_id and pt.tag = 'DialogueFlags.Faction.FooledThufir';
UPDATE actors
SET properties = jsonb_set(
properties,
'{FactionPlayerComponent,m_FactionDataArray}',
(
SELECT coalesce(
jsonb_agg(
CASE
WHEN elem->'Faction'->>'Name' = 'Harkonnen'
THEN jsonb_set(elem, '{ReputationAmount}', '2000'::jsonb)
ELSE elem
END
),
'[]'::jsonb
)
FROM jsonb_array_elements(properties->'FactionPlayerComponent'->'m_FactionDataArray') AS t(elem)
)
)
FROM da_6358_broken_players_12400 b12400
WHERE b12400.player_controller_id = actors.id;
---Fix players that are in a broken state in live aka 1.3.0
---Tag combo to check for:
---DialogueFlags.Factions.Hark_ThufirBetrayedComplete
---Contract.Tracking.FactionStory.R4C6Completed
---PlayerIsFactionTier Harkonnen 4
---NOT DialogueFlags.Faction.FooledThufir
create table if not exists da_6358_broken_players_1300 as
with broken_accounts as (
select pt.account_id
from player_tags pt
group by pt.account_id
HAVING array_agg(DISTINCT tag) @> ARRAY ['DialogueFlags.Factions.Hark_ThufirBetrayedComplete', 'Contract.Tracking.FactionStory.R4C6Completed', 'Faction.Harkonnen.Tier4']
and not array_agg(distinct tag) && array['DialogueFlags.Faction.FooledThufir', 'Faction.Harkonnen.Tier5'] -- Since Tier4 players can also have Tier5 we need to exclude that
),
one_state_row_per_account as (
-- If player_state can theoretically have duplicates per account_id,
-- pick one deterministically.
select distinct on (ps.account_id)
ps.account_id,
ps.player_controller_id
from player_state ps
join broken_accounts ba on ba.account_id = ps.account_id
order by ps.account_id, ps.player_controller_id desc
)
select
s.account_id,
s.player_controller_id,
a.properties as backup_properties
from one_state_row_per_account s
join actors a on a.id = s.player_controller_id;
INSERT INTO player_tags (account_id, tag)
SELECT account_id, 'Faction.Harkonnen.Tier5' as tag
FROM da_6358_broken_players_1300
ON CONFLICT (account_id, tag) DO NOTHING;
UPDATE actors
SET properties = jsonb_set(
properties,
'{FactionPlayerComponent,m_FactionDataArray}',
(
SELECT coalesce(
jsonb_agg(
CASE
WHEN elem->'Faction'->>'Name' = 'Harkonnen'
THEN jsonb_set(elem, '{ReputationAmount}', '2000'::jsonb)
ELSE elem
END
),
'[]'::jsonb
)
FROM jsonb_array_elements(properties->'FactionPlayerComponent'->'m_FactionDataArray') AS t(elem)
)
)
FROM da_6358_broken_players_1300 b1300
WHERE b1300.player_controller_id = actors.id;
END;
$function$

View File

@@ -0,0 +1,21 @@
-- get_consumed_lore_pickups(in_actor_id bigint, in_use_temporary boolean) -> SETOF bit
-- oid: 58294 kind: FUNCTION category: misc
CREATE OR REPLACE FUNCTION dune.get_consumed_lore_pickups(in_actor_id bigint, in_use_temporary boolean)
RETURNS SETOF bit
LANGUAGE plpgsql
AS $function$
BEGIN
IF in_use_temporary THEN
RETURN query
SELECT consumed_bit_array
FROM consumed_temporary_per_player_lore
WHERE actor_id = in_actor_id;
ELSE
RETURN query
SELECT consumed_bit_array
FROM consumed_per_player_lore
WHERE actor_id = in_actor_id;
END IF;
END
$function$

View File

@@ -0,0 +1,18 @@
-- get_controller_id_from_platform_id(in_platform_id text) -> bigint
-- oid: 58295 kind: FUNCTION category: misc
CREATE OR REPLACE FUNCTION dune.get_controller_id_from_platform_id(in_platform_id text)
RETURNS bigint
LANGUAGE plpgsql
AS $function$
DECLARE
out_controller_id BIGINT;
BEGIN
SELECT ps.player_controller_id
INTO out_controller_id
FROM accounts acc LEFT JOIN player_state ps ON acc.id=ps.account_id
WHERE acc.platform_id = in_platform_id
LIMIT 1;
RETURN out_controller_id;
END
$function$

View File

@@ -0,0 +1,16 @@
-- get_friends_search(in_player_name text, in_max_players_count integer) -> TABLE(player_id bigint, character_name text, funcom_id text, platform_id text, platform_name text)
-- oid: 58306 kind: FUNCTION category: misc
CREATE OR REPLACE FUNCTION dune.get_friends_search(in_player_name text, in_max_players_count integer)
RETURNS TABLE(player_id bigint, character_name text, funcom_id text, platform_id text, platform_name text)
LANGUAGE plpgsql
AS $function$
BEGIN
RETURN QUERY SELECT player_state.player_controller_id, player_state.character_name, accounts.funcom_id, accounts.platform_id, accounts.platform_name
FROM player_state
JOIN accounts ON player_state.account_id = accounts.id
WHERE player_state.character_name ILIKE '%' || in_player_name || '%'
ORDER BY ext.SIMILARITY(player_state.character_name, in_player_name) DESC
LIMIT in_max_players_count;
END
$function$

View File

@@ -0,0 +1,16 @@
-- get_sub_inventory_id(in_owner_item_id bigint) -> bigint
-- oid: 58356 kind: FUNCTION category: misc
CREATE OR REPLACE FUNCTION dune.get_sub_inventory_id(in_owner_item_id bigint)
RETURNS bigint
LANGUAGE plpgsql
AS $function$
DECLARE
inv_id BIGINT;
BEGIN
SELECT INTO inv_id id FROM inventories WHERE item_id = in_owner_item_id;
IF inv_id IS NULL THEN
INSERT INTO inventories("id", "item_id") VALUES(DEFAULT, in_owner_item_id) RETURNING id INTO inv_id;
END IF;
RETURN inv_id;
END $function$

View File

@@ -0,0 +1,10 @@
-- load_dimension_index(in_map text, in_partition_id bigint) -> integer
-- oid: 58452 kind: FUNCTION category: misc
CREATE OR REPLACE FUNCTION dune.load_dimension_index(in_map text, in_partition_id bigint)
RETURNS integer
LANGUAGE plpgsql
AS $function$
BEGIN
RETURN (SELECT dimension_index from world_partition where map = in_map and partition_id = in_partition_id limit 1);
END; $function$

View File

@@ -0,0 +1,14 @@
-- load_events_log_data_from_player(in_actor_id bigint, in_limit_entries_num integer) -> TABLE(game_event_owner bigint, universe_time timestamp without time zone, map_name text, partition_id bigint, event_type integer, x_location double precision, y_location double precision, z_location double precision, custom_data jsonb)
-- oid: 58453 kind: FUNCTION category: misc
CREATE OR REPLACE FUNCTION dune.load_events_log_data_from_player(in_actor_id bigint, in_limit_entries_num integer)
RETURNS TABLE(game_event_owner bigint, universe_time timestamp without time zone, map_name text, partition_id bigint, event_type integer, x_location double precision, y_location double precision, z_location double precision, custom_data jsonb)
LANGUAGE plpgsql
AS $function$
BEGIN
RETURN QUERY
SELECT temp.actor_id, (temp.universe_time AT TIME ZONE 'UTC')::TIMESTAMP, temp.map, temp.partition_id, temp.event_type, temp.x, temp.y, temp.z, temp.custom_data
FROM (SELECT game_events.actor_id, game_events.universe_time, game_events.map, game_events.partition_id, game_events.event_type, game_events.x, game_events.y, game_events.z, game_events.custom_data FROM game_events WHERE game_events.actor_id = in_actor_id AND game_events.player_facing_event = true ORDER BY game_events.universe_time DESC LIMIT in_limit_entries_num) temp
ORDER BY temp.universe_time ASC;
END
$function$

View File

@@ -0,0 +1,13 @@
-- load_static_encounter_name(in_map_name text, in_package_name text, in_actor_name text) -> TABLE(encounter_name text, waiting_for_reset boolean)
-- oid: 58462 kind: FUNCTION category: misc
CREATE OR REPLACE FUNCTION dune.load_static_encounter_name(in_map_name text, in_package_name text, in_actor_name text)
RETURNS TABLE(encounter_name text, waiting_for_reset boolean)
LANGUAGE plpgsql
AS $function$
BEGIN
RETURN QUERY
SELECT t.encounter_name, t.waiting_for_reset
FROM encounters_static as t
WHERE t.map_name = in_map_name AND t.package_name = in_package_name AND t.actor_name = in_actor_name;
END; $function$

View File

@@ -0,0 +1,11 @@
-- parties_get_exclusive_operation_lock() -> void
-- oid: 58483 kind: FUNCTION category: misc
CREATE OR REPLACE FUNCTION dune.parties_get_exclusive_operation_lock()
RETURNS void
LANGUAGE plpgsql
AS $function$
BEGIN
PERFORM pg_advisory_xact_lock(9457135); -- Parties in leet :/
END;
$function$

View File

@@ -0,0 +1,17 @@
-- remove_members_offline_for(in_interval_seconds integer) -> void
-- oid: 58522 kind: FUNCTION category: misc
CREATE OR REPLACE FUNCTION dune.remove_members_offline_for(in_interval_seconds integer)
RETURNS void
LANGUAGE plpgsql
AS $function$
BEGIN
PERFORM parties_get_exclusive_operation_lock();
PERFORM remove_party_member(party_members.player_id, 0::SMALLINT) FROM party_members
JOIN player_state ON player_state.player_controller_id = party_members.player_id
WHERE player_state.online_status = 'Offline'
AND CURRENT_TIMESTAMP > player_state.last_avatar_activity + INTERVAL '1 second' * in_interval_seconds;
END
$function$

View File

@@ -0,0 +1,14 @@
-- save_login_target_dimension(in_fls_id text, in_login_target_dimension_index integer) -> void
-- oid: 58550 kind: FUNCTION category: misc
CREATE OR REPLACE FUNCTION dune.save_login_target_dimension(in_fls_id text, in_login_target_dimension_index integer)
RETURNS void
LANGUAGE plpgsql
AS $function$
BEGIN
INSERT INTO player_travel_state (fls_id, login_target_dimension_index)
VALUES (in_fls_id, in_login_target_dimension_index)
ON CONFLICT (fls_id) DO UPDATE
SET login_target_dimension_index = EXCLUDED.login_target_dimension_index;
END;
$function$

View File

@@ -0,0 +1,14 @@
-- save_static_encounter_name(in_map_name text, in_package_name text, in_actor_name text, in_encounter_name text) -> void
-- oid: 58564 kind: FUNCTION category: misc
CREATE OR REPLACE FUNCTION dune.save_static_encounter_name(in_map_name text, in_package_name text, in_actor_name text, in_encounter_name text)
RETURNS void
LANGUAGE plpgsql
AS $function$
BEGIN
INSERT INTO encounters_static(map_name, package_name, actor_name, encounter_name, waiting_for_reset)
VALUES(in_map_name, in_package_name, in_actor_name, in_encounter_name, false)
ON CONFLICT(map_name, package_name, actor_name)
DO UPDATE SET encounter_name = in_encounter_name, waiting_for_reset = false
WHERE encounters_static.map_name = in_map_name AND encounters_static.package_name = in_package_name AND encounters_static.actor_name = in_actor_name;
END; $function$

View File

@@ -0,0 +1,12 @@
-- save_static_encounter_waiting_for_reset(in_map_name text, in_package_name text, in_actor_name text, in_waiting_for_reset boolean) -> void
-- oid: 58565 kind: FUNCTION category: misc
CREATE OR REPLACE FUNCTION dune.save_static_encounter_waiting_for_reset(in_map_name text, in_package_name text, in_actor_name text, in_waiting_for_reset boolean)
RETURNS void
LANGUAGE plpgsql
AS $function$
BEGIN
UPDATE encounters_static
SET waiting_for_reset = in_waiting_for_reset
WHERE encounters_static.map_name = in_map_name AND encounters_static.package_name = in_package_name AND encounters_static.actor_name = in_actor_name;
END; $function$

View File

@@ -0,0 +1,22 @@
-- update_consumed_per_player_lore(in_actor_id bigint, in_consumed_bit_array bit, in_use_temporary boolean) -> void
-- oid: 58617 kind: FUNCTION category: misc
CREATE OR REPLACE FUNCTION dune.update_consumed_per_player_lore(in_actor_id bigint, in_consumed_bit_array bit, in_use_temporary boolean)
RETURNS void
LANGUAGE plpgsql
AS $function$
BEGIN
IF in_use_temporary THEN
INSERT INTO consumed_temporary_per_player_lore(actor_id, consumed_bit_array)
VALUES(in_actor_id, in_consumed_bit_array)
ON CONFLICT (actor_id)
DO UPDATE SET
consumed_bit_array = in_consumed_bit_array;
ELSE
INSERT INTO consumed_per_player_lore(actor_id, consumed_bit_array)
VALUES(in_actor_id, in_consumed_bit_array)
ON CONFLICT (actor_id)
DO UPDATE SET
consumed_bit_array = in_consumed_bit_array;
END IF;
END; $function$

View File

@@ -0,0 +1,14 @@
-- update_inventories_data(in_inventory_data_list dune.inventorydata[]) -> void
-- oid: 58622 kind: FUNCTION category: misc
CREATE OR REPLACE FUNCTION dune.update_inventories_data(in_inventory_data_list dune.inventorydata[])
RETURNS void
LANGUAGE plpgsql
AS $function$
BEGIN
UPDATE inventories
SET inventory_type = (u).inventory_type, max_item_count = (u).max_item_count, max_item_volume = (u).max_item_volume
FROM (SELECT inventory_id, inventory_type, max_item_count, max_item_volume FROM UNNEST(in_inventory_data_list)) u
WHERE id = (u).inventory_id;
END
$function$

View File

@@ -0,0 +1,16 @@
-- update_resourcefield_states(in_map text, in_dimension_index integer, in_field_kind_id smallint, in_field_states dune.resourcefieldstateentry[]) -> void
-- oid: 58631 kind: FUNCTION category: misc
CREATE OR REPLACE FUNCTION dune.update_resourcefield_states(in_map text, in_dimension_index integer, in_field_kind_id smallint, in_field_states dune.resourcefieldstateentry[])
RETURNS void
LANGUAGE plpgsql
AS $function$
BEGIN
INSERT INTO resourcefield_state(map, dimension_index, field_kind_id, field_id, spawn_time, value_remaining)
SELECT in_map, in_dimension_index, in_field_kind_id, * FROM UNNEST(in_field_states)
ON CONFLICT("field_id", "map", "dimension_index") DO
UPDATE
SET value_remaining = EXCLUDED.value_remaining
WHERE resourcefield_state.field_id = EXCLUDED.field_id AND resourcefield_state.map = in_map AND resourcefield_state.dimension_index = in_dimension_index;
END
$function$

View File

@@ -0,0 +1,14 @@
-- update_sell_orders_categories(category_update_data dune.exchangecategoryupdatedata[]) -> void
-- oid: 58634 kind: FUNCTION category: misc
CREATE OR REPLACE FUNCTION dune.update_sell_orders_categories(category_update_data dune.exchangecategoryupdatedata[])
RETURNS void
LANGUAGE plpgsql
AS $function$
DECLARE
BEGIN
UPDATE dune_exchange_orders SET category_mask = update_data.mask, category_depth = update_data.depth
FROM UNNEST(category_update_data) update_data
WHERE update_data.item_template_id = dune_exchange_orders.template_id;
END
$function$

View File

@@ -0,0 +1,29 @@
-- upgrade_location_data_list(in_location_data_list jsonb, in_map_field_name text) -> jsonb
-- oid: 58644 kind: FUNCTION category: misc
CREATE OR REPLACE FUNCTION dune.upgrade_location_data_list(in_location_data_list jsonb, in_map_field_name text)
RETURNS jsonb
LANGUAGE plpgsql
AS $function$
BEGIN
return COALESCE(
(
SELECT jsonb_agg(
CASE
WHEN elem ? in_map_field_name
THEN
jsonb_set(
elem,
('{' || in_map_field_name ||'}')::Text[],
upgrade_map_value(elem->in_map_field_name)
)
ELSE
elem
END
)
FROM jsonb_array_elements(in_location_data_list) elem
),
'[]'::jsonb
);
END
$function$

View File

@@ -0,0 +1,51 @@
-- upgrade_map_name(in_map_name text) -> text
-- oid: 58645 kind: FUNCTION category: misc
CREATE OR REPLACE FUNCTION dune.upgrade_map_name(in_map_name text)
RETURNS text
LANGUAGE plpgsql
AS $function$
BEGIN
return
CASE in_map_name
WHEN 'Survival_1' THEN 'HaggaBasin'
WHEN 'SH_HarkoVillage' THEN 'HarkoVillage'
WHEN 'DeepDesert_1' THEN 'DeepDesert'
WHEN 'Overmap' THEN 'Overland'
WHEN 'SH_Arrakeen' THEN 'Arrakeen'
WHEN 'CB_Story_Hephaestus' THEN 'WreckOfHephaestus'
WHEN 'CB_Story_Ecolab_Carthag' THEN 'BeneathCarthag'
WHEN 'CB_SurvivalChallenge_Station_15' THEN 'Station15'
WHEN 'CB_Story_WaterFatManor' THEN 'WaterFat'
WHEN 'SH_FallenLight' THEN 'FallenLight'
WHEN 'Story_ProcesVerbal' THEN 'ProcesVerbal'
WHEN 'DLC_Story_LostHarvest' THEN 'LostHarvest'
WHEN 'DLC_Story_LostHarvest_EcolabA' THEN 'LostHarvest_EcolabA'
WHEN 'DLC_Story_LostHarvest_EcolabB' THEN 'LostHarvest_EcolabB'
WHEN 'DLC_Story_LostHarvest_ForgottenLab' THEN 'LostHarvest_ForgottenLab'
WHEN 'Story_ArtOfKanly' THEN 'ArtOfKanly'
WHEN 'Story_HeighlinerDungeon' THEN 'HeighlinerDungeon'
WHEN 'CB_Dungeon_Hephaestus' THEN 'WreckOfHephaestusDungeon'
WHEN 'CB_Dungeon_OldCarthag' THEN 'OldCarthagDungeon'
WHEN 'CB_Story_BanditFortress01' THEN 'SandfliesFortress'
WHEN 'CB_Overland_S_05' THEN 'ClosedOffTestingStationIsland'
WHEN 'CB_Overland_S_06' THEN 'GroundVehicleTimeTrialIsland'
WHEN 'CB_Overland_S_04' THEN 'ErythriteCaveIsland'
WHEN 'CB_Overland_M_01' THEN 'RadioactiveShipwreck'
WHEN 'CB_Overland_S_07' THEN 'TheRuinsOfTsimpo'
WHEN 'Story_Faction_Outpost_Hark' THEN 'Story_Faction_Outpost_Hark'
WHEN 'Story_Faction_Outpost_Atre' THEN 'Story_Faction_Outpost_Atre'
WHEN 'CB_Ecolab_Bronze_Green_089' THEN 'RadiationDungeon'
WHEN 'CB_Ecolab_Bronze_Green_152' THEN 'ElectricityDungeon'
WHEN 'CB_Ecolab_Bronze_Green_195' THEN 'PoisonDungeon'
WHEN 'CB_Ecolab_Bronze_Green_024' THEN 'DarknessDungeon'
WHEN 'CB_Ecolab_Bronze_Green_136' THEN 'FireDungeon'
WHEN 'CB_Story_DestroyedZanovar' THEN 'DestroyedZanovar'
WHEN 'CB_Story_OrbitalMonitor' THEN 'OrbitalMonitor'
WHEN 'CB_Dungeon_TheFacility' THEN 'FacilityDungeon'
WHEN 'CB_Dungeon_ThePit' THEN 'PitDungeon'
WHEN 'CB_Overland_S_08' THEN 'WindPass'
ELSE in_map_name
END;
END;
$function$

View File

@@ -0,0 +1,18 @@
-- upgrade_map_value(in_value jsonb) -> jsonb
-- oid: 58646 kind: FUNCTION category: misc
CREATE OR REPLACE FUNCTION dune.upgrade_map_value(in_value jsonb)
RETURNS jsonb
LANGUAGE plpgsql
AS $function$
BEGIN
RETURN
CASE
WHEN jsonb_typeof(in_value) = 'string'
THEN
jsonb_build_object('Name', upgrade_map_name(in_value->>0))
ELSE
in_value
END;
END;
$function$

View File

@@ -0,0 +1,17 @@
-- zero_transform() -> dune.transform
-- oid: 58651 kind: FUNCTION category: misc
CREATE OR REPLACE FUNCTION dune.zero_transform()
RETURNS dune.transform
LANGUAGE plpgsql
IMMUTABLE
AS $function$
BEGIN
RETURN (
ROW(
ROW(0.0, 0.0, 0.0)::Vector,
ROW(0.0, 0.0, 0.0, 1.0)::Quaternion
)::Transform
);
END;
$function$